diff options
author | Furquan Shaikh <furquan@google.com> | 2018-06-03 04:22:17 -0700 |
---|---|---|
committer | Furquan Shaikh <furquan@google.com> | 2018-06-08 23:36:02 +0000 |
commit | 931982600d3ac3dfb9d66e013604ecc0573a1744 (patch) | |
tree | f4ceeaa3bf1e4a0c24e89587ce86d54ff8ea808a /util/sconfig/sconfig.h | |
parent | 7398deda2b12f2ba3ab6c14009ff8da003ef2b0c (diff) | |
download | coreboot-931982600d3ac3dfb9d66e013604ecc0573a1744.tar.xz |
util/sconfig: Re-factor device structure in parse tree
This change re-factors the device structure in parse tree to be able
to support multidev devices just like non-multidev devices.
With this change, every device has a bus under it which is the parent
of all devices that fall on the bus. If there are duplicate entries in
the devicetree, then there will be multiple buses under the device and
each bus will have its own set of children.
The tree starts out with a root device which has a root bus under
it. This is a special device which is created statically and its
parent is its own root bus. When parsing the device tree file, devices
get added under the root bus as children.
Since this change re-organizes the way devicetree is represented, it
gets rid of latestchild and next_sibling pointers from struct
device. Also, the tree traversal to generate static.c is changed to
breadth-first walk instead of using the next_sibling.
BUG=b:80081934
TEST=Verified using abuild that all boards compile successfully.
Change-Id: Ic8c8a73a247e8e992ab6b1b2cc3131e06fa2e5a1
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/26800
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'util/sconfig/sconfig.h')
-rw-r--r-- | util/sconfig/sconfig.h | 69 |
1 files changed, 51 insertions, 18 deletions
diff --git a/util/sconfig/sconfig.h b/util/sconfig/sconfig.h index 2bb816d5ef..f9137fa7ac 100644 --- a/util/sconfig/sconfig.h +++ b/util/sconfig/sconfig.h @@ -78,50 +78,83 @@ struct chip { }; struct device; +struct bus { + /* Instance/ID of the bus under the device. */ + int id; + + /* Pointer to device to which this bus belongs. */ + struct device *dev; + + /* Pointer to list of children. */ + struct device *children; + + /* Pointer to next bus for the device. */ + struct bus *next_bus; +}; + struct device { + /* Monotonically increasing ID for the device. */ int id; + + /* Indicates whether this device is enabled. */ int enabled; - int used; - int multidev; - int link; + + /* Indicates number of resources for the device. */ int rescnt; + + /* Subsystem IDs for the device. */ int subsystem_vendor; int subsystem_device; int inherit_subsystem; + + /* Name of ops structure for the device. */ char *ops; + + /* Name of this device. */ char *name; + + /* Path of this device. */ char *path; int path_a; int path_b; + + /* Type of bus that exists under this device. */ int bustype; + + /* PCI IRQ info. */ struct pci_irq_info pci_irq_info[4]; - struct device *parent; - struct device *next; - struct device *children; - struct device *latestchild; - struct device *next_sibling; + /* Pointer to bus of parent on which this device resides. */ + struct bus *parent; + + /* Pointer to next child under the same parent. */ struct device *sibling; + + /* Pointer to resources for this device. */ struct resource *res; + /* Pointer to chip instance for this device. */ struct chip_instance *chip_instance; -}; - -extern struct device *head; -void fold_in(struct device *parent); + /* Pointer to list of buses under this device. */ + struct bus *bus; + /* Pointer to last bus under this device. */ + struct bus *last_bus; +}; -void postprocess_devtree(void); +extern struct bus *root_parent; -struct device *new_device(struct device *parent, +struct device *new_device(struct bus *parent, struct chip_instance *chip_instance, const int bustype, const char *devnum, int enabled); -void alias_siblings(struct device *d); -void add_resource(struct device *dev, int type, int index, int base); -void add_pci_subsystem_ids(struct device *dev, int vendor, int device, + +void add_resource(struct bus *bus, int type, int index, int base); + +void add_pci_subsystem_ids(struct bus *bus, int vendor, int device, int inherit); -void add_ioapic_info(struct device *dev, int apicid, const char *_srcpin, + +void add_ioapic_info(struct bus *bus, int apicid, const char *_srcpin, int irqpin); void yyrestart(FILE *input_file); |