root / hw / realview.c @ abcebc7e
History | View | Annotate | Download (4.2 kB)
1 |
/*
|
---|---|
2 |
* ARM RealView Baseboard System emulation.
|
3 |
*
|
4 |
* Copyright (c) 2006 CodeSourcery.
|
5 |
* Written by Paul Brook
|
6 |
*
|
7 |
* This code is licenced under the GPL.
|
8 |
*/
|
9 |
|
10 |
#include "vl.h" |
11 |
#include "arm_pic.h" |
12 |
|
13 |
/* Board init. */
|
14 |
|
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) |
19 |
{ |
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; |
27 |
|
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);
|
34 |
|
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); |
43 |
|
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]); |
48 |
|
49 |
/* DMA controller is optional, apparently. */
|
50 |
pl080_init(0x10030000, pic, 24, 2); |
51 |
|
52 |
sp804_init(0x10011000, pic, 4); |
53 |
sp804_init(0x10012000, pic, 5); |
54 |
|
55 |
pl110_init(ds, 0x10020000, pic, 23, 1); |
56 |
|
57 |
pci_bus = pci_vpb_init(pic, 48, 1); |
58 |
if (usb_enabled) {
|
59 |
usb_ohci_init(pci_bus, 3, -1); |
60 |
} |
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); |
65 |
} |
66 |
} |
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);
|
75 |
} |
76 |
} |
77 |
|
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. */
|
129 |
|
130 |
arm_load_kernel(ram_size, kernel_filename, kernel_cmdline, |
131 |
initrd_filename, 0x33b);
|
132 |
} |
133 |
|
134 |
QEMUMachine realview_machine = { |
135 |
"realview",
|
136 |
"ARM RealView Emulation Baseboard (ARM926EJ-S)",
|
137 |
realview_init |
138 |
}; |