[SeaBIOS] [PATCH 2/2] usb-xhci: use hub portmap
Gerd Hoffmann
kraxel at redhat.com
Tue Jul 18 13:36:35 CEST 2017
xhci controllers have two virtual ports per (usb3 capable) physical
port, one for usb2 and one for usb3 devices. Add a hub portmap callback
to map the virtual ports to physical ports. For now assume we simply
have the same number of usb2 and usb3 ports.
Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
src/hw/usb-xhci.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/hw/usb-xhci.c b/src/hw/usb-xhci.c
index 69954b9d8d..803822aece 100644
--- a/src/hw/usb-xhci.c
+++ b/src/hw/usb-xhci.c
@@ -374,6 +374,16 @@ xhci_hub_reset(struct usbhub_s *hub, u32 port)
return rc;
}
+static int
+xhci_hub_portmap(struct usbhub_s *hub, u32 port)
+{
+ struct usb_xhci_s *xhci = container_of(hub->cntl, struct usb_xhci_s, usb);
+
+ // we don't parse the extended capabilities, so we take a shortcut
+ // here and assumes we have the same number of usb2 and usb3 ports
+ return port % (xhci->ports/2) + 1;
+}
+
static void
xhci_hub_disconnect(struct usbhub_s *hub, u32 port)
{
@@ -383,6 +393,7 @@ xhci_hub_disconnect(struct usbhub_s *hub, u32 port)
static struct usbhub_op_s xhci_hub_ops = {
.detect = xhci_hub_detect,
.reset = xhci_hub_reset,
+ .portmap = xhci_hub_portmap,
.disconnect = xhci_hub_disconnect,
};
--
2.9.3
More information about the SeaBIOS
mailing list