blob: 139a68643a647b19fe5959f2cc70205788f06ab5 [file] [log] [blame]
Felix Held3f3eca92020-01-23 17:12:32 +01001/* SPDX-License-Identifier: GPL-2.0-only */
Timothy Pearson448e3862015-11-24 14:12:01 -06002
3 /* SuperIO control port */
4 Name (SPIO, 0x2E)
5
6 /* SuperIO control map */
7 OperationRegion (SPIM, SystemIO, SPIO, 0x02)
8 Field (SPIM, ByteAcc, NoLock, Preserve) {
9 SIOI, 8,
10 SIOD, 8
11 }
12
13 /* SuperIO control registers */
14 IndexField (SIOI, SIOD, ByteAcc, NoLock, Preserve) {
15 Offset (0x2A),
16 CR2A, 8, /* Pin function selection */
17 }
18
19 Device (PS2K) // Keyboard
20 {
21 Name(_HID, EISAID("PNP0303"))
22 Name(_CID, EISAID("PNP030B"))
23
24 Name(_CRS, ResourceTemplate()
25 {
26 IO (Decode16, 0x60, 0x60, 0x01, 0x01)
27 IO (Decode16, 0x64, 0x64, 0x01, 0x01)
28 IRQ (Edge, ActiveHigh, Exclusive) { 0x01 } // IRQ 1
29 })
30
31 Method (_STA, 0)
32 {
33 Return (0xf)
34 }
35 }
36
37 Device (PS2M) // Mouse
38 {
39 Name(_HID, EISAID("PNP0F13"))
40 Name(_CRS, ResourceTemplate()
41 {
42 IRQ (Edge, ActiveHigh, Exclusive) { 0x0c } // IRQ 12
43 })
44
45 Method(_STA, 0)
46 {
47 /* Access SuperIO ACPI device */
Felix Singer1bb621c2022-12-12 06:46:28 +010048 SIOI = 0x87
49 SIOI = 0x87
Timothy Pearson448e3862015-11-24 14:12:01 -060050
51 /* Read Pin56 function select */
Felix Singer35e65a82022-12-16 07:11:17 +010052 Local0 = CR2A & 2
Timothy Pearson448e3862015-11-24 14:12:01 -060053
54 /* Restore default SuperIO access */
Felix Singer1bb621c2022-12-12 06:46:28 +010055 SIOI = 0xAA
Timothy Pearson448e3862015-11-24 14:12:01 -060056
Felix Singerb2d88072022-01-02 00:33:18 +010057 if (Local0 == 0) {
Timothy Pearson448e3862015-11-24 14:12:01 -060058 /* Mouse function selected */
59 Return (0xf)
60 }
61 Return (0x0)
62 }
63 }