switch-coreboot/src/include
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
..
boot lib: add common write_tables() implementation 2016-04-21 20:49:05 +02:00
console drivers/uart: Enable override for input clock divider 2016-05-09 18:44:47 +02:00
cpu cpu/x86/mp_init: reduce exposure of internal implementation 2016-05-06 16:47:54 +02:00
device device: Add an ACPI device name and path concept to devices 2016-05-21 05:59:52 +02:00
pc80 kbuild: Allow drivers to fit src/drivers/[X]/[Y]/ scheme 2016-04-19 18:34:18 +02:00
smp atomic.h: Fix doxygen errors 2015-01-04 20:03:28 +01:00
superio tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
sys commonlib: Prepare code to be included in cbfstool builds. 2016-01-06 01:11:32 +01:00
tpm_lite vboot2: read secdata and nvdata 2015-03-23 19:51:47 +01:00
antirollback.h chromeos: vboot2: Add TPM PCR extension support 2015-04-20 17:06:28 +02:00
assert.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
b64_decode.h lib: add base64 decoder 2015-04-22 08:50:54 +02:00
base3.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
bcd.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
boardid.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
boot_device.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
bootblock_common.h lib/bootblock: Provide mechanism to pass in an early timestamp 2016-05-19 18:26:42 +02:00
bootmem.h lib/bootmem: allow architecture specific bootmem ranges 2016-04-21 20:46:45 +02:00
bootmode.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
bootstate.h lib: Add Kconfig to toggle boot state debugging 2016-02-18 00:01:14 +01:00
cbfs.h cbfs: Add LZ4 in-place decompression support for pre-RAM stages 2016-02-22 21:38:37 +01:00
cbmem.h cbmem: Add comment for cbmem_top returning NULL if backing store is not ready 2016-03-29 19:40:23 +02:00
delay.h timer: Reestablish init_timer(), consolidate timer initialization calls 2015-04-14 09:03:28 +02:00
edid.h edid: Make framebuffer row alignment configurable 2016-04-07 20:46:38 +02:00
elog.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
endian.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
fallback.h cbfs: new API and better program loading 2015-06-02 14:09:31 +02:00
fmap.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
gic.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
gpio.h gpio: Add support for binary_first base3 number system 2016-03-22 21:18:30 +01:00
halt.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
imd.h cbmem: add coreboot table records for each cbmem entry 2015-11-03 00:19:46 +01:00
inttypes.h x86: provide more C standard environment 2013-03-20 04:20:25 +01:00
ip_checksum.h Drop prototype guarding for romcc 2013-05-10 00:06:46 +02:00
kconfig.h Add config_enabled() from Linux 2012-05-08 00:36:09 +02:00
lib.h hexstrtobin: Add a library function to decode ASCII hex into binary 2016-05-21 05:58:51 +02:00
main_decl.h arches: lib: add main_decl.h for main() declaration 2016-02-11 23:29:08 +01:00
memlayout.h arch/x86: introduce postcar stage/phase 2016-03-23 14:24:30 +01:00
memory_info.h smbios: add funtion for smbios type17 2015-03-27 09:55:21 +01:00
memrange.h lib/memrange: add function to initialize range_entry 2016-03-09 16:46:16 +01:00
nhlt.h nhlt: add api to override oem_id and oem_table_id of acpi_header_t 2016-02-09 13:21:39 +01:00
option.h option: Add arch-agnostic get_option() 2014-03-04 15:23:10 +01:00
program_loading.h lib/prog_loading: introduce prog_segment_loaded() 2016-04-02 03:56:37 +02:00
reg_script.h lib/reg_script: Add display support 2016-05-04 19:21:40 +02:00
reset.h vboot2: implement select_firmware for pre-romstage verification 2015-01-27 01:43:01 +01:00
rmodule.h lib/rmodule: export parameters in struct rmod_stage_load 2016-03-22 13:54:52 +01:00
romstage_handoff.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
rtc.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
rules.h arch/x86: introduce postcar stage/phase 2016-03-23 14:24:30 +01:00
sdram_mode.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
smbios.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
spd.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
spd_cache.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
spd_ddr2.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
spi-generic.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
spi_flash.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
stage_cache.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
stddef.h stddef.h: fix zeroptr's definition 2016-04-15 16:18:57 +02:00
stdlib.h coreboot: introduce commonlib 2015-09-22 21:21:34 +00:00
string.h lib: Fix strncmp 2015-12-16 01:14:22 +01:00
swab.h include: Fix spelling 2013-07-11 22:36:19 +02:00
symbols.h memlayout: Add symbols for stage bounds 2016-02-22 21:38:07 +01:00
thread.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
timer.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
timestamp.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
tpm.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
trace.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
types.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
vbe.h intel/gma: Clarify code and use dedicated init for Google Peppy 2014-08-25 22:36:03 +02:00
version.h build.h: remove variable for the builduser, -hostname and -domain 2015-03-09 17:53:16 +01:00
watchdog.h watchdog.h: Fix compile time error on disabling watchdog handling 2013-03-12 12:06:43 +01:00
wrdd.h lib: Implement framework for retrieving WiFi regulatory domain 2016-01-22 16:12:17 +01:00