sar: Fix semantics of get_wifi_sar_cbfs_filename()

Currently, if `get_wifi_sar_cbfs_filename()` returns NULL, then
`get_wifi_sar_limits()` assumes that the default filename is used for
CBFS SAR file. This prevents a board from supporting different models
using the same firmware -- some which require SAR support and some
which don't.

This change updates the logic in `get_wifi_sar_limits()` to return
early if filename is not provided by the mainboard. In order to
maintain the same logic as before, current mainboards are updated to
return WIFI_SAR_CBFS_DEFAULT_FILENAME instead of NULL in default
case.

Change-Id: I68b5bdd213767a3cd81fe41ace66540acd68e26a
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/51485
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Furquan Shaikh
2021-03-13 22:54:16 -08:00
committed by Patrick Georgi
parent 31f6320afe
commit 7fe5d3d382
18 changed files with 49 additions and 82 deletions

View File

@ -9,8 +9,6 @@
#include <string.h>
#include <types.h>
#define WIFI_SAR_CBFS_FILENAME "wifi_sar_defaults.hex"
/*
* Retrieve WiFi SAR limits data from CBFS and decode it
* WiFi SAR data is expected in the format: [<WRDD><EWRD>][WGDS]
@ -37,6 +35,12 @@ int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits)
char *sar_str;
int ret = -1;
filename = get_wifi_sar_cbfs_filename();
if (filename == NULL) {
printk(BIOS_DEBUG, "Filename missing for CBFS SAR file!\n");
return ret;
}
/*
* If GEO_SAR_ENABLE is not selected, SAR file does not contain
* delta table settings.
@ -64,10 +68,6 @@ int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits)
printk(BIOS_DEBUG, "Checking CBFS for default SAR values\n");
filename = get_wifi_sar_cbfs_filename();
if (filename == NULL)
filename = WIFI_SAR_CBFS_FILENAME;
if (cbfs_load(filename, sar_str, sar_str_len) != sar_str_len) {
printk(BIOS_ERR, "%s has bad len in CBFS\n", filename);
goto done;
@ -88,5 +88,5 @@ done:
__weak
const char *get_wifi_sar_cbfs_filename(void)
{
return WIFI_SAR_CBFS_FILENAME;
return WIFI_SAR_CBFS_DEFAULT_FILENAME;
}