2 * Creation Date: <2004/08/28 18:38:22 greg>
3 * Time-stamp: <2004/08/28 18:38:22 greg>
7 * Copyright (C) 2004, Greg Watson
11 * Copyright (C) 2003, 2004 Samuel Rydh (samuel@ibrium.se)
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
20 #include "kernel/kernel.h"
21 #include "arch/common/nvram.h"
22 #include "libc/vsprintf.h"
23 #include "libc/string.h"
24 #include "briq/briq.h"
27 #define UART_BASE 0x3f8
29 unsigned long virt_offset = 0;
38 fatal_error( const char *err )
40 printk("Fatal error: %s\n", err );
45 panic( const char *err )
47 printk("Panic: %s\n", err );
50 /* won't come here... this keeps the gcc happy */
56 /************************************************************************/
57 /* print using OSI interface */
58 /************************************************************************/
63 printk( const char *fmt, ... )
70 i = vnsprintf(buf, sizeof(buf), fmt, args);
73 for( p=buf; *p; p++ ) {
76 if( do_indent++ == 1 ) {
87 /************************************************************************/
89 /************************************************************************/
91 static int ttychar = -1;
103 while (!(inb(UART_BASE + 0x05) & 0x20))
106 while (!(inb(UART_BASE + 0x05) & 0x40))
119 ttychar = inb(UART_BASE);
120 return (ttychar >= 0);
132 return inb(UART_BASE);
143 return tty_putchar(c);
147 /************************************************************************/
148 /* briQ specific stuff */
149 /************************************************************************/
151 static char nvram[2048];
156 static char hexdigit[] = "0123456789abcdef";
158 for (i = 0; i < 16*4; i++)
160 printk ("%c", hexdigit[nvram[i] >> 4]);
161 printk ("%c", hexdigit[nvram[i] % 16]);
175 arch_nvram_size( void )
177 return sizeof(nvram);
181 arch_nvram_put( char *buf )
183 memcpy(nvram, buf, sizeof(nvram));
184 printk("new nvram:\n");
189 arch_nvram_get( char *buf )
191 memcpy(buf, nvram, sizeof(nvram));
192 printk("current nvram:\n");