Timothy Pearson | 448e386 | 2015-11-24 14:12:01 -0600 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (c) 2013 Vladimir Serbinenko |
| 5 | * Copyright (c) 2015 Raptor Engineering |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License as |
| 9 | * published by the Free Software Foundation; version 2 of |
| 10 | * the License. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | */ |
| 17 | |
| 18 | /* SuperIO control port */ |
| 19 | Name (SPIO, 0x2E) |
| 20 | |
| 21 | /* SuperIO control map */ |
| 22 | OperationRegion (SPIM, SystemIO, SPIO, 0x02) |
| 23 | Field (SPIM, ByteAcc, NoLock, Preserve) { |
| 24 | SIOI, 8, |
| 25 | SIOD, 8 |
| 26 | } |
| 27 | |
| 28 | /* SuperIO control registers */ |
| 29 | IndexField (SIOI, SIOD, ByteAcc, NoLock, Preserve) { |
| 30 | Offset (0x2A), |
| 31 | CR2A, 8, /* Pin function selection */ |
| 32 | } |
| 33 | |
| 34 | Device (PS2K) // Keyboard |
| 35 | { |
| 36 | Name(_HID, EISAID("PNP0303")) |
| 37 | Name(_CID, EISAID("PNP030B")) |
| 38 | |
| 39 | Name(_CRS, ResourceTemplate() |
| 40 | { |
| 41 | IO (Decode16, 0x60, 0x60, 0x01, 0x01) |
| 42 | IO (Decode16, 0x64, 0x64, 0x01, 0x01) |
| 43 | IRQ (Edge, ActiveHigh, Exclusive) { 0x01 } // IRQ 1 |
| 44 | }) |
| 45 | |
| 46 | Method (_STA, 0) |
| 47 | { |
| 48 | Return (0xf) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | Device (PS2M) // Mouse |
| 53 | { |
| 54 | Name(_HID, EISAID("PNP0F13")) |
| 55 | Name(_CRS, ResourceTemplate() |
| 56 | { |
| 57 | IRQ (Edge, ActiveHigh, Exclusive) { 0x0c } // IRQ 12 |
| 58 | }) |
| 59 | |
| 60 | Method(_STA, 0) |
| 61 | { |
| 62 | /* Access SuperIO ACPI device */ |
| 63 | Store(0x87, SIOI) |
| 64 | Store(0x87, SIOI) |
| 65 | |
| 66 | /* Read Pin56 function select */ |
| 67 | And(CR2A, 0x2, Local0) |
| 68 | |
| 69 | /* Restore default SuperIO access */ |
| 70 | Store(0xAA, SIOI) |
| 71 | |
| 72 | if (LEqual(Local0, 0x0)) { |
| 73 | /* Mouse function selected */ |
| 74 | Return (0xf) |
| 75 | } |
| 76 | Return (0x0) |
| 77 | } |
| 78 | } |