diff options
-rw-r--r-- | src/ec/intel/board_id.c | 27 | ||||
-rw-r--r-- | src/ec/intel/board_id.h | 10 | ||||
-rw-r--r-- | src/mainboard/intel/mtlrvp/Makefile.inc | 1 | ||||
-rw-r--r-- | src/mainboard/intel/mtlrvp/variants/baseboard/include/baseboard/variants.h | 15 |
4 files changed, 50 insertions, 3 deletions
diff --git a/src/ec/intel/board_id.c b/src/ec/intel/board_id.c index 2d50b4a614..15acad6617 100644 --- a/src/ec/intel/board_id.c +++ b/src/ec/intel/board_id.c @@ -2,9 +2,32 @@ #include <boardid.h> #include "board_id.h" +#include <ec/acpi/ec.h> +#include <ec/google/chromeec/ec.h> +#include <types.h> -/* Get RVP Board ID */ +static uint32_t get_board_id_via_ext_ec(void) +{ + uint32_t id = BOARD_ID_INIT; + + if (google_chromeec_get_board_version(&id)) + id = BOARD_ID_UNKNOWN; + + return id; +} + +/* Get Board ID via EC I/O port write/read */ int get_rvp_board_id(void) { - return BOARD_ID_INIT; + MAYBE_STATIC_NONZERO int id = BOARD_ID_UNKNOWN; + + if (CONFIG(EC_GOOGLE_CHROMEEC)) { /* CHROME_EC */ + id = get_board_id_via_ext_ec(); + } else { /* WINDOWS_EC */ + if (send_ec_command(EC_FAB_ID_CMD) == 0) { + id = recv_ec_data() << 8; + id |= recv_ec_data(); + } + } + return (id & BOARD_ID_MASK); } diff --git a/src/ec/intel/board_id.h b/src/ec/intel/board_id.h index e4f24d172a..821bb30b65 100644 --- a/src/ec/intel/board_id.h +++ b/src/ec/intel/board_id.h @@ -3,7 +3,15 @@ #ifndef _MAINBOARD_COMMON_BOARD_ID_H_ #define _MAINBOARD_COMMON_BOARD_ID_H_ -/* Returns RVP board_id */ +/* Board/FAB ID Command */ +#define EC_FAB_ID_CMD 0x0d +/* Bit 5:0 for Board ID */ +#define BOARD_ID_MASK 0x3f + +/* + * Returns board information (board id[15:8] and + * Fab info[7:0]) on success and < 0 on error + */ int get_rvp_board_id(void); #endif /* _MAINBOARD_COMMON_BOARD_ID_H_ */ diff --git a/src/mainboard/intel/mtlrvp/Makefile.inc b/src/mainboard/intel/mtlrvp/Makefile.inc index 71ca021fd0..3ec354afe3 100644 --- a/src/mainboard/intel/mtlrvp/Makefile.inc +++ b/src/mainboard/intel/mtlrvp/Makefile.inc @@ -6,4 +6,5 @@ BASEBOARD_DIR:=$(call strip_quotes,$(CONFIG_BASEBOARD_DIR)) subdirs-y += variants/baseboard/$(BASEBOARD_DIR) subdirs-y += variants/$(VARIANT_DIR) +CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/$(BASEBOARD_DIR)/include diff --git a/src/mainboard/intel/mtlrvp/variants/baseboard/include/baseboard/variants.h b/src/mainboard/intel/mtlrvp/variants/baseboard/include/baseboard/variants.h new file mode 100644 index 0000000000..9ce216c8b0 --- /dev/null +++ b/src/mainboard/intel/mtlrvp/variants/baseboard/include/baseboard/variants.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __BASEBOARD_VARIANTS_H__ +#define __BASEBOARD_VARIANTS_H__ + +#include <stdint.h> + +enum mtl_boardid { + MTLP_DDR5_RVP = 0x01, + MTLP_LP5_T3_RVP = 0x02, + MTLP_LP5_T4_RVP = 0x04, + MTLM_LP5_RVP = 0x06, +}; + +#endif /*__BASEBOARD_VARIANTS_H__ */ |