device: Use __pci_0_00_0_config in config_of_soc()

This change updates the definition of config_of_soc() to a macro that
expands to __pci_0_00_0_config instead of accessing the config
structure by referencing the struct device. This allows linker to
optimize out unused portions of the device tree from early stages.

With this change, bootblock .text section size drops as follows:

Platform       | Size without change | Size with change | Reduction   |
---------------|---------------------|------------------|-------------|
GLK (ampton)   |  27112 bytes        |  9832 bytes      | 17280 bytes |
APL (reef)     |  26488 bytes        | 17528 bytes      |  8960 bytes |
TGL (volteer2) |  47760 bytes        | 21648 bytes      | 26112 bytes |
CML (hatch)    |  40616 bytes        | 22792 bytes      | 17824 bytes |
JSL (waddledee)|  37872 bytes        | 19408 bytes      | 18464 bytes |
KBL (soraka)   |  31840 bytes        | 21568 bytes      | 10272 bytes |

As static.h is now included in device.h which gets pulled in during
the unit tests, a dummy static.h is added under tests/include.

Change-Id: I1fbf5b9817065e967e46188739978a1cc96c2c7e
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49215
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Furquan Shaikh 2021-01-06 22:40:40 -08:00
parent a19001bff7
commit 28e61f1634
2 changed files with 13 additions and 5 deletions

View File

@ -6,6 +6,7 @@
#include <device/path.h> #include <device/path.h>
#include <device/pci_type.h> #include <device/pci_type.h>
#include <smbios.h> #include <smbios.h>
#include <static.h>
#include <types.h> #include <types.h>
struct fw_config; struct fw_config;
@ -387,11 +388,11 @@ static inline DEVTREE_CONST void *config_of(const struct device *dev)
devtree_die(); devtree_die();
} }
/* config_of_soc() either returns a non-NULL pointer or dies in the config_of() call. */ /*
static inline DEVTREE_CONST void *config_of_soc(void) * Returns pointer to config structure of root device (B:D:F = 0:00:0) defined by
{ * sconfig in static.{h/c}.
return config_of(pcidev_on_root(0, 0)); */
} #define config_of_soc() __pci_0_00_0_config
void enable_static_device(struct device *dev); void enable_static_device(struct device *dev);
void enable_static_devices(struct device *bus); void enable_static_devices(struct device *bus);

7
tests/include/static.h Normal file
View File

@ -0,0 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* static.h is generated by util/sconfig during a coreboot build. Since this file might be
* included by other header files that are part of the unit tests, this dummy file is added to
* make the test infrastructure happy.
*/