1 #include <linux/init.h>
2 #include <linux/errno.h>
3 #include <linux/console.h>
5 #include <asm/sibyte/board.h>
7 #include <asm/fw/cfe/cfe_api.h>
8 #include <asm/fw/cfe/cfe_error.h>
10 extern int cfe_cons_handle
;
12 static void cfe_console_write(struct console
*cons
, const char *str
,
17 for (i
=0, last
=0; i
<count
; i
++) {
19 /* XXXKW can/should this ever happen? */
23 written
= cfe_write(cfe_cons_handle
, &str
[last
], i
-last
);
28 while (cfe_write(cfe_cons_handle
, "\r", 1) <= 0)
34 written
= cfe_write(cfe_cons_handle
, &str
[last
], count
-last
);
38 } while (last
< count
);
43 static int cfe_console_setup(struct console
*cons
, char *str
)
46 /* XXXKW think about interaction with 'console=' cmdline arg */
47 /* If none of the console options are configured, the build will break. */
48 if (cfe_getenv("BOOT_CONSOLE", consdev
, 32) >= 0) {
49 #ifdef CONFIG_SERIAL_SB1250_DUART
50 if (!strcmp(consdev
, "uart0")) {
52 } else if (!strcmp(consdev
, "uart1")) {
55 #ifdef CONFIG_VGA_CONSOLE
56 } else if (!strcmp(consdev
, "pcconsole0")) {
65 static struct console sb1250_cfe_cons
= {
67 .write
= cfe_console_write
,
68 .setup
= cfe_console_setup
,
69 .flags
= CON_PRINTBUFFER
,
73 static int __init
sb1250_cfe_console_init(void)
75 register_console(&sb1250_cfe_cons
);
79 console_initcall(sb1250_cfe_console_init
);