Nico Huber has submitted this change. ( https://review.coreboot.org/c/coreboot/+/84431?usp=email )
Change subject: sconfig: Move config_of_soc from device.h to static.h ......................................................................
sconfig: Move config_of_soc from device.h to static.h
Many sources include device.h and thus static.h, but many only need the function declarations and type definitions, not the compiled devicetree from sconfig. This causes many unnecessary recompiles whenever the devicetree is updated due to the dependency. Address this by moving the config_of_soc macro directly into the generated static.h header, as it seems to be the only line in device.h that actually requires static.h. For now, static.h remains included in device.h so that the build is not affected. Subsequent commits will include static.h directly into sources that actually need it, after which it can be dropped from device.h.
Some statistics for C objects:
Dell Latitude E6400 (GM45/ICH9): 669 total objects 181 depend on static.h 2 require static.h
Dell Latitude E6430 (Ivy Bridge/Panther Point): 693 total objects 199 depend on static.h 3 require static.h
Lenovo ThinkCentre M700 / M900 Tiny (Kaby Lake): 794 total objects 298 depend on static.h 23 objects require static.h
MSI PRO Z690-A (WIFI) DDR4 (Alder Lake): 959 total objects 319 depend on static.h 25 require static.h
The number of objects was determined by grepping the build log for calls to CC, the number of objects that depend on static.h was determined by grepping for calls to CC after touching static.h, and the number of objects that actually require the static.h related lines from device.h was determined by grepping for objects that failed to build after removing the static.h lines from device.h and running make with the --keep-going flag.
Change-Id: I7c40135bf2815093b81e47201c38b7d0a6ac8fa8 Signed-off-by: Nicholas Chin nic.c3.14@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/84431 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Nico Huber nico.h@gmx.de --- M src/include/device/device.h M util/sconfig/main.c 2 files changed, 3 insertions(+), 6 deletions(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved
diff --git a/src/include/device/device.h b/src/include/device/device.h index a1a64e2..b52be54 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -487,12 +487,6 @@ devtree_die(); }
-/* - * Returns pointer to config structure of root device (B:D:F = 0:00:0) defined by - * sconfig in static.{h/c}. - */ -#define config_of_soc() __pci_0_00_0_config - static inline bool is_root_device(const struct device *dev) { if (!dev || !dev->upstream) diff --git a/util/sconfig/main.c b/util/sconfig/main.c index c06e67e..677b9d2 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -1905,6 +1905,9 @@ fprintf(f, "#include <%s>\n", fw_conf_header); fprintf(f, "#include <%s>\n\n", device_header);
+ fprintf(f, "/* Returns pointer to config structure of root device (B:D:F = 0:00:0) */\n"); + fprintf(f, "#define config_of_soc() __pci_0_00_0_config\n"); + fprintf(f, "\n#endif /* __STATIC_DEVICE_TREE_H */\n"); }