Sugnan Prabhu S has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/57061 )
Change subject: vc/google/chromeos: Add support for wifi time average SAR config ......................................................................
vc/google/chromeos: Add support for wifi time average SAR config
Add support for the WTAS ACPI BIOS configuration table as per the connectivity document: 559910_Intel_Connectivity_Platforms_BIOS_Guidelines_Rev6_4.pdf
Change-Id: I42cf3cba7974e6db0e05de30846ef103a15fd584 Signed-off-by: Sugnan Prabhu S sugnan.prabhu.s@intel.com --- M src/drivers/wifi/generic/acpi.c M src/include/sar.h M src/vendorcode/google/chromeos/sar.c 3 files changed, 85 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/61/57061/1
diff --git a/src/drivers/wifi/generic/acpi.c b/src/drivers/wifi/generic/acpi.c index 3449af3..1ff081d 100644 --- a/src/drivers/wifi/generic/acpi.c +++ b/src/drivers/wifi/generic/acpi.c @@ -399,6 +399,61 @@ acpigen_pop_len(); }
+static void emit_wifi_sar_avg_table(struct wifi_sar_avg_table *wtas) +{ + int i; + size_t package_size = 1; + + if (wtas == NULL) + return; + + /* + * Name (WTAS, Package() { + * { + * Revision, + * Package() + * { + * DomainType, // 0x7:WiFi + * WifiTASSelection, // Enable/Disable the TAS feature + * WifiTASListEntries, // No. of blocked countries not approved by OEM to + * BlockedListEntry1, support this feature + * BlockedListEntry2, + * BlockedListEntry3, + * BlockedListEntry4, + * BlockedListEntry5, + * BlockedListEntry6, + * BlockedListEntry7, + * BlockedListEntry8, + * BlockedListEntry9, + * BlockedListEntry10, + * BlockedListEntry11, + * BlockedListEntry12, + * BlockedListEntry13, + * BlockedListEntry14, + * BlockedListEntry15, + * BlockedListEntry16, + * } + * }) + */ + if (wtas->version > MAX_SAR_AVG_VERSION) + return; + + package_size = MAX_BLACKLIST_ENTRY + 3; + + acpigen_write_name("WTAS"); + acpigen_write_package(2); + acpigen_write_dword(wtas->version); + acpigen_write_package(package_size); + acpigen_write_dword(DOMAIN_TYPE_WIFI); + acpigen_write_dword(wtas->tas_selection); + acpigen_write_dword(wtas->tas_list_size); + for (i = 0; i < MAX_BLACKLIST_ENTRY; i++) + acpigen_write_byte(wtas->black_list_entry[i]); + + acpigen_pop_len(); + acpigen_pop_len(); +} + static void emit_sar_acpi_structures(const struct device *dev) { struct wifi_sar_limits sar_limits; @@ -419,6 +474,7 @@ emit_wifi_sar_table(sar_limits.sar_table); emit_wifi_sar_delta_table(sar_limits.wgds); emit_wifi_antgain_table(sar_limits.ant_gains); + emit_wifi_sar_avg_table(sar_limits.wtas);
wifi_write_dsm(sar_limits.dsm);
diff --git a/src/include/sar.h b/src/include/sar.h index 71cb851..df3faf8 100644 --- a/src/include/sar.h +++ b/src/include/sar.h @@ -11,6 +11,8 @@ #define NUM_SAR_LIMITS 4 #define PPAG_MODE_SIZE 1 #define REVISION_SIZE 1 +#define MAX_SAR_AVG_VERSION UINT8_MAX +#define MAX_BLACKLIST_ENTRY 16
enum { SAR_FCC, @@ -90,11 +92,19 @@ uint32_t unni_4; };
+struct wifi_sar_avg_table { + uint16_t version; + uint8_t tas_selection; + uint8_t tas_list_size; + uint8_t black_list_entry[MAX_BLACKLIST_ENTRY]; +} __packed; + /* Wifi SAR limit table structure */ struct wifi_sar_limits { struct wifi_sar_table *sar_table; struct wifi_sar_delta_table *wgds; struct wifi_ant_table *ant_gains; + struct wifi_sar_avg_table *wtas; struct wifi_dsm *dsm; };
diff --git a/src/vendorcode/google/chromeos/sar.c b/src/vendorcode/google/chromeos/sar.c index 1100830..cb818e2 100644 --- a/src/vendorcode/google/chromeos/sar.c +++ b/src/vendorcode/google/chromeos/sar.c @@ -63,6 +63,17 @@ return REVISION_SIZE; }
+static int sar_avg_table_size(struct wifi_sar_avg_table *sar_avg) +{ + if (CONFIG(USE_SAR)) + return 0; + + if (sar_avg->version > MAX_SAR_AVG_VERSION) + return sizeof(sar_avg->version); + + return sizeof(struct wifi_sar_avg_table); +} + static int dsm_size(void) { if (CONFIG(USE_SAR)) @@ -81,6 +92,7 @@ * SAR_REVISION[SAR_ENABLE,DSAR_ENABLE,DSAR_SET_NUM <WRDD><EWRD>] * WGDS_REVISION[WGDS_DATA] * PPAG_REVISION[MODE,PPAG_DATA] + * WTAS_REVISION[WTAS_DATA] * DSM_DATA * * The configuration data will always have the revision added in the file for each of the @@ -112,6 +124,11 @@ * [Antenna gain used for 6525-6705MHz frequency] version 1 and 2 * [Antenna gain used for 6705-6865MHz frequency] version 1 and 2 * [Antenna gain used for 6865-7105MHz frequency] version 1 and 2 + * + * [WTAS_DATA] = + * [Enable/disable the TAS feature] + * [Number of blocked countries that are not approved by the OEM to support this feature] + * [black_list_entry_<1-16>: ISO country code to block] */ int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits) { @@ -187,6 +204,8 @@ if (CONFIG(USE_SAR_V2)) { sar_limits->ant_gains = (struct wifi_ant_table *)sar_ptr; sar_ptr += antgains_table_size(sar_limits->ant_gains); + sar_limits->wtas = (struct wifi_sar_avg_table *)sar_ptr; + sar_ptr += sar_avg_table_size(sar_limits->wtas); sar_limits->dsm = (struct wifi_dsm *)sar_ptr; }