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); + 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; + /* 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); + 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 }