[SeaBIOS] [PATCH 3/3] usb: add xhci support
Gerd Hoffmann
kraxel at redhat.com
Fri Sep 6 12:43:11 CEST 2013
> > +static struct xhci_device *xhci_find_alloc_device(struct usb_xhci_s *xhci,
> > + struct usbdevice_s *usbdev)
> > +{
> > + ASSERT32FLAT();
> > + struct xhci_device *dev;
> > +
> > + for (dev = xhci->list; dev != NULL; dev = dev->next) {
> > + if (dev->usbdev == usbdev) {
> > + return dev;
> > + }
> > + }
>
> I have not done a full review, but I did notice the above. The
> freelist has a longer lifetime than a usbdev, so I don't think it is
> safe to compare to it. (Nothing stops a usbdev from being free'd and
> a new one being alloc'd at the same address.)
Unlinking the usbdev on disconnect() should take care of this.
Incremental fix attached.
> Can the needed info from usbdev be copied into the pipe so that a long
> held reference isn't needed?
This is needed when allocating a new pipe. Basically because xhci has
not only per-pipe data structures (like ehci/uhci/ohci), but also a
per-device data structure called "device context". When allocating a
new pipe I'll have to find the device context so I can hook up the
endpoint context for the new pipe properly.
cheers,
Gerd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fixup-xhci-switch-to-hlist-unlink-device-on-disconne.patch
Type: text/x-patch
Size: 2083 bytes
Desc: not available
URL: <http://www.seabios.org/pipermail/seabios/attachments/20130906/07609414/attachment.patch>
More information about the SeaBIOS
mailing list