2 * This file is part of the coreboot project.
4 * Copyright (C) 2014 Google Inc.
5 * Copyright (C) 2015 Intel Corporation.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 #include <soc/gpio_defs.h>
18 #include <soc/pcr_ids.h>
23 Name (_HID, "INT34BB")
25 Name (_DDN, "GPIO Controller")
27 Name (RBUF, ResourceTemplate()
29 Memory32Fixed (ReadWrite, 0, 0, COM0)
30 Memory32Fixed (ReadWrite, 0, 0, COM1)
31 Memory32Fixed (ReadWrite, 0, 0, COM4)
32 Interrupt (ResourceConsumer, Level, ActiveLow, Shared,,, GIRQ)
36 Method (_CRS, 0, NotSerialized)
38 /* GPIO Community 0 */
39 CreateDWordField (^RBUF, ^COM0._BAS, BAS0)
40 Store (^^PCRB (PID_GPIOCOM0), BAS0)
42 /* GPIO Community 1 */
43 CreateDWordField (^RBUF, ^COM1._BAS, BAS1)
44 Store (^^PCRB (PID_GPIOCOM1), BAS1)
46 /* GPIO Community 4 */
47 CreateDWordField (^RBUF, ^COM4._BAS, BAS4)
48 Store (^^PCRB (PID_GPIOCOM4), BAS4)
53 Method (_STA, 0, NotSerialized)
60 * Get GPIO DW0 Address
63 Method (GADD, 1, NotSerialized)
65 /* GPIO Community 0 */
66 If (LAnd (LGreaterEqual (Arg0, GPP_A0), LLessEqual (Arg0, GPP_G7)))
68 Store (PID_GPIOCOM0, Local0)
69 Subtract (Arg0, GPP_A0, Local1)
71 /* GPIO Community 1 */
72 If (LAnd (LGreaterEqual (Arg0, GPP_D0), LLessEqual (Arg0, GPP_H23)))
74 Store (PID_GPIOCOM1, Local0)
75 Subtract (Arg0, GPP_D0, Local1)
77 /* GPIO Community 04*/
78 If (LAnd (LGreaterEqual (Arg0, GPP_C0), LLessEqual (Arg0, GPP_E23)))
80 Store (PID_GPIOCOM4, Local0)
81 Subtract (Arg0, GPP_C0, Local1)
83 Store (PCRB (Local0), Local2)
84 Add (Local2, PAD_CFG_BASE, Local2)
85 Return (Add (Local2, Multiply (Local1, 16)))
92 Method (GRXS, 1, Serialized)
94 OperationRegion (PREG, SystemMemory, GADD (Arg0), 4)
95 Field (PREG, AnyAcc, NoLock, Preserve)
99 And (GPIORXSTATE_MASK, ShiftRight (VAL0, GPIORXSTATE_SHIFT), Local0)