aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/intel')
-rw-r--r--src/soc/intel/xeon_sp/cpx/soc_util.c15
-rw-r--r--src/soc/intel/xeon_sp/include/soc/util.h4
-rw-r--r--src/soc/intel/xeon_sp/skx/soc_util.c15
-rw-r--r--src/soc/intel/xeon_sp/spr/soc_util.c21
-rw-r--r--src/soc/intel/xeon_sp/uncore_acpi.c14
5 files changed, 61 insertions, 8 deletions
diff --git a/src/soc/intel/xeon_sp/cpx/soc_util.c b/src/soc/intel/xeon_sp/cpx/soc_util.c
index 5dbac98a2a..2d6005b08f 100644
--- a/src/soc/intel/xeon_sp/cpx/soc_util.c
+++ b/src/soc/intel/xeon_sp/cpx/soc_util.c
@@ -121,3 +121,18 @@ void get_iiostack_info(struct iiostack_resource *info)
}
}
}
+
+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)
+{
+ return true;
+}
diff --git a/src/soc/intel/xeon_sp/include/soc/util.h b/src/soc/intel/xeon_sp/include/soc/util.h
index dd84f0cd02..a7d5dac0e6 100644
--- a/src/soc/intel/xeon_sp/include/soc/util.h
+++ b/src/soc/intel/xeon_sp/include/soc/util.h
@@ -19,6 +19,10 @@ bool soc_cpu_is_enabled(const size_t idx);
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);
+bool is_memtype_processor_attached(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/skx/soc_util.c b/src/soc/intel/xeon_sp/skx/soc_util.c
index 12d30d40f3..38d834f97c 100644
--- a/src/soc/intel/xeon_sp/skx/soc_util.c
+++ b/src/soc/intel/xeon_sp/skx/soc_util.c
@@ -195,3 +195,18 @@ uint8_t soc_get_iio_ioapicid(int socket, int stack)
}
return ioapic_id;
}
+
+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)
+{
+ return true;
+}
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);
+}
diff --git a/src/soc/intel/xeon_sp/uncore_acpi.c b/src/soc/intel/xeon_sp/uncore_acpi.c
index b4856120a7..b7c66407f2 100644
--- a/src/soc/intel/xeon_sp/uncore_acpi.c
+++ b/src/soc/intel/xeon_sp/uncore_acpi.c
@@ -99,19 +99,17 @@ static unsigned int get_srat_memory_entries(acpi_srat_mem_t *srat_mem)
"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 */
- /* In other words, skip all the types >= MemTypeCxlAccVolatileMem */
- if (mem_element->Type >= MemTypeCxlAccVolatileMem)
+ /* skip all non processor attached memory regions */
+ if (CONFIG(SOC_INTEL_HAS_CXL) &&
+ (!is_memtype_processor_attached(mem_element->Type)))
continue;
-#endif
/* skip if this address is already added */
bool skip = false;
@@ -134,7 +132,7 @@ static unsigned int get_srat_memory_entries(acpi_srat_mem_t *srat_mem)
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;
}