Angel Pons | 236c637 | 2020-04-03 01:21:05 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 2 | |
| 3 | |
| 4 | /* SuperIO GPIO configuration via logical device 0x0A */ |
| 5 | |
| 6 | Name (MSBF, ResourceTemplate () |
| 7 | { |
| 8 | IO (Decode16, 0x0000, 0x0000, 0x01, 0x80, _Y1B) |
| 9 | }) |
| 10 | |
| 11 | OperationRegion (LPC0, SystemIO, 0x0E00, 0x60) |
| 12 | Field (LPC0, ByteAcc, NoLock, Preserve) |
| 13 | { |
| 14 | PME0, 8, |
| 15 | Offset (0x02), PME2,8, |
| 16 | Offset (0x04), PME4,8, |
| 17 | Offset (0x0A), PMEA,8, |
| 18 | Offset (0x23), |
| 19 | GC10,8, GC11,8, GC12,8, GC13,8, GC14,8, GC15,8, GC16,8, GC17,8, |
| 20 | GC20,8, GC21,8, GC22,8, GC23,8, GC24,8, GC25,8, GC26,8, GC27,8, |
| 21 | GC30,8, GC31,8, GC32,8, GC33,8, GC34,8, GC35,8, GC36,8, GC37,8, |
| 22 | GC40,8, GC41,8, GC42,8, GC43,8, |
| 23 | |
| 24 | Offset (0x3F), |
| 25 | GC50,8, GC51,8, GC52,8, GC53,8, GC54,8, GC55,8, GC56,8, GC57,8, |
| 26 | GC60,8, GC61,8, |
| 27 | |
| 28 | Offset (0x4B), |
| 29 | GP_1,8, GP_2,8, GP_3,8, GP_4,8, GP_5,8, GP_6,8, |
| 30 | Offset (0x56), FAN1,8, |
| 31 | Offset (0x5D), LED1,8, LED2,8, |
| 32 | } |
| 33 | |
| 34 | OperationRegion (SMC1, SystemIO, 0x2E, 0x02) |
| 35 | Field (SMC1, ByteAcc, NoLock, Preserve) |
| 36 | { |
| 37 | INDX, 8, DATA, 8 |
| 38 | } |
| 39 | |
| 40 | IndexField (INDX, DATA, ByteAcc, NoLock, Preserve) |
| 41 | { |
| 42 | Offset (0x07), LDN, 8, |
| 43 | Offset (0x22), PWRC, 8, |
| 44 | Offset (0x30), ACTR, 8, |
| 45 | Offset (0x60), |
| 46 | IOAH, 8, IOAL, 8, |
| 47 | IOBH, 8, IOBL, 8, |
| 48 | |
| 49 | Offset (0x70), INTR, 8, |
| 50 | Offset (0x72), INT1, 8, |
| 51 | Offset (0x74), DMCH, 8, |
| 52 | Offset (0xB2), SPS1, 8, SPS2, 8, |
| 53 | Offset (0xB8), D2TS, 8, |
| 54 | Offset (0xF0), OPT1, 8, OPT2, 8, OPT3, 8, |
| 55 | Offset (0xF4), WDTC, 8, |
| 56 | Offset (0xF6), GP01, 8, GP02, 8, GP04, 8 |
| 57 | } |
| 58 | |
| 59 | Method (ECFG, 0, NotSerialized) |
| 60 | { |
| 61 | Store (0x55, INDX) |
| 62 | } |
| 63 | Method (XCFG, 0, NotSerialized) |
| 64 | { |
| 65 | Store (0xAA, INDX) |
| 66 | } |
| 67 | |
| 68 | Method (_CRS, 0, NotSerialized) |
| 69 | { |
| 70 | CreateWordField (MSBF, \_SB.PCI0.ICH0.SMSC._Y1B._MIN, IOM1) |
| 71 | CreateWordField (MSBF, \_SB.PCI0.ICH0.SMSC._Y1B._MAX, IOM2) |
| 72 | CreateByteField (MSBF, \_SB.PCI0.ICH0.SMSC._Y1B._LEN, IOML) |
| 73 | |
| 74 | ECFG () |
| 75 | Store (0x0A, \_SB.PCI0.ICH0.SMSC.LDN) |
| 76 | Store (0x00, IOM1) |
| 77 | Store (0x00, IOM2) |
| 78 | Or (\_SB.PCI0.ICH0.SMSC.IOAH, IOM1, IOM1) |
| 79 | ShiftLeft (IOM1, 0x08, IOM1) |
| 80 | Or (\_SB.PCI0.ICH0.SMSC.IOAL, IOM1, IOM1) |
| 81 | Store (IOM1, IOM2) |
Felix Singer | 7d8df61 | 2022-01-02 02:57:02 +0100 | [diff] [blame^] | 82 | If (IOM1 != 0) |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 83 | { |
| 84 | Store (0x80, IOML) |
| 85 | } |
| 86 | XCFG () |
| 87 | |
| 88 | Return (MSBF) |
| 89 | } |
| 90 | |
| 91 | |
| 92 | Method (_INI, 0, NotSerialized) |
| 93 | { |
| 94 | /* GPIO configuration */ |
| 95 | Store (0x00, GC10) |
| 96 | Store (0x81, GC11) |
| 97 | Store (0x00, GC17) |
| 98 | Store (0x0c, GC21) |
| 99 | Store (0x00, GC22) |
| 100 | Store (0x04, GC27) |
| 101 | Store (0x04, GC30) |
| 102 | Store (0x01, GC31) |
| 103 | Store (0x01, GC32) |
| 104 | Store (0x01, GC33) |
| 105 | Store (0x01, GC34) /* GPI password jumper */ |
| 106 | Store (0x01, GC35) /* GPI scsi enable jumper */ |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 107 | Store (0x01, GC42) /* GPI */ |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 108 | Store (0x86, GC60) /* led 1 */ |
| 109 | Store (0x81, GC61) /* led 2 ?? */ |
| 110 | |
| 111 | /* GPIO initial output levels */ |
| 112 | Store (GP_1, Local0) |
| 113 | And( Local0, 0x7C, Local0) |
| 114 | Or ( Local0, 0x81, Local0) |
| 115 | Store (Local0, GP_1) |
| 116 | |
| 117 | Store (GP_2, Local0) |
| 118 | And( Local0, 0xFE, Local0) |
| 119 | Or ( Local0, 0x00, Local0) |
| 120 | Store (Local0, GP_2) |
| 121 | |
| 122 | Store (GP_3, Local0) |
| 123 | And( Local0, 0x7F, Local0) |
| 124 | Or ( Local0, 0x80, Local0) |
| 125 | Store (Local0, GP_3) |
| 126 | |
| 127 | Store (GP_4, Local0) |
| 128 | And( Local0, 0x7F, Local0) |
| 129 | Or ( Local0, 0x00, Local0) |
| 130 | Store (Local0, GP_4) |
| 131 | |
| 132 | /* Power Led */ |
| 133 | Store (LED1, Local0) |
| 134 | And( Local0, 0xfc, Local0) |
| 135 | Or ( Local0, 0x01, Local0) |
| 136 | Store (Local0, LED1) |
| 137 | |
| 138 | } |
| 139 | |
| 140 | Method (MLED, 1, NotSerialized) |
| 141 | { |
| 142 | If (LEqual (Arg0, 0x00)) |
| 143 | { |
| 144 | Store (0x00, LED1) |
| 145 | } |
| 146 | |
Felix Singer | ca1b2a5 | 2021-12-31 13:24:35 +0100 | [diff] [blame] | 147 | If (LEqual (Arg0, 0x01) || LEqual (Arg0, 0x02)) |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 148 | { |
| 149 | Store (0x01, LED1) |
| 150 | } |
| 151 | |
| 152 | If (LEqual (Arg0, 0x03)) |
| 153 | { |
| 154 | Store (0x02, LED1) |
| 155 | } |
| 156 | |
Felix Singer | ca1b2a5 | 2021-12-31 13:24:35 +0100 | [diff] [blame] | 157 | If (LEqual (Arg0, 0x04) || LEqual (Arg0, 0x05)) |
Kyösti Mälkki | 9116270 | 2011-11-03 15:22:01 +0200 | [diff] [blame] | 158 | { |
| 159 | Store (0x03, LED1) |
| 160 | } |
| 161 | } |