summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorJohnny Lin <johnny_lin@wiwynn.com>2022-12-19 21:36:00 +0800
committerFelix Held <felix-coreboot@felixheld.de>2023-01-11 14:57:20 +0000
commit651e3e06a5b2374acf9d2ba3328d8318d8f52fe9 (patch)
tree3e03d4ce23320e3351bf6d0e6c9b317ac17f8ac4 /src/drivers
parentda538cb38f559052cce2879ad8b96a6014390af6 (diff)
drivers/ocp/vpd: add get_cxl_mode_from_vpd()
cxl_mode VPD variable supports 3 modes: CXL_DISABLED, CXL_SYSTEM_MEMORY and CXL_SPM. Change-Id: Ib3bf85fbe687680db3c11efa908c4fb351be9c44 Signed-off-by: Johnny Lin <johnny_lin@wiwynn.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/71100 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jonathan Zhang <jonzhang@fb.com> Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/ocp/include/vpd.h1
-rw-r--r--src/drivers/ocp/vpd/vpd_util.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/src/drivers/ocp/include/vpd.h b/src/drivers/ocp/include/vpd.h
index f4517c4660..d58f79120f 100644
--- a/src/drivers/ocp/include/vpd.h
+++ b/src/drivers/ocp/include/vpd.h
@@ -81,4 +81,5 @@ enum cxl_memory_mode {
int get_int_from_vpd_range(const char *const key, const int fallback, const int min,
const int max);
bool get_bool_from_vpd(const char *const key, const bool fallback);
+int get_cxl_mode_from_vpd(void);
#endif
diff --git a/src/drivers/ocp/vpd/vpd_util.c b/src/drivers/ocp/vpd/vpd_util.c
index 3a66b884f2..27d7bccb5c 100644
--- a/src/drivers/ocp/vpd/vpd_util.c
+++ b/src/drivers/ocp/vpd/vpd_util.c
@@ -38,3 +38,8 @@ bool get_bool_from_vpd(const char *const key, const bool fallback)
return (bool)val;
}
+
+int get_cxl_mode_from_vpd(void)
+{
+ return get_int_from_vpd_range(CXL_MODE, CXL_MODE_DEFAULT, 0, CXL_MODE_MAX-1);
+}