void mmio_ide_init_drives(DeviceState *dev, DriveInfo *hd0, DriveInfo *hd1) { MMIOState *s = MMIO_IDE(dev); if (hd0 != NULL) { ide_create_drive(&s->bus, 0, hd0); } if (hd1 != NULL) { ide_create_drive(&s->bus, 1, hd1); } }
ISADevice *pc98_ide_init(DriveInfo **hd_table) { ISADevice *dev; PC98IDEState *s; static const int bus[4] = { 0, 0, 1, 1 }; static const int unit[4] = { 0, 1, 0, 1 }; int i; dev = isa_create("pc98-ide"); if (qdev_init(&dev->qdev) < 0) { return NULL; } s = DO_UPCAST(PC98IDEState, dev, dev); for (i = 0; i < 4; i++) { if (hd_table[i] == NULL) continue; ide_create_drive(s->bus + bus[i], unit[i], hd_table[i]); if (s->bus[bus[i]].ifs[unit[i]].drive_kind == IDE_HD) { s->bus[bus[i]].ifs[unit[i]].support_chs = 1; } } return dev; }