summaryrefslogtreecommitdiffstats
path: root/src/ec
diff options
context:
space:
mode:
authorJamie Ryu <jamie.m.ryu@intel.com>2022-07-22 13:58:14 -0700
committerFelix Held <felix-coreboot@felixheld.de>2022-12-09 23:57:03 +0000
commited8bdefcdf6c19258febb9931d1e8eb12b958bcc (patch)
tree01bf390d7fcb463b624e87e7f41efa3ef83989c9 /src/ec
parentc03cdc143a90d410066f210243278aac5acd3116 (diff)
downloadcoreboot-ed8bdefcdf6c19258febb9931d1e8eb12b958bcc.tar.gz
coreboot-ed8bdefcdf6c19258febb9931d1e8eb12b958bcc.tar.bz2
coreboot-ed8bdefcdf6c19258febb9931d1e8eb12b958bcc.zip
mb/intel/mtlrvp: Add MTL-P RVP board ids
This adds MTL-P board id definition. Change include, 1. Add board_id.c implementation 2. Add board_id.h implementation 3. Add board_id config in variants.h 4. Makefile changes BUG=b:224325352 TEST=Able to build with the patch and boot the mtlrvp platform with the subsequent patches in the train Signed-off-by: Jamie Ryu <jamie.m.ryu@intel.com> Change-Id: I90b0543d5db208f696d2c2c2dc3d2581514a845b Signed-off-by: Harsha B R <harsha.b.r@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66102 Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Usha P <usha.p@intel.com> Reviewed-by: Subrata Banik <subratabanik@google.com>
Diffstat (limited to 'src/ec')
-rw-r--r--src/ec/intel/board_id.c27
-rw-r--r--src/ec/intel/board_id.h10
2 files changed, 34 insertions, 3 deletions
diff --git a/src/ec/intel/board_id.c b/src/ec/intel/board_id.c
index 2d50b4a61430..15acad6617a4 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 e4f24d172af9..821bb30b65db 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_ */