diff options
author | Gabe Black <gabeblack@google.com> | 2012-11-01 15:44:10 -0700 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2012-11-07 18:38:37 +0100 |
commit | 93ded5905c36d34c4e4f132623c854bbd895b8c9 (patch) | |
tree | 242d35c611db91e2351a4e942ff518a66110ca38 /payloads/libpayload/drivers/usb/uhci.c | |
parent | 8670b9b81aba6bf51510e337d4f7208d2b4ea320 (diff) |
libpayload: Turn the "debug" #define into the usb_debug static inline function.
The "debug" macro used internally in the libpayload USB subsystem was very
generically named and would leak into consumers of the library that included
usb.h directly or indirectly. This change turns that #define from a macro into
a static inline function to move away from the preprocessor, and also renames
it to usb_debug so it's less likely to collide with something unrelated.
Change-Id: I18717df111aa9671495f8a2a5bdb2c6311fa7acf
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://review.coreboot.org/1738
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Tested-by: build bot (Jenkins)
Diffstat (limited to 'payloads/libpayload/drivers/usb/uhci.c')
-rw-r--r-- | payloads/libpayload/drivers/usb/uhci.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/payloads/libpayload/drivers/usb/uhci.c b/payloads/libpayload/drivers/usb/uhci.c index 764770763a..ab4f7982d1 100644 --- a/payloads/libpayload/drivers/usb/uhci.c +++ b/payloads/libpayload/drivers/usb/uhci.c @@ -50,14 +50,14 @@ static u8* uhci_poll_intr_queue (void *queue); static void uhci_dump (hci_t *controller) { - debug ("dump:\nUSBCMD: %x\n", uhci_reg_read16 (controller, USBCMD)); - debug ("USBSTS: %x\n", uhci_reg_read16 (controller, USBSTS)); - debug ("USBINTR: %x\n", uhci_reg_read16 (controller, USBINTR)); - debug ("FRNUM: %x\n", uhci_reg_read16 (controller, FRNUM)); - debug ("FLBASEADD: %x\n", uhci_reg_read32 (controller, FLBASEADD)); - debug ("SOFMOD: %x\n", uhci_reg_read8 (controller, SOFMOD)); - debug ("PORTSC1: %x\n", uhci_reg_read16 (controller, PORTSC1)); - debug ("PORTSC2: %x\n", uhci_reg_read16 (controller, PORTSC2)); + usb_debug ("dump:\nUSBCMD: %x\n", uhci_reg_read16 (controller, USBCMD)); + usb_debug ("USBSTS: %x\n", uhci_reg_read16 (controller, USBSTS)); + usb_debug ("USBINTR: %x\n", uhci_reg_read16 (controller, USBINTR)); + usb_debug ("FRNUM: %x\n", uhci_reg_read16 (controller, FRNUM)); + usb_debug ("FLBASEADD: %x\n", uhci_reg_read32 (controller, FLBASEADD)); + usb_debug ("SOFMOD: %x\n", uhci_reg_read8 (controller, SOFMOD)); + usb_debug ("PORTSC1: %x\n", uhci_reg_read16 (controller, PORTSC1)); + usb_debug ("PORTSC2: %x\n", uhci_reg_read16 (controller, PORTSC2)); } #endif @@ -80,22 +80,22 @@ td_dump (td_t *td) sprintf(td_value, "%x", td->token & TD_PID_MASK); td_type=td_value; } - debug ("%s packet (at %lx) to %x.%x failed\n", td_type, + usb_debug ("%s packet (at %lx) to %x.%x failed\n", td_type, virt_to_phys (td), (td->token & TD_DEVADDR_MASK) >> TD_DEVADDR_SHIFT, (td->token & TD_EP_MASK) >> TD_EP_SHIFT); - debug ("td (counter at %x) returns: ", td->ctrlsts >> TD_COUNTER_SHIFT); - debug (" bitstuff err: %x, ", !!(td->ctrlsts & TD_STATUS_BITSTUFF_ERR)); - debug (" CRC err: %x, ", !!(td->ctrlsts & TD_STATUS_CRC_ERR)); - debug (" NAK rcvd: %x, ", !!(td->ctrlsts & TD_STATUS_NAK_RCVD)); - debug (" Babble: %x, ", !!(td->ctrlsts & TD_STATUS_BABBLE)); - debug (" Data Buffer err: %x, ", !!(td->ctrlsts & TD_STATUS_DATABUF_ERR)); - debug (" Stalled: %x, ", !!(td->ctrlsts & TD_STATUS_STALLED)); - debug (" Active: %x\n", !!(td->ctrlsts & TD_STATUS_ACTIVE)); + usb_debug ("td (counter at %x) returns: ", td->ctrlsts >> TD_COUNTER_SHIFT); + usb_debug (" bitstuff err: %x, ", !!(td->ctrlsts & TD_STATUS_BITSTUFF_ERR)); + usb_debug (" CRC err: %x, ", !!(td->ctrlsts & TD_STATUS_CRC_ERR)); + usb_debug (" NAK rcvd: %x, ", !!(td->ctrlsts & TD_STATUS_NAK_RCVD)); + usb_debug (" Babble: %x, ", !!(td->ctrlsts & TD_STATUS_BABBLE)); + usb_debug (" Data Buffer err: %x, ", !!(td->ctrlsts & TD_STATUS_DATABUF_ERR)); + usb_debug (" Stalled: %x, ", !!(td->ctrlsts & TD_STATUS_STALLED)); + usb_debug (" Active: %x\n", !!(td->ctrlsts & TD_STATUS_ACTIVE)); if (td->ctrlsts & TD_STATUS_BABBLE) - debug (" Babble because of %s\n", + usb_debug (" Babble because of %s\n", (td->ctrlsts & TD_STATUS_BITSTUFF_ERR) ? "host" : "device"); if (td->ctrlsts & TD_STATUS_ACTIVE) - debug (" still active - timeout?\n"); + usb_debug (" still active - timeout?\n"); } static void @@ -113,12 +113,12 @@ uhci_reset (hci_t *controller) while (((uhci_reg_read16 (controller, USBCMD) & 2) != 0) && timeout--) udelay (500); if (timeout < 0) - debug ("Warning: uhci: host controller reset timed out.\n"); + usb_debug ("Warning: uhci: host controller reset timed out.\n"); uhci_reg_write32 (controller, FLBASEADD, (u32) virt_to_phys (UHCI_INST (controller)-> framelistptr)); - //debug ("framelist at %p\n",UHCI_INST(controller)->framelistptr); + //usb_debug ("framelist at %p\n",UHCI_INST(controller)->framelistptr); /* disable irqs */ uhci_reg_write16 (controller, USBINTR, 0); @@ -364,7 +364,7 @@ uhci_control (usbdev_t *dev, direction_t dir, int drlen, void *devreq, int dalen if (td == 0) { result = 0; } else { - debug ("control packet, req %x\n", req); + usb_debug ("control packet, req %x\n", req); td_dump (td); result = 1; } @@ -445,7 +445,7 @@ uhci_bulk (endpoint_t *ep, int size, u8 *data, int finalize) size -= maxpsize; } if (run_schedule (ep->dev, tds) == 1) { - debug("Stalled. Trying to clean up.\n"); + usb_debug("Stalled. Trying to clean up.\n"); clear_stall (ep); free (tds); return 1; |