aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/usb/pci_xhci
diff options
context:
space:
mode:
authorRaul E Rangel <rrangel@chromium.org>2020-07-10 14:09:03 -0600
committerFelix Held <felix-coreboot@felixheld.de>2020-07-12 17:01:42 +0000
commit9d017d2d29603ae23d24ba34eef5444761397097 (patch)
tree72266ab03bb647a8d346503f60c683e0fce69e3e /src/drivers/usb/pci_xhci
parent2c952d6bd912605736e3a900c2f67cf0b6bec5b2 (diff)
drivers/usb/pci_xhci: Switch to using xhci_for_each_supported_usb_cap
This removes some boilerplate code. BUG=b:154756391 TEST=Dump ACPI table for trembyle and verify it didn't change. Signed-off-by: Raul E Rangel <rrangel@chromium.org> Change-Id: Idcda4356f4e6cb7f6066c67e8fabe0299a1a75b4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/43353 Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/drivers/usb/pci_xhci')
-rw-r--r--src/drivers/usb/pci_xhci/pci_xhci.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/drivers/usb/pci_xhci/pci_xhci.c b/src/drivers/usb/pci_xhci/pci_xhci.c
index 695cd09c4d..edee03afa7 100644
--- a/src/drivers/usb/pci_xhci/pci_xhci.c
+++ b/src/drivers/usb/pci_xhci/pci_xhci.c
@@ -7,7 +7,6 @@
#include <device/pci_ids.h>
#include <device/xhci.h>
#include <stdlib.h>
-#include <string.h>
#define PCI_XHCI_CLASSCODE 0x0c0330 /* USB3.0 xHCI controller */
@@ -57,27 +56,15 @@ static const char *xhci_acpi_name(const struct device *dev)
return NULL;
}
-static void handle_xhci_ext_cap(void *context, const struct xhci_ext_cap *cap)
+static void xhci_generate_port_acpi(void *context, const struct xhci_supported_protocol *data)
{
- const struct xhci_supported_protocol *data;
const char *format;
char buf[16];
struct port_counts *counts = context;
unsigned int *dev_num;
- if (cap->cap_id != XHCI_ECP_CAP_ID_SUPP)
- return;
-
- data = &cap->supported_protocol;
-
xhci_print_supported_protocol(data);
- if (memcmp(data->name, "USB ", 4)) {
- printk(BIOS_INFO, "%s: Unknown Protocol: %.*s\n", __func__,
- (int)sizeof(data->name), data->name);
- return;
- }
-
if (data->major_rev == 3) {
format = "SS%02d";
dev_num = &counts->super_speed;
@@ -105,7 +92,7 @@ static void xhci_add_devices(const struct device *dev)
acpigen_write_device("RHUB");
acpigen_write_name_integer("_ADR", 0x00000000);
- xhci_for_each_ext_cap(dev, &counts, handle_xhci_ext_cap);
+ xhci_for_each_supported_usb_cap(dev, &counts, xhci_generate_port_acpi);
acpigen_pop_len();
}