Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
This commit is contained in:
80
arch/mips/sibyte/cfe/console.c
Normal file
80
arch/mips/sibyte/cfe/console.c
Normal file
@@ -0,0 +1,80 @@
|
||||
#include <linux/config.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/console.h>
|
||||
|
||||
#include <asm/sibyte/board.h>
|
||||
|
||||
#include "cfe_api.h"
|
||||
#include "cfe_error.h"
|
||||
|
||||
extern int cfe_cons_handle;
|
||||
|
||||
static void cfe_console_write(struct console *cons, const char *str,
|
||||
unsigned int count)
|
||||
{
|
||||
int i, last, written;
|
||||
|
||||
for (i=0,last=0; i<count; i++) {
|
||||
if (!str[i])
|
||||
/* XXXKW can/should this ever happen? */
|
||||
return;
|
||||
if (str[i] == '\n') {
|
||||
do {
|
||||
written = cfe_write(cfe_cons_handle, &str[last], i-last);
|
||||
if (written < 0)
|
||||
;
|
||||
last += written;
|
||||
} while (last < i);
|
||||
while (cfe_write(cfe_cons_handle, "\r", 1) <= 0)
|
||||
;
|
||||
}
|
||||
}
|
||||
if (last != count) {
|
||||
do {
|
||||
written = cfe_write(cfe_cons_handle, &str[last], count-last);
|
||||
if (written < 0)
|
||||
;
|
||||
last += written;
|
||||
} while (last < count);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int cfe_console_setup(struct console *cons, char *str)
|
||||
{
|
||||
char consdev[32];
|
||||
/* XXXKW think about interaction with 'console=' cmdline arg */
|
||||
/* If none of the console options are configured, the build will break. */
|
||||
if (cfe_getenv("BOOT_CONSOLE", consdev, 32) >= 0) {
|
||||
#ifdef CONFIG_SIBYTE_SB1250_DUART
|
||||
if (!strcmp(consdev, "uart0")) {
|
||||
setleds("u0cn");
|
||||
} else if (!strcmp(consdev, "uart1")) {
|
||||
setleds("u1cn");
|
||||
#endif
|
||||
#ifdef CONFIG_VGA_CONSOLE
|
||||
} else if (!strcmp(consdev, "pcconsole0")) {
|
||||
setleds("pccn");
|
||||
#endif
|
||||
} else
|
||||
return -ENODEV;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct console sb1250_cfe_cons = {
|
||||
.name = "cfe",
|
||||
.write = cfe_console_write,
|
||||
.setup = cfe_console_setup,
|
||||
.flags = CON_PRINTBUFFER,
|
||||
.index = -1,
|
||||
};
|
||||
|
||||
static int __init sb1250_cfe_console_init(void)
|
||||
{
|
||||
register_console(&sb1250_cfe_cons);
|
||||
return 0;
|
||||
}
|
||||
|
||||
console_initcall(sb1250_cfe_console_init);
|
||||
Reference in New Issue
Block a user