2 * This file is part of the coreboot project.
4 * Copyright (C) 2011 Christoph Grenz <christophg+cb@grenz-bonn.de>
5 * Copyright (C) 2013 secunet Security Networks AG
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.
17 /* =================== Keyboard Controller ================== */
20 * Just uses the default i/o ports 0x60/0x64, irq 1 (and 12 for PS/2
21 * mouse). Do we have any system that needs this configurable?
23 * Controlled by the following preprocessor defines:
25 * SUPERIO_CHIP_NAME The name of the super i/o chip (unique, required)
26 * SUPERIO_KBC_LDN The logical device number on the super i/o
27 * chip for this keyboard controller (required)
28 * SUPERIO_KBC_PS2M If defined, PS/2 mouse support is included in
29 * the KBC_LDN. Mouse irq is set at IRQ1 of the
31 * SUPERIO_KBC_PS2LDN If defined, specifies a second LDN to configure
32 * PS/2 mouse support. Mouse irq is set at IRQ0 of
34 * SUPERIO_KBC_PS2M and SUPERIO_KBC_PS2LDN are mutually exclusive.
39 #ifndef SUPERIO_CHIP_NAME
40 # error "SUPERIO_CHIP_NAME is not defined."
43 #ifndef SUPERIO_KBC_LDN
44 # error "SUPERIO_KBC_LDN is not defined."
47 #if defined(SUPERIO_KBC_PS2M) && defined(SUPERIO_KBC_PS2LDN)
48 # error "SUPERIO_KBC_PS2M and SUPERIO_KBC_PS2LDN are mutually exclusive."
51 Device (SUPERIO_ID(KBD, SUPERIO_KBC_LDN)) {
52 Name (_HID, EisaId ("PNP0303"))
53 Name (_UID, SUPERIO_UID(KBD, SUPERIO_KBC_LDN))
57 PNP_GENERIC_STA(SUPERIO_KBC_LDN)
62 ENTER_CONFIG_MODE (SUPERIO_KBC_LDN)
63 Store (Zero, PNP_DEVICE_ACTIVE)
65 #if defined(SUPERIO_KBC_PS2LDN)
66 Notify (SUPERIO_ID(PS2, SUPERIO_KBC_PS2LDN), 1)
67 #elif defined(SUPERIO_KBC_PS2M)
68 Notify (SUPERIO_ID(PS2, SUPERIO_KBC_LDN), 1)
78 Name (CRS, ResourceTemplate () {
79 IO (Decode16, 0x0000, 0x0000, 0x01, 0x01, IO0)
80 IO (Decode16, 0x0000, 0x0000, 0x01, 0x01, IO1)
83 ENTER_CONFIG_MODE (SUPERIO_KBC_LDN)
84 PNP_READ_IO(PNP_IO0, CRS, IO0)
85 PNP_READ_IO(PNP_IO1, CRS, IO1)
86 PNP_READ_IRQ(PNP_IRQ0, CRS, IR0)
91 Name (_PRS, ResourceTemplate ()
93 StartDependentFn (0,0) {
94 IO (Decode16, 0x0060, 0x0060, 0x01, 0x01)
95 IO (Decode16, 0x0064, 0x0064, 0x01, 0x01)
101 Method (_SRS, 1, Serialized)
103 Name (TMPL, ResourceTemplate () {
104 IO (Decode16, 0x0000, 0x0000, 0x01, 0x01, IO0)
105 IO (Decode16, 0x0000, 0x0000, 0x01, 0x01, IO1)
108 ENTER_CONFIG_MODE (SUPERIO_KBC_LDN)
109 PNP_WRITE_IO(PNP_IO0, Arg0, IO0)
110 PNP_WRITE_IO(PNP_IO1, Arg0, IO1)
111 PNP_WRITE_IRQ(PNP_IRQ0, Arg0, IR0)
112 Store (One, PNP_DEVICE_ACTIVE)
114 #if defined(SUPERIO_KBC_PS2LDN)
115 Notify (SUPERIO_ID(PS2, SUPERIO_KBC_PS2LDN), 1)
116 #elif defined(SUPERIO_KBC_PS2M)
117 Notify (SUPERIO_ID(PS2, SUPERIO_KBC_LDN), 1)
122 #if defined(SUPERIO_KBC_PS2M)
123 Device (SUPERIO_ID(PS2, SUPERIO_KBC_LDN)) {
124 Name (_HID, EisaId ("PNP0F13"))
125 Name (_UID, SUPERIO_UID(PS2, SUPERIO_KBC_LDN))
129 Return (^^SUPERIO_ID(KBD, SUPERIO_KBC_LDN)._STA ())
133 Return (^^SUPERIO_ID(KBD, SUPERIO_KBC_LDN)._PSC ())
138 Name (CRS, ResourceTemplate () {
141 ENTER_CONFIG_MODE (SUPERIO_KBC_LDN)
142 PNP_READ_IRQ(PNP_IRQ1, CRS, IR1)
147 Name (_PRS, ResourceTemplate ()
149 StartDependentFn (0,0) {
155 Method (_SRS, 1, Serialized)
157 Name (TMPL, ResourceTemplate () {
160 ENTER_CONFIG_MODE (SUPERIO_KBC_LDN)
161 PNP_WRITE_IRQ(PNP_IRQ1, Arg0, IR1)
165 #elif defined(SUPERIO_KBC_PS2LDN)
166 Device (SUPERIO_ID(PS2, SUPERIO_KBC_PS2LDN)) {
167 Name (_HID, EisaId ("PNP0F13"))
168 Name (_UID, SUPERIO_UID(PS2, SUPERIO_KBC_PS2LDN))
172 Store (^^SUPERIO_ID(KBD, SUPERIO_KBC_LDN)._STA (), Local0)
173 If (LEqual (Local0, DEVICE_PRESENT_ACTIVE)) {
174 PNP_GENERIC_STA(SUPERIO_KBC_PS2LDN)
182 ENTER_CONFIG_MODE (SUPERIO_KBC_PS2LDN)
183 Store (Zero, PNP_DEVICE_ACTIVE)
193 Name (CRS, ResourceTemplate () {
196 ENTER_CONFIG_MODE (SUPERIO_KBC_PS2LDN)
197 PNP_READ_IRQ(PNP_IRQ0, CRS, IR1)
202 Name (_PRS, ResourceTemplate ()
204 StartDependentFn (0,0) {
210 Method (_SRS, 1, Serialized)
212 Name (TMPL, ResourceTemplate () {
215 ENTER_CONFIG_MODE (SUPERIO_KBC_PS2LDN)
216 PNP_WRITE_IRQ(PNP_IRQ0, Arg0, IR1)
217 Store (One, PNP_DEVICE_ACTIVE)