From a5bdf8e8df7c2afe0264c58537569d6142d145cd Mon Sep 17 00:00:00 2001 From: Shuo Liu Date: Tue, 20 Feb 2024 01:06:10 +0800 Subject: soc/intel/xeon_sp: Add memory type check utils FSP memory type representations change across Xeon-SP SoCs. This patch adds type check utils to abstract the differences. TEST=intel/archercity CRB Change-Id: I2f5f3c0f16dc50bc739146e46afce2e5fbf4f62c Signed-off-by: Shuo Liu Signed-off-by: Jincheng Li Reviewed-on: https://review.coreboot.org/c/coreboot/+/80632 Tested-by: build bot (Jenkins) Reviewed-by: Lean Sheng Tan --- src/soc/intel/xeon_sp/spr/soc_util.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/soc/intel/xeon_sp/spr') diff --git a/src/soc/intel/xeon_sp/spr/soc_util.c b/src/soc/intel/xeon_sp/spr/soc_util.c index b8f06accad..41b256c28a 100644 --- a/src/soc/intel/xeon_sp/spr/soc_util.c +++ b/src/soc/intel/xeon_sp/spr/soc_util.c @@ -167,3 +167,24 @@ void soc_set_mrc_cold_boot_flag(bool cold_boot_required) cmos_write(new_mrc_status, CMOS_OFFSET_MRC_STATUS); } + +bool is_memtype_reserved(uint16_t mem_type) +{ + return !!(mem_type & MEM_TYPE_RESERVED); +} + +bool is_memtype_non_volatile(uint16_t mem_type) +{ + return !(mem_type & MEMTYPE_VOLATILE_MASK); +} + +bool is_memtype_processor_attached(uint16_t mem_type) +{ + /* + * Refer to the definition of MEM_TYPE enum type in + * vendorcode/intel/fsp/fsp2_0/sapphirerapids_sp/MemoryMapDataHob.h, + * values less than MemTypeCxlAccVolatileMem represents + * processor attached memory + */ + return (mem_type < MemTypeCxlAccVolatileMem); +} -- cgit v1.2.3