[SeaBIOS] [PATCH 2/2] usb-xhci: use hub portmap

Kevin O'Connor kevin at koconnor.net
Thu Jul 20 15:51:55 CEST 2017


On Tue, Jul 18, 2017 at 01:36:35PM +0200, Gerd Hoffmann wrote:
> 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;

Real hardware often does not have the same number of usb3 ports as
usb2 ports, so I think this would break the bootorder on coreboot.
(As well as on qemu with pci passthrough.)

-Kevin



More information about the SeaBIOS mailing list