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>
This commit is contained in:
parent
2c952d6bd9
commit
9d017d2d29
|
@ -7,7 +7,6 @@
|
||||||
#include <device/pci_ids.h>
|
#include <device/pci_ids.h>
|
||||||
#include <device/xhci.h>
|
#include <device/xhci.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define PCI_XHCI_CLASSCODE 0x0c0330 /* USB3.0 xHCI controller */
|
#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;
|
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;
|
const char *format;
|
||||||
char buf[16];
|
char buf[16];
|
||||||
struct port_counts *counts = context;
|
struct port_counts *counts = context;
|
||||||
unsigned int *dev_num;
|
unsigned int *dev_num;
|
||||||
|
|
||||||
if (cap->cap_id != XHCI_ECP_CAP_ID_SUPP)
|
|
||||||
return;
|
|
||||||
|
|
||||||
data = &cap->supported_protocol;
|
|
||||||
|
|
||||||
xhci_print_supported_protocol(data);
|
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) {
|
if (data->major_rev == 3) {
|
||||||
format = "SS%02d";
|
format = "SS%02d";
|
||||||
dev_num = &counts->super_speed;
|
dev_num = &counts->super_speed;
|
||||||
|
@ -105,7 +92,7 @@ static void xhci_add_devices(const struct device *dev)
|
||||||
acpigen_write_device("RHUB");
|
acpigen_write_device("RHUB");
|
||||||
acpigen_write_name_integer("_ADR", 0x00000000);
|
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();
|
acpigen_pop_len();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue