summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2020-05-02 15:51:02 -0700
committerFurquan Shaikh <furquan@google.com>2020-05-07 11:55:35 +0000
commit9f681d2d7c48431d2d286d5ce7060bba924f4e37 (patch)
tree3e131e9c22a23e9c03f585b9cffc202a47842cee /util
parent4ebe953090df979a76b99a532b2f28e697fbf365 (diff)
downloadcoreboot-9f681d2d7c48431d2d286d5ce7060bba924f4e37.tar.xz
util/sconfig: Move chip instance id assignment to emit_chips()
This change moves the assignment of id for chip instance from new_chip_instance() to emit_chips(). This is similar to the previous change for moving dev id assignment to happen much later. This ensures that the same ID gets assigned to a chip when adding support for device trees which makes it easier to compare static.c files. BUG=b:155549176 Change-Id: I3efa9af5ed91123675be42bce1cb389bad19cb62 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/41006 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/sconfig/main.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 27fca44179..951ad6d219 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -30,12 +30,6 @@ extern int linenum;
*/
static struct chip chip_header;
-/*
- * This is intentionally shared between chip and device structure ids because it
- * is easier to track the order of parsing for chip and device.
- */
-static int count = 0;
-
typedef enum {
UNSLASH,
SPLIT_1ST,
@@ -336,7 +330,6 @@ struct chip_instance *new_chip_instance(char *path)
struct chip *chip = get_chip(path);
struct chip_instance *instance = S_ALLOC(sizeof(*instance));
- instance->id = ++count;
instance->chip = chip;
instance->next = chip->instance;
chip->instance = instance;
@@ -987,6 +980,7 @@ static void emit_chips(FILE *fil)
{
struct chip *chip = chip_header.next;
struct chip_instance *instance;
+ int chip_id;
emit_chip_headers(fil, chip);
@@ -996,8 +990,10 @@ static void emit_chips(FILE *fil)
if (!chip->chiph_exists)
continue;
+ chip_id = 1;
instance = chip->instance;
while (instance) {
+ instance->id = chip_id++;
emit_chip_instance(fil, instance);
instance = instance->next;
}