2010-04-08 13:37:43 +02:00
|
|
|
%{
|
2020-05-08 19:28:13 +02:00
|
|
|
/* sconfig, coreboot device tree compiler */
|
util/: Replace GPLv2 boiler plate with SPDX header
Used commands:
perl -i -p0e 's|\/\*[\s*]*.*is free software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and\/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-2.0-only */|' $(cat filelist)
perl -i -p0e 's|This[\s*]*program[\s*]*is[\s*]*free[\s*]*software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*either[\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License,[\s*]*or[\s*]*.at[\s*]*your[\s*]*option.*[\s*]*any[\s*]*later[\s*]*version.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-2.0-or-later */|' $(cat filelist)
perl -i -p0e 's|\/\*[\s*]*.*This[\s*#]*program[\s*#]*is[\s*#]*free[\s*#]*software[;:,][\s*#]*you[\s*#]*can[\s*#]*redistribute[\s*#]*it[\s*#]*and/or[\s*#]*modify[\s*#]*it[\s*#]*under[\s*#]*the[\s*#]*terms[\s*#]*of[\s*#]*the[\s*#]*GNU[\s*#]*General[\s*#]*Public[\s*#]*License[\s*#]*as[\s*#]*published[\s*#]*by[\s*#]*the[\s*#]*Free[\s*#]*Software[\s*#]*Foundation[;:,][\s*#]*either[\s*#]*version[\s*#]*3[\s*#]*of[\s*#]*the[\s*#]*License[;:,][\s*#]*or[\s*#]*.at[\s*#]*your[\s*#]*option.*[\s*#]*any[\s*#]*later[\s*#]*version.[\s*#]*This[\s*#]*program[\s*#]*is[\s*#]*distributed[\s*#]*in[\s*#]*the[\s*#]*hope[\s*#]*that[\s*#]*it[\s*#]*will[\s*#]*be[\s*#]*useful[;:,][\s*#]*but[\s*#]*WITHOUT[\s*#]*ANY[\s*#]*WARRANTY[;:,][\s*#]*without[\s*#]*even[\s*#]*the[\s*#]*implied[\s*#]*warranty[\s*#]*of[\s*#]*MERCHANTABILITY[\s*#]*or[\s*#]*FITNESS[\s*#]*FOR[\s*#]*A[\s*#]*PARTICULAR[\s*#]*PURPOSE.[\s*#]*See[\s*#]*the[\s*#]*GNU[\s*#]*General[\s*#]*Public[\s*#]*License[\s*#]*for[\s*#]*more[\s*#]*details.[\s*]*\*\/|/* SPDX-License-Identifier: GPL-3.0-or-later */|' $(cat filelist)
perl -i -p0e 's|(\#\#*)[\w]*.*is free software[:;][\#\s]*you[\#\s]*can[\#\s]*redistribute[\#\s]*it[\#\s]*and\/or[\#\s]*modify[\#\s]*it[\s\#]*under[\s \#]*the[\s\#]*terms[\s\#]*of[\s\#]*the[\s\#]*GNU[\s\#]*General[\s\#]*Public[\s\#]*License[\s\#]*as[\s\#]*published[\s\#]*by[\s\#]*the[\s\#]*Free[\s\#]*Software[\s\#]*Foundation[;,][\s\#]*version[\s\#]*2[\s\#]*of[\s\#]*the[\s\#]*License.*[\s\#]*This[\s\#]*program[\s\#]*is[\s\#]*distributed[\s\#]*in[\s\#]*the[\s\#]*hope[\s\#]*that[\s\#]*it[\s\#]*will[\#\s]*be[\#\s]*useful,[\#\s]*but[\#\s]*WITHOUT[\#\s]*ANY[\#\s]*WARRANTY;[\#\s]*without[\#\s]*even[\#\s]*the[\#\s]*implied[\#\s]*warranty[\#\s]*of[\#\s]*MERCHANTABILITY[\#\s]*or[\#\s]*FITNESS[\#\s]*FOR[\#\s]*A[\#\s]*PARTICULAR[\#\s]*PURPOSE.[\#\s]*See[\#\s]*the[\#\s]*GNU[\#\s]*General[\#\s]*Public[\#\s]*License[\#\s]*for[\#\s]*more[\#\s]*details.\s(#* *\n)*|\1 SPDX-License-Identifier: GPL-2.0-only\n\n|' $(cat filelist)
perl -i -p0e 's|(\#\#*)[\w*]*.*is free software[:;][\s*]*you[\s*]*can[\s*]*redistribute[\s*]*it[\s*]*and\/or[\s*]*modify[\s*]*it[\s*]*under[\s*]*the[\s*]*terms[\s*]*of[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*as[\s*]*published[\s*]*by[\s*]*the[\s*]*Free[\s*]*Software[\s*]*Foundation[;,][\s*]*version[\s*]*2[\s*]*of[\s*]*the[\s*]*License.[\s*]*This[\s*]*program[\s*]*is[\s*]*distributed[\s*]*in[\s*]*the[\s*]*hope[\s*]*that[\s*]*it[\s*]*will[\s*]*be[\s*]*useful,[\s*]*but[\s*]*WITHOUT[\s*]*ANY[\s*]*WARRANTY;[\s*]*without[\s*]*even[\s*]*the[\s*]*implied[\s*]*warranty[\s*]*of[\s*]*MERCHANTABILITY[\s*]*or[\s*]*FITNESS[\s*]*FOR[\s*]*A[\s*]*PARTICULAR[\s*]*PURPOSE.[\s*]*See[\s*]*the[\s*]*GNU[\s*]*General[\s*]*Public[\s*]*License[\s*]*for[\s*]*more[\s*]*details.\s(#* *\n)*|\1 SPDX-License-Identifier: GPL-2.0-only\n\n|' $(cat filelist)
Change-Id: I1008a63b804f355a916221ac994701d7584f60ff
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41177
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-05-08 20:48:04 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2010-04-08 13:37:43 +02:00
|
|
|
|
2020-10-01 23:41:31 +02:00
|
|
|
#include <stdint.h>
|
2010-05-05 13:19:50 +02:00
|
|
|
#include "sconfig.h"
|
2010-04-08 13:37:43 +02:00
|
|
|
|
2016-05-07 10:11:14 +02:00
|
|
|
int yylex();
|
|
|
|
void yyerror(const char *s);
|
|
|
|
|
2018-06-03 13:22:17 +02:00
|
|
|
static struct bus *cur_parent;
|
2018-05-31 19:33:16 +02:00
|
|
|
static struct chip_instance *cur_chip_instance;
|
2020-05-16 00:39:08 +02:00
|
|
|
static struct fw_config_field *cur_field;
|
2021-04-28 22:03:07 +02:00
|
|
|
static struct fw_config_field_bits *cur_bits;
|
2010-04-08 13:37:43 +02:00
|
|
|
|
|
|
|
%}
|
|
|
|
%union {
|
2018-06-03 13:22:17 +02:00
|
|
|
struct device *dev;
|
2018-05-31 19:33:16 +02:00
|
|
|
struct chip_instance *chip_instance;
|
2010-04-08 13:37:43 +02:00
|
|
|
char *string;
|
2020-10-01 23:41:31 +02:00
|
|
|
uint64_t number;
|
2010-04-08 13:37:43 +02:00
|
|
|
}
|
2011-03-01 20:58:15 +01:00
|
|
|
|
2021-07-11 00:37:39 +02:00
|
|
|
%token CHIP DEVICE REGISTER ALIAS REFERENCE ASSOCIATION BOOL STATUS MANDATORY BUS RESOURCE END EQUALS HEX STRING PCI PNP I2C APIC CPU_CLUSTER CPU DOMAIN IRQ DRQ SLOT_DESC IO NUMBER SUBSYSTEMID INHERIT IOAPIC_IRQ IOAPIC PCIINT GENERIC SPI USB MMIO GPIO FW_CONFIG_TABLE FW_CONFIG_FIELD FW_CONFIG_OPTION FW_CONFIG_PROBE PIPE
|
2010-04-08 13:37:43 +02:00
|
|
|
%%
|
2020-05-16 00:39:08 +02:00
|
|
|
devtree: { cur_parent = root_parent; } | devtree chip | devtree fw_config_table;
|
2010-04-08 13:37:43 +02:00
|
|
|
|
2020-06-03 19:20:07 +02:00
|
|
|
chipchildren: chipchildren device | chipchildren chip | chipchildren registers | chipchildren reference | /* empty */ ;
|
2010-04-08 13:37:43 +02:00
|
|
|
|
2020-05-16 00:39:08 +02:00
|
|
|
devicechildren: devicechildren device | devicechildren chip | devicechildren resource | devicechildren subsystemid | devicechildren ioapic_irq | devicechildren smbios_slot_desc | devicechildren registers | devicechildren fw_config_probe | /* empty */ ;
|
2010-04-08 13:37:43 +02:00
|
|
|
|
|
|
|
chip: CHIP STRING /* == path */ {
|
2018-05-31 19:33:16 +02:00
|
|
|
$<chip_instance>$ = new_chip_instance($<string>2);
|
|
|
|
chip_enqueue_tail(cur_chip_instance);
|
|
|
|
cur_chip_instance = $<chip_instance>$;
|
2010-04-08 13:37:43 +02:00
|
|
|
}
|
2010-05-05 15:13:47 +02:00
|
|
|
chipchildren END {
|
2018-05-31 19:33:16 +02:00
|
|
|
cur_chip_instance = chip_dequeue_tail();
|
2010-04-08 13:37:43 +02:00
|
|
|
};
|
|
|
|
|
2020-06-03 19:20:07 +02:00
|
|
|
device: DEVICE BUS NUMBER /* == devnum */ alias status {
|
2020-07-30 01:28:43 +02:00
|
|
|
$<dev>$ = new_device_raw(cur_parent, cur_chip_instance, $<number>2, $<string>3, $<string>4, $<number>5);
|
2018-06-03 13:22:17 +02:00
|
|
|
cur_parent = $<dev>$->last_bus;
|
2010-04-08 13:37:43 +02:00
|
|
|
}
|
2010-05-05 15:13:47 +02:00
|
|
|
devicechildren END {
|
2020-06-03 19:20:07 +02:00
|
|
|
cur_parent = $<dev>6->parent;
|
|
|
|
};
|
|
|
|
|
2020-07-30 01:28:43 +02:00
|
|
|
device: DEVICE REFERENCE STRING status {
|
|
|
|
$<dev>$ = new_device_reference(cur_parent, cur_chip_instance, $<string>3, $<number>4);
|
|
|
|
cur_parent = $<dev>$->last_bus;
|
|
|
|
}
|
|
|
|
devicechildren END {
|
|
|
|
cur_parent = $<dev>5->parent;
|
|
|
|
};
|
|
|
|
|
2020-06-03 19:20:07 +02:00
|
|
|
alias: /* empty */ {
|
|
|
|
$<string>$ = NULL;
|
|
|
|
} | ALIAS STRING {
|
|
|
|
$<string>$ = $<string>2;
|
2010-04-08 13:37:43 +02:00
|
|
|
};
|
|
|
|
|
Add configurable ramstage support for minimal PCI scanning
This CL has changes that allow us to enable a configurable
ramstage, and one change that allows us to minimize PCI
scanning. Minimal scanning is a frequently requested feature.
To enable it, we add two new variables to src/Kconfig
CONFIGURABLE_RAMSTAGE
is the overall variable controlling other options for minimizing the
ramstage.
MINIMAL_PCI_SCANNING is how we indicate we wish to enable minimal
PCI scanning.
Some devices must be scanned in all cases, such as 0:0.0.
To indicate which devices we must scan, we add a new mandatory
keyword to sconfig
It is used in place of on, off, or hidden, and indicates
a device is enabled and mandatory. Mandatory
devices are always scanned. When MINIMAL_PCI_SCANNING is enabled,
ONLY mandatory devices are scanned.
We further add support in src/device/pci_device.c to manage
both MINIMAL_PCI_SCANNING and mandatory devices.
Finally, to show how this works in practice, we add mandatory
keywords to 3 devices on the qemu-q35.
TEST=
1. This is tested and working on the qemu-q35 target.
2. On CML-Hatch
Before CL:
Total Boot time: ~685ms
After CL:
Total Boot time: ~615ms
Change-Id: I2073d9f8e9297c2b02530821ebb634ea2a5c758e
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/36221
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jeremy Soller <jeremy@system76.com>
2019-10-22 04:02:24 +02:00
|
|
|
status: BOOL | STATUS ;
|
2018-09-10 04:51:26 +02:00
|
|
|
|
2010-04-08 13:37:43 +02:00
|
|
|
resource: RESOURCE NUMBER /* == resnum */ EQUALS NUMBER /* == resval */
|
2010-05-05 14:05:25 +02:00
|
|
|
{ add_resource(cur_parent, $<number>1, strtol($<string>2, NULL, 0), strtol($<string>4, NULL, 0)); } ;
|
2010-04-08 13:37:43 +02:00
|
|
|
|
2020-06-03 19:20:07 +02:00
|
|
|
reference: REFERENCE STRING /* == alias */ ASSOCIATION STRING /* == field in chip config */
|
|
|
|
{ add_reference(cur_chip_instance, $<string>4, $<string>2); } ;
|
|
|
|
|
2010-04-08 13:37:43 +02:00
|
|
|
registers: REGISTER STRING /* == regname */ EQUALS STRING /* == regval */
|
2018-05-31 19:33:16 +02:00
|
|
|
{ add_register(cur_chip_instance, $<string>2, $<string>4); } ;
|
2010-04-08 13:37:43 +02:00
|
|
|
|
2011-03-01 20:58:15 +01:00
|
|
|
subsystemid: SUBSYSTEMID NUMBER NUMBER
|
|
|
|
{ add_pci_subsystem_ids(cur_parent, strtol($<string>2, NULL, 16), strtol($<string>3, NULL, 16), 0); };
|
|
|
|
|
|
|
|
subsystemid: SUBSYSTEMID NUMBER NUMBER INHERIT
|
|
|
|
{ add_pci_subsystem_ids(cur_parent, strtol($<string>2, NULL, 16), strtol($<string>3, NULL, 16), 1); };
|
|
|
|
|
2012-06-21 22:19:48 +02:00
|
|
|
ioapic_irq: IOAPIC_IRQ NUMBER PCIINT NUMBER
|
|
|
|
{ add_ioapic_info(cur_parent, strtol($<string>2, NULL, 16), $<string>3, strtol($<string>4, NULL, 16)); };
|
2019-04-12 14:42:17 +02:00
|
|
|
|
|
|
|
smbios_slot_desc: SLOT_DESC STRING STRING STRING STRING
|
|
|
|
{ add_slot_desc(cur_parent, $<string>2, $<string>3, $<string>4, $<string>5); };
|
|
|
|
|
|
|
|
smbios_slot_desc: SLOT_DESC STRING STRING STRING
|
|
|
|
{ add_slot_desc(cur_parent, $<string>2, $<string>3, $<string>4, NULL); };
|
|
|
|
|
|
|
|
smbios_slot_desc: SLOT_DESC STRING STRING
|
|
|
|
{ add_slot_desc(cur_parent, $<string>2, $<string>3, NULL, NULL); };
|
|
|
|
|
2020-05-16 00:39:08 +02:00
|
|
|
/* fw_config: firmware configuration table */
|
|
|
|
fw_config_table: FW_CONFIG_TABLE fw_config_table_children END { };
|
|
|
|
|
|
|
|
/* fw_config -> field */
|
|
|
|
fw_config_table_children: fw_config_table_children fw_config_field | /* empty */ ;
|
|
|
|
|
|
|
|
/* field -> option */
|
|
|
|
fw_config_field_children: fw_config_field_children fw_config_option | /* empty */ ;
|
|
|
|
|
2021-04-28 22:03:07 +02:00
|
|
|
/* <start-bit> <end-bit> */
|
|
|
|
fw_config_field_bits: NUMBER /* == start bit */ NUMBER /* == end bit */
|
|
|
|
{
|
|
|
|
append_fw_config_bits(&cur_bits, strtoul($<string>1, NULL, 0), strtoul($<string>2, NULL, 0));
|
|
|
|
};
|
|
|
|
|
|
|
|
/* field <start-bit> <end-bit>(| <start-bit> <end-bit>)* */
|
|
|
|
fw_config_field_bits_repeating: PIPE fw_config_field_bits fw_config_field_bits_repeating | /* empty */ ;
|
|
|
|
|
|
|
|
fw_config_field: FW_CONFIG_FIELD STRING fw_config_field_bits fw_config_field_bits_repeating
|
|
|
|
{ cur_field = new_fw_config_field($<string>2, cur_bits); }
|
|
|
|
fw_config_field_children END { cur_bits = NULL; };
|
2020-05-16 00:39:08 +02:00
|
|
|
|
|
|
|
/* field <bit> (for single-bit fields) */
|
|
|
|
fw_config_field: FW_CONFIG_FIELD STRING NUMBER /* == bit */ {
|
2021-04-28 22:03:07 +02:00
|
|
|
cur_bits = NULL;
|
|
|
|
append_fw_config_bits(&cur_bits, strtoul($<string>3, NULL, 0), strtoul($<string>3, NULL, 0));
|
|
|
|
cur_field = new_fw_config_field($<string>2, cur_bits);
|
2020-05-16 00:39:08 +02:00
|
|
|
}
|
2021-04-28 22:03:07 +02:00
|
|
|
fw_config_field_children END { cur_bits = NULL; };
|
2020-05-16 00:39:08 +02:00
|
|
|
|
|
|
|
/* field (for adding options to an existing field) */
|
|
|
|
fw_config_field: FW_CONFIG_FIELD STRING {
|
|
|
|
cur_field = get_fw_config_field($<string>2);
|
|
|
|
}
|
2021-04-28 22:03:07 +02:00
|
|
|
fw_config_field_children END { cur_bits = NULL; };
|
2020-05-16 00:39:08 +02:00
|
|
|
|
|
|
|
/* option <value> */
|
|
|
|
fw_config_option: FW_CONFIG_OPTION STRING NUMBER /* == field value */
|
2020-10-01 23:41:31 +02:00
|
|
|
{ add_fw_config_option(cur_field, $<string>2, strtoull($<string>3, NULL, 0)); };
|
2020-05-16 00:39:08 +02:00
|
|
|
|
|
|
|
/* probe <field> <option> */
|
|
|
|
fw_config_probe: FW_CONFIG_PROBE STRING /* == field */ STRING /* == option */
|
|
|
|
{ add_fw_config_probe(cur_parent, $<string>2, $<string>3); }
|
2010-04-08 13:37:43 +02:00
|
|
|
%%
|