[SeaBIOS] xhci controller and slot count

Kevin O'Connor kevin at koconnor.net
Mon Dec 30 00:27:19 CET 2013


On Sun, Dec 29, 2013 at 03:11:32PM -0500, Kevin O'Connor wrote:
> I think I've found the remaining issue with the XHCI controller on my
> e350m1.  The controller doesn't like the dummy context entries count
> that seabios assigns during a configure event.  The patch below allows
> me to use keyboard and mice on the xhci controller.  Interestingly,
> the xhci controller doesn't seem to care about that field at all when
> using super speed devices.
> 
> However, the controller still doesn't work for high speed flash
> devices.  It looks like the controller doesn't like getting two
> configure events - it accepts the first configure event for the bulkin
> pipe, but then complains about the second configure event for the
> bulkout pipe.  Unfortunately, it looks like fixing this would require
> significant changes to the seabios usb code.

The reason the previous patch didn't work for flash drives is that the
bit math was incorrect.  I've updated the patch and now all of my
devices are working when connected to the xhci root ports.

I've updated the xhci testing tree with this patch:
https://github.com/KevinOConnor/seabios/tree/xhci-testing

-Kevin


>From 1a03788e394b816de9061329e4b5fbe50bf1f8d2 Mon Sep 17 00:00:00 2001
Message-Id: <1a03788e394b816de9061329e4b5fbe50bf1f8d2.1388359379.git.kevin at koconnor.net>
From: Kevin O'Connor <kevin at koconnor.net>
Date: Sun, 29 Dec 2013 18:17:57 -0500
Subject: [PATCH] xhci: Don't use a dummy endpoint count in configure command.
To: seabios at seabios.org

At least some real-world controllers expect the endpoint count in the
inctx to be accurate, so set it to the pipe currently being activated.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/hw/usb-xhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hw/usb-xhci.c b/src/hw/usb-xhci.c
index 9a1954c..6f5604e 100644
--- a/src/hw/usb-xhci.c
+++ b/src/hw/usb-xhci.c
@@ -922,7 +922,7 @@ xhci_alloc_pipe(struct usbdevice_s *usbdev
             goto fail;
         in->add |= (1 << pipe->epid);
         struct xhci_slotctx *slot = (void*)&in[1 << xhci->context64];
-        slot->ctx[0] |= (31 << 27); // context entries
+        slot->ctx[0] = (slot->ctx[0] & ~0xf8000000) | (pipe->epid << 27);
 
         struct xhci_epctx *ep = (void*)&in[(pipe->epid+1) << xhci->context64];
         if (eptype == USB_ENDPOINT_XFER_INT)
-- 
1.8.3.1




More information about the SeaBIOS mailing list