Index: hw/r2d.c =================================================================== --- hw/r2d.c (revision 6618) +++ hw/r2d.c (working copy) @@ -224,29 +224,41 @@ serial_hds[2]); /* onboard CF (True IDE mode, Master only). */ - mmio_ide_init(0x14001000, 0x1400080c, irq[CF_IDE], 1, - drives_table[drive_get_index(IF_IDE, 0, 0)].bdrv, NULL); + if ((i = drive_get_index(IF_IDE, 0, 0)) != -1) + mmio_ide_init(0x14001000, 0x1400080c, irq[CF_IDE], 1, + drives_table[drive_get_index(IF_IDE, 0, 0)].bdrv, NULL); + /* PCI host and peripherals */ + pci = sh_pci_register_bus(r2d_pci_set_irq, r2d_pci_map_irq, irq, 0, 4); + /* NIC: rtl8139 on-board, and 2 slots. */ - pci_nic_init(pci, &nd_table[0], 2 << 3, "rtl8139"); + if (nb_nics) + pci_nic_init(pci, &nd_table[0], 2 << 3, "rtl8139"); for (i = 1; i < nb_nics; i++) pci_nic_init(pci, &nd_table[i], -1, "ne2k_pci"); + if (usb_enabled) + usb_ohci_init_pci(pci, 4, -1); + /* Todo: register on board registers */ - { + if (kernel_filename) { int kernel_size; /* initialization which should be done by firmware */ stl_phys(SH7750_BCR1, 1<<3); /* cs3 SDRAM */ stw_phys(SH7750_BCR2, 3<<(3*2)); /* cs3 32bit */ - kernel_size = load_image(kernel_filename, phys_ram_base); - + if (kernel_cmdline) { + kernel_size = load_image(kernel_filename, phys_ram_base + 0x80000); + env->pc = (SDRAM_BASE + 0x80000) | 0xa0000000; + pstrcpy(phys_ram_base + 0x10100, 256, kernel_cmdline); + } else { + kernel_size = load_image(kernel_filename, phys_ram_base); + env->pc = SDRAM_BASE | 0xa0000000; /* Start from P2 area */ + } if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } - - env->pc = SDRAM_BASE | 0xa0000000; /* Start from P2 area */ } }