coreboot-kgpe-d16/src
Duncan Laurie 559e947306 acpi_device: Add support for writing ACPI Device Properties
The recent ACPI specification extensions have formally defined a
method for describing device information with a key=value format that
is modeled after the Devicetree/DTS format using a special crafted
object named _DSD with a specific UUID for this format.

There are three defined Device Property types: Integers, Strings, and
References.  It is also possible to have arrays of these properties
under one key=value pair.  Strings and References are both represented
as character arrays but result in different generated ACPI OpCodes.

Various helpers are provided for writing the Device Property header
(to fill in the object name and UUID) and footer (to fill in the
property count and device length values) as well as for writing the
different Device Property types.  A specific helper is provided for
writing the defined GPIO binding Device Property that is used to allow
GPIOs to be referred to by name rather than resource index.

This is all documented in the _DSD Device Properties UUID document:
http://uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf

This will be used by device drivers to provide device properties that
are consumed by the operating system.  Devicetree bindings are often
described in the linux kernel at Documentation/devicetree/bindings/

A sample driver here has an input GPIO that it needs to describe to
the kernel driver:

chip.h:
  struct drivers_generic_sample_config {
    struct acpi_gpio mode_gpio;
  };

sample.c:
  static void acpi_fill_ssdt_generator(struct device *dev) {
    struct drivers_generic_sample_config *config = dev->chip_info;
    const char *path = acpi_device_path(dev);
    ...
    acpi_device_write_gpio(&config->mode_gpio);
    ...
    acpi_dp_write_header();
    acpi_dp_write_gpio("mode-gpio", path, 0, 0, 0);
    acpi_dp_write_footer();
    ...
  }

devicetree.cb:
  device pci 1f.0 on
    chip drivers/generic/sample
      register "mode_gpio" = "ACPI_GPIO_INPUT(GPP_B1)"
      device generic 0 on end
    end
  end

SSDT.dsl:
  Name (_CRS, ResourceTemplate () {
    GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionInputOnly,
            "\\_SB.PCI0.GPIO", 0, ResourceConsumer) { 25 }
  })
  Name (_DSD, Package () {
    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
    Package () {
      Package () {"mode-gpio", Package () { \_SB.PCI0.LPCB, 0, 0, 1 }}
    }
  })

Change-Id: I93ffd09e59d05c09e38693e221a87085469be3ad
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://review.coreboot.org/14937
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-05-28 03:48:55 +02:00
..
acpi acpi/: add missing license header 2016-01-14 22:52:11 +01:00
arch acpi_device: Add support for writing ACPI Device Properties 2016-05-28 03:48:55 +02:00
commonlib cbfstool/fsp: Rename fsp1_1_relocate 2016-05-11 18:38:28 +02:00
console console/post: be explicit about conditional cmos_post_log() compiling 2016-05-25 18:04:11 +02:00
cpu AGESA vendorcode: Build a common amdlib 2016-05-18 10:44:43 +02:00
device device: Add an ACPI device name and path concept to devices 2016-05-21 05:59:52 +02:00
drivers drivers/intel/fsp2_0: Send post codes around calls to the blobs 2016-05-26 23:50:02 +02:00
ec ec/google/chromeec/acpi: Add MKBP support 2016-05-18 20:22:38 +02:00
include acpi_device: Add support for writing ACPI I2C descriptors 2016-05-28 03:47:09 +02:00
lib program.ld: Don't exclude sbe region from verstage 2016-05-21 06:04:32 +02:00
mainboard mainboard/google/reef: increase BIOS region size 2016-05-27 19:55:30 +02:00
northbridge intel/sch: Merge northbridge and southbridge in src/soc 2016-05-17 21:38:17 +02:00
soc soc/intel/apollolake: provide SMM dependency requirements 2016-05-27 19:56:01 +02:00
southbridge AGESA vendorcode: Build a common amdlib 2016-05-18 10:44:43 +02:00
superio sio/winbond: Expose enter/exit configuration state functions 2016-05-20 04:11:58 +02:00
vendorcode vendorcode/google/chromeos/vboot2: use cbmem for postcar region selection 2016-05-25 18:04:30 +02:00
Kconfig src/Kconfig: Move acpi Kconfig below chipset Kconfigs 2016-05-19 19:29:59 +02:00