提交 3835510f 编写于 作者: G Gleb Natapov 提交者: Blue Swirl

Store IDE bus id in IDEBus structure for easy access.

Signed-off-by: NGleb Natapov <gleb@redhat.com>
Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
上级 6a26e119
...@@ -253,8 +253,8 @@ static int pci_cmd646_ide_initfn(PCIDevice *dev) ...@@ -253,8 +253,8 @@ static int pci_cmd646_ide_initfn(PCIDevice *dev)
pci_conf[PCI_INTERRUPT_PIN] = 0x01; // interrupt on pin 1 pci_conf[PCI_INTERRUPT_PIN] = 0x01; // interrupt on pin 1
irq = qemu_allocate_irqs(cmd646_set_irq, d, 2); irq = qemu_allocate_irqs(cmd646_set_irq, d, 2);
ide_bus_new(&d->bus[0], &d->dev.qdev); ide_bus_new(&d->bus[0], &d->dev.qdev, 0);
ide_bus_new(&d->bus[1], &d->dev.qdev); ide_bus_new(&d->bus[1], &d->dev.qdev, 1);
ide_init2(&d->bus[0], irq[0]); ide_init2(&d->bus[0], irq[0]);
ide_init2(&d->bus[1], irq[1]); ide_init2(&d->bus[1], irq[1]);
......
...@@ -449,6 +449,7 @@ struct IDEBus { ...@@ -449,6 +449,7 @@ struct IDEBus {
IDEDevice *slave; IDEDevice *slave;
BMDMAState *bmdma; BMDMAState *bmdma;
IDEState ifs[2]; IDEState ifs[2];
int bus_id;
uint8_t unit; uint8_t unit;
uint8_t cmd; uint8_t cmd;
qemu_irq irq; qemu_irq irq;
...@@ -567,7 +568,7 @@ void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0, ...@@ -567,7 +568,7 @@ void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0,
void ide_init_ioport(IDEBus *bus, int iobase, int iobase2); void ide_init_ioport(IDEBus *bus, int iobase, int iobase2);
/* hw/ide/qdev.c */ /* hw/ide/qdev.c */
void ide_bus_new(IDEBus *idebus, DeviceState *dev); void ide_bus_new(IDEBus *idebus, DeviceState *dev, int bus_id);
IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive); IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive);
#endif /* HW_IDE_INTERNAL_H */ #endif /* HW_IDE_INTERNAL_H */
...@@ -67,7 +67,7 @@ static int isa_ide_initfn(ISADevice *dev) ...@@ -67,7 +67,7 @@ static int isa_ide_initfn(ISADevice *dev)
{ {
ISAIDEState *s = DO_UPCAST(ISAIDEState, dev, dev); ISAIDEState *s = DO_UPCAST(ISAIDEState, dev, dev);
ide_bus_new(&s->bus, &s->dev.qdev); ide_bus_new(&s->bus, &s->dev.qdev, 0);
ide_init_ioport(&s->bus, s->iobase, s->iobase2); ide_init_ioport(&s->bus, s->iobase, s->iobase2);
isa_init_irq(dev, &s->irq, s->isairq); isa_init_irq(dev, &s->irq, s->isairq);
isa_init_ioport_range(dev, s->iobase, 8); isa_init_ioport_range(dev, s->iobase, 8);
......
...@@ -125,8 +125,8 @@ static int pci_piix_ide_initfn(PCIIDEState *d) ...@@ -125,8 +125,8 @@ static int pci_piix_ide_initfn(PCIIDEState *d)
vmstate_register(&d->dev.qdev, 0, &vmstate_ide_pci, d); vmstate_register(&d->dev.qdev, 0, &vmstate_ide_pci, d);
ide_bus_new(&d->bus[0], &d->dev.qdev); ide_bus_new(&d->bus[0], &d->dev.qdev, 0);
ide_bus_new(&d->bus[1], &d->dev.qdev); ide_bus_new(&d->bus[1], &d->dev.qdev, 1);
ide_init_ioport(&d->bus[0], 0x1f0, 0x3f6); ide_init_ioport(&d->bus[0], 0x1f0, 0x3f6);
ide_init_ioport(&d->bus[1], 0x170, 0x376); ide_init_ioport(&d->bus[1], 0x170, 0x376);
......
...@@ -29,9 +29,10 @@ static struct BusInfo ide_bus_info = { ...@@ -29,9 +29,10 @@ static struct BusInfo ide_bus_info = {
.size = sizeof(IDEBus), .size = sizeof(IDEBus),
}; };
void ide_bus_new(IDEBus *idebus, DeviceState *dev) void ide_bus_new(IDEBus *idebus, DeviceState *dev, int bus_id)
{ {
qbus_create_inplace(&idebus->qbus, &ide_bus_info, dev, NULL); qbus_create_inplace(&idebus->qbus, &ide_bus_info, dev, NULL);
idebus->bus_id = bus_id;
} }
static int ide_qdev_init(DeviceState *qdev, DeviceInfo *base) static int ide_qdev_init(DeviceState *qdev, DeviceInfo *base)
......
...@@ -154,8 +154,8 @@ static int vt82c686b_ide_initfn(PCIDevice *dev) ...@@ -154,8 +154,8 @@ static int vt82c686b_ide_initfn(PCIDevice *dev)
vmstate_register(&dev->qdev, 0, &vmstate_ide_pci, d); vmstate_register(&dev->qdev, 0, &vmstate_ide_pci, d);
ide_bus_new(&d->bus[0], &d->dev.qdev); ide_bus_new(&d->bus[0], &d->dev.qdev, 0);
ide_bus_new(&d->bus[1], &d->dev.qdev); ide_bus_new(&d->bus[1], &d->dev.qdev, 1);
ide_init2(&d->bus[0], isa_reserve_irq(14)); ide_init2(&d->bus[0], isa_reserve_irq(14));
ide_init2(&d->bus[1], isa_reserve_irq(15)); ide_init2(&d->bus[1], isa_reserve_irq(15));
ide_init_ioport(&d->bus[0], 0x1f0, 0x3f6); ide_init_ioport(&d->bus[0], 0x1f0, 0x3f6);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册