24 Device(
const sc_core::sc_module_name& name,
QemuInstance& inst,
const char* qom_type)
29 std::function<void()> set_dev_props;
36 virtual void usb_realize(
qemu::Bus& usb_bus)
38 m_dev.set_parent_bus(usb_bus);
39 QemuDevice::end_of_elaboration();
44 std::vector<Device*> m_devices;
47 qemu_xhci(
const sc_core::sc_module_name& name, sc_core::sc_object* o, sc_core::sc_object* t)
48 : qemu_xhci(name, *(dynamic_cast<QemuInstance*>(o)), (dynamic_cast<qemu_gpex*>(t)))
51 qemu_xhci(
const sc_core::sc_module_name& n, QemuInstance& inst, qemu_gpex* gpex)
52 : qemu_gpex::
Device(n, inst,
"qemu-xhci")
54 gpex->add_device(*
this);
57 void add_device(
Device& dev)
59 if (m_inst != dev.get_qemu_inst()) {
60 SCP_FATAL(SCMOD) <<
"USB device and host have to be in same qemu instance";
62 m_devices.push_back(&dev);
65 void end_of_elaboration()
override
67 qemu_gpex::Device::end_of_elaboration();
69 qemu::Bus root_bus = m_dev.get_child_bus(
"usb-bus.0");
70 for (
Device* device : m_devices) {
71 if (device->set_dev_props) {
72 device->set_dev_props();
74 device->usb_realize(root_bus);
void end_of_elaboration() override
We cannot do the end_of_elaboration at this point because we need the USB bus (created only during th...
Definition qemu_xhci.h:33