payloads/edk2: Disable the CPU Timer Lib unless supported
[coreboot.git] / src / mainboard / intel / icelake_rvp / board_id.c
blob0ab7e6a5e9f6978af5d9813f26df22c064e7e3b7
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #include "board_id.h"
3 #include <boardid.h>
4 #include <ec/acpi/ec.h>
5 #include <stdint.h>
6 #include <ec/google/chromeec/ec.h>
8 static int get_board_id_via_ext_ec(void)
10 uint32_t id = BOARD_ID_INIT;
12 if (google_chromeec_get_board_version(&id))
13 id = BOARD_ID_UNKNOWN;
15 return id;
18 /* Get Board ID via EC I/O port write/read */
19 int get_board_id(void)
21 MAYBE_STATIC_NONZERO int id = -1;
23 if (id < 0) {
24 if (CONFIG(EC_GOOGLE_CHROMEEC))
25 id = get_board_id_via_ext_ec();
26 else{
27 uint8_t buffer[2];
28 uint8_t index;
29 if (send_ec_command(EC_FAB_ID_CMD) == 0) {
30 for (index = 0; index < sizeof(buffer); index++)
31 buffer[index] = recv_ec_data();
32 id = (buffer[0] << 8) | buffer[1];
37 return id;