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>
This commit is contained in:
Patrick Rudolph
2019-04-12 14:42:17 +02:00
committed by Patrick Georgi
parent 1a93058448
commit ac24d3c311
8 changed files with 344 additions and 242 deletions

View File

@ -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);