Attention is currently required from: Martin L Roth.
Nico Huber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/82764?usp=email )
Change subject: sconfig: Provide simple constants for aliased devices ......................................................................
sconfig: Provide simple constants for aliased devices
Expose aliased PCI and PNP devices as `pci_/pnp_devfn_t` constants in <static_devices.h>. They will be named `_sdev_<alias>` to have a underscore prefix for consistency and to not collide with the `struct device` objects (with `_dev_` prefix).
Change-Id: I2d1cfe12b1e7309f8235c84dd220bd090ebfe1b5 Signed-off-by: Nico Huber nico.h@gmx.de --- M util/sconfig/main.c 1 file changed, 10 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/82764/1
diff --git a/util/sconfig/main.c b/util/sconfig/main.c index 04f78a4..741859f 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -1288,6 +1288,10 @@
/* Only devices on root bus here. */ if (ptr->bustype == PCI && ptr->parent->dev->bustype == DOMAIN) { + if (ptr->alias) { + fprintf(head, "static const pci_devfn_t _sdev_%s = PCI_DEV(%d, %d, %d);\n", + ptr->alias, ptr->parent->dev->path_a, ptr->path_a, ptr->path_b); + } fprintf(head, "extern DEVTREE_CONST struct device *const __pci_%d_%02x_%d;\n", ptr->parent->dev->path_a, ptr->path_a, ptr->path_b); fprintf(fil, "DEVTREE_CONST struct device *const __pci_%d_%02x_%d = &%s;\n", @@ -1303,6 +1307,10 @@ }
if (ptr->bustype == PNP) { + if (ptr->alias) { + fprintf(head, "static const pnp_devfn_t _sdev_%s = PNP_DEV(0x%02x, 0x%04x);\n", + ptr->alias, ptr->path_a, ptr->path_b); + } fprintf(head, "extern DEVTREE_CONST struct device *const __pnp_%04x_%02x;\n", ptr->path_a, ptr->path_b); fprintf(fil, "DEVTREE_CONST struct device *const __pnp_%04x_%02x = &%s;\n", @@ -1917,6 +1925,8 @@ { fprintf(dev, "#ifndef __STATIC_DEVICES_H\n"); fprintf(dev, "#define __STATIC_DEVICES_H\n\n"); + fprintf(dev, "#include <device/pci_type.h>\n"); + fprintf(dev, "#include <device/pnp_type.h>\n"); fprintf(dev, "#include <device/device.h>\n\n"); fprintf(dev, "/* expose_device_names */\n"); walk_device_tree(gen, dev, &base_root_dev, expose_device_names);