Commit 75717903 authored by Isaku Yamahata's avatar Isaku Yamahata Committed by Kevin Wolf
Browse files

ide: consolidate drive_get(IF_IDE)



factor out ide initialization to call drive_get(IF_IDE)

Signed-off-by: default avatarIsaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent e2982c3a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -28,4 +28,7 @@ void mmio_ide_init (target_phys_addr_t membase, target_phys_addr_t membase2,

void ide_get_bs(BlockDriverState *bs[], BusState *qbus);

/* ide/core.c */
void ide_drive_get(DriveInfo **hd, int max_bus);

#endif /* HW_IDE_H */
+14 −0
Original line number Diff line number Diff line
@@ -2826,3 +2826,17 @@ const VMStateDescription vmstate_ide_bus = {
        VMSTATE_END_OF_LIST()
    }
};

void ide_drive_get(DriveInfo **hd, int max_bus)
{
    int i;

    if (drive_get_max_bus(IF_IDE) >= max_bus) {
        fprintf(stderr, "qemu: too many IDE bus: %d\n", max_bus);
        exit(1);
    }

    for(i = 0; i < max_bus * MAX_IDE_DEVS; i++) {
        hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS);
    }
}
+1 −8
Original line number Diff line number Diff line
@@ -338,14 +338,7 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device,
    pci_bus = bonito_init((qemu_irq *)&(env->irq[2]));

    /* South bridge */
    if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {
        fprintf(stderr, "qemu: too many IDE bus\n");
        exit(1);
    }

    for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) {
        hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS);
    }
    ide_drive_get(hd, MAX_IDE_BUS);

    via_devfn = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0));
    if (via_devfn < 0) {
+1 −9
Original line number Diff line number Diff line
@@ -905,15 +905,7 @@ void mips_malta_init (ram_addr_t ram_size,
    pci_bus = gt64120_register(i8259);

    /* Southbridge */

    if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {
        fprintf(stderr, "qemu: too many IDE bus\n");
        exit(1);
    }

    for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) {
        hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS);
    }
    ide_drive_get(hd, MAX_IDE_BUS);

    piix4_devfn = piix4_init(pci_bus, 80);
    isa_bus_irqs(i8259);
+1 −9
Original line number Diff line number Diff line
@@ -287,15 +287,7 @@ void mips_r4k_init (ram_addr_t ram_size,
    if (nd_table[0].vlan)
        isa_ne2000_init(0x300, 9, &nd_table[0]);

    if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {
        fprintf(stderr, "qemu: too many IDE bus\n");
        exit(1);
    }

    for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) {
        hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS);
    }

    ide_drive_get(hd, MAX_IDE_BUS);
    for(i = 0; i < MAX_IDE_BUS; i++)
        isa_ide_init(ide_iobase[i], ide_iobase2[i], ide_irq[i],
                     hd[MAX_IDE_DEVS * i],
Loading