summaryrefslogtreecommitdiff
path: root/payloads/libpayload
diff options
context:
space:
mode:
authorPatrick Georgi <patrick.georgi@secunet.com>2011-11-04 11:50:03 +0100
committerStefan Reinauer <stefan.reinauer@coreboot.org>2011-11-04 22:11:05 +0100
commit2e768e7f171514924c3b206b7f3fbe6bf20c1c71 (patch)
treeffd804b1a8dfccfbe08451b3dd0e16ed0502bc94 /payloads/libpayload
parent3cd0ae2c7b21174188ff1df1f98d3d5295cb7684 (diff)
libpayload: Drop usb_fatal()
We have fatal(), which is just as good. Coccinelle script: @@ expression E; @@ -usb_fatal(E) +fatal(E) Change-Id: Iabecbcc7d068cc0f82687bf51d89c2626642cd86 Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com> Reviewed-on: http://review.coreboot.org/395 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins)
Diffstat (limited to 'payloads/libpayload')
-rw-r--r--payloads/libpayload/drivers/usb/ehci.c4
-rw-r--r--payloads/libpayload/drivers/usb/ohci.c4
-rw-r--r--payloads/libpayload/drivers/usb/ohci_rh.c2
-rw-r--r--payloads/libpayload/drivers/usb/uhci.c16
-rw-r--r--payloads/libpayload/drivers/usb/uhci_rh.c2
-rw-r--r--payloads/libpayload/drivers/usb/usb.c6
-rw-r--r--payloads/libpayload/drivers/usb/usbhid.c2
-rw-r--r--payloads/libpayload/drivers/usb/usbhub.c4
-rw-r--r--payloads/libpayload/drivers/usb/usbmsc.c2
-rw-r--r--payloads/libpayload/drivers/usb/xhci.c10
-rw-r--r--payloads/libpayload/drivers/usb/xhci_rh.c2
-rw-r--r--payloads/libpayload/include/usb/usb.h1
12 files changed, 24 insertions, 31 deletions
diff --git a/payloads/libpayload/drivers/usb/ehci.c b/payloads/libpayload/drivers/usb/ehci.c
index f258e075e3..b1ccb0bf2f 100644
--- a/payloads/libpayload/drivers/usb/ehci.c
+++ b/payloads/libpayload/drivers/usb/ehci.c
@@ -312,11 +312,11 @@ ehci_init (pcidev_t addr)
hci_t *controller = new_controller ();
if (!controller)
- usb_fatal("Could not create USB controller instance.\n");
+ fatal("Could not create USB controller instance.\n");
controller->instance = malloc (sizeof (ehci_t));
if(!controller->instance)
- usb_fatal("Not enough memory creating USB controller instance.\n");
+ fatal("Not enough memory creating USB controller instance.\n");
#define PCI_COMMAND 4
#define PCI_COMMAND_IO 1
diff --git a/payloads/libpayload/drivers/usb/ohci.c b/payloads/libpayload/drivers/usb/ohci.c
index ef33bd9125..60866d80d9 100644
--- a/payloads/libpayload/drivers/usb/ohci.c
+++ b/payloads/libpayload/drivers/usb/ohci.c
@@ -88,11 +88,11 @@ ohci_init (pcidev_t addr)
hci_t *controller = new_controller ();
if (!controller)
- usb_fatal("Could not create USB controller instance.\n");
+ fatal("Could not create USB controller instance.\n");
controller->instance = malloc (sizeof (ohci_t));
if(!controller->instance)
- usb_fatal("Not enough memory creating USB controller instance.\n");
+ fatal("Not enough memory creating USB controller instance.\n");
controller->start = ohci_start;
controller->stop = ohci_stop;
diff --git a/payloads/libpayload/drivers/usb/ohci_rh.c b/payloads/libpayload/drivers/usb/ohci_rh.c
index da74340abd..5cf7ee8376 100644
--- a/payloads/libpayload/drivers/usb/ohci_rh.c
+++ b/payloads/libpayload/drivers/usb/ohci_rh.c
@@ -143,7 +143,7 @@ ohci_rh_init (usbdev_t *dev)
dev->data = malloc (sizeof (rh_inst_t));
if (!dev->data)
- usb_fatal ("Not enough memory for OHCI RH.\n");
+ fatal("Not enough memory for OHCI RH.\n");
RH_INST (dev)->numports = OHCI_INST (dev->controller)->opreg->HcRhDescriptorA & NumberDownstreamPortsMask;
RH_INST (dev)->port = malloc(sizeof(int) * RH_INST (dev)->numports);
diff --git a/payloads/libpayload/drivers/usb/uhci.c b/payloads/libpayload/drivers/usb/uhci.c
index 4484e17331..779098b168 100644
--- a/payloads/libpayload/drivers/usb/uhci.c
+++ b/payloads/libpayload/drivers/usb/uhci.c
@@ -134,11 +134,11 @@ uhci_init (pcidev_t addr)
hci_t *controller = new_controller ();
if (!controller)
- usb_fatal("Could not create USB controller instance.\n");
+ fatal("Could not create USB controller instance.\n");
controller->instance = malloc (sizeof (uhci_t));
if(!controller->instance)
- usb_fatal("Not enough memory creating USB controller instance.\n");
+ fatal("Not enough memory creating USB controller instance.\n");
controller->start = uhci_start;
controller->stop = uhci_stop;
@@ -168,7 +168,7 @@ uhci_init (pcidev_t addr)
UHCI_INST (controller)->framelistptr = memalign (0x1000, 1024 * sizeof (flistp_t *)); /* 4kb aligned to 4kb */
if (! UHCI_INST (controller)->framelistptr)
- usb_fatal("Not enough memory for USB frame list pointer.\n");
+ fatal("Not enough memory for USB frame list pointer.\n");
memset (UHCI_INST (controller)->framelistptr, 0,
1024 * sizeof (flistp_t));
@@ -182,7 +182,7 @@ uhci_init (pcidev_t addr)
*/
td_t *antiberserk = memalign(16, sizeof(td_t));
if (!antiberserk)
- usb_fatal("Not enough memory for chipset workaround.\n");
+ fatal("Not enough memory for chipset workaround.\n");
memset(antiberserk, 0, sizeof(td_t));
UHCI_INST (controller)->qh_prei = memalign (16, sizeof (qh_t));
@@ -194,7 +194,7 @@ uhci_init (pcidev_t addr)
! UHCI_INST (controller)->qh_intr ||
! UHCI_INST (controller)->qh_data ||
! UHCI_INST (controller)->qh_last)
- usb_fatal ("Not enough memory for USB controller queues.\n");
+ fatal("Not enough memory for USB controller queues.\n");
UHCI_INST (controller)->qh_prei->headlinkptr.ptr =
virt_to_phys (UHCI_INST (controller)->qh_intr);
@@ -443,7 +443,7 @@ uhci_bulk (endpoint_t *ep, int size, u8 *data, int finalize)
{
int maxpsize = ep->maxpacketsize;
if (maxpsize == 0)
- usb_fatal ("MaxPacketSize == 0!!!");
+ fatal("MaxPacketSize == 0!!!");
int numpackets = (size + maxpsize - 1 + finalize) / maxpsize;
if (numpackets == 0)
return 0;
@@ -486,7 +486,7 @@ uhci_create_intr_queue (endpoint_t *ep, int reqsize, int reqcount, int reqtiming
qh_t *qh = memalign(16, sizeof(qh_t));
if (!data || !tds || !qh)
- usb_fatal ("Not enough memory to create USB intr queue prerequisites.\n");
+ fatal("Not enough memory to create USB intr queue prerequisites.\n");
qh->elementlinkptr.ptr = virt_to_phys(tds);
qh->elementlinkptr.queue_head = 0;
@@ -494,7 +494,7 @@ uhci_create_intr_queue (endpoint_t *ep, int reqsize, int reqcount, int reqtiming
intr_q *q = malloc(sizeof(intr_q));
if (!q)
- usb_fatal ("Not enough memory to create USB intr queue.\n");
+ fatal("Not enough memory to create USB intr queue.\n");
q->qh = qh;
q->tds = tds;
q->data = data;
diff --git a/payloads/libpayload/drivers/usb/uhci_rh.c b/payloads/libpayload/drivers/usb/uhci_rh.c
index bd3fb42b22..53b32f6a14 100644
--- a/payloads/libpayload/drivers/usb/uhci_rh.c
+++ b/payloads/libpayload/drivers/usb/uhci_rh.c
@@ -178,7 +178,7 @@ uhci_rh_init (usbdev_t *dev)
uhci_rh_enable_port (dev, 2);
dev->data = malloc (sizeof (rh_inst_t));
if (!dev->data)
- usb_fatal ("Not enough memory for UHCI RH.\n");
+ fatal("Not enough memory for UHCI RH.\n");
RH_INST (dev)->port[0] = -1;
RH_INST (dev)->port[1] = -1;
diff --git a/payloads/libpayload/drivers/usb/usb.c b/payloads/libpayload/drivers/usb/usb.c
index 6995cef7b2..4f423327d5 100644
--- a/payloads/libpayload/drivers/usb/usb.c
+++ b/payloads/libpayload/drivers/usb/usb.c
@@ -459,9 +459,3 @@ usb_attach_device(hci_t *controller, int hubaddress, int port, int speed)
return newdev;
}
-void
-usb_fatal (const char *message)
-{
- printf(message);
- for (;;) ;
-}
diff --git a/payloads/libpayload/drivers/usb/usbhid.c b/payloads/libpayload/drivers/usb/usbhid.c
index 57f60cfe80..840b298cf8 100644
--- a/payloads/libpayload/drivers/usb/usbhid.c
+++ b/payloads/libpayload/drivers/usb/usbhid.c
@@ -421,7 +421,7 @@ usb_hid_init (usbdev_t *dev)
case hid_boot_proto_keyboard:
dev->data = malloc (sizeof (usbhid_inst_t));
if (!dev->data)
- usb_fatal("Not enough memory for USB HID device.\n");
+ fatal("Not enough memory for USB HID device.\n");
debug (" configuring...\n");
usb_hid_set_protocol(dev, interface, hid_proto_boot);
usb_hid_set_idle(dev, interface, KEYBOARD_REPEAT_MS);
diff --git a/payloads/libpayload/drivers/usb/usbhub.c b/payloads/libpayload/drivers/usb/usbhub.c
index fcf4f36d5f..08042a2b9f 100644
--- a/payloads/libpayload/drivers/usb/usbhub.c
+++ b/payloads/libpayload/drivers/usb/usbhub.c
@@ -135,7 +135,7 @@ usb_hub_init (usbdev_t *dev)
dev->data = malloc (sizeof (usbhub_inst_t));
if (!dev->data)
- usb_fatal("Not enough memory for USB hub.\n");
+ fatal("Not enough memory for USB hub.\n");
HUB_INST (dev)->descriptor = (hub_descriptor_t *) get_descriptor(dev,
gen_bmRequestType(device_to_host, class_type, dev_recp), 0x29, 0, 0);
@@ -143,7 +143,7 @@ usb_hub_init (usbdev_t *dev)
HUB_INST (dev)->ports =
malloc (sizeof (int) * (HUB_INST (dev)->num_ports + 1));
if (! HUB_INST (dev)->ports)
- usb_fatal("Not enough memory for USB hub ports.\n");
+ fatal("Not enough memory for USB hub ports.\n");
for (i = 1; i <= HUB_INST (dev)->num_ports; i++)
HUB_INST (dev)->ports[i] = -1;
diff --git a/payloads/libpayload/drivers/usb/usbmsc.c b/payloads/libpayload/drivers/usb/usbmsc.c
index 729bf91171..f90acb1744 100644
--- a/payloads/libpayload/drivers/usb/usbmsc.c
+++ b/payloads/libpayload/drivers/usb/usbmsc.c
@@ -398,7 +398,7 @@ usb_msc_init (usbdev_t *dev)
dev->data = malloc (sizeof (usbmsc_inst_t));
if (!dev->data)
- usb_fatal ("Not enough memory for USB MSC device.\n");
+ fatal("Not enough memory for USB MSC device.\n");
MSC_INST (dev)->protocol = interface->bInterfaceSubClass;
MSC_INST (dev)->bulk_in = 0;
diff --git a/payloads/libpayload/drivers/usb/xhci.c b/payloads/libpayload/drivers/usb/xhci.c
index 0aca63de9d..a25cf403a0 100644
--- a/payloads/libpayload/drivers/usb/xhci.c
+++ b/payloads/libpayload/drivers/usb/xhci.c
@@ -57,11 +57,11 @@ xhci_init (pcidev_t addr)
hci_t *controller = new_controller ();
if (!controller)
- usb_fatal("Could not create USB controller instance.\n");
+ fatal("Could not create USB controller instance.\n");
controller->instance = malloc (sizeof (xhci_t));
if(!controller->instance)
- usb_fatal("Not enough memory creating USB controller instance.\n");
+ fatal("Not enough memory creating USB controller instance.\n");
controller->start = xhci_start;
controller->stop = xhci_stop;
@@ -82,7 +82,7 @@ xhci_init (pcidev_t addr)
controller->reg_base = (u32)phys_to_virt(pci_read_config32 (controller->bus_address, 0x10) & ~0xf);
//controller->reg_base = pci_read_config32 (controller->bus_address, 0x14) & ~0xf;
if (pci_read_config32 (controller->bus_address, 0x14) > 0) {
- usb_fatal("We don't do 64bit addressing.\n");
+ fatal("We don't do 64bit addressing.\n");
}
debug("regbase: %lx\n", controller->reg_base);
@@ -94,7 +94,7 @@ xhci_init (pcidev_t addr)
debug("caplength: %x\n", XHCI_INST (controller)->capreg->caplength);
debug("hciversion: %x.%x\n", XHCI_INST (controller)->capreg->hciver_hi, XHCI_INST (controller)->capreg->hciver_lo);
if ((XHCI_INST (controller)->capreg->hciversion < 0x96) || (XHCI_INST (controller)->capreg->hciversion > 0x100)) {
- usb_fatal("Unsupported xHCI version\n");
+ fatal("Unsupported xHCI version\n");
}
debug("maxslots: %x\n", XHCI_INST (controller)->capreg->MaxSlots);
debug("maxports: %x\n", XHCI_INST (controller)->capreg->MaxPorts);
@@ -233,7 +233,7 @@ xhci_bulk (endpoint_t *ep, int size, u8 *data, int finalize)
{
int maxpsize = ep->maxpacketsize;
if (maxpsize == 0)
- usb_fatal ("MaxPacketSize == 0!!!");
+ fatal("MaxPacketSize == 0!!!");
return 1;
}
diff --git a/payloads/libpayload/drivers/usb/xhci_rh.c b/payloads/libpayload/drivers/usb/xhci_rh.c
index 2817f04299..1547ef62e2 100644
--- a/payloads/libpayload/drivers/usb/xhci_rh.c
+++ b/payloads/libpayload/drivers/usb/xhci_rh.c
@@ -112,7 +112,7 @@ xhci_rh_init (usbdev_t *dev)
dev->data = malloc (sizeof (rh_inst_t));
if (!dev->data)
- usb_fatal ("Not enough memory for XHCI RH.\n");
+ fatal("Not enough memory for XHCI RH.\n");
RH_INST (dev)->numports = XHCI_INST (dev->controller)->capreg->MaxPorts;
RH_INST (dev)->port = malloc(sizeof(int) * RH_INST (dev)->numports);
diff --git a/payloads/libpayload/include/usb/usb.h b/payloads/libpayload/include/usb/usb.h
index 2cd9c55895..e38aa78bd1 100644
--- a/payloads/libpayload/include/usb/usb.h
+++ b/payloads/libpayload/include/usb/usb.h
@@ -257,5 +257,4 @@ int usb_interface_check(u16 vendor, u16 device);
# define debug(fmt, ...) while (0) { printf(fmt, ##__VA_ARGS__); }
#endif
-void usb_fatal(const char *message) __attribute__ ((noreturn));
#endif