2 * This file is part of the coreboot project.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
30 Name (RBUF, ResourceTemplate()
32 DWordIo (ResourceProducer,
33 MinFixed, // IsMinFixed
34 MaxFixed, // IsMaxFixed
36 EntireRange, // ISARanges
37 0x00000000, // AddressGranularity
38 0x00000000, // AddressMinimum
39 0x00000000, // AddressMaximum
40 0x00000000, // AddressTranslation
41 0x00000000, // RangeLength
42 , // ResourceSourceIndex
45 // Disabled due to IRQ storm: http://crosbug.com/p/29548
46 //Interrupt (ResourceConsumer,
47 // Level, ActiveHigh, Shared, , , ) {14}
50 Method (_CRS, 0, NotSerialized)
52 CreateDwordField (^RBUF, ^BAR0._MIN, BMIN)
53 CreateDwordField (^RBUF, ^BAR0._MAX, BMAX)
54 CreateDwordField (^RBUF, ^BAR0._LEN, BLEN)
56 Store (GPIO_BASE_SIZE, BLEN)
57 Store (GPIO_BASE_ADDRESS, BMIN)
58 Store (Subtract (Add (GPIO_BASE_ADDRESS,
59 GPIO_BASE_SIZE), 1), BMAX)
64 Method (_STA, 0, NotSerialized)
69 // GWAK: Setup GPIO as ACPI GPE for Wake
71 Method (GWAK, 1, Serialized)
73 // Local0 = GPIO Base Address
74 Store (And (GPBS, Not(0x1)), Local0)
76 // Local1 = BANK, Local2 = OFFSET
77 Divide (Arg0, 32, Local2, Local1)
83 // Local3 = GPIOBASE + GPIO_OWN(BANK)
84 Store (Add (Local0, Multiply (Local1, 0x4)), Local3)
87 OperationRegion (IOWN, SystemIO, Local3, 4)
88 Field (IOWN, AnyAcc, NoLock, Preserve) {
92 // GPIO_OWN[GPIO] = 0 (ACPI)
93 Store (And (GOWN, Not (ShiftLeft (0x1, Local2))), GOWN)
99 // Local3 = GPIOBASE + GPIO_ROUTE(BANK)
100 Store (Add (Add (Local0, 0x30), Multiply (Local1, 0x4)), Local3)
103 OperationRegion (IROU, SystemIO, Local3, 4)
104 Field (IROU, AnyAcc, NoLock, Preserve) {
108 // GPIO_ROUTE[GPIO] = 0 (SCI)
109 Store (And (GROU, Not (ShiftLeft (0x1, Local2))), GROU)
112 // Set GPnCONFIG to GPIO|INPUT|INVERT
115 // Local3 = GPIOBASE + GPnCONFIG0(GPIO)
116 Store (Add (Add (Local0, 0x100), Multiply (Arg0, 0x8)), Local3)
119 OperationRegion (GPNC, SystemIO, Local3, 8)
120 Field (GPNC, AnyAcc, NoLock, Preserve) {
121 GMOD, 1, // MODE: 0=NATIVE 1=GPIO
123 GIOS, 1, // IO_SEL: 0=OUTPUT 1=INPUT
124 GINV, 1, // INVERT: 0=NORMAL 1=INVERT
125 GLES, 1, // LxEB: 0=EDGE 1=LEVEL
127 ILVL, 1, // INPUT: 0=LOW 1=HIGH
128 OLVL, 1, // OUTPUT: 0=LOW 1=HIGH
129 GPWP, 2, // PULLUP: 00=NONE 01=DOWN 10=UP 11=INVALID
130 ISEN, 1, // SENSE: 0=ENABLE 1=DISABLE
133 Store (0x1, GMOD) // GPIO
134 Store (0x1, GIOS) // INPUT
135 Store (0x1, GINV) // INVERT