summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/sar.h3
-rw-r--r--src/vendorcode/google/chromeos/sar.c18
2 files changed, 21 insertions, 0 deletions
diff --git a/src/include/sar.h b/src/include/sar.h
index beccb377cd..87edf1a5b7 100644
--- a/src/include/sar.h
+++ b/src/include/sar.h
@@ -2,6 +2,7 @@
#ifndef _SAR_H_
#define _SAR_H_
+#include <fw_config.h>
#include <stdint.h>
#define MAX_ANT_GAINS_REVISION 2
@@ -88,4 +89,6 @@ int get_wifi_sar_limits(union wifi_sar_limits *sar_limits);
const char *get_wifi_sar_cbfs_filename(void);
+char *get_wifi_sar_fw_config_filename(const struct fw_config_field *field);
+
#endif /* _SAR_H_ */
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;
+}