root / hw / ppc_newworld.c @ 006f3a48
History | View | Annotate | Download (12 kB)
1 | 64201201 | bellard | /*
|
---|---|---|---|
2 | 3cbee15b | j_mayer | * QEMU PowerPC CHRP (currently NewWorld PowerMac) hardware System Emulator
|
3 | 5fafdf24 | ths | *
|
4 | 47103572 | j_mayer | * Copyright (c) 2004-2007 Fabrice Bellard
|
5 | 3cbee15b | j_mayer | * Copyright (c) 2007 Jocelyn Mayer
|
6 | 5fafdf24 | ths | *
|
7 | 64201201 | bellard | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
8 | 64201201 | bellard | * of this software and associated documentation files (the "Software"), to deal
|
9 | 64201201 | bellard | * in the Software without restriction, including without limitation the rights
|
10 | 64201201 | bellard | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11 | 64201201 | bellard | * copies of the Software, and to permit persons to whom the Software is
|
12 | 64201201 | bellard | * furnished to do so, subject to the following conditions:
|
13 | 64201201 | bellard | *
|
14 | 64201201 | bellard | * The above copyright notice and this permission notice shall be included in
|
15 | 64201201 | bellard | * all copies or substantial portions of the Software.
|
16 | 64201201 | bellard | *
|
17 | 64201201 | bellard | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18 | 64201201 | bellard | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19 | 64201201 | bellard | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
20 | 64201201 | bellard | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21 | 64201201 | bellard | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22 | 64201201 | bellard | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23 | 64201201 | bellard | * THE SOFTWARE.
|
24 | 64201201 | bellard | */
|
25 | 87ecb68b | pbrook | #include "hw.h" |
26 | 87ecb68b | pbrook | #include "ppc.h" |
27 | 3cbee15b | j_mayer | #include "ppc_mac.h" |
28 | 28ce5ce6 | aurel32 | #include "mac_dbdma.h" |
29 | 87ecb68b | pbrook | #include "nvram.h" |
30 | 87ecb68b | pbrook | #include "pc.h" |
31 | 87ecb68b | pbrook | #include "pci.h" |
32 | 87ecb68b | pbrook | #include "net.h" |
33 | 87ecb68b | pbrook | #include "sysemu.h" |
34 | 87ecb68b | pbrook | #include "boards.h" |
35 | 006f3a48 | blueswir1 | #include "fw_cfg.h" |
36 | 7fa9ae1a | blueswir1 | #include "escc.h" |
37 | 267002cd | bellard | |
38 | e4bcb14c | ths | #define MAX_IDE_BUS 2 |
39 | 864c136a | blueswir1 | #define VGA_BIOS_SIZE 65536 |
40 | 006f3a48 | blueswir1 | #define CFG_ADDR 0xf0000510 |
41 | e4bcb14c | ths | |
42 | f3902383 | blueswir1 | /* debug UniNorth */
|
43 | f3902383 | blueswir1 | //#define DEBUG_UNIN
|
44 | f3902383 | blueswir1 | |
45 | f3902383 | blueswir1 | #ifdef DEBUG_UNIN
|
46 | f3902383 | blueswir1 | #define UNIN_DPRINTF(fmt, args...) \
|
47 | f3902383 | blueswir1 | do { printf("UNIN: " fmt , ##args); } while (0) |
48 | f3902383 | blueswir1 | #else
|
49 | f3902383 | blueswir1 | #define UNIN_DPRINTF(fmt, args...)
|
50 | f3902383 | blueswir1 | #endif
|
51 | f3902383 | blueswir1 | |
52 | 0aa6a4a2 | bellard | /* UniN device */
|
53 | 0aa6a4a2 | bellard | static void unin_writel (void *opaque, target_phys_addr_t addr, uint32_t value) |
54 | 0aa6a4a2 | bellard | { |
55 | f3902383 | blueswir1 | UNIN_DPRINTF("writel addr " TARGET_FMT_plx " val %x\n", addr, value); |
56 | 0aa6a4a2 | bellard | } |
57 | 0aa6a4a2 | bellard | |
58 | 0aa6a4a2 | bellard | static uint32_t unin_readl (void *opaque, target_phys_addr_t addr) |
59 | 0aa6a4a2 | bellard | { |
60 | f3902383 | blueswir1 | uint32_t value; |
61 | f3902383 | blueswir1 | |
62 | f3902383 | blueswir1 | value = 0;
|
63 | f3902383 | blueswir1 | UNIN_DPRINTF("readl addr " TARGET_FMT_plx " val %x\n", addr, value); |
64 | f3902383 | blueswir1 | |
65 | f3902383 | blueswir1 | return value;
|
66 | 0aa6a4a2 | bellard | } |
67 | 0aa6a4a2 | bellard | |
68 | 0aa6a4a2 | bellard | static CPUWriteMemoryFunc *unin_write[] = {
|
69 | 0aa6a4a2 | bellard | &unin_writel, |
70 | 0aa6a4a2 | bellard | &unin_writel, |
71 | 0aa6a4a2 | bellard | &unin_writel, |
72 | 0aa6a4a2 | bellard | }; |
73 | 0aa6a4a2 | bellard | |
74 | 0aa6a4a2 | bellard | static CPUReadMemoryFunc *unin_read[] = {
|
75 | 0aa6a4a2 | bellard | &unin_readl, |
76 | 0aa6a4a2 | bellard | &unin_readl, |
77 | 0aa6a4a2 | bellard | &unin_readl, |
78 | 0aa6a4a2 | bellard | }; |
79 | 0aa6a4a2 | bellard | |
80 | 3cbee15b | j_mayer | /* PowerPC Mac99 hardware initialisation */
|
81 | 00f82b8a | aurel32 | static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size, |
82 | 3023f332 | aliguori | const char *boot_device, |
83 | 3cbee15b | j_mayer | const char *kernel_filename, |
84 | 3cbee15b | j_mayer | const char *kernel_cmdline, |
85 | 3cbee15b | j_mayer | const char *initrd_filename, |
86 | 3cbee15b | j_mayer | const char *cpu_model) |
87 | 64201201 | bellard | { |
88 | aaed909a | bellard | CPUState *env = NULL, *envs[MAX_CPUS];
|
89 | 64201201 | bellard | char buf[1024]; |
90 | e9df014c | j_mayer | qemu_irq *pic, **openpic_irqs; |
91 | aef445bd | pbrook | int unin_memory;
|
92 | d5295253 | bellard | int linux_boot, i;
|
93 | 864c136a | blueswir1 | ram_addr_t ram_offset, vga_ram_offset, bios_offset, vga_bios_offset; |
94 | b6b8bd18 | bellard | uint32_t kernel_base, kernel_size, initrd_base, initrd_size; |
95 | 46e50e9d | bellard | PCIBus *pci_bus; |
96 | 3cbee15b | j_mayer | nvram_t nvram; |
97 | 3cbee15b | j_mayer | #if 0
|
98 | 3cbee15b | j_mayer | MacIONVRAMState *nvr;
|
99 | 3cbee15b | j_mayer | int nvram_mem_index;
|
100 | 3cbee15b | j_mayer | #endif
|
101 | 3cbee15b | j_mayer | m48t59_t *m48t59; |
102 | d5295253 | bellard | int vga_bios_size, bios_size;
|
103 | d537cf6c | pbrook | qemu_irq *dummy_irq; |
104 | 7fa9ae1a | blueswir1 | int pic_mem_index, dbdma_mem_index, cuda_mem_index, escc_mem_index;
|
105 | 28c5af54 | j_mayer | int ppc_boot_device;
|
106 | e4bcb14c | ths | int index;
|
107 | e4bcb14c | ths | BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; |
108 | 006f3a48 | blueswir1 | void *fw_cfg;
|
109 | 28ce5ce6 | aurel32 | void *dbdma;
|
110 | 46e50e9d | bellard | |
111 | 64201201 | bellard | linux_boot = (kernel_filename != NULL);
|
112 | 64201201 | bellard | |
113 | c68ea704 | bellard | /* init CPUs */
|
114 | 94fc95cd | j_mayer | if (cpu_model == NULL) |
115 | d12f4c38 | j_mayer | cpu_model = "default";
|
116 | e9df014c | j_mayer | for (i = 0; i < smp_cpus; i++) { |
117 | aaed909a | bellard | env = cpu_init(cpu_model); |
118 | aaed909a | bellard | if (!env) {
|
119 | aaed909a | bellard | fprintf(stderr, "Unable to find PowerPC CPU definition\n");
|
120 | aaed909a | bellard | exit(1);
|
121 | aaed909a | bellard | } |
122 | e9df014c | j_mayer | /* Set time-base frequency to 100 Mhz */
|
123 | e9df014c | j_mayer | cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); |
124 | 3cbee15b | j_mayer | #if 0
|
125 | e9df014c | j_mayer | env->osi_call = vga_osi_call;
|
126 | 3cbee15b | j_mayer | #endif
|
127 | fe33cc71 | j_mayer | qemu_register_reset(&cpu_ppc_reset, env); |
128 | e9df014c | j_mayer | envs[i] = env; |
129 | e9df014c | j_mayer | } |
130 | c68ea704 | bellard | |
131 | 64201201 | bellard | /* allocate RAM */
|
132 | 864c136a | blueswir1 | ram_offset = qemu_ram_alloc(ram_size); |
133 | 864c136a | blueswir1 | cpu_register_physical_memory(0, ram_size, ram_offset);
|
134 | 864c136a | blueswir1 | |
135 | 864c136a | blueswir1 | /* allocate VGA RAM */
|
136 | 864c136a | blueswir1 | vga_ram_offset = qemu_ram_alloc(vga_ram_size); |
137 | 64201201 | bellard | |
138 | 64201201 | bellard | /* allocate and load BIOS */
|
139 | 864c136a | blueswir1 | bios_offset = qemu_ram_alloc(BIOS_SIZE); |
140 | 1192dad8 | j_mayer | if (bios_name == NULL) |
141 | 006f3a48 | blueswir1 | bios_name = PROM_FILENAME; |
142 | 1192dad8 | j_mayer | snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); |
143 | 006f3a48 | blueswir1 | cpu_register_physical_memory(PROM_ADDR, BIOS_SIZE, bios_offset | IO_MEM_ROM); |
144 | 006f3a48 | blueswir1 | |
145 | 006f3a48 | blueswir1 | /* Load OpenBIOS (ELF) */
|
146 | 006f3a48 | blueswir1 | bios_size = load_elf(buf, 0, NULL, NULL, NULL); |
147 | d5295253 | bellard | if (bios_size < 0 || bios_size > BIOS_SIZE) { |
148 | 4a057712 | j_mayer | cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", buf);
|
149 | 64201201 | bellard | exit(1);
|
150 | 64201201 | bellard | } |
151 | 3b46e624 | ths | |
152 | d5295253 | bellard | /* allocate and load VGA BIOS */
|
153 | 864c136a | blueswir1 | vga_bios_offset = qemu_ram_alloc(VGA_BIOS_SIZE); |
154 | d5295253 | bellard | snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME); |
155 | d5295253 | bellard | vga_bios_size = load_image(buf, phys_ram_base + vga_bios_offset + 8);
|
156 | d5295253 | bellard | if (vga_bios_size < 0) { |
157 | d5295253 | bellard | /* if no bios is present, we can still work */
|
158 | d5295253 | bellard | fprintf(stderr, "qemu: warning: could not load VGA bios '%s'\n", buf);
|
159 | d5295253 | bellard | vga_bios_size = 0;
|
160 | d5295253 | bellard | } else {
|
161 | d5295253 | bellard | /* set a specific header (XXX: find real Apple format for NDRV
|
162 | d5295253 | bellard | drivers) */
|
163 | d5295253 | bellard | phys_ram_base[vga_bios_offset] = 'N';
|
164 | d5295253 | bellard | phys_ram_base[vga_bios_offset + 1] = 'D'; |
165 | d5295253 | bellard | phys_ram_base[vga_bios_offset + 2] = 'R'; |
166 | d5295253 | bellard | phys_ram_base[vga_bios_offset + 3] = 'V'; |
167 | 5fafdf24 | ths | cpu_to_be32w((uint32_t *)(phys_ram_base + vga_bios_offset + 4),
|
168 | d5295253 | bellard | vga_bios_size); |
169 | d5295253 | bellard | vga_bios_size += 8;
|
170 | d5295253 | bellard | } |
171 | 3b46e624 | ths | |
172 | b6b8bd18 | bellard | if (linux_boot) {
|
173 | b6b8bd18 | bellard | kernel_base = KERNEL_LOAD_ADDR; |
174 | b6b8bd18 | bellard | /* now we can load the kernel */
|
175 | b6b8bd18 | bellard | kernel_size = load_image(kernel_filename, phys_ram_base + kernel_base); |
176 | b6b8bd18 | bellard | if (kernel_size < 0) { |
177 | 4a057712 | j_mayer | cpu_abort(env, "qemu: could not load kernel '%s'\n",
|
178 | 4a057712 | j_mayer | kernel_filename); |
179 | b6b8bd18 | bellard | exit(1);
|
180 | b6b8bd18 | bellard | } |
181 | b6b8bd18 | bellard | /* load initrd */
|
182 | b6b8bd18 | bellard | if (initrd_filename) {
|
183 | b6b8bd18 | bellard | initrd_base = INITRD_LOAD_ADDR; |
184 | b6b8bd18 | bellard | initrd_size = load_image(initrd_filename, |
185 | b6b8bd18 | bellard | phys_ram_base + initrd_base); |
186 | b6b8bd18 | bellard | if (initrd_size < 0) { |
187 | 4a057712 | j_mayer | cpu_abort(env, "qemu: could not load initial ram disk '%s'\n",
|
188 | 4a057712 | j_mayer | initrd_filename); |
189 | b6b8bd18 | bellard | exit(1);
|
190 | b6b8bd18 | bellard | } |
191 | b6b8bd18 | bellard | } else {
|
192 | b6b8bd18 | bellard | initrd_base = 0;
|
193 | b6b8bd18 | bellard | initrd_size = 0;
|
194 | b6b8bd18 | bellard | } |
195 | 6ac0e82d | balrog | ppc_boot_device = 'm';
|
196 | b6b8bd18 | bellard | } else {
|
197 | b6b8bd18 | bellard | kernel_base = 0;
|
198 | b6b8bd18 | bellard | kernel_size = 0;
|
199 | b6b8bd18 | bellard | initrd_base = 0;
|
200 | b6b8bd18 | bellard | initrd_size = 0;
|
201 | 28c5af54 | j_mayer | ppc_boot_device = '\0';
|
202 | 28c5af54 | j_mayer | /* We consider that NewWorld PowerMac never have any floppy drive
|
203 | 28c5af54 | j_mayer | * For now, OHW cannot boot from the network.
|
204 | 28c5af54 | j_mayer | */
|
205 | 0d913fdb | j_mayer | for (i = 0; boot_device[i] != '\0'; i++) { |
206 | 0d913fdb | j_mayer | if (boot_device[i] >= 'c' && boot_device[i] <= 'f') { |
207 | 0d913fdb | j_mayer | ppc_boot_device = boot_device[i]; |
208 | 28c5af54 | j_mayer | break;
|
209 | 0d913fdb | j_mayer | } |
210 | 28c5af54 | j_mayer | } |
211 | 28c5af54 | j_mayer | if (ppc_boot_device == '\0') { |
212 | 28c5af54 | j_mayer | fprintf(stderr, "No valid boot device for Mac99 machine\n");
|
213 | 28c5af54 | j_mayer | exit(1);
|
214 | 28c5af54 | j_mayer | } |
215 | b6b8bd18 | bellard | } |
216 | 0aa6a4a2 | bellard | |
217 | 3cbee15b | j_mayer | isa_mem_base = 0x80000000;
|
218 | aef445bd | pbrook | |
219 | 3cbee15b | j_mayer | /* Register 8 MB of ISA IO space */
|
220 | 3cbee15b | j_mayer | isa_mmio_init(0xf2000000, 0x00800000); |
221 | 3b46e624 | ths | |
222 | 3cbee15b | j_mayer | /* UniN init */
|
223 | 3cbee15b | j_mayer | unin_memory = cpu_register_io_memory(0, unin_read, unin_write, NULL); |
224 | 3cbee15b | j_mayer | cpu_register_physical_memory(0xf8000000, 0x00001000, unin_memory); |
225 | 47103572 | j_mayer | |
226 | 3cbee15b | j_mayer | openpic_irqs = qemu_mallocz(smp_cpus * sizeof(qemu_irq *));
|
227 | 3cbee15b | j_mayer | openpic_irqs[0] =
|
228 | 3cbee15b | j_mayer | qemu_mallocz(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB);
|
229 | 3cbee15b | j_mayer | for (i = 0; i < smp_cpus; i++) { |
230 | 3cbee15b | j_mayer | /* Mac99 IRQ connection between OpenPIC outputs pins
|
231 | 3cbee15b | j_mayer | * and PowerPC input pins
|
232 | 3cbee15b | j_mayer | */
|
233 | 3cbee15b | j_mayer | switch (PPC_INPUT(env)) {
|
234 | 3cbee15b | j_mayer | case PPC_FLAGS_INPUT_6xx:
|
235 | 3cbee15b | j_mayer | openpic_irqs[i] = openpic_irqs[0] + (i * OPENPIC_OUTPUT_NB);
|
236 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_INT] = |
237 | 3cbee15b | j_mayer | ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; |
238 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_CINT] = |
239 | 3cbee15b | j_mayer | ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; |
240 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_MCK] = |
241 | 3cbee15b | j_mayer | ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_MCP]; |
242 | 3cbee15b | j_mayer | /* Not connected ? */
|
243 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_DEBUG] = NULL;
|
244 | 3cbee15b | j_mayer | /* Check this */
|
245 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_RESET] = |
246 | 3cbee15b | j_mayer | ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_HRESET]; |
247 | 3cbee15b | j_mayer | break;
|
248 | 00af685f | j_mayer | #if defined(TARGET_PPC64)
|
249 | 3cbee15b | j_mayer | case PPC_FLAGS_INPUT_970:
|
250 | 3cbee15b | j_mayer | openpic_irqs[i] = openpic_irqs[0] + (i * OPENPIC_OUTPUT_NB);
|
251 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_INT] = |
252 | 3cbee15b | j_mayer | ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; |
253 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_CINT] = |
254 | 3cbee15b | j_mayer | ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; |
255 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_MCK] = |
256 | 3cbee15b | j_mayer | ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_MCP]; |
257 | 3cbee15b | j_mayer | /* Not connected ? */
|
258 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_DEBUG] = NULL;
|
259 | 3cbee15b | j_mayer | /* Check this */
|
260 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_RESET] = |
261 | 3cbee15b | j_mayer | ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_HRESET]; |
262 | 3cbee15b | j_mayer | break;
|
263 | 00af685f | j_mayer | #endif /* defined(TARGET_PPC64) */ |
264 | 3cbee15b | j_mayer | default:
|
265 | 3cbee15b | j_mayer | cpu_abort(env, "Bus model not supported on mac99 machine\n");
|
266 | 3cbee15b | j_mayer | exit(1);
|
267 | 0aa6a4a2 | bellard | } |
268 | 3cbee15b | j_mayer | } |
269 | 3cbee15b | j_mayer | pic = openpic_init(NULL, &pic_mem_index, smp_cpus, openpic_irqs, NULL); |
270 | 3cbee15b | j_mayer | pci_bus = pci_pmac_init(pic); |
271 | 3cbee15b | j_mayer | /* init basic PC hardware */
|
272 | 0a645949 | blueswir1 | pci_vga_init(pci_bus, phys_ram_base + vga_ram_offset, |
273 | 0a645949 | blueswir1 | vga_ram_offset, vga_ram_size, |
274 | 3cbee15b | j_mayer | vga_bios_offset, vga_bios_size); |
275 | aae9366a | j_mayer | |
276 | 3cbee15b | j_mayer | /* XXX: suppress that */
|
277 | 3cbee15b | j_mayer | dummy_irq = i8259_init(NULL);
|
278 | 3cbee15b | j_mayer | |
279 | aeeb69c7 | aurel32 | escc_mem_index = escc_init(0x80013000, dummy_irq[4], dummy_irq[5], |
280 | aeeb69c7 | aurel32 | serial_hds[0], serial_hds[1], ESCC_CLOCK, 4); |
281 | cb457d76 | aliguori | |
282 | cb457d76 | aliguori | for(i = 0; i < nb_nics; i++) |
283 | cb457d76 | aliguori | pci_nic_init(pci_bus, &nd_table[i], -1, "ne2k_pci"); |
284 | cb457d76 | aliguori | |
285 | e4bcb14c | ths | if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {
|
286 | e4bcb14c | ths | fprintf(stderr, "qemu: too many IDE bus\n");
|
287 | e4bcb14c | ths | exit(1);
|
288 | e4bcb14c | ths | } |
289 | e4bcb14c | ths | for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { |
290 | e4bcb14c | ths | index = drive_get_index(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); |
291 | e4bcb14c | ths | if (index != -1) |
292 | e4bcb14c | ths | hd[i] = drives_table[index].bdrv; |
293 | e4bcb14c | ths | else
|
294 | e4bcb14c | ths | hd[i] = NULL;
|
295 | e4bcb14c | ths | } |
296 | 28ce5ce6 | aurel32 | dbdma = DBDMA_init(&dbdma_mem_index); |
297 | 77f0435e | blueswir1 | pci_cmd646_ide_init(pci_bus, hd, 0);
|
298 | 77f0435e | blueswir1 | |
299 | 3cbee15b | j_mayer | /* cuda also initialize ADB */
|
300 | 3cbee15b | j_mayer | cuda_init(&cuda_mem_index, pic[0x19]);
|
301 | aae9366a | j_mayer | |
302 | 3cbee15b | j_mayer | adb_kbd_init(&adb_bus); |
303 | 3cbee15b | j_mayer | adb_mouse_init(&adb_bus); |
304 | 3b46e624 | ths | |
305 | 3b46e624 | ths | |
306 | 4ebcf884 | blueswir1 | macio_init(pci_bus, PCI_DEVICE_ID_APPLE_UNI_N_KEYL, 0, pic_mem_index,
|
307 | 77f0435e | blueswir1 | dbdma_mem_index, cuda_mem_index, NULL, 0, NULL, |
308 | 4ebcf884 | blueswir1 | escc_mem_index); |
309 | 0d92ed30 | pbrook | |
310 | 0d92ed30 | pbrook | if (usb_enabled) {
|
311 | e24ad6f1 | pbrook | usb_ohci_init_pci(pci_bus, 3, -1); |
312 | 0d92ed30 | pbrook | } |
313 | 0d92ed30 | pbrook | |
314 | b6b8bd18 | bellard | if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) |
315 | b6b8bd18 | bellard | graphic_depth = 15;
|
316 | 3cbee15b | j_mayer | #if 0 /* XXX: this is ugly but needed for now, or OHW won't boot */
|
317 | 3cbee15b | j_mayer | /* The NewWorld NVRAM is not located in the MacIO device */
|
318 | 68af3f24 | blueswir1 | nvr = macio_nvram_init(&nvram_mem_index, 0x2000, 1);
|
319 | 3cbee15b | j_mayer | pmac_format_nvram_partition(nvr, 0x2000);
|
320 | 74e91155 | j_mayer | macio_nvram_map(nvr, 0xFFF04000);
|
321 | 3cbee15b | j_mayer | nvram.opaque = nvr;
|
322 | 3cbee15b | j_mayer | nvram.read_fn = &macio_nvram_read;
|
323 | 3cbee15b | j_mayer | nvram.write_fn = &macio_nvram_write;
|
324 | 3cbee15b | j_mayer | #else
|
325 | 3cbee15b | j_mayer | m48t59 = m48t59_init(dummy_irq[8], 0xFFF04000, 0x0074, NVRAM_SIZE, 59); |
326 | 3cbee15b | j_mayer | nvram.opaque = m48t59; |
327 | 3cbee15b | j_mayer | nvram.read_fn = &m48t59_read; |
328 | 3cbee15b | j_mayer | nvram.write_fn = &m48t59_write; |
329 | 3cbee15b | j_mayer | #endif
|
330 | 6ac0e82d | balrog | PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "MAC99", ram_size,
|
331 | 6ac0e82d | balrog | ppc_boot_device, kernel_base, kernel_size, |
332 | b6b8bd18 | bellard | kernel_cmdline, |
333 | b6b8bd18 | bellard | initrd_base, initrd_size, |
334 | 64201201 | bellard | /* XXX: need an option to load a NVRAM image */
|
335 | b6b8bd18 | bellard | 0,
|
336 | b6b8bd18 | bellard | graphic_width, graphic_height, graphic_depth); |
337 | b6b8bd18 | bellard | /* No PCI init: the BIOS will do it */
|
338 | 0aa6a4a2 | bellard | |
339 | 006f3a48 | blueswir1 | fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2); |
340 | 006f3a48 | blueswir1 | fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
|
341 | 006f3a48 | blueswir1 | fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); |
342 | 006f3a48 | blueswir1 | fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_MAC99); |
343 | aae9366a | j_mayer | } |
344 | 0aa6a4a2 | bellard | |
345 | 0aa6a4a2 | bellard | QEMUMachine core99_machine = { |
346 | 4b32e168 | aliguori | .name = "mac99",
|
347 | 4b32e168 | aliguori | .desc = "Mac99 based PowerMAC",
|
348 | 4b32e168 | aliguori | .init = ppc_core99_init, |
349 | 864c136a | blueswir1 | .ram_require = BIOS_SIZE + VGA_BIOS_SIZE + VGA_RAM_SIZE, |
350 | 3d878caa | balrog | .max_cpus = MAX_CPUS, |
351 | 0aa6a4a2 | bellard | }; |