Felix Held | 3f3eca9 | 2020-01-23 17:12:32 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Timothy Pearson | 448e386 | 2015-11-24 14:12:01 -0600 | [diff] [blame] | 2 | |
| 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 Singer | 1bb621c | 2022-12-12 06:46:28 +0100 | [diff] [blame] | 48 | SIOI = 0x87 |
| 49 | SIOI = 0x87 |
Timothy Pearson | 448e386 | 2015-11-24 14:12:01 -0600 | [diff] [blame] | 50 | |
| 51 | /* Read Pin56 function select */ |
Felix Singer | 35e65a8 | 2022-12-16 07:11:17 +0100 | [diff] [blame] | 52 | Local0 = CR2A & 2 |
Timothy Pearson | 448e386 | 2015-11-24 14:12:01 -0600 | [diff] [blame] | 53 | |
| 54 | /* Restore default SuperIO access */ |
Felix Singer | 1bb621c | 2022-12-12 06:46:28 +0100 | [diff] [blame] | 55 | SIOI = 0xAA |
Timothy Pearson | 448e386 | 2015-11-24 14:12:01 -0600 | [diff] [blame] | 56 | |
Felix Singer | b2d8807 | 2022-01-02 00:33:18 +0100 | [diff] [blame] | 57 | if (Local0 == 0) { |
Timothy Pearson | 448e386 | 2015-11-24 14:12:01 -0600 | [diff] [blame] | 58 | /* Mouse function selected */ |
| 59 | Return (0xf) |
| 60 | } |
| 61 | Return (0x0) |
| 62 | } |
| 63 | } |