Felix Held | 3f3eca9 | 2020-01-23 17:12:32 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Christoph Grenz | 8ae574c | 2011-09-18 22:53:18 +0200 | [diff] [blame] | 2 | |
| 3 | /* |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 4 | * include this file into a mainboard's DSDT _SB device tree and it will expose the |
| 5 | * W83627HF SuperIO and its functionality. |
Christoph Grenz | 8ae574c | 2011-09-18 22:53:18 +0200 | [diff] [blame] | 6 | * |
Martin Roth | 2ed0aa2 | 2016-01-05 20:58:58 -0700 | [diff] [blame] | 7 | * Devices are marked as nonexistent if they got 0x00000000 as I/O base address |
Christoph Grenz | 8ae574c | 2011-09-18 22:53:18 +0200 | [diff] [blame] | 8 | * (compatibility with legacy bios, which disables logical devices that way) |
| 9 | * |
| 10 | * It allows the change of IO ports, IRQs and DMA settings on most logical |
| 11 | * devices, disabling and reenabling logical devices and controlling power |
| 12 | * saving mode on logical devices or the whole chip. |
| 13 | * |
| 14 | * Notes: |
| 15 | * - ECP mode of parallel port not implemented, DMA settings of parallel port |
| 16 | * will be reset on DSDT init |
| 17 | * - Hardware monitor is only shown as "Motherboard Resource", shows no real |
| 18 | * functionality |
| 19 | * |
| 20 | * Controllable through preprocessor macros: |
| 21 | * NO_W83627HF_FDC: don't expose the floppy disk controller |
| 22 | * NO_W83627HF_FDC_ENUM: don't try to enumerate the connected floppy drives |
| 23 | * NO_W83627HF_PPORT: don't expose the parallel port |
| 24 | * NO_W83627HF_UARTA: don't expose the first serial port |
| 25 | * NO_W83627HF_UARTB: don't expose the second serial port (already hidden |
| 26 | * if UARTB is configured as IRDA port by firmware) |
| 27 | * NO_W83627HF_IRDA: don't expose the IRDA port (already hidden if UARTB is |
| 28 | * configured as serial port by firmware) |
| 29 | * NO_W83627HF_CIR: don't expose the Consumer Infrared functionality |
| 30 | * NO_W83627HF_KBC: don't expose the keyboard controller |
| 31 | * NO_W83627HF_PS2M: don't expose the PS/2 mouse functionality of the |
| 32 | * keyboard controller |
| 33 | * NO_W83627HF_GAME: don't expose the game port |
| 34 | * NO_W83627HF_MIDI: don't expose the MIDI port |
| 35 | * NO_W83627HF_HWMON: don't expose the hardware monitor as |
Martin Roth | 26f97f9 | 2021-10-01 14:53:22 -0600 | [diff] [blame] | 36 | * PnP "Motherboard Resource" |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 37 | * W83627HF_KBC_COMPAT: show the keyboard controller and the PS/2 mouse as |
| 38 | * enabled if it is disabled but an address is assigned |
Martin Roth | 26f97f9 | 2021-10-01 14:53:22 -0600 | [diff] [blame] | 39 | * to it. This may be necessary in some cases. |
Christoph Grenz | 8ae574c | 2011-09-18 22:53:18 +0200 | [diff] [blame] | 40 | * |
| 41 | * Datasheet: "W83627HF/F WINBOND I/O" rev. 6.0 |
| 42 | * http://www.itox.com/pages/support/wdt/W83627HF.pdf |
| 43 | */ |
| 44 | |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 45 | #include <superio/acpi/pnp.asl> |
| 46 | |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 47 | Device(SIO) { |
| 48 | Name (_HID, EisaId("PNP0A05")) |
| 49 | Name (_STR, Unicode("Winbond W83627HF SuperIO")) |
| 50 | Name (_UID, "w83627hf") |
Christoph Grenz | 8ae574c | 2011-09-18 22:53:18 +0200 | [diff] [blame] | 51 | |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 52 | /* Mutex for accesses to the configuration ports (prolog and epilog commands are used, so synchronization is useful) */ |
| 53 | Mutex(CRMX, 1) |
Christoph Grenz | 8ae574c | 2011-09-18 22:53:18 +0200 | [diff] [blame] | 54 | |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 55 | /* SuperIO configuration ports */ |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 56 | OperationRegion (CREG, SystemIO, SUPERIO_PNP_BASE, 0x02) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 57 | Field (CREG, ByteAcc, NoLock, Preserve) |
| 58 | { |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 59 | PNP_ADDR_REG, 8, |
| 60 | PNP_DATA_REG, 8 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 61 | } |
Elyes HAOUAS | 007af42 | 2019-11-03 14:31:35 +0100 | [diff] [blame] | 62 | IndexField (PNP_ADDR_REG, PNP_DATA_REG, ByteAcc, NoLock, Preserve) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 63 | { |
| 64 | Offset (0x02), |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 65 | RST, 1, /* Soft reset */ |
| 66 | , 7, |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 67 | Offset (0x07), |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 68 | LDN, 8, /* Logical device selector */ |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 69 | Offset (0x20), |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 70 | DID, 8, /* Device ID */ |
| 71 | DREV, 8, /* Device Revision */ |
| 72 | FDPW, 1, /* FDC Power Down */ |
| 73 | , 2, |
| 74 | PRPW, 1, /* PRT Power Down */ |
| 75 | UAPW, 1, /* UART A Power Down */ |
| 76 | UBPW, 1, /* UART B Power Down */ |
| 77 | HWPW, 1, /* HWM Power Down */ |
| 78 | , 1, |
| 79 | IPD, 1, /* Immediate Chip Power Down */ |
| 80 | , 7, |
| 81 | PNPS, 1, /* PnP Address Select Register Default Value Mode */ |
| 82 | , 1, |
| 83 | KBCR, 1, /* KBC enabled after system reset (read-only) */ |
| 84 | , 3, |
| 85 | CLKS, 1, /* Clock select */ |
| 86 | AQ16, 1, /* 16bit Address Qualification */ |
| 87 | FDCT, 1, /* Tristate FDC (?) */ |
| 88 | , 2, |
| 89 | PRTT, 1, /* Tristate parallel port (?) */ |
| 90 | URAT, 1, /* Tristate UART A (?) */ |
| 91 | URBT, 1, /* Tristate UART B (?) */ |
| 92 | , 2, |
| 93 | URAI, 1, /* UART A Legacy IRQ Select Disable */ |
| 94 | URBI, 1, /* UART B Legacy IRQ Select Disable */ |
| 95 | PRTI, 1, /* Parallel Port Legacy IRQ/DRQ Select Disable */ |
| 96 | FDCI, 1, /* FDC Legacy IRQ/DRQ Select Disable */ |
| 97 | , 1, |
| 98 | LCKC, 1, /* Lock Configuration Registers */ |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 99 | Offset (0x29), |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 100 | IO3S, 8, /* GPIO3 pin selection register */ |
Nico Huber | f66dd69 | 2013-07-03 12:07:43 +0200 | [diff] [blame] | 101 | Offset (0x30), |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 102 | ACTR, 1, /* Logical device activation */ |
| 103 | ACT1, 1, /* Logical part activation 1 (mostly unused) */ |
| 104 | ACT2, 1, /* Logical part activation 2 (mostly unused) */ |
| 105 | , 5, |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 106 | Offset (0x60), |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 107 | IO1H, 8, /* First I/O port base - high byte */ |
| 108 | IO1L, 8, /* First I/O port base - low byte */ |
| 109 | IO2H, 8, /* Second I/O port base - high byte */ |
| 110 | IO2L, 8, /* Second I/O port base - low byte */ |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 111 | Offset (0x70), |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 112 | IRQ0, 8, /* First IRQ */ |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 113 | Offset (0x72), |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 114 | IRQ1, 8, /* First IRQ */ |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 115 | Offset (0x74), |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 116 | DMA0, 8, /* DMA */ |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 117 | Offset (0xE0), |
Martin Roth | 26f97f9 | 2021-10-01 14:53:22 -0600 | [diff] [blame] | 118 | /* CRE0-CRE4: function logical device dependent, seems to be reserved for ACPI settings */ |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 119 | CRE0, 8, |
| 120 | CRE1, 8, |
| 121 | CRE2, 8, |
| 122 | CRE3, 8, |
| 123 | CRE4, 8, |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 124 | Offset (0xF0), |
Martin Roth | 26f97f9 | 2021-10-01 14:53:22 -0600 | [diff] [blame] | 125 | /* OPT1-OPTA aka CRF0-CRF9: function logical device dependent */ |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 126 | OPT1, 8, |
| 127 | OPT2, 8, |
| 128 | OPT3, 8, |
| 129 | OPT4, 8, |
| 130 | OPT5, 8, |
| 131 | OPT6, 8, |
| 132 | OPT7, 8, |
| 133 | OPT8, 8, |
| 134 | OPT9, 8, |
| 135 | OPTA, 8 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 136 | } |
Christoph Grenz | 8ae574c | 2011-09-18 22:53:18 +0200 | [diff] [blame] | 137 | |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 138 | Method (_CRS) |
| 139 | { |
| 140 | Return (ResourceTemplate () { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 141 | /* Announce the used I/O ports to the OS */ |
| 142 | IO (Decode16, SUPERIO_PNP_BASE, SUPERIO_PNP_BASE, 0x02, 0x01) |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 143 | }) |
| 144 | } |
Christoph Grenz | 8ae574c | 2011-09-18 22:53:18 +0200 | [diff] [blame] | 145 | |
Martin Roth | 26f97f9 | 2021-10-01 14:53:22 -0600 | [diff] [blame] | 146 | /* Enter configuration mode (and acquire mutex) |
Elyes HAOUAS | 89c05c5 | 2021-02-09 14:18:19 +0100 | [diff] [blame] | 147 | Method must be run before accessing the configuration region. |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 148 | Parameter is the LDN which should be accessed. Values >= 0xFF mean |
| 149 | no LDN switch should be done. |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 150 | */ |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 151 | Method (ENTER_CONFIG_MODE, 1) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 152 | { |
| 153 | Acquire (CRMX, 0xFFFF) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 154 | ADDR = 0x87 |
| 155 | ADDR = 0x87 |
Felix Singer | d67ed59 | 2022-01-02 01:42:31 +0100 | [diff] [blame] | 156 | If (Arg0 < 0xFF) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 157 | LDN = Arg0 |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 158 | } |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 159 | } |
Christoph Grenz | 8ae574c | 2011-09-18 22:53:18 +0200 | [diff] [blame] | 160 | |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 161 | /* Exit configuration mode (and release mutex) |
| 162 | Method must be run after accessing the configuration region. |
| 163 | */ |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 164 | Method (EXIT_CONFIG_MODE) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 165 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 166 | ADDR = 0xAA |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 167 | Release (CRMX) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 168 | } |
Christoph Grenz | 8ae574c | 2011-09-18 22:53:18 +0200 | [diff] [blame] | 169 | |
Nico Huber | 79dfa90 | 2020-03-22 01:17:54 +0100 | [diff] [blame] | 170 | /* PM: indicate IPD (Immediate Power Down) bit state as D0/D3 */ |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 171 | Method (_PSC) { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 172 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 173 | Local0 = IPD |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 174 | EXIT_CONFIG_MODE () |
Nico Huber | 79dfa90 | 2020-03-22 01:17:54 +0100 | [diff] [blame] | 175 | If (Local0) { Return (3) } |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 176 | Else { Return (0) } |
| 177 | } |
Christoph Grenz | 8ae574c | 2011-09-18 22:53:18 +0200 | [diff] [blame] | 178 | |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 179 | /* PM: Switch to D0 by setting IPD low */ |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 180 | Method (_PS0) { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 181 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 182 | IPD = Zero |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 183 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 184 | } |
| 185 | |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 186 | /* PM: Switch to D3 by setting IPD high */ |
Nico Huber | 79dfa90 | 2020-03-22 01:17:54 +0100 | [diff] [blame] | 187 | Method (_PS3) { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 188 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 189 | IPD = One |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 190 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | #ifndef NO_W83627HF_FDC |
| 194 | /* =================== Floppy Disk Controller ================ */ |
| 195 | Device (FDC0) { |
| 196 | Name (_HID, EisaId ("PNP0700")) |
| 197 | Name (_STR, Unicode ("W83627HF Floppy Disk Controller")) |
| 198 | Name (_UID, "w83627hf-fdc") |
| 199 | |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 200 | Method (_STA) |
| 201 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 202 | Local0 = 0x00 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 203 | ENTER_CONFIG_MODE (0) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 204 | If (ACTR) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 205 | Local0 = 0x0F |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 206 | } |
Felix Singer | 5a303b0 | 2021-12-31 13:12:16 +0100 | [diff] [blame] | 207 | ElseIf (IO1H || IO1L) |
Christoph Grenz | 8ae574c | 2011-09-18 22:53:18 +0200 | [diff] [blame] | 208 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 209 | Local0 = 0x0D |
Christoph Grenz | 8ae574c | 2011-09-18 22:53:18 +0200 | [diff] [blame] | 210 | } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 211 | EXIT_CONFIG_MODE () |
Christoph Grenz | b9da3cd | 2011-10-19 02:25:08 +0200 | [diff] [blame] | 212 | Return (Local0) |
| 213 | } |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 214 | |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 215 | /* Current power state (Returns 1 if LDN in power saving mode, |
| 216 | * 2 if whole chip is powered down), 0 else |
| 217 | */ |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 218 | Method (_PSC) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 219 | Local0 = ^^_PSC () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 220 | If (Local0) { Return (Local0) } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 221 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 222 | Local0 = FDPW |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 223 | EXIT_CONFIG_MODE () |
Nico Huber | 79dfa90 | 2020-03-22 01:17:54 +0100 | [diff] [blame] | 224 | If (Local0) { Return (3) } |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 225 | Else { Return (0) } |
| 226 | } |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 227 | /* Disable power saving mode */ |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 228 | Method (_PS0) { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 229 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 230 | FDPW = One |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 231 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 232 | } |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 233 | /* Enable power saving mode */ |
Nico Huber | 79dfa90 | 2020-03-22 01:17:54 +0100 | [diff] [blame] | 234 | Method (_PS3) { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 235 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 236 | FDPW = Zero |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 237 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | Method (_DIS) |
| 241 | { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 242 | ENTER_CONFIG_MODE (0) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 243 | ACTR = Zero |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 244 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | Method (_CRS) |
| 248 | { |
| 249 | Name (CRS, ResourceTemplate () { |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 250 | IO (Decode16, 0x0000, 0x0000, 0x01, 0x07, IO0) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 251 | IRQNoFlags () {6} |
| 252 | DMA (Compatibility, NotBusMaster, Transfer8) {2} |
| 253 | }) |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 254 | |
| 255 | /* Get IO port info */ |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 256 | ENTER_CONFIG_MODE (0) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 257 | Local0 = IO1L |
| 258 | Local1 = IO1H |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 259 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 260 | |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 261 | /* Calculate full IO port address */ |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 262 | Local0 |= Local1 << 8 |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 263 | |
| 264 | /* Modify the resource template and return it */ |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 265 | CreateWordField (CRS, IO0._MIN, IMIN) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 266 | CreateWordField (CRS, IO0._MAX, IMAX) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 267 | IMIN = Local0 |
| 268 | IMAX = Local0 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 269 | Return (CRS) |
| 270 | } |
| 271 | |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 272 | Method (_PRS) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 273 | { |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 274 | Return (ResourceTemplate () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 275 | { |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 276 | StartDependentFnNoPri () |
| 277 | { |
| 278 | IO (Decode16, 0x03F0, 0x03F0, 0x01, 0x07) |
| 279 | IRQNoFlags () {6} |
| 280 | DMA (Compatibility, NotBusMaster, Transfer8) {2} |
| 281 | } |
| 282 | EndDependentFn () |
| 283 | }) |
| 284 | } |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 285 | |
| 286 | #ifndef NO_W83627HF_FDC_ENUM |
Christoph Grenz | 7037840 | 2013-07-04 03:06:26 +0200 | [diff] [blame] | 287 | Method (_FDE, 0) { |
| 288 | /* Try probing drives. |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 289 | Probing is done through selecting and activating a drive |
| 290 | and reading 0x03F7 aka the "shared IDE and floppy register" |
| 291 | as any value there besides zero seems to indicate a |
| 292 | connected drive. |
| 293 | */ |
Christoph Grenz | 7037840 | 2013-07-04 03:06:26 +0200 | [diff] [blame] | 294 | // Create template |
| 295 | Name(FDE, Buffer(){0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}) |
| 296 | CreateByteField (FDE, 1, FD1) |
| 297 | CreateByteField (FDE, 4, FD2) |
| 298 | CreateByteField (FDE, 8, FD3) |
| 299 | CreateByteField (FDE, 12, FD4) |
| 300 | |
| 301 | // Get resources from logical device |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 302 | ENTER_CONFIG_MODE (0) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 303 | Local0 = ACTR |
| 304 | Local1 = IO1H |
| 305 | Local2 = IO1L |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 306 | EXIT_CONFIG_MODE () |
Felix Singer | 3c9291b | 2022-12-16 02:43:56 +0100 | [diff] [blame] | 307 | Local1 <<= 8 |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 308 | Local1 |= Local2 |
Felix Singer | 1a6925c | 2021-12-31 14:35:35 +0100 | [diff] [blame] | 309 | If (!Local0) { |
Christoph Grenz | 7037840 | 2013-07-04 03:06:26 +0200 | [diff] [blame] | 310 | Return (FDE) |
| 311 | } |
| 312 | |
| 313 | OperationRegion (FIO1, SystemIO, Local1, 0x06) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 314 | Field (FIO1, ByteAcc, NoLock, Preserve) |
| 315 | { |
| 316 | Offset(0x02), |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 317 | SELE, 2, |
| 318 | RSTL, 1, |
| 319 | IDMA, 1, |
| 320 | ACT1, 1, |
| 321 | ACT2, 1, |
| 322 | ACT3, 1, |
| 323 | ACT4, 1, |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 324 | Offset(0x04), |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 325 | BSY1, 1, |
| 326 | BSY2, 1, |
| 327 | BSY3, 1, |
| 328 | BSY4, 1, |
| 329 | BUSY, 1, |
| 330 | NDMA, 1, |
| 331 | IODI, 1, |
| 332 | RDY, 1, |
| 333 | DATA, 8, |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 334 | } |
| 335 | OperationRegion (FIO2, SystemIO, 0x3F7, 0x01) |
Christoph Grenz | 0bd5dff | 2013-07-04 02:54:04 +0200 | [diff] [blame] | 336 | Field (FIO2, ByteAcc, NoLock, Preserve) |
| 337 | { |
| 338 | SIFR, 8 |
| 339 | } |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 340 | |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 341 | ACT1 = One |
| 342 | SELE = 0 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 343 | Sleep(0x64) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 344 | If (SIFR) { FD1 = One } |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 345 | |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 346 | ACT1 = Zero |
| 347 | ACT2 = One |
| 348 | SELE = 1 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 349 | Sleep(0x64) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 350 | If (SIFR) { FD2 = One } |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 351 | |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 352 | ACT2 = Zero |
| 353 | ACT3 = One |
| 354 | SELE = 2 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 355 | Sleep(0x64) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 356 | If (SIFR) { FD3 = One } |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 357 | |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 358 | ACT3 = Zero |
| 359 | ACT4 = One |
| 360 | SELE = 3 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 361 | Sleep(0x64) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 362 | If (SIFR) { FD4 = One } |
| 363 | ACT4 = Zero |
| 364 | SELE = Zero |
Christoph Grenz | 7037840 | 2013-07-04 03:06:26 +0200 | [diff] [blame] | 365 | |
| 366 | Return (FDE) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 367 | } |
Christoph Grenz | 7037840 | 2013-07-04 03:06:26 +0200 | [diff] [blame] | 368 | #endif |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 369 | |
| 370 | |
| 371 | Method (_SRS, 1, Serialized) |
| 372 | { |
| 373 | Name (TMPL, ResourceTemplate () { |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 374 | IO (Decode16, 0, 0, 1, 7, IO0) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 375 | IRQNoFlags (IRQ0) {} |
| 376 | DMA (Compatibility, NotBusMaster, Transfer8, DMA0) {} |
| 377 | }) |
| 378 | CreateWordField (Arg0, IO0._MIN, IOA0) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 379 | CreateByteField (Arg0, IRQ0._INT, IRQL) |
| 380 | CreateByteField (Arg0, DMA0._DMA, DMCH) |
| 381 | |
| 382 | Divide(IOA0, 256, Local0, Local1) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 383 | |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 384 | ENTER_CONFIG_MODE (0) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 385 | IO1L = Local0 |
| 386 | IO1H = Local1 |
| 387 | ACTR = One |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 388 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 389 | } |
| 390 | } |
| 391 | #endif |
| 392 | |
| 393 | #ifndef NO_W83627HF_PPORT |
| 394 | /* ======================== Parallel Port ======================== */ |
| 395 | /* Currently no ECP support */ |
| 396 | Device (PAR0) { |
| 397 | Name (_HID, EisaId ("PNP0400")) |
| 398 | Name (_DDN, "LPT1") |
| 399 | Name (_UID, "w83627hf-pport") |
| 400 | |
| 401 | Method (MODE, 1) { |
Felix Singer | 35e65a8 | 2022-12-16 07:11:17 +0100 | [diff] [blame^] | 402 | Local0 = Arg0 & 7 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 403 | ENTER_CONFIG_MODE (1) |
Felix Singer | 35e65a8 | 2022-12-16 07:11:17 +0100 | [diff] [blame^] | 404 | Local1 = OPT1 & 3 |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 405 | OPT1 = Local1 | Local0 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 406 | EXIT_CONFIG_MODE() |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 407 | } |
| 408 | |
| 409 | Method (_INI) |
| 410 | { |
| 411 | /* Deactivate DMA, even if set by BIOS. We don't announce it |
| 412 | through _CRS and it's only useful in ECP mode which we |
| 413 | don't support at the moment. */ |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 414 | ENTER_CONFIG_MODE (1) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 415 | DMA0 = 0x04 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 416 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 417 | } |
| 418 | |
| 419 | Method (_STA) |
| 420 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 421 | Local0 = 0x00 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 422 | ENTER_CONFIG_MODE (1) |
Felix Singer | 35e65a8 | 2022-12-16 07:11:17 +0100 | [diff] [blame^] | 423 | Local1 = OPT1 & 3 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 424 | If (ACTR) { |
Felix Singer | 3cfbe8a | 2022-01-02 02:44:04 +0100 | [diff] [blame] | 425 | If (Local1 != 2) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 426 | Local0 = 0x0D |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 427 | } Else { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 428 | Local0 = 0x0D |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 429 | } |
| 430 | } |
Felix Singer | 5a303b0 | 2021-12-31 13:12:16 +0100 | [diff] [blame] | 431 | ElseIf (IO1H || IO1L) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 432 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 433 | Local0 = 0x0D |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 434 | } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 435 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 436 | Return (Local0) |
| 437 | } |
| 438 | |
| 439 | Method (_PSC) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 440 | Local0 = ^^_PSC () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 441 | If (Local0) { Return (Local0) } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 442 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 443 | Local0 = PRPW |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 444 | EXIT_CONFIG_MODE () |
Nico Huber | 79dfa90 | 2020-03-22 01:17:54 +0100 | [diff] [blame] | 445 | If (Local0) { Return (3) } |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 446 | Else { Return (0) } |
| 447 | } |
| 448 | Method (_PS0) { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 449 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 450 | PRPW = One |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 451 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 452 | } |
Nico Huber | 79dfa90 | 2020-03-22 01:17:54 +0100 | [diff] [blame] | 453 | Method (_PS3) { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 454 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 455 | PRPW = Zero |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 456 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 457 | } |
| 458 | |
| 459 | Method (_DIS) { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 460 | ENTER_CONFIG_MODE (1) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 461 | ACTR = Zero |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 462 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 463 | } |
| 464 | |
| 465 | Method (_CRS) |
| 466 | { |
| 467 | Name (CRS, ResourceTemplate () |
| 468 | { |
| 469 | IO (Decode16, 0x0000, 0x0000, 0x04, 0x08, IO0) |
| 470 | IRQNoFlags (IRQX) {} |
| 471 | }) |
| 472 | CreateWordField (CRS, IO0._MIN, IOP0) |
| 473 | CreateWordField (CRS, IO0._MAX, IOR0) |
| 474 | CreateByteField (CRS, IO0._ALN, IOAL) |
| 475 | CreateByteField (CRS, IO0._LEN, IOLE) |
| 476 | CreateWordField (CRS, IRQX._INT, IRQW) |
| 477 | |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 478 | /* Get device settings */ |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 479 | ENTER_CONFIG_MODE (1) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 480 | Local0 = IO1L |
| 481 | Local1 = IO1H |
| 482 | Local2 = OPT1 |
| 483 | Local5 = IRQ0 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 484 | EXIT_CONFIG_MODE () |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 485 | /* Calculate IO port and modify template */ |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 486 | Local0 |= Local1 << 8 |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 487 | IOP0 = Local1 |
| 488 | IOR0 = Local1 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 489 | |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 490 | /* Set align and length based on active parallel port mode */ |
Felix Singer | 35e65a8 | 2022-12-16 07:11:17 +0100 | [diff] [blame^] | 491 | Local3 = Local2 & 3 |
| 492 | Local4 = Local2 & 4 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 493 | If (Local4) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 494 | IOAL = 0x04 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 495 | } |
Felix Singer | 3f37d7a | 2022-01-02 00:31:21 +0100 | [diff] [blame] | 496 | If (Local0 == 0xBC) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 497 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 498 | IOLE = 0x04 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 499 | } |
| 500 | Else |
| 501 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 502 | IOLE = 0x08 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 503 | } |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 504 | /* Calculate IRQ bitmap */ |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 505 | Local0 = One |
Felix Singer | 3c9291b | 2022-12-16 02:43:56 +0100 | [diff] [blame] | 506 | IRQW = Local0 << Local5 |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 507 | /* Return resource template */ |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 508 | Return (CRS) |
| 509 | } |
| 510 | |
| 511 | Name (_PRS, ResourceTemplate () |
| 512 | { |
Christoph Grenz | dda4095 | 2013-06-18 01:26:50 +0200 | [diff] [blame] | 513 | /* Traditional configurations (SPP mode) */ |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 514 | StartDependentFn (0,1) |
| 515 | { |
| 516 | IO (Decode16, 0x0378, 0x0378, 0x04, 0x08) |
| 517 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 518 | } |
| 519 | StartDependentFn (0,1) |
| 520 | { |
| 521 | IO (Decode16, 0x0278, 0x0278, 0x04, 0x08) |
| 522 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 523 | } |
| 524 | StartDependentFn (0,1) |
| 525 | { |
| 526 | IO (Decode16, 0x03BC, 0x03BC, 0x04, 0x04) |
| 527 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 528 | } |
Christoph Grenz | dda4095 | 2013-06-18 01:26:50 +0200 | [diff] [blame] | 529 | /* Traditional configurations (EPP mode) */ |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 530 | StartDependentFn (0,0) |
| 531 | { |
| 532 | IO (Decode16, 0x0378, 0x0378, 0x08, 0x08) |
| 533 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 534 | } |
| 535 | StartDependentFn (0,0) |
| 536 | { |
| 537 | IO (Decode16, 0x0278, 0x0278, 0x08, 0x08) |
| 538 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 539 | } |
Christoph Grenz | dda4095 | 2013-06-18 01:26:50 +0200 | [diff] [blame] | 540 | /* Any configurable address (EPP mode) */ |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 541 | StartDependentFn (2,0) |
| 542 | { |
Christoph Grenz | bbf0969 | 2013-07-06 17:09:39 +0200 | [diff] [blame] | 543 | IO (Decode16, 0x0100, 0x0FF8, 0x08, 0x08) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 544 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 545 | } |
Christoph Grenz | dda4095 | 2013-06-18 01:26:50 +0200 | [diff] [blame] | 546 | /* Any configurable address (No EPP mode) */ |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 547 | StartDependentFn (2,1) |
| 548 | { |
| 549 | IO (Decode16, 0x0100, 0x0FFC, 0x04, 0x08) |
| 550 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 551 | } |
| 552 | EndDependentFn () |
| 553 | }) |
| 554 | |
| 555 | Method (_SRS, 1, Serialized) |
| 556 | { |
| 557 | Name (TMPL, ResourceTemplate () { |
| 558 | IO (Decode16, 0, 0, 4, 4, IO0) |
| 559 | IRQNoFlags (IRQX) {} |
| 560 | }) |
| 561 | CreateWordField (Arg0, IO0._MIN, IOA0) |
| 562 | CreateWordField (Arg0, IO0._MIN, IOA1) |
| 563 | CreateByteField (Arg0, IO0._ALN, IOAL) |
| 564 | CreateByteField (Arg0, IO0._LEN, IOLE) |
| 565 | CreateWordField (Arg0, IRQX._INT, IRQL) |
| 566 | |
Felix Singer | 3f37d7a | 2022-01-02 00:31:21 +0100 | [diff] [blame] | 567 | If (IOAL == 4) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 568 | Local2 = 0x0 |
Elyes HAOUAS | e8fcf1b | 2020-03-30 16:47:28 +0200 | [diff] [blame] | 569 | } else { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 570 | Local2 = 0x1 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | Divide(IOA0, 256, Local0, Local1) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 574 | |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 575 | ENTER_CONFIG_MODE (1) |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 576 | /* IO port */ |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 577 | IO1L = Local0 |
| 578 | IO1H = Local1 |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 579 | /* Mode */ |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 580 | Local3 = OPT1 |
Felix Singer | 35e65a8 | 2022-12-16 07:11:17 +0100 | [diff] [blame^] | 581 | Local3 &= 0xF8 |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 582 | OPT1 = Local2 | Local3 |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 583 | /* DMA off */ |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 584 | DMA0 = 0x04 |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 585 | /* IRQ */ |
Felix Singer | f5b162e | 2021-12-30 00:21:21 +0100 | [diff] [blame] | 586 | IRQ0 = FindSetLeftBit (IRQL) - 1 |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 587 | /* Activate */ |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 588 | ACTR = One |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 589 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 590 | } |
| 591 | } |
| 592 | #endif |
| 593 | |
| 594 | #ifndef NO_W83627HF_UARTA |
| 595 | /* =========================== UART A ============================ */ |
| 596 | Device (SER0) { |
| 597 | Name (_HID, EisaId ("PNP0501")) |
| 598 | Name (_UID, "w83627hf-uarta") |
| 599 | Name (_DDN, "COM1") |
| 600 | |
| 601 | Method (_STA) |
| 602 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 603 | Local0 = 0x00 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 604 | ENTER_CONFIG_MODE (2) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 605 | If (ACTR) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 606 | Local0 = 0x0F |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 607 | } |
Felix Singer | 5a303b0 | 2021-12-31 13:12:16 +0100 | [diff] [blame] | 608 | ElseIf (IO1H || IO1L) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 609 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 610 | Local0 = 0x0D |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 611 | } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 612 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 613 | Return (Local0) |
| 614 | } |
| 615 | |
| 616 | Method (_PSC) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 617 | Local0 = ^^_PSC () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 618 | If (Local0) { Return (Local0) } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 619 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 620 | Local0 = UAPW |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 621 | EXIT_CONFIG_MODE () |
Nico Huber | 79dfa90 | 2020-03-22 01:17:54 +0100 | [diff] [blame] | 622 | If (Local0) { Return (3) } |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 623 | Else { Return (0) } |
| 624 | } |
| 625 | Method (_PS0) { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 626 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 627 | UAPW = One |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 628 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 629 | } |
Nico Huber | 79dfa90 | 2020-03-22 01:17:54 +0100 | [diff] [blame] | 630 | Method (_PS3) { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 631 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 632 | UAPW = Zero |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 633 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 634 | } |
| 635 | |
| 636 | Method (_DIS) |
| 637 | { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 638 | ENTER_CONFIG_MODE (2) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 639 | ACTR = Zero |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 640 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 641 | } |
| 642 | |
Oskar Enoksson | 42283e7 | 2014-02-11 23:19:02 +0100 | [diff] [blame] | 643 | Method (_CRS, 0, Serialized) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 644 | { |
| 645 | Name (CRS, ResourceTemplate () { |
| 646 | IO (Decode16, 0x0000, 0x0000, 0x01, 0x08, IO0) |
| 647 | IRQNoFlags (IRQX) {6} |
| 648 | }) |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 649 | ENTER_CONFIG_MODE (2) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 650 | Local0 = IO1L |
| 651 | Local1 = IO1H |
| 652 | Local2 = IRQ0 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 653 | EXIT_CONFIG_MODE () |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 654 | Local0 |= Local1 << 8 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 655 | |
| 656 | CreateWordField (CRS, IO0._MIN, IMIN) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 657 | IMIN = Local0 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 658 | CreateWordField (CRS, IO0._MAX, IMAX) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 659 | IMAX = Local0 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 660 | |
| 661 | CreateWordField (CRS, IRQX._INT, IRQW) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 662 | Local3 = One |
Felix Singer | 3c9291b | 2022-12-16 02:43:56 +0100 | [diff] [blame] | 663 | IRQW = Local3 << Local2 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 664 | |
| 665 | Return (CRS) |
| 666 | } |
| 667 | |
| 668 | Name (_PRS, ResourceTemplate () |
| 669 | { |
| 670 | StartDependentFn (0,0) { |
| 671 | IO (Decode16, 0x03F8, 0x03F8, 0x08, 0x08) |
| 672 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 673 | } |
| 674 | StartDependentFn (0,0) { |
| 675 | IO (Decode16, 0x02F8, 0x02F8, 0x08, 0x08) |
| 676 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 677 | } |
| 678 | StartDependentFn (1,0) { |
| 679 | IO (Decode16, 0x03E8, 0x03E8, 0x08, 0x08) |
| 680 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 681 | } |
| 682 | StartDependentFn (1,0) { |
| 683 | IO (Decode16, 0x02E8, 0x02E8, 0x08, 0x08) |
| 684 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 685 | } |
| 686 | StartDependentFn (2,0) { |
| 687 | IO (Decode16, 0x0100, 0x0FF8, 0x08, 0x08) |
| 688 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 689 | } |
| 690 | EndDependentFn() |
| 691 | }) |
| 692 | |
| 693 | Method (_SRS, 1, Serialized) |
| 694 | { |
| 695 | Name (TMPL, ResourceTemplate () { |
| 696 | IO (Decode16, 0, 0, 1, 6, IO0) |
| 697 | IRQNoFlags (IRQX) {} |
| 698 | }) |
| 699 | CreateWordField (Arg0, IO0._MIN, IOA0) |
Oskar Enoksson | 411bf97 | 2014-02-11 23:20:14 +0100 | [diff] [blame] | 700 | CreateWordField (Arg0, IRQX._INT, IRQL) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 701 | |
| 702 | Divide(IOA0, 256, Local0, Local1) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 703 | |
Felix Singer | f5b162e | 2021-12-30 00:21:21 +0100 | [diff] [blame] | 704 | Local3 = FindSetLeftBit (IRQL) - 1 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 705 | |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 706 | ENTER_CONFIG_MODE (2) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 707 | IO1L = Local0 |
| 708 | IO1H = Local1 |
| 709 | IRQ0 = Local3 |
| 710 | ACTR = One |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 711 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 712 | } |
| 713 | } |
| 714 | #endif |
| 715 | |
| 716 | #ifndef NO_W83627HF_UARTB |
| 717 | /* =========================== UART B ============================ */ |
| 718 | Device (SER1) { |
| 719 | Name (_HID, EisaId ("PNP0501")) |
| 720 | Name (_UID, "w83627hf-uartb") |
| 721 | Name (_DDN, "COM2") |
| 722 | |
| 723 | Method (_STA) |
| 724 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 725 | Local0 = 0x00 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 726 | ENTER_CONFIG_MODE (3) |
Felix Singer | 1a6925c | 2021-12-31 14:35:35 +0100 | [diff] [blame] | 727 | If (!And(OPT2, 0x30)) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 728 | { |
| 729 | If (ACTR) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 730 | Local0 = 0x0F |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 731 | } |
Felix Singer | 5a303b0 | 2021-12-31 13:12:16 +0100 | [diff] [blame] | 732 | ElseIf (IO1H || IO1L) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 733 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 734 | Local0 = 0x0D |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 735 | } |
| 736 | } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 737 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 738 | Return (Local0) |
| 739 | } |
| 740 | |
| 741 | Method (_PSC) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 742 | Local0 = ^^_PSC () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 743 | If (Local0) { Return (Local0) } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 744 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 745 | Local0 = UBPW |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 746 | EXIT_CONFIG_MODE () |
Nico Huber | 79dfa90 | 2020-03-22 01:17:54 +0100 | [diff] [blame] | 747 | If (Local0) { Return (3) } |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 748 | Else { Return (0) } |
| 749 | } |
| 750 | Method (_PS0) { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 751 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 752 | UBPW = One |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 753 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 754 | } |
Nico Huber | 79dfa90 | 2020-03-22 01:17:54 +0100 | [diff] [blame] | 755 | Method (_PS3) { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 756 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 757 | UBPW = Zero |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 758 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 759 | } |
| 760 | |
| 761 | Method (_DIS) |
| 762 | { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 763 | ENTER_CONFIG_MODE (3) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 764 | ACTR = Zero |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 765 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 766 | } |
| 767 | |
| 768 | Method (_CRS) |
| 769 | { |
| 770 | Name (CRS, ResourceTemplate () { |
| 771 | IO (Decode16, 0x0000, 0x0000, 0x01, 0x08, IO0) |
| 772 | IRQNoFlags (IRQX) {6} |
| 773 | }) |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 774 | ENTER_CONFIG_MODE (3) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 775 | Local0 = IO1L |
| 776 | Local1 = IO1H |
| 777 | Local2 = IRQ0 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 778 | EXIT_CONFIG_MODE () |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 779 | Local0 |= Local1 << 8 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 780 | |
| 781 | CreateWordField (CRS, IO0._MIN, IMIN) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 782 | IMIN = Local0 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 783 | CreateWordField (CRS, IO0._MAX, IMAX) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 784 | IMAX = Local0 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 785 | |
| 786 | CreateWordField (CRS, IRQX._INT, IRQW) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 787 | Local3 = One |
Felix Singer | 3c9291b | 2022-12-16 02:43:56 +0100 | [diff] [blame] | 788 | IRQW = Local3 << Local2 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 789 | |
| 790 | Return (CRS) |
| 791 | } |
| 792 | |
| 793 | Name (_PRS, ResourceTemplate () |
| 794 | { |
| 795 | StartDependentFn (0,0) { |
| 796 | IO (Decode16, 0x02F8, 0x02F8, 0x08, 0x08) |
| 797 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 798 | } |
| 799 | StartDependentFn (0,0) { |
| 800 | IO (Decode16, 0x03F8, 0x03F8, 0x08, 0x08) |
| 801 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 802 | } |
| 803 | StartDependentFn (1,0) { |
| 804 | IO (Decode16, 0x03E8, 0x03E8, 0x08, 0x08) |
| 805 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 806 | } |
| 807 | StartDependentFn (1,0) { |
| 808 | IO (Decode16, 0x02E8, 0x02E8, 0x08, 0x08) |
| 809 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 810 | } |
| 811 | StartDependentFn (2,0) { |
| 812 | IO (Decode16, 0x0100, 0x0FF8, 0x08, 0x08) |
| 813 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 814 | } |
| 815 | EndDependentFn() |
| 816 | }) |
| 817 | |
| 818 | Method (_SRS, 1, Serialized) |
| 819 | { |
| 820 | Name (TMPL, ResourceTemplate () { |
| 821 | IO (Decode16, 0, 0, 1, 8, IO0) |
| 822 | IRQNoFlags (IRQX) {} |
| 823 | }) |
| 824 | CreateWordField (Arg0, IO0._MIN, IOA0) |
| 825 | CreateByteField (Arg0, IRQX._INT, IRQL) |
| 826 | |
| 827 | Divide(IOA0, 256, Local0, Local1) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 828 | |
Felix Singer | f5b162e | 2021-12-30 00:21:21 +0100 | [diff] [blame] | 829 | Local3 = FindSetLeftBit (IRQL) - 1 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 830 | |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 831 | ENTER_CONFIG_MODE (3) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 832 | IO1L = Local0 |
| 833 | IO1H = Local1 |
| 834 | IRQ0 = Local3 |
| 835 | ACTR = One |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 836 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 837 | } |
| 838 | } |
| 839 | #endif |
| 840 | |
| 841 | #ifndef NO_W83627HF_IRDA |
| 842 | /* ======================== UART B (IRDA) ======================== */ |
| 843 | Device (IRDA) { |
| 844 | Name (_HID, EisaId ("PNP0510")) |
| 845 | Name (_UID, "w83627hf-irda") |
| 846 | Name (_STR, Unicode("IrDA Port")) |
| 847 | |
| 848 | Method (_STA) |
| 849 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 850 | Local0 = 0x00 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 851 | ENTER_CONFIG_MODE (3) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 852 | If (And(OPT2, 0x30)) |
| 853 | { |
| 854 | If (ACTR) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 855 | Local0 = 0x0F |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 856 | } |
Felix Singer | 5a303b0 | 2021-12-31 13:12:16 +0100 | [diff] [blame] | 857 | ElseIf (IO1H || IO1L) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 858 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 859 | Local0 = 0x0D |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 860 | } |
| 861 | } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 862 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 863 | Return (Local0) |
| 864 | } |
| 865 | |
| 866 | Method (_PSC) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 867 | Local0 = ^^_PSC () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 868 | If (Local0) { Return (Local0) } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 869 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 870 | Local0 = UBPW |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 871 | EXIT_CONFIG_MODE () |
Nico Huber | 79dfa90 | 2020-03-22 01:17:54 +0100 | [diff] [blame] | 872 | If (Local0) { Return (3) } |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 873 | Else { Return (0) } |
| 874 | } |
| 875 | Method (_PS0) { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 876 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 877 | UBPW = One |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 878 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 879 | } |
Nico Huber | 79dfa90 | 2020-03-22 01:17:54 +0100 | [diff] [blame] | 880 | Method (_PS3) { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 881 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 882 | UBPW = Zero |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 883 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 884 | } |
| 885 | |
| 886 | Method (_DIS) |
| 887 | { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 888 | ENTER_CONFIG_MODE (3) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 889 | ACTR = Zero |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 890 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 891 | } |
| 892 | |
| 893 | Method (_CRS) |
| 894 | { |
| 895 | Name (CRS, ResourceTemplate () { |
| 896 | IO (Decode16, 0x0000, 0x0000, 0x01, 0x08, IO0) |
| 897 | IRQNoFlags (IRQX) {6} |
| 898 | }) |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 899 | ENTER_CONFIG_MODE (3) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 900 | Local1 = IO1H |
| 901 | Local0 = IO1L |
| 902 | Local2 = IRQ0 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 903 | EXIT_CONFIG_MODE () |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 904 | Local0 |= Local1 << 8 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 905 | |
| 906 | CreateWordField (CRS, IO0._MIN, IMIN) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 907 | IMIN = Local0 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 908 | CreateWordField (CRS, IO0._MAX, IMAX) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 909 | IMAX = Local0 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 910 | |
| 911 | CreateWordField (CRS, IRQX._INT, IRQW) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 912 | Local3 = One |
Felix Singer | 3c9291b | 2022-12-16 02:43:56 +0100 | [diff] [blame] | 913 | IRQW = Local3 << Local2 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 914 | |
| 915 | Return (CRS) |
| 916 | } |
| 917 | |
| 918 | Name (_PRS, ResourceTemplate () |
| 919 | { |
| 920 | StartDependentFn (0,0) { |
| 921 | IO (Decode16, 0x02F8, 0x02F8, 0x08, 0x08) |
| 922 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 923 | } |
| 924 | StartDependentFn (1,0) { |
| 925 | IO (Decode16, 0x03F8, 0x03F8, 0x08, 0x08) |
| 926 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 927 | } |
| 928 | StartDependentFn (0,0) { |
| 929 | IO (Decode16, 0x03E8, 0x03E8, 0x08, 0x08) |
| 930 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 931 | } |
| 932 | StartDependentFn (0,0) { |
| 933 | IO (Decode16, 0x02E8, 0x02E8, 0x08, 0x08) |
| 934 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 935 | } |
| 936 | StartDependentFn (2,0) { |
| 937 | IO (Decode16, 0x0100, 0x0FF8, 0x08, 0x08) |
| 938 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 939 | } |
| 940 | EndDependentFn() |
| 941 | }) |
| 942 | |
| 943 | Method (_SRS, 1, Serialized) |
| 944 | { |
| 945 | Name (TMPL, ResourceTemplate () { |
| 946 | IO (Decode16, 0, 0, 1, 8, IO0) |
| 947 | IRQNoFlags (IRQX) {} |
| 948 | }) |
| 949 | CreateWordField (Arg0, IO0._MIN, IOA0) |
| 950 | CreateByteField (Arg0, IRQX._INT, IRQL) |
| 951 | |
| 952 | Divide(IOA0, 256, Local0, Local1) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 953 | |
Felix Singer | f5b162e | 2021-12-30 00:21:21 +0100 | [diff] [blame] | 954 | Local3 = FindSetLeftBit (IRQL) - 1 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 955 | |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 956 | ENTER_CONFIG_MODE (3) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 957 | IO1L = Local0 |
| 958 | IO1H = Local1 |
| 959 | IRQ0 = Local3 |
| 960 | ACTR = One |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 961 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 962 | } |
| 963 | } |
| 964 | #endif |
| 965 | |
| 966 | #ifndef NO_W83627HF_CIR |
| 967 | /* ========================= Consumer IR ========================= */ |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 968 | Device (CIR0) |
| 969 | { |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 970 | Name (_HID, EisaId ("WEC1022")) /* Should be the correct one */ |
| 971 | Name (_UID, "w83627hf-cir") |
| 972 | Name (_STR, Unicode("Winbond Consumer Infrared Transceiver")) |
| 973 | |
| 974 | Method (_STA) |
| 975 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 976 | Local0 = 0x00 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 977 | ENTER_CONFIG_MODE (6) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 978 | If (ACTR) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 979 | Local0 = 0x0F |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 980 | } |
Felix Singer | 5a303b0 | 2021-12-31 13:12:16 +0100 | [diff] [blame] | 981 | ElseIf (IO1H || IO1L) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 982 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 983 | Local0 = 0x0D |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 984 | } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 985 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 986 | Return (Local0) |
| 987 | } |
| 988 | |
| 989 | Method (_DIS) |
| 990 | { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 991 | ENTER_CONFIG_MODE (6) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 992 | ACTR = Zero |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 993 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 994 | } |
| 995 | |
| 996 | Method (_CRS) |
| 997 | { |
| 998 | Name (CRS, ResourceTemplate () { |
| 999 | IO (Decode16, 0x0000, 0x0000, 0x01, 0x08, IO0) |
| 1000 | IRQNoFlags (IRQX) {6} |
| 1001 | }) |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1002 | ENTER_CONFIG_MODE (6) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1003 | Local0 = IO1L |
| 1004 | Local1 = IO1H |
| 1005 | Local2 = IRQ0 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1006 | EXIT_CONFIG_MODE () |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 1007 | Local0 |= Local1 << 8 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1008 | |
| 1009 | CreateWordField (CRS, IO0._MIN, IMIN) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1010 | IMIN = Local0 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1011 | CreateWordField (CRS, IO0._MAX, IMAX) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1012 | IMAX = Local0 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1013 | |
| 1014 | CreateWordField (CRS, IRQX._INT, IRQW) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1015 | Local3 = One |
Felix Singer | 3c9291b | 2022-12-16 02:43:56 +0100 | [diff] [blame] | 1016 | IRQW = Local3 << Local2 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1017 | |
| 1018 | Return (CRS) |
| 1019 | } |
| 1020 | |
| 1021 | Name (_PRS, ResourceTemplate () |
| 1022 | { |
| 1023 | StartDependentFn (0,0) { |
| 1024 | IO (Decode16, 0x0100, 0x0FF8, 0x08, 0x08) |
| 1025 | IRQNoFlags () {3,4,5,7,9,10,11,12} |
| 1026 | } |
| 1027 | EndDependentFn() |
| 1028 | }) |
| 1029 | |
| 1030 | Method (_SRS, 1, Serialized) |
| 1031 | { |
| 1032 | Name (TMPL, ResourceTemplate () { |
| 1033 | IO (Decode16, 0, 0, 1, 8, IO0) |
| 1034 | IRQNoFlags (IRQX) {} |
| 1035 | }) |
| 1036 | CreateWordField (Arg0, IO0._MIN, IOA0) |
| 1037 | CreateByteField (Arg0, IRQX._INT, IRQL) |
| 1038 | |
| 1039 | Divide(IOA0, 256, Local0, Local1) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1040 | |
Felix Singer | f5b162e | 2021-12-30 00:21:21 +0100 | [diff] [blame] | 1041 | Local3 = FindSetLeftBit (IRQL) - 1 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1042 | |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1043 | ENTER_CONFIG_MODE (6) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1044 | IO1L = Local0 |
| 1045 | IO1H = Local1 |
| 1046 | IRQ0 = Local3 |
| 1047 | ACTR = One |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1048 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1049 | } |
| 1050 | } |
| 1051 | #endif |
| 1052 | |
| 1053 | #ifndef NO_W83627HF_KBC |
| 1054 | /* ===================== Keyboard Controller ===================== */ |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1055 | Device (KBD0) |
| 1056 | { |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1057 | Name (_HID, EisaId ("PNP0303")) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1058 | Name (_UID, "w83627hf-kbc") |
| 1059 | |
| 1060 | Method (_STA) |
| 1061 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1062 | Local0 = 0x00 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1063 | ENTER_CONFIG_MODE (5) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1064 | If (ACTR) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1065 | Local0 = 0x0F |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1066 | } |
Felix Singer | 5a303b0 | 2021-12-31 13:12:16 +0100 | [diff] [blame] | 1067 | ElseIf (IO1H || IO1L || IO2H || IO2L) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1068 | { |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1069 | #ifdef W83627HF_KBC_COMPAT |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1070 | Local0 = 0x0F |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1071 | #else |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1072 | Local0 = 0x0D |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1073 | #endif |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1074 | } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1075 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1076 | Return (Local0) |
| 1077 | } |
| 1078 | |
| 1079 | Method (_DIS) |
| 1080 | { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1081 | ENTER_CONFIG_MODE (5) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1082 | ACTR = Zero |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1083 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1084 | Notify(PS2M, 1) |
| 1085 | } |
| 1086 | |
Oskar Enoksson | 42283e7 | 2014-02-11 23:19:02 +0100 | [diff] [blame] | 1087 | Method (_CRS, 0, Serialized) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1088 | { |
| 1089 | Name (CRS, ResourceTemplate () { |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1090 | IRQNoFlags (IRQX) {} |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1091 | IO (Decode16, 0x0000, 0x0000, 0x01, 0x01, IO0) |
| 1092 | IO (Decode16, 0x0000, 0x0000, 0x01, 0x01, IO1) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1093 | }) |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1094 | ENTER_CONFIG_MODE (5) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1095 | Local0 = IO1L |
| 1096 | Local1 = IO1H |
| 1097 | Local2 = IO2L |
| 1098 | Local3 = IO2H |
| 1099 | Local4 = IRQ0 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1100 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1101 | |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 1102 | Local0 |= Local1 << 8 |
| 1103 | Local2 |= Local3 << 8 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1104 | |
| 1105 | CreateWordField (CRS, IO0._MIN, IMIN) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1106 | IMIN = Local0 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1107 | CreateWordField (CRS, IO0._MAX, IMAX) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1108 | IMAX = Local0 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1109 | |
| 1110 | CreateWordField (CRS, IO1._MIN, I1MI) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1111 | I1MI = Local2 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1112 | CreateWordField (CRS, IO1._MAX, I1MA) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1113 | I1MA = Local2 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1114 | |
| 1115 | CreateWordField (CRS, IRQX._INT, IRQW) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1116 | Local5 = One |
Felix Singer | 3c9291b | 2022-12-16 02:43:56 +0100 | [diff] [blame] | 1117 | IRQW = Local5 << Local4 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1118 | |
| 1119 | Return (CRS) |
| 1120 | } |
| 1121 | |
| 1122 | Name (_PRS, ResourceTemplate () |
| 1123 | { |
| 1124 | StartDependentFn (0,0) { |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1125 | IRQNoFlags () {1} |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1126 | IO (Decode16, 0x0060, 0x0060, 0x01, 0x01) |
| 1127 | IO (Decode16, 0x0064, 0x0064, 0x01, 0x01) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1128 | } |
| 1129 | EndDependentFn() |
| 1130 | }) |
| 1131 | |
| 1132 | Method (_SRS, 1, Serialized) |
| 1133 | { |
| 1134 | Name (TMPL, ResourceTemplate () { |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1135 | IRQNoFlags (IRQX) {} |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1136 | IO (Decode16, 0, 0, 1, 1, IO0) |
| 1137 | IO (Decode16, 0, 0, 1, 1, IO1) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1138 | }) |
| 1139 | CreateWordField (Arg0, IO0._MIN, IOA0) |
| 1140 | CreateWordField (Arg0, IO1._MIN, IOA1) |
Oskar Enoksson | 411bf97 | 2014-02-11 23:20:14 +0100 | [diff] [blame] | 1141 | CreateWordField (Arg0, IRQX._INT, IRQL) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1142 | |
| 1143 | Divide(IOA0, 256, Local0, Local1) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1144 | Divide(IOA1, 256, Local2, Local3) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1145 | |
Felix Singer | f5b162e | 2021-12-30 00:21:21 +0100 | [diff] [blame] | 1146 | Local4 = FindSetLeftBit (IRQL) - 1 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1147 | |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1148 | ENTER_CONFIG_MODE (5) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1149 | IO1L = Local0 |
| 1150 | IO1H = Local1 |
| 1151 | IO2L = Local2 |
| 1152 | IO2H = Local3 |
| 1153 | IRQ0 = Local4 |
| 1154 | ACTR = One |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1155 | EXIT_CONFIG_MODE () |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1156 | Notify(PS2M, 1) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1157 | } |
| 1158 | } |
| 1159 | #ifndef NO_W83627HF_PS2M |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1160 | Device (PS2M) |
| 1161 | { |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1162 | Name (_HID, EisaId ("PNP0F13")) |
| 1163 | Name (_UID, "w83627hf-ps2m") |
| 1164 | |
| 1165 | Method (_STA) |
| 1166 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1167 | Local0 = 0x00 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1168 | ENTER_CONFIG_MODE (5) |
Felix Singer | db4cf7f | 2021-12-31 12:32:08 +0100 | [diff] [blame] | 1169 | If (ACTR && IRQ1) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1170 | Local0 = 0x0F |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1171 | } |
Felix Singer | 5a303b0 | 2021-12-31 13:12:16 +0100 | [diff] [blame] | 1172 | ElseIf (IO1H || IO1L || IO2H || IO2L) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1173 | { |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1174 | #ifdef W83627HF_KBC_COMPAT |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1175 | Local0 = 0x0F |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1176 | #else |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1177 | Local0 = 0x0D |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1178 | #endif |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1179 | } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1180 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1181 | Return (Local0) |
| 1182 | } |
| 1183 | |
| 1184 | Method (_DIS) |
| 1185 | { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1186 | ENTER_CONFIG_MODE (5) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1187 | IRQ1 = Zero |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1188 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1189 | } |
| 1190 | |
Oskar Enoksson | 42283e7 | 2014-02-11 23:19:02 +0100 | [diff] [blame] | 1191 | Method (_CRS, 0, Serialized) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1192 | { |
| 1193 | Name (CRS, ResourceTemplate () { |
| 1194 | IRQNoFlags (IRQX) {} |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1195 | }) |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1196 | ENTER_CONFIG_MODE (5) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1197 | Local4 = IRQ1 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1198 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1199 | |
| 1200 | CreateWordField (CRS, IRQX._INT, IRQW) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1201 | Local5 = One |
Felix Singer | 3c9291b | 2022-12-16 02:43:56 +0100 | [diff] [blame] | 1202 | IRQW = Local5 << Local4 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1203 | |
| 1204 | Return (CRS) |
| 1205 | } |
| 1206 | |
| 1207 | Name (_PRS, ResourceTemplate () |
| 1208 | { |
| 1209 | StartDependentFn (0,0) { |
| 1210 | IRQNoFlags () {12} |
| 1211 | } |
| 1212 | StartDependentFn (2,0) { |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1213 | IRQNoFlags () {1,3,4,5,6,7,9,10,11} |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1214 | } |
| 1215 | EndDependentFn() |
| 1216 | }) |
| 1217 | |
| 1218 | Method (_SRS, 1, Serialized) |
| 1219 | { |
| 1220 | Name (TMPL, ResourceTemplate () { |
| 1221 | IRQNoFlags (IRQX) {} |
| 1222 | }) |
Oskar Enoksson | 411bf97 | 2014-02-11 23:20:14 +0100 | [diff] [blame] | 1223 | CreateWordField (Arg0, IRQX._INT, IRQL) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1224 | |
Felix Singer | f5b162e | 2021-12-30 00:21:21 +0100 | [diff] [blame] | 1225 | Local0 = FindSetLeftBit (IRQL) - 1 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1226 | |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1227 | ENTER_CONFIG_MODE (5) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1228 | IRQ1 = Local0 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1229 | /* Only activates if KBD is active */ |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1230 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1231 | } |
| 1232 | } |
| 1233 | #endif |
| 1234 | #endif |
| 1235 | |
| 1236 | #ifndef NO_W83627HF_GAME |
| 1237 | /* ========================== Game Port ========================== */ |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1238 | Device (GAME) |
| 1239 | { |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1240 | Name (_HID, EisaId ("PNPB02F")) |
| 1241 | Name (_STR, Unicode ("Joystick/Game Port")) |
| 1242 | Name (_UID, "w83627hf-game") |
| 1243 | |
| 1244 | Method (_STA) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1245 | Local0 = 0 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1246 | ENTER_CONFIG_MODE (7) |
Felix Singer | 5a303b0 | 2021-12-31 13:12:16 +0100 | [diff] [blame] | 1247 | If (IO1L || IO1H) { |
| 1248 | If (ACTR || ACT1) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1249 | Local0 = 0x0F |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1250 | } |
| 1251 | Else { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1252 | Local0 = 0x0D |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1253 | } |
| 1254 | } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1255 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1256 | Return (Local0) |
| 1257 | } |
| 1258 | |
| 1259 | Method (_CRS) |
| 1260 | { |
| 1261 | Name (CRS, ResourceTemplate () { |
| 1262 | IO (Decode16, 0x0000, 0x0000, 0x01, 0x01, IO0) |
| 1263 | IRQNoFlags (IRQX) {} |
| 1264 | }) |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1265 | ENTER_CONFIG_MODE (7) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1266 | Local0 = IO1L |
| 1267 | Local1 = IO1H |
| 1268 | Local2 = IRQ0 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1269 | EXIT_CONFIG_MODE () |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1270 | |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 1271 | Local0 |= Local1 << 8 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1272 | |
| 1273 | CreateWordField (CRS, IO0._MIN, IMIN) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1274 | CreateWordField (CRS, IO0._MAX, IMAX) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1275 | IMIN = Local0 |
| 1276 | IMAX = Local0 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1277 | |
| 1278 | If (Local2) { |
| 1279 | CreateWordField (CRS, IRQX._INT, IRQW) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1280 | Local3 = One |
Felix Singer | 3c9291b | 2022-12-16 02:43:56 +0100 | [diff] [blame] | 1281 | IRQW = Local3 << Local2 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1282 | } |
| 1283 | |
| 1284 | Return (CRS) |
| 1285 | } |
| 1286 | |
| 1287 | } |
| 1288 | #endif |
| 1289 | |
| 1290 | #ifndef NO_W83627HF_MIDI |
| 1291 | /* ========================== MIDI Port ========================== */ |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1292 | Device (MIDI) |
| 1293 | { |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1294 | Name (_HID, EisaId ("PNPB006")) |
| 1295 | Name (_STR, Unicode ("MPU-401 Compatible MIDI Port")) |
| 1296 | Name (_UID, "w83627hf-midi") |
| 1297 | |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1298 | Method (_STA) |
| 1299 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1300 | Local0 = 0 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1301 | ENTER_CONFIG_MODE (7) |
Felix Singer | 5a303b0 | 2021-12-31 13:12:16 +0100 | [diff] [blame] | 1302 | If (IO2L || IO2H) { |
| 1303 | If (ACTR || ACT2) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1304 | Local0 = 0x0F |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1305 | } |
| 1306 | Else { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1307 | Local0 = 0x0D |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1308 | } |
| 1309 | } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1310 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1311 | Return (Local0) |
| 1312 | } |
| 1313 | |
| 1314 | Method (_CRS) |
| 1315 | { |
| 1316 | Name (CRS, ResourceTemplate () { |
| 1317 | IO (Decode16, 0x0000, 0x0000, 0x02, 0x02, IO0) |
| 1318 | IRQNoFlags (IRQX) {} |
| 1319 | }) |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1320 | ENTER_CONFIG_MODE (7) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1321 | Local0 = IO2L |
| 1322 | Local1 = IO2H |
| 1323 | Local2 = IRQ1 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1324 | EXIT_CONFIG_MODE () |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1325 | |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 1326 | Local0 |= Local1 << 8 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1327 | |
| 1328 | CreateWordField (CRS, IO0._MIN, IMIN) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1329 | CreateWordField (CRS, IO0._MAX, IMAX) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1330 | IMIN = Local0 |
| 1331 | IMAX = Local0 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1332 | |
| 1333 | If (Local2) { |
| 1334 | CreateWordField (CRS, IRQX._INT, IRQW) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1335 | Local3 = One |
Felix Singer | 3c9291b | 2022-12-16 02:43:56 +0100 | [diff] [blame] | 1336 | IRQW = Local3 << Local2 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1337 | } |
| 1338 | |
| 1339 | Return (CRS) |
| 1340 | } |
| 1341 | |
| 1342 | } |
| 1343 | #endif |
| 1344 | |
| 1345 | /* ==== Suspend LED control if it is connected to the SuperIO ==== */ |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1346 | Method (SLED, 1) |
| 1347 | { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1348 | ENTER_CONFIG_MODE (9) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1349 | Local0 = OPT4 |
Felix Singer | 35e65a8 | 2022-12-16 07:11:17 +0100 | [diff] [blame^] | 1350 | Local0 &= 63 |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 1351 | OPT4 = Local0 | (And(Arg0, 0x03) << 6) |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1352 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1353 | } |
| 1354 | |
| 1355 | /* ===== Power LED control if it is connected to the SuperIO ===== */ |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1356 | Method (PLED, 1) |
| 1357 | { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1358 | ENTER_CONFIG_MODE (8) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1359 | Local0 = OPT4 |
Felix Singer | 35e65a8 | 2022-12-16 07:11:17 +0100 | [diff] [blame^] | 1360 | Local0 &= 63 |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 1361 | OPT4 = Local0 | (And(Arg0, 0x03) << 6) |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1362 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1363 | } |
| 1364 | |
| 1365 | #ifndef NO_W83627HF_HWMON |
| 1366 | /* ====================== Hardware Monitor ======================= */ |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1367 | Device (HMON) |
| 1368 | { |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1369 | Name (_HID, EisaId ("PNP0C02")) // TODO: find better matching ID |
| 1370 | Name (_STR, Unicode("W83627 Hardware Monitor")) |
| 1371 | Name (_UID, "w83627hf-hwmon") |
| 1372 | |
| 1373 | Method (_STA) |
| 1374 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1375 | Local0 = 0x00 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1376 | ENTER_CONFIG_MODE (11) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1377 | If (ACTR) { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1378 | Local0 = 0x0F |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1379 | } |
Felix Singer | 5a303b0 | 2021-12-31 13:12:16 +0100 | [diff] [blame] | 1380 | ElseIf (IO1H || IO1L) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1381 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1382 | Local0 = 0x0D |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1383 | } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1384 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1385 | Return (Local0) |
| 1386 | } |
| 1387 | |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1388 | Method (_PSC) |
| 1389 | { |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1390 | Local0 = ^^_PSC () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1391 | If (Local0) { Return (Local0) } |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1392 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1393 | Local0 = HWPW |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1394 | EXIT_CONFIG_MODE () |
Nico Huber | 79dfa90 | 2020-03-22 01:17:54 +0100 | [diff] [blame] | 1395 | If (Local0) { Return (3) } |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1396 | Else { Return (0) } |
| 1397 | } |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1398 | |
| 1399 | Method (_PS0) |
| 1400 | { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1401 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1402 | HWPW = One |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1403 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1404 | } |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1405 | |
Nico Huber | 79dfa90 | 2020-03-22 01:17:54 +0100 | [diff] [blame] | 1406 | Method (_PS3) |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1407 | { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1408 | ENTER_CONFIG_MODE (PNP_NO_LDN_CHANGE) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1409 | HWPW = Zero |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1410 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1411 | } |
| 1412 | |
Oskar Enoksson | 42283e7 | 2014-02-11 23:19:02 +0100 | [diff] [blame] | 1413 | Method (_CRS, 0, Serialized) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1414 | { |
| 1415 | Name (CRS, ResourceTemplate () { |
| 1416 | IO (Decode16, 0x0000, 0x0000, 0x08, 0x02, IO0) |
| 1417 | IRQNoFlags (IRQX) {} |
| 1418 | }) |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1419 | ENTER_CONFIG_MODE (11) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1420 | Local0 = IO1L |
| 1421 | Local1 = IO1H |
| 1422 | Local2 = IRQ1 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1423 | EXIT_CONFIG_MODE () |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1424 | |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 1425 | Local0 |= Local1 << 8 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1426 | |
| 1427 | CreateWordField (CRS, IO0._MIN, IMIN) |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1428 | CreateWordField (CRS, IO0._MAX, IMAX) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1429 | IMIN = Local0 |
| 1430 | IMAX = Local0 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1431 | |
| 1432 | If (Local2) { |
| 1433 | CreateWordField (CRS, IRQX._INT, IRQW) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1434 | Local3 = One |
Felix Singer | 3c9291b | 2022-12-16 02:43:56 +0100 | [diff] [blame] | 1435 | IRQW = Local3 << Local2 |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1436 | } |
| 1437 | Return (CRS) |
| 1438 | } |
| 1439 | } |
| 1440 | #endif |
| 1441 | |
| 1442 | /* Returns the wake source register. |
| 1443 | It is cleared after reading. |
| 1444 | Bit 0: Keyboard wake-up event |
| 1445 | Bit 1: Mouse wake-up event |
| 1446 | Bit 2: Power button event |
| 1447 | Bit 3: CIR wake-up event |
| 1448 | Bit 4: Power loss event |
| 1449 | Bit 5: VSB power loss status |
| 1450 | */ |
Christoph Grenz | 287ca50 | 2011-11-05 23:39:20 +0100 | [diff] [blame] | 1451 | Method (WAKS) |
| 1452 | { |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1453 | ENTER_CONFIG_MODE (10) |
Felix Singer | fa07096 | 2022-12-12 04:43:21 +0100 | [diff] [blame] | 1454 | Local0 = CRE3 |
Elyes HAOUAS | cfaf4c7 | 2020-03-29 17:29:48 +0200 | [diff] [blame] | 1455 | EXIT_CONFIG_MODE () |
Christoph Grenz | e3e641c | 2011-11-05 22:14:41 +0100 | [diff] [blame] | 1456 | Return (Local0) |
Christoph Grenz | 8ae574c | 2011-09-18 22:53:18 +0200 | [diff] [blame] | 1457 | } |
Christoph Grenz | d17f3d7 | 2011-10-19 02:24:23 +0200 | [diff] [blame] | 1458 | } |