diff options
author | Nico Huber <nico.h@gmx.de> | 2024-06-02 17:09:27 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-07-11 00:19:15 +0000 |
commit | 7ac0f5b9693929ce8cc1486a67c9a46e3a0af2d2 (patch) | |
tree | a84522fba2b7e503ec21134aef4ccc41e7b4472d /util/sconfig | |
parent | 22a25d53e46fd04b87b520d0ccfd35ff33601414 (diff) |
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>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/82764
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'util/sconfig')
-rw-r--r-- | util/sconfig/main.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/util/sconfig/main.c b/util/sconfig/main.c index 3f12946edf..9acd5921a1 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -1288,6 +1288,10 @@ static void expose_device_names(FILE *fil, FILE *head, struct device *ptr, struc /* 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 @@ static void expose_device_names(FILE *fil, FILE *head, struct device *ptr, struc } 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 @@ static void generate_outputd(FILE *gen, FILE *dev) { 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); |