Furquan Shaikh has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/49214 )
Change subject: sconfig: Emit chip config pointers for PCI devices on root bus ......................................................................
sconfig: Emit chip config pointers for PCI devices on root bus
This change emits chip config pointers for PCI devices on root bus in static_devices.h so that the config structure can be accessed directly without having to reference the device structure. This allows the linker to optimize out unused parts of the device tree from early stages like bootblock.
Change-Id: I1d42e926dbfae14b889ade6dda363d8607974cae Signed-off-by: Furquan Shaikh furquan@google.com --- M util/sconfig/main.c 1 file changed, 18 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/14/49214/1
diff --git a/util/sconfig/main.c b/util/sconfig/main.c index 175b926..7bce227 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -1085,12 +1085,9 @@ fprintf(fil, "\t};\n"); }
-static void pass1(FILE *fil, FILE *head, struct device *ptr, struct device *next) +static struct chip_instance *get_chip_instance(const struct device *dev) { - int pin; - struct chip_instance *chip_ins = ptr->chip_instance; - int has_children = dev_has_children(ptr); - + struct chip_instance *chip_ins = dev->chip_instance; /* * If the chip instance of device has base_chip_instance pointer set, then follow that * to update the chip instance for current device. @@ -1098,6 +1095,15 @@ if (chip_ins->base_chip_instance) chip_ins = chip_ins->base_chip_instance;
+ return chip_ins; +} + +static void pass1(FILE *fil, FILE *head, struct device *ptr, struct device *next) +{ + int pin; + struct chip_instance *chip_ins = get_chip_instance(ptr); + int has_children = dev_has_children(ptr); + /* Emit probe structures. */ if (ptr->probe && (emit_fw_config_probe(fil, ptr) < 0)) { if (head) @@ -1209,12 +1215,19 @@
static void expose_device_names(FILE *fil, FILE *head, struct device *ptr, struct device *next) { + struct chip_instance *chip_ins = get_chip_instance(ptr); + /* Only devices on root bus here. */ if (ptr->bustype == PCI && ptr->parent->dev->bustype == DOMAIN) { fprintf(head, "extern DEVTREE_CONST struct device *DEVTREE_CONST __pci_0_%02x_%d;\n", ptr->path_a, ptr->path_b); fprintf(fil, "DEVTREE_CONST struct device *DEVTREE_CONST __pci_0_%02x_%d = &%s;\n", ptr->path_a, ptr->path_b, ptr->name); + + fprintf(head, "extern DEVTREE_CONST void *DEVTREE_CONST __pci_0_%02x_%d_config;\n", + ptr->path_a, ptr->path_b); + fprintf(fil, "DEVTREE_CONST void *DEVTREE_CONST __pci_0_%02x_%d_config = &%s_info_%d;\n", + ptr->path_a, ptr->path_b, chip_ins->chip->name_underscore, chip_ins->id); }
if (ptr->bustype == PNP) {
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/49214 )
Change subject: sconfig: Emit chip config pointers for PCI devices on root bus ......................................................................
Patch Set 1:
(3 comments)
https://review.coreboot.org/c/coreboot/+/49214/1/util/sconfig/main.c File util/sconfig/main.c:
https://review.coreboot.org/c/coreboot/+/49214/1/util/sconfig/main.c@1227 PS1, Line 1227: fprintf(head, "extern DEVTREE_CONST void *DEVTREE_CONST __pci_0_%02x_%d_config;\n", line over 96 characters
https://review.coreboot.org/c/coreboot/+/49214/1/util/sconfig/main.c@1229 PS1, Line 1229: fprintf(fil, "DEVTREE_CONST void *DEVTREE_CONST __pci_0_%02x_%d_config = &%s_info_%d;\n", line over 96 characters
https://review.coreboot.org/c/coreboot/+/49214/1/util/sconfig/main.c@1230 PS1, Line 1230: ptr->path_a, ptr->path_b, chip_ins->chip->name_underscore, chip_ins->id); line over 96 characters
Hello build bot (Jenkins), Nico Huber, Patrick Georgi, Martin Roth, Tim Wawrzynczak, Angel Pons, Kyösti Mälkki, Karthik Ramasubramanian,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/49214
to look at the new patch set (#2).
Change subject: sconfig: Emit chip config pointers for PCI devices on root bus ......................................................................
sconfig: Emit chip config pointers for PCI devices on root bus
This change emits chip config pointers for PCI devices on root bus in static_devices.h so that the config structure can be accessed directly without having to reference the device structure. This allows the linker to optimize out unused parts of the device tree from early stages like bootblock.
Change-Id: I1d42e926dbfae14b889ade6dda363d8607974cae Signed-off-by: Furquan Shaikh furquan@google.com --- M util/sconfig/main.c 1 file changed, 20 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/14/49214/2
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/49214 )
Change subject: sconfig: Emit chip config pointers for PCI devices on root bus ......................................................................
Patch Set 2:
(3 comments)
https://review.coreboot.org/c/coreboot/+/49214/2/util/sconfig/main.c File util/sconfig/main.c:
https://review.coreboot.org/c/coreboot/+/49214/2/util/sconfig/main.c@1228 PS2, Line 1228: fprintf(head, "extern DEVTREE_CONST void *DEVTREE_CONST __pci_0_%02x_%d_config;\n", line over 96 characters
https://review.coreboot.org/c/coreboot/+/49214/2/util/sconfig/main.c@1230 PS2, Line 1230: fprintf(fil, "DEVTREE_CONST void *DEVTREE_CONST __pci_0_%02x_%d_config = &%s_info_%d;\n", line over 96 characters
https://review.coreboot.org/c/coreboot/+/49214/2/util/sconfig/main.c@1231 PS2, Line 1231: ptr->path_a, ptr->path_b, chip_ins->chip->name_underscore, chip_ins->id); line over 96 characters
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/49214 )
Change subject: sconfig: Emit chip config pointers for PCI devices on root bus ......................................................................
Patch Set 2: Code-Review+1
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/49214 )
Change subject: sconfig: Emit chip config pointers for PCI devices on root bus ......................................................................
Patch Set 3:
(3 comments)
File util/sconfig/main.c:
https://review.coreboot.org/c/coreboot/+/49214/comment/6ad27ee6_5946f7ef PS3, Line 1228: fprintf(head, "extern DEVTREE_CONST void *DEVTREE_CONST __pci_0_%02x_%d_config;\n", line over 96 characters
https://review.coreboot.org/c/coreboot/+/49214/comment/83e56604_ce15ee88 PS3, Line 1230: fprintf(fil, "DEVTREE_CONST void *DEVTREE_CONST __pci_0_%02x_%d_config = &%s_info_%d;\n", line over 96 characters
https://review.coreboot.org/c/coreboot/+/49214/comment/e7ec1faf_44e08915 PS3, Line 1231: ptr->path_a, ptr->path_b, chip_ins->chip->name_underscore, chip_ins->id); line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/49214 )
Change subject: sconfig: Emit chip config pointers for PCI devices on root bus ......................................................................
Patch Set 4:
(3 comments)
File util/sconfig/main.c:
https://review.coreboot.org/c/coreboot/+/49214/comment/99bc5a0f_258ab262 PS4, Line 1228: fprintf(head, "extern DEVTREE_CONST void *DEVTREE_CONST __pci_0_%02x_%d_config;\n", line over 96 characters
https://review.coreboot.org/c/coreboot/+/49214/comment/6fb75fb6_8ca93c2b PS4, Line 1230: fprintf(fil, "DEVTREE_CONST void *DEVTREE_CONST __pci_0_%02x_%d_config = &%s_info_%d;\n", line over 96 characters
https://review.coreboot.org/c/coreboot/+/49214/comment/1107bf39_a2b26680 PS4, Line 1231: ptr->path_a, ptr->path_b, chip_ins->chip->name_underscore, chip_ins->id); line over 96 characters
Attention is currently required from: Furquan Shaikh. Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/49214 )
Change subject: sconfig: Emit chip config pointers for PCI devices on root bus ......................................................................
Patch Set 4: Code-Review+2
(1 comment)
File util/sconfig/main.c:
https://review.coreboot.org/c/coreboot/+/49214/comment/8ff9ef8f_919c6b55 PS4, Line 1228: DEVTREE_CONST Although I wrote the surrounding code, I don't see a reason why the pointer itself shouldn't be plainly `const`. I can update that later.
Hello build bot (Jenkins), Nico Huber, Patrick Georgi, Martin Roth, Tim Wawrzynczak, Angel Pons, Kyösti Mälkki, Karthik Ramasubramanian,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/49214
to look at the new patch set (#5).
Change subject: util/sconfig: Emit chip config pointers for PCI devices on root bus ......................................................................
util/sconfig: Emit chip config pointers for PCI devices on root bus
This change emits chip config pointers for PCI devices on root bus in static_devices.h so that the config structure can be accessed directly without having to reference the device structure. This allows the linker to optimize out unused parts of the device tree from early stages like bootblock.
Change-Id: I1d42e926dbfae14b889ade6dda363d8607974cae Signed-off-by: Furquan Shaikh furquan@google.com --- M util/sconfig/main.c 1 file changed, 20 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/14/49214/5
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/49214 )
Change subject: util/sconfig: Emit chip config pointers for PCI devices on root bus ......................................................................
Patch Set 5:
(3 comments)
File util/sconfig/main.c:
https://review.coreboot.org/c/coreboot/+/49214/comment/353ed190_6859855b PS5, Line 1228: fprintf(head, "extern DEVTREE_CONST void *const __pci_0_%02x_%d_config;\n", line over 96 characters
https://review.coreboot.org/c/coreboot/+/49214/comment/c5f9588e_b598bea4 PS5, Line 1230: fprintf(fil, "DEVTREE_CONST void *const __pci_0_%02x_%d_config = &%s_info_%d;\n", line over 96 characters
https://review.coreboot.org/c/coreboot/+/49214/comment/cce77bde_1d0b2f07 PS5, Line 1231: ptr->path_a, ptr->path_b, chip_ins->chip->name_underscore, chip_ins->id); line over 96 characters
Attention is currently required from: Nico Huber. Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/49214 )
Change subject: util/sconfig: Emit chip config pointers for PCI devices on root bus ......................................................................
Patch Set 5:
(1 comment)
File util/sconfig/main.c:
https://review.coreboot.org/c/coreboot/+/49214/comment/9e6fa17c_5ab9eaab PS4, Line 1228: DEVTREE_CONST
Although I wrote the surrounding code, I don't see a reason why the pointer […]
Done: https://review.coreboot.org/c/coreboot/+/49242
Attention is currently required from: Furquan Shaikh. Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/49214 )
Change subject: util/sconfig: Emit chip config pointers for PCI devices on root bus ......................................................................
Patch Set 5: Code-Review+2
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/49214 )
Change subject: util/sconfig: Emit chip config pointers for PCI devices on root bus ......................................................................
Patch Set 6:
(3 comments)
File util/sconfig/main.c:
https://review.coreboot.org/c/coreboot/+/49214/comment/ea37890f_66a0197c PS6, Line 1228: fprintf(head, "extern DEVTREE_CONST void *const __pci_0_%02x_%d_config;\n", line over 96 characters
https://review.coreboot.org/c/coreboot/+/49214/comment/b06c5ea1_1130ea3e PS6, Line 1230: fprintf(fil, "DEVTREE_CONST void *const __pci_0_%02x_%d_config = &%s_info_%d;\n", line over 96 characters
https://review.coreboot.org/c/coreboot/+/49214/comment/7eea776e_6c8aa747 PS6, Line 1231: ptr->path_a, ptr->path_b, chip_ins->chip->name_underscore, chip_ins->id); line over 96 characters
Attention is currently required from: Furquan Shaikh. Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/49214 )
Change subject: util/sconfig: Emit chip config pointers for PCI devices on root bus ......................................................................
Patch Set 6: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/49214 )
Change subject: util/sconfig: Emit chip config pointers for PCI devices on root bus ......................................................................
util/sconfig: Emit chip config pointers for PCI devices on root bus
This change emits chip config pointers for PCI devices on root bus in static_devices.h so that the config structure can be accessed directly without having to reference the device structure. This allows the linker to optimize out unused parts of the device tree from early stages like bootblock.
Change-Id: I1d42e926dbfae14b889ade6dda363d8607974cae Signed-off-by: Furquan Shaikh furquan@google.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/49214 Reviewed-by: Angel Pons th3fanbus@gmail.com Reviewed-by: Nico Huber nico.h@gmx.de Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M util/sconfig/main.c 1 file changed, 20 insertions(+), 5 deletions(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Angel Pons: Looks good to me, approved
diff --git a/util/sconfig/main.c b/util/sconfig/main.c index 1af55ac..99e76ad 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -1085,12 +1085,9 @@ fprintf(fil, "\t};\n"); }
-static void pass1(FILE *fil, FILE *head, struct device *ptr, struct device *next) +static struct chip_instance *get_chip_instance(const struct device *dev) { - int pin; - struct chip_instance *chip_ins = ptr->chip_instance; - int has_children = dev_has_children(ptr); - + struct chip_instance *chip_ins = dev->chip_instance; /* * If the chip instance of device has base_chip_instance pointer set, then follow that * to update the chip instance for current device. @@ -1098,6 +1095,15 @@ if (chip_ins->base_chip_instance) chip_ins = chip_ins->base_chip_instance;
+ return chip_ins; +} + +static void pass1(FILE *fil, FILE *head, struct device *ptr, struct device *next) +{ + int pin; + struct chip_instance *chip_ins = get_chip_instance(ptr); + int has_children = dev_has_children(ptr); + /* Emit probe structures. */ if (ptr->probe && (emit_fw_config_probe(fil, ptr) < 0)) { if (head) @@ -1209,12 +1215,21 @@
static void expose_device_names(FILE *fil, FILE *head, struct device *ptr, struct device *next) { + struct chip_instance *chip_ins = get_chip_instance(ptr); + /* Only devices on root bus here. */ if (ptr->bustype == PCI && ptr->parent->dev->bustype == DOMAIN) { fprintf(head, "extern DEVTREE_CONST struct device *const __pci_0_%02x_%d;\n", ptr->path_a, ptr->path_b); fprintf(fil, "DEVTREE_CONST struct device *const __pci_0_%02x_%d = &%s;\n", ptr->path_a, ptr->path_b, ptr->name); + + if (chip_ins->chip->chiph_exists) { + fprintf(head, "extern DEVTREE_CONST void *const __pci_0_%02x_%d_config;\n", + ptr->path_a, ptr->path_b); + fprintf(fil, "DEVTREE_CONST void *const __pci_0_%02x_%d_config = &%s_info_%d;\n", + ptr->path_a, ptr->path_b, chip_ins->chip->name_underscore, chip_ins->id); + } }
if (ptr->bustype == PNP) {