summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/soc/intel/common/block/systemagent/systemagent.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/systemagent/systemagent.c b/src/soc/intel/common/block/systemagent/systemagent.c
index d95a4ebedb..0f91156566 100644
--- a/src/soc/intel/common/block/systemagent/systemagent.c
+++ b/src/soc/intel/common/block/systemagent/systemagent.c
@@ -21,6 +21,7 @@
#include <device/pci_ids.h>
#include <intelblocks/acpi.h>
#include <intelblocks/systemagent.h>
+#include <smbios.h>
#include <soc/iomap.h>
#include <soc/pci_devs.h>
#include <soc/systemagent.h>
@@ -275,6 +276,37 @@ static void systemagent_read_resources(struct device *dev)
sa_add_imr_resources(dev, &index);
}
+#if CONFIG(GENERATE_SMBIOS_TABLES)
+static int sa_smbios_write_type_16(struct device *dev, int *handle,
+ unsigned long *current)
+{
+ struct smbios_type16 *t = (struct smbios_type16 *)*current;
+ int len = sizeof(struct smbios_type16);
+
+ struct memory_info *meminfo;
+ meminfo = cbmem_find(CBMEM_ID_MEMINFO);
+ if (meminfo == NULL)
+ return 0; /* can't find mem info in cbmem */
+
+ memset(t, 0, sizeof(struct smbios_type16));
+ t->type = SMBIOS_PHYS_MEMORY_ARRAY;
+ t->handle = *handle;
+ t->length = len - 2;
+ t->location = MEMORY_ARRAY_LOCATION_SYSTEM_BOARD;
+ t->use = MEMORY_ARRAY_USE_SYSTEM;
+ /* TBD, meminfo hob have information about ECC */
+ t->memory_error_correction = MEMORY_ARRAY_ECC_NONE;
+ /* no error information handle available */
+ t->memory_error_information_handle = 0xFFFE;
+ t->maximum_capacity = 32 * (GiB / KiB); /* 32GB as default */
+ t->number_of_memory_devices = meminfo->dimm_cnt;
+
+ *current += len;
+ *handle += 1;
+ return len;
+}
+#endif
+
void enable_power_aware_intr(void)
{
uint8_t pair;
@@ -295,6 +327,9 @@ static struct device_operations systemagent_ops = {
#if CONFIG(HAVE_ACPI_TABLES)
.write_acpi_tables = sa_write_acpi_tables,
#endif
+#if CONFIG(GENERATE_SMBIOS_TABLES)
+ .get_smbios_data = sa_smbios_write_type_16,
+#endif
};
static const unsigned short systemagent_ids[] = {