@@ -200,20 +200,27 @@ static void pc_q35_init_late(BusState **idebus, ISADevice *rtc_state,
idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1");
if (usb_enabled) {
+ int i;
+ PCIDevice *usb;
+ DeviceState *usb_qdev;
+
/* Should we create 6 UHCI according to ich9 spec? */
- pci_create_simple_multifunction(
- host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI1_FUNC),
- true, "ich9-usb-uhci1");
- pci_create_simple_multifunction(
- host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI2_FUNC),
- true, "ich9-usb-uhci2");
- pci_create_simple_multifunction(
- host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI3_FUNC),
- true, "ich9-usb-uhci3");
- pci_create_simple_multifunction(
+ usb = pci_create_multifunction(
host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_EHCI1_FUNC),
true, "ich9-usb-ehci1");
- /* XXX: EHCI */
+ usb_qdev = &usb->qdev;
+ usb_qdev->id = g_strdup("ich9-usb-bus");
+ qdev_init_nofail(usb_qdev);
+
+ for (i = 0; i < 3; i++) {
+ usb = pci_create_multifunction(
+ host_bus, PCI_DEVFN(ICH9_USB_DEV, ICH9_USB_UHCI1_FUNC + i),
+ true, "ich9-usb-uhci1");
+ usb_qdev = &usb->qdev;
+ qdev_prop_set_string(usb_qdev, "masterbus", "ich9-usb-bus.0");
+ qdev_prop_set_uint32(usb_qdev, "firstport", i * 2);
+ qdev_init_nofail(usb_qdev);
+ }
}
/* TODO: Populate SPD eeprom data. */