Hi, > Does it make sense to have an EHCI bus type that inherits from USBBus? > > That way we could change USBPortOps into methods of the USBBus that the > subclass overrides.
I don't think this is useful. USBPortOps should be identical for both cases. > That would strongly decouple the EHCI code from the PCI device. Then > the ehci-pci device just needs to setup the EHCI bus and forward MMIO > requests appropriately. I think what we need to do is: (1) Create EHCIPCIState, which holds just PCIDevice and EHCIState. (2) Setup dma context in pci init function, then switch over all memory access from pci_* to dma_* (simliar to ohci). Generic ehci code should not have any pci references any more then. Now: (3) create EHCISysbusState, hook up sysbus init function which does mmio registration, dma context setup and irq windup the sysbus way. cheers, Gerd