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>
diff --git a/src/drivers/usb/pci_xhci/pci_xhci.c b/src/drivers/usb/pci_xhci/pci_xhci.c
index 695cd09..edee03a 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 @@
 	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 @@
 	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();
 }