blob: e8c7e69842cd2cc8283114634525639026681b11 [file] [log] [blame]
Angel Pons27123982020-04-05 13:22:30 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Zhuohao Leefe68ab92018-09-01 17:41:56 +08002
3#include <baseboard/variants.h>
4#include <ec/google/chromeec/ec.h>
5#include <smbios.h>
Elyes Haouasbdd03c22024-05-27 11:20:07 +02006#include <stdio.h>
Zhuohao Leefe68ab92018-09-01 17:41:56 +08007#include <string.h>
Zhuohao Leee6f12d02021-03-11 12:07:57 +08008#include <sar.h>
Zhuohao Leefe68ab92018-09-01 17:41:56 +08009
10#define SKU_UNKNOWN 0xFFFFFFFF
11
12uint32_t variant_board_sku(void)
13{
14 static uint32_t sku_id = SKU_UNKNOWN;
15 uint32_t id;
16
17 if (sku_id != SKU_UNKNOWN)
18 return sku_id;
19 if (google_chromeec_cbi_get_sku_id(&id))
20 return SKU_UNKNOWN;
21 sku_id = id;
22
23 return sku_id;
24}
25
Nico Huberebd8a4f2017-11-01 09:49:16 +010026const char *smbios_system_sku(void)
Zhuohao Leefe68ab92018-09-01 17:41:56 +080027{
28 static char sku_str[14]; /* sku{0..4294967295} */
29
30 snprintf(sku_str, sizeof(sku_str), "sku%u", variant_board_sku());
31
32 return sku_str;
33}
Zhuohao Leee6f12d02021-03-11 12:07:57 +080034
35const char *get_wifi_sar_cbfs_filename(void)
36{
Yuchen Hea0833952023-03-22 00:34:35 +010037 const uint32_t sku_id = variant_board_sku();
Zhuohao Leee6f12d02021-03-11 12:07:57 +080038
Zhuohao Leee6f12d02021-03-11 12:07:57 +080039 if (sku_id & 0x200)
Furquan Shaikh7fe5d3d2021-03-13 22:54:16 -080040 return "wifi_sar-shyvana.hex";
Zhuohao Leee6f12d02021-03-11 12:07:57 +080041 else
Furquan Shaikh7fe5d3d2021-03-13 22:54:16 -080042 return "wifi_sar-leona.hex";
Zhuohao Leee6f12d02021-03-11 12:07:57 +080043}