44 #define EARLY_BOOTUP_DEBUG
47 #include <linux/kernel.h>
49 #include <linux/string.h>
52 #include <linux/tty.h>
59 static void pdc_console_write(
struct console *co,
const char *
s,
unsigned count)
68 spin_unlock_irqrestore(&pdc_console_lock, flags);
78 spin_unlock_irqrestore(&pdc_console_lock, flags);
88 #if defined(CONFIG_PDC_CONSOLE)
92 #define PDC_CONS_POLL_DELAY (30 * HZ / 1000)
94 static void pdc_console_poll(
unsigned long unused);
95 static DEFINE_TIMER(pdc_console_timer, pdc_console_poll, 0, 0);
101 mod_timer(&pdc_console_timer, jiffies + PDC_CONS_POLL_DELAY);
108 if (tty->
count == 1) {
114 static int pdc_console_tty_write(
struct tty_struct *tty,
const unsigned char *
buf,
int count)
116 pdc_console_write(
NULL, buf, count);
120 static int pdc_console_tty_write_room(
struct tty_struct *tty)
125 static int pdc_console_tty_chars_in_buffer(
struct tty_struct *tty)
131 .
open = pdc_console_tty_open,
132 .close = pdc_console_tty_close,
133 .write = pdc_console_tty_write,
134 .write_room = pdc_console_tty_write_room,
135 .chars_in_buffer = pdc_console_tty_chars_in_buffer,
138 static void pdc_console_poll(
unsigned long unused)
150 tty_insert_flip_char(tty, data & 0xFF,
TTY_NORMAL);
160 mod_timer(&pdc_console_timer, jiffies + PDC_CONS_POLL_DELAY);
163 static struct tty_driver *pdc_console_tty_driver;
165 static int __init pdc_console_tty_driver_init(
void)
177 if (tmp == &pdc_cons)
182 printk(
KERN_INFO "PDC console driver not registered anymore, not creating %s\n", pdc_cons.name);
186 printk(
KERN_INFO "The PDC console driver is still registered, removing CON_BOOT flag\n");
191 pdc_console_tty_driver = alloc_tty_driver(1);
193 if (!pdc_console_tty_driver)
197 pdc_console_tty_driver->
name =
"ttyB";
209 printk(
KERN_ERR "Unable to register the PDC console TTY driver\n");
221 return pdc_console_tty_driver;
224 #define pdc_console_device NULL
227 static struct console pdc_cons = {
229 .write = pdc_console_write,
231 .setup = pdc_console_setup,
236 static int pdc_console_initialized;
238 static void pdc_console_init_force(
void)
240 if (pdc_console_initialized)
242 ++pdc_console_initialized;
254 #if defined(EARLY_BOOTUP_DEBUG) || defined(CONFIG_PDC_CONSOLE)
255 pdc_console_init_force();
257 #ifdef EARLY_BOOTUP_DEBUG
275 if (pdc_console_initialized)
286 pdc_console_init_force();