kvm: configure: better fix for --kerneldir
[qemu-kvm/fedora.git] / hw / realview.c
blobf968e1a187d00ed04e3a6a7816c2129e5bf4ced5
1 /*
2 * ARM RealView Baseboard System emulation.
4 * Copyright (c) 2006 CodeSourcery.
5 * Written by Paul Brook
7 * This code is licenced under the GPL.
8 */
10 #include "vl.h"
11 #include "arm_pic.h"
13 /* Board init. */
15 static void realview_init(int ram_size, int vga_ram_size, int boot_device,
16 DisplayState *ds, const char **fd_filename, int snapshot,
17 const char *kernel_filename, const char *kernel_cmdline,
18 const char *initrd_filename)
20 CPUState *env;
21 void *pic;
22 void *scsi_hba;
23 PCIBus *pci_bus;
24 NICInfo *nd;
25 int n;
26 int done_smc = 0;
28 env = cpu_init();
29 cpu_arm_set_model(env, ARM_CPUID_ARM926);
30 //cpu_arm_set_model(env, ARM_CPUID_ARM11MPCORE);
31 /* ??? RAM shoud repeat to fill physical memory space. */
32 /* SDRAM at address zero. */
33 cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
35 arm_sysctl_init(0x10000000, 0xc1400400);
36 pic = arm_pic_init_cpu(env);
37 /* ??? The documentation says GIC1 is nFIQ and either GIC2 or GIC3
38 is nIRQ (there are inconsistencies). However Linux 2.6.17 expects
39 GIC1 to be nIRQ and ignores all the others, so do that for now. */
40 pic = arm_gic_init(0x10040000, pic, ARM_PIC_CPU_IRQ);
41 pl050_init(0x10006000, pic, 20, 0);
42 pl050_init(0x10007000, pic, 21, 1);
44 pl011_init(0x10009000, pic, 12, serial_hds[0]);
45 pl011_init(0x1000a000, pic, 13, serial_hds[1]);
46 pl011_init(0x1000b000, pic, 14, serial_hds[2]);
47 pl011_init(0x1000c000, pic, 15, serial_hds[3]);
49 /* DMA controller is optional, apparently. */
50 pl080_init(0x10030000, pic, 24, 2);
52 sp804_init(0x10011000, pic, 4);
53 sp804_init(0x10012000, pic, 5);
55 pl110_init(ds, 0x10020000, pic, 23, 1);
57 pci_bus = pci_vpb_init(pic, 48, 1);
58 if (usb_enabled) {
59 usb_ohci_init(pci_bus, 3, -1);
61 scsi_hba = lsi_scsi_init(pci_bus, -1);
62 for (n = 0; n < MAX_DISKS; n++) {
63 if (bs_table[n]) {
64 lsi_scsi_attach(scsi_hba, bs_table[n], n);
67 for(n = 0; n < nb_nics; n++) {
68 nd = &nd_table[n];
69 if (!nd->model)
70 nd->model = done_smc ? "rtl8139" : "smc91c111";
71 if (strcmp(nd->model, "smc91c111") == 0) {
72 smc91c111_init(nd, 0x4e000000, pic, 28);
73 } else {
74 pci_nic_init(pci_bus, nd, -1);
78 /* Memory map for RealView Emulation Baseboard: */
79 /* 0x10000000 System registers. */
80 /* 0x10001000 System controller. */
81 /* 0x10002000 Two-Wire Serial Bus. */
82 /* 0x10003000 Reserved. */
83 /* 0x10004000 AACI. */
84 /* 0x10005000 MCI. */
85 /* 0x10006000 KMI0. */
86 /* 0x10007000 KMI1. */
87 /* 0x10008000 Character LCD. */
88 /* 0x10009000 UART0. */
89 /* 0x1000a000 UART1. */
90 /* 0x1000b000 UART2. */
91 /* 0x1000c000 UART3. */
92 /* 0x1000d000 SSPI. */
93 /* 0x1000e000 SCI. */
94 /* 0x1000f000 Reserved. */
95 /* 0x10010000 Watchdog. */
96 /* 0x10011000 Timer 0+1. */
97 /* 0x10012000 Timer 2+3. */
98 /* 0x10013000 GPIO 0. */
99 /* 0x10014000 GPIO 1. */
100 /* 0x10015000 GPIO 2. */
101 /* 0x10016000 Reserved. */
102 /* 0x10017000 RTC. */
103 /* 0x10018000 DMC. */
104 /* 0x10019000 PCI controller config. */
105 /* 0x10020000 CLCD. */
106 /* 0x10030000 DMA Controller. */
107 /* 0x10040000 GIC1 (FIQ1). */
108 /* 0x10050000 GIC2 (IRQ1). */
109 /* 0x10060000 GIC3 (FIQ2). */
110 /* 0x10070000 GIC4 (IRQ2). */
111 /* 0x10080000 SMC. */
112 /* 0x40000000 NOR flash. */
113 /* 0x44000000 DoC flash. */
114 /* 0x48000000 SRAM. */
115 /* 0x4c000000 Configuration flash. */
116 /* 0x4e000000 Ethernet. */
117 /* 0x4f000000 USB. */
118 /* 0x50000000 PISMO. */
119 /* 0x54000000 PISMO. */
120 /* 0x58000000 PISMO. */
121 /* 0x5c000000 PISMO. */
122 /* 0x60000000 PCI. */
123 /* 0x61000000 PCI Self Config. */
124 /* 0x62000000 PCI Config. */
125 /* 0x63000000 PCI IO. */
126 /* 0x64000000 PCI mem 0. */
127 /* 0x68000000 PCI mem 1. */
128 /* 0x6c000000 PCI mem 2. */
130 arm_load_kernel(env, ram_size, kernel_filename, kernel_cmdline,
131 initrd_filename, 0x33b);
134 QEMUMachine realview_machine = {
135 "realview",
136 "ARM RealView Emulation Baseboard (ARM926EJ-S)",
137 realview_init
140 * ARM RealView Baseboard System emulation.
142 * Copyright (c) 2006 CodeSourcery.
143 * Written by Paul Brook
145 * This code is licenced under the GPL.
148 #include "vl.h"
149 #include "arm_pic.h"
151 /* Board init. */
153 static void realview_init(int ram_size, int vga_ram_size, int boot_device,
154 DisplayState *ds, const char **fd_filename, int snapshot,
155 const char *kernel_filename, const char *kernel_cmdline,
156 const char *initrd_filename)
158 CPUState *env;
159 void *pic;
160 void *scsi_hba;
161 PCIBus *pci_bus;
162 NICInfo *nd;
163 int n;
164 int done_smc = 0;
166 env = cpu_init();
167 cpu_arm_set_model(env, ARM_CPUID_ARM926);
168 //cpu_arm_set_model(env, ARM_CPUID_ARM11MPCORE);
169 /* ??? RAM shoud repeat to fill physical memory space. */
170 /* SDRAM at address zero. */
171 cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
173 arm_sysctl_init(0x10000000, 0xc1400400);
174 pic = arm_pic_init_cpu(env);
175 /* ??? The documentation says GIC1 is nFIQ and either GIC2 or GIC3
176 is nIRQ (there are inconsistencies). However Linux 2.6.17 expects
177 GIC1 to be nIRQ and ignores all the others, so do that for now. */
178 pic = arm_gic_init(0x10040000, pic, ARM_PIC_CPU_IRQ);
179 pl050_init(0x10006000, pic, 20, 0);
180 pl050_init(0x10007000, pic, 21, 1);
182 pl011_init(0x10009000, pic, 12, serial_hds[0]);
183 pl011_init(0x1000a000, pic, 13, serial_hds[1]);
184 pl011_init(0x1000b000, pic, 14, serial_hds[2]);
185 pl011_init(0x1000c000, pic, 15, serial_hds[3]);
187 /* DMA controller is optional, apparently. */
188 pl080_init(0x10030000, pic, 24, 2);
190 sp804_init(0x10011000, pic, 4);
191 sp804_init(0x10012000, pic, 5);
193 pl110_init(ds, 0x10020000, pic, 23, 1);
195 pci_bus = pci_vpb_init(pic, 48, 1);
196 if (usb_enabled) {
197 usb_ohci_init(pci_bus, 3, -1);
199 scsi_hba = lsi_scsi_init(pci_bus, -1);
200 for (n = 0; n < MAX_DISKS; n++) {
201 if (bs_table[n]) {
202 lsi_scsi_attach(scsi_hba, bs_table[n], n);
205 for(n = 0; n < nb_nics; n++) {
206 nd = &nd_table[n];
207 if (!nd->model)
208 nd->model = done_smc ? "rtl8139" : "smc91c111";
209 if (strcmp(nd->model, "smc91c111") == 0) {
210 smc91c111_init(nd, 0x4e000000, pic, 28);
211 } else {
212 pci_nic_init(pci_bus, nd, -1);
216 /* Memory map for RealView Emulation Baseboard: */
217 /* 0x10000000 System registers. */
218 /* 0x10001000 System controller. */
219 /* 0x10002000 Two-Wire Serial Bus. */
220 /* 0x10003000 Reserved. */
221 /* 0x10004000 AACI. */
222 /* 0x10005000 MCI. */
223 /* 0x10006000 KMI0. */
224 /* 0x10007000 KMI1. */
225 /* 0x10008000 Character LCD. */
226 /* 0x10009000 UART0. */
227 /* 0x1000a000 UART1. */
228 /* 0x1000b000 UART2. */
229 /* 0x1000c000 UART3. */
230 /* 0x1000d000 SSPI. */
231 /* 0x1000e000 SCI. */
232 /* 0x1000f000 Reserved. */
233 /* 0x10010000 Watchdog. */
234 /* 0x10011000 Timer 0+1. */
235 /* 0x10012000 Timer 2+3. */
236 /* 0x10013000 GPIO 0. */
237 /* 0x10014000 GPIO 1. */
238 /* 0x10015000 GPIO 2. */
239 /* 0x10016000 Reserved. */
240 /* 0x10017000 RTC. */
241 /* 0x10018000 DMC. */
242 /* 0x10019000 PCI controller config. */
243 /* 0x10020000 CLCD. */
244 /* 0x10030000 DMA Controller. */
245 /* 0x10040000 GIC1 (FIQ1). */
246 /* 0x10050000 GIC2 (IRQ1). */
247 /* 0x10060000 GIC3 (FIQ2). */
248 /* 0x10070000 GIC4 (IRQ2). */
249 /* 0x10080000 SMC. */
250 /* 0x40000000 NOR flash. */
251 /* 0x44000000 DoC flash. */
252 /* 0x48000000 SRAM. */
253 /* 0x4c000000 Configuration flash. */
254 /* 0x4e000000 Ethernet. */
255 /* 0x4f000000 USB. */
256 /* 0x50000000 PISMO. */
257 /* 0x54000000 PISMO. */
258 /* 0x58000000 PISMO. */
259 /* 0x5c000000 PISMO. */
260 /* 0x60000000 PCI. */
261 /* 0x61000000 PCI Self Config. */
262 /* 0x62000000 PCI Config. */
263 /* 0x63000000 PCI IO. */
264 /* 0x64000000 PCI mem 0. */
265 /* 0x68000000 PCI mem 1. */
266 /* 0x6c000000 PCI mem 2. */
268 arm_load_kernel(env, ram_size, kernel_filename, kernel_cmdline,
269 initrd_filename, 0x33b);
272 QEMUMachine realview_machine = {
273 "realview",
274 "ARM RealView Emulation Baseboard (ARM926EJ-S)",
275 realview_init