Attention is currently required from: Jincheng Li.
Hello Jincheng Li,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/80632?usp=email
to review the following change.
Change subject: soc/intel/xeon_sp: Add memory type check utils ......................................................................
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 shuo.liu@intel.com Signed-off-by: Jincheng Li jincheng.li@intel.com --- M src/soc/intel/xeon_sp/include/soc/util.h M src/soc/intel/xeon_sp/uncore_acpi.c M src/soc/intel/xeon_sp/util.c 3 files changed, 16 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/32/80632/1
diff --git a/src/soc/intel/xeon_sp/include/soc/util.h b/src/soc/intel/xeon_sp/include/soc/util.h index b532b9a..038ee6e 100644 --- a/src/soc/intel/xeon_sp/include/soc/util.h +++ b/src/soc/intel/xeon_sp/include/soc/util.h @@ -17,6 +17,9 @@ void set_bios_init_completion(void); uint8_t soc_get_iio_ioapicid(int socket, int stack);
+bool is_memtype_non_volatile(uint16_t mem_type); +bool is_memtype_reserved(uint16_t mem_type); + struct iiostack_resource { uint8_t no_of_stacks; STACK_RES res[CONFIG_MAX_SOCKET * MAX_IIO_STACK]; diff --git a/src/soc/intel/xeon_sp/uncore_acpi.c b/src/soc/intel/xeon_sp/uncore_acpi.c index 51c2e0e..9fe7ccd 100644 --- a/src/soc/intel/xeon_sp/uncore_acpi.c +++ b/src/soc/intel/xeon_sp/uncore_acpi.c @@ -98,12 +98,12 @@ "ElementSize: 0x%x, type: %d, reserved: %d\n", e, addr, mem_element->BaseAddress, size, mem_element->ElementSize, mem_element->Type, - (mem_element->Type & MEM_TYPE_RESERVED)); + is_memtype_reserved(mem_element->Type));
assert(mmap_index < MAX_ACPI_MEMORY_AFFINITY_COUNT);
/* skip reserved memory region */ - if (mem_element->Type & MEM_TYPE_RESERVED) + if (is_memtype_reserved(mem_element->Type)) continue; #if CONFIG(SOC_INTEL_SAPPHIRERAPIDS_SP) /* Skip all non processor attached memory regions */ @@ -133,7 +133,7 @@ srat_mem[mmap_index].length_high = (uint32_t)(size >> 32); srat_mem[mmap_index].proximity_domain = mem_element->SocketId; srat_mem[mmap_index].flags = ACPI_SRAT_MEMORY_ENABLED; - if ((mem_element->Type & MEMTYPE_VOLATILE_MASK) == 0) + if (is_memtype_non_volatile(mem_element->Type)) srat_mem[mmap_index].flags |= ACPI_SRAT_MEMORY_NONVOLATILE; ++mmap_index; } diff --git a/src/soc/intel/xeon_sp/util.c b/src/soc/intel/xeon_sp/util.c index 8658e01..244587b 100644 --- a/src/soc/intel/xeon_sp/util.c +++ b/src/soc/intel/xeon_sp/util.c @@ -113,6 +113,16 @@ return hob->PlatformData.IIO_resource[idx].Valid; }
+bool is_memtype_reserved(UINT16 mem_type) +{ + return !!(mem_type & MEM_TYPE_RESERVED); +} + +bool is_memtype_non_volatile(UINT16 mem_type) +{ + return !(mem_type & MEMTYPE_VOLATILE_MASK); +} + unsigned int soc_get_num_cpus(void) { return get_iio_uds()->SystemStatus.numCpus;