Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / arch / ppc / qemu / qemu.c
1 /*
2  *   Creation Date: <2004/08/28 18:38:22 greg>
3  *   Time-stamp: <2004/08/28 18:38:22 greg>
4  *
5  *      <qemu.c>
6  *
7  *   Copyright (C) 2004, Greg Watson
8  *
9  *   derived from mol.c
10  *
11  *   Copyright (C) 2003, 2004 Samuel Rydh (samuel@ibrium.se)
12  *
13  *   This program is free software; you can redistribute it and/or
14  *   modify it under the terms of the GNU General Public License
15  *   version 2
16  *
17  */
18
19 #include "config.h"
20 #include "kernel/kernel.h"
21 #include "arch/common/nvram.h"
22 #include "libopenbios/bindings.h"
23 #include "drivers/drivers.h"
24 #include "libc/vsprintf.h"
25 #include "libc/string.h"
26 #include "libc/byteorder.h"
27 #include "qemu/qemu.h"
28 #include <stdarg.h>
29
30 //#define DUMP_NVRAM
31
32 unsigned long virt_offset = 0;
33
34 void
35 exit( int status __attribute__ ((unused)))
36 {
37         for (;;);
38 }
39
40 void
41 fatal_error( const char *err )
42 {
43         printk("Fatal error: %s\n", err );
44         exit(0);
45 }
46
47 void
48 panic( const char *err )
49 {
50         printk("Panic: %s\n", err );
51         exit(0);
52 }
53
54 static int do_indent;
55
56 int
57 printk( const char *fmt, ... )
58 {
59         char *p, buf[1024];
60         va_list args;
61         int i;
62
63         va_start(args, fmt);
64         i = vsnprintf(buf, sizeof(buf), fmt, args);
65         va_end(args);
66
67         for( p=buf; *p; p++ ) {
68                 if( *p == '\n' )
69                         do_indent = 0;
70                 if( do_indent++ == 1 ) {
71                         putchar( '>' );
72                         putchar( '>' );
73                         putchar( ' ' );
74                 }
75                 putchar( *p );
76         }
77         return i;
78 }
79
80 int arch_nvram_size(void)
81 {
82     if (is_apple()) {
83         return macio_get_nvram_size();
84     } else {
85         // not implemented
86     }
87     return 0;
88 }
89
90 void arch_nvram_put(char *buf)
91 {
92     if (is_apple()) {
93         macio_nvram_put(buf);
94     } else {
95         // not implemented
96     }
97 }
98
99 void arch_nvram_get(char *buf)
100 {
101     if (is_apple()) {
102         macio_nvram_get(buf);
103     } else {
104         // not implemented
105     }
106 }