diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2019-03-15 10:04:11 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-07-10 10:17:48 +0000 |
commit | 5ccce7cdc712843c4f3eef2153b91d98548a12bf (patch) | |
tree | 259ae48fcb20ab6ecf8ed61554ec00bf0724f21c /util/sconfig | |
parent | 975a7e3ba3e646f91a5c6e73968e9efd1a1521f1 (diff) |
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>
Diffstat (limited to 'util/sconfig')
-rw-r--r-- | util/sconfig/main.c | 24 |
1 files 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; |