device/xhci: Add functions to work with resource pointers

The XHCI device functions currently use functions that require a
access to the device tree. Create variant of these functions that can
operate with a resource* as an argument and refactor the existing
device*-based functions to operate by calling the resource*-based
variants. This is useful for stages like SMM that may not have access to
the device tree.

BRANCH=guybrush
BUG=b:186792595
TEST=Ran on skyrim device, verified that XHCI ACPI tables are still
generated correctly.

Change-Id: If5a74f9529d5dc6031ec968ef5f40a9cad5ffbc4
Signed-off-by: Robert Zieba <robertzieba@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/69914
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
This commit is contained in:
Robert Zieba
2022-11-18 18:06:28 +00:00
committed by Martin L Roth
parent ac8c378777
commit 219cb952f8
4 changed files with 140 additions and 95 deletions

View File

@@ -97,6 +97,9 @@ struct xhci_usb_info {
/**
* Iterates over the xHCI Extended Capabilities List.
*/
enum cb_err xhci_resource_for_each_ext_cap(const struct resource *res, void *context,
void (*callback)(void *context,
const struct xhci_ext_cap *cap));
enum cb_err xhci_for_each_ext_cap(const struct device *device, void *context,
void (*callback)(void *context,
const struct xhci_ext_cap *cap));
@@ -108,6 +111,9 @@ enum cb_err xhci_for_each_ext_cap(const struct device *device, void *context,
enum cb_err xhci_for_each_supported_usb_cap(
const struct device *device, void *context,
void (*callback)(void *context, const struct xhci_supported_protocol *data));
enum cb_err xhci_resource_for_each_supported_usb_cap(
const struct resource *res, void *context,
void (*callback)(void *context, const struct xhci_supported_protocol *data));
void xhci_print_supported_protocol(const struct xhci_supported_protocol *supported_protocol);