diff options
author | Jeremy Compostella <jeremy.compostella@intel.com> | 2024-10-29 12:24:58 -0700 |
---|---|---|
committer | Jérémy Compostella <jeremy.compostella@intel.com> | 2024-11-27 21:28:17 +0000 |
commit | 6e941f99dad04e6476059082ee6129f4788c1491 (patch) | |
tree | 06edccac246e818f74cf3b0a719f3c0414266082 | |
parent | e9b36b03ce63c40fd9d81cefc797928ca867bbb7 (diff) |
drivers/wifi: Support Ultra High Band Country Selection
This feature provides ability to set the Bluetooth Ultra High
Band (UHB) settings per country. The bluetooth UHB country selection
is defined as follow (default is 0):
| Bit | Value | |
|-------+-------+---------------------------------------------------|
| 0 | 0 | No override; use BT device settings |
| | 1 | Force disable BT in all countries that are not |
| | | defined in the following bits |
| 1 | 0 | USA 6GHz BT disable |
| | 1 | 6GHz BT allowed in the USA (enabled only if the |
| | | device is certified to the USA) |
| 2 | 0 | Rest of the World 6GHz BT disable |
| | 1 | 6GHz BT allowed in the Rest of the World (enabled |
| | | only if the device is certified to the rest |
| | | of the world) |
| 3 | 0 | EU countries 6GHz BT disable |
| | 1 | 6GHz BT allowed in the EU countries (enabled only |
| | | if the device is certified to the EU countries) |
| 4 | 0 | South Korea 6GHz BT disable |
| | 1 | 6GHz BT allowed in the South Korea (enabled only |
| | | if the device is certified to the South Korea) |
| 5 | 0 | Brazil 6GHz BT disable |
| | 1 | 6GHz BT allowed in the Brazil (enabled only if |
| | | the device is certified to the Brazil) |
| 6 | 0 | Chile 6GHz BT disable |
| | 1 | 6GHz BT allowed in the Chile (enabled only if the |
| | | device is certified to the Chile) |
| 7 | 0 | Japan 6GHz BT disable |
| | 1 | 6GHz BT allowed in Japan (enabled only if the |
| | | device is certified to Japan) |
| 8 | 0 | Canada 6GHz BT disable |
| | 1 | 6GHz BT allowed in Canada (enabled only if the |
| | | device is certified to Canada) |
| 9 | 0 | Morocco 6GHz BT disable |
| | 1 | 6GHz BT allowed in the Morocco (enabled only if |
| | | the device is certified to the Morocco) |
| 10 | 0 | Mongolia 6GHz BT disable |
| | 1 | 6GHz BT allowed in the Mongolia (enabled only if |
| | | the device is certified to the Mongolia) |
| 11 | 0 | Malaysia 6GHz BT disable |
| | 1 | 6GHz BT allowed in the Malaysia (enabled only if |
| | | the device is certified to the Malaysia) |
| 31:12 | 0 | Reserved Should set to zeros |
The implementation follows document 559910 Intel Connectivity
Platforms BIOS Guideline revision 9.2 specification.
BUG=b:346600091
TEST=BUCS method is added to the bluetooth companion device and
return the data supplied by the SAR binary blob
Change-Id: Iebe95815c944d045f4cf686abcd1874a8a45e231
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84945
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
-rw-r--r-- | src/drivers/wifi/generic/acpi.c | 36 | ||||
-rw-r--r-- | src/include/sar.h | 9 | ||||
-rw-r--r-- | src/vendorcode/google/chromeos/sar.c | 9 |
3 files changed, 53 insertions, 1 deletions
diff --git a/src/drivers/wifi/generic/acpi.c b/src/drivers/wifi/generic/acpi.c index a3fd3ca4c0..4a95b690b4 100644 --- a/src/drivers/wifi/generic/acpi.c +++ b/src/drivers/wifi/generic/acpi.c @@ -806,6 +806,41 @@ static void sar_emit_bbsm(const struct bbsm_profile *bbsm) acpigen_write_package_end(); } +static void sar_emit_bucs(const struct bucs_profile *bucs) +{ + if (bucs == NULL) + return; + + /* + * Name ("BUCS", Package () { + * Revision, + * Package () { + * Domain Type, // 0x12:Bluetooth + * UHB country selection bits + * } + * }) + */ + if (bucs->revision != BUCS_REVISION) { + printk(BIOS_ERR, "Unsupported BUCS table revision: %d\n", + bucs->revision); + return; + } + + acpigen_write_name("BUCS"); + acpigen_write_package(2); + acpigen_write_dword(bucs->revision); + + /* + * Emit 'Domain Type' + 'UHB country selection bits' + */ + acpigen_write_package(2); + acpigen_write_dword(DOMAIN_TYPE_BLUETOOTH); + acpigen_write_dword(bucs->uhb_country_selection); + + 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) { @@ -942,6 +977,7 @@ static void wifi_ssdt_write_properties(const struct device *dev, const char *sco sar_emit_bbfb(sar_limits.bbfb); sar_emit_bdcm(sar_limits.bdcm); sar_emit_bbsm(sar_limits.bbsm); + sar_emit_bucs(sar_limits.bucs); 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 71daa238b4..433b91107a 100644 --- a/src/include/sar.h +++ b/src/include/sar.h @@ -9,7 +9,7 @@ #define MAX_DENYLIST_ENTRY 16 #define MAX_DSAR_SET_COUNT 3 #define MAX_GEO_OFFSET_REVISION 3 -#define MAX_PROFILE_COUNT 11 +#define MAX_PROFILE_COUNT 12 #define MAX_SAR_REVISION 2 #define BSAR_REVISION 1 #define WBEM_REVISION 0 @@ -17,6 +17,7 @@ #define BBFB_REVISION 1 #define BDCM_REVISION 1 #define BBSM_REVISION 1 +#define BUCS_REVISION 1 #define REVISION_SIZE 1 #define SAR_REV0_CHAINS_COUNT 2 #define SAR_REV0_SUBBANDS_COUNT 5 @@ -105,6 +106,11 @@ struct bbsm_profile { uint32_t bands_selection; } __packed; +struct bucs_profile { + uint8_t revision; + uint32_t uhb_country_selection; +} __packed; + struct sar_header { char marker[SAR_STR_PREFIX_SIZE]; uint8_t version; @@ -125,6 +131,7 @@ union wifi_sar_limits { struct bbfb_profile *bbfb; struct bdcm_profile *bdcm; struct bbsm_profile *bbsm; + struct bucs_profile *bucs; }; void *profile[MAX_PROFILE_COUNT]; }; diff --git a/src/vendorcode/google/chromeos/sar.c b/src/vendorcode/google/chromeos/sar.c index f6f11181d6..8e54942a4f 100644 --- a/src/vendorcode/google/chromeos/sar.c +++ b/src/vendorcode/google/chromeos/sar.c @@ -142,6 +142,14 @@ static size_t bbsm_table_size(const struct bbsm_profile *bbsm) return sizeof(struct bbsm_profile); } +static size_t bucs_table_size(const struct bucs_profile *bucs) +{ + if (bucs == NULL) + return 0; + + return sizeof(struct bucs_profile); +} + static bool valid_legacy_length(size_t bin_len) { if (bin_len == LEGACY_SAR_WGDS_BIN_SIZE) @@ -199,6 +207,7 @@ static int fill_wifi_sar_limits(union wifi_sar_limits *sar_limits, const uint8_t expected_sar_bin_size += bbfb_table_size(sar_limits->bbfb); expected_sar_bin_size += bdcm_table_size(sar_limits->bdcm); expected_sar_bin_size += bbsm_table_size(sar_limits->bbsm); + expected_sar_bin_size += bucs_table_size(sar_limits->bucs); if (sar_bin_size != expected_sar_bin_size) { printk(BIOS_ERR, "Invalid SAR size, expected: %zu, obtained: %zu\n", |