coreboot/src/device
Duncan Laurie 7163a1cdbf UPSTREAM: device: Add an ACPI device name and path concept to devices
Add a function to "struct device_operations" to return the ACPI name
for the device, and helper functions to find this name (either from
the device or its parent) and to build a fully qualified ACPI path
from the root device.

This addition will allow device drivers to generate their ACPI AML in
the SSDT at boot, with customization supplied by devicetree.cb,
instead of needing custom DSDT ASL for every mainboard.

The root device acpi_name is defined as "\_SB" and is used to start
the path when building a fully qualified name.

This requires SOC support to provide handlers for returning the ACPI
name for devices that it owns, and those names must match the objects
declared in the DSDT. The handler can be done either in each device
driver or with a global handler for the entire SOC.

Simplified example of how this can be used for an i2c device declared
in devicetree.cb with:

chip soc/intel/skylake # "_SB" (from root device)
device domain 0 on # "PCI0"
device pci 19.2 on # "I2C4"
chip drivers/i2c/test0
device i2c 1a.0 on end # "TST0"
end
end
end
end

And basic SSDT generating code in the device driver:

acpigen_write_scope(acpi_device_scope(dev));
acpigen_write_device(acpi_device_name(dev));
acpigen_write_string("_HID", "TEST0000");
acpigen_write_byte("_UID", 0);
acpigen_pop_len(); /bin /boot /cdrom /dev /etc /home /initrd.img /initrd.img.old /lib /lib32 /lib64 /libx32 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var /vmlinuz /vmlinuz.old device */
acpigen_pop_len(); /bin /boot /cdrom /dev /etc /home /initrd.img /initrd.img.old /lib /lib32 /lib64 /libx32 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var /vmlinuz /vmlinuz.old scope */

Will produce this ACPI code:

Scope (_SB.PCI0.I2C4) {
Device (TST0) {
Name (_HID, "TEST0000")
Name (_UID, 0)
}
}

BUG=None
BRANCH=None
TEST=None

Change-Id: Ie149595aeab96266fa5f006e7934339f0119ac54
Original-Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Original-Reviewed-on: https://review.coreboot.org/14840
Original-Tested-by: build bot (Jenkins)
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/346989
Commit-Ready: Martin Roth <martinroth@chromium.org>
Tested-by: Martin Roth <martinroth@chromium.org>
Reviewed-by: Martin Roth <martinroth@chromium.org>
2016-05-26 03:21:45 -07:00
..
dram device/dram/ddr3: fix debug output 2016-03-21 18:31:10 +01:00
oprom src/device: Update license headers 2016-04-13 17:34:18 +02:00
azalia_device.c Correct some common spelling mistakes 2016-01-07 22:57:02 +01:00
cardbus_device.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
cpu_device.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
device.c src/device: Update license headers 2016-04-13 17:34:18 +02:00
device_romstage.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
device_util.c UPSTREAM: sconfig: Add a new generic device type 2016-05-20 20:04:05 +00:00
hypertransport.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
i2c.c device: Add i2c read/write register field API 2016-03-21 23:10:55 +01:00
Kconfig payloads: add iPXE 'payload' build 2016-04-13 17:45:37 +02:00
Makefile.inc device/pci_rom: Always use pci_rom 2016-04-13 17:21:07 +02:00
pci_class.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
pci_device.c src/device: Update license headers 2016-04-13 17:34:18 +02:00
pci_early.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
pci_ops.c arch/x86: Drop arch/pciconf.h 2016-01-26 20:22:44 +01:00
pci_rom.c device/pci_rom: Rename missleading ON_DEVICE_ROM_RUN 2016-02-16 22:44:04 +01:00
pciexp_device.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
pcix_device.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
pnp_device.c device/pnp: Ability to set vendor specific logical device config 2015-12-29 18:17:01 +01:00
root_device.c UPSTREAM: device: Add an ACPI device name and path concept to devices 2016-05-26 03:21:45 -07:00
smbus_ops.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
software_i2c.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00