/*
* The PCI Utilities -- List All PCI Devices
*
- * Copyright (c) 1997--2010 Martin Mares <mj@ucw.cz>
+ * Copyright (c) 1997--2018 Martin Mares <mj@ucw.cz>
*
- * Can be freely distributed and used under the terms of the GNU GPL.
+ * Can be freely distributed and used under the terms of the GNU GPL v2+
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
*/
#define PCIUTILS_LSPCI
struct device {
struct device *next;
struct pci_dev *dev;
+ /* Bus topology calculated by grow_tree() */
+ struct device *bus_next;
+ struct bus *parent_bus;
+ struct bridge *bridge;
+ /* Cache */
+ int no_config_access;
unsigned int config_cached, config_bufsize;
byte *config; /* Cached configuration space data */
byte *present; /* Maps which configuration bytes are present */
word get_conf_word(struct device *d, unsigned int pos);
byte get_conf_byte(struct device *d, unsigned int pos);
-void get_subid(struct device *d, word *subvp, word *subdp);
-
-/* Useful macros for decoding of bits and bit fields */
-
-#define FLAG(x,y) ((x & y) ? '+' : '-')
-#define BITS(x,at,width) (((x) >> (at)) & ((1 << (width)) - 1))
-#define TABLE(tab,x,buf) ((x) < sizeof(tab)/sizeof((tab)[0]) ? (tab)[x] : (sprintf((buf), "??%d", (x)), (buf)))
-
/* ls-vpd.c */
void cap_vpd(struct device *d);
/* ls-tree.c */
-void show_forest(void);
+struct bridge {
+ struct bridge *chain; /* Single-linked list of bridges */
+ struct bridge *next, *prev, *child; /* Tree of bridges */
+ struct bus *first_bus, *last_bus; /* List of buses connected to this bridge */
+ unsigned int domain;
+ unsigned int primary, secondary, subordinate; /* Bus numbers */
+ struct device *br_dev;
+};
+
+struct bus {
+ unsigned int domain;
+ unsigned int number;
+ struct bus *sibling;
+ struct bridge *parent_bridge;
+ struct device *first_dev, **last_dev;
+};
+
+extern struct bridge host_bridge;
+
+void grow_tree(void);
+void show_forest(struct pci_filter *filter);
/* ls-map.c */