root / hw / realview.c @ 36081602
History | View | Annotate | Download (4.3 kB)
1 | 5fafdf24 | ths | /*
|
---|---|---|---|
2 | e69954b9 | pbrook | * ARM RealView Baseboard System emulation.
|
3 | e69954b9 | pbrook | *
|
4 | a1bb27b1 | pbrook | * Copyright (c) 2006-2007 CodeSourcery.
|
5 | e69954b9 | pbrook | * Written by Paul Brook
|
6 | e69954b9 | pbrook | *
|
7 | e69954b9 | pbrook | * This code is licenced under the GPL.
|
8 | e69954b9 | pbrook | */
|
9 | e69954b9 | pbrook | |
10 | e69954b9 | pbrook | #include "vl.h" |
11 | e69954b9 | pbrook | #include "arm_pic.h" |
12 | e69954b9 | pbrook | |
13 | e69954b9 | pbrook | /* Board init. */
|
14 | e69954b9 | pbrook | |
15 | e69954b9 | pbrook | static void realview_init(int ram_size, int vga_ram_size, int boot_device, |
16 | e69954b9 | pbrook | DisplayState *ds, const char **fd_filename, int snapshot, |
17 | e69954b9 | pbrook | const char *kernel_filename, const char *kernel_cmdline, |
18 | 94fc95cd | j_mayer | const char *initrd_filename, const char *cpu_model) |
19 | e69954b9 | pbrook | { |
20 | e69954b9 | pbrook | CPUState *env; |
21 | d537cf6c | pbrook | qemu_irq *pic; |
22 | e69954b9 | pbrook | void *scsi_hba;
|
23 | e69954b9 | pbrook | PCIBus *pci_bus; |
24 | e69954b9 | pbrook | NICInfo *nd; |
25 | e69954b9 | pbrook | int n;
|
26 | e69954b9 | pbrook | int done_smc = 0; |
27 | e69954b9 | pbrook | |
28 | e69954b9 | pbrook | env = cpu_init(); |
29 | 3371d272 | pbrook | if (!cpu_model)
|
30 | 3371d272 | pbrook | cpu_model = "arm926";
|
31 | 3371d272 | pbrook | cpu_arm_set_model(env, cpu_model); |
32 | e69954b9 | pbrook | /* ??? RAM shoud repeat to fill physical memory space. */
|
33 | e69954b9 | pbrook | /* SDRAM at address zero. */
|
34 | e69954b9 | pbrook | cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
|
35 | e69954b9 | pbrook | |
36 | e69954b9 | pbrook | arm_sysctl_init(0x10000000, 0xc1400400); |
37 | e69954b9 | pbrook | pic = arm_pic_init_cpu(env); |
38 | e69954b9 | pbrook | /* ??? The documentation says GIC1 is nFIQ and either GIC2 or GIC3
|
39 | e69954b9 | pbrook | is nIRQ (there are inconsistencies). However Linux 2.6.17 expects
|
40 | e69954b9 | pbrook | GIC1 to be nIRQ and ignores all the others, so do that for now. */
|
41 | d537cf6c | pbrook | pic = arm_gic_init(0x10040000, pic[ARM_PIC_CPU_IRQ]);
|
42 | d537cf6c | pbrook | pl050_init(0x10006000, pic[20], 0); |
43 | d537cf6c | pbrook | pl050_init(0x10007000, pic[21], 1); |
44 | e69954b9 | pbrook | |
45 | d537cf6c | pbrook | pl011_init(0x10009000, pic[12], serial_hds[0]); |
46 | d537cf6c | pbrook | pl011_init(0x1000a000, pic[13], serial_hds[1]); |
47 | d537cf6c | pbrook | pl011_init(0x1000b000, pic[14], serial_hds[2]); |
48 | d537cf6c | pbrook | pl011_init(0x1000c000, pic[15], serial_hds[3]); |
49 | e69954b9 | pbrook | |
50 | e69954b9 | pbrook | /* DMA controller is optional, apparently. */
|
51 | d537cf6c | pbrook | pl080_init(0x10030000, pic[24], 2); |
52 | e69954b9 | pbrook | |
53 | d537cf6c | pbrook | sp804_init(0x10011000, pic[4]); |
54 | d537cf6c | pbrook | sp804_init(0x10012000, pic[5]); |
55 | e69954b9 | pbrook | |
56 | d537cf6c | pbrook | pl110_init(ds, 0x10020000, pic[23], 1); |
57 | e69954b9 | pbrook | |
58 | d537cf6c | pbrook | pl181_init(0x10005000, sd_bdrv, pic[17], pic[18]); |
59 | a1bb27b1 | pbrook | |
60 | 7e1543c2 | pbrook | pl031_init(0x10017000, pic[10]); |
61 | 7e1543c2 | pbrook | |
62 | e69954b9 | pbrook | pci_bus = pci_vpb_init(pic, 48, 1); |
63 | e69954b9 | pbrook | if (usb_enabled) {
|
64 | e24ad6f1 | pbrook | usb_ohci_init_pci(pci_bus, 3, -1); |
65 | e69954b9 | pbrook | } |
66 | e69954b9 | pbrook | scsi_hba = lsi_scsi_init(pci_bus, -1);
|
67 | e69954b9 | pbrook | for (n = 0; n < MAX_DISKS; n++) { |
68 | e69954b9 | pbrook | if (bs_table[n]) {
|
69 | e69954b9 | pbrook | lsi_scsi_attach(scsi_hba, bs_table[n], n); |
70 | e69954b9 | pbrook | } |
71 | e69954b9 | pbrook | } |
72 | e69954b9 | pbrook | for(n = 0; n < nb_nics; n++) { |
73 | e69954b9 | pbrook | nd = &nd_table[n]; |
74 | e69954b9 | pbrook | if (!nd->model)
|
75 | e69954b9 | pbrook | nd->model = done_smc ? "rtl8139" : "smc91c111"; |
76 | e69954b9 | pbrook | if (strcmp(nd->model, "smc91c111") == 0) { |
77 | d537cf6c | pbrook | smc91c111_init(nd, 0x4e000000, pic[28]); |
78 | e69954b9 | pbrook | } else {
|
79 | abcebc7e | ths | pci_nic_init(pci_bus, nd, -1);
|
80 | e69954b9 | pbrook | } |
81 | e69954b9 | pbrook | } |
82 | e69954b9 | pbrook | |
83 | e69954b9 | pbrook | /* Memory map for RealView Emulation Baseboard: */
|
84 | e69954b9 | pbrook | /* 0x10000000 System registers. */
|
85 | e69954b9 | pbrook | /* 0x10001000 System controller. */
|
86 | e69954b9 | pbrook | /* 0x10002000 Two-Wire Serial Bus. */
|
87 | e69954b9 | pbrook | /* 0x10003000 Reserved. */
|
88 | e69954b9 | pbrook | /* 0x10004000 AACI. */
|
89 | e69954b9 | pbrook | /* 0x10005000 MCI. */
|
90 | e69954b9 | pbrook | /* 0x10006000 KMI0. */
|
91 | e69954b9 | pbrook | /* 0x10007000 KMI1. */
|
92 | e69954b9 | pbrook | /* 0x10008000 Character LCD. */
|
93 | e69954b9 | pbrook | /* 0x10009000 UART0. */
|
94 | e69954b9 | pbrook | /* 0x1000a000 UART1. */
|
95 | e69954b9 | pbrook | /* 0x1000b000 UART2. */
|
96 | e69954b9 | pbrook | /* 0x1000c000 UART3. */
|
97 | e69954b9 | pbrook | /* 0x1000d000 SSPI. */
|
98 | e69954b9 | pbrook | /* 0x1000e000 SCI. */
|
99 | e69954b9 | pbrook | /* 0x1000f000 Reserved. */
|
100 | e69954b9 | pbrook | /* 0x10010000 Watchdog. */
|
101 | e69954b9 | pbrook | /* 0x10011000 Timer 0+1. */
|
102 | e69954b9 | pbrook | /* 0x10012000 Timer 2+3. */
|
103 | e69954b9 | pbrook | /* 0x10013000 GPIO 0. */
|
104 | e69954b9 | pbrook | /* 0x10014000 GPIO 1. */
|
105 | e69954b9 | pbrook | /* 0x10015000 GPIO 2. */
|
106 | e69954b9 | pbrook | /* 0x10016000 Reserved. */
|
107 | 7e1543c2 | pbrook | /* 0x10017000 RTC. */
|
108 | e69954b9 | pbrook | /* 0x10018000 DMC. */
|
109 | e69954b9 | pbrook | /* 0x10019000 PCI controller config. */
|
110 | e69954b9 | pbrook | /* 0x10020000 CLCD. */
|
111 | e69954b9 | pbrook | /* 0x10030000 DMA Controller. */
|
112 | e69954b9 | pbrook | /* 0x10040000 GIC1 (FIQ1). */
|
113 | e69954b9 | pbrook | /* 0x10050000 GIC2 (IRQ1). */
|
114 | e69954b9 | pbrook | /* 0x10060000 GIC3 (FIQ2). */
|
115 | e69954b9 | pbrook | /* 0x10070000 GIC4 (IRQ2). */
|
116 | e69954b9 | pbrook | /* 0x10080000 SMC. */
|
117 | e69954b9 | pbrook | /* 0x40000000 NOR flash. */
|
118 | e69954b9 | pbrook | /* 0x44000000 DoC flash. */
|
119 | e69954b9 | pbrook | /* 0x48000000 SRAM. */
|
120 | e69954b9 | pbrook | /* 0x4c000000 Configuration flash. */
|
121 | e69954b9 | pbrook | /* 0x4e000000 Ethernet. */
|
122 | e69954b9 | pbrook | /* 0x4f000000 USB. */
|
123 | e69954b9 | pbrook | /* 0x50000000 PISMO. */
|
124 | e69954b9 | pbrook | /* 0x54000000 PISMO. */
|
125 | e69954b9 | pbrook | /* 0x58000000 PISMO. */
|
126 | e69954b9 | pbrook | /* 0x5c000000 PISMO. */
|
127 | e69954b9 | pbrook | /* 0x60000000 PCI. */
|
128 | e69954b9 | pbrook | /* 0x61000000 PCI Self Config. */
|
129 | e69954b9 | pbrook | /* 0x62000000 PCI Config. */
|
130 | e69954b9 | pbrook | /* 0x63000000 PCI IO. */
|
131 | e69954b9 | pbrook | /* 0x64000000 PCI mem 0. */
|
132 | e69954b9 | pbrook | /* 0x68000000 PCI mem 1. */
|
133 | e69954b9 | pbrook | /* 0x6c000000 PCI mem 2. */
|
134 | e69954b9 | pbrook | |
135 | daf90626 | pbrook | arm_load_kernel(env, ram_size, kernel_filename, kernel_cmdline, |
136 | 9d551997 | balrog | initrd_filename, 0x33b, 0x0); |
137 | e69954b9 | pbrook | } |
138 | e69954b9 | pbrook | |
139 | e69954b9 | pbrook | QEMUMachine realview_machine = { |
140 | e69954b9 | pbrook | "realview",
|
141 | e69954b9 | pbrook | "ARM RealView Emulation Baseboard (ARM926EJ-S)",
|
142 | e69954b9 | pbrook | realview_init |
143 | e69954b9 | pbrook | }; |