summaryrefslogtreecommitdiff
path: root/util/sconfig/sconfig.h
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2018-05-31 10:33:16 -0700
committerFurquan Shaikh <furquan@google.com>2018-06-05 20:58:03 +0000
commitc56ae2ffa16fe0590af015add99354cf34f68a9b (patch)
tree5e0e582bee1cb92dbbb95cd439d549ccc21a8389 /util/sconfig/sconfig.h
parent369e1f074f7b376e815927ddfc7d8a529ba57500 (diff)
downloadcoreboot-c56ae2ffa16fe0590af015add99354cf34f68a9b.tar.xz
util/sconfig: Get rid of struct header
Now that chips and devices are treated differently in sconfig, this change gets rid of struct header and add_header function which were responsible for maintaining list of headers that need to be added to static.c. Instead, struct chip is re-factored into struct chip and struct chip_instance, where chip is a list of unique chips required by the mainboard whereas chip_instance is an instance of the chip. One chip can have multiple instances dependending upon the devices in the system. Also, struct device is updated to hold a pointer to chip instance instead of the chip structure. This unique list of chips is then used to add appropriate headers to static.c BUG=b:80081934 TEST=Verified using abuild that all boards compile successfully. Change-Id: I6fccdf7c361b4f55a831195adcda9b21932755aa Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/26739 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/sconfig/sconfig.h')
-rw-r--r--util/sconfig/sconfig.h36
1 files changed, 22 insertions, 14 deletions
diff --git a/util/sconfig/sconfig.h b/util/sconfig/sconfig.h
index 1f18907331..960facd7b1 100644
--- a/util/sconfig/sconfig.h
+++ b/util/sconfig/sconfig.h
@@ -42,13 +42,25 @@ struct pci_irq_info {
int ioapic_dst_id;
};
-struct chip {
+struct chip;
+struct chip_instance {
/*
* Monotonically increasing ID for each newly allocated
* node(chip/device).
*/
int id;
+ /* Pointer to registers for this chip. */
+ struct reg *reg;
+
+ /* Pointer to chip of which this is instance. */
+ struct chip *chip;
+
+ /* Pointer to next instance of the same chip. */
+ struct chip_instance *next;
+};
+
+struct chip {
/* Indicates if chip header exists for this chip. */
int chiph_exists;
@@ -58,8 +70,8 @@ struct chip {
/* Name of current chip normalized to _. */
char *name_underscore;
- /* Pointer to registers for this chip. */
- struct reg *reg;
+ /* Pointer to first instance of this chip. */
+ struct chip_instance *instance;
/* Pointer to next chip. */
struct chip *next;
@@ -93,28 +105,21 @@ struct device {
struct device *sibling;
struct resource *res;
- struct chip *chip;
+ struct chip_instance *chip_instance;
};
extern struct device *head;
-struct header;
-struct header {
- char *name;
- int chiph_exists;
- struct header *next;
-};
-
void fold_in(struct device *parent);
void postprocess_devtree(void);
-struct chip *new_chip(char *path);
-struct device *new_device(struct device *parent, struct chip *chip,
+
+struct device *new_device(struct device *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_register(struct chip *chip, char *name, char *val);
void add_pci_subsystem_ids(struct device *dev, int vendor, int device,
int inherit);
void add_ioapic_info(struct device *dev, int apicid, const char *_srcpin,
@@ -127,3 +132,6 @@ void chip_enqueue_tail(void *data);
/* Retrieve chip data from tail of queue. */
void *chip_dequeue_tail(void);
+
+struct chip_instance *new_chip_instance(char *path);
+void add_register(struct chip_instance *chip, char *name, char *val);