summaryrefslogtreecommitdiff
path: root/src/drivers/wifi/generic
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2022-03-10 16:25:27 -0700
committerTim Wawrzynczak <twawrzynczak@chromium.org>2022-03-17 14:54:28 +0000
commit5e6fd360de7fe92f1e8b1b3eb20241809e2a6aff (patch)
tree7cf0f9a9c8490fdb27a4cc417b7bb41d68cc80da /src/drivers/wifi/generic
parentdc27d807baaf3dcb366470caf2b3f4c40cdf12f7 (diff)
drivers/wifi/generic: Fix properties in generic-under-PCI device case
In the devicetree case where a generic device underneath the Intel PCI CNVi device carries the device properties, the incorrect device was passed to wifi_ssdt_write_properties. Also while here, update the UUID for `DmaProperty` to match what Microsoft defined here: https://docs.microsoft.com/en-us/windows-hardware/drivers/pci/dsd-for-pcie-root-ports BUG=b:215424986, b:220639445 TEST=dump SSDT and see that _PRW for CNVi device is no longer garbage, but contains the value from the devicetree (GPE0_PME_B0). Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Change-Id: Iafd86458d2f65ccb7e74d1308d37fd3ebbf7f520 Reviewed-on: https://review.coreboot.org/c/coreboot/+/62746 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: YH Lin <yueherngl@google.com> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com> Reviewed-by: Varshit B Pandya <varshit.b.pandya@intel.com>
Diffstat (limited to 'src/drivers/wifi/generic')
-rw-r--r--src/drivers/wifi/generic/acpi.c39
-rw-r--r--src/drivers/wifi/generic/generic.c18
2 files changed, 31 insertions, 26 deletions
diff --git a/src/drivers/wifi/generic/acpi.c b/src/drivers/wifi/generic/acpi.c
index 63faae0176..ef18f6d68f 100644
--- a/src/drivers/wifi/generic/acpi.c
+++ b/src/drivers/wifi/generic/acpi.c
@@ -26,8 +26,8 @@
/* Unique ID for the WIFI _DSM */
#define ACPI_DSM_OEM_WIFI_UUID "F21202BF-8F78-4DC6-A5B3-1F738E285ADE"
-/* Unique ID for the Wifi _DSD */
-#define ACPI_DSD_UNTRUSTED_UUID "88566a92-1a61-466d-949a-6d12809d480c"
+/* ID for the Wifi DmaProperty _DSD */
+#define ACPI_DSD_DMA_PROPERTY_UUID "70D24161-6DD5-4C9E-8070-705531292865"
__weak int get_wifi_sar_limits(union wifi_sar_limits *sar_limits)
{
@@ -506,24 +506,25 @@ static void wifi_ssdt_write_device(const struct device *dev, const char *path)
static void wifi_ssdt_write_properties(const struct device *dev, const char *scope)
{
- const struct drivers_wifi_generic_config *config = dev->chip_info;
-
/* Scope */
acpigen_write_scope(scope);
- if (config) {
- /* Wake capabilities */
- acpigen_write_PRW(config->wake, ACPI_S3);
-
- /* Add _DSD for DmaProperty property. */
- if (config->is_untrusted) {
- struct acpi_dp *dsd, *pkg;
-
- dsd = acpi_dp_new_table("_DSD");
- pkg = acpi_dp_new_table(ACPI_DSD_UNTRUSTED_UUID);
- acpi_dp_add_integer(pkg, "DmaProperty", 1);
- acpi_dp_add_package(dsd, pkg);
- acpi_dp_write(dsd);
+ if (dev->path.type == DEVICE_PATH_GENERIC) {
+ const struct drivers_wifi_generic_config *config = dev->chip_info;
+ if (config) {
+ /* Wake capabilities */
+ acpigen_write_PRW(config->wake, ACPI_S3);
+
+ /* Add _DSD for DmaProperty property. */
+ if (config->is_untrusted) {
+ struct acpi_dp *dsd, *pkg;
+
+ dsd = acpi_dp_new_table("_DSD");
+ pkg = acpi_dp_new_table(ACPI_DSD_DMA_PROPERTY_UUID);
+ acpi_dp_add_integer(pkg, "DmaProperty", 1);
+ acpi_dp_add_package(dsd, pkg);
+ acpi_dp_write(dsd);
+ }
}
}
@@ -567,7 +568,9 @@ void wifi_pcie_fill_ssdt(const struct device *dev)
return;
wifi_ssdt_write_device(dev, path);
- wifi_ssdt_write_properties(dev, path);
+ const struct device *child = dev->link_list->children;
+ if (child && child->path.type == DEVICE_PATH_GENERIC)
+ wifi_ssdt_write_properties(child, path);
}
const char *wifi_pcie_acpi_name(const struct device *dev)
diff --git a/src/drivers/wifi/generic/generic.c b/src/drivers/wifi/generic/generic.c
index 5aaedaeafe..1187b3326a 100644
--- a/src/drivers/wifi/generic/generic.c
+++ b/src/drivers/wifi/generic/generic.c
@@ -21,6 +21,7 @@ struct device_operations wifi_pcie_ops = {
.enable_resources = pci_dev_enable_resources,
.init = wifi_pci_dev_init,
.ops_pci = &pci_dev_ops_pci,
+ .scan_bus = scan_static_bus,
#if CONFIG(HAVE_ACPI_TABLES)
.acpi_name = wifi_pcie_acpi_name,
.acpi_fill_ssdt = wifi_pcie_fill_ssdt,
@@ -41,6 +42,11 @@ struct device_operations wifi_cnvi_ops = {
#endif
};
+struct device_operations wifi_generic_ops = {
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
+};
+
static bool is_cnvi(const struct device *dev)
{
return dev && dev->path.type != DEVICE_PATH_PCI;
@@ -59,16 +65,12 @@ bool wifi_generic_cnvi_ddr_rfim_enabled(const struct device *dev)
static void wifi_generic_enable(struct device *dev)
{
- DEVTREE_CONST struct drivers_wifi_generic_config *config = dev ? dev->chip_info : NULL;
-
- if (!config)
- return;
-
#if !DEVTREE_EARLY
- if (is_cnvi(dev))
- dev->ops = &wifi_cnvi_ops;
+ const struct device *parent = dev->bus->dev;
+ if (parent && parent->ops == &wifi_pcie_ops)
+ dev->ops = &wifi_generic_ops;
else
- dev->ops = &wifi_pcie_ops;
+ dev->ops = &wifi_cnvi_ops;
#endif
}