summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2019-04-12 15:59:40 +0200
committerPatrick Georgi <pgeorgi@google.com>2019-05-07 16:05:53 +0000
commitf5b9369720ac0458be13e723468e27ab987b439e (patch)
treeb8977953d93acc7926a7959ff6761ad03de94320 /src
parentbd7739f3aa64aa5409265397722728ba1ffa78ac (diff)
downloadcoreboot-f5b9369720ac0458be13e723468e27ab987b439e.tar.xz
smbios: Walk over PCI devicetree to fill type 9
Use the devicetree values for type 9 slots. Tested on Lenovo T520. Change-Id: I1961d8af2d21f755ff52ad58804ea9b31d2a5b9b Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/32308 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86/smbios.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c
index 7c87c693e1..589f4f0e30 100644
--- a/src/arch/x86/smbios.c
+++ b/src/arch/x86/smbios.c
@@ -999,6 +999,56 @@ static int smbios_write_type127(unsigned long *current, int handle)
return len;
}
+/* Generate Type9 entries from devicetree */
+static int smbios_walk_device_tree_type9(struct device *dev, int *handle,
+ unsigned long *current)
+{
+ enum misc_slot_usage usage;
+ enum slot_data_bus_bandwidth bandwidth;
+ enum misc_slot_type type;
+ enum misc_slot_length length;
+
+ if (dev->path.type != DEVICE_PATH_PCI)
+ return 0;
+
+ if (!dev->smbios_slot_type && !dev->smbios_slot_data_width &&
+ !dev->smbios_slot_designation && !dev->smbios_slot_length)
+ return 0;
+
+ if (dev_is_active_bridge(dev))
+ usage = SlotUsageInUse;
+ else if (dev->enabled)
+ usage = SlotUsageAvailable;
+ else
+ usage = SlotUsageUnknown;
+
+ if (dev->smbios_slot_data_width)
+ bandwidth = dev->smbios_slot_data_width;
+ else
+ bandwidth = SlotDataBusWidthUnknown;
+
+ if (dev->smbios_slot_type)
+ type = dev->smbios_slot_type;
+ else
+ type = SlotTypeUnknown;
+
+ if (dev->smbios_slot_length)
+ length = dev->smbios_slot_length;
+ else
+ length = SlotLengthUnknown;
+
+ return smbios_write_type9(current, handle,
+ dev->smbios_slot_designation,
+ type,
+ bandwidth,
+ usage,
+ length,
+ 1,
+ 0,
+ dev->bus->secondary,
+ dev->path.pci.devfn);
+}
+
static int smbios_walk_device_tree(struct device *tree, int *handle,
unsigned long *current)
{
@@ -1011,6 +1061,7 @@ static int smbios_walk_device_tree(struct device *tree, int *handle,
dev_name(dev));
len += dev->ops->get_smbios_data(dev, handle, current);
}
+ len += smbios_walk_device_tree_type9(dev, handle, current);
}
return len;
}