[SeaBIOS] [PATCH 2/2] usb-xhci: use hub portmap
Paul Menzel
pmenzel at molgen.mpg.de
Tue Jul 18 13:51:45 CEST 2017
Dear Gerd,
On 07/18/17 13:36, 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.
How can the change be tested? Do you have some QEMU command?
> 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
*assume* without the 3rd person singular s?
> + 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,
> };
Kind regards,
Paul
More information about the SeaBIOS
mailing list