]> Git Repo - qemu.git/blame - hw/ppc/prep.c
Merge remote-tracking branch 'remotes/amit-migration/for-2.2' into staging
[qemu.git] / hw / ppc / prep.c
CommitLineData
9a64fbe4 1/*
a541f297 2 * QEMU PPC PREP hardware System Emulator
5fafdf24 3 *
47103572 4 * Copyright (c) 2003-2007 Jocelyn Mayer
5fafdf24 5 *
a541f297
FB
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
9a64fbe4 23 */
75610155 24#include "hw/hw.h"
0d09e41a
PB
25#include "hw/timer/m48t59.h"
26#include "hw/i386/pc.h"
27#include "hw/char/serial.h"
28#include "hw/block/fdc.h"
1422e32d 29#include "net/net.h"
9c17d615 30#include "sysemu/sysemu.h"
0d09e41a 31#include "hw/isa/isa.h"
75610155
AF
32#include "hw/pci/pci.h"
33#include "hw/pci/pci_host.h"
0d09e41a 34#include "hw/ppc/ppc.h"
75610155 35#include "hw/boards.h"
1de7afc9 36#include "qemu/log.h"
75610155
AF
37#include "hw/ide.h"
38#include "hw/loader.h"
0d09e41a
PB
39#include "hw/timer/mc146818rtc.h"
40#include "hw/isa/pc87312.h"
9c17d615
PB
41#include "sysemu/blockdev.h"
42#include "sysemu/arch_init.h"
97c42c3c 43#include "sysemu/qtest.h"
022c62cb 44#include "exec/address-spaces.h"
97c42c3c 45#include "elf.h"
9fddaa0c 46
9a64fbe4 47//#define HARD_DEBUG_PPC_IO
a541f297 48//#define DEBUG_PPC_IO
9a64fbe4 49
fe33cc71
JM
50/* SMP is not enabled, for now */
51#define MAX_CPUS 1
52
e4bcb14c
TS
53#define MAX_IDE_BUS 2
54
bba831e8 55#define BIOS_SIZE (1024 * 1024)
b6b8bd18
FB
56#define BIOS_FILENAME "ppc_rom.bin"
57#define KERNEL_LOAD_ADDR 0x01000000
58#define INITRD_LOAD_ADDR 0x01800000
64201201 59
9a64fbe4
FB
60#if defined (HARD_DEBUG_PPC_IO) && !defined (DEBUG_PPC_IO)
61#define DEBUG_PPC_IO
62#endif
63
64#if defined (HARD_DEBUG_PPC_IO)
001faf32 65#define PPC_IO_DPRINTF(fmt, ...) \
9a64fbe4 66do { \
8fec2b8c 67 if (qemu_loglevel_mask(CPU_LOG_IOPORT)) { \
001faf32 68 qemu_log("%s: " fmt, __func__ , ## __VA_ARGS__); \
9a64fbe4 69 } else { \
001faf32 70 printf("%s : " fmt, __func__ , ## __VA_ARGS__); \
9a64fbe4
FB
71 } \
72} while (0)
73#elif defined (DEBUG_PPC_IO)
0bf9e31a
BS
74#define PPC_IO_DPRINTF(fmt, ...) \
75qemu_log_mask(CPU_LOG_IOPORT, fmt, ## __VA_ARGS__)
9a64fbe4 76#else
001faf32 77#define PPC_IO_DPRINTF(fmt, ...) do { } while (0)
9a64fbe4
FB
78#endif
79
64201201 80/* Constants for devices init */
a541f297
FB
81static const int ide_iobase[2] = { 0x1f0, 0x170 };
82static const int ide_iobase2[2] = { 0x3f6, 0x376 };
83static const int ide_irq[2] = { 13, 13 };
84
85#define NE2000_NB_MAX 6
86
87static uint32_t ne2000_io[NE2000_NB_MAX] = { 0x300, 0x320, 0x340, 0x360, 0x280, 0x380 };
88static int ne2000_irq[NE2000_NB_MAX] = { 9, 10, 11, 3, 4, 5 };
9a64fbe4 89
64201201 90/* ISA IO ports bridge */
9a64fbe4
FB
91#define PPC_IO_BASE 0x80000000
92
64201201
FB
93/* PowerPC control and status registers */
94#if 0 // Not used
95static struct {
96 /* IDs */
97 uint32_t veni_devi;
98 uint32_t revi;
99 /* Control and status */
100 uint32_t gcsr;
101 uint32_t xcfr;
102 uint32_t ct32;
103 uint32_t mcsr;
104 /* General purpose registers */
105 uint32_t gprg[6];
106 /* Exceptions */
107 uint32_t feen;
108 uint32_t fest;
109 uint32_t fema;
110 uint32_t fecl;
111 uint32_t eeen;
112 uint32_t eest;
113 uint32_t eecl;
114 uint32_t eeint;
115 uint32_t eemck0;
116 uint32_t eemck1;
117 /* Error diagnostic */
118} XCSR;
64201201 119
36081602 120static void PPC_XCSR_writeb (void *opaque,
a8170e5e 121 hwaddr addr, uint32_t value)
64201201 122{
90e189ec
BS
123 printf("%s: 0x" TARGET_FMT_plx " => 0x%08" PRIx32 "\n", __func__, addr,
124 value);
64201201
FB
125}
126
36081602 127static void PPC_XCSR_writew (void *opaque,
a8170e5e 128 hwaddr addr, uint32_t value)
9a64fbe4 129{
90e189ec
BS
130 printf("%s: 0x" TARGET_FMT_plx " => 0x%08" PRIx32 "\n", __func__, addr,
131 value);
9a64fbe4
FB
132}
133
36081602 134static void PPC_XCSR_writel (void *opaque,
a8170e5e 135 hwaddr addr, uint32_t value)
9a64fbe4 136{
90e189ec
BS
137 printf("%s: 0x" TARGET_FMT_plx " => 0x%08" PRIx32 "\n", __func__, addr,
138 value);
9a64fbe4
FB
139}
140
a8170e5e 141static uint32_t PPC_XCSR_readb (void *opaque, hwaddr addr)
64201201
FB
142{
143 uint32_t retval = 0;
9a64fbe4 144
90e189ec
BS
145 printf("%s: 0x" TARGET_FMT_plx " <= %08" PRIx32 "\n", __func__, addr,
146 retval);
9a64fbe4 147
64201201
FB
148 return retval;
149}
150
a8170e5e 151static uint32_t PPC_XCSR_readw (void *opaque, hwaddr addr)
9a64fbe4 152{
64201201
FB
153 uint32_t retval = 0;
154
90e189ec
BS
155 printf("%s: 0x" TARGET_FMT_plx " <= %08" PRIx32 "\n", __func__, addr,
156 retval);
64201201
FB
157
158 return retval;
9a64fbe4
FB
159}
160
a8170e5e 161static uint32_t PPC_XCSR_readl (void *opaque, hwaddr addr)
9a64fbe4
FB
162{
163 uint32_t retval = 0;
164
90e189ec
BS
165 printf("%s: 0x" TARGET_FMT_plx " <= %08" PRIx32 "\n", __func__, addr,
166 retval);
9a64fbe4
FB
167
168 return retval;
169}
170
0c90c52f
AK
171static const MemoryRegionOps PPC_XCSR_ops = {
172 .old_mmio = {
173 .read = { PPC_XCSR_readb, PPC_XCSR_readw, PPC_XCSR_readl, },
174 .write = { PPC_XCSR_writeb, PPC_XCSR_writew, PPC_XCSR_writel, },
175 },
176 .endianness = DEVICE_LITTLE_ENDIAN,
9a64fbe4
FB
177};
178
b6b8bd18 179#endif
9a64fbe4 180
64201201 181/* Fake super-io ports for PREP platform (Intel 82378ZB) */
c227f099 182typedef struct sysctrl_t {
c4781a51 183 qemu_irq reset_irq;
43a34704 184 M48t59State *nvram;
64201201
FB
185 uint8_t state;
186 uint8_t syscontrol;
da9b266b 187 int contiguous_map;
9a183916 188 qemu_irq contiguous_map_irq;
fb3444b8 189 int endian;
c227f099 190} sysctrl_t;
9a64fbe4 191
64201201
FB
192enum {
193 STATE_HARDFILE = 0x01,
9a64fbe4 194};
9a64fbe4 195
c227f099 196static sysctrl_t *sysctrl;
9a64fbe4 197
a541f297 198static void PREP_io_800_writeb (void *opaque, uint32_t addr, uint32_t val)
9a64fbe4 199{
c227f099 200 sysctrl_t *sysctrl = opaque;
64201201 201
aae9366a
JM
202 PPC_IO_DPRINTF("0x%08" PRIx32 " => 0x%02" PRIx32 "\n",
203 addr - PPC_IO_BASE, val);
9a64fbe4
FB
204 switch (addr) {
205 case 0x0092:
206 /* Special port 92 */
207 /* Check soft reset asked */
64201201 208 if (val & 0x01) {
c4781a51
JM
209 qemu_irq_raise(sysctrl->reset_irq);
210 } else {
211 qemu_irq_lower(sysctrl->reset_irq);
9a64fbe4
FB
212 }
213 /* Check LE mode */
64201201 214 if (val & 0x02) {
fb3444b8
FB
215 sysctrl->endian = 1;
216 } else {
217 sysctrl->endian = 0;
9a64fbe4
FB
218 }
219 break;
64201201
FB
220 case 0x0800:
221 /* Motorola CPU configuration register : read-only */
222 break;
223 case 0x0802:
224 /* Motorola base module feature register : read-only */
225 break;
226 case 0x0803:
227 /* Motorola base module status register : read-only */
228 break;
9a64fbe4 229 case 0x0808:
64201201
FB
230 /* Hardfile light register */
231 if (val & 1)
232 sysctrl->state |= STATE_HARDFILE;
233 else
234 sysctrl->state &= ~STATE_HARDFILE;
9a64fbe4
FB
235 break;
236 case 0x0810:
237 /* Password protect 1 register */
64201201
FB
238 if (sysctrl->nvram != NULL)
239 m48t59_toggle_lock(sysctrl->nvram, 1);
9a64fbe4
FB
240 break;
241 case 0x0812:
242 /* Password protect 2 register */
64201201
FB
243 if (sysctrl->nvram != NULL)
244 m48t59_toggle_lock(sysctrl->nvram, 2);
9a64fbe4
FB
245 break;
246 case 0x0814:
64201201 247 /* L2 invalidate register */
c68ea704 248 // tlb_flush(first_cpu, 1);
9a64fbe4
FB
249 break;
250 case 0x081C:
251 /* system control register */
64201201 252 sysctrl->syscontrol = val & 0x0F;
9a64fbe4
FB
253 break;
254 case 0x0850:
255 /* I/O map type register */
da9b266b 256 sysctrl->contiguous_map = val & 0x01;
9a183916 257 qemu_set_irq(sysctrl->contiguous_map_irq, sysctrl->contiguous_map);
9a64fbe4
FB
258 break;
259 default:
aae9366a
JM
260 printf("ERROR: unaffected IO port write: %04" PRIx32
261 " => %02" PRIx32"\n", addr, val);
9a64fbe4
FB
262 break;
263 }
264}
265
a541f297 266static uint32_t PREP_io_800_readb (void *opaque, uint32_t addr)
9a64fbe4 267{
c227f099 268 sysctrl_t *sysctrl = opaque;
9a64fbe4
FB
269 uint32_t retval = 0xFF;
270
271 switch (addr) {
272 case 0x0092:
273 /* Special port 92 */
b6f54b31 274 retval = sysctrl->endian << 1;
64201201
FB
275 break;
276 case 0x0800:
277 /* Motorola CPU configuration register */
278 retval = 0xEF; /* MPC750 */
279 break;
280 case 0x0802:
281 /* Motorola Base module feature register */
282 retval = 0xAD; /* No ESCC, PMC slot neither ethernet */
283 break;
284 case 0x0803:
285 /* Motorola base module status register */
286 retval = 0xE0; /* Standard MPC750 */
9a64fbe4
FB
287 break;
288 case 0x080C:
289 /* Equipment present register:
290 * no L2 cache
291 * no upgrade processor
292 * no cards in PCI slots
293 * SCSI fuse is bad
294 */
64201201
FB
295 retval = 0x3C;
296 break;
297 case 0x0810:
298 /* Motorola base module extended feature register */
299 retval = 0x39; /* No USB, CF and PCI bridge. NVRAM present */
9a64fbe4 300 break;
da9b266b
FB
301 case 0x0814:
302 /* L2 invalidate: don't care */
303 break;
9a64fbe4
FB
304 case 0x0818:
305 /* Keylock */
306 retval = 0x00;
307 break;
308 case 0x081C:
309 /* system control register
310 * 7 - 6 / 1 - 0: L2 cache enable
311 */
64201201 312 retval = sysctrl->syscontrol;
9a64fbe4
FB
313 break;
314 case 0x0823:
315 /* */
316 retval = 0x03; /* no L2 cache */
317 break;
318 case 0x0850:
319 /* I/O map type register */
da9b266b 320 retval = sysctrl->contiguous_map;
9a64fbe4
FB
321 break;
322 default:
aae9366a 323 printf("ERROR: unaffected IO port: %04" PRIx32 " read\n", addr);
9a64fbe4
FB
324 break;
325 }
aae9366a
JM
326 PPC_IO_DPRINTF("0x%08" PRIx32 " <= 0x%02" PRIx32 "\n",
327 addr - PPC_IO_BASE, retval);
9a64fbe4
FB
328
329 return retval;
330}
331
da9b266b 332
64201201 333#define NVRAM_SIZE 0x2000
a541f297 334
4556bd8b
BS
335static void cpu_request_exit(void *opaque, int irq, int level)
336{
4917cf44 337 CPUState *cpu = current_cpu;
4556bd8b 338
4917cf44
AF
339 if (cpu && level) {
340 cpu_exit(cpu);
4556bd8b
BS
341 }
342}
343
1bba0dc9
AF
344static void ppc_prep_reset(void *opaque)
345{
5c3e735f 346 PowerPCCPU *cpu = opaque;
1bba0dc9 347
5c3e735f 348 cpu_reset(CPU(cpu));
1bba0dc9
AF
349}
350
fd533eb5
JK
351static const MemoryRegionPortio prep_portio_list[] = {
352 /* System control ports */
353 { 0x0092, 1, 1, .read = PREP_io_800_readb, .write = PREP_io_800_writeb, },
354 { 0x0800, 0x52, 1,
355 .read = PREP_io_800_readb, .write = PREP_io_800_writeb, },
356 /* Special port to get debug messages from Open-Firmware */
357 { 0x0F00, 4, 1, .write = PPC_debug_write, },
358 PORTIO_END_OF_LIST(),
359};
360
848696bf
KB
361static PortioList prep_port_list;
362
26aa7d72 363/* PowerPC PREP hardware initialisation */
3ef96221 364static void ppc_prep_init(MachineState *machine)
a541f297 365{
3ef96221
MA
366 ram_addr_t ram_size = machine->ram_size;
367 const char *cpu_model = machine->cpu_model;
368 const char *kernel_filename = machine->kernel_filename;
369 const char *kernel_cmdline = machine->kernel_cmdline;
370 const char *initrd_filename = machine->initrd_filename;
371 const char *boot_device = machine->boot_order;
0c90c52f 372 MemoryRegion *sysmem = get_system_memory();
a9bf3df0 373 PowerPCCPU *cpu = NULL;
e2684c0b 374 CPUPPCState *env = NULL;
c227f099 375 nvram_t nvram;
43a34704 376 M48t59State *m48t59;
0c90c52f
AK
377#if 0
378 MemoryRegion *xcsr = g_new(MemoryRegion, 1);
379#endif
d0b25425 380 int linux_boot, i, nb_nics1;
0c90c52f 381 MemoryRegion *ram = g_new(MemoryRegion, 1);
093209cd
BS
382 uint32_t kernel_base, initrd_base;
383 long kernel_size, initrd_size;
8ca8c7bc 384 DeviceState *dev;
8ca8c7bc 385 PCIHostState *pcihost;
46e50e9d 386 PCIBus *pci_bus;
506b7ddf 387 PCIDevice *pci;
48a18b3c 388 ISABus *isa_bus;
52a71bff 389 ISADevice *isa;
4556bd8b 390 qemu_irq *cpu_exit_irq;
28c5af54 391 int ppc_boot_device;
f455e98c 392 DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
64201201 393
7267c094 394 sysctrl = g_malloc0(sizeof(sysctrl_t));
a541f297
FB
395
396 linux_boot = (kernel_filename != NULL);
0a032cbe 397
c68ea704 398 /* init CPUs */
94fc95cd 399 if (cpu_model == NULL)
b37fc148 400 cpu_model = "602";
fe33cc71 401 for (i = 0; i < smp_cpus; i++) {
a9bf3df0
AF
402 cpu = cpu_ppc_init(cpu_model);
403 if (cpu == NULL) {
aaed909a
FB
404 fprintf(stderr, "Unable to find PowerPC CPU definition\n");
405 exit(1);
406 }
a9bf3df0
AF
407 env = &cpu->env;
408
4018bae9
JM
409 if (env->flags & POWERPC_FLAG_RTC_CLK) {
410 /* POWER / PowerPC 601 RTC clock frequency is 7.8125 MHz */
411 cpu_ppc_tb_init(env, 7812500UL);
412 } else {
413 /* Set time-base frequency to 100 Mhz */
414 cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL);
415 }
5c3e735f 416 qemu_register_reset(ppc_prep_reset, cpu);
fe33cc71 417 }
a541f297
FB
418
419 /* allocate RAM */
e938ba0c 420 memory_region_allocate_system_memory(ram, NULL, "ppc_prep.ram", ram_size);
0c90c52f 421 memory_region_add_subregion(sysmem, 0, ram);
cf9c147c 422
a541f297 423 if (linux_boot) {
64201201 424 kernel_base = KERNEL_LOAD_ADDR;
a541f297 425 /* now we can load the kernel */
dcac9679
PB
426 kernel_size = load_image_targphys(kernel_filename, kernel_base,
427 ram_size - kernel_base);
64201201 428 if (kernel_size < 0) {
2ac71179 429 hw_error("qemu: could not load kernel '%s'\n", kernel_filename);
a541f297
FB
430 exit(1);
431 }
432 /* load initrd */
a541f297 433 if (initrd_filename) {
64201201 434 initrd_base = INITRD_LOAD_ADDR;
dcac9679
PB
435 initrd_size = load_image_targphys(initrd_filename, initrd_base,
436 ram_size - initrd_base);
a541f297 437 if (initrd_size < 0) {
2ac71179 438 hw_error("qemu: could not load initial ram disk '%s'\n",
4a057712 439 initrd_filename);
a541f297 440 }
64201201
FB
441 } else {
442 initrd_base = 0;
443 initrd_size = 0;
a541f297 444 }
6ac0e82d 445 ppc_boot_device = 'm';
a541f297 446 } else {
64201201
FB
447 kernel_base = 0;
448 kernel_size = 0;
449 initrd_base = 0;
450 initrd_size = 0;
28c5af54
JM
451 ppc_boot_device = '\0';
452 /* For now, OHW cannot boot from the network. */
0d913fdb
JM
453 for (i = 0; boot_device[i] != '\0'; i++) {
454 if (boot_device[i] >= 'a' && boot_device[i] <= 'f') {
455 ppc_boot_device = boot_device[i];
28c5af54 456 break;
0d913fdb 457 }
28c5af54
JM
458 }
459 if (ppc_boot_device == '\0') {
460 fprintf(stderr, "No valid boot device for Mac99 machine\n");
461 exit(1);
462 }
a541f297
FB
463 }
464
dd37a5e4 465 if (PPC_INPUT(env) != PPC_FLAGS_INPUT_6xx) {
2ac71179 466 hw_error("Only 6xx bus is supported on PREP machine\n");
dd37a5e4 467 }
8ca8c7bc
AF
468
469 dev = qdev_create(NULL, "raven-pcihost");
d0b25425
HP
470 if (bios_name == NULL) {
471 bios_name = BIOS_FILENAME;
472 }
473 qdev_prop_set_string(dev, "bios-name", bios_name);
474 qdev_prop_set_uint32(dev, "elf-machine", ELF_MACHINE);
8558d942 475 pcihost = PCI_HOST_BRIDGE(dev);
f05f6b4a 476 object_property_add_child(qdev_get_machine(), "raven", OBJECT(dev), NULL);
f424d5c4 477 qdev_init_nofail(dev);
8ca8c7bc
AF
478 pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0");
479 if (pci_bus == NULL) {
480 fprintf(stderr, "Couldn't create PCI host controller.\n");
481 exit(1);
482 }
9a183916 483 sysctrl->contiguous_map_irq = qdev_get_gpio_in(dev, 0);
8ca8c7bc 484
506b7ddf
AF
485 /* PCI -> ISA bridge */
486 pci = pci_create_simple(pci_bus, PCI_DEVFN(1, 0), "i82378");
487 cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);
182735ef 488 cpu = POWERPC_CPU(first_cpu);
506b7ddf 489 qdev_connect_gpio_out(&pci->qdev, 0,
182735ef 490 cpu->env.irq_inputs[PPC6xx_INPUT_INT]);
506b7ddf
AF
491 qdev_connect_gpio_out(&pci->qdev, 1, *cpu_exit_irq);
492 sysbus_connect_irq(&pcihost->busdev, 0, qdev_get_gpio_in(&pci->qdev, 9));
493 sysbus_connect_irq(&pcihost->busdev, 1, qdev_get_gpio_in(&pci->qdev, 11));
494 sysbus_connect_irq(&pcihost->busdev, 2, qdev_get_gpio_in(&pci->qdev, 9));
495 sysbus_connect_irq(&pcihost->busdev, 3, qdev_get_gpio_in(&pci->qdev, 11));
2ae0e48d 496 isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(pci), "isa.0"));
506b7ddf 497
52a71bff
HP
498 /* Super I/O (parallel + serial ports) */
499 isa = isa_create(isa_bus, TYPE_PC87312);
4a17cc4f
AF
500 dev = DEVICE(isa);
501 qdev_prop_set_uint8(dev, "config", 13); /* fdc, ser0, ser1, par0 */
502 qdev_init_nofail(dev);
52a71bff 503
a541f297 504 /* init basic PC hardware */
78895427 505 pci_vga_init(pci_bus);
a541f297 506
a541f297
FB
507 nb_nics1 = nb_nics;
508 if (nb_nics1 > NE2000_NB_MAX)
509 nb_nics1 = NE2000_NB_MAX;
510 for(i = 0; i < nb_nics1; i++) {
5652ef78 511 if (nd_table[i].model == NULL) {
7267c094 512 nd_table[i].model = g_strdup("ne2k_isa");
5652ef78
AJ
513 }
514 if (strcmp(nd_table[i].model, "ne2k_isa") == 0) {
48a18b3c
HP
515 isa_ne2000_init(isa_bus, ne2000_io[i], ne2000_irq[i],
516 &nd_table[i]);
a41b2ff2 517 } else {
29b358f9 518 pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL);
a41b2ff2 519 }
a541f297 520 }
a541f297 521
75717903 522 ide_drive_get(hd, MAX_IDE_BUS);
81aa0647 523 for(i = 0; i < MAX_IDE_BUS; i++) {
48a18b3c 524 isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], ide_irq[i],
e4bcb14c
TS
525 hd[2 * i],
526 hd[2 * i + 1]);
a541f297 527 }
48a18b3c 528 isa_create_simple(isa_bus, "i8042");
4556bd8b 529
182735ef
AF
530 cpu = POWERPC_CPU(first_cpu);
531 sysctrl->reset_irq = cpu->env.irq_inputs[PPC6xx_INPUT_HRESET];
fd533eb5 532
848696bf
KB
533 portio_list_init(&prep_port_list, NULL, prep_portio_list, sysctrl, "prep");
534 portio_list_add(&prep_port_list, isa_address_space_io(isa), 0x0);
fd533eb5 535
64201201 536 /* PowerPC control and status register group */
b6b8bd18 537#if 0
2c9b15ca 538 memory_region_init_io(xcsr, NULL, &PPC_XCSR_ops, NULL, "ppc-xcsr", 0x1000);
0c90c52f 539 memory_region_add_subregion(sysmem, 0xFEFF0000, xcsr);
b6b8bd18 540#endif
a541f297 541
094b287f 542 if (usb_enabled(false)) {
afb9a60e 543 pci_create_simple(pci_bus, -1, "pci-ohci");
0d92ed30
PB
544 }
545
48e93728 546 m48t59 = m48t59_init_isa(isa_bus, 0x0074, NVRAM_SIZE, 59);
3cbee15b 547 if (m48t59 == NULL)
64201201 548 return;
3cbee15b 549 sysctrl->nvram = m48t59;
64201201
FB
550
551 /* Initialise NVRAM */
3cbee15b
JM
552 nvram.opaque = m48t59;
553 nvram.read_fn = &m48t59_read;
554 nvram.write_fn = &m48t59_write;
6ac0e82d 555 PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "PREP", ram_size, ppc_boot_device,
64201201 556 kernel_base, kernel_size,
b6b8bd18 557 kernel_cmdline,
64201201
FB
558 initrd_base, initrd_size,
559 /* XXX: need an option to load a NVRAM image */
b6b8bd18
FB
560 0,
561 graphic_width, graphic_height, graphic_depth);
a541f297 562}
c0e564d5 563
f80f9ec9 564static QEMUMachine prep_machine = {
4b32e168
AL
565 .name = "prep",
566 .desc = "PowerPC PREP platform",
567 .init = ppc_prep_init,
3d878caa 568 .max_cpus = MAX_CPUS,
c1654732 569 .default_boot_order = "cad",
c0e564d5 570};
f80f9ec9
AL
571
572static void prep_machine_init(void)
573{
574 qemu_register_machine(&prep_machine);
575}
576
577machine_init(prep_machine_init);
This page took 0.940191 seconds and 4 git commands to generate.