1e86fba50SShameer Kolothum==================================================
2e86fba50SShameer KolothumQEMU and ACPI BIOS Generic Event Device interface
3e86fba50SShameer Kolothum==================================================
4e86fba50SShameer Kolothum
5e86fba50SShameer KolothumThe ACPI *Generic Event Device* (GED) is a HW reduced platform
6e86fba50SShameer Kolothumspecific device introduced in ACPI v6.1 that handles all platform
7e86fba50SShameer Kolothumevents, including the hotplug ones. GED is modelled as a device
8e86fba50SShameer Kolothumin the namespace with a _HID defined to be ACPI0013. This document
9e86fba50SShameer Kolothumdescribes the interface between QEMU and the ACPI BIOS.
10e86fba50SShameer Kolothum
11e86fba50SShameer KolothumGED allows HW reduced platforms to handle interrupts in ACPI ASL
12e86fba50SShameer Kolothumstatements. It follows a very similar approach to the _EVT method
13e86fba50SShameer Kolothumfrom GPIO events. All interrupts are listed in  _CRS and the handler
14e86fba50SShameer Kolothumis written in _EVT method. However, the QEMU implementation uses a
15e86fba50SShameer Kolothumsingle interrupt for the GED device, relying on an IO memory region
16e86fba50SShameer Kolothumto communicate the type of device affected by the interrupt. This way,
17e86fba50SShameer Kolothumwe can support up to 32 events with a unique interrupt.
18e86fba50SShameer Kolothum
19e86fba50SShameer Kolothum**Here is an example,**
20e86fba50SShameer Kolothum
21e86fba50SShameer Kolothum::
22e86fba50SShameer Kolothum
23e86fba50SShameer Kolothum   Device (\_SB.GED)
24e86fba50SShameer Kolothum   {
25e86fba50SShameer Kolothum       Name (_HID, "ACPI0013")
26e86fba50SShameer Kolothum       Name (_UID, Zero)
27e86fba50SShameer Kolothum       Name (_CRS, ResourceTemplate ()
28e86fba50SShameer Kolothum       {
29e86fba50SShameer Kolothum           Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, ,, )
30e86fba50SShameer Kolothum           {
31e86fba50SShameer Kolothum               0x00000029,
32e86fba50SShameer Kolothum           }
33e86fba50SShameer Kolothum       })
34e86fba50SShameer Kolothum       OperationRegion (EREG, SystemMemory, 0x09080000, 0x04)
35e86fba50SShameer Kolothum       Field (EREG, DWordAcc, NoLock, WriteAsZeros)
36e86fba50SShameer Kolothum       {
37e86fba50SShameer Kolothum           ESEL,   32
38e86fba50SShameer Kolothum       }
39e86fba50SShameer Kolothum       Method (_EVT, 1, Serialized)
40e86fba50SShameer Kolothum       {
41e86fba50SShameer Kolothum           Local0 = ESEL // ESEL = IO memory region which specifies the
42e86fba50SShameer Kolothum                         // device type.
43e86fba50SShameer Kolothum           If (((Local0 & One) == One))
44e86fba50SShameer Kolothum           {
45e86fba50SShameer Kolothum               MethodEvent1()
46e86fba50SShameer Kolothum           }
47e86fba50SShameer Kolothum           If ((Local0 & 0x2) == 0x2)
48e86fba50SShameer Kolothum           {
49e86fba50SShameer Kolothum               MethodEvent2()
50e86fba50SShameer Kolothum           }
51e86fba50SShameer Kolothum           ...
52e86fba50SShameer Kolothum       }
53e86fba50SShameer Kolothum   }
54e86fba50SShameer Kolothum
55e86fba50SShameer KolothumGED IO interface (4 byte access)
56e86fba50SShameer Kolothum--------------------------------
57e86fba50SShameer Kolothum**read access:**
58e86fba50SShameer Kolothum
59e86fba50SShameer Kolothum::
60e86fba50SShameer Kolothum
61e86fba50SShameer Kolothum   [0x0-0x3] Event selector bit field (32 bit) set by QEMU.
62e86fba50SShameer Kolothum
63e86fba50SShameer Kolothum    bits:
64e86fba50SShameer Kolothum       0: Memory hotplug event
65e86fba50SShameer Kolothum       1: System power down event
66*c2505d1cSShameer Kolothum       2: NVDIMM hotplug event
67*c2505d1cSShameer Kolothum    3-31: Reserved
68e86fba50SShameer Kolothum
69e86fba50SShameer Kolothum**write_access:**
70e86fba50SShameer Kolothum
71e86fba50SShameer KolothumNothing is expected to be written into GED IO memory
72