diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2014-10-16 13:23:08 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2014-10-16 16:30:10 -0400 |
commit | c427deff961c022d06bc3527e37dea654393e5cb (patch) | |
tree | 0e1f8e2655f907bb34212173ae2a67ee6825c1ad /src/hw | |
parent | 2bfd170cc3c33d575eb61295312e695ac95643ef (diff) | |
download | seabios-hppa-c427deff961c022d06bc3527e37dea654393e5cb.zip seabios-hppa-c427deff961c022d06bc3527e37dea654393e5cb.tar.gz seabios-hppa-c427deff961c022d06bc3527e37dea654393e5cb.tar.bz2 |
xhci: Change xhci_update_pipe() to xhci_realloc_pipe() and use for alloc too
Instead of exporting both xhci_alloc_pipe() and xhci_update_pipe(),
export only xhci_realloc_pipe() and support alloc, update, and free
from it.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/hw')
-rw-r--r-- | src/hw/usb-xhci.c | 14 | ||||
-rw-r--r-- | src/hw/usb-xhci.h | 8 | ||||
-rw-r--r-- | src/hw/usb.c | 4 |
3 files changed, 14 insertions, 12 deletions
diff --git a/src/hw/usb-xhci.c b/src/hw/usb-xhci.c index 0b8ed64..d6caa77 100644 --- a/src/hw/usb-xhci.c +++ b/src/hw/usb-xhci.c @@ -972,12 +972,10 @@ static int xhci_config_hub(struct usbhub_s *hub) return 0; } -struct usb_pipe * +static struct usb_pipe * xhci_alloc_pipe(struct usbdevice_s *usbdev , struct usb_endpoint_descriptor *epdesc) { - if (!CONFIG_USB_XHCI) - return NULL; u8 eptype = epdesc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; struct usb_xhci_s *xhci = container_of( usbdev->hub->cntl, struct usb_xhci_s, usb); @@ -1077,11 +1075,17 @@ fail: } struct usb_pipe * -xhci_update_pipe(struct usbdevice_s *usbdev, struct usb_pipe *upipe - , struct usb_endpoint_descriptor *epdesc) +xhci_realloc_pipe(struct usbdevice_s *usbdev, struct usb_pipe *upipe + , struct usb_endpoint_descriptor *epdesc) { if (!CONFIG_USB_XHCI) return NULL; + if (!epdesc) { + usb_add_freelist(upipe); + return NULL; + } + if (!upipe) + return xhci_alloc_pipe(usbdev, epdesc); u8 eptype = epdesc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; int oldmaxpacket = upipe->maxpacket; usb_desc2pipe(upipe, usbdev, epdesc); diff --git a/src/hw/usb-xhci.h b/src/hw/usb-xhci.h index 7639409..807d597 100644 --- a/src/hw/usb-xhci.h +++ b/src/hw/usb-xhci.h @@ -9,11 +9,9 @@ struct usb_pipe; // usb-xhci.c void xhci_setup(void); -struct usb_pipe *xhci_alloc_pipe(struct usbdevice_s *usbdev - , struct usb_endpoint_descriptor *epdesc); -struct usb_pipe *xhci_update_pipe(struct usbdevice_s *usbdev - , struct usb_pipe *pipe - , struct usb_endpoint_descriptor *epdesc); +struct usb_pipe *xhci_realloc_pipe(struct usbdevice_s *usbdev + , struct usb_pipe *upipe + , struct usb_endpoint_descriptor *epdesc); int xhci_send_control(struct usb_pipe *p, int dir, const void *cmd, int cmdsize , void *data, int datasize); int xhci_send_bulk(struct usb_pipe *p, int dir, void *data, int datasize); diff --git a/src/hw/usb.c b/src/hw/usb.c index f7d5502..1fb5051 100644 --- a/src/hw/usb.c +++ b/src/hw/usb.c @@ -40,7 +40,7 @@ usb_alloc_pipe(struct usbdevice_s *usbdev case USB_TYPE_EHCI: return ehci_alloc_pipe(usbdev, epdesc); case USB_TYPE_XHCI: - return xhci_alloc_pipe(usbdev, epdesc); + return xhci_realloc_pipe(usbdev, NULL, epdesc); } } @@ -51,7 +51,7 @@ usb_update_pipe(struct usbdevice_s *usbdev, struct usb_pipe *pipe { switch (usbdev->hub->cntl->type) { case USB_TYPE_XHCI: - return xhci_update_pipe(usbdev, pipe, epdesc); + return xhci_realloc_pipe(usbdev, pipe, epdesc); default: usb_free_pipe(usbdev, pipe); return usb_alloc_pipe(usbdev, epdesc); |