diff options
author | Eric Lai <eric_lai@quanta.corp-partner.google.com> | 2022-12-19 09:14:39 +0800 |
---|---|---|
committer | Eric Lai <eric_lai@quanta.corp-partner.google.com> | 2022-12-24 05:50:13 +0000 |
commit | 8cb2f185d11ba1ebcb86bd4add5ebec2f4650d68 (patch) | |
tree | 3709707b8b56ff125970301c15fed97a1d53adf2 /src/vendorcode/google | |
parent | 9f2faca246e32170fcc9154b0bc2dd31a8404721 (diff) |
vc/google/chromeos: use fw_config field to return sar filename
Use fw_config field to return sar filename instead of fw_config probe.
Return filename unconditionly because the sar_id must be valid in
CBI. If invalid sar_id, the file won't exist in CBFS by design.
Signed-off-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Change-Id: I7b75c5d4fd3c459ad7232bb16c6218a6218f1f77
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70896
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Ivy Jian <ivy.jian@quanta.corp-partner.google.com>
Diffstat (limited to 'src/vendorcode/google')
-rw-r--r-- | src/vendorcode/google/chromeos/sar.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/vendorcode/google/chromeos/sar.c b/src/vendorcode/google/chromeos/sar.c index 4250b4ce7e..c42bf65437 100644 --- a/src/vendorcode/google/chromeos/sar.c +++ b/src/vendorcode/google/chromeos/sar.c @@ -3,8 +3,10 @@ #include <cbfs.h> #include <console/console.h> #include <drivers/vpd/vpd.h> +#include <fw_config.h> #include <lib.h> #include <sar.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #include <types.h> @@ -304,3 +306,19 @@ const char *get_wifi_sar_cbfs_filename(void) { return WIFI_SAR_CBFS_DEFAULT_FILENAME; } + +char *get_wifi_sar_fw_config_filename(const struct fw_config_field *field) +{ + uint64_t sar_id = fw_config_get_field(field); + if (sar_id == UNDEFINED_FW_CONFIG) { + printk(BIOS_WARNING, "fw_config unprovisioned, set sar filename to NULL\n"); + return NULL; + } + static char filename[20]; + printk(BIOS_INFO, "Use wifi_sar_%lld.hex.\n", sar_id); + if (snprintf(filename, sizeof(filename), "wifi_sar_%lld.hex", sar_id) < 0) { + printk(BIOS_ERR, "Error occurred with snprintf, set sar filename to NULL\n"); + return NULL; + } + return filename; +} |