sconfig: Allow to specify device operations
Currently we only have runtime mechanisms to assign device operations to a node in our devicetree (with one exception: the root device). The most common method is to map PCI IDs to the device operations with a `struct pci_driver`. Another accustomed way is to let a chip driver assign them. For very common drivers, e.g. those in soc/intel/common/blocks/, the PCI ID lists grew very large and are incredibly error-prone. Often, IDs are missing and sometimes IDs are added almost mechanically without checking the code for compatibility. Maintaining these lists in a central place also reduces flexibility. Now, for onboard devices it is actually unnecessary to assign the device operations at runtime. We already know exactly what operations should be assigned. And since we are using chipset devicetrees, we have a perfect place to put that information. This patch adds a simple mechanism to `sconfig`. It allows us to speci- fy operations per device, e.g. device pci 00.0 alias system_agent on ops system_agent_ops end The operations are given as a C identifier. In this example, we simply assume that a global `struct device_operations system_agent_ops` exists. Change-Id: I2833d2f2450fde3206c33393f58b86fd4280b566 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66483 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
@@ -21,7 +21,7 @@ static struct fw_config_field_bits *cur_bits;
|
||||
uint64_t number;
|
||||
}
|
||||
|
||||
%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 SMBIOS_DEV_INFO 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
|
||||
%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 SMBIOS_DEV_INFO 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 OPS
|
||||
%%
|
||||
devtree: { cur_parent = root_parent; } | devtree chip | devtree fw_config_table;
|
||||
|
||||
@@ -31,7 +31,7 @@ chipchild: device | chipchild_nondev;
|
||||
chipchildren: chipchildren chipchild | /* empty */ ;
|
||||
chipchildren_dev: device chipchildren | chipchild_nondev chipchildren_dev;
|
||||
|
||||
devicechildren: devicechildren device | devicechildren chip | devicechildren resource | devicechildren subsystemid | devicechildren ioapic_irq | devicechildren smbios_slot_desc | devicechildren smbios_dev_info | devicechildren registers | devicechildren fw_config_probe | /* empty */ ;
|
||||
devicechildren: devicechildren device | devicechildren chip | devicechildren resource | devicechildren subsystemid | devicechildren ioapic_irq | devicechildren smbios_slot_desc | devicechildren smbios_dev_info | devicechildren registers | devicechildren fw_config_probe | devicechildren ops | /* empty */ ;
|
||||
|
||||
chip: CHIP STRING /* == path */ {
|
||||
$<chip_instance>$ = new_chip_instance($<string>2);
|
||||
@@ -142,4 +142,8 @@ fw_config_option: FW_CONFIG_OPTION STRING NUMBER /* == field value */
|
||||
/* probe <field> <option> */
|
||||
fw_config_probe: FW_CONFIG_PROBE STRING /* == field */ STRING /* == option */
|
||||
{ add_fw_config_probe(cur_parent, $<string>2, $<string>3); }
|
||||
|
||||
ops: OPS STRING /* == global identifier */
|
||||
{ add_device_ops(cur_parent, $<string>2); }
|
||||
|
||||
%%
|
||||
|
Reference in New Issue
Block a user