aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/hcd-ehci-pci.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-06-06 15:41:10 +0200
committerGerd Hoffmann <kraxel@redhat.com>2013-06-24 08:23:10 +0200
commitd4614cc3121b3c6375a63d01947779e36149c68c (patch)
treea6fc1a146e46f9fcb32230649be931ccae159941 /hw/usb/hcd-ehci-pci.c
parent08f4c90b2887a4499a2f199cf9410308f8ed298c (diff)
downloadqemu-d4614cc3121b3c6375a63d01947779e36149c68c.zip
qemu-d4614cc3121b3c6375a63d01947779e36149c68c.tar.gz
qemu-d4614cc3121b3c6375a63d01947779e36149c68c.tar.bz2
usb/hcd-ehci: Split off instance_init from realize
This makes the mem MemoryRegion available to derived instance_inits. Keep the bus in realize for now since naming breaks in instance_init. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/hcd-ehci-pci.c')
-rw-r--r--hw/usb/hcd-ehci-pci.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c
index b352f73..509867d 100644
--- a/hw/usb/hcd-ehci-pci.c
+++ b/hw/usb/hcd-ehci-pci.c
@@ -60,20 +60,28 @@ static int usb_ehci_pci_initfn(PCIDevice *dev)
pci_conf[0x6e] = 0x00;
pci_conf[0x6f] = 0xc0; /* USBLEFCTLSTS */
- s->caps[0x09] = 0x68; /* EECP */
-
s->irq = dev->irq[3];
s->as = pci_get_address_space(dev);
- s->capsbase = 0x00;
- s->opregbase = 0x20;
-
usb_ehci_realize(s, DEVICE(dev), NULL);
pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->mem);
return 0;
}
+static void usb_ehci_pci_init(Object *obj)
+{
+ EHCIPCIState *i = PCI_EHCI(obj);
+ EHCIState *s = &i->ehci;
+
+ s->caps[0x09] = 0x68; /* EECP */
+
+ s->capsbase = 0x00;
+ s->opregbase = 0x20;
+
+ usb_ehci_init(s, DEVICE(obj));
+}
+
static void usb_ehci_pci_write_config(PCIDevice *dev, uint32_t addr,
uint32_t val, int l)
{
@@ -122,6 +130,7 @@ static const TypeInfo ehci_pci_type_info = {
.name = TYPE_PCI_EHCI,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(EHCIPCIState),
+ .instance_init = usb_ehci_pci_init,
.abstract = true,
.class_init = ehci_class_init,
};