[patch] enhance powerd(8) to handle max temperature

Pietro Cerutti gahr at gahr.ch
Tue Jul 31 07:28:13 UTC 2007


Hajimu UMEMOTO wrote:
> Hi,
> 
>>>>>> On Mon, 30 Jul 2007 23:31:33 +0200
>>>>>> Pietro Cerutti <gahr at gahr.ch> said:
> 
> gahr> I can't test it, since I can't use passive cooling, but how do not these
> gahr> two systems interfere with each other wrt setting the CPU frequency?
> gahr> What if, for example, my CPU temperature rises above _PSV but the CPU
> gahr> usage drops below 65%?
> 
> Do you mean that your hw.acpi.thermal.tz0._PSV has reasonable value?
> If so, perhaps, your ACPI BIOS is broken, and _TC1, _TC2 and _TSP are
> not defined correctly.  Please show me the output of `sysctl hw.acpi'
> and `acpidump -dt'.

Thanks for your help!

> sysctl hw.acpi
hw.acpi.supported_sleep_state: S1 S3 S4 S5
hw.acpi.power_button_state: S5
hw.acpi.sleep_button_state: S1
hw.acpi.lid_switch_state: NONE
hw.acpi.standby_state: S1
hw.acpi.suspend_state: S3
hw.acpi.sleep_delay: 1
hw.acpi.s4bios: 0
hw.acpi.verbose: 1
hw.acpi.disable_on_reboot: 0
hw.acpi.handle_reboot: 0
hw.acpi.reset_video: 0
hw.acpi.cpu.cx_lowest: C1
hw.acpi.thermal.min_runtime: 0
hw.acpi.thermal.polling_rate: 10
hw.acpi.thermal.user_override: 1
hw.acpi.thermal.tz0.temperature: 59.8C
hw.acpi.thermal.tz0.active: -1
hw.acpi.thermal.tz0.passive_cooling: 0
hw.acpi.thermal.tz0.thermal_flags: 0
hw.acpi.thermal.tz0._PSV: 80.0C
hw.acpi.thermal.tz0._HOT: -1
hw.acpi.thermal.tz0._CRT: 99.8C
hw.acpi.thermal.tz0._ACx: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
hw.acpi.acline: 1
hw.acpi.battery.life: 97
hw.acpi.battery.time: -1
hw.acpi.battery.state: 0
hw.acpi.battery.units: 1
hw.acpi.battery.info_expire: 5

> sudo acpidump -dt

/*
  RSD PTR: OEM=MSI, ACPI_Rev=1.0x (0)
RSDT=0x7f7c0000, cksum=157
 */
/*
  RSDT: Length=60, Revision=1, Checksum=212,
OEMID=MSI_NB, OEM Table ID=MEGABOOK, OEM Revision=0x3262007,
Creator ID=MSFT, Creator Revision=0x97
Entries={ 0x7f7c0200, 0x7f7c0390, 0x7f7c03f0, 0x7f7c0430, 0x7f7ce040,
0x7f7c4670 }
 */
/*
  FACP: Length=132, Revision=2, Checksum=98,
OEMID=MSI, OEM Table ID=1034, OEM Revision=0x3262007,
Creator ID=MSFT, Creator Revision=0x97
 FACS=0x7f7ce000, DSDT=0x7f7c05b0
INT_MODEL=APIC
Preferred_PM_Profile=Unspecified (0)
SCI_INT=9
SMI_CMD=0xb2, ACPI_ENABLE=0xe1, ACPI_DISABLE=0x1e, S4BIOS_REQ=0x0
PSTATE_CNT=0xe2
PM1a_EVT_BLK=0x800-0x803
PM1a_CNT_BLK=0x804-0x805
PM2_CNT_BLK=0x820-0x81f
PM_TMR_BLK=0x808-0x80b
GPE0_BLK=0x828-0x82f
CST_CNT=0xe3
P_LVL2_LAT=1 us, P_LVL3_LAT=85 us
FLUSH_SIZE=1024, FLUSH_STRIDE=16
DUTY_OFFSET=1, DUTY_WIDTH=0
DAY_ALRM=13, MON_ALRM=0, CENTURY=0
IAPC_BOOT_ARCH={8042}
Flags={WBINVD,PROC_C1,SLP_BUTTON,RTC_S4}
 */
/*
  FACS:Length=64, HwSig=0x00000000, Firm_Wake_Vec=0x00000000
Global_Lock=
Flags=
Version=1
 */
/*
  DSDT: Length=16571, Revision=1, Checksum=254,
OEMID=MSI_NB, OEM Table ID=MEGABOOK, OEM Revision=0x3262007,
Creator ID=INTL, Creator Revision=0x20051117
 */
/*
  APIC: Length=92, Revision=1, Checksum=3,
OEMID=MSI, OEM Table ID=OEMAPIC, OEM Revision=0x3262007,
Creator ID=MSFT, Creator Revision=0x97
Local APIC ADDR=0xfee00000
Flags={PC-AT}

Type=Local APIC
ACPI CPU=1
Flags={ENABLED}
APIC ID=0

Type=Local APIC
ACPI CPU=2
Flags={ENABLED}
APIC ID=1

Type=IO APIC
APIC ID=2
INT BASE=0
ADDR=0x00000000fec00000

Type=INT Override
BUS=0
IRQ=0
INTR=2
Flags={Polarity=conforming, Trigger=conforming}

Type=INT Override
BUS=0
IRQ=9
INTR=9
Flags={Polarity=active-hi, Trigger=level}
 */
/*
  MCFG: Length=60, Revision=1, Checksum=63,
OEMID=MSI, OEM Table ID=OEMMCFG, OEM Revision=0x3262007,
Creator ID=MSFT, Creator Revision=0x97

Base Address= 0x00000000e0000000
Segment Group= 0x0000
Start Bus= 0
End Bus= 255
 */
/*
  SLIC: Length=374, Revision=1, Checksum=213,
OEMID=MSI_NB, OEM Table ID=MEGABOOK, OEM Revision=0x3262007,
Creator ID=MSFT, Creator Revision=0x97
 */
acpidump: RSDT entry 4 (sig OEMB) is corrupt
/*
  HPET: Length=56, Revision=1, Checksum=3,
OEMID=MSI, OEM Table ID=OEMHPET, OEM Revision=0x3262007,
Creator ID=MSFT, Creator Revision=0x97
HPET Number=0
ADDR=0xfed00000:0[8] (Memory)	HW Rev=0xff
Comparitors=31
Counter Size=1
Legacy IRQ routing capable={TRUE}
PCI Vendor ID=0xffff
Minimal Tick=14318
 */
/*
 * Intel ACPI Component Architecture
 * AML Disassembler version 20041119
 *
 * Disassembly of /tmp/acpidump.l8hiOT, Tue Jul 31 07:50:26 2007
 */
DefinitionBlock ("DSDT.aml", "DSDT", 1, "MSI_NB", "MEGABOOK", 52830215)
{
    Scope (_PR)
    {
        Processor (CPU1, 0x01, 0x00000810, 0x06)
        {
            OperationRegion (STBL, SystemMemory, 0x7F7CE0C0, 0x06CA)
            Name (NCPU, 0x02)
            Name (TYPE, 0x80000000)
            Name (HNDL, 0x80000000)
            Name (CFGD, 0x010061F1)
            Name (TBLD, 0x80)
            Method (_PDC, 1, NotSerialized)
            {
                CreateDWordField (Arg0, Zero, REVS)
                CreateDWordField (Arg0, 0x04, SIZE)
                Store (SizeOf (Arg0), Local0)
                Store (Subtract (Local0, 0x08), Local1)
                CreateField (Arg0, 0x40, Multiply (Local1, 0x08), TEMP)
                Name (STS0, Buffer (0x04)
                {
                    0x00, 0x00, 0x00, 0x00
                })
                Concatenate (STS0, TEMP, Local2)
                _OSC (Buffer (0x10)
                    {
                        0x16, 0xA6, 0x77, 0x40, 0x0C, 0x29, 0xBE, 0x47,
                        0x9E, 0xBD, 0xD8, 0x70, 0x58, 0x71, 0x39, 0x53
                    }, REVS, SIZE, Local2)
            }

            Method (_OSC, 4, NotSerialized)
            {
                CreateDWordField (Arg3, Zero, STS0)
                CreateDWordField (Arg3, 0x04, CAP0)
                CreateDWordField (Arg0, Zero, IID0)
                CreateDWordField (Arg0, 0x04, IID1)
                CreateDWordField (Arg0, 0x08, IID2)
                CreateDWordField (Arg0, 0x0C, IID3)
                Name (UID0, Buffer (0x10)
                {
                    0x16, 0xA6, 0x77, 0x40, 0x0C, 0x29, 0xBE, 0x47,
                    0x9E, 0xBD, 0xD8, 0x70, 0x58, 0x71, 0x39, 0x53
                })
                CreateDWordField (UID0, Zero, EID0)
                CreateDWordField (UID0, 0x04, EID1)
                CreateDWordField (UID0, 0x08, EID2)
                CreateDWordField (UID0, 0x0C, EID3)
                If (LNot (LAnd (LAnd (LEqual (IID0, EID0), LEqual (IID1,
EID1)), LAnd (LEqual (IID2, EID2), LEqual (IID3, EID3)))))
                {
                    Store (0x06, STS0)
                    Return (Arg3)
                }

                If (LNot (LEqual (Arg1, One)))
                {
                    Store (0x0A, STS0)
                    Return (Arg3)
                }

                Or (And (TYPE, 0x7FFFFFFF), CAP0, TYPE)
                If (And (CFGD, One))
                {
                    If (LAnd (LEqual (And (TYPE, 0x09), 0x09), LNot (And
(TBLD, One))))
                    {
                        Or (TBLD, One, TBLD)
                        Load (STBL, HNDL)
                    }
                }

                If (And (CFGD, 0xF0))
                {
                    If (LAnd (LAnd (And (CFGD, 0x01000000), And (TYPE,
0x18)), LNot (And (TBLD, 0x02))))
                    {
                        Or (TBLD, 0x02, TBLD)
                    }
                }

                Return (Arg3)
            }
        }
    }

    Scope (_PR)
    {
        Processor (CPU2, 0x02, 0x00000810, 0x06)
        {
            OperationRegion (STBL, SystemMemory, 0x7F7CE790, 0x0120)
            Name (NCPU, 0x02)
            Name (TYPE, 0x80000000)
            Name (HNDL, 0x80000000)
            Name (CFGD, 0x010061F1)
            Name (TBLD, 0x80)
            Method (_PDC, 1, NotSerialized)
            {
                CreateDWordField (Arg0, Zero, REVS)
                CreateDWordField (Arg0, 0x04, SIZE)
                Store (SizeOf (Arg0), Local0)
                Store (Subtract (Local0, 0x08), Local1)
                CreateField (Arg0, 0x40, Multiply (Local1, 0x08), TEMP)
                Name (STS0, Buffer (0x04)
                {
                    0x00, 0x00, 0x00, 0x00
                })
                Concatenate (STS0, TEMP, Local2)
                _OSC (Buffer (0x10)
                    {
                        0x16, 0xA6, 0x77, 0x40, 0x0C, 0x29, 0xBE, 0x47,
                        0x9E, 0xBD, 0xD8, 0x70, 0x58, 0x71, 0x39, 0x53
                    }, REVS, SIZE, Local2)
            }

            Method (_OSC, 4, NotSerialized)
            {
                CreateDWordField (Arg3, Zero, STS0)
                CreateDWordField (Arg3, 0x04, CAP0)
                CreateDWordField (Arg0, Zero, IID0)
                CreateDWordField (Arg0, 0x04, IID1)
                CreateDWordField (Arg0, 0x08, IID2)
                CreateDWordField (Arg0, 0x0C, IID3)
                Name (UID0, Buffer (0x10)
                {
                    0x16, 0xA6, 0x77, 0x40, 0x0C, 0x29, 0xBE, 0x47,
                    0x9E, 0xBD, 0xD8, 0x70, 0x58, 0x71, 0x39, 0x53
                })
                CreateDWordField (UID0, Zero, EID0)
                CreateDWordField (UID0, 0x04, EID1)
                CreateDWordField (UID0, 0x08, EID2)
                CreateDWordField (UID0, 0x0C, EID3)
                If (LNot (LAnd (LAnd (LEqual (IID0, EID0), LEqual (IID1,
EID1)), LAnd (LEqual (IID2, EID2), LEqual (IID3, EID3)))))
                {
                    Store (0x06, STS0)
                    Return (Arg3)
                }

                If (LNot (LEqual (Arg1, One)))
                {
                    Store (0x0A, STS0)
                    Return (Arg3)
                }

                Or (And (TYPE, 0x7FFFFFFF), CAP0, TYPE)
                If (And (CFGD, One))
                {
                    If (LAnd (LAnd (And (CFGD, 0x01000000), LEqual (And
(TYPE, 0x09), 0x09)), LNot (And (TBLD, One))))
                    {
                        Or (TBLD, One, TBLD)
                        Load (STBL, HNDL)
                    }
                }

                If (And (CFGD, 0xF0))
                {
                    If (LAnd (LAnd (And (CFGD, 0x01000000), And (TYPE,
0x18)), LNot (And (TBLD, 0x02))))
                    {
                        Or (TBLD, 0x02, TBLD)
                    }
                }

                Return (Arg3)
            }
        }
    }

    Name (DP80, 0x80)
    Name (DP90, 0x90)
    Name (APIC, One)
    Name (PMBS, 0x0800)
    Name (PMLN, 0x80)
    Name (GPBS, 0x0480)
    Name (GPLN, 0x40)
    Name (SMBS, Zero)
    Name (SMBL, Zero)
    Name (PM30, 0x0830)
    Name (SUSW, 0xFF)
    Name (SMIR, 0xB2)
    Name (TPBA, 0xFED40000)
    Name (TPBL, Zero)
    Name (SMIP, 0xB2)
    Name (PCIB, 0xE0000000)
    Name (PCIL, 0x04000000)
    OperationRegion (BIOS, SystemMemory, 0x7F7CE064, 0xFF)
    Field (BIOS, ByteAcc, NoLock, Preserve)
    {
        SS1,    1,
        SS2,    1,
        SS3,    1,
        SS4,    1,
        Offset (0x01),
        IOST,   16,
        TOPM,   32,
        ROMS,   32,
        MG1B,   32,
        MG1L,   32,
        MG2B,   32,
        MG2L,   32,
        SPEE,   8,
        DMAX,   8,
        HPTA,   32,
        CPB0,   32,
        CPB1,   32,
        CPB2,   32,
        CPB3,   32,
        ASSB,   8,
        AOTB,   8,
        AAXB,   32,
        DTSF,   8,
        DTSE,   8,
        DTS1,   8,
        DTS2,   8,
        MPEN,   8,
        TPMF,   8,
        MG3B,   32,
        MG3L,   32,
        MH1B,   32,
        MH1L,   32
    }

    Method (RRIO, 4, NotSerialized)
    {
        Store ("RRIO", Debug)
    }

    Method (RDMA, 3, NotSerialized)
    {
        Store ("rDMA", Debug)
    }

    Name (PICM, Zero)
    Method (_PIC, 1, NotSerialized)
    {
        If (Arg0)
        {
            Store (0xAA, DBG8)
        }
        Else
        {
            Store (0xAC, DBG8)
        }

        Store (Arg0, PICM)
    }

    Name (OSVR, Ones)
    Method (OSFL, 0, NotSerialized)
    {
        If (LNot (LEqual (OSVR, Ones)))
        {
            Return (OSVR)
        }

        If (LEqual (PICM, Zero))
        {
            Store (0xAC, DBG8)
        }

        Store (One, OSVR)
        If (CondRefOf (_OSI, Local1))
        {
            If (_OSI ("Windows 2000"))
            {
                Store (0x04, OSVR)
            }

            If (_OSI ("Windows 2001"))
            {
                Store (Zero, OSVR)
            }

            If (_OSI ("Windows 2001 SP1"))
            {
                Store (Zero, OSVR)
            }

            If (_OSI ("Windows 2001 SP2"))
            {
                Store (Zero, OSVR)
            }

            If (_OSI ("Windows 2001.1"))
            {
                Store (Zero, OSVR)
            }

            If (_OSI ("Windows 2001.1 SP1"))
            {
                Store (Zero, OSVR)
            }

            If (_OSI ("Windows 2006"))
            {
                Store (Zero, OSVR)
            }
        }
        Else
        {
            If (MCTH (_OS, "Microsoft Windows NT"))
            {
                Store (0x04, OSVR)
            }
            Else
            {
                If (MCTH (_OS, "Microsoft WindowsME: Millennium Edition"))
                {
                    Store (0x02, OSVR)
                }

                If (MCTH (_OS, "Linux"))
                {
                    Store (0x03, OSVR)
                }
            }
        }

        Return (OSVR)
    }

    Method (MCTH, 2, NotSerialized)
    {
        If (LLess (SizeOf (Arg0), SizeOf (Arg1)))
        {
            Return (Zero)
        }

        Add (SizeOf (Arg0), One, Local0)
        Name (BUF0, Buffer (Local0) {})
        Name (BUF1, Buffer (Local0) {})
        Store (Arg0, BUF0)
        Store (Arg1, BUF1)
        While (Local0)
        {
            Decrement (Local0)
            If (LNot (LEqual (DerefOf (Index (BUF0, Local0)), DerefOf
(Index (BUF1, Local0)))))
            {
                Return (Zero)
            }
        }

        Return (One)
    }

    Name (PRWP, Package (0x02)
    {
        Zero,
        Zero
    })
    Method (GPRW, 2, NotSerialized)
    {
        Store (Arg0, Index (PRWP, Zero))
        Store (ShiftLeft (SS1, One), Local0)
        Or (Local0, ShiftLeft (SS2, 0x02), Local0)
        Or (Local0, ShiftLeft (SS3, 0x03), Local0)
        Or (Local0, ShiftLeft (SS4, 0x04), Local0)
        If (And (ShiftLeft (One, Arg1), Local0))
        {
            Store (Arg1, Index (PRWP, One))
        }
        Else
        {
            ShiftRight (Local0, One, Local0)
            If (LOr (LEqual (OSFL (), One), LEqual (OSFL (), 0x02)))
            {
                FindSetLeftBit (Local0, Index (PRWP, One))
            }
            Else
            {
                FindSetRightBit (Local0, Index (PRWP, One))
            }
        }

        Return (PRWP)
    }

    Name (WAKP, Package (0x02)
    {
        Zero,
        Zero
    })
    OperationRegion (DEB0, SystemIO, DP80, One)
    Field (DEB0, ByteAcc, NoLock, Preserve)
    {
        DBG8,   8
    }

    OperationRegion (DEB1, SystemIO, DP90, 0x02)
    Field (DEB1, WordAcc, NoLock, Preserve)
    {
        DBG9,   16
    }

    Scope (_SB)
    {
        Name (PR00, Package (0x12)
        {
            Package (0x04)
            {
                0x0001FFFF,
                Zero,
                LNKA,
                Zero
            },

            Package (0x04)
            {
                0x0001FFFF,
                One,
                LNKB,
                Zero
            },

            Package (0x04)
            {
                0x0001FFFF,
                0x02,
                LNKC,
                Zero
            },

            Package (0x04)
            {
                0x0001FFFF,
                0x03,
                LNKD,
                Zero
            },

            Package (0x04)
            {
                0x001FFFFF,
                Zero,
                LNKC,
                Zero
            },

            Package (0x04)
            {
                0x001FFFFF,
                One,
                LNKD,
                Zero
            },

            Package (0x04)
            {
                0x001DFFFF,
                Zero,
                LNKH,
                Zero
            },

            Package (0x04)
            {
                0x001DFFFF,
                One,
                LNKD,
                Zero
            },

            Package (0x04)
            {
                0x001DFFFF,
                0x02,
                LNKC,
                Zero
            },

            Package (0x04)
            {
                0x001DFFFF,
                0x03,
                LNKA,
                Zero
            },

            Package (0x04)
            {
                0x001EFFFF,
                Zero,
                LNKB,
                Zero
            },

            Package (0x04)
            {
                0x001EFFFF,
                One,
                LNKE,
                Zero
            },

            Package (0x04)
            {
                0x001BFFFF,
                Zero,
                LNKA,
                Zero
            },

            Package (0x04)
            {
                0x001CFFFF,
                Zero,
                LNKA,
                Zero
            },

            Package (0x04)
            {
                0x001CFFFF,
                One,
                LNKB,
                Zero
            },

            Package (0x04)
            {
                0x001CFFFF,
                0x02,
                LNKC,
                Zero
            },

            Package (0x04)
            {
                0x001CFFFF,
                0x03,
                LNKD,
                Zero
            },

            Package (0x04)
            {
                0x0002FFFF,
                Zero,
                LNKA,
                Zero
            }
        })
        Name (AR00, Package (0x12)
        {
            Package (0x04)
            {
                0x0001FFFF,
                Zero,
                Zero,
                0x10
            },

            Package (0x04)
            {
                0x0001FFFF,
                One,
                Zero,
                0x11
            },

            Package (0x04)
            {
                0x0001FFFF,
                0x02,
                Zero,
                0x12
            },

            Package (0x04)
            {
                0x0001FFFF,
                0x03,
                Zero,
                0x13
            },

            Package (0x04)
            {
                0x001FFFFF,
                Zero,
                Zero,
                0x12
            },

            Package (0x04)
            {
                0x001FFFFF,
                One,
                Zero,
                0x13
            },

            Package (0x04)
            {
                0x001DFFFF,
                Zero,
                Zero,
                0x17
            },

            Package (0x04)
            {
                0x001DFFFF,
                One,
                Zero,
                0x13
            },

            Package (0x04)
            {
                0x001DFFFF,
                0x02,
                Zero,
                0x12
            },

            Package (0x04)
            {
                0x001DFFFF,
                0x03,
                Zero,
                0x10
            },

            Package (0x04)
            {
                0x001EFFFF,
                Zero,
                Zero,
                0x11
            },

            Package (0x04)
            {
                0x001EFFFF,
                One,
                Zero,
                0x14
            },

            Package (0x04)
            {
                0x001BFFFF,
                Zero,
                Zero,
                0x10
            },

            Package (0x04)
            {
                0x001CFFFF,
                Zero,
                Zero,
                0x10
            },

            Package (0x04)
            {
                0x001CFFFF,
                One,
                Zero,
                0x11
            },

            Package (0x04)
            {
                0x001CFFFF,
                0x02,
                Zero,
                0x12
            },

            Package (0x04)
            {
                0x001CFFFF,
                0x03,
                Zero,
                0x13
            },

            Package (0x04)
            {
                0x0002FFFF,
                Zero,
                Zero,
                0x10
            }
        })
        Name (PR04, Package (0x01)
        {
            Package (0x04)
            {
                0x0004FFFF,
                Zero,
                LNKA,
                Zero
            }
        })
        Name (AR04, Package (0x01)
        {
            Package (0x04)
            {
                0x0004FFFF,
                Zero,
                Zero,
                0x10
            }
        })
        Name (PR02, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF,
                Zero,
                LNKB,
                Zero
            },

            Package (0x04)
            {
                0xFFFF,
                One,
                LNKC,
                Zero
            },

            Package (0x04)
            {
                0xFFFF,
                0x02,
                LNKD,
                Zero
            },

            Package (0x04)
            {
                0xFFFF,
                0x03,
                LNKA,
                Zero
            }
        })
        Name (AR02, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF,
                Zero,
                Zero,
                0x11
            },

            Package (0x04)
            {
                0xFFFF,
                One,
                Zero,
                0x12
            },

            Package (0x04)
            {
                0xFFFF,
                0x02,
                Zero,
                0x13
            },

            Package (0x04)
            {
                0xFFFF,
                0x03,
                Zero,
                0x10
            }
        })
        Name (PR03, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF,
                Zero,
                LNKC,
                Zero
            },

            Package (0x04)
            {
                0xFFFF,
                One,
                LNKD,
                Zero
            },

            Package (0x04)
            {
                0xFFFF,
                0x02,
                LNKA,
                Zero
            },

            Package (0x04)
            {
                0xFFFF,
                0x03,
                LNKB,
                Zero
            }
        })
        Name (AR03, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF,
                Zero,
                Zero,
                0x12
            },

            Package (0x04)
            {
                0xFFFF,
                One,
                Zero,
                0x13
            },

            Package (0x04)
            {
                0xFFFF,
                0x02,
                Zero,
                0x10
            },

            Package (0x04)
            {
                0xFFFF,
                0x03,
                Zero,
                0x11
            }
        })
        Name (PR07, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF,
                Zero,
                LNKD,
                Zero
            },

            Package (0x04)
            {
                0xFFFF,
                One,
                LNKA,
                Zero
            },

            Package (0x04)
            {
                0xFFFF,
                0x02,
                LNKB,
                Zero
            },

            Package (0x04)
            {
                0xFFFF,
                0x03,
                LNKC,
                Zero
            }
        })
        Name (AR07, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF,
                Zero,
                Zero,
                0x13
            },

            Package (0x04)
            {
                0xFFFF,
                One,
                Zero,
                0x10
            },

            Package (0x04)
            {
                0xFFFF,
                0x02,
                Zero,
                0x11
            },

            Package (0x04)
            {
                0xFFFF,
                0x03,
                Zero,
                0x12
            }
        })
        Name (PR08, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF,
                Zero,
                LNKA,
                Zero
            },

            Package (0x04)
            {
                0xFFFF,
                One,
                LNKB,
                Zero
            },

            Package (0x04)
            {
                0xFFFF,
                0x02,
                LNKC,
                Zero
            },

            Package (0x04)
            {
                0xFFFF,
                0x03,
                LNKD,
                Zero
            }
        })
        Name (AR08, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF,
                Zero,
                Zero,
                0x10
            },

            Package (0x04)
            {
                0xFFFF,
                One,
                Zero,
                0x11
            },

            Package (0x04)
            {
                0xFFFF,
                0x02,
                Zero,
                0x12
            },

            Package (0x04)
            {
                0xFFFF,
                0x03,
                Zero,
                0x13
            }
        })
        Name (PR09, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF,
                Zero,
                LNKB,
                Zero
            },

            Package (0x04)
            {
                0xFFFF,
                One,
                LNKC,
                Zero
            },

            Package (0x04)
            {
                0xFFFF,
                0x02,
                LNKD,
                Zero
            },

            Package (0x04)
            {
                0xFFFF,
                0x03,
                LNKA,
                Zero
            }
        })
        Name (AR09, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF,
                Zero,
                Zero,
                0x11
            },

            Package (0x04)
            {
                0xFFFF,
                One,
                Zero,
                0x12
            },

            Package (0x04)
            {
                0xFFFF,
                0x02,
                Zero,
                0x13
            },

            Package (0x04)
            {
                0xFFFF,
                0x03,
                Zero,
                0x10
            }
        })
        Name (PRSA, ResourceTemplate ()
        {
            IRQ (Level, ActiveLow, Shared) {3,4,5,6,7,10,11,12,14,15}
        })
        Alias (PRSA, PRSB)
        Alias (PRSA, PRSC)
        Alias (PRSA, PRSD)
        Alias (PRSA, PRSE)
        Alias (PRSA, PRSF)
        Alias (PRSA, PRSG)
        Alias (PRSA, PRSH)
        Device (PCI0)
        {
            Name (_HID, EisaId ("PNP0A08"))
            Name (_ADR, Zero)
            Method (^BN00, 0, NotSerialized)
            {
                Return (Zero)
            }

            Method (_BBN, 0, NotSerialized)
            {
                Return (BN00 ())
            }

            Name (_UID, Zero)
            Method (_PRT, 0, NotSerialized)
            {
                If (PICM)
                {
                    Return (AR00)
                }

                Return (PR00)
            }

            Method (_S3D, 0, NotSerialized)
            {
                If (LOr (LEqual (OSFL (), One), LEqual (OSFL (), 0x02)))
                {
                    Return (0x02)
                }
                Else
                {
                    Return (0x03)
                }
            }

            Name (_CID, 0x030AD041)
            Device (MCH)
            {
                Name (_HID, EisaId ("PNP0C01"))
                Name (_UID, 0x0A)
                Name (_CRS, ResourceTemplate ()
                {
                    Memory32Fixed (ReadWrite, 0xFED13000, 0x00007000)
                })
            }

            Method (NPTS, 1, NotSerialized)
            {
            }

            Method (NWAK, 1, NotSerialized)
            {
            }

            Device (P0PC)
            {
                Name (_ADR, 0x00010000)
                Method (_PRW, 0, NotSerialized)
                {
                    Return (GPRW (0x09, 0x04))
                }
            }

            Device (P0P4)
            {
                Name (_ADR, 0x001E0000)
                Method (_PRW, 0, NotSerialized)
                {
                    Return (GPRW (0x0B, 0x04))
                }

                Method (_PRT, 0, NotSerialized)
                {
                    If (PICM)
                    {
                        Return (AR04)
                    }

                    Return (PR04)
                }

                Device (CBC0)
                {
                    Name (_ADR, 0x00040000)
                    OperationRegion (CBR0, PCI_Config, Zero, 0xE4)
                    Field (CBR0, DWordAcc, NoLock, Preserve)
                    {
                        Offset (0x44),
                        C044,   32,
                        Offset (0x91),
                        C091,   8,
                        Offset (0xA4),
                        C0A4,   8,
                        C0A5,   8,
                        Offset (0xE0),
                        C0E0,   8,
                        C0E1,   8
                    }

                    Method (_STA, 0, NotSerialized)
                    {
                        Return (0x0F)
                    }

                    Method (_S3D, 0, NotSerialized)
                    {
                        Return (0x03)
                    }

                    Method (_INI, 0, NotSerialized)
                    {
                        Or (C0A5, 0x81, C0A5)
                        And (C091, 0x7F, C091)
                        Store (Zero, C0A4)
                    }

                    Method (CEV0, 0, NotSerialized)
                    {
                        And (C0A5, 0x80, Local0)
                        Store (0xCB, DBG8)
                        If (Local0)
                        {
                            Notify (CBC0, 0x02)
                            Sleep (0x0BB8)
                            And (C0A5, 0xFE, Local1)
                            Store (Local1, C0A5)
                            Or (Local1, One, Local1)
                            Store (Local1, C0A5)
                        }
                    }

                    Method (_PRW, 0, NotSerialized)
                    {
                        Return (GPRW (0x0B, 0x03))
                    }
                }

                Device (CBC2)
                {
                    Name (_ADR, 0x00040002)
                }

                Device (CBC3)
                {
                    Name (_ADR, 0x00040003)
                }

                Device (CBC4)
                {
                    Name (_ADR, 0x00040004)
                }
            }

            Device (SBRG)
            {
                Name (_ADR, 0x001F0000)
                Device (IELK)
                {
                    Name (_HID, "AWY0001")
                    OperationRegion (RXA0, PCI_Config, 0xA0, 0x20)
                    Field (RXA0, ByteAcc, NoLock, Preserve)
                    {
                            ,   9,
                        PBLV,   1,
                        Offset (0x10),
                            ,   1,
                        PBMS,   1,
                            ,   1,
                        PMCS,   1,
                        ECNS,   1,
                        Offset (0x11),
                        ECT1,   16,
                        ELEN,   1,
                        Offset (0x14)
                    }

                    Method (\_GPE._L0A, 0, NotSerialized)
                    {
                        Notify (\_SB.PCI0.SBRG.IELK, 0x81)
                        Store (One, \_SB.PCI0.SBRG.IELK.PMCS)
                    }

                    Method (_STA, 0, NotSerialized)
                    {
                        If (ELEN)
                        {
                            Return (0x0F)
                        }
                        Else
                        {
                            Return (Zero)
                        }
                    }

                    Method (SMOD, 1, NotSerialized)
                    {
                    }

                    Method (GPBS, 0, NotSerialized)
                    {
                        Return (XOr (PBLV, One))
                    }
                }

                Method (SPTS, 1, NotSerialized)
                {
                    Store (One, PS1S)
                    Store (One, PS1E)
                    Store (One, SLPS)
                }

                Method (SWAK, 1, NotSerialized)
                {
                    Store (Zero, SLPS)
                    Store (Zero, PS1E)
                    If (BRTC) {}
                    Else
                    {
                        Notify (PWRB, 0x02)
                    }
                }

                OperationRegion (APMP, SystemIO, SMIR, 0x02)
                Field (APMP, ByteAcc, NoLock, Preserve)
                {
                    APMC,   8,
                    APMS,   8
                }

                Field (APMP, ByteAcc, NoLock, Preserve)
                {
                    Offset (0x01),
                        ,   1,
                    BRTC,   1
                }

                OperationRegion (PMS0, SystemIO, PMBS, 0x04)
                Field (PMS0, ByteAcc, NoLock, Preserve)
                {
                        ,   10,
                    RTCS,   1,
                        ,   4,
                    WAKS,   1,
                    Offset (0x03),
                    PWBT,   1,
                    Offset (0x04)
                }

                OperationRegion (SMIE, SystemIO, PM30, 0x08)
                Field (SMIE, ByteAcc, NoLock, Preserve)
                {
                        ,   4,
                    PS1E,   1,
                        ,   31,
                    PS1S,   1,
                    Offset (0x08)
                }

                Scope (\_SB)
                {
                }

                Device (PIC)
                {
                    Name (_HID, EisaId ("PNP0000"))
                    Name (_CRS, ResourceTemplate ()
                    {
                        IO (Decode16, 0x0020, 0x0020, 0x00, 0x02)
                        IO (Decode16, 0x00A0, 0x00A0, 0x00, 0x02)
                        IRQNoFlags () {2}
                    })
                }

                Device (DMAD)
                {
                    Name (_HID, EisaId ("PNP0200"))
                    Name (_CRS, ResourceTemplate ()
                    {
                        DMA (Compatibility, BusMaster, Transfer8) {4}
                        IO (Decode16, 0x0000, 0x0000, 0x00, 0x10)
                        IO (Decode16, 0x0081, 0x0081, 0x00, 0x03)
                        IO (Decode16, 0x0087, 0x0087, 0x00, 0x01)
                        IO (Decode16, 0x0089, 0x0089, 0x00, 0x03)
                        IO (Decode16, 0x008F, 0x008F, 0x00, 0x01)
                        IO (Decode16, 0x00C0, 0x00C0, 0x00, 0x20)
                    })
                }

                Device (TMR)
                {
                    Name (_HID, EisaId ("PNP0100"))
                    Name (_CRS, ResourceTemplate ()
                    {
                        IO (Decode16, 0x0040, 0x0040, 0x00, 0x04)
                        IRQNoFlags () {0}
                    })
                }

                Device (RTC0)
                {
                    Name (_HID, EisaId ("PNP0B00"))
                    Name (_CRS, ResourceTemplate ()
                    {
                        IO (Decode16, 0x0070, 0x0070, 0x00, 0x02)
                        IRQNoFlags () {8}
                    })
                }

                Device (PS2K)
                {
                    Name (_HID, EisaId ("PNP0303"))
                    Name (_CID, 0x0B03D041)
                    Method (_STA, 0, NotSerialized)
                    {
                        ShiftLeft (One, 0x0A, Local0)
                        If (And (IOST, Local0))
                        {
                            Return (0x0F)
                        }

                        Return (Zero)
                    }

                    Name (_CRS, ResourceTemplate ()
                    {
                        IO (Decode16, 0x0060, 0x0060, 0x00, 0x01)
                        IO (Decode16, 0x0064, 0x0064, 0x00, 0x01)
                        IRQNoFlags () {1}
                    })
                }

                Device (PS2M)
                {
                    Name (_HID, EisaId ("PNP0F03"))
                    Name (_CID, 0x130FD041)
                    Method (_STA, 0, NotSerialized)
                    {
                        ShiftLeft (One, 0x0C, Local0)
                        If (And (IOST, Local0))
                        {
                            Return (0x0F)
                        }

                        Return (Zero)
                    }

                    Name (_CRS, ResourceTemplate ()
                    {
                        IRQNoFlags () {12}
                    })
                }

                Device (SPKR)
                {
                    Name (_HID, EisaId ("PNP0800"))
                    Name (_CRS, ResourceTemplate ()
                    {
                        IO (Decode16, 0x0061, 0x0061, 0x00, 0x01)
                    })
                }

                Device (COPR)
                {
                    Name (_HID, EisaId ("PNP0C04"))
                    Name (_CRS, ResourceTemplate ()
                    {
                        IO (Decode16, 0x00F0, 0x00F0, 0x00, 0x10)
                        IRQNoFlags () {13}
                    })
                }

                Device (RMSC)
                {
                    Name (_HID, EisaId ("PNP0C02"))
                    Name (_UID, 0x10)
                    Name (CRS, ResourceTemplate ()
                    {
                        IO (Decode16, 0x0010, 0x0010, 0x00, 0x10)
                        IO (Decode16, 0x0022, 0x0022, 0x00, 0x1E)
                        IO (Decode16, 0x0044, 0x0044, 0x00, 0x1C)
                        IO (Decode16, 0x0063, 0x0063, 0x00, 0x01)
                        IO (Decode16, 0x0065, 0x0065, 0x00, 0x01)
                        IO (Decode16, 0x0067, 0x0067, 0x00, 0x09)
                        IO (Decode16, 0x0072, 0x0072, 0x00, 0x0E)
                        IO (Decode16, 0x0080, 0x0080, 0x00, 0x01)
                        IO (Decode16, 0x0084, 0x0084, 0x00, 0x03)
                        IO (Decode16, 0x0088, 0x0088, 0x00, 0x01)
                        IO (Decode16, 0x008C, 0x008C, 0x00, 0x03)
                        IO (Decode16, 0x0090, 0x0090, 0x00, 0x10)
                        IO (Decode16, 0x00A2, 0x00A2, 0x00, 0x1E)
                        IO (Decode16, 0x00E0, 0x00E0, 0x00, 0x10)
                        IO (Decode16, 0x04D0, 0x04D0, 0x00, 0x02)
                        IO (Decode16, 0x0000, 0x0000, 0x00, 0x00)
                        IO (Decode16, 0x0000, 0x0000, 0x00, 0x00)
                        IO (Decode16, 0x0000, 0x0000, 0x00, 0x00)
                        Memory32Fixed (ReadOnly, 0xFFF80000, 0x00080000)
                        Memory32Fixed (ReadOnly, 0xFFB80000, 0x0017D000)
                        Memory32Fixed (ReadWrite, 0xFED1C000, 0x00004000)
                        Memory32Fixed (ReadWrite, 0xFED20000, 0x00070000)
                        Memory32Fixed (ReadOnly, 0xFFF80000, 0x00080000)
                    })
                    Method (_CRS, 0, NotSerialized)
                    {
                        CreateWordField (CRS, 0x7A, GP00)
                        CreateWordField (CRS, 0x7C, GP01)
                        CreateByteField (CRS, 0x7F, GP0L)
                        Store (PMBS, GP00)
                        Store (PMBS, GP01)
                        Store (PMLN, GP0L)
                        If (SMBS)
                        {
                            CreateWordField (CRS, 0x82, GP10)
                            CreateWordField (CRS, 0x84, GP11)
                            CreateByteField (CRS, 0x87, GP1L)
                            Store (SMBS, GP10)
                            Store (SMBS, GP11)
                            Store (SMBL, GP1L)
                        }

                        If (GPBS)
                        {
                            CreateWordField (CRS, 0x8A, GP20)
                            CreateWordField (CRS, 0x8C, GP21)
                            CreateByteField (CRS, 0x8F, GP2L)
                            Store (GPBS, GP20)
                            Store (GPBS, GP21)
                            Store (GPLN, GP2L)
                        }

                        Return (CRS)
                    }
                }

                Device (HPET)
                {
                    Name (_HID, EisaId ("PNP0103"))
                    Name (CRS, ResourceTemplate ()
                    {
                        Memory32Fixed (ReadOnly, 0xFED00000, 0x00000400)
                    })
                    OperationRegion (^LPCR, SystemMemory, 0xFED1F404, 0x04)
                    Field (LPCR, AnyAcc, NoLock, Preserve)
                    {
                        HPTS,   2,
                            ,   5,
                        HPTE,   1,
                        Offset (0x04)
                    }

                    Method (_STA, 0, NotSerialized)
                    {
                        If (LEqual (OSFL (), Zero))
                        {
                            If (HPTE)
                            {
                                Return (0x0F)
                            }
                        }
                        Else
                        {
                            If (HPTE)
                            {
                                Return (0x0B)
                            }
                        }

                        Return (Zero)
                    }

                    Method (_CRS, 0, NotSerialized)
                    {
                        CreateDWordField (CRS, 0x04, HPT)
                        Multiply (HPTS, 0x1000, Local0)
                        Add (Local0, 0xFED00000, HPT)
                        Return (CRS)
                    }
                }

                OperationRegion (RX80, PCI_Config, Zero, 0xFF)
                Field (RX80, ByteAcc, NoLock, Preserve)
                {
                    Offset (0x80),
                    LPCD,   16,
                    LPCE,   16
                }

                Name (DBPT, Package (0x04)
                {
                    Package (0x08)
                    {
                        0x03F8,
                        0x02F8,
                        0x0220,
                        0x0228,
                        0x0238,
                        0x02E8,
                        0x0338,
                        0x03E8
                    },

                    Package (0x08)
                    {
                        0x03F8,
                        0x02F8,
                        0x0220,
                        0x0228,
                        0x0238,
                        0x02E8,
                        0x0338,
                        0x03E8
                    },

                    Package (0x03)
                    {
                        0x0378,
                        0x0278,
                        0x03BC
                    },

                    Package (0x02)
                    {
                        0x03F0,
                        0x0370
                    }
                })
                Name (DDLT, Package (0x04)
                {
                    Package (0x02)
                    {
                        Zero,
                        0xFFF8
                    },

                    Package (0x02)
                    {
                        0x04,
                        0xFF8F
                    },

                    Package (0x02)
                    {
                        0x08,
                        0xFCFF
                    },

                    Package (0x02)
                    {
                        0x0C,
                        0xEFFF
                    }
                })
                Method (RRIO, 4, NotSerialized)
                {
                    If (LAnd (LNot (LGreater (Arg0, 0x03)), LNot (LLess
(Arg0, Zero))))
                    {
                        Store (Match (DerefOf (Index (DBPT, Arg0)), MEQ,
Arg2, MTR, Zero, Zero), Local0)
                        If (LNot (LEqual (Local0, Ones)))
                        {
                            Store (DerefOf (Index (DerefOf (Index (DDLT,
Arg0)), Zero)), Local1)
                            Store (DerefOf (Index (DerefOf (Index (DDLT,
Arg0)), One)), Local2)
                            ShiftLeft (Local0, Local1, Local0)
                            And (LPCD, Local2, LPCD)
                            Or (LPCD, Local0, LPCD)
                            WX82 (Arg0, Arg1)
                        }
                    }

                    If (LEqual (Arg0, 0x08))
                    {
                        If (LEqual (Arg2, 0x0200))
                        {
                            WX82 (0x08, Arg0)
                        }
                        Else
                        {
                            If (LEqual (Arg2, 0x0208))
                            {
                                WX82 (0x09, Arg0)
                            }
                        }
                    }

                    If (LAnd (LNot (LGreater (Arg0, 0x0D)), LNot (LLess
(Arg0, 0x0A))))
                    {
                        WX82 (Arg0, Arg1)
                    }
                }

                Method (WX82, 2, NotSerialized)
                {
                    ShiftLeft (One, Arg0, Local0)
                    If (Arg1)
                    {
                        Or (LPCE, Local0, LPCE)
                    }
                    Else
                    {
                        Not (Local0, Local0)
                        And (LPCE, Local0, LPCE)
                    }
                }

                Method (RDMA, 3, NotSerialized)
                {
                }

                Scope (\)
                {
                    Field (BIOS, ByteAcc, NoLock, Preserve)
                    {
                        Offset (0x22),
                        OSYS,   16,
                        SMIF,   8,
                        BLID,   8,
                        ACPR,   32,
                        CADL,   16,
                        PADL,   16,
                        IGDS,   8,
                        CSTE,   16,
                        NSTE,   16,
                        SSTE,   16,
                        CTID,   8
                    }
                }

                Device (EC)
                {
                    Name (_HID, EisaId ("PNP0C09"))
                    Name (_GPE, 0x19)
                    Name (MYEC, Zero)
                    Name (CTSD, Zero)
                    Name (\PPCL, Zero)
                    Method (_REG, 2, NotSerialized)
                    {
                        If (LEqual (Arg0, 0x03))
                        {
                            Store (Arg1, MYEC)
                        }

                        Store (Zero, CTSD)
                        Store (Zero, PPCL)
                    }

                    Name (_CRS, ResourceTemplate ()
                    {
                        IO (Decode16, 0x0062, 0x0062, 0x00, 0x01)
                        IO (Decode16, 0x0066, 0x0066, 0x00, 0x01)
                    })
                    OperationRegion (EC, EmbeddedControl, Zero, 0xFF)
                    Field (EC, ByteAcc, NoLock, Preserve)
                    {
                        SMPR,   8,
                        SMST,   8,
                        SMAD,   8,
                        SMCM,   8,
                        SMD0,   264,
                        SMAA,   8,
                        Offset (0x30),
                        POWS,   1,
                        LIDS,   1,
                        KBCS,   1,
                        Offset (0x31),
                        MBTS,   1,
                        MBCS,   1,
                        MBDS,   1,
                        MBFS,   1,
                        MBWS,   1,
                        MBLS,   1,
                        MBCL,   1,
                        MBFL,   1,
                        Offset (0x38),
                        MDCL,   8,
                        MDCH,   8,
                        MDVL,   8,
                        MDVH,   8,
                        MCAL,   8,
                        MCAH,   8,
                        MSTL,   8,
                        MSTH,   8,
                        MCCL,   8,
                        MCCH,   8,
                        MPOL,   8,
                        MPOH,   8,
                        MFCL,   8,
                        MFCH,   8,
                        MCUL,   8,
                        MCUH,   8,
                        MRCL,   8,
                        MRCH,   8,
                        MVOL,   8,
                        MVOH,   8,
                        MTEL,   8,
                        MTEH,   8,
                        RSV1,   8,
                        RSV2,   8,
                        SDCL,   8,
                        SDCH,   8,
                        SDVL,   8,
                        SDVH,   8,
                        SCAL,   8,
                        SCAH,   8,
                        SSTL,   8,
                        SSTH,   8,
                        SCCL,   8,
                        SCCH,   8,
                        SPOL,   8,
                        SPOH,   8,
                        SFCL,   8,
                        SFCH,   8,
                        SCUL,   8,
                        SCUH,   8,
                        SRCL,   8,
                        SRCH,   8,
                        SVOL,   8,
                        SVOH,   8,
                        STEL,   8,
                        STEH,   8,
                        Offset (0x68),
                        CPUT,   8,
                        Offset (0x7E),
                        RES1,   3,
                        CHET,   1,
                        RES2,   4,
                        Offset (0x80),
                        SYST,   8
                    }

                    OperationRegion (APMP, SystemIO, 0xB2, 0x02)
                    Field (APMP, ByteAcc, NoLock, Preserve)
                    {
                        APMC,   8,
                        APMS,   8
                    }

                    Device (ADP1)
                    {
                        Name (_HID, "ACPI0003")
                        Name (BFLG, One)
                        Name (ACP, One)
                        Name (INIT, One)
                        Method (_PSR, 0, NotSerialized)
                        {
                            If (ACP)
                            {
                                Return (One)
                            }
                            Else
                            {
                                Return (Zero)
                            }
                        }

                        Method (_STA, 0, NotSerialized)
                        {
                            If (MYEC)
                            {
                                If (INIT)
                                {
                                    Store (MBTS, Local0)
                                    If (LEqual (Local0, One))
                                    {
                                        Store (One, BFLG)
                                    }
                                    Else
                                    {
                                        Store (Zero, BFLG)
                                    }

                                    Store (POWS, Local0)
                                    If (LEqual (Local0, One))
                                    {
                                        Store (One, ACP)
                                    }
                                    Else
                                    {
                                        Store (Zero, ACP)
                                    }
                                }

                                Store (Zero, INIT)
                            }

                            Return (0x0F)
                        }

                        Name (_PCL, Package (0x01)
                        {
                            _SB
                        })
                    }

                    Name (BIF0, Package (0x0D)
                    {
                        One,
                        0x1130,
                        0x1130,
                        One,
                        0x39D0,
                        Zero,
                        Zero,
                        One,
                        One,
                        "BAT1",
                        "1234",
                        "LION",
                        "MSI Corp."
                    })
                    Name (STAT, Package (0x04)
                    {
                        0x02,
                        0x0500,
                        0x0800,
                        0x03E8
                    })
                    Device (BAT1)
                    {
                        Name (_HID, EisaId ("PNP0C0A"))
                        Name (_UID, One)
                        Name (_PCL, Package (0x01)
                        {
                            _SB
                        })
                        Method (_STA, 0, NotSerialized)
                        {
                            If (^^ADP1.BFLG)
                            {
                                Return (0x1F)
                            }
                            Else
                            {
                                Return (0x0F)
                            }
                        }

                        Method (_BIF, 0, NotSerialized)
                        {
                            If (MYEC)
                            {
                                UPBI ()
                            }
                            Else
                            {
                                IVBI ()
                                Store (0x99, DBG8)
                                Sleep (0x03E8)
                            }

                            Return (BIF0)
                        }

                        Method (_BST, 0, NotSerialized)
                        {
                            If (MYEC)
                            {
                                UPBS ()
                            }
                            Else
                            {
                                IVBS ()
                            }

                            Return (STAT)
                        }

                        Method (IVBI, 0, NotSerialized)
                        {
                            Store (Ones, Index (BIF0, One))
                            Store (Ones, Index (BIF0, 0x02))
                            Store (Ones, Index (BIF0, 0x04))
                            Store ("Wrong", Index (BIF0, 0x09))
                            Store (" ", Index (BIF0, 0x0A))
                            Store ("Wrong", Index (BIF0, 0x0B))
                            Store ("Wrong", Index (BIF0, 0x0C))
                        }

                        Method (IVBS, 0, NotSerialized)
                        {
                            Store (Zero, Index (STAT, Zero))
                            Store (Ones, Index (STAT, One))
                            Store (Ones, Index (STAT, 0x02))
                            Store (0x2710, Index (STAT, 0x03))
                        }

                        Method (UPBI, 0, NotSerialized)
                        {
                            Store (Zero, Local0)
                            Store (Zero, Local1)
                            Store (Zero, Local2)
                            Store (Zero, Local3)
                            Store (MDCH, Local0)
                            Store (MDCL, Local1)
                            ShiftLeft (Local0, 0x08, Local0)
                            Or (Local0, Local1, Local0)
                            Store (Local0, Index (BIF0, One))
                            Store (MFCH, Local0)
                            Store (MFCL, Local1)
                            ShiftLeft (Local0, 0x08, Local0)
                            Or (Local0, Local1, Local1)
                            Store (Local1, Index (BIF0, 0x02))
                            Store (MDVH, Local0)
                            Store (MDVL, Local2)
                            ShiftLeft (Local0, 0x08, Local0)
                            Or (Local0, Local2, Local2)
                            Store (Local2, Index (BIF0, 0x04))
                            If (LEqual (CTID, One))
                            {
                                Store (CTID, DBG8)
                                Sleep (0x0BB8)
                                Store (" LG ", Index (BIF0, 0x0C))
                            }
                        }

                        Method (UPBS, 0, NotSerialized)
                        {
                            Store (Zero, Local0)
                            Store (Zero, Local1)
                            Store (Zero, Local2)
                            Store (Zero, Local3)
                            Store (Zero, Local4)
                            Store (Zero, Local7)
                            Store (MBTS, Local0)
                            If (LEqual (Local0, One))
                            {
                                Store (POWS, Local0)
                                If (LEqual (Local0, One))
                                {
                                    Store (MBCS, Local1)
                                    If (LEqual (Local1, One))
                                    {
                                        Or (Local4, 0x02, Local4)
                                    }
                                }
                                Else
                                {
                                    Or (Local4, One, Local4)
                                    Store (MBLS, Local0)
                                    If (LEqual (Local0, One))
                                    {
                                        Or (Local4, 0x04, Local4)
                                    }
                                }

                                Store (POWS, Local0)
                                If (LEqual (Local0, One))
                                {
                                    Store (MBCS, Local0)
                                    If (LEqual (Local0, One))
                                    {
                                        Store (MCUH, Local0)
                                        Store (MCUL, Local1)
                                        ShiftLeft (Local0, 0x08, Local0)
                                        Or (Local0, Local1, Local1)
                                        If (LEqual (Local1, 0xFFFF))
                                        {
                                            Store (Ones, Local1)
                                        }

                                        Store (Local1, Index (STAT, One))
                                    }
                                    Else
                                    {
                                        Store (Zero, Index (STAT, One))
                                    }
                                }
                                Else
                                {
                                    Store (MCUH, Local0)
                                    Store (MCUL, Local1)
                                    ShiftLeft (Local0, 0x08, Local0)
                                    Or (Local0, Local1, Local1)
                                    XOr (Local1, 0xFFFF, Local1)
                                    If (LEqual (Local1, Zero))
                                    {
                                        Store (Ones, Local1)
                                    }

                                    Store (Local1, Index (STAT, One))
                                }

                                Store (MRCH, Local0)
                                Store (MRCL, Local2)
                                ShiftLeft (Local0, 0x08, Local0)
                                Or (Local0, Local2, Local2)
                                Store (Local2, Index (STAT, 0x02))
                                Store (MVOH, Local0)
                                Store (MVOL, Local3)
                                ShiftLeft (Local0, 0x08, Local0)
                                Or (Local0, Local3, Local3)
                                Store (Local3, Index (STAT, 0x03))
                                Store (Local4, Index (STAT, Zero))
                                Sleep (0x64)
                            }
                            Else
                            {
                                IVBS ()
                            }
                        }
                    }

                    Method (_Q80, 0, NotSerialized)
                    {
                        Store (0x80, DBG8)
                    }

                    Method (_Q81, 0, NotSerialized)
                    {
                        If (LEqual (SPEE, Zero))
                        {
                            Store (0x68, DBG8)
                            Store (0x68, APMC)
                        }
                        Else
                        {
                            Store (0x81, DBG8)
                            Or (One, PPCL, PPCL)
                            Notify (\_PR.CPU1, 0x80)
                            Notify (\_PR.CPU2, 0x80)
                        }

                        Store (One, CHET)
                    }

                    Method (_Q82, 0, NotSerialized)
                    {
                        If (LEqual (SPEE, Zero))
                        {
                            Store (0x69, DBG8)
                            Store (0x69, APMC)
                        }
                        Else
                        {
                            Store (0x82, DBG8)
                            And (0xFE, PPCL, PPCL)
                            Notify (\_PR.CPU1, 0x80)
                            Notify (\_PR.CPU2, 0x80)
                        }

                        Store (One, CHET)
                    }

                    Method (_Q83, 0, NotSerialized)
                    {
                        Store (0x83, DBG8)
                        Store (Zero, Local0)
                        Store (POWS, Local0)
                        If (LEqual (Local0, One))
                        {
                            Store (One, ^ADP1.ACP)
                        }
                        Else
                        {
                            Store (Zero, ^ADP1.ACP)
                        }

                        Notify (ADP1, 0x80)
                    }

                    Method (_Q84, 0, NotSerialized)
                    {
                        Store (0x84, DBG8)
                        Notify (LID0, 0x80)
                    }

                    Method (_Q85, 0, NotSerialized)
                    {
                        Store (0x85, DBG8)
                        Store (One, CTSD)
                        Notify (\_TZ.THRM, 0x80)
                    }

                    Method (_Q86, 0, NotSerialized)
                    {
                        Store (0x86, DBG8)
                    }

                    Method (_Q87, 0, NotSerialized)
                    {
                        Store (0x87, DBG8)
                        Store (Zero, Local0)
                        Store (MBTS, Local0)
                        If (LEqual (Local0, One))
                        {
                            Store (One, ^ADP1.BFLG)
                            Notify (BAT1, 0x80)
                        }
                        Else
                        {
                            Store (Zero, ^ADP1.BFLG)
                            Notify (ADP1, 0x80)
                            Sleep (0x19)
                            Notify (BAT1, 0x81)
                        }

                        Notify (ADP1, 0x80)
                    }

                    Method (_Q88, 0, NotSerialized)
                    {
                        Store (0x88, DBG8)
                    }

                    Method (_Q89, 0, NotSerialized)
                    {
                        Store (0x89, DBG8)
                    }

                    Method (_Q8A, 0, NotSerialized)
                    {
                        Store (0x8A, DBG8)
                        Store (One, CTSD)
                        Notify (\_TZ.THRM, 0x80)
                    }

                    Method (_Q8B, 0, NotSerialized)
                    {
                        Store (0x8B, DBG8)
                    }

                    Method (_Q8C, 0, NotSerialized)
                    {
                        Store (0x8C, DBG8)
                    }

                    Method (_Q90, 0, NotSerialized)
                    {
                        Store (0x90, DBG8)
                    }

                    Method (_QB4, 0, NotSerialized)
                    {
                        Store (0xB4, DBG8)
                        If (LEqual (DSEN, Zero))
                        {
                            Store (0x10, SMIF)
                            Store (0x70, APMC)
                            If (LEqual (SMIF, Zero))
                            {
                                Store (CADL, PADL)
                                If (LEqual (OSFL (), Zero))
                                {
                                    Notify (PCI0, Zero)
                                }
                                Else
                                {
                                    Notify (IGFX, Zero)
                                }

                                Sleep (0x02EE)
                                Notify (IGFX, 0x80)
                            }
                        }

                        If (LEqual (DSEN, One))
                        {
                            Store (0x11, SMIF)
                            Store (0x70, APMC)
                            If (LEqual (SMIF, Zero))
                            {
                                Notify (IGFX, 0x81)
                            }
                        }
                    }

                    Method (_QB5, 0, NotSerialized)
                    {
                        Store (0xB5, DBG8)
                    }

                    Method (_QB6, 0, NotSerialized)
                    {
                        Store (0xB6, DBG8)
                    }

                    Method (_QB7, 0, NotSerialized)
                    {
                        Store (0xB7, DBG8)
                    }

                    Method (_QB8, 0, NotSerialized)
                    {
                        Store (0xB8, DBG8)
                    }

                    Method (_QB9, 0, NotSerialized)
                    {
                        Store (0xB9, DBG8)
                    }

                    Scope (\_SB)
                    {
                        Name (SLPS, Zero)
                        Device (SLPB)
                        {
                            Name (_HID, EisaId ("PNP0C0E"))
                        }

                        Device (LID0)
                        {
                            Name (_HID, EisaId ("PNP0C0D"))
                            Method (_LID, 0, NotSerialized)
                            {
                                If (^^PCI0.SBRG.EC.MYEC)
                                {
                                    Store (^^PCI0.SBRG.EC.LIDS, Local0)
                                }
                                Else
                                {
                                    Store (One, Local0)
                                }

                                Return (Local0)
                            }
                        }
                    }

                    Scope (\_GPE)
                    {
                        Method (_L01, 0, NotSerialized)
                        {
                            Sleep (0xC8)
                            Store (One, \_SB.PCI0.WAWA.PDC1)
                            Store (One, \_SB.PCI0.WAWA.HPCS)
                        }
                    }

                    Scope (^^^PCI0)
                    {
                        Device (WAWA)
                        {
                            Name (_ADR, 0x001C0000)
                            OperationRegion (P1CS, PCI_Config, 0x40, 0x0100)
                            Field (P1CS, AnyAcc, NoLock, WriteAsZeros)
                            {
                                Offset (0x1A),
                                ABP1,   1,
                                    ,   2,
                                PDC1,   1,
                                    ,   2,
                                PDS1,   1,
                                Offset (0x20),
                                Offset (0x22),
                                PSP1,   1,
                                Offset (0x9C),
                                    ,   30,
                                HPCS,   1,
                                PMCS,   1
                            }

                            Device (PECA)
                            {
                                Name (_ADR, Zero)
                                Method (_RMV, 0, NotSerialized)
                                {
                                    Return (One)
                                }
                            }
                        }
                    }
                }

                Scope (^^PCI0)
                {
                    Device (IGFX)
                    {
                        Name (\DSEN, One)
                        Name (_ADR, 0x00020000)
                        OperationRegion (APMP, SystemIO, 0xB2, 0x02)
                        Field (APMP, ByteAcc, NoLock, Preserve)
                        {
                            APMC,   8,
                            APMS,   8
                        }

                        Method (_DOS, 1, NotSerialized)
                        {
                            Store (And (Arg0, 0x03), DSEN)
                        }

                        Method (_DOD, 0, NotSerialized)
                        {
                            Return (Package (0x03)
                            {
                                0x00010100,
                                0x00010240,
                                0x00010410
                            })
                        }

                        Device (CRT)
                        {
                            Name (_ADR, 0x0100)
                            Method (_DCS, 0, NotSerialized)
                            {
                                Store (One, SMIF)
                                Store (0x68, APMC)
                                If (And (CSTE, 0x0101))
                                {
                                    Return (0x1F)
                                }

                                Return (0x1D)
                            }

                            Method (_DGS, 0, NotSerialized)
                            {
                                If (And (NSTE, 0x0101))
                                {
                                    Return (One)
                                }

                                Return (Zero)
                            }

                            Method (_DSS, 1, NotSerialized)
                            {
                                If (LEqual (And (Arg0, 0xC0000000),
0xC0000000))
                                {
                                    Store (NSTE, CSTE)
                                }
                            }
                        }

                        Device (DTV1)
                        {
                            Name (_ADR, 0x0240)
                            Method (_DCS, 0, NotSerialized)
                            {
                                Store (One, SMIF)
                                Store (0x68, APMC)
                                If (And (CSTE, 0x0202))
                                {
                                    Return (0x1F)
                                }

                                Return (0x1D)
                            }

                            Method (_DGS, 0, NotSerialized)
                            {
                                If (And (NSTE, 0x0202))
                                {
                                    Return (One)
                                }

                                Return (Zero)
                            }

                            Method (_DSS, 1, NotSerialized)
                            {
                                If (LEqual (And (Arg0, 0xC0000000),
0xC0000000))
                                {
                                    Store (NSTE, CSTE)
                                }
                            }
                        }

                        Device (LCD)
                        {
                            Name (_ADR, 0x0410)
                            Method (_DCS, 0, NotSerialized)
                            {
                                Store (One, SMIF)
                                Store (0x68, APMC)
                                If (And (CSTE, 0x0808))
                                {
                                    Return (0x1F)
                                }

                                Return (0x1D)
                            }

                            Method (_DGS, 0, NotSerialized)
                            {
                                If (And (NSTE, 0x0808))
                                {
                                    Return (One)
                                }

                                Return (Zero)
                            }

                            Method (_DSS, 1, NotSerialized)
                            {
                                If (LEqual (And (Arg0, 0xC0000000),
0xC0000000))
                                {
                                    Store (NSTE, CSTE)
                                }
                            }
                        }
                    }
                }

                Device (^PCIE)
                {
                    Name (_HID, EisaId ("PNP0C02"))
                    Name (_UID, 0x11)
                    Name (CRS, ResourceTemplate ()
                    {
                        Memory32Fixed (ReadOnly, 0xE0000000, 0x10000000)
                    })
                    Method (_CRS, 0, NotSerialized)
                    {
                        CreateDWordField (CRS, 0x04, BAS1)
                        CreateDWordField (CRS, 0x08, LEN1)
                        Store (PCIB, BAS1)
                        Store (PCIL, LEN1)
                        Return (CRS)
                    }
                }

                Scope (\_TZ)
                {
                    ThermalZone (THRM)
                    {
                        Method (KLV, 1, NotSerialized)
                        {
                            Add (Arg0, 0x0111, Local0)
                            Multiply (Local0, 0x0A, Local0)
                            Return (Local0)
                        }

                        Method (_TMP, 0, NotSerialized)
                        {
                            If (\_SB.PCI0.SBRG.EC.MYEC)
                            {
                                If (\_SB.PCI0.SBRG.EC.CTSD)
                                {
                                    Store (Zero, \_SB.PCI0.SBRG.EC.CTSD)
                                    Return (KLV (0x6E))
                                }
                                Else
                                {
                                    Store (\_SB.PCI0.SBRG.EC.CPUT, Local0)
                                    Store (Local0, DBG8)
                                    Return (KLV (Local0))
                                }
                            }
                            Else
                            {
                                Return (KLV (0x1E))
                            }
                        }

                        Method (_CRT, 0, NotSerialized)
                        {
                            Return (KLV (0x64))
                        }
                    }
                }

                Device (OMSC)
                {
                    Name (_HID, EisaId ("PNP0C02"))
                    Name (_UID, Zero)
                    Name (CRS, ResourceTemplate ()
                    {
                        Memory32Fixed (ReadOnly, 0x00000000, 0x00000000)
                        Memory32Fixed (ReadOnly, 0x00000000, 0x00000000)
                    })
                    Method (_CRS, 0, NotSerialized)
                    {
                        If (APIC)
                        {
                            CreateDWordField (CRS, 0x08, ML01)
                            CreateDWordField (CRS, 0x04, MB01)
                            CreateDWordField (CRS, 0x14, ML02)
                            CreateDWordField (CRS, 0x10, MB02)
                            Store (0xFEC00000, MB01)
                            Store (0x1000, ML01)
                            Store (0xFEE00000, MB02)
                            Store (0x1000, ML02)
                        }

                        Return (CRS)
                    }
                }

                Device (^^RMEM)
                {
                    Name (_HID, EisaId ("PNP0C01"))
                    Name (_UID, One)
                    Name (CRS, ResourceTemplate ()
                    {
                        Memory32Fixed (ReadWrite, 0x00000000, 0x000A0000)
                        Memory32Fixed (ReadOnly, 0x00000000, 0x00000000)
                        Memory32Fixed (ReadOnly, 0x000E0000, 0x00020000)
                        Memory32Fixed (ReadWrite, 0x00100000, 0x00000000)
                        Memory32Fixed (ReadOnly, 0x00000000, 0x00000000)
                    })
                    Method (_CRS, 0, NotSerialized)
                    {
                        CreateDWordField (CRS, 0x10, BAS1)
                        CreateDWordField (CRS, 0x14, LEN1)
                        CreateDWordField (CRS, 0x1C, BAS2)
                        CreateDWordField (CRS, 0x20, LEN2)
                        CreateDWordField (CRS, 0x2C, LEN3)
                        CreateDWordField (CRS, 0x34, BAS4)
                        CreateDWordField (CRS, 0x38, LEN4)
                        If (OSFL ()) {}
                        Else
                        {
                            If (MG1B)
                            {
                                If (LGreater (MG1B, 0x000C0000))
                                {
                                    Store (0x000C0000, BAS1)
                                    Subtract (MG1B, BAS1, LEN1)
                                }
                            }
                            Else
                            {
                                Store (0x000C0000, BAS1)
                                Store (0x00020000, LEN1)
                            }

                            If (Add (MG1B, MG1L, Local0))
                            {
                                Store (Local0, BAS2)
                                Subtract (0x00100000, BAS2, LEN2)
                            }
                        }

                        Subtract (MG2B, 0x00100000, LEN3)
                        Store (MH1B, BAS4)
                        Subtract (Zero, BAS4, LEN4)
                        Return (CRS)
                    }
                }
            }

            Device (IDE0)
            {
                Name (_ADR, 0x001F0002)
                Name (^NATA, Package (0x01)
                {
                    0x001F0002
                })
                Name (REGF, One)
                Method (_REG, 2, NotSerialized)
                {
                    If (LEqual (Arg0, 0x02))
                    {
                        Store (Arg1, REGF)
                    }
                }

                Name (TIM0, Package (0x08)
                {
                    Package (0x04)
                    {
                        0x78,
                        0xB4,
                        0xF0,
                        0x0384
                    },

                    Package (0x04)
                    {
                        0x23,
                        0x21,
                        0x10,
                        Zero
                    },

                    Package (0x04)
                    {
                        0x0B,
                        0x09,
                        0x04,
                        Zero
                    },

                    Package (0x06)
                    {
                        0x70,
                        0x49,
                        0x36,
                        0x27,
                        0x19,
                        0x0F
                    },

                    Package (0x06)
                    {
                        Zero,
                        One,
                        0x02,
                        One,
                        0x02,
                        One
                    },

                    Package (0x06)
                    {
                        Zero,
                        Zero,
                        Zero,
                        One,
                        One,
                        One
                    },

                    Package (0x04)
                    {
                        0x04,
                        0x03,
                        0x02,
                        Zero
                    },

                    Package (0x04)
                    {
                        0x02,
                        One,
                        Zero,
                        Zero
                    }
                })
                Name (TMD0, Buffer (0x14) {})
                CreateDWordField (TMD0, Zero, PIO0)
                CreateDWordField (TMD0, 0x04, DMA0)
                CreateDWordField (TMD0, 0x08, PIO1)
                CreateDWordField (TMD0, 0x0C, DMA1)
                CreateDWordField (TMD0, 0x10, CHNF)
                OperationRegion (CFG2, PCI_Config, 0x40, 0x20)
                Field (CFG2, DWordAcc, NoLock, Preserve)
                {
                    PMPT,   4,
                    PSPT,   4,
                    PMRI,   6,
                    Offset (0x02),
                    SMPT,   4,
                    SSPT,   4,
                    SMRI,   6,
                    Offset (0x04),
                    PSRI,   4,
                    SSRI,   4,
                    Offset (0x08),
                    PM3E,   1,
                    PS3E,   1,
                    SM3E,   1,
                    SS3E,   1,
                    Offset (0x0A),
                    PMUT,   2,
                        ,   2,
                    PSUT,   2,
                    Offset (0x0B),
                    SMUT,   2,
                        ,   2,
                    SSUT,   2,
                    Offset (0x0C),
                    Offset (0x14),
                    PM6E,   1,
                    PS6E,   1,
                    SM6E,   1,
                    SS6E,   1,
                    PMCR,   1,
                    PSCR,   1,
                    SMCR,   1,
                    SSCR,   1,
                        ,   4,
                    PMAE,   1,
                    PSAE,   1,
                    SMAE,   1,
                    SSAE,   1
                }

                Name (GMPT, Zero)
                Name (GMUE, Zero)
                Name (GMUT, Zero)
                Name (GMCR, Zero)
                Name (GSPT, Zero)
                Name (GSUE, Zero)
                Name (GSUT, Zero)
                Name (GSCR, Zero)
                Device (CHN0)
                {
                    Name (_ADR, Zero)
                    Method (_GTM, 0, NotSerialized)
                    {
                        ShiftLeft (PSCR, One, Local1)
                        Or (PMCR, Local1, Local0)
                        ShiftLeft (PMAE, 0x02, Local3)
                        ShiftLeft (PM6E, One, Local4)
                        Or (Local3, Local4, Local3)
                        Or (PM3E, Local3, Local1)
                        ShiftLeft (PMPT, 0x04, Local3)
                        Or (Local1, Local3, Local1)
                        ShiftLeft (PSAE, 0x02, Local3)
                        ShiftLeft (PS6E, One, Local4)
                        Or (Local3, Local4, Local3)
                        Or (PS3E, Local3, Local2)
                        ShiftLeft (PSPT, 0x04, Local3)
                        Or (Local2, Local3, Local2)
                        Return (GTM (PMRI, Local1, PMUT, PSRI, Local2,
PSUT, Local0))
                    }

                    Method (_STM, 3, NotSerialized)
                    {
                        Store (Arg0, Debug)
                        Store (Arg0, TMD0)
                        ShiftLeft (PMAE, 0x02, Local3)
                        ShiftLeft (PM6E, One, Local4)
                        Or (Local3, Local4, Local3)
                        Or (PM3E, Local3, Local0)
                        ShiftLeft (PMPT, 0x04, Local3)
                        Or (Local0, Local3, Local0)
                        ShiftLeft (PSAE, 0x02, Local3)
                        ShiftLeft (PS6E, One, Local4)
                        Or (Local3, Local4, Local3)
                        Or (PS3E, Local3, Local1)
                        ShiftLeft (PSPT, 0x04, Local3)
                        Or (Local1, Local3, Local1)
                        Store (PMRI, GMPT)
                        Store (Local0, GMUE)
                        Store (PMUT, GMUT)
                        Store (PMCR, GMCR)
                        Store (PSRI, GSPT)
                        Store (Local1, GSUE)
                        Store (PSUT, GSUT)
                        Store (PSCR, GSCR)
                        STM ()
                        Store (GMPT, PMRI)
                        Store (GMUE, Local0)
                        Store (GMUT, PMUT)
                        Store (GMCR, PMCR)
                        Store (GSUE, Local1)
                        Store (GSUT, PSUT)
                        Store (GSCR, PSCR)
                        If (And (Local0, One))
                        {
                            Store (One, PM3E)
                        }
                        Else
                        {
                            Store (Zero, PM3E)
                        }

                        If (And (Local0, 0x02))
                        {
                            Store (One, PM6E)
                        }
                        Else
                        {
                            Store (Zero, PM6E)
                        }

                        If (And (Local0, 0x04))
                        {
                            Store (One, PMAE)
                        }
                        Else
                        {
                            Store (Zero, PMAE)
                        }

                        If (And (Local1, One))
                        {
                            Store (One, PS3E)
                        }
                        Else
                        {
                            Store (Zero, PS3E)
                        }

                        If (And (Local1, 0x02))
                        {
                            Store (One, PS6E)
                        }
                        Else
                        {
                            Store (Zero, PS6E)
                        }

                        If (And (Local1, 0x04))
                        {
                            Store (One, PSAE)
                        }
                        Else
                        {
                            Store (Zero, PSAE)
                        }

                        Store (GTF (Zero, Arg1), ATA0)
                        Store (GTF (One, Arg2), ATA1)
                    }

                    Device (DRV0)
                    {
                        Name (_ADR, Zero)
                        Method (_GTF, 0, NotSerialized)
                        {
                            Return (RATA (ATA0))
                        }
                    }

                    Device (DRV1)
                    {
                        Name (_ADR, One)
                        Method (_GTF, 0, NotSerialized)
                        {
                            Return (RATA (ATA1))
                        }
                    }
                }

                Device (CHN1)
                {
                    Name (_ADR, One)
                    Method (_GTM, 0, NotSerialized)
                    {
                        ShiftLeft (SSCR, One, Local1)
                        Or (SMCR, Local1, Local0)
                        ShiftLeft (SMAE, 0x02, Local3)
                        ShiftLeft (SM6E, One, Local4)
                        Or (Local3, Local4, Local3)
                        Or (SM3E, Local3, Local1)
                        ShiftLeft (SMPT, 0x04, Local3)
                        Or (Local1, Local3, Local1)
                        ShiftLeft (SSAE, 0x02, Local3)
                        ShiftLeft (SS6E, One, Local4)
                        Or (Local3, Local4, Local3)
                        Or (SS3E, Local3, Local2)
                        ShiftLeft (SSPT, 0x04, Local3)
                        Or (Local2, Local3, Local2)
                        Return (GTM (SMRI, Local1, SMUT, SSRI, Local2,
SSUT, Local0))
                    }

                    Method (_STM, 3, NotSerialized)
                    {
                        Store (Arg0, Debug)
                        Store (Arg0, TMD0)
                        ShiftLeft (SMAE, 0x02, Local3)
                        ShiftLeft (SM6E, One, Local4)
                        Or (Local3, Local4, Local3)
                        Or (SM3E, Local3, Local0)
                        ShiftLeft (SMPT, 0x04, Local3)
                        Or (Local0, Local3, Local0)
                        ShiftLeft (SSAE, 0x02, Local3)
                        ShiftLeft (SS6E, One, Local4)
                        Or (Local3, Local4, Local3)
                        Or (SS3E, Local3, Local1)
                        ShiftLeft (SSPT, 0x04, Local3)
                        Or (Local1, Local3, Local1)
                        Store (SMRI, GMPT)
                        Store (Local0, GMUE)
                        Store (SMUT, GMUT)
                        Store (SMCR, GMCR)
                        Store (SSRI, GSPT)
                        Store (Local1, GSUE)
                        Store (SSUT, GSUT)
                        Store (SSCR, GSCR)
                        STM ()
                        Store (GMPT, SMRI)
                        Store (GMUE, Local0)
                        Store (GMUT, SMUT)
                        Store (GMCR, SMCR)
                        Store (GSUE, Local1)
                        Store (GSUT, SSUT)
                        Store (GSCR, SSCR)
                        If (And (Local0, One))
                        {
                            Store (One, SM3E)
                        }
                        Else
                        {
                            Store (Zero, SM3E)
                        }

                        If (And (Local0, 0x02))
                        {
                            Store (One, SM6E)
                        }
                        Else
                        {
                            Store (Zero, SM6E)
                        }

                        If (And (Local0, 0x04))
                        {
                            Store (One, SMAE)
                        }
                        Else
                        {
                            Store (Zero, SMAE)
                        }

                        If (And (Local1, One))
                        {
                            Store (One, SS3E)
                        }
                        Else
                        {
                            Store (Zero, SS3E)
                        }

                        If (And (Local1, 0x02))
                        {
                            Store (One, SS6E)
                        }
                        Else
                        {
                            Store (Zero, SS6E)
                        }

                        If (And (Local1, 0x04))
                        {
                            Store (One, SSAE)
                        }
                        Else
                        {
                            Store (Zero, SSAE)
                        }

                        Store (GTF (Zero, Arg1), ATA2)
                        Store (GTF (One, Arg2), ATA3)
                    }

                    Device (DRV0)
                    {
                        Name (_ADR, Zero)
                        Method (_GTF, 0, NotSerialized)
                        {
                            Return (RATA (ATA2))
                        }
                    }

                    Device (DRV1)
                    {
                        Name (_ADR, One)
                        Method (_GTF, 0, NotSerialized)
                        {
                            Return (RATA (ATA3))
                        }
                    }
                }

                Method (GTM, 7, Serialized)
                {
                    Store (Ones, PIO0)
                    Store (Ones, PIO1)
                    Store (Ones, DMA0)
                    Store (Ones, DMA1)
                    Store (0x10, CHNF)
                    If (REGF) {}
                    Else
                    {
                        Return (TMD0)
                    }

                    If (And (Arg1, 0x20))
                    {
                        Or (CHNF, 0x02, CHNF)
                    }

                    Store (Match (DerefOf (Index (TIM0, One)), MEQ,
Arg0, MTR, Zero, Zero), Local6)
                    Store (DerefOf (Index (DerefOf (Index (TIM0, Zero)),
Local6)), Local7)
                    Store (Local7, DMA0)
                    Store (Local7, PIO0)
                    If (And (Arg4, 0x20))
                    {
                        Or (CHNF, 0x08, CHNF)
                    }

                    Store (Match (DerefOf (Index (TIM0, 0x02)), MEQ,
Arg3, MTR, Zero, Zero), Local6)
                    Store (DerefOf (Index (DerefOf (Index (TIM0, Zero)),
Local6)), Local7)
                    Store (Local7, DMA1)
                    Store (Local7, PIO1)
                    If (And (Arg1, 0x07))
                    {
                        Store (Arg2, Local5)
                        If (And (Arg1, 0x02))
                        {
                            Add (Local5, 0x02, Local5)
                        }

                        If (And (Arg1, 0x04))
                        {
                            Add (Local5, 0x04, Local5)
                        }

                        Store (DerefOf (Index (DerefOf (Index (TIM0,
0x03)), Local5)), DMA0)
                        Or (CHNF, One, CHNF)
                    }

                    If (And (Arg4, 0x07))
                    {
                        Store (Arg5, Local5)
                        If (And (Arg4, 0x02))
                        {
                            Add (Local5, 0x02, Local5)
                        }

                        If (And (Arg4, 0x04))
                        {
                            Add (Local5, 0x04, Local5)
                        }

                        Store (DerefOf (Index (DerefOf (Index (TIM0,
0x03)), Local5)), DMA1)
                        Or (CHNF, 0x04, CHNF)
                    }

                    Store (TMD0, Debug)
                    Return (TMD0)
                }

                Method (STM, 0, Serialized)
                {
                    If (REGF) {}
                    Else
                    {
                        Store (Zero, GMUE)
                        Store (Zero, GMUT)
                        Store (Zero, GSUE)
                        Store (Zero, GSUT)
                        If (And (CHNF, One))
                        {
                            Store (Match (DerefOf (Index (TIM0, 0x03)),
MLE, DMA0, MTR, Zero, Zero), Local0)
                            If (LGreater (Local0, 0x05))
                            {
                                Store (0x05, Local0)
                            }

                            Store (DerefOf (Index (DerefOf (Index (TIM0,
0x04)), Local0)), GMUT)
                            Or (GMUE, One, GMUE)
                            If (LGreater (Local0, 0x02))
                            {
                                Or (GMUE, 0x02, GMUE)
                            }

                            If (LGreater (Local0, 0x04))
                            {
                                And (GMUE, 0xFD, GMUE)
                                Or (GMUE, 0x04, GMUE)
                            }
                        }
                        Else
                        {
                            If (Or (LEqual (PIO0, Ones), LEqual (PIO0,
Zero)))
                            {
                                If (And (LLess (DMA0, Ones), LGreater
(DMA0, Zero)))
                                {
                                    Store (DMA0, PIO0)
                                    Or (GMUE, 0x80, GMUE)
                                }
                            }
                        }

                        If (And (CHNF, 0x04))
                        {
                            Store (Match (DerefOf (Index (TIM0, 0x03)),
MLE, DMA1, MTR, Zero, Zero), Local0)
                            If (LGreater (Local0, 0x05))
                            {
                                Store (0x05, Local0)
                            }

                            Store (DerefOf (Index (DerefOf (Index (TIM0,
0x04)), Local0)), GSUT)
                            Or (GSUE, One, GSUE)
                            If (LGreater (Local0, 0x02))
                            {
                                Or (GSUE, 0x02, GSUE)
                            }

                            If (LGreater (Local0, 0x04))
                            {
                                And (GSUE, 0xFD, GSUE)
                                Or (GSUE, 0x04, GSUE)
                            }
                        }
                        Else
                        {
                            If (Or (LEqual (PIO1, Ones), LEqual (PIO1,
Zero)))
                            {
                                If (And (LLess (DMA1, Ones), LGreater
(DMA1, Zero)))
                                {
                                    Store (DMA1, PIO1)
                                    Or (GSUE, 0x80, GSUE)
                                }
                            }
                        }

                        If (And (CHNF, 0x02))
                        {
                            Or (GMUE, 0x20, GMUE)
                        }

                        If (And (CHNF, 0x08))
                        {
                            Or (GSUE, 0x20, GSUE)
                        }

                        And (Match (DerefOf (Index (TIM0, Zero)), MGE,
PIO0, MTR, Zero, Zero), 0x07, Local0)
                        Store (DerefOf (Index (DerefOf (Index (TIM0,
One)), Local0)), Local1)
                        Store (Local1, GMPT)
                        If (LLess (Local0, 0x03))
                        {
                            Or (GMUE, 0x50, GMUE)
                        }

                        And (Match (DerefOf (Index (TIM0, Zero)), MGE,
PIO1, MTR, Zero, Zero), 0x07, Local0)
                        Store (DerefOf (Index (DerefOf (Index (TIM0,
0x02)), Local0)), Local1)
                        Store (Local1, GSPT)
                        If (LLess (Local0, 0x03))
                        {
                            Or (GSUE, 0x50, GSUE)
                        }
                    }
                }

                Name (AT01, Buffer (0x07)
                {
                    0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEF
                })
                Name (AT02, Buffer (0x07)
                {
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90
                })
                Name (AT03, Buffer (0x07)
                {
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6
                })
                Name (AT04, Buffer (0x07)
                {
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91
                })
                Name (ATA0, Buffer (0x1D) {})
                Name (ATA1, Buffer (0x1D) {})
                Name (ATA2, Buffer (0x1D) {})
                Name (ATA3, Buffer (0x1D) {})
                Name (ATAB, Buffer (0x1D) {})
                CreateByteField (ATAB, Zero, CMDC)
                Method (GTFB, 3, Serialized)
                {
                    Multiply (CMDC, 0x38, Local0)
                    Add (Local0, 0x08, Local1)
                    CreateField (ATAB, Local1, 0x38, CMDX)
                    Multiply (CMDC, 0x07, Local0)
                    CreateByteField (ATAB, Add (Local0, 0x02), A001)
                    CreateByteField (ATAB, Add (Local0, 0x06), A005)
                    Store (Arg0, CMDX)
                    Store (Arg1, A001)
                    Store (Arg2, A005)
                    Increment (CMDC)
                }

                Method (GTF, 2, Serialized)
                {
                    Store (Arg1, Debug)
                    Store (Zero, CMDC)
                    Name (ID49, 0x0C00)
                    Name (ID59, Zero)
                    Name (ID53, 0x04)
                    Name (ID63, 0x0F00)
                    Name (ID88, 0x0F00)
                    Name (IRDY, One)
                    Name (PIOT, Zero)
                    Name (DMAT, Zero)
                    If (LEqual (SizeOf (Arg1), 0x0200))
                    {
                        CreateWordField (Arg1, 0x62, IW49)
                        Store (IW49, ID49)
                        CreateWordField (Arg1, 0x6A, IW53)
                        Store (IW53, ID53)
                        CreateWordField (Arg1, 0x7E, IW63)
                        Store (IW63, ID63)
                        CreateWordField (Arg1, 0x76, IW59)
                        Store (IW59, ID59)
                        CreateWordField (Arg1, 0xB0, IW88)
                        Store (IW88, ID88)
                    }

                    Store (0xA0, Local7)
                    If (Arg0)
                    {
                        Store (0xB0, Local7)
                        And (CHNF, 0x08, IRDY)
                        If (And (CHNF, 0x10))
                        {
                            Store (PIO1, PIOT)
                        }
                        Else
                        {
                            Store (PIO0, PIOT)
                        }

                        If (And (CHNF, 0x04))
                        {
                            If (And (CHNF, 0x10))
                            {
                                Store (DMA1, DMAT)
                            }
                            Else
                            {
                                Store (DMA0, DMAT)
                            }
                        }
                    }
                    Else
                    {
                        And (CHNF, 0x02, IRDY)
                        Store (PIO0, PIOT)
                        If (And (CHNF, One))
                        {
                            Store (DMA0, DMAT)
                        }
                    }

                    If (LAnd (LAnd (And (ID53, 0x04), And (ID88,
0xFF00)), DMAT))
                    {
                        Store (Match (DerefOf (Index (TIM0, 0x03)), MLE,
DMAT, MTR, Zero, Zero), Local1)
                        If (LGreater (Local1, 0x05))
                        {
                            Store (0x05, Local1)
                        }

                        GTFB (AT01, Or (0x40, Local1), Local7)
                    }
                    Else
                    {
                        If (LAnd (And (ID63, 0xFF00), PIOT))
                        {
                            And (Match (DerefOf (Index (TIM0, Zero)),
MGE, PIOT, MTR, Zero, Zero), 0x03, Local0)
                            Or (0x20, DerefOf (Index (DerefOf (Index
(TIM0, 0x07)), Local0)), Local1)
                            GTFB (AT01, Local1, Local7)
                        }
                    }

                    If (IRDY)
                    {
                        And (Match (DerefOf (Index (TIM0, Zero)), MGE,
PIOT, MTR, Zero, Zero), 0x07, Local0)
                        Or (0x08, DerefOf (Index (DerefOf (Index (TIM0,
0x06)), Local0)), Local1)
                        GTFB (AT01, Local1, Local7)
                    }
                    Else
                    {
                        If (And (ID49, 0x0400))
                        {
                            GTFB (AT01, One, Local7)
                        }
                    }

                    If (LAnd (And (ID59, 0x0100), And (ID59, 0xFF)))
                    {
                        GTFB (AT03, And (ID59, 0xFF), Local7)
                    }

                    Store (ATAB, Debug)
                    Return (ATAB)
                }

                Method (RATA, 1, NotSerialized)
                {
                    CreateByteField (Arg0, Zero, CMDN)
                    Multiply (CMDN, 0x38, Local0)
                    CreateField (Arg0, 0x08, Local0, RETB)
                    Store (RETB, Debug)
                    Concatenate (RETB, FZTF, RETB)
                    Return (RETB)
                }

                Name (FZTF, Buffer (0x07)
                {
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF5
                })
            }

            Device (IDE1)
            {
                Name (_ADR, 0x001F0001)
            }

            Device (USB0)
            {
                Name (_ADR, 0x001D0000)
                OperationRegion (BAR0, PCI_Config, 0xC4, One)
                Field (BAR0, ByteAcc, NoLock, Preserve)
                {
                    USBW,   2,
                    Offset (0x01)
                }

                Method (_S3D, 0, NotSerialized)
                {
                    If (LOr (LEqual (OSFL (), One), LEqual (OSFL (), 0x02)))
                    {
                        Return (0x02)
                    }
                    Else
                    {
                        Return (0x03)
                    }
                }

                Method (_PSW, 1, NotSerialized)
                {
                    If (Arg0)
                    {
                        Store (0x03, USBW)
                    }
                    Else
                    {
                        Store (Zero, USBW)
                    }
                }

                Method (_PRW, 0, NotSerialized)
                {
                    Return (GPRW (0x03, 0x03))
                }
            }

            Device (USB1)
            {
                Name (_ADR, 0x001D0001)
                OperationRegion (BAR0, PCI_Config, 0xC4, One)
                Field (BAR0, ByteAcc, NoLock, Preserve)
                {
                    USBW,   2,
                    Offset (0x01)
                }

                Method (_S3D, 0, NotSerialized)
                {
                    If (LOr (LEqual (OSFL (), One), LEqual (OSFL (), 0x02)))
                    {
                        Return (0x02)
                    }
                    Else
                    {
                        Return (0x03)
                    }
                }

                Method (_PSW, 1, NotSerialized)
                {
                    If (Arg0)
                    {
                        Store (0x03, USBW)
                    }
                    Else
                    {
                        Store (Zero, USBW)
                    }
                }

                Method (_PRW, 0, NotSerialized)
                {
                    Return (GPRW (0x04, 0x03))
                }
            }

            Device (USB2)
            {
                Name (_ADR, 0x001D0002)
                OperationRegion (BAR0, PCI_Config, 0xC4, One)
                Field (BAR0, ByteAcc, NoLock, Preserve)
                {
                    USBW,   2,
                    Offset (0x01)
                }

                Method (_S3D, 0, NotSerialized)
                {
                    If (LOr (LEqual (OSFL (), One), LEqual (OSFL (), 0x02)))
                    {
                        Return (0x02)
                    }
                    Else
                    {
                        Return (0x03)
                    }
                }

                Method (_PSW, 1, NotSerialized)
                {
                    If (Arg0)
                    {
                        Store (0x03, USBW)
                    }
                    Else
                    {
                        Store (Zero, USBW)
                    }
                }

                Method (_PRW, 0, NotSerialized)
                {
                    Return (GPRW (0x0C, 0x03))
                }
            }

            Device (USB3)
            {
                Name (_ADR, 0x001D0003)
                OperationRegion (BAR0, PCI_Config, 0xC4, One)
                Field (BAR0, ByteAcc, NoLock, Preserve)
                {
                    USBW,   2,
                    Offset (0x01)
                }

                Method (_S3D, 0, NotSerialized)
                {
                    If (LOr (LEqual (OSFL (), One), LEqual (OSFL (), 0x02)))
                    {
                        Return (0x02)
                    }
                    Else
                    {
                        Return (0x03)
                    }
                }

                Method (_PSW, 1, NotSerialized)
                {
                    If (Arg0)
                    {
                        Store (0x03, USBW)
                    }
                    Else
                    {
                        Store (Zero, USBW)
                    }
                }
            }

            Device (EUSB)
            {
                Name (_ADR, 0x001D0007)
                Method (_PRW, 0, NotSerialized)
                {
                    Return (GPRW (0x0D, 0x03))
                }
            }

            Device (MC97)
            {
                Name (_ADR, 0x001E0003)
            }

            Device (AZAL)
            {
                Name (_ADR, 0x001B0000)
                Method (_PRW, 0, NotSerialized)
                {
                    Return (GPRW (0x05, 0x04))
                }
            }

            Device (P0PD)
            {
                Name (_ADR, 0x001C0000)
            }

            Device (P0P2)
            {
                Name (_ADR, 0x001C0001)
                Method (_PRW, 0, NotSerialized)
                {
                    Return (GPRW (0x09, 0x04))
                }

                Method (_PRT, 0, NotSerialized)
                {
                    If (PICM)
                    {
                        Return (AR02)
                    }

                    Return (PR02)
                }
            }

            Device (P0P3)
            {
                Name (_ADR, 0x001C0002)
                Method (_PRT, 0, NotSerialized)
                {
                    If (PICM)
                    {
                        Return (AR03)
                    }

                    Return (PR03)
                }
            }

            Device (P0P7)
            {
                Name (_ADR, 0x001C0003)
                Method (_PRT, 0, NotSerialized)
                {
                    If (PICM)
                    {
                        Return (AR07)
                    }

                    Return (PR07)
                }
            }

            Device (P0P8)
            {
                Name (_ADR, 0x001C0004)
                Method (_PRT, 0, NotSerialized)
                {
                    If (PICM)
                    {
                        Return (AR08)
                    }

                    Return (PR08)
                }
            }

            Device (P0P9)
            {
                Name (_ADR, 0x001C0005)
                Method (_PRT, 0, NotSerialized)
                {
                    If (PICM)
                    {
                        Return (AR09)
                    }

                    Return (PR09)
                }
            }
        }

        Scope (\_GPE)
        {
            Method (_L09, 0, NotSerialized)
            {
                Notify (\_SB.PCI0.P0PC, 0x02)
                Notify (\_SB.PCI0.P0P2, 0x02)
                Notify (\_SB.PWRB, 0x02)
            }

            Method (_L0B, 0, NotSerialized)
            {
                Notify (\_SB.PCI0.P0P4, 0x02)
                Notify (\_SB.PCI0.P0P4.CBC0, 0x02)
                Notify (\_SB.PWRB, 0x02)
            }

            Method (_L03, 0, NotSerialized)
            {
                Notify (\_SB.PCI0.USB0, 0x02)
                Notify (\_SB.PWRB, 0x02)
            }

            Method (_L04, 0, NotSerialized)
            {
                Notify (\_SB.PCI0.USB1, 0x02)
                Notify (\_SB.PWRB, 0x02)
            }

            Method (_L0C, 0, NotSerialized)
            {
                Notify (\_SB.PCI0.USB2, 0x02)
                Notify (\_SB.PWRB, 0x02)
            }

            Method (_L0D, 0, NotSerialized)
            {
                Notify (\_SB.PCI0.EUSB, 0x02)
                Notify (\_SB.PWRB, 0x02)
            }

            Method (_L05, 0, NotSerialized)
            {
                Notify (\_SB.PCI0.AZAL, 0x02)
                Notify (\_SB.PWRB, 0x02)
            }
        }

        Device (PWRB)
        {
            Name (_HID, EisaId ("PNP0C0C"))
            Name (_UID, 0xAA)
            Name (_STA, 0x0B)
        }
    }

    OperationRegion (_SB.PCI0.SBRG.PIX0, PCI_Config, 0x60, 0x0C)
    Field (\_SB.PCI0.SBRG.PIX0, ByteAcc, NoLock, Preserve)
    {
        PIRA,   8,
        PIRB,   8,
        PIRC,   8,
        PIRD,   8,
        Offset (0x08),
        PIRE,   8,
        PIRF,   8,
        PIRG,   8,
        PIRH,   8
    }

    Scope (_SB)
    {
        Name (BUFA, ResourceTemplate ()
        {
            IRQ (Level, ActiveLow, Shared) {15}
        })
        CreateWordField (BUFA, One, IRA0)
        Device (LNKA)
        {
            Name (_HID, EisaId ("PNP0C0F"))
            Name (_UID, One)
            Method (_STA, 0, NotSerialized)
            {
                And (PIRA, 0x80, Local0)
                If (Local0)
                {
                    Return (0x09)
                }
                Else
                {
                    Return (0x0B)
                }
            }

            Method (_PRS, 0, NotSerialized)
            {
                Return (PRSA)
            }

            Method (_DIS, 0, NotSerialized)
            {
                Or (PIRA, 0x80, PIRA)
            }

            Method (_CRS, 0, NotSerialized)
            {
                And (PIRA, 0x0F, Local0)
                ShiftLeft (One, Local0, IRA0)
                Return (BUFA)
            }

            Method (_SRS, 1, NotSerialized)
            {
                CreateWordField (Arg0, One, IRA)
                FindSetRightBit (IRA, Local0)
                Decrement (Local0)
                Store (Local0, PIRA)
            }
        }

        Device (LNKB)
        {
            Name (_HID, EisaId ("PNP0C0F"))
            Name (_UID, 0x02)
            Method (_STA, 0, NotSerialized)
            {
                And (PIRB, 0x80, Local0)
                If (Local0)
                {
                    Return (0x09)
                }
                Else
                {
                    Return (0x0B)
                }
            }

            Method (_PRS, 0, NotSerialized)
            {
                Return (PRSB)
            }

            Method (_DIS, 0, NotSerialized)
            {
                Or (PIRB, 0x80, PIRB)
            }

            Method (_CRS, 0, NotSerialized)
            {
                And (PIRB, 0x0F, Local0)
                ShiftLeft (One, Local0, IRA0)
                Return (BUFA)
            }

            Method (_SRS, 1, NotSerialized)
            {
                CreateWordField (Arg0, One, IRA)
                FindSetRightBit (IRA, Local0)
                Decrement (Local0)
                Store (Local0, PIRB)
            }
        }

        Device (LNKC)
        {
            Name (_HID, EisaId ("PNP0C0F"))
            Name (_UID, 0x03)
            Method (_STA, 0, NotSerialized)
            {
                And (PIRC, 0x80, Local0)
                If (Local0)
                {
                    Return (0x09)
                }
                Else
                {
                    Return (0x0B)
                }
            }

            Method (_PRS, 0, NotSerialized)
            {
                Return (PRSC)
            }

            Method (_DIS, 0, NotSerialized)
            {
                Or (PIRC, 0x80, PIRC)
            }

            Method (_CRS, 0, NotSerialized)
            {
                And (PIRC, 0x0F, Local0)
                ShiftLeft (One, Local0, IRA0)
                Return (BUFA)
            }

            Method (_SRS, 1, NotSerialized)
            {
                CreateWordField (Arg0, One, IRA)
                FindSetRightBit (IRA, Local0)
                Decrement (Local0)
                Store (Local0, PIRC)
            }
        }

        Device (LNKD)
        {
            Name (_HID, EisaId ("PNP0C0F"))
            Name (_UID, 0x04)
            Method (_STA, 0, NotSerialized)
            {
                And (PIRD, 0x80, Local0)
                If (Local0)
                {
                    Return (0x09)
                }
                Else
                {
                    Return (0x0B)
                }
            }

            Method (_PRS, 0, NotSerialized)
            {
                Return (PRSD)
            }

            Method (_DIS, 0, NotSerialized)
            {
                Or (PIRD, 0x80, PIRD)
            }

            Method (_CRS, 0, NotSerialized)
            {
                And (PIRD, 0x0F, Local0)
                ShiftLeft (One, Local0, IRA0)
                Return (BUFA)
            }

            Method (_SRS, 1, NotSerialized)
            {
                CreateWordField (Arg0, One, IRA)
                FindSetRightBit (IRA, Local0)
                Decrement (Local0)
                Store (Local0, PIRD)
            }
        }

        Device (LNKE)
        {
            Name (_HID, EisaId ("PNP0C0F"))
            Name (_UID, 0x05)
            Method (_STA, 0, NotSerialized)
            {
                And (PIRE, 0x80, Local0)
                If (Local0)
                {
                    Return (0x09)
                }
                Else
                {
                    Return (0x0B)
                }
            }

            Method (_PRS, 0, NotSerialized)
            {
                Return (PRSE)
            }

            Method (_DIS, 0, NotSerialized)
            {
                Or (PIRE, 0x80, PIRE)
            }

            Method (_CRS, 0, NotSerialized)
            {
                And (PIRE, 0x0F, Local0)
                ShiftLeft (One, Local0, IRA0)
                Return (BUFA)
            }

            Method (_SRS, 1, NotSerialized)
            {
                CreateWordField (Arg0, One, IRA)
                FindSetRightBit (IRA, Local0)
                Decrement (Local0)
                Store (Local0, PIRE)
            }
        }

        Device (LNKF)
        {
            Name (_HID, EisaId ("PNP0C0F"))
            Name (_UID, 0x06)
            Method (_STA, 0, NotSerialized)
            {
                And (PIRF, 0x80, Local0)
                If (Local0)
                {
                    Return (0x09)
                }
                Else
                {
                    Return (0x0B)
                }
            }

            Method (_PRS, 0, NotSerialized)
            {
                Return (PRSF)
            }

            Method (_DIS, 0, NotSerialized)
            {
                Or (PIRF, 0x80, PIRF)
            }

            Method (_CRS, 0, NotSerialized)
            {
                And (PIRF, 0x0F, Local0)
                ShiftLeft (One, Local0, IRA0)
                Return (BUFA)
            }

            Method (_SRS, 1, NotSerialized)
            {
                CreateWordField (Arg0, One, IRA)
                FindSetRightBit (IRA, Local0)
                Decrement (Local0)
                Store (Local0, PIRF)
            }
        }

        Device (LNKG)
        {
            Name (_HID, EisaId ("PNP0C0F"))
            Name (_UID, 0x07)
            Method (_STA, 0, NotSerialized)
            {
                And (PIRG, 0x80, Local0)
                If (Local0)
                {
                    Return (0x09)
                }
                Else
                {
                    Return (0x0B)
                }
            }

            Method (_PRS, 0, NotSerialized)
            {
                Return (PRSG)
            }

            Method (_DIS, 0, NotSerialized)
            {
                Or (PIRG, 0x80, PIRG)
            }

            Method (_CRS, 0, NotSerialized)
            {
                And (PIRG, 0x0F, Local0)
                ShiftLeft (One, Local0, IRA0)
                Return (BUFA)
            }

            Method (_SRS, 1, NotSerialized)
            {
                CreateWordField (Arg0, One, IRA)
                FindSetRightBit (IRA, Local0)
                Decrement (Local0)
                Store (Local0, PIRG)
            }
        }

        Device (LNKH)
        {
            Name (_HID, EisaId ("PNP0C0F"))
            Name (_UID, 0x08)
            Method (_STA, 0, NotSerialized)
            {
                And (PIRH, 0x80, Local0)
                If (Local0)
                {
                    Return (0x09)
                }
                Else
                {
                    Return (0x0B)
                }
            }

            Method (_PRS, 0, NotSerialized)
            {
                Return (PRSH)
            }

            Method (_DIS, 0, NotSerialized)
            {
                Or (PIRH, 0x80, PIRH)
            }

            Method (_CRS, 0, NotSerialized)
            {
                And (PIRH, 0x0F, Local0)
                ShiftLeft (One, Local0, IRA0)
                Return (BUFA)
            }

            Method (_SRS, 1, NotSerialized)
            {
                CreateWordField (Arg0, One, IRA)
                FindSetRightBit (IRA, Local0)
                Decrement (Local0)
                Store (Local0, PIRH)
            }
        }
    }

    Scope (_SB)
    {
        Name (XCPD, Zero)
        Name (XNPT, One)
        Name (XCAP, 0x02)
        Name (XDCP, 0x04)
        Name (XDCT, 0x08)
        Name (XDST, 0x0A)
        Name (XLCP, 0x0C)
        Name (XLCT, 0x10)
        Name (XLST, 0x12)
        Name (XSCP, 0x14)
        Name (XSCT, 0x18)
        Name (XSST, 0x1A)
        Name (XRCT, 0x1C)
        Mutex (MUTE, 0x00)
        Method (RBPE, 1, NotSerialized)
        {
            Acquire (MUTE, 0x03E8)
            Add (Arg0, PCIB, Local0)
            OperationRegion (PCFG, SystemMemory, Local0, One)
            Field (PCFG, ByteAcc, NoLock, Preserve)
            {
                XCFG,   8
            }

            Release (MUTE)
            Return (XCFG)
        }

        Method (RWPE, 1, NotSerialized)
        {
            Acquire (MUTE, 0x03E8)
            And (Arg0, 0xFFFFFFFE, Arg0)
            Add (Arg0, PCIB, Local0)
            OperationRegion (PCFG, SystemMemory, Local0, 0x02)
            Field (PCFG, WordAcc, NoLock, Preserve)
            {
                XCFG,   16
            }

            Release (MUTE)
            Return (XCFG)
        }

        Method (RDPE, 1, NotSerialized)
        {
            Acquire (MUTE, 0x03E8)
            And (Arg0, 0xFFFFFFFC, Arg0)
            Add (Arg0, PCIB, Local0)
            OperationRegion (PCFG, SystemMemory, Local0, 0x04)
            Field (PCFG, DWordAcc, NoLock, Preserve)
            {
                XCFG,   32
            }

            Release (MUTE)
            Return (XCFG)
        }

        Method (WBPE, 2, NotSerialized)
        {
            Acquire (MUTE, 0x0FFF)
            Add (Arg0, PCIB, Local0)
            OperationRegion (PCFG, SystemMemory, Local0, One)
            Field (PCFG, ByteAcc, NoLock, Preserve)
            {
                XCFG,   8
            }

            Store (Arg1, XCFG)
            Release (MUTE)
        }

        Method (WWPE, 2, NotSerialized)
        {
            Acquire (MUTE, 0x03E8)
            And (Arg0, 0xFFFFFFFE, Arg0)
            Add (Arg0, PCIB, Local0)
            OperationRegion (PCFG, SystemMemory, Local0, 0x02)
            Field (PCFG, WordAcc, NoLock, Preserve)
            {
                XCFG,   16
            }

            Store (Arg1, XCFG)
            Release (MUTE)
        }

        Method (WDPE, 2, NotSerialized)
        {
            Acquire (MUTE, 0x03E8)
            And (Arg0, 0xFFFFFFFC, Arg0)
            Add (Arg0, PCIB, Local0)
            OperationRegion (PCFG, SystemMemory, Local0, 0x04)
            Field (PCFG, DWordAcc, NoLock, Preserve)
            {
                XCFG,   32
            }

            Store (Arg1, XCFG)
            Release (MUTE)
        }

        Method (RWDP, 3, NotSerialized)
        {
            Acquire (MUTE, 0x03E8)
            And (Arg0, 0xFFFFFFFC, Arg0)
            Add (Arg0, PCIB, Local0)
            OperationRegion (PCFG, SystemMemory, Local0, 0x04)
            Field (PCFG, DWordAcc, NoLock, Preserve)
            {
                XCFG,   32
            }

            And (XCFG, Arg2, Local1)
            Or (Local1, Arg1, XCFG)
            Release (MUTE)
        }

        Method (RPME, 1, NotSerialized)
        {
            Add (Arg0, 0x84, Local0)
            Store (RDPE (Local0), Local1)
            If (LEqual (Local1, Ones))
            {
                Return (Zero)
            }
            Else
            {
                If (LAnd (Local1, 0x00010000))
                {
                    WDPE (Local0, And (Local1, 0x00010000))
                    Return (One)
                }

                Return (Zero)
            }
        }
    }

    Scope (_SB)
    {
        Scope (PCI0)
        {
            Name (CRS, ResourceTemplate ()
            {
                WordBusNumber (ResourceProducer, MinFixed, MaxFixed,
PosDecode,
                    0x0000,
                    0x0000,
                    0x00FF,
                    0x0000,
                    0x0100)
                IO (Decode16, 0x0CF8, 0x0CF8, 0x01, 0x08)
                WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode,
EntireRange,
                    0x0000,
                    0x0000,
                    0x0CF7,
                    0x0000,
                    0x0CF8)
                WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode,
EntireRange,
                    0x0000,
                    0x0D00,
                    0xFFFF,
                    0x0000,
                    0xF300)
                DWordMemory (ResourceProducer, PosDecode, MinFixed,
MaxFixed, Cacheable, ReadWrite,
                    0x00000000,
                    0x000A0000,
                    0x000BFFFF,
                    0x00000000,
                    0x00020000)
                DWordMemory (ResourceProducer, PosDecode, MinFixed,
MaxFixed, Cacheable, ReadWrite,
                    0x00000000,
                    0x000C0000,
                    0x000DFFFF,
                    0x00000000,
                    0x00020000)
                DWordMemory (ResourceProducer, PosDecode, MinFixed,
MaxFixed, Cacheable, ReadWrite,
                    0x00000000,
                    0x00000000,
                    0x00000000,
                    0x00000000,
                    0x00000000)
                DWordMemory (ResourceProducer, PosDecode, MinFixed,
MaxFixed, Cacheable, ReadWrite,
                    0x00000000,
                    0x00000000,
                    0x00000000,
                    0x00000000,
                    0x00000000)
            })
            CreateDWordField (CRS, 0x5C, MIN5)
            CreateDWordField (CRS, 0x60, MAX5)
            CreateDWordField (CRS, 0x68, LEN5)
            CreateDWordField (CRS, 0x76, MIN6)
            CreateDWordField (CRS, 0x7A, MAX6)
            CreateDWordField (CRS, 0x82, LEN6)
            CreateDWordField (CRS, 0x90, MIN7)
            CreateDWordField (CRS, 0x94, MAX7)
            CreateDWordField (CRS, 0x9C, LEN7)
            Method (_CRS, 0, NotSerialized)
            {
                Store (MG1L, Local0)
                If (Local0)
                {
                    Store (MG1B, MIN5)
                    Store (MG1L, LEN5)
                    Add (MIN5, Decrement (Local0), MAX5)
                }

                Store (MG2B, MIN6)
                Store (MG2L, LEN6)
                Store (MG2L, Local0)
                Add (MIN6, Decrement (Local0), MAX6)
                Store (MG3B, MIN7)
                Store (MG3L, LEN7)
                Store (MG3L, Local0)
                Add (MIN7, Decrement (Local0), MAX7)
                Return (CRS)
            }
        }
    }

    Name (WOTB, Zero)
    Name (WSSB, Zero)
    Name (WAXB, Zero)
    Method (_PTS, 1, NotSerialized)
    {
        Store (Arg0, DBG8)
        PTS (Arg0)
        Store (Zero, Index (WAKP, Zero))
        Store (Zero, Index (WAKP, One))
        If (LAnd (LEqual (Arg0, 0x04), LEqual (OSFL (), 0x02)))
        {
            Sleep (0x0BB8)
        }

        Store (ASSB, WSSB)
        Store (AOTB, WOTB)
        Store (AAXB, WAXB)
        Store (Arg0, ASSB)
        Store (OSFL (), AOTB)
        Store (Zero, AAXB)
    }

    Name (SLID, One)
    Method (_WAK, 1, NotSerialized)
    {
        ShiftLeft (Arg0, 0x04, DBG8)
        Store (One, SLID)
        WAK (Arg0)
        If (ASSB)
        {
            Store (WSSB, ASSB)
            Store (WOTB, AOTB)
            Store (WAXB, AAXB)
        }

        If (DerefOf (Index (WAKP, Zero)))
        {
            Store (Zero, Index (WAKP, One))
        }
        Else
        {
            Store (Arg0, Index (WAKP, One))
        }

        Store (\_SB.PCI0.SBRG.EC.POWS, Local0)
        If (LEqual (Local0, One))
        {
            Store (One, \_SB.PCI0.SBRG.EC.ADP1.ACP)
        }
        Else
        {
            Store (Zero, \_SB.PCI0.SBRG.EC.ADP1.ACP)
        }

        Store (\_SB.PCI0.SBRG.EC.MBTS, Local0)
        If (LEqual (Local0, One))
        {
            Store (One, \_SB.PCI0.SBRG.EC.ADP1.BFLG)
        }
        Else
        {
            Store (Zero, \_SB.PCI0.SBRG.EC.ADP1.BFLG)
        }

        Notify (\_SB.PCI0.SBRG.EC.ADP1, Zero)
        Notify (\_SB.PCI0.SBRG.EC.BAT1, Zero)
        Store (One, \_SB.PCI0.WAWA.PDC1)
        Store (One, \_SB.PCI0.WAWA.HPCS)
        If (MCTH (_OS, "Microsoft Windows"))
        {
            If (LEqual (Arg0, 0x04))
            {
                Notify (\_SB.PWRB, 0x02)
            }
        }

        Return (WAKP)
    }

    Name (_S0, Package (0x04)
    {
        Zero,
        Zero,
        Zero,
        Zero
    })
    If (SS1)
    {
        Name (_S1, Package (0x04)
        {
            One,
            Zero,
            Zero,
            Zero
        })
    }

    If (SS3)
    {
        Name (_S3, Package (0x04)
        {
            0x05,
            Zero,
            Zero,
            Zero
        })
    }

    If (SS4)
    {
        Name (_S4, Package (0x04)
        {
            0x06,
            Zero,
            Zero,
            Zero
        })
    }

    Name (_S5, Package (0x04)
    {
        0x07,
        Zero,
        Zero,
        Zero
    })
    Method (PTS, 1, NotSerialized)
    {
        If (Arg0)
        {
            \_SB.PCI0.NPTS (Arg0)
            \_SB.PCI0.SBRG.SPTS (Arg0)
        }
    }

    Method (WAK, 1, NotSerialized)
    {
        \_SB.PCI0.NWAK (Arg0)
        \_SB.PCI0.SBRG.SWAK (Arg0)
    }
}



> 
> gahr> In this case, the CPU frequency should be increased according to
> gahr> powerd's algorithm and should be decreased according to passive
> gahr> cooling's algorithm.
> 
> gahr> Wouldn't it be better to have one subsystem deal with both usage and
> gahr> temperature in order to decide which is the best next frequency to be set?
> 
> No, we have a priority to control a cpufreq in our kernel, to deal
> with conflict between kernel and userland.  Controlling cpufreq within
> our kernel is considered as high proirity.  So, during our kernel is
> controlling a cpufreq, we cannot change cpufreq from userland.  And,
> our kernel releasing the control, a cpufreq is back to the value
> before our kernel changed it.
> 
> gahr> My patch is really just a first draft that I wrote in order to have
> gahr> feedbacks on the general idea to implement a temperature controlling
> gahr> system inside powerd, and doesn't implement hysteresis as you noted, and
> gahr> your feedback is that it's not a good idea, which I respect.
> 
> It is rather backward, IMHO.  I did implement a passive cooling
> feature as an enhancement of powerd(8) like you did, during initial
> phases.  Then, I implemented it in our kernel as a result.
> 
> Sincerely,
> 
> --
> Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
> ume at mahoroba.org  ume@{,jp.}FreeBSD.org
> http://www.imasy.org/~ume/


-- 
Pietro Cerutti

PGP Public Key:
http://gahr.ch/pgp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 187 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-acpi/attachments/20070731/950812d5/signature-0001.pgp


More information about the freebsd-acpi mailing list