util/sconfig: Expose usable PCI and PNP device names
These devices can be accessed directly by symbolname, without a search and walk through the tree, as they have static paths. Change-Id: I711058f5c809fa9bc7ea4333aaebad6847ebdfd4 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/31933 Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
8bb2bace86
commit
5e2a2cd5e7
|
@ -883,6 +883,18 @@ static void pass1(FILE *fil, struct device *ptr, struct device *next)
|
||||||
emit_dev_links(fil, ptr);
|
emit_dev_links(fil, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void expose_device_names(FILE *fil, struct device *ptr, struct device *next)
|
||||||
|
{
|
||||||
|
/* Only devices on root bus here. */
|
||||||
|
if (ptr->bustype == PCI && ptr->parent->dev->bustype == DOMAIN)
|
||||||
|
fprintf(fil, "DEVTREE_CONST struct device *DEVTREE_CONST __pci_0_%02x_%d = &%s;\n",
|
||||||
|
ptr->path_a, ptr->path_b, ptr->name);
|
||||||
|
|
||||||
|
if (ptr->bustype == PNP)
|
||||||
|
fprintf(fil, "DEVTREE_CONST struct device *DEVTREE_CONST __pnp_%04x_%02x = &%s;\n",
|
||||||
|
ptr->path_a, ptr->path_b, ptr->name);
|
||||||
|
}
|
||||||
|
|
||||||
static void add_siblings_to_queue(struct queue_entry **bfs_q_head,
|
static void add_siblings_to_queue(struct queue_entry **bfs_q_head,
|
||||||
struct device *d)
|
struct device *d)
|
||||||
{
|
{
|
||||||
|
@ -1385,6 +1397,10 @@ int main(int argc, char **argv)
|
||||||
fprintf(autogen, "\n/* pass 1 */\n");
|
fprintf(autogen, "\n/* pass 1 */\n");
|
||||||
walk_device_tree(autogen, &base_root_dev, pass1);
|
walk_device_tree(autogen, &base_root_dev, pass1);
|
||||||
|
|
||||||
|
/* Expose static devicenames to global namespace. */
|
||||||
|
fprintf(autogen, "\n/* expose_device_names */\n");
|
||||||
|
walk_device_tree(autogen, &base_root_dev, expose_device_names);
|
||||||
|
|
||||||
fclose(autogen);
|
fclose(autogen);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue