summaryrefslogtreecommitdiff
path: root/util/sconfig/main.c
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-09-03 16:55:25 +0200
committerFelix Held <felix-coreboot@felixheld.de>2021-09-13 13:58:20 +0000
commitd56d2a86edace2a0058a54c2d1a075b1211e2945 (patch)
tree01f73e439bf11e8a1f37d22077d247ce9b6af796 /util/sconfig/main.c
parent39e029768b90bbe4b3ccb05d6ffa9d4f5fa1050a (diff)
util/sconfig: Extract handling of SMBIOS data
Move the code that handles devices' SMBIOS data into a helper function. Change-Id: I4f36d6c6f26e79558d360d319d09b0b8426def0e Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/57369 Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/sconfig/main.c')
-rw-r--r--util/sconfig/main.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 9d791ef6c3..2b1feda95e 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -1108,6 +1108,29 @@ static void pass0(FILE *fil, FILE *head, struct device *ptr, struct device *next
ptr->name);
}
+static void emit_smbios_data(FILE *fil, struct device *ptr)
+{
+ 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);
+
+ fprintf(fil, "#endif\n");
+ fprintf(fil, "#endif\n");
+}
+
static void emit_resources(FILE *fil, struct device *ptr)
{
if (ptr->res == NULL)
@@ -1266,23 +1289,9 @@ static void pass1(FILE *fil, FILE *head, struct device *ptr, struct device *next
chip_ins->chip->name_underscore, chip_ins->id);
if (next)
fprintf(fil, "\t.next=&%s,\n", next->name);
- 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);
- fprintf(fil, "#endif\n");
- fprintf(fil, "#endif\n");
+
+ emit_smbios_data(fil, ptr);
+
fprintf(fil, "};\n");
emit_resources(fil, ptr);