From 67dff1b2b1023aecbe6fa169bee2a4ba342b15c3 Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Tue, 29 Oct 2024 10:40:27 -0700 Subject: drivers/wifi: Support Bluetooth Dual Chain Mode This feature provides ability to provide dual chain setting. The implementation follows document 559910 Intel Connectivity Platforms BIOS Guideline revision 9.2 specification. BUG=b:346600091 TEST=BDCM method is added to the bluetooth companion device and return the data supplied by the SAR binary blob Change-Id: Iebe95815c944d045f4cf686abcd1874a8a45e220 Signed-off-by: Jeremy Compostella Reviewed-on: https://review.coreboot.org/c/coreboot/+/84943 Reviewed-by: Kapil Porwal Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) Reviewed-by: Elyes Haouas --- src/drivers/wifi/generic/acpi.c | 36 ++++++++++++++++++++++++++++++++++++ src/include/sar.h | 9 ++++++++- src/vendorcode/google/chromeos/sar.c | 9 +++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/drivers/wifi/generic/acpi.c b/src/drivers/wifi/generic/acpi.c index 4be43ffe43..8bfce816fb 100644 --- a/src/drivers/wifi/generic/acpi.c +++ b/src/drivers/wifi/generic/acpi.c @@ -736,6 +736,41 @@ static void sar_emit_bbfb(const struct bbfb_profile *bbfb) acpigen_write_package_end(); } +static void sar_emit_bdcm(const struct bdcm_profile *bdcm) +{ + if (bdcm == NULL) + return; + + /* + * Name ("BDCM", Package () { + * Revision, + * Package () { + * Domain Type, // 0x12:Bluetooth + * Dual Chain Mode + * } + * }) + */ + if (bdcm->revision != BDCM_REVISION) { + printk(BIOS_ERR, "Unsupported BDCM table revision: %d\n", + bdcm->revision); + return; + } + + acpigen_write_name("BDCM"); + acpigen_write_package(2); + acpigen_write_dword(bdcm->revision); + + /* + * Emit 'Domain Type' + 'Dual Chain Mode' + */ + acpigen_write_package(2); + acpigen_write_dword(DOMAIN_TYPE_BLUETOOTH); + acpigen_write_dword(bdcm->dual_chain_mode); + + acpigen_write_package_end(); + acpigen_write_package_end(); +} + static void emit_wifi_sar_acpi_structures(const struct device *dev, union wifi_sar_limits *sar_limits) { @@ -870,6 +905,7 @@ static void wifi_ssdt_write_properties(const struct device *dev, const char *sco sar_emit_brds(sar_limits.bsar); sar_emit_bpag(sar_limits.bpag); sar_emit_bbfb(sar_limits.bbfb); + sar_emit_bdcm(sar_limits.bdcm); acpigen_write_scope_end(); } else { printk(BIOS_ERR, "Failed to get %s Bluetooth companion ACPI path\n", diff --git a/src/include/sar.h b/src/include/sar.h index 0609bd34ef..d09ee0dd03 100644 --- a/src/include/sar.h +++ b/src/include/sar.h @@ -9,12 +9,13 @@ #define MAX_DENYLIST_ENTRY 16 #define MAX_DSAR_SET_COUNT 3 #define MAX_GEO_OFFSET_REVISION 3 -#define MAX_PROFILE_COUNT 9 +#define MAX_PROFILE_COUNT 10 #define MAX_SAR_REVISION 2 #define BSAR_REVISION 1 #define WBEM_REVISION 0 #define BPAG_REVISION 2 #define BBFB_REVISION 1 +#define BDCM_REVISION 1 #define REVISION_SIZE 1 #define SAR_REV0_CHAINS_COUNT 2 #define SAR_REV0_SUBBANDS_COUNT 5 @@ -93,6 +94,11 @@ struct bbfb_profile { uint8_t enable_quad_filter_bypass; } __packed; +struct bdcm_profile { + uint8_t revision; + uint32_t dual_chain_mode; +} __packed; + struct sar_header { char marker[SAR_STR_PREFIX_SIZE]; uint8_t version; @@ -111,6 +117,7 @@ union wifi_sar_limits { struct wbem_profile *wbem; struct bpag_profile *bpag; struct bbfb_profile *bbfb; + struct bdcm_profile *bdcm; }; void *profile[MAX_PROFILE_COUNT]; }; diff --git a/src/vendorcode/google/chromeos/sar.c b/src/vendorcode/google/chromeos/sar.c index 8d19f00222..bf2900b019 100644 --- a/src/vendorcode/google/chromeos/sar.c +++ b/src/vendorcode/google/chromeos/sar.c @@ -126,6 +126,14 @@ static size_t bbfb_table_size(const struct bbfb_profile *bbfb) return sizeof(struct bbfb_profile); } +static size_t bdcm_table_size(const struct bdcm_profile *bdcm) +{ + if (bdcm == NULL) + return 0; + + return sizeof(struct bdcm_profile); +} + static bool valid_legacy_length(size_t bin_len) { if (bin_len == LEGACY_SAR_WGDS_BIN_SIZE) @@ -181,6 +189,7 @@ static int fill_wifi_sar_limits(union wifi_sar_limits *sar_limits, const uint8_t expected_sar_bin_size += wbem_table_size(sar_limits->wbem); expected_sar_bin_size += bpag_table_size(sar_limits->bpag); expected_sar_bin_size += bbfb_table_size(sar_limits->bbfb); + expected_sar_bin_size += bdcm_table_size(sar_limits->bdcm); if (sar_bin_size != expected_sar_bin_size) { printk(BIOS_ERR, "Invalid SAR size, expected: %zu, obtained: %zu\n", -- cgit v1.2.3