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>
This commit is contained in:
Johnny Lin 2022-12-19 21:36:00 +08:00 committed by Felix Held
parent da538cb38f
commit 651e3e06a5
2 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -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);
}