cpu/x86/smm/pci_resource_store: Store DEV/VEN ID
[coreboot2.git] / src / mainboard / intel / jasperlake_rvp / board_id.c
blobd1876de48fc6d995a1dc7937771b91a71154af60
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <boardid.h>
4 #include <ec/acpi/ec.h>
5 #include <ec/google/chromeec/ec.h>
6 #include <stdint.h>
8 #include "board_id.h"
10 static uint32_t get_board_id_via_ext_ec(void)
12 uint32_t id = BOARD_ID_INIT;
14 if (google_chromeec_get_board_version(&id))
15 id = BOARD_ID_UNKNOWN;
17 return id;
21 * Get Board ID via EC I/O port write/read
22 * Board id is 5 bit, so mask other bits while returning board id.
24 int get_board_id(void)
26 static int id = -1;
28 if (id < 0) {
29 if (CONFIG(EC_GOOGLE_CHROMEEC)) {
30 id = get_board_id_via_ext_ec();
31 } else {
32 uint8_t buffer[2];
33 uint8_t index;
34 if (send_ec_command(EC_FAB_ID_CMD) == 0) {
35 for (index = 0; index < sizeof(buffer); index++)
36 buffer[index] = recv_ec_data();
37 id = (buffer[0] << 8) | buffer[1];
42 return (id & 0x1f);