2 * This file is part of the coreboot project.
4 * Copyright (C) 2011 Christoph Grenz <christophg+cb@grenz-bonn.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 * include this file into a mainboard's DSDT _SB device tree and it will expose the
22 * W83627HF SuperIO and its functionality.
24 * Devices are marked as nonexistant if they got 0x00000000 as I/O base address
25 * (compatibility with legacy bios, which disables logical devices that way)
27 * It allows the change of IO ports, IRQs and DMA settings on most logical
28 * devices, disabling and reenabling logical devices and controlling power
29 * saving mode on logical devices or the whole chip.
32 * - ECP mode of parallel port not implemented, DMA settings of parallel port
33 * will be reset on DSDT init
34 * - Hardware monitor is only shown as "Motherboard Resource", shows no real
37 * Controllable through preprocessor macros:
38 * NO_W83627HF_FDC: don't expose the floppy disk controller
39 * NO_W83627HF_FDC_ENUM: don't try to enumerate the connected floppy drives
40 * NO_W83627HF_PPORT: don't expose the parallel port
41 * NO_W83627HF_UARTA: don't expose the first serial port
42 * NO_W83627HF_UARTB: don't expose the second serial port (already hidden
43 * if UARTB is configured as IRDA port by firmware)
44 * NO_W83627HF_IRDA: don't expose the IRDA port (already hidden if UARTB is
45 * configured as serial port by firmware)
46 * NO_W83627HF_CIR: don't expose the Consumer Infrared functionality
47 * NO_W83627HF_KBC: don't expose the keyboard controller
48 * NO_W83627HF_PS2M: don't expose the PS/2 mouse functionality of the
50 * NO_W83627HF_GAME: don't expose the game port
51 * NO_W83627HF_MIDI: don't expose the MIDI port
52 * NO_W83627HF_HWMON: don't expose the hardware monitor as
53 * PnP "Motherboard Ressource"
55 * Datasheet: "W83627HF/F WINBOND I/O" rev. 6.0
56 * http://www.itox.com/pages/support/wdt/W83627HF.pdf
60 Name (_HID, EisaId("PNP0A05"))
61 Name (_STR, Unicode("Winbond W83627HF SuperIO"))
62 Name (_UID, "w83627hf")
64 /* Mutex for accesses to the configuration ports (prolog and epilog commands are used, so synchronization is useful) */
67 /* SuperIO configuration ports */
68 OperationRegion (CREG, SystemIO, 0x2E, 0x02)
69 Field (CREG, ByteAcc, NoLock, Preserve)
74 IndexField (ADDR, DATA, ByteAcc, NoLock, Preserve)
77 RST, 1, /* Soft reset */
80 LDN, 8, /* Logical device selector */
82 DID, 8, /* Device ID */
83 DREV, 8, /* Device Revision */
84 FDPW, 1, /* FDC Power Down */
86 PRPW, 1, /* PRT Power Down */
87 UAPW, 1, /* UART A Power Down */
88 UBPW, 1, /* UART B Power Down */
89 HWPW, 1, /* HWM Power Down */
91 IPD, 1, /* Immediate Chip Power Down */
93 PNPS, 1, /* PnP Address Select Register Default Value Mode */
95 KBCR, 1, /* KBC enabled after system reset (read-only) */
97 CLKS, 1, /* Clock select */
98 AQ16, 1, /* 16bit Address Qualification */
99 FDCT, 1, /* Tristate FDC (?) */
101 PRTT, 1, /* Tristate parallel port (?) */
102 URAT, 1, /* Tristate UART A (?) */
103 URBT, 1, /* Tristate UART B (?) */
105 URAI, 1, /* UART A Legacy IRQ Select Disable */
106 URBI, 1, /* UART B Legacy IRQ Select Disable */
107 PRTI, 1, /* Parallel Port Legacy IRQ/DRQ Select Disable */
108 FDCI, 1, /* FDC Legacy IRQ/DRQ Select Disable */
110 LCKC, 1, /* Lock Configuration Registers */
112 IO3S, 8, /* GPIO3 pin selection register */
113 ACTR, 1, /* Logical device activation */
114 ACT1, 1, /* Logical part activation 1 (mostly unused) */
115 ACT2, 1, /* Logical part activation 2 (mostly unused) */
118 IO1H, 8, /* First I/O port base - high byte */
119 IO1L, 8, /* First I/O port base - low byte */
120 IO2H, 8, /* Second I/O port base - high byte */
121 IO2L, 8, /* Second I/O port base - low byte */
123 IRQ0, 8, /* First IRQ */
125 IRQ1, 8, /* First IRQ */
129 /* CRE0-CRE4: function logical device dependant, seems to be reserved for ACPI settings */
136 /* OPT1-OPTA aka CRF0-CRF9: function logical device dependant */
149 Name (_CRS, ResourceTemplate () {
150 IO (Decode16, 0x002E, 0x002E, 0x02, 0x01) /* Announce the used I/O ports to the OS */
151 IO (Decode16, 0x004E, 0x004E, 0x01, 0x01) /* this port is used in some configurations, so announce it to be sure */
154 /* Enter configuration mode (and aquire mutex)
155 Method must be run before accesssing the configuration region.
159 Acquire (CRMX, 0xFFFF)
164 /* Exit configuration mode (and release mutex)
165 Method must be run after accessing the configuration region.
173 /* PM: indicate IPD (Immediate Power Down) bit state as D0/D2 */
178 If (Local0) { Return (2) }
182 /* PM: Switch to D0 by setting IPD low */
189 /* PM: Switch to D2 by setting IPD high */
196 #ifndef NO_W83627HF_FDC
197 /* =================== Floppy Disk Controller ================ */
199 Name (_HID, EisaId ("PNP0700"))
200 Name (_STR, Unicode ("W83627HF Floppy Disk Controller"))
201 Name (_UID, "w83627hf-fdc")
203 #ifndef NO_W83627HF_FDC_ENUM
204 /* Initialization method: Should be run once on boot
205 If FDC is active, enumerate all connected devices */
213 ShiftLeft(Local1, 8, Local1)
214 Or(Local1, Local2, Local1)
216 /* Try probing drives and save result in _FDE */
230 ElseIf (LOr (IO1H, IO1L))
239 Store(^^_PSC (), Local0)
240 If (Local0) { Return (Local0) }
244 If (Local0) { Return (1) }
268 Name (CRS, ResourceTemplate () {
269 IO (Decode16, 0x0000, 0x0000, 0x01, 0x06, IO0)
270 IO (Decode16, 0x03F7, 0x03F7, 0x01, 0x01)
272 DMA (Compatibility, NotBusMaster, Transfer8) {2}
279 ShiftLeft(Local1, 8, Local1)
280 Or (Local1, Local0, Local0)
282 CreateWordField (CRS, IO0._MIN, IMIN)
284 CreateWordField (CRS, IO0._MAX, IMAX)
290 Name (_PRS, ResourceTemplate ()
292 StartDependentFnNoPri ()
294 IO (Decode16, 0x03F0, 0x03F0, 0x01, 0x06)
295 IO (Decode16, 0x03F7, 0x03F7, 0x01, 0x01)
297 DMA (Compatibility, NotBusMaster, Transfer8) {2}
302 #ifndef NO_W83627HF_FDC_ENUM
303 Name(_FDE, Buffer(){0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})
307 #ifndef NO_W83627HF_FDC_ENUM
308 /* Try probing drives and save result in _FDE
309 Probing is done through selecting and activating a drive
310 and reading 0x03F7 aka the "shared IDE and floppy register"
311 as any value there besides zero seems to indicate a
314 OperationRegion (FIO1, SystemIO, Arg0, 0x06)
315 Field (FIO1, ByteAcc, NoLock, Preserve)
336 OperationRegion (FIO2, SystemIO, 0x3F7, 0x01)
338 CreateByteField (_FDE, 3, FD1)
339 CreateByteField (_FDE, 7, FD2)
340 CreateByteField (_FDE, 11, FD3)
341 CreateByteField (_FDE, 15, FD4)
346 If (FIO2) { Store (One, FD1) }
352 If (FIO2) { Store (One, FD2) }
358 If (FIO2) { Store (One, FD3) }
364 If (FIO2) { Store (One, FD4) }
371 Method (_SRS, 1, Serialized)
373 Name (TMPL, ResourceTemplate () {
374 IO (Decode16, 0, 0, 1, 6, IO0)
375 IO (Decode16, 0, 0, 1, 1, IO1)
377 DMA (Compatibility, NotBusMaster, Transfer8, DMA0) {}
379 CreateWordField (Arg0, IO0._MIN, IOA0)
380 CreateWordField (Arg0, IO1._MIN, IOA1)
381 CreateByteField (Arg0, IRQ0._INT, IRQL)
382 CreateByteField (Arg0, DMA0._DMA, DMCH)
384 Divide(IOA0, 256, Local0, Local1)
385 ShiftRight(Local1, 8, Local1)
394 /* Try probing drives and save result in _FDE */
400 #ifndef NO_W83627HF_PPORT
401 /* ======================== Parallel Port ======================== */
402 /* Currently no ECP support */
404 Name (_HID, EisaId ("PNP0400"))
406 Name (_UID, "w83627hf-pport")
409 And(Arg0, 0x07, Local0)
412 And(OPT1, 0x3, Local1)
413 Or(Local1, Local0, OPT1)
419 /* Deactivate DMA, even if set by BIOS. We don't announce it
420 through _CRS and it's only useful in ECP mode which we
421 don't support at the moment. */
433 And(OPT1, 0x3, Local1)
435 If (LNotEqual(Local1, 2)) {
441 ElseIf (LOr (IO1H, IO1L))
450 Store(^^_PSC (), Local0)
451 If (Local0) { Return (Local0) }
455 If (Local0) { Return (1) }
478 Name (CRS, ResourceTemplate ()
480 IO (Decode16, 0x0000, 0x0000, 0x04, 0x08, IO0)
483 CreateWordField (CRS, IO0._MIN, IOP0)
484 CreateWordField (CRS, IO0._MAX, IOR0)
485 CreateByteField (CRS, IO0._ALN, IOAL)
486 CreateByteField (CRS, IO0._LEN, IOLE)
487 CreateWordField (CRS, IRQX._INT, IRQW)
496 ShiftLeft(Local1, 8, Local1)
497 Or (Local1, Local0, Local1)
499 And(Local2, 0x3, Local3)
500 And(Local2, 0x4, Local4)
508 If (LEqual (Local0, 0xBC))
518 ShiftLeft (Local0, Local5, IRQW)
523 Name (_PRS, ResourceTemplate ()
525 StartDependentFn (0,1)
527 IO (Decode16, 0x0378, 0x0378, 0x04, 0x08)
528 IRQNoFlags () {3,4,5,7,9,10,11,12}
530 StartDependentFn (0,1)
532 IO (Decode16, 0x0278, 0x0278, 0x04, 0x08)
533 IRQNoFlags () {3,4,5,7,9,10,11,12}
535 StartDependentFn (0,1)
537 IO (Decode16, 0x03BC, 0x03BC, 0x04, 0x04)
538 IRQNoFlags () {3,4,5,7,9,10,11,12}
540 StartDependentFn (0,0)
542 IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
543 IRQNoFlags () {3,4,5,7,9,10,11,12}
545 StartDependentFn (0,0)
547 IO (Decode16, 0x0278, 0x0278, 0x08, 0x08)
548 IRQNoFlags () {3,4,5,7,9,10,11,12}
550 StartDependentFn (2,0)
552 IO (Decode16, 0x0100, 0x0FFC, 0x08, 0x08)
553 IRQNoFlags () {3,4,5,7,9,10,11,12}
555 StartDependentFn (2,1)
557 IO (Decode16, 0x0100, 0x0FFC, 0x04, 0x08)
558 IRQNoFlags () {3,4,5,7,9,10,11,12}
563 Method (_SRS, 1, Serialized)
565 Name (TMPL, ResourceTemplate () {
566 IO (Decode16, 0, 0, 4, 4, IO0)
569 CreateWordField (Arg0, IO0._MIN, IOA0)
570 CreateWordField (Arg0, IO0._MIN, IOA1)
571 CreateByteField (Arg0, IO0._ALN, IOAL)
572 CreateByteField (Arg0, IO0._LEN, IOLE)
573 CreateWordField (Arg0, IRQX._INT, IRQL)
575 If (LEqual(IOAL, 4)) {
581 Divide(IOA0, 256, Local0, Local1)
582 ShiftRight(Local1, 8, Local1)
590 And (Local3, 0xF8, Local3)
591 Or (Local2, Local3, OPT1)
595 FindSetLeftBit (IRQL, Local3)
596 Subtract (Local3, 0x01, Local3)
605 #ifndef NO_W83627HF_UARTA
606 /* =========================== UART A ============================ */
608 Name (_HID, EisaId ("PNP0501"))
609 Name (_UID, "w83627hf-uarta")
620 ElseIf (LOr (IO1H, IO1L))
629 Store(^^_PSC (), Local0)
630 If (Local0) { Return (Local0) }
634 If (Local0) { Return (1) }
658 Name (CRS, ResourceTemplate () {
659 IO (Decode16, 0x0000, 0x0000, 0x01, 0x08, IO0)
660 IRQNoFlags (IRQX) {6}
668 ShiftLeft(Local1, 8, Local1)
669 Or (Local1, Local0, Local0)
671 CreateWordField (CRS, IO0._MIN, IMIN)
673 CreateWordField (CRS, IO0._MAX, IMAX)
676 CreateWordField (CRS, IRQX._INT, IRQW)
678 ShiftLeft (Local3, Local2, IRQW)
683 Name (_PRS, ResourceTemplate ()
685 StartDependentFn (0,0) {
686 IO (Decode16, 0x03F8, 0x03F8, 0x08, 0x08)
687 IRQNoFlags () {3,4,5,7,9,10,11,12}
689 StartDependentFn (0,0) {
690 IO (Decode16, 0x02F8, 0x02F8, 0x08, 0x08)
691 IRQNoFlags () {3,4,5,7,9,10,11,12}
693 StartDependentFn (1,0) {
694 IO (Decode16, 0x03E8, 0x03E8, 0x08, 0x08)
695 IRQNoFlags () {3,4,5,7,9,10,11,12}
697 StartDependentFn (1,0) {
698 IO (Decode16, 0x02E8, 0x02E8, 0x08, 0x08)
699 IRQNoFlags () {3,4,5,7,9,10,11,12}
701 StartDependentFn (2,0) {
702 IO (Decode16, 0x0100, 0x0FF8, 0x08, 0x08)
703 IRQNoFlags () {3,4,5,7,9,10,11,12}
708 Method (_SRS, 1, Serialized)
710 Name (TMPL, ResourceTemplate () {
711 IO (Decode16, 0, 0, 1, 6, IO0)
714 CreateWordField (Arg0, IO0._MIN, IOA0)
715 CreateByteField (Arg0, IRQX._INT, IRQL)
717 Divide(IOA0, 256, Local0, Local1)
718 ShiftRight(Local1, 8, Local1)
720 FindSetLeftBit (IRQL, Local3)
721 Subtract (Local3, 0x01, Local3)
734 #ifndef NO_W83627HF_UARTB
735 /* =========================== UART B ============================ */
737 Name (_HID, EisaId ("PNP0501"))
738 Name (_UID, "w83627hf-uartb")
746 If (LNot(And(OPT2, 0x30)))
751 ElseIf (LOr (IO1H, IO1L))
761 Store(^^_PSC (), Local0)
762 If (Local0) { Return (Local0) }
766 If (Local0) { Return (1) }
790 Name (CRS, ResourceTemplate () {
791 IO (Decode16, 0x0000, 0x0000, 0x01, 0x08, IO0)
792 IRQNoFlags (IRQX) {6}
800 ShiftLeft(Local1, 8, Local1)
801 Or (Local1, Local0, Local0)
803 CreateWordField (CRS, IO0._MIN, IMIN)
805 CreateWordField (CRS, IO0._MAX, IMAX)
808 CreateWordField (CRS, IRQX._INT, IRQW)
810 ShiftLeft (Local3, Local2, IRQW)
815 Name (_PRS, ResourceTemplate ()
817 StartDependentFn (0,0) {
818 IO (Decode16, 0x02F8, 0x02F8, 0x08, 0x08)
819 IRQNoFlags () {3,4,5,7,9,10,11,12}
821 StartDependentFn (0,0) {
822 IO (Decode16, 0x03F8, 0x03F8, 0x08, 0x08)
823 IRQNoFlags () {3,4,5,7,9,10,11,12}
825 StartDependentFn (1,0) {
826 IO (Decode16, 0x03E8, 0x03E8, 0x08, 0x08)
827 IRQNoFlags () {3,4,5,7,9,10,11,12}
829 StartDependentFn (1,0) {
830 IO (Decode16, 0x02E8, 0x02E8, 0x08, 0x08)
831 IRQNoFlags () {3,4,5,7,9,10,11,12}
833 StartDependentFn (2,0) {
834 IO (Decode16, 0x0100, 0x0FF8, 0x08, 0x08)
835 IRQNoFlags () {3,4,5,7,9,10,11,12}
840 Method (_SRS, 1, Serialized)
842 Name (TMPL, ResourceTemplate () {
843 IO (Decode16, 0, 0, 1, 8, IO0)
846 CreateWordField (Arg0, IO0._MIN, IOA0)
847 CreateByteField (Arg0, IRQX._INT, IRQL)
849 Divide(IOA0, 256, Local0, Local1)
850 ShiftRight(Local1, 8, Local1)
852 FindSetLeftBit (IRQL, Local3)
853 Subtract (Local3, 0x01, Local3)
866 #ifndef NO_W83627HF_IRDA
867 /* ======================== UART B (IRDA) ======================== */
869 Name (_HID, EisaId ("PNP0510"))
870 Name (_UID, "w83627hf-irda")
871 Name (_STR, Unicode("IrDA Port"))
883 ElseIf (LOr (IO1H, IO1L))
893 Store(^^_PSC (), Local0)
894 If (Local0) { Return (Local0) }
898 If (Local0) { Return (1) }
922 Name (CRS, ResourceTemplate () {
923 IO (Decode16, 0x0000, 0x0000, 0x01, 0x08, IO0)
924 IRQNoFlags (IRQX) {6}
932 ShiftLeft(Local1, 8, Local1)
933 Or (Local1, Local0, Local0)
935 CreateWordField (CRS, IO0._MIN, IMIN)
937 CreateWordField (CRS, IO0._MAX, IMAX)
940 CreateWordField (CRS, IRQX._INT, IRQW)
942 ShiftLeft (Local3, Local2, IRQW)
947 Name (_PRS, ResourceTemplate ()
949 StartDependentFn (0,0) {
950 IO (Decode16, 0x02F8, 0x02F8, 0x08, 0x08)
951 IRQNoFlags () {3,4,5,7,9,10,11,12}
953 StartDependentFn (1,0) {
954 IO (Decode16, 0x03F8, 0x03F8, 0x08, 0x08)
955 IRQNoFlags () {3,4,5,7,9,10,11,12}
957 StartDependentFn (0,0) {
958 IO (Decode16, 0x03E8, 0x03E8, 0x08, 0x08)
959 IRQNoFlags () {3,4,5,7,9,10,11,12}
961 StartDependentFn (0,0) {
962 IO (Decode16, 0x02E8, 0x02E8, 0x08, 0x08)
963 IRQNoFlags () {3,4,5,7,9,10,11,12}
965 StartDependentFn (2,0) {
966 IO (Decode16, 0x0100, 0x0FF8, 0x08, 0x08)
967 IRQNoFlags () {3,4,5,7,9,10,11,12}
972 Method (_SRS, 1, Serialized)
974 Name (TMPL, ResourceTemplate () {
975 IO (Decode16, 0, 0, 1, 8, IO0)
978 CreateWordField (Arg0, IO0._MIN, IOA0)
979 CreateByteField (Arg0, IRQX._INT, IRQL)
981 Divide(IOA0, 256, Local0, Local1)
982 ShiftRight(Local1, 8, Local1)
984 FindSetLeftBit (IRQL, Local3)
985 Subtract (Local3, 0x01, Local3)
998 #ifndef NO_W83627HF_CIR
999 /* ========================= Consumer IR ========================= */
1001 Name (_HID, EisaId ("WEC1022")) /* Should be the correct one */
1002 Name (_UID, "w83627hf-cir")
1003 Name (_STR, Unicode("Winbond Consumer Infrared Transceiver"))
1007 Store (0x00, Local0)
1011 Store (0x0F, Local0)
1013 ElseIf (LOr (IO1H, IO1L))
1015 Store (0x0D, Local0)
1031 Name (CRS, ResourceTemplate () {
1032 IO (Decode16, 0x0000, 0x0000, 0x01, 0x08, IO0)
1033 IRQNoFlags (IRQX) {6}
1041 ShiftLeft(Local1, 8, Local1)
1042 Or (Local1, Local0, Local0)
1044 CreateWordField (CRS, IO0._MIN, IMIN)
1045 Store (Local0, IMIN)
1046 CreateWordField (CRS, IO0._MAX, IMAX)
1047 Store (Local0, IMAX)
1049 CreateWordField (CRS, IRQX._INT, IRQW)
1051 ShiftLeft (Local3, Local2, IRQW)
1056 Name (_PRS, ResourceTemplate ()
1058 StartDependentFn (0,0) {
1059 IO (Decode16, 0x0100, 0x0FF8, 0x08, 0x08)
1060 IRQNoFlags () {3,4,5,7,9,10,11,12}
1065 Method (_SRS, 1, Serialized)
1067 Name (TMPL, ResourceTemplate () {
1068 IO (Decode16, 0, 0, 1, 8, IO0)
1069 IRQNoFlags (IRQX) {}
1071 CreateWordField (Arg0, IO0._MIN, IOA0)
1072 CreateByteField (Arg0, IRQX._INT, IRQL)
1074 Divide(IOA0, 256, Local0, Local1)
1075 ShiftRight(Local1, 8, Local1)
1077 FindSetLeftBit (IRQL, Local3)
1078 Subtract (Local3, 0x01, Local3)
1082 Store (Local1, IO1H)
1083 Store (Local0, IO1L)
1084 Store (Local3, IRQ0)
1091 #ifndef NO_W83627HF_KBC
1092 /* ===================== Keyboard Controller ===================== */
1094 Name (_HID, EisaId ("PNP0303"))
1095 Name (_CID, 0x0B03D041)
1096 Name (_UID, "w83627hf-kbc")
1100 Store (0x00, Local0)
1104 Store (0x0F, Local0)
1106 ElseIf (Lor(LOr (IO1H, IO1L), LOr (IO2H, IO2L)))
1108 Store (0x0D, Local0)
1125 Name (CRS, ResourceTemplate () {
1126 IO (Decode16, 0x0000, 0x0000, 0x01, 0x01, IO0)
1127 IO (Decode16, 0x0000, 0x0000, 0x01, 0x01, IO1)
1128 IRQNoFlags (IRQX) {}
1138 ShiftLeft(Local0, 8, Local0)
1139 Or (Local1, Local0, Local0)
1141 ShiftLeft(Local2, 8, Local2)
1142 Or (Local1, Local0, Local0)
1144 CreateWordField (CRS, IO0._MIN, IMIN)
1145 Store (Local0, IMIN)
1146 CreateWordField (CRS, IO0._MAX, IMAX)
1147 Store (Local0, IMAX)
1149 CreateWordField (CRS, IO1._MIN, I1MI)
1150 Store (Local2, I1MI)
1151 CreateWordField (CRS, IO1._MAX, I1MA)
1152 Store (Local2, I1MA)
1154 CreateWordField (CRS, IRQX._INT, IRQW)
1156 ShiftLeft (Local5, Local4, IRQW)
1161 Name (_PRS, ResourceTemplate ()
1163 StartDependentFn (0,0) {
1164 IO (Decode16, 0x0060, 0x0060, 0x01, 0x01)
1165 IO (Decode16, 0x0064, 0x0064, 0x01, 0x01)
1171 Method (_SRS, 1, Serialized)
1173 Name (TMPL, ResourceTemplate () {
1174 IO (Decode16, 0, 0, 1, 1, IO0)
1175 IO (Decode16, 0, 0, 1, 1, IO1)
1176 IRQNoFlags (IRQX) {}
1178 CreateWordField (Arg0, IO0._MIN, IOA0)
1179 CreateWordField (Arg0, IO1._MIN, IOA1)
1180 CreateByteField (Arg0, IRQX._INT, IRQL)
1182 Divide(IOA0, 256, Local0, Local1)
1183 ShiftRight(Local1, 8, Local1)
1185 Divide(IOA1, 256, Local2, Local3)
1186 ShiftRight(Local1, 8, Local1)
1188 FindSetLeftBit (IRQL, Local4)
1189 Subtract (Local4, 0x01, Local4)
1193 Store (Local1, IO1H)
1194 Store (Local0, IO1L)
1195 Store (Local3, IO2H)
1196 Store (Local2, IO2L)
1197 Store (Local3, IRQ0)
1202 #ifndef NO_W83627HF_PS2M
1204 Name (_HID, EisaId ("PNP0F13"))
1205 Name (_UID, "w83627hf-ps2m")
1209 Store (0x00, Local0)
1212 If (LAnd(ACTR, IRQ1) ) {
1213 Store (0x0F, Local0)
1215 ElseIf (Lor(LOr (IO1H, IO1L), LOr (IO2H, IO2L)))
1217 Store (0x0D, Local0)
1233 Name (CRS, ResourceTemplate () {
1234 IRQNoFlags (IRQX) {}
1235 IO (Decode16, 0x0000, 0x0000, 0x01, 0x01, IO0)
1236 IO (Decode16, 0x0000, 0x0000, 0x01, 0x01, IO1)
1246 ShiftLeft(Local0, 8, Local0)
1247 Or (Local1, Local0, Local0)
1249 ShiftLeft(Local2, 8, Local2)
1250 Or (Local1, Local0, Local0)
1252 CreateWordField (CRS, IO0._MIN, IMIN)
1253 Store (Local0, IMIN)
1254 CreateWordField (CRS, IO0._MAX, IMAX)
1255 Store (Local0, IMAX)
1257 CreateWordField (CRS, IO1._MIN, I1MI)
1258 Store (Local2, I1MI)
1259 CreateWordField (CRS, IO1._MAX, I1MA)
1260 Store (Local2, I1MA)
1262 CreateWordField (CRS, IRQX._INT, IRQW)
1264 ShiftLeft (Local5, Local4, IRQW)
1269 Name (_PRS, ResourceTemplate ()
1271 StartDependentFn (0,0) {
1274 StartDependentFn (2,0) {
1275 IRQNoFlags () {1,3,4,5,6,7,9,10,11,12}
1280 Method (_SRS, 1, Serialized)
1282 Name (TMPL, ResourceTemplate () {
1283 IRQNoFlags (IRQX) {}
1285 CreateByteField (Arg0, IRQX._INT, IRQL)
1287 FindSetLeftBit (IRQL, Local0)
1288 Subtract (Local0, 0x01, Local0)
1292 Store (Local0, IRQ1)
1293 /* Only activates if KBD is active */
1301 #ifndef NO_W83627HF_GAME
1302 /* ========================== Game Port ========================== */
1304 Name (_HID, EisaId ("PNPB02F"))
1305 Name (_STR, Unicode ("Joystick/Game Port"))
1306 Name (_UID, "w83627hf-game")
1312 If (LOr(IO1L, IO1H)) {
1313 If (LOr(ACTR, ACT1)) {
1314 Store (0x0F, Local0)
1317 Store (0x0D, Local0)
1326 Name (CRS, ResourceTemplate () {
1327 IO (Decode16, 0x0000, 0x0000, 0x01, 0x01, IO0)
1328 IRQNoFlags (IRQX) {}
1336 ShiftLeft(Local0, 8, Local0)
1337 Or (Local1, Local0, Local0)
1339 CreateWordField (CRS, IO0._MIN, IMIN)
1340 Store (Local0, IMIN)
1341 CreateWordField (CRS, IO0._MAX, IMAX)
1342 Store (Local0, IMAX)
1345 CreateWordField (CRS, IRQX._INT, IRQW)
1347 ShiftLeft (Local3, Local2, IRQW)
1356 #ifndef NO_W83627HF_MIDI
1357 /* ========================== MIDI Port ========================== */
1359 Name (_HID, EisaId ("PNPB006"))
1360 Name (_STR, Unicode ("MPU-401 Compatible MIDI Port"))
1361 Name (_UID, "w83627hf-midi")
1367 If (LOr(IO2L, IO2H)) {
1368 If (LOr(ACTR, ACT2)) {
1369 Store (0x0F, Local0)
1372 Store (0x0D, Local0)
1381 Name (CRS, ResourceTemplate () {
1382 IO (Decode16, 0x0000, 0x0000, 0x02, 0x02, IO0)
1383 IRQNoFlags (IRQX) {}
1391 ShiftLeft(Local0, 8, Local0)
1392 Or (Local1, Local0, Local0)
1394 CreateWordField (CRS, IO0._MIN, IMIN)
1395 Store (Local0, IMIN)
1396 CreateWordField (CRS, IO0._MAX, IMAX)
1397 Store (Local0, IMAX)
1400 CreateWordField (CRS, IRQX._INT, IRQW)
1402 ShiftLeft (Local3, Local2, IRQW)
1411 /* ==== Suspend LED control if it is connected to the SuperIO ==== */
1416 And(Local0, 63, Local0)
1417 Or(Local0, ShiftLeft(And(Arg0, 0x03), 6), OPT4)
1421 /* ===== Power LED control if it is connected to the SuperIO ===== */
1426 And(Local0, 63, Local0)
1427 Or(Local0, ShiftLeft(And(Arg0, 0x03), 6), OPT4)
1431 #ifndef NO_W83627HF_HWMON
1432 /* ====================== Hardware Monitor ======================= */
1434 Name (_HID, EisaId ("PNP0C02")) // TODO: find better matching ID
1435 Name (_STR, Unicode("W83627 Hardware Monitor"))
1436 Name (_UID, "w83627hf-hwmon")
1440 Store (0x00, Local0)
1444 Store (0x0F, Local0)
1446 ElseIf (LOr (IO1H, IO1L))
1448 Store (0x0D, Local0)
1455 Store(^^_PSC (), Local0)
1456 If (Local0) { Return (Local0) }
1458 Store (HWPW, Local0)
1460 If (Local0) { Return (1) }
1476 Name (CRS, ResourceTemplate () {
1477 IO (Decode16, 0x0000, 0x0000, 0x08, 0x02, IO0)
1478 IRQNoFlags (IRQX) {}
1486 ShiftLeft(Local0, 8, Local0)
1487 Or (Local1, Local0, Local0)
1489 CreateWordField (CRS, IO0._MIN, IMIN)
1490 Store (Local0, IMIN)
1491 CreateWordField (CRS, IO0._MAX, IMAX)
1492 Store (Local0, IMAX)
1495 CreateWordField (CRS, IRQX._INT, IRQW)
1497 ShiftLeft (Local3, Local2, IRQW)
1504 /* Returns the wake source register.
1505 It is cleared after reading.
1506 Bit 0: Keyboard wake-up event
1507 Bit 1: Mouse wake-up event
1508 Bit 2: Power button event
1509 Bit 3: CIR wake-up event
1510 Bit 4: Power loss event
1511 Bit 5: VSB power loss status
1516 Store (CRE3, Local0)