1/* SPDX-License-Identifier: GPL-2.0-only */ 2 3// Scope is \_SB.PCI0.LPCB 4 5Device (SIO) { 6 Name (_ADR, 0x2E) 7 OperationRegion (SIOA, SystemIO, 0x2E, 0x02) 8 Field (SIOA, ByteAcc, NoLock, Preserve) 9 { 10 SI2E, 8, 11 SI2F, 8, 12 } 13 14 IndexField (SI2E, SI2F, ByteAcc, NoLock, Preserve) 15 { 16 Offset (0x02), 17 SCNT, 8, /* Configure Control */ 18 Offset (0x07), 19 SLDN, 8, /* Logical Device Number */ 20 Offset (0x30), 21 SACT, 8, /* Activate */ 22 Offset (0x60), 23 IO0H, 8, /* Base Address 0 MSB */ 24 IO0L, 8, /* Base Address 0 LSB */ 25 Offset (0x62), 26 IO1H, 8, /* Base Address 1 MSB */ 27 IO1L, 8, /* Base Address 1 LSB */ 28 Offset (0x70), 29 IQ00, 8, /* Interrupt Select */ 30 } 31 32 Name (SFDC, 0) /* Floppy Disk Controller */ 33 Name (SSP1, 1) /* Serial Port 1 */ 34 Name (SENV, 4) /* Environment Controller */ 35 Name (SKBC, 5) /* Keyboard */ 36 Name (SKBM, 6) /* Mouse */ 37 Name (SGPI, 7) /* GPIO */ 38 Name (SINF, 10) /* Consumer IR */ 39 40 Method (ENTR, 0, NotSerialized) 41 { 42 SI2E = 0x87 43 SI2E = 0x01 44 SI2E = 0x55 45 SI2E = 0x55 46 } 47 48 Method (EXIT, 0, NotSerialized) 49 { 50 SCNT = 0x02 51 } 52 53 /* Parse activate register for an LDN */ 54 Method (ISEN, 1, NotSerialized) 55 { 56 ENTR () 57 SLDN = Arg0 58 Local0 = SACT 59 EXIT () 60 61 /* Check if it exists */ 62 If (Local0 == 0xFF) 63 { 64 Return (0x00) 65 } 66 67 /* Check if activated */ 68 If (Local0 == 1) 69 { 70 Return (0x0F) 71 } 72 Else 73 { 74 Return (0x0D) 75 } 76 } 77 78 /* Enable an LDN via the activate register */ 79 Method (SENA, 1, NotSerialized) 80 { 81 ENTR () 82 SLDN = Arg0 83 SACT = 1 84 EXIT () 85 } 86 87 /* Disable an LDN via the activate register */ 88 Method (SDIS, 1, NotSerialized) 89 { 90 ENTR () 91 SLDN = Arg0 92 SACT = 0 93 EXIT () 94 } 95 96#ifdef SIO_ENABLE_ENVC 97 Device (ENVC) { 98 Name (_HID, EISAID ("PNP0C02")) 99 Name (_UID, 10) 100 101 Method (_STA, 0, NotSerialized) { 102 Return (ISEN (SENV)) 103 } 104 105 Name (_CRS, ResourceTemplate () 106 { 107 IO (Decode16, SIO_ENVC_IO0, SIO_ENVC_IO0, 0x08, 0x08) 108 IO (Decode16, SIO_ENVC_IO1, SIO_ENVC_IO1, 0x04, 0x04) 109 }) 110 111 OperationRegion (ECAP, SystemIO, SIO_ENVC_IO0, 0x07) 112 Field (ECAP, ByteAcc, NoLock, Preserve) 113 { 114 Offset (0x05), 115 ECAI, 8, // Address Index Register 116 ECAD, 8, // Address Data Register 117 } 118 119 // Registers for thermal zone implementations 120 IndexField (ECAI, ECAD, ByteAcc, NoLock, Preserve) 121 { 122 Offset (0x29), 123 TIN1, 8, // TMPIN1 Reading 124 TIN2, 8, // TMPIN2 Reading 125 TIN3, 8, // TMPIN3 Reading 126 Offset (0x6b), 127 F2PS, 8, // FAN2 PWM Setting 128 Offset (0x73), 129 F3PS, 8, // FAN3 PWM Setting 130 } 131 } 132#endif 133 134#ifdef SIO_ENABLE_GPIO 135 Device (GPIO) { 136 Name (_HID, EISAID ("PNP0C02")) 137 Name (_UID, 11) 138 139 Method (_STA, 0, NotSerialized) { 140 Return (0x0F) 141 } 142 143 Name (_CRS, ResourceTemplate () 144 { 145 IO (Decode16, SIO_GPIO_IO0, SIO_GPIO_IO0, 0x01, 0x01) 146 IO (Decode16, SIO_GPIO_IO1, SIO_GPIO_IO1, 0x08, 0x08) 147 }) 148 } 149#endif 150 151#ifdef SIO_ENABLE_COM1 152 Device (COM1) { 153 Name (_HID, EISAID ("PNP0501")) 154 Name (_UID, 1) 155 156 Method (_STA, 0, NotSerialized) { 157 Return (ISEN (SSP1)) 158 } 159 160 Name (_CRS, ResourceTemplate () 161 { 162 IO (Decode16, 0x03F8, 0x03F8, 0x08, 0x08) 163 IRQNoFlags () {4} 164 }) 165 166 } 167#endif 168 169#ifdef SIO_ENABLE_PS2K 170 Device (PS2K) // Keyboard 171 { 172 Name (_HID, EISAID("PNP0303")) 173 Name (_CID, EISAID("PNP030B")) 174 175 Method (_STA, 0, NotSerialized) { 176 Return (ISEN (SKBC)) 177 } 178 179 Name (_CRS, ResourceTemplate() 180 { 181 IO (Decode16, 0x60, 0x60, 0x01, 0x01) 182 IO (Decode16, 0x64, 0x64, 0x01, 0x01) 183 IRQNoFlags () {1} 184 }) 185 186 } 187#endif 188 189#ifdef SIO_ENABLE_PS2M 190 Device (PS2M) // Mouse 191 { 192 Name (_HID, EISAID("PNP0F13")) 193 194 Method (_STA, 0, NotSerialized) { 195 Return (ISEN (SKBM)) 196 } 197 198 Name (_CRS, ResourceTemplate() 199 { 200 IRQNoFlags () {12} 201 }) 202 203 } 204#endif 205 206#ifdef SIO_ENABLE_FDC0 207 Device (FDC0) // Floppy controller 208 { 209 Name (_HID, EISAID ("PNP0700")) 210 211 Method (_STA, 0, NotSerialized) { 212 Return (ISEN (SFDC)) 213 } 214 215 Name (_CRS, ResourceTemplate() 216 { 217 IO (Decode16, 0x03F0, 0x03F0, 0x01, 0x06) 218 IO (Decode16, 0x03F7, 0x03F7, 0x01, 0x01) 219 IRQNoFlags () {6} 220 DMA (Compatibility, NotBusMaster, Transfer8) {2} 221 }) 222 223 } 224#endif 225 226#ifdef SIO_ENABLE_INFR 227 Device (INFR) // Infrared controller 228 { 229 Name (_HID, EISAID ("PNP0510")) 230 231 Method (_STA, 0, NotSerialized) { 232 Return (ISEN (SINF)) 233 } 234 235 Name (_CRS, ResourceTemplate() 236 { 237 IO (Decode16, SIO_INFR_IO0, SIO_INFR_IO0, 0x08, 0x08) 238 IRQNoFlags () { SIO_INFR_IRQ } 239 }) 240 241 } 242#endif 243} 244