|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v8 04/18] hw/usb/hcd-uhci: Add an auto-hub property and leave it off
Add auto-hub and leave it off. hw_compat_11_1 turns it on, so an older
machine type keeps the hub it has today and a guest saved by an older
QEMU still loads.
A companion UHCI adds its ports to the EHCI bus instead of making one,
so there the EHCI property decides. Both property lists still define
auto-hub, because hw_compat_11_1 names pci-uhci-usb, and QEMU stops
when a global names a property the device does not have.
Suggested-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
Signed-off-by: Jamin Lin <jamin_lin@xxxxxxxxxxxxxx>
---
hw/usb/hcd-uhci.h | 1 +
hw/core/machine.c | 1 +
hw/usb/hcd-uhci.c | 3 +++
3 files changed, 5 insertions(+)
diff --git a/hw/usb/hcd-uhci.h b/hw/usb/hcd-uhci.h
index 3154837f1d..06433ce3de 100644
--- a/hw/usb/hcd-uhci.h
+++ b/hw/usb/hcd-uhci.h
@@ -72,6 +72,7 @@ typedef struct UHCIState {
char *masterbus;
uint32_t firstport;
uint32_t maxframes;
+ bool auto_hub;
} UHCIState;
#define TYPE_UHCI "pci-uhci-usb"
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 0103038cad..f79337e7d7 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -46,6 +46,7 @@ GlobalProperty hw_compat_11_1[] = {
{ "sysbus-ehci-usb", "auto-hub", "on" },
{ "pci-ehci-usb", "auto-hub", "on" },
{ "base-xhci", "auto-hub", "on" },
+ { "pci-uhci-usb", "auto-hub", "on" },
};
const size_t hw_compat_11_1_len = G_N_ELEMENTS(hw_compat_11_1);
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index a7b9fe1317..36d4076c25 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -1213,6 +1213,7 @@ void usb_uhci_common_realize(PCIDevice *dev, Error **errp)
}
} else {
usb_bus_new(&s->bus, sizeof(s->bus), &uhci_bus_ops, DEVICE(dev));
+ s->bus.auto_hub = s->auto_hub;
for (i = 0; i < UHCI_PORTS; i++) {
usb_register_port(&s->bus, &s->ports[i].port, s, i, &uhci_port_ops,
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
@@ -1260,10 +1261,12 @@ static const Property uhci_properties_companion[] = {
DEFINE_PROP_UINT32("firstport", UHCIState, firstport, 0),
DEFINE_PROP_UINT32("bandwidth", UHCIState, frame_bandwidth, 1280),
DEFINE_PROP_UINT32("maxframes", UHCIState, maxframes, 128),
+ DEFINE_PROP_BOOL("auto-hub", UHCIState, auto_hub, false),
};
static const Property uhci_properties_standalone[] = {
DEFINE_PROP_UINT32("bandwidth", UHCIState, frame_bandwidth, 1280),
DEFINE_PROP_UINT32("maxframes", UHCIState, maxframes, 128),
+ DEFINE_PROP_BOOL("auto-hub", UHCIState, auto_hub, false),
};
static void uhci_class_init(ObjectClass *klass, const void *data)
--
2.43.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |