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>
This commit is contained in:
@@ -21,12 +21,12 @@ int yylex();
|
||||
void yyerror(const char *s);
|
||||
|
||||
static struct device *cur_parent;
|
||||
static struct chip *cur_chip;
|
||||
static struct chip_instance *cur_chip_instance;
|
||||
|
||||
%}
|
||||
%union {
|
||||
struct device *device;
|
||||
struct chip *chip;
|
||||
struct chip_instance *chip_instance;
|
||||
char *string;
|
||||
int number;
|
||||
}
|
||||
@@ -40,16 +40,16 @@ chipchildren: chipchildren device | chipchildren chip | chipchildren registers |
|
||||
devicechildren: devicechildren device | devicechildren chip | devicechildren resource | devicechildren subsystemid | devicechildren ioapic_irq | /* empty */ ;
|
||||
|
||||
chip: CHIP STRING /* == path */ {
|
||||
$<chip>$ = new_chip($<string>2);
|
||||
chip_enqueue_tail(cur_chip);
|
||||
cur_chip = $<chip>$;
|
||||
$<chip_instance>$ = new_chip_instance($<string>2);
|
||||
chip_enqueue_tail(cur_chip_instance);
|
||||
cur_chip_instance = $<chip_instance>$;
|
||||
}
|
||||
chipchildren END {
|
||||
cur_chip = chip_dequeue_tail();
|
||||
cur_chip_instance = chip_dequeue_tail();
|
||||
};
|
||||
|
||||
device: DEVICE BUS NUMBER /* == devnum */ BOOL {
|
||||
$<device>$ = new_device(cur_parent, cur_chip, $<number>2, $<string>3, $<number>4);
|
||||
$<device>$ = new_device(cur_parent, cur_chip_instance, $<number>2, $<string>3, $<number>4);
|
||||
cur_parent = $<device>$;
|
||||
}
|
||||
devicechildren END {
|
||||
@@ -62,7 +62,7 @@ resource: RESOURCE NUMBER /* == resnum */ EQUALS NUMBER /* == resval */
|
||||
{ add_resource(cur_parent, $<number>1, strtol($<string>2, NULL, 0), strtol($<string>4, NULL, 0)); } ;
|
||||
|
||||
registers: REGISTER STRING /* == regname */ EQUALS STRING /* == regval */
|
||||
{ add_register(cur_chip, $<string>2, $<string>4); } ;
|
||||
{ add_register(cur_chip_instance, $<string>2, $<string>4); } ;
|
||||
|
||||
subsystemid: SUBSYSTEMID NUMBER NUMBER
|
||||
{ add_pci_subsystem_ids(cur_parent, strtol($<string>2, NULL, 16), strtol($<string>3, NULL, 16), 0); };
|
||||
|
Reference in New Issue
Block a user