summaryrefslogtreecommitdiff
path: root/src/lib/smbios.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/smbios.c')
-rw-r--r--src/lib/smbios.c41
1 files changed, 34 insertions, 7 deletions
diff --git a/src/lib/smbios.c b/src/lib/smbios.c
index ca71e3b053..9cee637b69 100644
--- a/src/lib/smbios.c
+++ b/src/lib/smbios.c
@@ -6,6 +6,7 @@
#include <console/console.h>
#include <version.h>
#include <device/device.h>
+#include <device/pciexp.h>
#include <device/dram/spd.h>
#include <elog.h>
#include <endian.h>
@@ -443,6 +444,14 @@ unsigned int __weak smbios_cpu_get_voltage(void)
return 0; /* Unknown */
}
+unsigned int smbios_get_max_sockets(void)
+{
+ if (CONFIG_MAX_SOCKET == 1)
+ return 1;
+ else
+ return smbios_soc_get_max_sockets();
+}
+
static int smbios_write_type1(unsigned long *current, int handle)
{
struct smbios_type1 *t = smbios_carve_table(*current, SMBIOS_SYSTEM_INFORMATION,
@@ -1128,6 +1137,7 @@ static int smbios_generate_type9_from_devtree(struct device *dev, int *handle,
enum slot_data_bus_bandwidth bandwidth;
enum misc_slot_type type;
enum misc_slot_length length;
+ uint8_t characteristics_1 = 0, characteristics_2 = 0;
if (dev->path.type != DEVICE_PATH_PCI)
return 0;
@@ -1148,16 +1158,31 @@ static int smbios_generate_type9_from_devtree(struct device *dev, int *handle,
else
bandwidth = SlotDataBusWidthUnknown;
- if (dev->smbios_slot_type)
+ if (dev->smbios_slot_type > SlotTypeUnknown) {
type = dev->smbios_slot_type;
- else
+ if ((type >= SlotTypePciExpress && type <= SlotTypeEDSFF_E3) ||
+ (type >= SlotTypeAgp && type <= SlotTypeM2Socket3) ||
+ (type == SlotTypePci)) {
+ characteristics_1 |= SMBIOS_SLOT_3P3V;
+ }
+ if ((type >= SlotTypeAgp && type <= SlotTypeAgp8X) ||
+ (type == SlotTypePci))
+ characteristics_1 |= SMBIOS_SLOT_5V;
+ } else {
+ characteristics_1 = SMBIOS_SLOT_UNKNOWN;
type = SlotTypeUnknown;
+ }
if (dev->smbios_slot_length)
length = dev->smbios_slot_length;
else
length = SlotLengthUnknown;
+ if (pci_has_pme_pin(dev))
+ characteristics_2 |= SMBIOS_SLOT_PME;
+ if (CONFIG(PCIEXP_PLUGIN_SUPPORT) && pciexp_dev_is_slot_hot_plug_cap(dev))
+ characteristics_2 |= SMBIOS_SLOT_HOTPLUG;
+
return smbios_write_type9(current, handle,
dev->smbios_slot_designation,
type,
@@ -1165,8 +1190,8 @@ static int smbios_generate_type9_from_devtree(struct device *dev, int *handle,
usage,
length,
0,
- 1,
- 0,
+ characteristics_1,
+ characteristics_2,
dev->upstream->segment_group,
dev->upstream->secondary,
dev->path.pci.devfn);
@@ -1233,9 +1258,11 @@ unsigned long smbios_write_tables(unsigned long current)
handle++;
update_max(len, max_struct_size, smbios_write_type3(&current, handle++));
- struct smbios_type4 *type4 = (struct smbios_type4 *)current;
- update_max(len, max_struct_size, smbios_write_type4(&current, handle++));
- len += smbios_write_type7_cache_parameters(&current, &handle, &max_struct_size, type4);
+ for (unsigned int s = 0; s < smbios_get_max_sockets(); s++) {
+ struct smbios_type4 *type4 = (struct smbios_type4 *)current;
+ update_max(len, max_struct_size, smbios_write_type4(&current, handle++));
+ len += smbios_write_type7_cache_parameters(&current, &handle, &max_struct_size, type4);
+ }
update_max(len, max_struct_size, smbios_write_type11(&current, &handle));
if (CONFIG(ELOG))
update_max(len, max_struct_size,