summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2017-04-16 22:05:36 -0500
committerAaron Durbin <adurbin@chromium.org>2017-04-25 18:14:38 +0200
commite4d7abc0d448c7e805f2b48ed1251708d1f84c67 (patch)
tree4ca1014c9d972063e7b44c8a373072008c6015fa /util
parent4003950881af6fc4761aa0b177a3670d04ee9881 (diff)
downloadcoreboot-e4d7abc0d448c7e805f2b48ed1251708d1f84c67.tar.xz
lib: provide clearer devicetree semantics
The devicetree data structures have been available in more than just ramstage and romstage. In order to provide clearer and consistent semantics two new macros are provided: 1. DEVTREE_EARLY which is true when !ENV_RAMSTAGE 2. DEVTREE_CONST as a replacment for ROMSTAGE_CONST The ROMSTAGE_CONST attribute is used in the source code to mark the devicetree data structures as const in early stages even though it's not just romstage. Therefore, rename the attribute to DEVTREE_CONST as that's the actual usage. The only place where the usage was not devicetree related is console_loglevel, but the same name was used for consistency. Any stage that is not ramstage has the const C attribute applied when DEVTREE_CONST is used. Change-Id: Ibd51c2628dc8f68e0896974f7e4e7c8588d333ed Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/19333 Tested-by: build bot (Jenkins) Reviewed-by: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'util')
-rw-r--r--util/sconfig/main.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 2bc614589b..570ca4a0cf 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -407,18 +407,18 @@ void add_ioapic_info(struct device *dev, int apicid, const char *_srcpin,
static void pass0(FILE * fil, struct device *ptr)
{
if (ptr->type == device && ptr->id == 0)
- fprintf(fil, "ROMSTAGE_CONST struct bus %s_links[];\n",
+ fprintf(fil, "DEVTREE_CONST struct bus %s_links[];\n",
ptr->name);
if ((ptr->type == device) && (ptr->id != 0) && (!ptr->used)) {
- fprintf(fil, "ROMSTAGE_CONST static struct device %s;\n",
+ fprintf(fil, "DEVTREE_CONST static struct device %s;\n",
ptr->name);
if (ptr->rescnt > 0)
fprintf(fil,
- "ROMSTAGE_CONST struct resource %s_res[];\n",
+ "DEVTREE_CONST struct resource %s_res[];\n",
ptr->name);
if (ptr->children || ptr->multidev)
- fprintf(fil, "ROMSTAGE_CONST struct bus %s_links[];\n",
+ fprintf(fil, "DEVTREE_CONST struct bus %s_links[];\n",
ptr->name);
}
}
@@ -429,9 +429,9 @@ static void pass1(FILE * fil, struct device *ptr)
if (!ptr->used && (ptr->type == device)) {
if (ptr->id != 0)
fprintf(fil, "static ");
- fprintf(fil, "ROMSTAGE_CONST struct device %s = {\n",
+ fprintf(fil, "DEVTREE_CONST struct device %s = {\n",
ptr->name);
- fprintf(fil, "#ifndef __PRE_RAM__\n");
+ fprintf(fil, "#if !DEVTREE_EARLY\n");
fprintf(fil, "\t.ops = %s,\n", (ptr->ops) ? (ptr->ops) : "0");
fprintf(fil, "#endif\n");
fprintf(fil, "\t.bus = &%s_links[%d],\n", ptr->bus->name,
@@ -470,7 +470,7 @@ static void pass1(FILE * fil, struct device *ptr)
fprintf(fil, "\t.link_list = NULL,\n");
if (ptr->sibling)
fprintf(fil, "\t.sibling = &%s,\n", ptr->sibling->name);
- fprintf(fil, "#ifndef __PRE_RAM__\n");
+ fprintf(fil, "#if !DEVTREE_EARLY\n");
fprintf(fil, "\t.chip_ops = &%s_ops,\n",
ptr->chip->name_underscore);
if (ptr->chip->chip == &mainboard)
@@ -485,7 +485,7 @@ static void pass1(FILE * fil, struct device *ptr)
}
if (ptr->rescnt > 0) {
int i = 1;
- fprintf(fil, "ROMSTAGE_CONST struct resource %s_res[] = {\n",
+ fprintf(fil, "DEVTREE_CONST struct resource %s_res[] = {\n",
ptr->name);
struct resource *r = ptr->res;
while (r) {
@@ -510,7 +510,7 @@ static void pass1(FILE * fil, struct device *ptr)
}
if (!ptr->used && ptr->type == device
&& (ptr->children || ptr->multidev)) {
- fprintf(fil, "ROMSTAGE_CONST struct bus %s_links[] = {\n",
+ fprintf(fil, "DEVTREE_CONST struct bus %s_links[] = {\n",
ptr->name);
if (ptr->multidev) {
struct device *d = ptr;
@@ -554,7 +554,7 @@ static void pass1(FILE * fil, struct device *ptr)
if ((ptr->type == chip) && (ptr->chiph_exists)) {
if (ptr->reg) {
fprintf(fil,
- "ROMSTAGE_CONST struct %s_config %s_info_%d = {\n",
+ "DEVTREE_CONST struct %s_config %s_info_%d = {\n",
ptr->name_underscore, ptr->name_underscore,
ptr->id);
struct reg *r = ptr->reg;
@@ -565,7 +565,7 @@ static void pass1(FILE * fil, struct device *ptr)
fprintf(fil, "};\n\n");
} else {
fprintf(fil,
- "ROMSTAGE_CONST struct %s_config %s_info_%d = { };\n",
+ "DEVTREE_CONST struct %s_config %s_info_%d = { };\n",
ptr->name_underscore, ptr->name_underscore,
ptr->id);
}
@@ -665,7 +665,7 @@ int main(int argc, char **argv)
if (h->chiph_exists)
fprintf(autogen, "#include \"%s/chip.h\"\n", h->name);
}
- fprintf(autogen, "\n#ifndef __PRE_RAM__\n");
+ fprintf(autogen, "\n#if !DEVTREE_EARLY\n");
fprintf(autogen,
"__attribute__((weak)) struct chip_operations mainboard_ops = {};\n");
h = &headers;
@@ -683,7 +683,7 @@ int main(int argc, char **argv)
fprintf(autogen, "\n/* pass 0 */\n");
walk_device_tree(autogen, &root, pass0, NULL);
fprintf(autogen, "\n/* pass 1 */\n"
- "ROMSTAGE_CONST struct device * ROMSTAGE_CONST last_dev = &%s;\n",
+ "DEVTREE_CONST struct device * DEVTREE_CONST last_dev = &%s;\n",
lastdev->name);
walk_device_tree(autogen, &root, pass1, NULL);