Patrick Georgi has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/31931 )
Change subject: util/sconfig: Declare the repeated devicetree storage ......................................................................
util/sconfig: Declare the repeated devicetree storage
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 kyosti.malkki@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/31931 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Patrick Georgi pgeorgi@google.com --- M util/sconfig/main.c 1 file changed, 14 insertions(+), 10 deletions(-)
Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved
diff --git a/util/sconfig/main.c b/util/sconfig/main.c index 548063f..265e728 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -696,17 +696,17 @@ 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 @@ 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_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 @@ 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_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 @@
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;