coreboot-kgpe-d16/src/arch/x86
Duncan Laurie d9af3cecae 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(); /* device */
  acpigen_pop_len(); /* scope */

Will produce this ACPI code:

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

Change-Id: Ie149595aeab96266fa5f006e7934339f0119ac54
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://review.coreboot.org/14840
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-05-21 05:59:52 +02:00
..
acpi tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
include device: Add an ACPI device name and path concept to devices 2016-05-21 05:59:52 +02:00
acpi.c src/arch/x86/acpi.c: Use correct host address width in DMAR ACPI table 2016-03-18 19:15:25 +01:00
acpi_device.c device: Add an ACPI device name and path concept to devices 2016-05-21 05:59:52 +02:00
acpigen.c acpigen: Add function to generate ToUUID() from a string 2016-05-21 05:59:01 +02:00
assembly_entry.S arch/x86/assembly_entry: allow early post CAR stages to use common code 2016-05-02 20:06:23 +02:00
boot.c die() when attempting to use bounce buffer on non-i386. 2016-02-22 18:38:48 +01:00
bootblock.ld tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
bootblock_crt0.S bootblock_crt0: Use CR* macros from cpu/x86/cr.h 2016-04-15 01:31:16 +02:00
bootblock_normal.c arch/x86/include: Rename bootblock_common to bootblock_romcc.h 2016-01-21 05:37:19 +01:00
bootblock_romcc.S arch/x86: Rename bootblock.S to bootblock_romcc.S 2016-01-30 03:11:12 +01:00
bootblock_simple.c arch/x86/include: Rename bootblock_common to bootblock_romcc.h 2016-01-21 05:37:19 +01:00
c_start.S arch/x86: move SetCodeSelector to .text segment 2016-01-26 04:40:44 +01:00
car.ld arch/x86: document CAR symbols and expose them in symbols.h 2016-03-05 16:00:42 +01:00
cbfs_and_run.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
cbmem.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
cpu.c x86: add coreboot table entry for TSC info 2016-02-19 19:50:10 +01:00
cpu_common.c arch/x86: add missing license headers 2016-01-14 23:37:06 +01:00
crt0_romcc_epilogue.inc src/arch: Update license headers missing paragraph 2 2016-01-26 04:44:20 +01:00
ebda.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
exception.c arch/x86: add missing license headers 2016-01-14 23:37:06 +01:00
exit_car.S arch/x86: introduce postcar stage/phase 2016-03-23 14:24:30 +01:00
failover.ld arch/x86: rename reset_vector -> _start 2016-03-04 01:16:05 +01:00
gdt.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
id.ld arch/x86: add missing license headers 2016-01-14 23:37:06 +01:00
id.S arch/x86: add missing license headers 2016-01-14 23:37:06 +01:00
ioapic.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
Kconfig arch/x86: introduce postcar stage/phase 2016-03-23 14:24:30 +01:00
Makefile.inc device: Add an ACPI device name and path concept to devices 2016-05-21 05:59:52 +02:00
memcpy.c arch/x86: add missing license headers 2016-01-14 23:37:06 +01:00
memlayout.ld arch/x86: introduce postcar stage/phase 2016-03-23 14:24:30 +01:00
memmove.c arch/x86: add missing license headers 2016-01-14 23:37:06 +01:00
memset.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
mmap_boot.c Revert "x86: Align CBFS on top of ROM" 2016-01-06 17:44:54 +01:00
mpspec.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
pci_ops_conf1.c arch/x86: Drop arch/pciconf.h 2016-01-26 20:22:44 +01:00
pci_ops_mmconf.c arch/x86: Drop arch/pciconf.h 2016-01-26 20:22:44 +01:00
pirq_routing.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
postcar_loader.c lib/prog_loading: introduce prog_segment_loaded() 2016-04-02 03:56:37 +02:00
prologue.inc tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
romcc_console.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
smbios.c smbios: Add SuperTalent SPD ID 2016-05-09 20:43:50 +02:00
stages.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
tables.c lib: add common write_tables() implementation 2016-04-21 20:49:05 +02:00
thread.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
thread_switch.S tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
timestamp.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
wakeup.S arch/x86: remove .intel_syntax 2016-01-23 17:01:44 +01:00
walkcbfs.S arch/x86: add missing license headers 2016-01-14 23:37:06 +01:00