From 5ccce7cdc712843c4f3eef2153b91d98548a12bf Mon Sep 17 00:00:00 2001 From: Kyösti Mälkki Date: Fri, 15 Mar 2019 10:04:11 +0200 Subject: util/sconfig: Declare the repeated devicetree storage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With DEVTREE_EARLY we could create incomplete device objects with topology links removed to reduce footprint for bootblock. Declare everything with 'static __unused DEVTREE_CONST' to avoid compiler errors and to not expose unusable device object names to global scope. Change-Id: Ie4cb9e75f179f44edf4f8256ad8320bc2d4ae71a Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/31931 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- util/sconfig/main.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/util/sconfig/main.c b/util/sconfig/main.c index 548063fd88..265e7285cb 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -696,17 +696,17 @@ static int dev_has_children(struct device *dev) static void pass0(FILE *fil, struct device *ptr, struct device *next) { if (ptr == &base_root_dev) { - fprintf(fil, "DEVTREE_CONST struct bus %s_links[];\n", + fprintf(fil, "STORAGE struct bus %s_links[];\n", ptr->name); return; } - fprintf(fil, "static DEVTREE_CONST struct device %s;\n", ptr->name); + fprintf(fil, "STORAGE struct device %s;\n", ptr->name); if (ptr->res) - fprintf(fil, "DEVTREE_CONST struct resource %s_res[];\n", + fprintf(fil, "STORAGE struct resource %s_res[];\n", ptr->name); if (dev_has_children(ptr)) - fprintf(fil, "DEVTREE_CONST struct bus %s_links[];\n", + fprintf(fil, "STORAGE struct bus %s_links[];\n", ptr->name); if (next) @@ -723,7 +723,7 @@ static void emit_resources(FILE *fil, struct device *ptr) return; int i = 1; - fprintf(fil, "DEVTREE_CONST struct resource %s_res[] = {\n", ptr->name); + fprintf(fil, "STORAGE struct resource %s_res[] = {\n", ptr->name); struct resource *r = ptr->res; while (r) { fprintf(fil, @@ -765,7 +765,7 @@ static void emit_bus(FILE *fil, struct bus *bus) static void emit_dev_links(FILE *fil, struct device *ptr) { - fprintf(fil, "DEVTREE_CONST struct bus %s_links[] = {\n", + fprintf(fil, "STORAGE struct bus %s_links[] = {\n", ptr->name); struct bus *bus = ptr->bus; @@ -784,9 +784,11 @@ static void pass1(FILE *fil, struct device *ptr, struct device *next) struct chip_instance *chip_ins = ptr->chip_instance; int has_children = dev_has_children(ptr); - if (ptr != &base_root_dev) - fprintf(fil, "static "); - fprintf(fil, "DEVTREE_CONST struct device %s = {\n", ptr->name); + if (ptr == &base_root_dev) + fprintf(fil, "DEVTREE_CONST struct device %s = {\n", ptr->name); + else + fprintf(fil, "STORAGE struct device %s = {\n", ptr->name); + fprintf(fil, "#if !DEVTREE_EARLY\n"); /* @@ -942,7 +944,7 @@ static void emit_chip_headers(FILE *fil, struct chip *chip) static void emit_chip_instance(FILE *fil, struct chip_instance *instance) { - fprintf(fil, "DEVTREE_CONST struct %s_config %s_info_%d = {", + fprintf(fil, "STORAGE struct %s_config %s_info_%d = {", instance->chip->name_underscore, instance->chip->name_underscore, instance->id); @@ -965,6 +967,8 @@ static void emit_chips(FILE *fil) emit_chip_headers(fil, chip); + fprintf(fil, "\n#define STORAGE static __unused DEVTREE_CONST\n\n"); + for (; chip; chip = chip->next) { if (!chip->chiph_exists) continue; -- cgit v1.2.3