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 "pearpc/pearpc.h"
27 #define UART_BASE 0x3f8
30 unsigned long virt_offset = 0;
40 fatal_error( const char *err )
42 printk("Fatal error: %s\n", err );
47 panic( const char *err )
49 printk("Panic: %s\n", err );
52 /* won't come here... this keeps the gcc happy */
58 /************************************************************************/
59 /* print using OSI interface */
60 /************************************************************************/
65 printk( const char *fmt, ... )
72 i = vsnprintf(buf, sizeof(buf), fmt, args);
75 for( p=buf; *p; p++ ) {
78 if( do_indent++ == 1 ) {
89 /************************************************************************/
91 /************************************************************************/
93 static int ttychar = -1;
105 while (!(inb(UART_BASE + 0x05) & 0x20))
108 while (!(inb(UART_BASE + 0x05) & 0x40))
121 ttychar = inb(UART_BASE);
122 return (ttychar >= 0);
134 return inb(UART_BASE);
145 return tty_putchar(c);
149 /************************************************************************/
150 /* briQ specific stuff */
151 /************************************************************************/
153 #define IO_NVRAM_PA_START 0x80860000
154 #define IO_NVRAM_PA_END 0x80880000
156 static char *nvram=(char *)IO_NVRAM_PA_START;
161 static char hexdigit[] = "0123456789abcdef";
163 for (i = 0; i < 16*4; i++)
165 printk ("%c", hexdigit[nvram[i<<4] >> 4]);
166 printk ("%c", hexdigit[nvram[i<<4] % 16]);
180 arch_nvram_size( void )
182 return (IO_NVRAM_PA_END-IO_NVRAM_PA_START)>>4;
186 arch_nvram_put( char *buf )
189 for (i=0; i<(IO_NVRAM_PA_END-IO_NVRAM_PA_START)>>4; i++)
191 // memcpy(nvram, buf, IO_NVRAM_PA_END-IO_NVRAM_PA_START);
192 printk("new nvram:\n");
197 arch_nvram_get( char *buf )
200 for (i=0; i<(IO_NVRAM_PA_END-IO_NVRAM_PA_START)>>4; i++)
203 //memcpy(buf, nvram, IO_NVRAM_PA_END-IO_NVRAM_PA_START);
204 printk("current nvram:\n");