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