summaryrefslogtreecommitdiff
path: root/util/sconfig/main.c
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2019-04-12 14:42:17 +0200
committerPatrick Georgi <pgeorgi@google.com>2019-05-07 16:04:56 +0000
commitac24d3c3118f0ffbf7f26e0ef867c58dbdcc98e3 (patch)
treee847a4cfb66338b9a5da452046308a4d4c6f1239 /util/sconfig/main.c
parent1a930584482c1cafb7ed02a9c37fcfe7cb61fb3f (diff)
downloadcoreboot-ac24d3c3118f0ffbf7f26e0ef867c58dbdcc98e3.tar.xz
sconfig: Add SMBIOS type 9 entries
Add the new field 'smbios_slot_desc', which takes 2 to 4 arguments. The field is valid for PCI devices and only compiled if SMBIOS table generation is enabled. smbios_slot_desc arguments: 1. slot type 2. slot lenth 3. slot designation (optional) 4. slot data width (optional) Example: device pci 1c.1 on smbios_slot_desc "21" "3" "MINI-PCI-FULL" "8" end # PCIe Port #2 Integrated Wireless LAN Tested on Lenovo T520. Change-Id: If95aae3c322d3da47637613b9a872ba1f7af9080 Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/32307 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Diffstat (limited to 'util/sconfig/main.c')
-rw-r--r--util/sconfig/main.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 5382f470fd..c3aa17f1a0 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -622,6 +622,22 @@ void add_register(struct chip_instance *chip_instance, char *name, char *val)
}
}
+void add_slot_desc(struct bus *bus, char *type, char *length, char *designation,
+ char *data_width)
+{
+ struct device *dev = bus->dev;
+
+ if (dev->bustype != PCI && dev->bustype != DOMAIN) {
+ printf("ERROR: 'slot_type' only allowed for PCI devices\n");
+ exit(1);
+ }
+
+ dev->smbios_slot_type = type;
+ dev->smbios_slot_length = length;
+ dev->smbios_slot_data_width = data_width;
+ dev->smbios_slot_designation = designation;
+}
+
void add_pci_subsystem_ids(struct bus *bus, int vendor, int device,
int inherit)
{
@@ -831,7 +847,30 @@ static void pass1(FILE *fil, struct device *ptr, struct device *next)
fprintf(fil, "\t.chip_info = &%s_info_%d,\n",
chip_ins->chip->name_underscore, chip_ins->id);
if (next)
- fprintf(fil, "\t.next=&%s\n", next->name);
+ fprintf(fil, "\t.next=&%s,\n", next->name);
+ if (ptr->smbios_slot_type || ptr->smbios_slot_data_width ||
+ ptr->smbios_slot_designation || ptr->smbios_slot_length) {
+ fprintf(fil, "#if !DEVTREE_EARLY\n");
+ fprintf(fil, "#if CONFIG(GENERATE_SMBIOS_TABLES)\n");
+ }
+ /* SMBIOS types start at 1, if zero it hasn't been set */
+ if (ptr->smbios_slot_type)
+ fprintf(fil, "\t.smbios_slot_type = %s,\n",
+ ptr->smbios_slot_type);
+ if (ptr->smbios_slot_data_width)
+ fprintf(fil, "\t.smbios_slot_data_width = %s,\n",
+ ptr->smbios_slot_data_width);
+ if (ptr->smbios_slot_designation)
+ fprintf(fil, "\t.smbios_slot_designation = \"%s\",\n",
+ ptr->smbios_slot_designation);
+ if (ptr->smbios_slot_length)
+ fprintf(fil, "\t.smbios_slot_length = %s,\n",
+ ptr->smbios_slot_length);
+ if (ptr->smbios_slot_type || ptr->smbios_slot_data_width ||
+ ptr->smbios_slot_designation || ptr->smbios_slot_length) {
+ fprintf(fil, "#endif\n");
+ fprintf(fil, "#endif\n");
+ }
fprintf(fil, "};\n");
emit_resources(fil, ptr);