root / hw / ppc_chrp.c @ ab7d9131
History | View | Annotate | Download (11.9 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 | 87ecb68b | pbrook | #include "nvram.h" |
29 | 87ecb68b | pbrook | #include "pc.h" |
30 | 87ecb68b | pbrook | #include "pci.h" |
31 | 87ecb68b | pbrook | #include "net.h" |
32 | 87ecb68b | pbrook | #include "sysemu.h" |
33 | 87ecb68b | pbrook | #include "boards.h" |
34 | 267002cd | bellard | |
35 | e4bcb14c | ths | #define MAX_IDE_BUS 2 |
36 | e4bcb14c | ths | |
37 | 0aa6a4a2 | bellard | /* UniN device */
|
38 | 0aa6a4a2 | bellard | static void unin_writel (void *opaque, target_phys_addr_t addr, uint32_t value) |
39 | 0aa6a4a2 | bellard | { |
40 | 0aa6a4a2 | bellard | } |
41 | 0aa6a4a2 | bellard | |
42 | 0aa6a4a2 | bellard | static uint32_t unin_readl (void *opaque, target_phys_addr_t addr) |
43 | 0aa6a4a2 | bellard | { |
44 | 0aa6a4a2 | bellard | return 0; |
45 | 0aa6a4a2 | bellard | } |
46 | 0aa6a4a2 | bellard | |
47 | 0aa6a4a2 | bellard | static CPUWriteMemoryFunc *unin_write[] = {
|
48 | 0aa6a4a2 | bellard | &unin_writel, |
49 | 0aa6a4a2 | bellard | &unin_writel, |
50 | 0aa6a4a2 | bellard | &unin_writel, |
51 | 0aa6a4a2 | bellard | }; |
52 | 0aa6a4a2 | bellard | |
53 | 0aa6a4a2 | bellard | static CPUReadMemoryFunc *unin_read[] = {
|
54 | 0aa6a4a2 | bellard | &unin_readl, |
55 | 0aa6a4a2 | bellard | &unin_readl, |
56 | 0aa6a4a2 | bellard | &unin_readl, |
57 | 0aa6a4a2 | bellard | }; |
58 | 0aa6a4a2 | bellard | |
59 | 3cbee15b | j_mayer | /* PowerPC Mac99 hardware initialisation */
|
60 | 00f82b8a | aurel32 | static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size, |
61 | 6ac0e82d | balrog | const char *boot_device, DisplayState *ds, |
62 | 3cbee15b | j_mayer | const char *kernel_filename, |
63 | 3cbee15b | j_mayer | const char *kernel_cmdline, |
64 | 3cbee15b | j_mayer | const char *initrd_filename, |
65 | 3cbee15b | j_mayer | const char *cpu_model) |
66 | 64201201 | bellard | { |
67 | aaed909a | bellard | CPUState *env = NULL, *envs[MAX_CPUS];
|
68 | 64201201 | bellard | char buf[1024]; |
69 | e9df014c | j_mayer | qemu_irq *pic, **openpic_irqs; |
70 | aef445bd | pbrook | int unin_memory;
|
71 | d5295253 | bellard | int linux_boot, i;
|
72 | d5295253 | bellard | unsigned long bios_offset, vga_bios_offset; |
73 | b6b8bd18 | bellard | uint32_t kernel_base, kernel_size, initrd_base, initrd_size; |
74 | 46e50e9d | bellard | PCIBus *pci_bus; |
75 | 3cbee15b | j_mayer | nvram_t nvram; |
76 | 3cbee15b | j_mayer | #if 0
|
77 | 3cbee15b | j_mayer | MacIONVRAMState *nvr;
|
78 | 3cbee15b | j_mayer | int nvram_mem_index;
|
79 | 3cbee15b | j_mayer | #endif
|
80 | 3cbee15b | j_mayer | m48t59_t *m48t59; |
81 | d5295253 | bellard | int vga_bios_size, bios_size;
|
82 | d537cf6c | pbrook | qemu_irq *dummy_irq; |
83 | 3cbee15b | j_mayer | int pic_mem_index, dbdma_mem_index, cuda_mem_index;
|
84 | 3cbee15b | j_mayer | int ide_mem_index[2]; |
85 | 28c5af54 | j_mayer | int ppc_boot_device;
|
86 | e4bcb14c | ths | int index;
|
87 | e4bcb14c | ths | BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; |
88 | 46e50e9d | bellard | |
89 | 64201201 | bellard | linux_boot = (kernel_filename != NULL);
|
90 | 64201201 | bellard | |
91 | c68ea704 | bellard | /* init CPUs */
|
92 | 94fc95cd | j_mayer | if (cpu_model == NULL) |
93 | d12f4c38 | j_mayer | cpu_model = "default";
|
94 | e9df014c | j_mayer | for (i = 0; i < smp_cpus; i++) { |
95 | aaed909a | bellard | env = cpu_init(cpu_model); |
96 | aaed909a | bellard | if (!env) {
|
97 | aaed909a | bellard | fprintf(stderr, "Unable to find PowerPC CPU definition\n");
|
98 | aaed909a | bellard | exit(1);
|
99 | aaed909a | bellard | } |
100 | e9df014c | j_mayer | /* Set time-base frequency to 100 Mhz */
|
101 | e9df014c | j_mayer | cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); |
102 | 3cbee15b | j_mayer | #if 0
|
103 | e9df014c | j_mayer | env->osi_call = vga_osi_call;
|
104 | 3cbee15b | j_mayer | #endif
|
105 | fe33cc71 | j_mayer | qemu_register_reset(&cpu_ppc_reset, env); |
106 | fe33cc71 | j_mayer | register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); |
107 | e9df014c | j_mayer | envs[i] = env; |
108 | e9df014c | j_mayer | } |
109 | 4c823cff | j_mayer | if (env->nip < 0xFFF80000) { |
110 | 4c823cff | j_mayer | /* Special test for PowerPC 601:
|
111 | 4c823cff | j_mayer | * the boot vector is at 0xFFF00100, then we need a 1MB BIOS.
|
112 | 4c823cff | j_mayer | * But the NVRAM is located at 0xFFF04000...
|
113 | 4c823cff | j_mayer | */
|
114 | 4c823cff | j_mayer | cpu_abort(env, "Mac99 hardware can not handle 1 MB BIOS\n");
|
115 | 4c823cff | j_mayer | } |
116 | c68ea704 | bellard | |
117 | 64201201 | bellard | /* allocate RAM */
|
118 | 64201201 | bellard | cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
|
119 | 64201201 | bellard | |
120 | 64201201 | bellard | /* allocate and load BIOS */
|
121 | 64201201 | bellard | bios_offset = ram_size + vga_ram_size; |
122 | 1192dad8 | j_mayer | if (bios_name == NULL) |
123 | 1192dad8 | j_mayer | bios_name = BIOS_FILENAME; |
124 | 1192dad8 | j_mayer | snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); |
125 | d5295253 | bellard | bios_size = load_image(buf, phys_ram_base + bios_offset); |
126 | d5295253 | bellard | if (bios_size < 0 || bios_size > BIOS_SIZE) { |
127 | 4a057712 | j_mayer | cpu_abort(env, "qemu: could not load PowerPC bios '%s'\n", buf);
|
128 | 64201201 | bellard | exit(1);
|
129 | 64201201 | bellard | } |
130 | d5295253 | bellard | bios_size = (bios_size + 0xfff) & ~0xfff; |
131 | 4c823cff | j_mayer | if (bios_size > 0x00080000) { |
132 | 4c823cff | j_mayer | /* As the NVRAM is located at 0xFFF04000, we cannot use 1 MB BIOSes */
|
133 | 4c823cff | j_mayer | cpu_abort(env, "Mac99 hardware can not handle 1 MB BIOS\n");
|
134 | 4c823cff | j_mayer | } |
135 | 4a057712 | j_mayer | cpu_register_physical_memory((uint32_t)(-bios_size), |
136 | d5295253 | bellard | bios_size, bios_offset | IO_MEM_ROM); |
137 | 3b46e624 | ths | |
138 | d5295253 | bellard | /* allocate and load VGA BIOS */
|
139 | d5295253 | bellard | vga_bios_offset = bios_offset + bios_size; |
140 | d5295253 | bellard | snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME); |
141 | d5295253 | bellard | vga_bios_size = load_image(buf, phys_ram_base + vga_bios_offset + 8);
|
142 | d5295253 | bellard | if (vga_bios_size < 0) { |
143 | d5295253 | bellard | /* if no bios is present, we can still work */
|
144 | d5295253 | bellard | fprintf(stderr, "qemu: warning: could not load VGA bios '%s'\n", buf);
|
145 | d5295253 | bellard | vga_bios_size = 0;
|
146 | d5295253 | bellard | } else {
|
147 | d5295253 | bellard | /* set a specific header (XXX: find real Apple format for NDRV
|
148 | d5295253 | bellard | drivers) */
|
149 | d5295253 | bellard | phys_ram_base[vga_bios_offset] = 'N';
|
150 | d5295253 | bellard | phys_ram_base[vga_bios_offset + 1] = 'D'; |
151 | d5295253 | bellard | phys_ram_base[vga_bios_offset + 2] = 'R'; |
152 | d5295253 | bellard | phys_ram_base[vga_bios_offset + 3] = 'V'; |
153 | 5fafdf24 | ths | cpu_to_be32w((uint32_t *)(phys_ram_base + vga_bios_offset + 4),
|
154 | d5295253 | bellard | vga_bios_size); |
155 | d5295253 | bellard | vga_bios_size += 8;
|
156 | d5295253 | bellard | } |
157 | d5295253 | bellard | vga_bios_size = (vga_bios_size + 0xfff) & ~0xfff; |
158 | 3b46e624 | ths | |
159 | b6b8bd18 | bellard | if (linux_boot) {
|
160 | b6b8bd18 | bellard | kernel_base = KERNEL_LOAD_ADDR; |
161 | b6b8bd18 | bellard | /* now we can load the kernel */
|
162 | b6b8bd18 | bellard | kernel_size = load_image(kernel_filename, phys_ram_base + kernel_base); |
163 | b6b8bd18 | bellard | if (kernel_size < 0) { |
164 | 4a057712 | j_mayer | cpu_abort(env, "qemu: could not load kernel '%s'\n",
|
165 | 4a057712 | j_mayer | kernel_filename); |
166 | b6b8bd18 | bellard | exit(1);
|
167 | b6b8bd18 | bellard | } |
168 | b6b8bd18 | bellard | /* load initrd */
|
169 | b6b8bd18 | bellard | if (initrd_filename) {
|
170 | b6b8bd18 | bellard | initrd_base = INITRD_LOAD_ADDR; |
171 | b6b8bd18 | bellard | initrd_size = load_image(initrd_filename, |
172 | b6b8bd18 | bellard | phys_ram_base + initrd_base); |
173 | b6b8bd18 | bellard | if (initrd_size < 0) { |
174 | 4a057712 | j_mayer | cpu_abort(env, "qemu: could not load initial ram disk '%s'\n",
|
175 | 4a057712 | j_mayer | initrd_filename); |
176 | b6b8bd18 | bellard | exit(1);
|
177 | b6b8bd18 | bellard | } |
178 | b6b8bd18 | bellard | } else {
|
179 | b6b8bd18 | bellard | initrd_base = 0;
|
180 | b6b8bd18 | bellard | initrd_size = 0;
|
181 | b6b8bd18 | bellard | } |
182 | 6ac0e82d | balrog | ppc_boot_device = 'm';
|
183 | b6b8bd18 | bellard | } else {
|
184 | b6b8bd18 | bellard | kernel_base = 0;
|
185 | b6b8bd18 | bellard | kernel_size = 0;
|
186 | b6b8bd18 | bellard | initrd_base = 0;
|
187 | b6b8bd18 | bellard | initrd_size = 0;
|
188 | 28c5af54 | j_mayer | ppc_boot_device = '\0';
|
189 | 28c5af54 | j_mayer | /* We consider that NewWorld PowerMac never have any floppy drive
|
190 | 28c5af54 | j_mayer | * For now, OHW cannot boot from the network.
|
191 | 28c5af54 | j_mayer | */
|
192 | 0d913fdb | j_mayer | for (i = 0; boot_device[i] != '\0'; i++) { |
193 | 0d913fdb | j_mayer | if (boot_device[i] >= 'c' && boot_device[i] <= 'f') { |
194 | 0d913fdb | j_mayer | ppc_boot_device = boot_device[i]; |
195 | 28c5af54 | j_mayer | break;
|
196 | 0d913fdb | j_mayer | } |
197 | 28c5af54 | j_mayer | } |
198 | 28c5af54 | j_mayer | if (ppc_boot_device == '\0') { |
199 | 28c5af54 | j_mayer | fprintf(stderr, "No valid boot device for Mac99 machine\n");
|
200 | 28c5af54 | j_mayer | exit(1);
|
201 | 28c5af54 | j_mayer | } |
202 | b6b8bd18 | bellard | } |
203 | 0aa6a4a2 | bellard | |
204 | 3cbee15b | j_mayer | isa_mem_base = 0x80000000;
|
205 | aef445bd | pbrook | |
206 | 3cbee15b | j_mayer | /* Register 8 MB of ISA IO space */
|
207 | 3cbee15b | j_mayer | isa_mmio_init(0xf2000000, 0x00800000); |
208 | 3b46e624 | ths | |
209 | 3cbee15b | j_mayer | /* UniN init */
|
210 | 3cbee15b | j_mayer | unin_memory = cpu_register_io_memory(0, unin_read, unin_write, NULL); |
211 | 3cbee15b | j_mayer | cpu_register_physical_memory(0xf8000000, 0x00001000, unin_memory); |
212 | 47103572 | j_mayer | |
213 | 3cbee15b | j_mayer | openpic_irqs = qemu_mallocz(smp_cpus * sizeof(qemu_irq *));
|
214 | 3cbee15b | j_mayer | openpic_irqs[0] =
|
215 | 3cbee15b | j_mayer | qemu_mallocz(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB);
|
216 | 3cbee15b | j_mayer | for (i = 0; i < smp_cpus; i++) { |
217 | 3cbee15b | j_mayer | /* Mac99 IRQ connection between OpenPIC outputs pins
|
218 | 3cbee15b | j_mayer | * and PowerPC input pins
|
219 | 3cbee15b | j_mayer | */
|
220 | 3cbee15b | j_mayer | switch (PPC_INPUT(env)) {
|
221 | 3cbee15b | j_mayer | case PPC_FLAGS_INPUT_6xx:
|
222 | 3cbee15b | j_mayer | openpic_irqs[i] = openpic_irqs[0] + (i * OPENPIC_OUTPUT_NB);
|
223 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_INT] = |
224 | 3cbee15b | j_mayer | ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; |
225 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_CINT] = |
226 | 3cbee15b | j_mayer | ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; |
227 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_MCK] = |
228 | 3cbee15b | j_mayer | ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_MCP]; |
229 | 3cbee15b | j_mayer | /* Not connected ? */
|
230 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_DEBUG] = NULL;
|
231 | 3cbee15b | j_mayer | /* Check this */
|
232 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_RESET] = |
233 | 3cbee15b | j_mayer | ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_HRESET]; |
234 | 3cbee15b | j_mayer | break;
|
235 | 00af685f | j_mayer | #if defined(TARGET_PPC64)
|
236 | 3cbee15b | j_mayer | case PPC_FLAGS_INPUT_970:
|
237 | 3cbee15b | j_mayer | openpic_irqs[i] = openpic_irqs[0] + (i * OPENPIC_OUTPUT_NB);
|
238 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_INT] = |
239 | 3cbee15b | j_mayer | ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; |
240 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_CINT] = |
241 | 3cbee15b | j_mayer | ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; |
242 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_MCK] = |
243 | 3cbee15b | j_mayer | ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_MCP]; |
244 | 3cbee15b | j_mayer | /* Not connected ? */
|
245 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_DEBUG] = NULL;
|
246 | 3cbee15b | j_mayer | /* Check this */
|
247 | 3cbee15b | j_mayer | openpic_irqs[i][OPENPIC_OUTPUT_RESET] = |
248 | 3cbee15b | j_mayer | ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_HRESET]; |
249 | 3cbee15b | j_mayer | break;
|
250 | 00af685f | j_mayer | #endif /* defined(TARGET_PPC64) */ |
251 | 3cbee15b | j_mayer | default:
|
252 | 3cbee15b | j_mayer | cpu_abort(env, "Bus model not supported on mac99 machine\n");
|
253 | 3cbee15b | j_mayer | exit(1);
|
254 | 0aa6a4a2 | bellard | } |
255 | 3cbee15b | j_mayer | } |
256 | 3cbee15b | j_mayer | pic = openpic_init(NULL, &pic_mem_index, smp_cpus, openpic_irqs, NULL); |
257 | 3cbee15b | j_mayer | pci_bus = pci_pmac_init(pic); |
258 | 3cbee15b | j_mayer | /* init basic PC hardware */
|
259 | 3cbee15b | j_mayer | pci_vga_init(pci_bus, ds, phys_ram_base + ram_size, |
260 | 3cbee15b | j_mayer | ram_size, vga_ram_size, |
261 | 3cbee15b | j_mayer | vga_bios_offset, vga_bios_size); |
262 | aae9366a | j_mayer | |
263 | 3cbee15b | j_mayer | /* XXX: suppress that */
|
264 | 3cbee15b | j_mayer | dummy_irq = i8259_init(NULL);
|
265 | 3cbee15b | j_mayer | |
266 | 3cbee15b | j_mayer | /* XXX: use Mac Serial port */
|
267 | b6cd0ea1 | aurel32 | serial_init(0x3f8, dummy_irq[4], 115200, serial_hds[0]); |
268 | 3cbee15b | j_mayer | for(i = 0; i < nb_nics; i++) { |
269 | 3cbee15b | j_mayer | if (!nd_table[i].model)
|
270 | 3cbee15b | j_mayer | nd_table[i].model = "ne2k_pci";
|
271 | 3cbee15b | j_mayer | pci_nic_init(pci_bus, &nd_table[i], -1);
|
272 | 3cbee15b | j_mayer | } |
273 | e4bcb14c | ths | if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {
|
274 | e4bcb14c | ths | fprintf(stderr, "qemu: too many IDE bus\n");
|
275 | e4bcb14c | ths | exit(1);
|
276 | e4bcb14c | ths | } |
277 | e4bcb14c | ths | for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { |
278 | e4bcb14c | ths | index = drive_get_index(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); |
279 | e4bcb14c | ths | if (index != -1) |
280 | e4bcb14c | ths | hd[i] = drives_table[index].bdrv; |
281 | e4bcb14c | ths | else
|
282 | e4bcb14c | ths | hd[i] = NULL;
|
283 | e4bcb14c | ths | } |
284 | 0aa6a4a2 | bellard | #if 1 |
285 | e4bcb14c | ths | ide_mem_index[0] = pmac_ide_init(&hd[0], pic[0x13]); |
286 | e4bcb14c | ths | ide_mem_index[1] = pmac_ide_init(&hd[2], pic[0x14]); |
287 | 0aa6a4a2 | bellard | #else
|
288 | e4bcb14c | ths | pci_cmd646_ide_init(pci_bus, &hd[0], 0); |
289 | 0aa6a4a2 | bellard | #endif
|
290 | 3cbee15b | j_mayer | /* cuda also initialize ADB */
|
291 | 3cbee15b | j_mayer | cuda_init(&cuda_mem_index, pic[0x19]);
|
292 | aae9366a | j_mayer | |
293 | 3cbee15b | j_mayer | adb_kbd_init(&adb_bus); |
294 | 3cbee15b | j_mayer | adb_mouse_init(&adb_bus); |
295 | 3b46e624 | ths | |
296 | 3cbee15b | j_mayer | dbdma_init(&dbdma_mem_index); |
297 | 3b46e624 | ths | |
298 | 3cbee15b | j_mayer | macio_init(pci_bus, 0x0022, 0, pic_mem_index, dbdma_mem_index, |
299 | 74e91155 | j_mayer | cuda_mem_index, NULL, 2, ide_mem_index); |
300 | 0d92ed30 | pbrook | |
301 | 0d92ed30 | pbrook | if (usb_enabled) {
|
302 | e24ad6f1 | pbrook | usb_ohci_init_pci(pci_bus, 3, -1); |
303 | 0d92ed30 | pbrook | } |
304 | 0d92ed30 | pbrook | |
305 | b6b8bd18 | bellard | if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) |
306 | b6b8bd18 | bellard | graphic_depth = 15;
|
307 | 3cbee15b | j_mayer | #if 0 /* XXX: this is ugly but needed for now, or OHW won't boot */
|
308 | 3cbee15b | j_mayer | /* The NewWorld NVRAM is not located in the MacIO device */
|
309 | 74e91155 | j_mayer | nvr = macio_nvram_init(&nvram_mem_index, 0x2000);
|
310 | 3cbee15b | j_mayer | pmac_format_nvram_partition(nvr, 0x2000);
|
311 | 74e91155 | j_mayer | macio_nvram_map(nvr, 0xFFF04000);
|
312 | 3cbee15b | j_mayer | nvram.opaque = nvr;
|
313 | 3cbee15b | j_mayer | nvram.read_fn = &macio_nvram_read;
|
314 | 3cbee15b | j_mayer | nvram.write_fn = &macio_nvram_write;
|
315 | 3cbee15b | j_mayer | #else
|
316 | 3cbee15b | j_mayer | m48t59 = m48t59_init(dummy_irq[8], 0xFFF04000, 0x0074, NVRAM_SIZE, 59); |
317 | 3cbee15b | j_mayer | nvram.opaque = m48t59; |
318 | 3cbee15b | j_mayer | nvram.read_fn = &m48t59_read; |
319 | 3cbee15b | j_mayer | nvram.write_fn = &m48t59_write; |
320 | 3cbee15b | j_mayer | #endif
|
321 | 6ac0e82d | balrog | PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "MAC99", ram_size,
|
322 | 6ac0e82d | balrog | ppc_boot_device, kernel_base, kernel_size, |
323 | b6b8bd18 | bellard | kernel_cmdline, |
324 | b6b8bd18 | bellard | initrd_base, initrd_size, |
325 | 64201201 | bellard | /* XXX: need an option to load a NVRAM image */
|
326 | b6b8bd18 | bellard | 0,
|
327 | b6b8bd18 | bellard | graphic_width, graphic_height, graphic_depth); |
328 | b6b8bd18 | bellard | /* No PCI init: the BIOS will do it */
|
329 | 0aa6a4a2 | bellard | |
330 | 0aa6a4a2 | bellard | /* Special port to get debug messages from Open-Firmware */
|
331 | 0aa6a4a2 | bellard | register_ioport_write(0x0F00, 4, 1, &PPC_debug_write, NULL); |
332 | aae9366a | j_mayer | } |
333 | 0aa6a4a2 | bellard | |
334 | 0aa6a4a2 | bellard | QEMUMachine core99_machine = { |
335 | 0289b2c1 | bellard | "mac99",
|
336 | 0289b2c1 | bellard | "Mac99 based PowerMAC",
|
337 | 0aa6a4a2 | bellard | ppc_core99_init, |
338 | 7fb4fdcf | balrog | BIOS_SIZE + VGA_RAM_SIZE, |
339 | 0aa6a4a2 | bellard | }; |