libpayload: Use usb_debug() to show USB messages
Previously printf()'s were used to show USB messages which results in lots of USB information being shown when it isn't needed. This will now use the usb_debug() printing funtion that already exists in usb.h. Change-Id: I2199814de3327417417eb2e26a660f4a5557cb9f Signed-off-by: Dave Frodin <dave.frodin@se-eng.com> Reviewed-on: http://review.coreboot.org/2044 Tested-by: build bot (Jenkins) Reviewed-by: Anton Kochkov <anton.kochkov@gmail.com>
This commit is contained in:
parent
8024b65550
commit
6bf11cf50c
|
@ -206,7 +206,7 @@ static int wait_for_tds(qtd_t *head)
|
|||
&& timeout--)
|
||||
udelay(50);
|
||||
if (timeout < 0) {
|
||||
printf("Error: ehci: queue transfer "
|
||||
usb_debug("Error: ehci: queue transfer "
|
||||
"processing timed out.\n");
|
||||
return 1;
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ static int ehci_control (usbdev_t *dev, direction_t dir, int drlen, void *devreq
|
|||
(EHCI_SETUP << QTD_PID_SHIFT) |
|
||||
(3 << QTD_CERR_SHIFT);
|
||||
if (fill_td(cur, devreq, drlen) != drlen) {
|
||||
printf("ERROR: couldn't send the entire device request\n");
|
||||
usb_debug("ERROR: couldn't send the entire device request\n");
|
||||
}
|
||||
qtd_t *next = memalign(32, sizeof(qtd_t));
|
||||
cur->next_qtd = virt_to_phys(next);
|
||||
|
@ -379,7 +379,7 @@ static int ehci_control (usbdev_t *dev, direction_t dir, int drlen, void *devreq
|
|||
(((dir == OUT)?EHCI_OUT:EHCI_IN) << QTD_PID_SHIFT) |
|
||||
(3 << QTD_CERR_SHIFT);
|
||||
if (fill_td(cur, data, dalen) != dalen) {
|
||||
printf("ERROR: couldn't send the entire control payload\n");
|
||||
usb_debug("ERROR: couldn't send the entire control payload\n");
|
||||
}
|
||||
next = memalign(32, sizeof(qtd_t));
|
||||
cur->next_qtd = virt_to_phys(next);
|
||||
|
@ -556,7 +556,7 @@ static void *ehci_create_intr_queue(
|
|||
}
|
||||
}
|
||||
if (nothing_placed) {
|
||||
printf("Error: Failed to place ehci interrupt queue head "
|
||||
usb_debug("Error: Failed to place ehci interrupt queue head "
|
||||
"into periodic schedule: no space left\n");
|
||||
ehci_destroy_intr_queue(ep, intrq);
|
||||
return NULL;
|
||||
|
|
|
@ -107,7 +107,7 @@ ehci_rh_scanport (usbdev_t *dev, int port)
|
|||
while ((RH_INST(dev)->ports[port] & P_PORT_RESET) && timeout--)
|
||||
udelay(100);
|
||||
if (RH_INST(dev)->ports[port] & P_PORT_RESET) {
|
||||
printf("Error: ehci_rh: port reset timed out.\n");
|
||||
usb_debug("Error: ehci_rh: port reset timed out.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ ohci_init (pcidev_t addr)
|
|||
* BASE ADDRESS only [31-12] bits. All other usually 0, but not all */
|
||||
controller->reg_base = pci_read_config32 (controller->bus_address, 0x10) & 0xfffff000; // OHCI mandates MMIO, so bit 0 is clear
|
||||
OHCI_INST (controller)->opreg = (opreg_t*)phys_to_virt(controller->reg_base);
|
||||
printf("OHCI Version %x.%x\n", (OHCI_INST (controller)->opreg->HcRevision >> 4) & 0xf, OHCI_INST (controller)->opreg->HcRevision & 0xf);
|
||||
usb_debug("OHCI Version %x.%x\n", (OHCI_INST (controller)->opreg->HcRevision >> 4) & 0xf, OHCI_INST (controller)->opreg->HcRevision & 0xf);
|
||||
|
||||
if ((OHCI_INST (controller)->opreg->HcControl & HostControllerFunctionalStateMask) == USBReset) {
|
||||
/* cold boot */
|
||||
|
@ -245,7 +245,7 @@ wait_for_ed(usbdev_t *dev, ed_t *head, int pages)
|
|||
mdelay(1);
|
||||
}
|
||||
if (timeout < 0)
|
||||
printf("Error: ohci: endpoint "
|
||||
usb_debug("Error: ohci: endpoint "
|
||||
"descriptor processing timed out.\n");
|
||||
/* Clear the done queue. */
|
||||
ohci_process_done_queue(OHCI_INST(dev->controller), 1);
|
||||
|
@ -609,7 +609,7 @@ ohci_create_intr_queue(endpoint_t *const ep, const int reqsize,
|
|||
}
|
||||
}
|
||||
if (nothing_placed) {
|
||||
printf("Error: Failed to place ohci interrupt endpoint "
|
||||
usb_debug("Error: Failed to place ohci interrupt endpoint "
|
||||
"descriptor into periodic table: no space left\n");
|
||||
ohci_destroy_intr_queue(ep, intrq);
|
||||
return NULL;
|
||||
|
|
|
@ -532,7 +532,7 @@ uhci_create_intr_queue (endpoint_t *ep, int reqsize, int reqcount, int reqtiming
|
|||
}
|
||||
}
|
||||
if (nothing_placed) {
|
||||
printf("Error: Failed to place UHCI interrupt queue "
|
||||
usb_debug("Error: Failed to place UHCI interrupt queue "
|
||||
"head into framelist: no space left\n");
|
||||
uhci_destroy_intr_queue(ep, q);
|
||||
return NULL;
|
||||
|
|
|
@ -286,7 +286,7 @@ set_address (hci_t *controller, int speed, int hubport, int hubaddr)
|
|||
(device_to_host, standard_type, dev_recp), 1, 0, 0);
|
||||
dd = (device_descriptor_t *) dev->descriptor;
|
||||
|
||||
printf ("* found device (0x%04x:0x%04x, USB %x.%x)",
|
||||
usb_debug ("* found device (0x%04x:0x%04x, USB %x.%x)",
|
||||
dd->idVendor, dd->idProduct,
|
||||
dd->bcdUSB >> 8, dd->bcdUSB & 0xff);
|
||||
dev->quirks = usb_quirk_check(dd->idVendor, dd->idProduct);
|
||||
|
@ -294,7 +294,7 @@ set_address (hci_t *controller, int speed, int hubport, int hubaddr)
|
|||
usb_debug ("\ndevice has %x configurations\n", dd->bNumConfigurations);
|
||||
if (dd->bNumConfigurations == 0) {
|
||||
/* device isn't usable */
|
||||
printf ("... no usable configuration!\n");
|
||||
usb_debug ("... no usable configuration!\n");
|
||||
dev->address = 0;
|
||||
return -1;
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ set_address (hci_t *controller, int speed, int hubport, int hubaddr)
|
|||
num = interfaces;
|
||||
} else {
|
||||
|
||||
printf ("\nNOTICE: This driver defaults to using the first interface.\n"
|
||||
usb_debug ("\nNOTICE: This driver defaults to using the first interface.\n"
|
||||
"This might be the wrong choice and lead to limited functionality\n"
|
||||
"of the device. Please report such a case to coreboot@coreboot.org\n"
|
||||
"as you might be the first.\n");
|
||||
|
@ -390,16 +390,16 @@ set_address (hci_t *controller, int speed, int hubport, int hubaddr)
|
|||
wireless_device = 0xe0,
|
||||
misc_device = 0xef,
|
||||
};
|
||||
printf(", class: ");
|
||||
usb_debug(", class: ");
|
||||
switch (class) {
|
||||
case audio_device:
|
||||
printf("audio\n");
|
||||
usb_debug("audio\n");
|
||||
break;
|
||||
case comm_device:
|
||||
printf("communication\n");
|
||||
usb_debug("communication\n");
|
||||
break;
|
||||
case hid_device:
|
||||
printf ("HID\n");
|
||||
usb_debug ("HID\n");
|
||||
#ifdef CONFIG_USB_HID
|
||||
controller->devices[adr]->init = usb_hid_init;
|
||||
#else
|
||||
|
@ -407,16 +407,16 @@ set_address (hci_t *controller, int speed, int hubport, int hubaddr)
|
|||
#endif
|
||||
break;
|
||||
case physical_device:
|
||||
printf("physical\n");
|
||||
usb_debug("physical\n");
|
||||
break;
|
||||
case imaging_device:
|
||||
printf("camera\n");
|
||||
usb_debug("camera\n");
|
||||
break;
|
||||
case printer_device:
|
||||
printf("printer\n");
|
||||
usb_debug("printer\n");
|
||||
break;
|
||||
case msc_device:
|
||||
printf ("MSC\n");
|
||||
usb_debug ("MSC\n");
|
||||
#ifdef CONFIG_USB_MSC
|
||||
controller->devices[adr]->init = usb_msc_init;
|
||||
#else
|
||||
|
@ -424,7 +424,7 @@ set_address (hci_t *controller, int speed, int hubport, int hubaddr)
|
|||
#endif
|
||||
break;
|
||||
case hub_device:
|
||||
printf ("hub\n");
|
||||
usb_debug ("hub\n");
|
||||
#ifdef CONFIG_USB_HUB
|
||||
controller->devices[adr]->init = usb_hub_init;
|
||||
#else
|
||||
|
@ -432,28 +432,28 @@ set_address (hci_t *controller, int speed, int hubport, int hubaddr)
|
|||
#endif
|
||||
break;
|
||||
case cdc_device:
|
||||
printf("CDC\n");
|
||||
usb_debug("CDC\n");
|
||||
break;
|
||||
case ccid_device:
|
||||
printf("smartcard / CCID\n");
|
||||
usb_debug("smartcard / CCID\n");
|
||||
break;
|
||||
case security_device:
|
||||
printf("content security\n");
|
||||
usb_debug("content security\n");
|
||||
break;
|
||||
case video_device:
|
||||
printf("video\n");
|
||||
usb_debug("video\n");
|
||||
break;
|
||||
case healthcare_device:
|
||||
printf("healthcare\n");
|
||||
usb_debug("healthcare\n");
|
||||
break;
|
||||
case diagnostic_device:
|
||||
printf("diagnostic\n");
|
||||
usb_debug("diagnostic\n");
|
||||
break;
|
||||
case wireless_device:
|
||||
printf("wireless\n");
|
||||
usb_debug("wireless\n");
|
||||
break;
|
||||
default:
|
||||
printf("unsupported class %x\n", class);
|
||||
usb_debug("unsupported class %x\n", class);
|
||||
break;
|
||||
}
|
||||
return adr;
|
||||
|
|
|
@ -407,11 +407,11 @@ static int usb_hid_set_layout (const char *country)
|
|||
|
||||
/* Found, changing keyboard layout */
|
||||
map = &keyboard_layouts[i];
|
||||
printf(" Keyboard layout '%s'\n", map->country);
|
||||
usb_debug(" Keyboard layout '%s'\n", map->country);
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf(" Keyboard layout '%s' not found, using '%s'\n",
|
||||
usb_debug(" Keyboard layout '%s' not found, using '%s'\n",
|
||||
country, map->country);
|
||||
|
||||
/* Nothing found, not changed */
|
||||
|
|
|
@ -67,47 +67,47 @@ static int usb_controller_initialize(int bus, int dev, int func)
|
|||
pci_command |= PCI_COMMAND_MASTER;
|
||||
pci_write_config32(addr, PCI_COMMAND, pci_command);
|
||||
|
||||
printf("%02x:%02x.%x %04x:%04x.%d ", bus, dev, func,
|
||||
usb_debug("%02x:%02x.%x %04x:%04x.%d ", bus, dev, func,
|
||||
pciid >> 16, pciid & 0xFFFF, func);
|
||||
switch (prog_if) {
|
||||
case 0x00:
|
||||
#ifdef CONFIG_USB_UHCI
|
||||
printf("UHCI controller\n");
|
||||
usb_debug("UHCI controller\n");
|
||||
uhci_init (addr);
|
||||
#else
|
||||
printf("UHCI controller (not supported)\n");
|
||||
usb_debug("UHCI controller (not supported)\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0x10:
|
||||
#ifdef CONFIG_USB_OHCI
|
||||
printf("OHCI controller\n");
|
||||
usb_debug("OHCI controller\n");
|
||||
ohci_init(addr);
|
||||
#else
|
||||
printf("OHCI controller (not supported)\n");
|
||||
usb_debug("OHCI controller (not supported)\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0x20:
|
||||
#ifdef CONFIG_USB_EHCI
|
||||
printf("EHCI controller\n");
|
||||
usb_debug("EHCI controller\n");
|
||||
ehci_init(addr);
|
||||
#else
|
||||
printf("EHCI controller (not supported)\n");
|
||||
usb_debug("EHCI controller (not supported)\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0x30:
|
||||
#ifdef CONFIG_USB_XHCI
|
||||
printf("xHCI controller\n");
|
||||
usb_debug("xHCI controller\n");
|
||||
xhci_init(addr);
|
||||
#else
|
||||
printf("xHCI controller (not supported)\n");
|
||||
usb_debug("xHCI controller (not supported)\n");
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("unknown controller %x not supported\n",
|
||||
usb_debug("unknown controller %x not supported\n",
|
||||
prog_if);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ reset_transport (usbdev_t *dev)
|
|||
if (dev->controller->control (dev, OUT, sizeof (dr), &dr, 0, 0) ||
|
||||
clear_stall (MSC_INST (dev)->bulk_in) ||
|
||||
clear_stall (MSC_INST (dev)->bulk_out)) {
|
||||
printf ("Detaching unresponsive device.\n");
|
||||
usb_debug ("Detaching unresponsive device.\n");
|
||||
usb_detach_device (dev->controller, dev->address);
|
||||
return MSC_COMMAND_DETACHED;
|
||||
}
|
||||
|
@ -394,14 +394,14 @@ read_capacity (usbdev_t *dev)
|
|||
}
|
||||
if (count >= 20) {
|
||||
// still not successful, assume 2tb in 512byte sectors, which is just the same garbage as any other number, but probably more usable.
|
||||
printf (" assuming 2 TB with 512-byte sectors as READ CAPACITY didn't answer.\n");
|
||||
usb_debug (" assuming 2 TB with 512-byte sectors as READ CAPACITY didn't answer.\n");
|
||||
MSC_INST (dev)->numblocks = 0xffffffff;
|
||||
MSC_INST (dev)->blocksize = 512;
|
||||
} else {
|
||||
MSC_INST (dev)->numblocks = ntohl (*(u32 *) buf) + 1;
|
||||
MSC_INST (dev)->blocksize = ntohl (*(u32 *) (buf + 4));
|
||||
}
|
||||
printf (" %d %d-byte sectors (%d MB)\n", MSC_INST (dev)->numblocks,
|
||||
usb_debug (" %d %d-byte sectors (%d MB)\n", MSC_INST (dev)->numblocks,
|
||||
MSC_INST (dev)->blocksize,
|
||||
/* round down high block counts to avoid integer overflow */
|
||||
MSC_INST (dev)->numblocks > 1000000
|
||||
|
@ -433,7 +433,7 @@ usb_msc_init (usbdev_t *dev)
|
|||
|
||||
|
||||
if (interface->bInterfaceProtocol != 0x50) {
|
||||
printf (" Protocol not supported.\n");
|
||||
usb_debug (" Protocol not supported.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -441,7 +441,7 @@ usb_msc_init (usbdev_t *dev)
|
|||
(interface->bInterfaceSubClass != 5) && // ATAPI 8070
|
||||
(interface->bInterfaceSubClass != 6)) { // SCSI
|
||||
/* Other protocols, such as ATAPI don't seem to be very popular. looks like ATAPI would be really easy to add, if necessary. */
|
||||
printf (" Interface SubClass not supported.\n");
|
||||
usb_debug (" Interface SubClass not supported.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -468,11 +468,11 @@ usb_msc_init (usbdev_t *dev)
|
|||
}
|
||||
|
||||
if (MSC_INST (dev)->bulk_in == 0) {
|
||||
printf("couldn't find bulk-in endpoint");
|
||||
usb_debug("couldn't find bulk-in endpoint");
|
||||
return;
|
||||
}
|
||||
if (MSC_INST (dev)->bulk_out == 0) {
|
||||
printf("couldn't find bulk-out endpoint");
|
||||
usb_debug("couldn't find bulk-out endpoint");
|
||||
return;
|
||||
}
|
||||
usb_debug (" using endpoint %x as in, %x as out\n",
|
||||
|
@ -481,7 +481,7 @@ usb_msc_init (usbdev_t *dev)
|
|||
|
||||
usb_debug (" has %d luns\n", get_max_luns (dev) + 1);
|
||||
|
||||
printf (" Waiting for device to become ready...");
|
||||
usb_debug (" Waiting for device to become ready...");
|
||||
timeout = 30 * 10; /* SCSI/ATA specs say we have to wait up to 30s. Ugh */
|
||||
while (timeout--) {
|
||||
switch (test_unit_ready (dev)) {
|
||||
|
@ -490,7 +490,7 @@ usb_msc_init (usbdev_t *dev)
|
|||
case MSC_COMMAND_FAIL:
|
||||
mdelay (100);
|
||||
if (!(timeout % 10))
|
||||
printf (".");
|
||||
usb_debug (".");
|
||||
continue;
|
||||
default: /* if it's worse return */
|
||||
return;
|
||||
|
@ -498,9 +498,9 @@ usb_msc_init (usbdev_t *dev)
|
|||
break;
|
||||
}
|
||||
if (timeout < 0) {
|
||||
printf ("timeout. Device not ready. Still trying...\n");
|
||||
usb_debug ("timeout. Device not ready. Still trying...\n");
|
||||
} else {
|
||||
printf ("ok.\n");
|
||||
usb_debug ("ok.\n");
|
||||
}
|
||||
|
||||
usb_debug (" spin up");
|
||||
|
|
|
@ -120,9 +120,9 @@ xhci_init (pcidev_t addr)
|
|||
XHCI_INST (controller)->opreg->dcbaap_lo = virt_to_phys(XHCI_INST (controller)->dcbaa);
|
||||
XHCI_INST (controller)->opreg->dcbaap_hi = 0;
|
||||
|
||||
printf("waiting for controller to be ready - ");
|
||||
usb_debug("waiting for controller to be ready - ");
|
||||
while ((XHCI_INST (controller)->opreg->usbsts & USBSTS_CNR) != 0) mdelay(1);
|
||||
printf("ok.\n");
|
||||
usb_debug("ok.\n");
|
||||
|
||||
usb_debug("ERST Max: %lx -> %lx entries\n", XHCI_INST (controller)->capreg->ERST_Max, 1<<(XHCI_INST (controller)->capreg->ERST_Max));
|
||||
|
||||
|
|
Loading…
Reference in New Issue