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