Angel Pons | 2712398 | 2020-04-05 13:22:30 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Zhuohao Lee | fe68ab9 | 2018-09-01 17:41:56 +0800 | [diff] [blame] | 2 | |
| 3 | #include <baseboard/variants.h> |
| 4 | #include <ec/google/chromeec/ec.h> |
| 5 | #include <smbios.h> |
Elyes Haouas | bdd03c2 | 2024-05-27 11:20:07 +0200 | [diff] [blame] | 6 | #include <stdio.h> |
Zhuohao Lee | e6f12d0 | 2021-03-11 12:07:57 +0800 | [diff] [blame] | 7 | #include <sar.h> |
Zhuohao Lee | fe68ab9 | 2018-09-01 17:41:56 +0800 | [diff] [blame] | 8 | |
| 9 | #define SKU_UNKNOWN 0xFFFFFFFF |
| 10 | |
| 11 | uint32_t variant_board_sku(void) |
| 12 | { |
| 13 | static uint32_t sku_id = SKU_UNKNOWN; |
| 14 | uint32_t id; |
| 15 | |
| 16 | if (sku_id != SKU_UNKNOWN) |
| 17 | return sku_id; |
| 18 | if (google_chromeec_cbi_get_sku_id(&id)) |
| 19 | return SKU_UNKNOWN; |
| 20 | sku_id = id; |
| 21 | |
| 22 | return sku_id; |
| 23 | } |
| 24 | |
Nico Huber | ebd8a4f | 2017-11-01 09:49:16 +0100 | [diff] [blame] | 25 | const char *smbios_system_sku(void) |
Zhuohao Lee | fe68ab9 | 2018-09-01 17:41:56 +0800 | [diff] [blame] | 26 | { |
| 27 | static char sku_str[14]; /* sku{0..4294967295} */ |
| 28 | |
| 29 | snprintf(sku_str, sizeof(sku_str), "sku%u", variant_board_sku()); |
| 30 | |
| 31 | return sku_str; |
| 32 | } |
Zhuohao Lee | e6f12d0 | 2021-03-11 12:07:57 +0800 | [diff] [blame] | 33 | |
| 34 | const char *get_wifi_sar_cbfs_filename(void) |
| 35 | { |
Yuchen He | a083395 | 2023-03-22 00:34:35 +0100 | [diff] [blame] | 36 | const uint32_t sku_id = variant_board_sku(); |
Zhuohao Lee | e6f12d0 | 2021-03-11 12:07:57 +0800 | [diff] [blame] | 37 | |
Zhuohao Lee | e6f12d0 | 2021-03-11 12:07:57 +0800 | [diff] [blame] | 38 | if (sku_id & 0x200) |
Furquan Shaikh | 7fe5d3d | 2021-03-13 22:54:16 -0800 | [diff] [blame] | 39 | return "wifi_sar-shyvana.hex"; |
Zhuohao Lee | e6f12d0 | 2021-03-11 12:07:57 +0800 | [diff] [blame] | 40 | else |
Furquan Shaikh | 7fe5d3d | 2021-03-13 22:54:16 -0800 | [diff] [blame] | 41 | return "wifi_sar-leona.hex"; |
Zhuohao Lee | e6f12d0 | 2021-03-11 12:07:57 +0800 | [diff] [blame] | 42 | } |