Varshit B Pandya has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/61594 )
Change subject: src/driver/wifi: Add _DSM method for DDRRFIM ......................................................................
src/driver/wifi: Add _DSM method for DDRRFIM
coreboot need to propagate the CnviDdrRfim value info of the feature enable/disable state into the CNVi via the WiFi DSM ACPI object. This patch adds _DSM method for that.
Add support for following 2 function in _DSM method
- Function 0: Function Support Query Returns a bitmask of functions supported. - Function 3: RFI enablement 0 Feature Enable 1 Feature Disable
BUG=b:201724512 TEST=Build, boot brya0 and dump SSDT entries
Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { ToBuffer (Arg0, Local0) If ((Local0 == ToUUID ("7266172c-220b-4b29-814f-75e4dd26b5fd"))) { ToInteger (Arg2, Local1) If ((Local1 == Zero)) { Return (Buffer (One) { 0x09 // . }) }
If ((Local1 == One)){} If ((Local1 == 0x02)){} If ((Local1 == 0x03)) { Return (Zero) }
Return (Buffer (One) { 0x00 // . }) }
Return (Buffer (One) { 0x00 // . }) }
Signed-off-by: Varshit B Pandya varshit.b.pandya@intel.com Change-Id: I08dce3db5f9f41195e88543f5dde1578572dbd27 --- M src/drivers/wifi/generic/acpi.c 1 file changed, 62 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/94/61594/1
diff --git a/src/drivers/wifi/generic/acpi.c b/src/drivers/wifi/generic/acpi.c index 3cc1c63..70e6a1e 100644 --- a/src/drivers/wifi/generic/acpi.c +++ b/src/drivers/wifi/generic/acpi.c @@ -6,6 +6,7 @@ #include <console/console.h> #include <device/pci_ids.h> #include <sar.h> +#include <soc/soc_chip.h> #include <stdlib.h> #include <wrdd.h>
@@ -15,6 +16,9 @@ /* WIFI Domain type */ #define DOMAIN_TYPE_WIFI 0x7
+/* Maximum number DSM UUID bifurcations in _DSM */ +#define MAX_DSM_FUNCS 2 + /* * WIFI ACPI NAME = "WF" + hex value of last 8 bits of dev_path_encode + '\0' * The above representation returns unique and consistent name every time @@ -26,6 +30,9 @@ /* Unique ID for the WIFI _DSM */ #define ACPI_DSM_OEM_WIFI_UUID "F21202BF-8F78-4DC6-A5B3-1F738E285ADE"
+/* Unique ID for CnviDdrRfim entry in WIFI _DSM */ +#define ACPI_DSM_RFIM_WIFI_UUID "7266172C-220B-4B29-814F-75E4DD26B5FD" + __weak int get_wifi_sar_limits(union wifi_sar_limits *sar_limits) { return -1; @@ -142,6 +149,13 @@ acpigen_write_return_integer(dsm_config->unii_4); }
+static void wifi_dsm_ddrrfim_func3_cb(void *ptr) +{ + config_t *config = config_of_soc(); + + acpigen_write_return_integer(config->CnviDdrRfim); +} + static void (*wifi_dsm_callbacks[])(void *) = { NULL, /* Function 0 */ wifi_dsm_srd_active_channels, /* Function 1 */ @@ -153,6 +167,17 @@ wifi_dsm_unii4_control_enable, /* Function 7 */ };
+/* + * The current DSM2 table is only exporting one function (function 3), some more + * functions are reserved so marking them NULL. +*/ +static void (*wifi_dsm2_callbacks[])(void *) = { + NULL, /* Function 0 */ + NULL, /* Function 1 */ + NULL, /* Function 2 */ + wifi_dsm_ddrrfim_func3_cb, /* Function 3 */ +}; + void wifi_emit_dsm(struct dsm_profile *dsm) { int i; @@ -459,9 +484,9 @@ acpigen_write_package_end(); }
-static void emit_sar_acpi_structures(const struct device *dev) +static void emit_sar_acpi_structures(const struct device *dev, struct dsm_profile *dsm) { - union wifi_sar_limits sar_limits; + union wifi_sar_limits sar_limits = {{NULL, NULL, NULL, NULL, NULL}};
/* * If device type is PCI, ensure that the device has Intel vendor ID. CBFS SAR and SAR @@ -481,7 +506,11 @@ sar_emit_wgds(sar_limits.wgds); sar_emit_ppag(sar_limits.ppag); sar_emit_wtas(sar_limits.wtas); - wifi_emit_dsm(sar_limits.dsm); + + /* copy the dsm data to be later used for creating _DSM function */ + if (sar_limits.dsm != NULL) { + memcpy(dsm, &sar_limits.dsm, sizeof(struct dsm_profile)); + }
free(sar_limits.sar); } @@ -533,9 +562,37 @@ acpigen_pop_len(); }
+ struct dsm_uuid dsm_ids[MAX_DSM_FUNCS]; + /* We will need a copy dsm data to be used later for creating _DSM function */ + struct dsm_profile dsm = {0}; + uint8_t dsm_count = 0; + /* Fill Wifi sar related ACPI structures */ - if (CONFIG(USE_SAR)) - emit_sar_acpi_structures(dev); + if (CONFIG(USE_SAR)) { + emit_sar_acpi_structures(dev, &dsm); + + if (dsm.supported_functions != 0) { + for (int i = 1; i < ARRAY_SIZE(wifi_dsm_callbacks); i++) + if (!(dsm.supported_functions & (1 << i))) + wifi_dsm_callbacks[i] = NULL; + + dsm_ids[dsm_count].uuid = ACPI_DSM_OEM_WIFI_UUID; + dsm_ids[dsm_count].callbacks = &wifi_dsm_callbacks[0]; + dsm_ids[dsm_count].count = ARRAY_SIZE(wifi_dsm_callbacks); + dsm_ids[dsm_count].arg = NULL; + dsm_count++; + } + } + + if (CONFIG(USE_DDR_RFIM_DSM)) { + dsm_ids[dsm_count].uuid = ACPI_DSM_RFIM_WIFI_UUID; + dsm_ids[dsm_count].callbacks = &wifi_dsm2_callbacks[0]; + dsm_ids[dsm_count].count = ARRAY_SIZE(wifi_dsm2_callbacks); + dsm_ids[dsm_count].arg = NULL; + dsm_count++; + } + + acpigen_write_dsm_uuid_arr(dsm_ids, dsm_count);
acpigen_pop_len(); /* Scope */