From c8ab1db0c65f4ffbdebd384abba455af005bd0a5 Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Wed, 30 Oct 2024 11:26:27 -0700 Subject: drivers/wifi: Support Extended Bluetooth Regulatory Descriptor Extended Bluetooth Regulatory Descriptor (EBRD) SAR/RFE are safety regulations for limiting antenna radiation near human contact. EBRD provides option to provide up to three sets of TX power limits and power restrictions. As the EBRD table is related to the revision 2 of the BRDS, this commit also adds support for this new revision. The implementation follows document 559910 Intel Connectivity Platforms BIOS Guideline revision 9.2 specification. BUG=b:346600091 TEST=EBRD method is added to the bluetooth companion device and return the data supplied by the SAR binary blob Change-Id: Iebe95815c944d045f4cf686abcd1874a8a45e250 Signed-off-by: Jeremy Compostella Reviewed-on: https://review.coreboot.org/c/coreboot/+/84947 Reviewed-by: Subrata Banik Reviewed-by: Kapil Porwal Tested-by: build bot (Jenkins) --- src/vendorcode/google/chromeos/sar.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/vendorcode') diff --git a/src/vendorcode/google/chromeos/sar.c b/src/vendorcode/google/chromeos/sar.c index dd43c977df..6ebf931d7d 100644 --- a/src/vendorcode/google/chromeos/sar.c +++ b/src/vendorcode/google/chromeos/sar.c @@ -96,10 +96,14 @@ static size_t dsm_table_size(const struct dsm_profile *dsm) static size_t bsar_table_size(const struct bsar_profile *bsar) { + int revs_offset = offsetof(struct bsar_profile, revs); + if (bsar == NULL) return 0; - return sizeof(struct bsar_profile); + if (bsar->revision == 2) + return revs_offset + sizeof(bsar->revs.rev2); + return revs_offset + sizeof(bsar->revs.rev1); } static size_t wbem_table_size(const struct wbem_profile *wbem) @@ -158,6 +162,14 @@ static size_t bdmm_table_size(const struct bdmm_profile *bdmm) return sizeof(struct bdmm_profile); } +static size_t ebrd_table_size(const struct ebrd_profile *ebrd) +{ + if (ebrd == NULL) + return 0; + + return sizeof(struct ebrd_profile); +} + static bool valid_legacy_length(size_t bin_len) { if (bin_len == LEGACY_SAR_WGDS_BIN_SIZE) @@ -217,6 +229,7 @@ static int fill_wifi_sar_limits(union wifi_sar_limits *sar_limits, const uint8_t expected_sar_bin_size += bbsm_table_size(sar_limits->bbsm); expected_sar_bin_size += bucs_table_size(sar_limits->bucs); expected_sar_bin_size += bdmm_table_size(sar_limits->bdmm); + expected_sar_bin_size += ebrd_table_size(sar_limits->ebrd); if (sar_bin_size != expected_sar_bin_size) { printk(BIOS_ERR, "Invalid SAR size, expected: %zu, obtained: %zu\n", -- cgit v1.2.3