From owner-acpi-jp@jp.FreeBSD.org Tue Jan  1 00:56:20 2002
Received: (from daemon@localhost)
	by castle.jp.FreeBSD.org (8.11.6+3.4W/8.11.3) id fBVFuKo88596;
	Tue, 1 Jan 2002 00:56:20 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from rover.village.org (warner@[204.144.255.66])
	by castle.jp.FreeBSD.org (8.11.6+3.4W/8.11.3) with ESMTP/inet id fBVFuCm88488
	for <acpi-jp@jp.FreeBSD.org>; Tue, 1 Jan 2002 00:56:16 +0900 (JST)
	(envelope-from imp@village.org)
Received: from harmony.village.org (harmony.village.org [10.0.0.6])
	by rover.village.org (8.11.3/8.11.3) with ESMTP id fBVFsgl35200;
	Mon, 31 Dec 2001 08:54:43 -0700 (MST)
	(envelope-from imp@village.org)
Received: from localhost (localhost [127.0.0.1])
	by harmony.village.org (8.11.6/8.11.6) with ESMTP id fBVFsX152637;
	Mon, 31 Dec 2001 08:54:41 -0700 (MST)
	(envelope-from imp@village.org)
Date: Mon, 31 Dec 2001 08:54:20 -0700 (MST)
Message-Id: <20011231.085420.61359732.imp@village.org>
To: acpi-jp@jp.FreeBSD.org, msmith@freebsd.org
From: "M. Warner Losh" <imp@village.org>
In-Reply-To: <200112281852.fBSIqXF13308@mass.dis.org>
References: <20011228.012622.108756262.imp@village.org>
	<200112281852.fBSIqXF13308@mass.dis.org>
X-Mailer: Mew version 2.1 on Emacs 21.1 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Multipart/Mixed;
 boundary="--Next_Part(Mon_Dec_31_08:54:20_2001_393)--"
Content-Transfer-Encoding: 7bit
Reply-To: acpi-jp@jp.FreeBSD.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+011218
X-Sequence: acpi-jp 1556
Subject: [acpi-jp 1556] Re: Maybe a PCI Interrupt bug report, but want
 to know what to send 
Errors-To: owner-acpi-jp@jp.FreeBSD.org
Sender: owner-acpi-jp@jp.FreeBSD.org
X-Originator: imp@village.org

----Next_Part(Mon_Dec_31_08:54:20_2001_393)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

In message: <200112281852.fBSIqXF13308@mass.dis.org>
            Mike Smith <msmith@freebsd.org> writes:
: An ASL dump would be a good start.

OK.  Please find attached my PIR table and the asl-dump.  I've also
included what I've hacked in the pci interrupt routing code as well.

Have I forgotten anything?

Warner

----Next_Part(Mon_Dec_31_08:54:20_2001_393)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="asl.dump"

/*
RSD PTR: Checksum=147, OEMID=PTLTD, RsdtAddress=0x06ffc1e0
 */
/*
RSDT: Length=44, Revision=1, Checksum=214,
	OEMID=PTLTD, OEM Table ID=  RSDT, OEM Revision=0x6040005,
	Creator ID= LTP, Creator Revision=0x0
 */
/*
	Entries={ 0x06fffb64, 0x06fffbd8 }
 */
/*
	DSDT=0x6ffc20c
	INT_MODEL=PIC
	SCI_INT=9
	SMI_CMD=0xb1, ACPI_ENABLE=0xf0, ACPI_DISABLE=0xf1, S4BIOS_REQ=0xf2
	PM1a_EVT_BLK=0x8000-0x8003
	PM1a_CNT_BLK=0x8004-0x8005
	PM2_CNT_BLK=0x8030-0x8030
	PM2_TMR_BLK=0x8008-0x800b
	PM2_GPE0_BLK=0x8018-0x8027
	P_LVL2_LAT=10ms, P_LVL3_LAT=32ms
	FLUSH_SIZE=0, FLUSH_STRIDE=0
	DUTY_OFFSET=1, DUTY_WIDTH=3
	DAY_ALRM=13, MON_ALRM=0, CENTURY=50
	Flags={WBINVD,PROC_C1,SLP_BUTTON,RTC_S4,TMR_VAL_EXT}
 */
/*
DSDT: Length=14680, Revision=1, Checksum=137,
	OEMID=TM, OEM Table ID=PDBALI35, OEM Revision=0x6040005,
	Creator ID=MSFT, Creator Revision=0x100000b
 */
DefinitionBlock (
    "acpi_dsdt.aml",	//Output filename
    "DSDT",		//Signature
    0x1,		//DSDT Revision
    "TM",		//OEMID
    "PDBALI35",		//TABLE ID
    0x6040005		//OEM Revision
)

{
Scope(_PR_) {
    Processor(CPU0, 0, 0x8010, 0x6) {
    }
}
Scope(\_TZ_) {
    Name(TPL_, 0x0d2c)
    Name(TACT, 0x0d7c)
    Name(TPC_, 0x0e44)
    Name(TPTM, 0x0ca0)
    Name(TBSE, 0x0aac)
    Name(TTMP, 0x0c82)
    Name(TVAR, Buffer(0x5) {0x0, 0x20, 0x1f, 0xc, 0x1f })
    CreateByteField(TVAR, 0x0, PLCY)
    CreateWordField(TVAR, 0x1, CTOS)
    CreateWordField(TVAR, 0x3, CTHY)
    PowerResource(QFAN, 0, 0) {
        Method(_STA) {
            If(\_SB_.PCI0.ISA_.EC0_.ECOK) {
                Return(\_SB_.PCI0.ISA_.EC0_.FANC)
            }
            Else {
                Return(Zero)
            }
        }
        Method(_ON_) {
            If(\_SB_.PCI0.ISA_.EC0_.ECOK) {
                Acquire(\_SB_.PCI0.ISA_.EC0_.MUT0, 0x5000)
                Store(0x1, \_SB_.PCI0.ISA_.EC0_.FANC)
                Release(\_SB_.PCI0.ISA_.EC0_.MUT0)
            }
        }
        Method(_OFF) {
            If(\_SB_.PCI0.ISA_.EC0_.ECOK) {
                Acquire(\_SB_.PCI0.ISA_.EC0_.MUT0, 0x5000)
                Store(0x0, \_SB_.PCI0.ISA_.EC0_.FANC)
                Release(\_SB_.PCI0.ISA_.EC0_.MUT0)
            }
        }
    }
    Device(FAN_) {
        Name(_HID, 0x0b0cd041)
        Name(_UID, 0x1)
        Name(_PR0, Package(0x1) {
            QFAN,
        })
    }
    ThermalZone(THRM) {
        Name(_AL0, Package(0x1) {
            FAN_,
        })
        Method(_AC0) {
            Return(TPL_)
        }
        Name(_TSP, 0x28)
        Method(_CRT) {
            Return(TPC_)
        }
        Name(Z000, 0x1)
        Method(_TMP) {
            If(Z000) {
                Store(0x0, Z000)
                Return(TPTM)
            }
            If(\_SB_.PCI0.ISA_.EC0_.ECOK) {
                If(Not(Acquire(\_SB_.PCI0.ISA_.EC0_.MUT0, 0x1400), )) {
                    Store(\_SB_.PCI0.ISA_.EC0_.BANK, Local0)
                    Store(0x7, \_SB_.PCI0.ISA_.EC0_.BANK)
                    Store(\_SB_.PCI0.ISA_.EC0_.CTMP, Local1)
                    Store(Local0, \_SB_.PCI0.ISA_.EC0_.BANK)
                    Release(\_SB_.PCI0.ISA_.EC0_.MUT0)
                }
                Add(Multiply(Local1, 0xa, ), TBSE, TTMP)
                If(LEqual(TTMP, 0x0)) {
                    Store(TPTM, TTMP)
                }
                If(And(LEqual(And(0x1, \_SB_.PCI0.ISA_.EC0_.BATF, ), 0x0), \_SB_.PCI0.ISA_.DCFN, )) {
                    Return(TTMP)
                }
                If(LGreater(TTMP, 0x0d7c)) {
                    Store(0x1, \_SB_.PCI0.ISA_.CHIB)
                    Store(0x1d, \_SB_.PCI0.LR__)
                }
                If(LLess(TTMP, 0x0d2c)) {
                    Store(0x0, \_SB_.PCI0.ISA_.CHIB)
                    Store(0x1, \_SB_.PCI0.LR__)
                }
                If(LGreater(TTMP, 0x0dcc)) {
                    Store(0x1, \_SB_.PCI0.ISA_.CHIB)
                    Store(0x19, \_SB_.PCI0.LR__)
                }
                Return(TTMP)
            }
            Else {
                Return(TPTM)
            }
        }
        Method(_SCP, 1) {
            If(Arg0) {
                Store(One, PLCY)
            }
            Else {
                Store(Zero, PLCY)
            }
            Notify(\_TZ_.THRM, 0x81)
        }
    }
}
Scope(\_GPE) {
    Method(_L05) {
        If(\_SB_.PCI0.PM__.LIDS) {
            Store(0x8b, \_SB_.PCI0.ISA_.BCMD)
            Store(0x0, \_SB_.PCI0.ISA_.SMIC)
        }
        Else {
            Store(0x8c, \_SB_.PCI0.ISA_.BCMD)
            Store(0x0, \_SB_.PCI0.ISA_.SMIC)
        }
        Store(" LID  OPEN/CLOSE ", Debug)
        Notify(\_SB_.LID_, 0x80)
    }
    Method(_L09) {
        Notify(\_SB_.PCI0.LAN_, 0x0)
        Notify(\_SB_.PCI0.MDEM, 0x0)
        Notify(\_SB_.SLPB, 0x2)
    }
}
Scope(_SB_) {
    Name(OKEC, 0x0)
    Device(PWRB) {
        Name(_HID, 0x0c0cd041)
    }
    Device(PCI0) {
        Name(_HID, 0x030ad041)
        Name(_BBN, 0x0)
        Name(_ADR, 0x0)
        OperationRegion(REGS, PCI_Config, 0x40, 0xa9)
        Field(REGS, DWordAcc, NoLock, Preserve) {
            Offset(0xa),
            TOM_,	16,
            Offset(0x1a),
            PAM1,	8,
            PAM2,	8,
            PAM3,	8,
            PAM4,	8,
            PAM5,	8,
            PAM6,	8,
            Offset(0x33),
            T_EN,	1,
            Offset(0x3b),
            ,	6,
            ARBC,	1,
            Offset(0x68),
            LR__,	8
        }
        Name(RSRC, Buffer(0xbd) {0x88, 0xd, 0x0, 0x2, 0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0x1, 0x47, 0x1, 0xf8, 0xc, 0xf8, 0xc, 0x1, 0x8, 0x88, 0xd, 0x0, 0x1, 0xc, 0x3, 0x0, 0x0, 0x0, 0x0, 0xf7, 0xc, 0x0, 0x0, 0xf8, 0xc, 0x88, 0xd, 0x0, 0x1, 0xc, 0x3, 0x0, 0x0, 0x0, 0xd, 0xff, 0xff, 0x0, 0x0, 0x0, 0xf3, 0x87, 0x17, 0x0, 0x0, 0xc, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2, 0x0, 0x87, 0x17, 0x0, 0x0, 0xc, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0, 0xc, 0x0, 0xff, 0xbf, 0xd, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x87, 0x17, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0, 0xd, 0x0, 0xff, 0xff, 0xf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40, 0x2, 0x0, 0x87, 0x17, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x0, 0x87, 0x18, 0x0, 0x0, 0xc, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,!
  0x0, 0x0, 0x0, 0x79, 0x0 })
        Method(_CRS, 0, Serialized) {
            CreateDWordField(RSRC, 0xaa, ATMN)
            CreateDWordField(RSRC, 0xae, ATMX)
            CreateDWordField(RSRC, 0xb6, ATLN)
            Multiply(TOM_, 0x00010000, Local0)
            If(T_EN) {
                Add(Local0, 0x000e0000, ATMN)
            }
            Else {
                Store(Local0, ATMN)
            }
            Subtract(0xffe00000, ATMN, ATLN)
            Subtract(Add(ATMN, ATLN, ), 0x1, ATMX)
            Return(RSRC)
        }
        OperationRegion(VNBR, PCI_Config, 0x0, 0x0100)
        Field(VNBR, ByteAcc, NoLock, Preserve) {
            Offset(0xd8),
            Z001,	16,
            Z002,	16,
            Z003,	16,
            Z004,	1,
            Z005,	1,
            Z006,	6,
            Z007,	8,
            Z008,	16,
            Z009,	16,
            Z00A,	16,
            Z00B,	1,
            Z00C,	1,
            Z00D,	6,
            Z00E,	8,
            Z00F,	16,
            Z00G,	16,
            Z00H,	16,
            Z00I,	1,
            Z00J,	1,
            Z00K,	6,
            Z00L,	8,
            Z00M,	16,
            Z00N,	16,
            Z00O,	16,
            Z00P,	1,
            Z00Q,	1,
            Z00R,	6,
            Z00S,	8
        }
        Name(_PRT, Package(0x8) {
            Package(0x4) {
                0x0014ffff,
                0x0,
                \_SB_.PCI0.ISA_.LNKU,
                0x0,
            },
            Package(0x4) {
                0x0003ffff,
                0x0,
                \_SB_.PCI0.ISA_.LNK7,
                0x0,
            },
            Package(0x4) {
                0x0004ffff,
                0x0,
                \_SB_.PCI0.ISA_.LNK8,
                0x0,
            },
            Package(0x4) {
                0x000affff,
                0x0,
                \_SB_.PCI0.ISA_.LNK2,
                0x0,
            },
            Package(0x4) {
                0x000affff,
                0x1,
                \_SB_.PCI0.ISA_.LNK3,
                0x0,
            },
            Package(0x4) {
                0x0009ffff,
                0x0,
                \_SB_.PCI0.ISA_.LNK1,
                0x0,
            },
            Package(0x4) {
                0x000bffff,
                0x0,
                \_SB_.PCI0.ISA_.LNK4,
                0x0,
            },
            Package(0x4) {
                0x000cffff,
                0x0,
                \_SB_.PCI0.ISA_.LNK5,
                0x0,
            },
        })
        Device(ISA_) {
            Name(_ADR, 0x00070000)
            Device(DMAC) {
                Name(_HID, 0x0002d041)
                Name(_CRS, Buffer(0x1d) {0x47, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x10, 0x47, 0x1, 0x81, 0x0, 0x81, 0x0, 0x1, 0xf, 0x47, 0x1, 0xc0, 0x0, 0xc0, 0x0, 0x1, 0x20, 0x2a, 0x10, 0x2, 0x79, 0x0 })
            }
            Device(PIC_) {
                Name(_HID, 0xd041)
                Name(_CRS, Buffer(0x16) {0x47, 0x1, 0x20, 0x0, 0x20, 0x0, 0x1, 0x2, 0x47, 0x1, 0xa0, 0x0, 0xa0, 0x0, 0x1, 0x2, 0x23, 0x4, 0x0, 0x1, 0x79, 0x0 })
            }
            Device(TIME) {
                Name(_HID, 0x0001d041)
                Name(_CRS, Buffer(0xe) {0x47, 0x1, 0x40, 0x0, 0x40, 0x0, 0x1, 0x4, 0x23, 0x1, 0x0, 0x1, 0x79, 0x0 })
            }
            Device(RTC_) {
                Name(_HID, 0x000bd041)
                Name(_CRS, Buffer(0xe) {0x47, 0x1, 0x70, 0x0, 0x70, 0x0, 0x1, 0x2, 0x23, 0x0, 0x1, 0x1, 0x79, 0x0 })
            }
            Device(MATH) {
                Name(_HID, 0x040cd041)
                Name(_CRS, Buffer(0xe) {0x47, 0x1, 0xf0, 0x0, 0xf0, 0x0, 0x1, 0xf, 0x23, 0x0, 0x20, 0x1, 0x79, 0x0 })
            }
            Device(SPKR) {
                Name(_HID, 0x0008d041)
                Name(_CRS, Buffer(0xa) {0x47, 0x1, 0x61, 0x0, 0x61, 0x0, 0x1, 0x1, 0x79, 0x0 })
            }
            Device(KBC0) {
                Name(_HID, 0x0303d041)
                Name(_UID, 0x0)
                Name(_CRS, Buffer(0x16) {0x47, 0x1, 0x60, 0x0, 0x60, 0x0, 0x1, 0x1, 0x47, 0x1, 0x64, 0x0, 0x64, 0x0, 0x1, 0x1, 0x23, 0x2, 0x0, 0x1, 0x79, 0x0 })
                Method(_STA) {
                    If(\_SB_.PCI0.ISA_.KBID) {
                        Return(0x0)
                    }
                    Else {
                        Return(0xf)
                    }
                }
            }
            Device(KBC1) {
                Name(_HID, 0x2003d041)
                Name(_UID, 0x1)
                Name(_CRS, Buffer(0x16) {0x47, 0x1, 0x60, 0x0, 0x60, 0x0, 0x1, 0x1, 0x47, 0x1, 0x64, 0x0, 0x64, 0x0, 0x1, 0x1, 0x23, 0x2, 0x0, 0x1, 0x79, 0x0 })
                Method(_STA) {
                    If(\_SB_.PCI0.ISA_.KBID) {
                        Return(0xf)
                    }
                    Else {
                        Return(0x0)
                    }
                }
            }
            Device(MSE0) {
                Name(_HID, 0x80374d24)
                Name(_CID, 0x130fd041)
                Name(_CRS, Buffer(0x6) {0x23, 0x0, 0x10, 0x1, 0x79, 0x0 })
            }
            Device(SYSR) {
                Name(_HID, 0x020cd041)
                Name(RSRC, Buffer(0x76) {0x47, 0x1, 0x80, 0x0, 0x80, 0x0, 0x1, 0x1, 0x47, 0x1, 0x92, 0x0, 0x92, 0x0, 0x1, 0x1, 0x47, 0x1, 0xb1, 0x0, 0xb1, 0x0, 0x1, 0x1, 0x23, 0x0, 0x80, 0x1, 0x47, 0x1, 0x70, 0x1, 0x70, 0x1, 0x1, 0x7, 0x47, 0x1, 0x76, 0x3, 0x76, 0x3, 0x1, 0x1, 0x47, 0x1, 0xd0, 0x4, 0xd0, 0x4, 0x1, 0x2, 0x47, 0x1, 0xb, 0x4, 0xb, 0x4, 0x1, 0x1, 0x47, 0x1, 0x80, 0x4, 0x80, 0x4, 0x1, 0x10, 0x47, 0x1, 0xd6, 0x4, 0xd6, 0x4, 0x1, 0x1, 0x47, 0x1, 0x0, 0x80, 0x0, 0x80, 0x1, 0x40, 0x47, 0x1, 0x40, 0x80, 0x40, 0x80, 0x1, 0x20, 0x86, 0x9, 0x0, 0x0, 0x0, 0x0, 0xf8, 0xff, 0x0, 0x0, 0x8, 0x0, 0x86, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x79, 0x0 })
                Method(_CRS, 0, Serialized) {
                    CreateDWordField(RSRC, 0x6c, MBAS)
                    Multiply(\_SB_.PCI0.TOM_, 0x00010000, Local0)
                    Store(Local0, MBAS)
                    Return(RSRC)
                }
            }
            Device(LNK1) {
                Name(_HID, 0x0f0cd041)
                Name(_UID, 0x1)
                Name(_PRS, Buffer(0x6) {0x23, 0xb8, 0xc, 0x18, 0x79, 0x0 })
                Name(RSRC, Buffer(0x6) {0x23, 0x0, 0x0, 0x18, 0x79, 0x0 })
                Method(_DIS) {
                    Store(0x0, PIR1)
                }
                Method(_CRS) {
                    CreateWordField(RSRC, 0x1, IRQ0)
                    Store(PIR1, Local0)
                    Store(DerefOf(Index(PIRI, Local0, )), Local1)
                    If(Local1) {
                        ShiftLeft(0x1, Local1, IRQ0)
                    }
                    Return(RSRC)
                }
                Method(_SRS, 1) {
                    CreateWordField(Arg0, 0x1, IRQ0)
                    FindSetRightBit(IRQ0, Local0)
                    Decrement(Local0)
                    Store(DerefOf(Index(PIIR, Local0, )), PIR1)
                }
                Method(_STA) {
                    If(PIR1) {
                        Return(0xb)
                    }
                    Return(0x9)
                }
            }
            Device(LNK2) {
                Name(_HID, 0x0f0cd041)
                Name(_UID, 0x2)
                Name(_PRS, Buffer(0x6) {0x23, 0xb8, 0xc, 0x18, 0x79, 0x0 })
                Name(RSRC, Buffer(0x6) {0x23, 0x0, 0x0, 0x18, 0x79, 0x0 })
                Method(_DIS) {
                    Store("LNK2_DIS", Debug)
                    Store(0x0, PIR2)
                }
                Method(_CRS) {
                    Store("LNK2_CRS", Debug)
                    CreateWordField(RSRC, 0x1, IRQ0)
                    Store(PIR2, Local0)
                    Store(DerefOf(Index(PIRI, Local0, )), Local1)
                    If(Local1) {
                        ShiftLeft(0x1, Local1, IRQ0)
                    }
                    Return(RSRC)
                }
                Method(_SRS, 1) {
                    Store("LNK2_SRS", Debug)
                    CreateWordField(Arg0, 0x1, IRQ0)
                    FindSetRightBit(IRQ0, Local0)
                    Decrement(Local0)
                    Store(DerefOf(Index(PIIR, Local0, )), PIR2)
                }
                Method(_STA) {
                    Store("LNK2_STA", Debug)
                    If(PIR2) {
                        Return(0xb)
                    }
                    Return(0x9)
                }
            }
            Device(LNK3) {
                Name(_HID, 0x0f0cd041)
                Name(_UID, 0x3)
                Name(_PRS, Buffer(0x6) {0x23, 0xb8, 0xc, 0x18, 0x79, 0x0 })
                Name(RSRC, Buffer(0x6) {0x23, 0x0, 0x0, 0x18, 0x79, 0x0 })
                Method(_DIS) {
                    Store("LNK3_DIS", Debug)
                    Store(0x0, PIR3)
                }
                Method(_CRS) {
                    Store("LNK3_CRS", Debug)
                    CreateWordField(RSRC, 0x1, IRQ0)
                    Store(PIR3, Local0)
                    Store(DerefOf(Index(PIRI, Local0, )), Local1)
                    If(Local1) {
                        ShiftLeft(0x1, Local1, IRQ0)
                    }
                    Return(RSRC)
                }
                Method(_SRS, 1) {
                    Store("LNK3_SRS", Debug)
                    CreateWordField(Arg0, 0x1, IRQ0)
                    FindSetRightBit(IRQ0, Local0)
                    Decrement(Local0)
                    Store(DerefOf(Index(PIIR, Local0, )), PIR3)
                }
                Method(_STA) {
                    Store("LNK3_STA", Debug)
                    If(PIR3) {
                        Return(0xb)
                    }
                    Return(0x9)
                }
            }
            Device(LNK4) {
                Name(_HID, 0x0f0cd041)
                Name(_UID, 0x4)
                Name(_PRS, Buffer(0x6) {0x23, 0xb8, 0xc, 0x18, 0x79, 0x0 })
                Name(RSRC, Buffer(0x6) {0x23, 0x0, 0x0, 0x18, 0x79, 0x0 })
                Method(_DIS) {
                    Store("LNK4_DIS", Debug)
                    Store(0x0, PIR4)
                }
                Method(_CRS) {
                    Store("LNK4_CRS", Debug)
                    CreateWordField(RSRC, 0x1, IRQ0)
                    Store(PIR4, Local0)
                    Store(DerefOf(Index(PIRI, Local0, )), Local1)
                    If(Local1) {
                        ShiftLeft(0x1, Local1, IRQ0)
                    }
                    Return(RSRC)
                }
                Method(_SRS, 1) {
                    Store("LNK4_SRS", Debug)
                    CreateWordField(Arg0, 0x1, IRQ0)
                    FindSetRightBit(IRQ0, Local0)
                    Decrement(Local0)
                    Store(DerefOf(Index(PIIR, Local0, )), PIR4)
                }
                Method(_STA) {
                    Store("LNK4_STA", Debug)
                    If(PIR4) {
                        Return(0xb)
                    }
                    Return(0x9)
                }
            }
            Device(LNK5) {
                Name(_HID, 0x0f0cd041)
                Name(_UID, 0x5)
                Name(_PRS, Buffer(0x6) {0x23, 0xb8, 0xc, 0x18, 0x79, 0x0 })
                Name(RSRC, Buffer(0x6) {0x23, 0x0, 0x0, 0x18, 0x79, 0x0 })
                Method(_DIS) {
                    Store("LNK5_DIS", Debug)
                    Store(0x0, PIR5)
                }
                Method(_CRS) {
                    Store("LNK5_CRS", Debug)
                    CreateWordField(RSRC, 0x1, IRQ0)
                    Store(PIR5, Local0)
                    Store(DerefOf(Index(PIRI, Local0, )), Local1)
                    If(Local1) {
                        ShiftLeft(0x1, Local1, IRQ0)
                    }
                    Return(RSRC)
                }
                Method(_SRS, 1) {
                    Store("LNK5_SRS", Debug)
                    CreateWordField(Arg0, 0x1, IRQ0)
                    FindSetRightBit(IRQ0, Local0)
                    Decrement(Local0)
                    Store(DerefOf(Index(PIIR, Local0, )), PIR5)
                }
                Method(_STA) {
                    Store("LNK5_STA", Debug)
                    If(PIR5) {
                        Return(0xb)
                    }
                    Return(0x9)
                }
            }
            Device(LNK6) {
                Name(_HID, 0x0f0cd041)
                Name(_UID, 0x6)
                Name(_PRS, Buffer(0x6) {0x23, 0xb8, 0xc, 0x18, 0x79, 0x0 })
                Name(RSRC, Buffer(0x6) {0x23, 0x0, 0x0, 0x18, 0x79, 0x0 })
                Method(_DIS) {
                    Store("LNK6_DIS", Debug)
                    Store(0x0, PIR6)
                }
                Method(_CRS) {
                    Store("LNK6_CRS", Debug)
                    CreateWordField(RSRC, 0x1, IRQ0)
                    Store(PIR6, Local0)
                    Store(DerefOf(Index(PIRI, Local0, )), Local1)
                    If(Local1) {
                        ShiftLeft(0x1, Local1, IRQ0)
                    }
                    Return(RSRC)
                }
                Method(_SRS, 1) {
                    Store("LNK6_SRS", Debug)
                    CreateWordField(Arg0, 0x1, IRQ0)
                    FindSetRightBit(IRQ0, Local0)
                    Decrement(Local0)
                    Store(DerefOf(Index(PIIR, Local0, )), PIR6)
                }
                Method(_STA) {
                    Store("LNK6_STA", Debug)
                    If(PIR6) {
                        Return(0xb)
                    }
                    Return(0x9)
                }
            }
            Device(LNK7) {
                Name(_HID, 0x0f0cd041)
                Name(_UID, 0x7)
                Name(_PRS, Buffer(0x6) {0x23, 0xb8, 0xc, 0x18, 0x79, 0x0 })
                Name(RSRC, Buffer(0x6) {0x23, 0x0, 0x0, 0x18, 0x79, 0x0 })
                Method(_DIS) {
                    Store("LNK7_DIS", Debug)
                    Store(0x0, PIR7)
                }
                Method(_CRS) {
                    Store("LNK7_CRS", Debug)
                    CreateWordField(RSRC, 0x1, IRQ0)
                    Store(PIR7, Local0)
                    Store(DerefOf(Index(PIRI, Local0, )), Local1)
                    If(Local1) {
                        ShiftLeft(0x1, Local1, IRQ0)
                    }
                    Return(RSRC)
                }
                Method(_SRS, 1) {
                    Store("LNK7_SRS", Debug)
                    CreateWordField(Arg0, 0x1, IRQ0)
                    FindSetRightBit(IRQ0, Local0)
                    Decrement(Local0)
                    Store(DerefOf(Index(PIIR, Local0, )), PIR7)
                }
                Method(_STA) {
                    Store("LNK7_STA", Debug)
                    If(PIR7) {
                        Return(0xb)
                    }
                    Return(0x9)
                }
            }
            Device(LNK8) {
                Name(_HID, 0x0f0cd041)
                Name(_UID, 0x8)
                Name(_PRS, Buffer(0x6) {0x23, 0xb8, 0xc, 0x18, 0x79, 0x0 })
                Name(RSRC, Buffer(0x6) {0x23, 0x0, 0x0, 0x18, 0x79, 0x0 })
                Method(_DIS) {
                    Store("LNK8_DIS", Debug)
                    Store(0x0, PIR8)
                }
                Method(_CRS) {
                    Store("LNK8_CRS", Debug)
                    CreateWordField(RSRC, 0x1, IRQ0)
                    Store(PIR8, Local0)
                    Store(DerefOf(Index(PIRI, Local0, )), Local1)
                    If(Local1) {
                        ShiftLeft(0x1, Local1, IRQ0)
                    }
                    Return(RSRC)
                }
                Method(_SRS, 1) {
                    Store("LNK8_SRS", Debug)
                    CreateWordField(Arg0, 0x1, IRQ0)
                    FindSetRightBit(IRQ0, Local0)
                    Decrement(Local0)
                    Store(DerefOf(Index(PIIR, Local0, )), PIR8)
                }
                Method(_STA) {
                    Store("LNK8_STA", Debug)
                    If(PIR8) {
                        Return(0xb)
                    }
                    Return(0x9)
                }
            }
            Device(LNKU) {
                Name(_HID, 0x0f0cd041)
                Name(_UID, 0x9)
                Name(_PRS, Buffer(0x6) {0x23, 0xb8, 0xc, 0x18, 0x79, 0x0 })
                Name(RSRC, Buffer(0x6) {0x23, 0x0, 0x0, 0x18, 0x79, 0x0 })
                Method(_DIS) {
                    Store(0x0, PIRU)
                }
                Method(_CRS) {
                    CreateWordField(RSRC, 0x1, IRQ0)
                    Store(PIRU, Local0)
                    Store(DerefOf(Index(PIRI, Local0, )), Local1)
                    If(Local1) {
                        ShiftLeft(0x1, Local1, IRQ0)
                    }
                    Return(RSRC)
                }
                Method(_SRS, 1) {
                    CreateWordField(Arg0, 0x1, IRQ0)
                    FindSetRightBit(IRQ0, Local0)
                    Decrement(Local0)
                    Store(DerefOf(Index(PIIR, Local0, )), PIRU)
                }
                Method(_STA) {
                    If(PIRU) {
                        Return(0xb)
                    }
                    Return(0x9)
                }
            }
            OperationRegion(PIUC, PCI_Config, 0x74, 0x1)
            Field(PIUC, DWordAcc, Lock, Preserve) {
                AccessAs(ByteAcc, 0),
                PIRU,	4
            }
            OperationRegion(PIRX, PCI_Config, 0x48, 0x4)
            Field(PIRX, DWordAcc, Lock, Preserve) {
                AccessAs(ByteAcc, 0),
                PIR1,	4,
                PIR2,	4,
                PIR3,	4,
                PIR4,	4,
                PIR5,	4,
                PIR6,	4,
                PIR7,	4,
                PIR8,	4
            }
            Name(PIRI, Package(0x10) {
                0x0,
                0x9,
                0x3,
                0xa,
                0x4,
                0x5,
                0x7,
                0x6,
                0x1,
                0xb,
                0x0,
                0xc,
                0x0,
                0xe,
                0x0,
                0xf,
            })
            Name(PIIR, Package(0x10) {
                0x0,
                0x8,
                0x0,
                0x2,
                0x4,
                0x5,
                0x7,
                0x6,
                0x0,
                0x1,
                0x3,
                0x9,
                0xb,
                0x0,
                0xd,
                0xf,
            })
            Mutex(PSMX, 0)
            OperationRegion(SMI0, SystemIO, 0x00008038, 0x00000002)
            Field(SMI0, AnyAcc, NoLock, Preserve) {
                SMIC,	8
            }
            OperationRegion(SMI1, SystemMemory, 0x06ffff2c, 0x00000090)
            Field(SMI1, AnyAcc, NoLock, Preserve) {
                BCMD,	8,
                DID_,	32,
                INFO,	1024
            }
            Field(SMI1, AnyAcc, NoLock, Preserve) {
                AccessAs(ByteAcc, 0),
                Offset(0x5),
                INF_,	8
            }
            Device(EC0_) {
                Name(_HID, 0x090cd041)
                Name(_CRS, Buffer(0x12) {0x47, 0x1, 0x62, 0x0, 0x62, 0x0, 0x1, 0x1, 0x47, 0x1, 0x66, 0x0, 0x66, 0x0, 0x1, 0x1, 0x79, 0x0 })
                Name(_GPE, 0x8)
                Name(ECOK, 0x0)
                Name(TMPB, 0x0)
                Name(TBAT, 0x0)
                Method(_REG, 2) {
                    If(LEqual(Arg0, 0x3)) {
                        Store(Arg1, ECOK)
                        Store(Arg1, \_SB_.OKEC)
                    }
                }
                OperationRegion(ERAM, EmbeddedControl, 0x0, 0xff)
                Field(ERAM, ByteAcc, NoLock, Preserve) {
                    Offset(0x18),
                    SMPR,	8,
                    SMST,	8,
                    SMAD,	8,
                    SMCM,	8,
                    SMD0,	264,
                    SMAA,	8,
                    BATD,	16,
                    Offset(0x53),
                    TMSS,	2,
                    ,	2,
                    BANK,	4,
                    Offset(0x56),
                    ,	4,
                    FANC,	1,
                    Offset(0x80),
                    CTMP,	8,
                    Offset(0x89),
                    TSK4,	8,
                    Offset(0x94),
                    TSC0,	8,
                    Offset(0x96),
                    MBVT,	16,
                    Offset(0x9a),
                    MBCT,	16,
                    Offset(0xa1),
                    TDLY,	8,
                    Offset(0xf6),
                    Z00T,	16,
                    Offset(0xfd),
                    DBAT,	16
                }
                Field(ERAM, ByteAcc, NoLock, Preserve) {
                    Offset(0x1c),
                    SMW0,	16
                }
                Field(ERAM, ByteAcc, NoLock, Preserve) {
                    Offset(0x1c),
                    SMB0,	8
                }
                Mutex(MUT0, 0)
                Method(SMRD, 4) {
                    If(LNot(LEqual(Arg0, 0x7))) {
                        If(LNot(LEqual(Arg0, 0x9))) {
                            If(LNot(LEqual(Arg0, 0xb))) {
                                Return(0x19)
                            }
                        }
                    }
                    If(Not(Acquire(MUT0, 0x1400), )) {
                        Store(0x4, Local0)
                        While(LGreater(Local0, 0x1)) {
                            And(SMST, 0x40, SMST)
                            Store(Arg2, SMCM)
                            Store(Arg1, SMAD)
                            Store(Arg0, SMPR)
                            Store(0x14, Local3)
                            And(SMST, 0xbf, Local1)
                            While(LAnd(LEqual(Local1, 0x0), LGreater(Local3, 0x0))) {
                                Sleep(0x1)
                                And(SMST, 0xbf, Local1)
                                Decrement(Local3)
                            }
                            If(LEqual(Local1, 0x80)) {
                                Store(0x0, Local0)
                            }
                            Else {
                                Decrement(Local0)
                            }
                        }
                        If(Local0) {
                            Store(And(Local1, 0x1f, ), Local0)
                        }
                        Else {
                            If(LEqual(Arg0, 0x7)) {
                                Store(SMB0, Arg3)
                            }
                            If(LEqual(Arg0, 0x9)) {
                                Store(SMW0, Arg3)
                            }
                            If(LEqual(Arg0, 0xb)) {
                                Store(SMD0, Arg3)
                            }
                        }
                        Release(MUT0)
                    }
                    Return(Local0)
                }
                Method(SMWR, 4) {
                    If(LNot(LEqual(Arg0, 0x6))) {
                        If(LNot(LEqual(Arg0, 0x8))) {
                            If(LNot(LEqual(Arg0, 0xa))) {
                                Return(0x19)
                            }
                        }
                    }
                    If(Not(Acquire(MUT0, 0x1400), )) {
                        Store(0x4, Local0)
                        While(LGreater(Local0, 0x1)) {
                            If(LEqual(Arg0, 0x6)) {
                                Store(Arg3, SMB0)
                            }
                            If(LEqual(Arg0, 0x8)) {
                                Store(Arg3, SMW0)
                            }
                            If(LEqual(Arg0, 0xa)) {
                                Store(Arg3, SMD0)
                            }
                            And(SMST, 0x40, SMST)
                            Store(Arg2, SMCM)
                            Store(Arg1, SMAD)
                            Store(Arg0, SMPR)
                            Store(0x14, Local3)
                            And(SMST, 0xbf, Local1)
                            While(LAnd(LEqual(Local1, 0x0), LGreater(Local3, 0x0))) {
                                Sleep(0x1)
                                And(SMST, 0xbf, Local1)
                                Decrement(Local3)
                            }
                            If(LEqual(Local1, 0x80)) {
                                Store(0x0, Local0)
                            }
                            Else {
                                Decrement(Local0)
                            }
                        }
                        If(Local0) {
                            Store(And(Local1, 0x1f, ), Local0)
                        }
                        Release(MUT0)
                    }
                    Return(Local0)
                }
                Method(BPOL) {
                    Store(BANK, Local0)
                    Store(0x1, BANK)
                    Store(0xe, TDLY)
                    Store(Local0, BANK)
                }
                Name(ACEV, 0x0)
                Name(BATO, 0xc0)
                Name(BATN, 0x0)
                Name(BATF, 0xc0)
                Method(_Q09) {
                    Acquire(MUT0, 0x5000)
                    SELE()
                    \_SB_.BAT1.UPBS()
                    Store(0x0, SMST)
                    Release(MUT0)
                }
                Method(_Q23) {
                }
                Method(_Q20) {
                    Sleep(0x03e8)
                    Acquire(MUT0, 0x5000)
                    If(And(SMST, 0x40, )) {
                        Store(SMAA, Local0)
                        If(LEqual(Local0, 0x14)) {
                            SELE()
                            Store(TBAT, Local1)
                            \_SB_.BAT1.CHBP(Local1)
                            If(And(0x2, BATF, )) {
                                If(And(0x1, BATF, )) {
                                    Store(0x89, \_SB_.PCI0.ISA_.BCMD)
                                    Store(0x0, \_SB_.PCI0.ISA_.SMIC)
                                }
                                Else {
                                    Store(0x8a, \_SB_.PCI0.ISA_.BCMD)
                                    Store(0x0, \_SB_.PCI0.ISA_.SMIC)
                                }
                                Store(0x1, ACEV)
                                Notify(\_SB_.ACAD, 0x0)
                                If(\_SB_.PCI0.ISA_.DCFN) {
                                    If(And(0x1, BATF, )) {
                                        Store(0x0, \_SB_.PCI0.ISA_.CHIB)
                                        Store(0x1, \_SB_.PCI0.LR__)
                                    }
                                    Else {
                                        Store(0x1, \_SB_.PCI0.ISA_.CHIB)
                                        Store(0x19, \_SB_.PCI0.LR__)
                                    }
                                }
                            }
                            If(And(0x40, BATF, )) {
                                Notify(\_SB_.BAT1, 0x0)
                                Notify(\_SB_.BAT1, 0x80)
                                Notify(\_SB_.BAT1, 0x81)
                            }
                        }
                        Store(TBAT, BATO)
                    }
                    Store(0x0, SMST)
                    Release(MUT0)
                }
                Method(SELE) {
                    Store(BANK, TMPB)
                    Store(0x4, BANK)
                    Store(DBAT, TBAT)
                    Store(TMPB, BANK)
                    Store(TBAT, BATN)
                    Store(0x0, BATF)
                    If(And(0xc0, BATN, )) {
                        Or(BATF, 0x1, BATF)
                    }
                    If(And(0x0c00, BATN, )) {
                        Or(BATF, 0x4, BATF)
                    }
                    And(BATN, 0x0f01, Local0)
                    And(BATO, 0x0f01, Local1)
                    If(Not(LEqual(Local0, Local1), )) {
                        Or(BATF, 0x40, BATF)
                    }
                    And(BATN, 0xc0, Local0)
                    And(BATO, 0xc0, Local1)
                    If(Not(LEqual(Local0, Local1), )) {
                        Or(BATF, 0x2, BATF)
                    }
                    If(And(0x4, BATF, )) {
                        Or(BATF, 0x10, BATF)
                    }
                }
                Method(_Q0C) {
                    Notify(\_SB_.SLPB, 0x80)
                }
                Method(_Q11) {
                    If(LEqual(\_SB_.PCI0.VGA_.SWIT, 0x0)) {
                        Store(\_SB_.PCI0.VGA_.TOGF, Local0)
                        If(LEqual(Local0, 0x0)) {
                            Store(Zero, \_SB_.PCI0.VGA_.CRTA)
                            Store(One, \_SB_.PCI0.VGA_.LCDA)
                            Increment(\_SB_.PCI0.VGA_.TOGF)
                        }
                        If(LEqual(Local0, 0x1)) {
                            Store(One, \_SB_.PCI0.VGA_.CRTA)
                            Store(Zero, \_SB_.PCI0.VGA_.LCDA)
                            Increment(\_SB_.PCI0.VGA_.TOGF)
                        }
                        If(LEqual(Local0, 0x2)) {
                            Store(Zero, \_SB_.PCI0.VGA_.TOGF)
                            Store(One, \_SB_.PCI0.VGA_.CRTA)
                            Store(One, \_SB_.PCI0.VGA_.LCDA)
                        }
                        Notify(\_SB_.PCI0.VGA_, 0x80)
                    }
                    Else {
                        Store(0x86, \_SB_.PCI0.ISA_.BCMD)
                        Store(0x0, \_SB_.PCI0.ISA_.SMIC)
                    }
                }
                Method(_Q0A) {
                    Store(0x87, \_SB_.PCI0.ISA_.BCMD)
                    Store(0x0, \_SB_.PCI0.ISA_.SMIC)
                }
                Method(_Q0B) {
                    Store(0x88, \_SB_.PCI0.ISA_.BCMD)
                    Store(0x0, \_SB_.PCI0.ISA_.SMIC)
                }
                Method(_Q80) {
                    Notify(\_TZ_.THRM, 0x80)
                }
                Method(_Q81) {
                    Notify(\_TZ_.THRM, 0x80)
                }
                Method(_PS0) {
                    If(\_SB_.OKEC) {
                        Store(0x1, ECOK)
                    }
                }
                Method(_PS3) {
                    Store(0x0, ECOK)
                }
            }
            OperationRegion(CMOS, SystemIO, 0x72, 0x2)
            Field(CMOS, ByteAcc, NoLock, Preserve) {
                CIND,	8,
                CDAT,	8
            }
            IndexField(CIND, CDAT, ByteAcc, NoLock, Preserve) {
                CHIB,	1,
                DCFN,	1,
                KBID,	1,
                Offset(0x7),
                ,	7,
                VGAL,	1,
                VGAH,	1
            }
            OperationRegion(GLBL, SystemIO, 0x8000, 0x50)
            Field(GLBL, ByteAcc, NoLock, Preserve) {
                Offset(0x18),
                ,	9,
                PMES,	1
            }
            Method(DECD, 4) {
            }
        }
        Device(SUND) {
            Name(_ADR, 0x00040000)
        }
        Device(DBUG) {
            Name(_ADR, 0x00080000)
        }
        Device(PM__) {
            Name(_ADR, 0x00110000)
            OperationRegion(PMUR, PCI_Config, 0x0, 0xff)
            Field(PMUR, ByteAcc, NoLock, Preserve) {
                Offset(0x7d),
                GPC0,	1,
                GPC1,	1,
                GPC2,	1,
                GPC3,	1,
                GPC4,	1,
                GPC5,	1,
                GPC6,	1,
                GPC7,	1,
                GPD0,	1,
                GPD1,	1,
                GPD2,	1,
                GPD3,	1,
                GPD4,	1,
                GPD5,	1,
                GPD6,	1,
                GPD7,	1,
                GPS0,	1,
                GPS1,	1,
                GPS2,	1,
                GPS3,	1,
                GPS4,	1,
                GPS5,	1,
                GPS6,	1,
                GPS7,	1,
                Offset(0x84),
                GP08,	8,
                GP09,	8,
                GP10,	8,
                GP11,	8,
                ,	5,
                LIDS,	1,
                Offset(0x89),
                GP13,	8,
                ,	4,
                PPCM,	1,
                PVGA,	1,
                Offset(0x8b),
                GP15,	8,
                Offset(0x90),
                GP16,	8,
                GP17,	8,
                GP18,	8,
                GP19,	8
            }
            OperationRegion(LEDS, PCI_Config, 0xb3, 0x1)
            Field(LEDS, ByteAcc, NoLock, Preserve) {
                GLED,	2
            }
        }
        Device(USB_) {
            Name(_ADR, 0x00140000)
            OperationRegion(USB0, PCI_Config, 0x0, 0x40)
            Field(USB0, DWordAcc, NoLock, Preserve) {
                Offset(0x4),
                R04_,	32,
                Offset(0x10),
                R10_,	32,
                Offset(0x3c),
                R3C_,	32
            }
            Name(B04_, Buffer(0x4) { })
            Name(B10_, Buffer(0x4) { })
            Name(B3C_, Buffer(0x4) { })
        }
        Device(CRD0) {
            Name(_ADR, 0x000a0000)
            Name(_PR0, Package(0x1) {
                PCR0,
            })
            Name(_PR1, Package(0x1) {
                PCR0,
            })
            Name(_PR2, Package(0x1) {
                PCR0,
            })
            OperationRegion(NPCC, PCI_Config, 0x0, 0xe0)
            Field(NPCC, DWordAcc, NoLock, Preserve) {
                Offset(0x4),
                TI04,	8,
                Offset(0xd),
                TI0D,	8,
                Offset(0x2e),
                TI2E,	8,
                Offset(0x3e),
                TI3E,	16,
                Offset(0x44),
                TI44,	16,
                Offset(0x80),
                TI80,	8,
                Offset(0x8c),
                TI8C,	8,
                TI8D,	8,
                TI8E,	8,
                TI8F,	8,
                Offset(0x91),
                TI91,	8,
                Offset(0xa4),
                TIA4,	8,
                TIA5,	8
            }
            OperationRegion(TIIO, SystemIO, 0x03e0, 0x2)
            Field(TIIO, ByteAcc, NoLock, Preserve) {
                TIID,	8,
                TIDA,	8
            }
            Method(_INI) {
                Store(TIA4, Local0)
                Store(And(0xf0, TIA4, ), TIA4)
                Store(Zero, TI44)
                Store(Or(TI91, 0x80, ), TI91)
                Store(Local0, TIA4)
            }
            Method(_PS0) {
                Store(0x1, _PSC)
                Store(Local0, Local0)
            }
            Method(_PS1) {
                Store(0x0, _PSC)
                Store(Local0, Local0)
            }
            Method(_PS2) {
                Store(And(0xf0, TIA4, ), TIA4)
                Store(0x0, _PSC)
            }
            Method(_PS3) {
                Store(0x0, _PSC)
                Store(Local0, Local0)
            }
            Name(TIWK, Zero)
            Method(_PSW, 1) {
                If(LEqual(Arg0, One)) {
                    Store(One, TIWK)
                }
                Else {
                    Store(Zero, TIWK)
                }
            }
            Name(EX03, Zero)
            Name(_PSC, 0x0)
            PowerResource(PCR0, 0, 0) {
                Method(_STA) {
                    Return(_PSC)
                }
                Method(_ON_) {
                    Store(Local0, Local0)
                }
                Method(_OFF) {
                    Store(Local0, Local0)
                }
            }
            Method(TIEN, 1) {
                If(TIWK) {
                    If(LEqual(Arg0, One)) {
                        Store(TIA4, Local0)
                        Store(And(0xf0, TIA4, ), TIA4)
                        Store(TI04, Local1)
                        Store(Or(TI04, 0x1, ), TI04)
                        Store(0x03e1, TI44)
                        Store(0x3, TIID)
                        Store(TIDA, EX03)
                        Store(Or(EX03, 0x80, ), TIDA)
                        Store(Zero, TI44)
                        Store(Local1, TI04)
                        Store(Local0, TIA4)
                        Store(Or(TIA5, 0x1, ), TIA5)
                    }
                    If(LEqual(Arg0, Zero)) {
                        If(And(TIA5, 0x80, )) {
                            Store(TIA5, Local0)
                            Store(Local0, TIA5)
                            Notify(\_SB_.PCI0.CRD0, 0x0)
                        }
                    }
                }
            }
        }
        Device(CRD1) {
            Name(_ADR, 0x000a0001)
            Name(_PR0, Package(0x1) {
                PCR1,
            })
            Name(_PR1, Package(0x1) {
                PCR1,
            })
            Name(_PR2, Package(0x1) {
                PCR1,
            })
            OperationRegion(NPCC, PCI_Config, 0x0, 0xe0)
            Field(NPCC, DWordAcc, NoLock, Preserve) {
                Offset(0x4),
                TI04,	8,
                Offset(0xd),
                TI0D,	8,
                Offset(0x44),
                TI44,	16,
                Offset(0x80),
                TI80,	8,
                Offset(0x8c),
                TI8C,	8,
                TI8D,	8,
                TI8E,	8,
                TI8F,	8,
                Offset(0x91),
                TI91,	8,
                Offset(0xa4),
                TIA4,	8,
                TIA5,	8
            }
            OperationRegion(TIIO, SystemIO, 0x03e0, 0x2)
            Field(TIIO, ByteAcc, NoLock, Preserve) {
                TIID,	8,
                TIDA,	8
            }
            Method(_INI) {
                Store(TIA4, Local0)
                Store(And(0xf0, TIA4, ), TIA4)
                Store(Zero, TI44)
                Store(Or(TI91, 0x80, ), TI91)
                Store(Local0, TIA4)
            }
            Method(_PS0) {
                Store(Local0, Local0)
                Store(0x1, _PSC)
            }
            Method(_PS1) {
                Store(Local0, Local0)
                Store(0x0, _PSC)
            }
            Method(_PS2) {
                Store(And(0xf0, TIA4, ), TIA4)
                Store(0x0, _PSC)
            }
            Method(_PS3) {
                Store(Local0, Local0)
                Store(0x0, _PSC)
            }
            Name(_PSC, 0x0)
            PowerResource(PCR1, 0, 0) {
                Method(_STA) {
                    Return(_PSC)
                }
                Method(_ON_) {
                    Store(Local0, Local0)
                }
                Method(_OFF) {
                    Store(Local0, Local0)
                }
            }
            Name(TIWK, Zero)
            Method(_PSW, 1) {
                If(LEqual(Arg0, One)) {
                    Store(One, TIWK)
                }
                Else {
                    Store(Zero, TIWK)
                }
            }
            Name(EX03, Zero)
            Name(EX43, Zero)
            Method(TIEN, 1) {
                If(TIWK) {
                    If(LEqual(Arg0, One)) {
                        Store(TIA4, Local0)
                        Store(And(0xf0, TIA4, ), TIA4)
                        Store(TI04, Local1)
                        Store(Or(TI04, 0x1, ), TI04)
                        Store(0x03e1, TI44)
                        Store(0x43, TIID)
                        Store(TIDA, EX43)
                        Store(Or(EX43, 0x80, ), TIDA)
                        Store(Zero, TI44)
                        Store(Local1, TI04)
                        Store(Local0, TIA4)
                        Store(Or(TIA5, 0x1, ), TIA5)
                    }
                    If(LEqual(Arg0, Zero)) {
                        If(And(TIA5, 0x80, )) {
                            Store(TIA5, Local0)
                            Store(Local0, TIA5)
                            Notify(\_SB_.PCI0.CRD1, 0x0)
                        }
                    }
                }
            }
        }
        Device(LAN_) {
            Name(_ADR, 0x000c0000)
            Name(_PRW, Package(0x2) {
                0x9,
                0x4,
            })
        }
        Device(MDEM) {
            Name(_ADR, 0x00030000)
            Name(_PRW, Package(0x2) {
                0x9,
                0x3,
            })
        }
        Device(IDE_) {
            Name(_ADR, 0x000f0000)
            Name(UDMT, Package(0x5) {
                0x1e,
                0x2d,
                0x3c,
                0x5a,
                0x78,
            })
            Name(PIOT, Package(0x5) {
                0x78,
                0xb4,
                0xf0,
                0x017f,
                0x0258,
            })
            Name(PIOC, Package(0x5) {
                0x4,
                0x6,
                0x8,
                0xd,
                0x10,
            })
            Name(CBCT, Package(0x5) {
                0x31,
                0x33,
                0x1,
                0x3,
                0xa,
            })
            Name(DACT, Package(0x5) {
                0x3,
                0x3,
                0x4,
                0x5,
                0x8,
            })
            Name(DRCT, Package(0x5) {
                0x1,
                0x3,
                0x4,
                0x8,
                0x8,
            })
            Name(PXLM, Package(0x5) {
                0x2,
                0x1,
                0x0,
                0x0,
                0x0,
            })
            OperationRegion(PCI_, PCI_Config, 0x0, 0x60)
            Field(PCI_, ByteAcc, NoLock, Preserve) {
                Offset(0x9),
                ,	4,
                SCHE,	1,
                PCHE,	1,
                Offset(0xa),
                Offset(0xd),
                IDLT,	8,
                Offset(0x4b),
                U66E,	1,
                Offset(0x4c),
                Offset(0x53),
                CDFI,	1,
                CDUD,	1,
                Offset(0x54),
                PFTH,	8,
                SFTH,	8,
                PUDC,	8,
                SUDC,	8,
                PAST,	8,
                PCBT,	8,
                PTM0,	8,
                PTM1,	8,
                SAST,	8,
                SCBT,	8,
                STM0,	8,
                STM1,	8
            }
            Method(GTM_, 3) {
                Store(Buffer(0x14) { }, Local0)
                CreateDWordField(Local0, 0x0, PIO0)
                CreateDWordField(Local0, 0x4, DMA0)
                CreateDWordField(Local0, 0x8, PIO1)
                CreateDWordField(Local0, 0xc, DMA1)
                CreateDWordField(Local0, 0x10, FLAG)
                Store(Zero, PIO0)
                Store(Zero, DMA0)
                Store(Zero, PIO1)
                Store(Zero, DMA1)
                Store(Zero, FLAG)
                If(Arg0) {
                    ShiftRight(And(Arg0, 0x70, ), 0x4, Local1)
                    If(LEqual(Local1, Zero)) {
                        Store(0x8, Local1)
                    }
                    Add(And(Arg0, 0xf, Local2), Local1, Local1)
                    Store(Match(^PIOC, MLE, Local1, MTR, 0x0, 0x0), Local2)
                    Store(DerefOf(Index(^PIOT, Local2, )), PIO0)
                    If(LNot(LGreater(PIO0, 0xf0))) {
                        Or(FLAG, 0x2, FLAG)
                    }
                }
                If(And(Arg2, 0x8, )) {
                    Store(DerefOf(Index(^UDMT, And(Arg2, 0x7, ), )), DMA0)
                    Or(FLAG, 0x1, FLAG)
                }
                Else {
                    Store(PIO0, DMA0)
                }
                If(Arg1) {
                    ShiftRight(And(Arg1, 0x70, ), 0x4, Local1)
                    If(LEqual(Local1, Zero)) {
                        Store(0x8, Local1)
                    }
                    Add(And(Arg1, 0xf, Local2), Local1, Local1)
                    Store(Match(^PIOC, MLE, Local1, MTR, 0x0, 0x0), Local2)
                    Store(DerefOf(Index(^PIOT, Local2, )), PIO1)
                    If(LNot(LGreater(PIO1, 0xf0))) {
                        Or(FLAG, 0x8, FLAG)
                    }
                }
                If(And(Arg2, 0x80, )) {
                    Store(DerefOf(Index(^UDMT, ShiftRight(And(Arg2, 0x70, ), 0x4, ), )), DMA1)
                    Or(FLAG, 0x4, FLAG)
                }
                Else {
                    Store(PIO1, DMA1)
                }
                Or(FLAG, 0x10, FLAG)
                Return(Local0)
            }
            Method(STM_, 3) {
                Store(Buffer(0x6) {0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, Local7)
                CreateByteField(Local7, 0x0, TM0_)
                CreateByteField(Local7, 0x1, TM1_)
                CreateByteField(Local7, 0x2, UDC_)
                CreateByteField(Local7, 0x3, AST_)
                CreateByteField(Local7, 0x4, CBT_)
                CreateByteField(Local7, 0x5, U66_)
                CreateDWordField(Arg0, 0x0, PIO0)
                CreateDWordField(Arg0, 0x4, DMA0)
                CreateDWordField(Arg0, 0x8, PIO1)
                CreateDWordField(Arg0, 0xc, DMA1)
                CreateDWordField(Arg0, 0x10, FLAG)
                Store(FLAG, Local6)
                Store(Ones, Local4)
                If(LOr(DMA0, PIO0)) {
                    If(LAnd(DMA0, LNot(PIO0))) {
                        If(And(Local6, 0x1, )) {
                            Store(Match(^UDMT, MGE, DMA0, MTR, 0x0, 0x0), Local0)
                            Or(Local0, 0x8, UDC_)
                            If(LLess(Local0, 0x2)) {
                                Store(One, U66_)
                            }
                        }
                        Store(Match(^PIOT, MGE, DMA0, MTR, 0x0, 0x0), Local0)
                        Store(DerefOf(Index(^DACT, Local0, )), Local2)
                        Store(DerefOf(Index(^DRCT, Local0, )), Local3)
                        Add(Local3, ShiftLeft(Local2, 0x4, ), TM0_)
                        Store(Local0, Local4)
                    }
                    If(LAnd(LNot(DMA0), PIO0)) {
                        Store(Match(^PIOT, MGE, PIO0, MTR, 0x0, 0x0), Local0)
                        Store(DerefOf(Index(^DACT, Local0, )), Local2)
                        Store(DerefOf(Index(^DRCT, Local0, )), Local3)
                        Add(Local3, ShiftLeft(Local2, 0x4, ), TM0_)
                        Store(Local0, Local4)
                    }
                    If(LAnd(DMA0, PIO0)) {
                        If(And(Local6, 0x1, )) {
                            Store(Match(^UDMT, MGE, DMA0, MTR, 0x0, 0x0), Local0)
                            Or(Local0, 0x8, UDC_)
                            If(LLess(Local0, 0x2)) {
                                Store(One, U66_)
                            }
                        }
                        If(LNot(LLess(PIO0, DMA0))) {
                            Store(Match(^PIOT, MGE, PIO0, MTR, 0x0, 0x0), Local0)
                            Store(Local0, Local4)
                        }
                        Else {
                            Store(Match(^PIOT, MGE, DMA0, MTR, 0x0, 0x0), Local0)
                            Store(Local0, Local4)
                        }
                        Store(DerefOf(Index(^DACT, Local0, )), Local2)
                        Store(DerefOf(Index(^DRCT, Local0, )), Local3)
                        Add(Local3, ShiftLeft(Local2, 0x4, ), TM0_)
                    }
                }
                Store(Ones, Local5)
                If(LOr(DMA1, PIO1)) {
                    If(LAnd(DMA1, LNot(PIO1))) {
                        If(And(Local6, 0x4, )) {
                            Store(Match(^UDMT, MGE, DMA1, MTR, 0x0, 0x0), Local0)
                            Or(ShiftLeft(Or(Local0, 0x8, ), 0x4, ), UDC_, UDC_)
                            If(LLess(Local0, 0x2)) {
                                Store(One, U66_)
                            }
                        }
                        Store(Match(^PIOT, MGE, DMA1, MTR, 0x0, 0x0), Local0)
                        Store(DerefOf(Index(^DACT, Local0, )), Local2)
                        Store(DerefOf(Index(^DRCT, Local0, )), Local3)
                        Add(Local3, ShiftLeft(Local2, 0x4, ), TM1_)
                        Store(Local0, Local5)
                    }
                    If(LAnd(LNot(DMA1), PIO1)) {
                        Store(Match(^PIOT, MGE, PIO1, MTR, 0x0, 0x0), Local0)
                        Store(DerefOf(Index(^DACT, Local0, )), Local2)
                        Store(DerefOf(Index(^DRCT, Local0, )), Local3)
                        Add(Local3, ShiftLeft(Local2, 0x4, ), TM1_)
                        Store(Local0, Local5)
                    }
                    If(LAnd(DMA1, PIO1)) {
                        If(And(Local6, 0x4, )) {
                            Store(Match(^UDMT, MGE, DMA1, MTR, 0x0, 0x0), Local0)
                            Or(ShiftLeft(Or(Local0, 0x8, ), 0x4, ), UDC_, UDC_)
                            If(LLess(Local0, 0x2)) {
                                Store(One, U66_)
                            }
                        }
                        If(LNot(LLess(PIO1, DMA1))) {
                            Store(Match(^PIOT, MGE, PIO1, MTR, 0x0, 0x0), Local0)
                            Store(Local0, Local5)
                        }
                        Else {
                            Store(Match(^PIOT, MGE, DMA1, MTR, 0x0, 0x0), Local0)
                            Store(Local0, Local5)
                        }
                        Store(DerefOf(Index(^DACT, Local0, )), Local2)
                        Store(DerefOf(Index(^DRCT, Local0, )), Local3)
                        Add(Local3, ShiftLeft(Local2, 0x4, ), TM1_)
                    }
                }
                If(LEqual(Local4, Ones)) {
                    If(LEqual(Local5, Ones)) {
                        Store(Zero, CBT_)
                    }
                    Else {
                        Store(DerefOf(Index(^CBCT, Local5, )), CBT_)
                    }
                }
                Else {
                    If(LEqual(Local5, Ones)) {
                        Store(DerefOf(Index(^CBCT, Local4, )), CBT_)
                    }
                    Else {
                        If(LNot(LLess(Local4, Local5))) {
                            Store(DerefOf(Index(^CBCT, Local4, )), CBT_)
                        }
                        Else {
                            Store(DerefOf(Index(^CBCT, Local5, )), CBT_)
                        }
                    }
                }
                Store(0x2, AST_)
                Return(Local7)
            }
            Method(GTF0, 3) {
                Store(Buffer(0x7) {0x3, 0x0, 0x0, 0x0, 0x0, 0xa0, 0xef }, Local7)
                CreateByteField(Local7, 0x1, MODE)
                If(And(Arg1, 0x8, )) {
                    And(Arg1, 0x7, Local0)
                    Subtract(0x4, Local0, MODE)
                    Or(MODE, 0x40, MODE)
                }
                Else {
                    And(Arg2, 0xf, Local0)
                    Store(Match(^DRCT, MEQ, Local0, MTR, 0x0, 0x0), Local1)
                    Store(DerefOf(Index(^PXLM, Local1, )), MODE)
                    Or(MODE, 0x20, MODE)
                }
                Concatenate(Local7, Local7, Local6)
                And(Arg2, 0xf, Local0)
                Store(Match(^DRCT, MEQ, Local0, MTR, 0x0, 0x0), Local1)
                Subtract(0x4, Local1, MODE)
                Or(MODE, 0x8, MODE)
                Concatenate(Local6, Local7, Local5)
                Return(Local5)
            }
            Method(GTF1, 3) {
                Store(Buffer(0x7) {0x3, 0x0, 0x0, 0x0, 0x0, 0xb0, 0xef }, Local7)
                CreateByteField(Local7, 0x1, MODE)
                If(And(Arg1, 0x80, )) {
                    ShiftRight(And(Arg1, 0x70, ), 0x4, Local0)
                    Subtract(0x4, Local0, MODE)
                    Or(MODE, 0x40, MODE)
                }
                Else {
                    And(Arg2, 0xf, Local0)
                    Store(Match(^DRCT, MEQ, Local0, MTR, 0x0, 0x0), Local1)
                    Store(DerefOf(Index(^PXLM, Local1, )), MODE)
                    Or(MODE, 0x20, MODE)
                }
                Concatenate(Local7, Local7, Local6)
                And(Arg2, 0xf, Local0)
                Store(Match(^DRCT, MEQ, Local0, MTR, 0x0, 0x0), Local1)
                Subtract(0x4, Local1, MODE)
                Or(MODE, 0x8, MODE)
                Concatenate(Local6, Local7, Local5)
                Return(Local5)
            }
            Device(PRIM) {
                Name(_ADR, 0x0)
                Method(_GTM) {
                    Store("GTM - Primary Controller", Debug)
                    Store(^^GTM_(^^PTM0, ^^PTM1, ^^PUDC), Local0)
                    Return(Local0)
                }
                Method(_STM, 3) {
                    Store("STM - Primary Controller", Debug)
                    Store(^^STM_(Arg0, Arg1, Arg2), Local0)
                    CreateByteField(Local0, 0x0, TM0_)
                    CreateByteField(Local0, 0x1, TM1_)
                    CreateByteField(Local0, 0x2, UDC_)
                    CreateByteField(Local0, 0x3, AST_)
                    CreateByteField(Local0, 0x4, CBT_)
                    CreateByteField(Local0, 0x5, U66_)
                    Store(TM0_, ^^PTM0)
                    Store(TM1_, ^^PTM1)
                    Store(UDC_, ^^PUDC)
                    Store(CBT_, ^^PCBT)
                    If(U66_) {
                        Store(U66_, ^^U66E)
                    }
                }
                Device(MAST) {
                    Name(_ADR, 0x0)
                    Method(_GTF) {
                        Store("GTF - Primary Master", Debug)
                        Store(^^^GTF0(^^^PCHE, ^^^PUDC, ^^^PTM0), Local0)
                        Return(Local0)
                    }
                }
                Device(SLAV) {
                    Name(_ADR, 0x1)
                    Method(_GTF) {
                        Store("GTF - Primary Slave", Debug)
                        Store(^^^GTF1(^^^PCHE, ^^^PUDC, ^^^PTM1), Local0)
                        Return(Local0)
                    }
                }
            }
            Method(_PS0) {
                If(LEqual(_PSC, 0x3)) {
                    Store(0x0, _PSC)
                }
            }
            Method(_PS3) {
                If(LEqual(_PSC, 0x0)) {
                }
                Store(0x3, _PSC)
            }
            Name(_PSC, 0x0)
        }
        Device(VGA_) {
            Name(_ADR, 0x00090000)
            Name(SWIT, 0x1)
            Name(CRTA, 0x1)
            Name(LCDA, 0x1)
            Name(TOGF, 0x2)
            Method(_INI) {
                If(LEqual(Or(\_SB_.PCI0.ISA_.VGAL, \_SB_.PCI0.ISA_.VGAH, ), 0x0)) {
                    Store(0x1, TOGF)
                }
                If(\_SB_.PCI0.ISA_.VGAL) {
                    Store(0x2, TOGF)
                }
                If(\_SB_.PCI0.ISA_.VGAH) {
                    Store(0x0, TOGF)
                }
            }
            Method(_DOS, 1) {
                Store("VGA --_DOS Arg0", Debug)
                Store(Arg0, SWIT)
            }
            Method(_DOD) {
                Store("VGA --_DOD", Debug)
                Return(Package(0x2) {
                    0x00010100,
                    0x00010110,
                })
            }
            Device(CRT_) {
                Name(_ADR, 0x0100)
                Method(_DCS) {
                    Store("CRT --_DCS", Debug)
                    If(CRTA) {
                        Return(0x1f)
                    }
                    Else {
                        Return(0x1d)
                    }
                }
                Method(_DGS) {
                    Store("CRT --_DGS", Debug)
                    Store(CRTA, Local0)
                    Store(Local0, Debug)
                    If(CRTA) {
                        Return(0x1)
                    }
                    Else {
                        Return(0x0)
                    }
                }
                Method(_DSS, 1) {
                    Store("CRT --_DSS", Debug)
                    Store(Arg0, Debug)
                }
            }
            Device(LCD_) {
                Name(_ADR, 0x0110)
                Method(_DCS) {
                    Store("LCD --_DCS", Debug)
                    If(LCDA) {
                        Return(0x1f)
                    }
                    Else {
                        Return(0x1d)
                    }
                }
                Method(_DGS) {
                    Store("LCD --_DGS", Debug)
                    Store(LCDA, Local0)
                    Store(Local0, Debug)
                    If(LCDA) {
                        Return(0x1)
                    }
                    Else {
                        Return(0x0)
                    }
                }
                Method(_DSS, 1) {
                    Store("LCD --_DSS", Debug)
                    Store(Arg0, Debug)
                }
            }
        }
    }
    Device(SLPB) {
        Name(_HID, 0x0e0cd041)
    }
    Device(ACAD) {
        Name(_HID, "ACPI0003")
        Name(_PCL, Package(0x1) {
            \_SB_,
        })
        Name(ACP_, Ones)
        Method(_PSR) {
            If(\_SB_.PCI0.ISA_.EC0_.ECOK) {
                And(0x1, \_SB_.PCI0.ISA_.EC0_.BATF, Local0)
                Return(Local0)
            }
            Return(0x1)
        }
        Method(_STA) {
            Return(0xf)
        }
        Method(CHAC, 1) {
            Store(LGreater(And(Arg0, 0xf0, ), 0x80), Local0)
            If(LNot(LEqual(Local0, ACP_))) {
                Store(Local0, ACP_)
                Notify(\_SB_.ACAD, 0x0)
                Return(Ones)
            }
            Else {
                Return(Zero)
            }
        }
        Method(FLPA) {
            Not(ACP_, ACP_)
            Notify(\_SB_.ACAD, 0x0)
        }
    }
    Method(VTOB, 1) {
        Store(0x1, Local0)
        ShiftLeft(Local0, Arg0, Local0)
        Return(Local0)
    }
    Method(BTOV, 1) {
        ShiftRight(Arg0, 0x1, Local0)
        Store(0x0, Local1)
        While(Local0) {
            Increment(Local1)
            ShiftRight(Local0, 0x1, Local0)
        }
        Return(Local1)
    }
    Method(MKWD, 2) {
        If(And(Arg1, 0x80, )) {
            Store(0xffff0000, Local0)
        }
        Else {
            Store(Zero, Local0)
        }
        Or(Local0, Arg0, Local0)
        Or(Local0, ShiftLeft(Arg1, 0x8, ), Local0)
        Return(Local0)
    }
    Method(GBFE, 3) {
        CreateByteField(Arg0, Arg1, TIDX)
        Store(TIDX, Arg2)
    }
    Method(PBFE, 3) {
        CreateByteField(Arg0, Arg1, TIDX)
        Store(Arg2, TIDX)
    }
    Method(ITOS, 1) {
        Store(Buffer(0x9) {0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0 }, Local0)
        Store(Buffer(0x11) {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x0 }, Local7)
        Store(0x8, Local1)
        Store(0x0, Local2)
        Store(0x0, Local3)
        While(Local1) {
            Decrement(Local1)
            And(ShiftRight(Arg0, ShiftLeft(Local1, 0x2, ), ), 0xf, Local4)
            If(Local4) {
                Store(Ones, Local3)
            }
            If(Local3) {
                GBFE(Local7, Local4, RefOf(Local5))
                PBFE(Local0, Local2, Local5)
                Increment(Local2)
            }
        }
        Return(Local0)
    }
    Mutex(MUT1, 0)
    Name(SEL0, 0xf0)
    Device(BAT1) {
        Name(_HID, 0x0a0cd041)
        Name(_UID, 0x1)
        Name(_PCL, Package(0x1) {
            \_SB_,
        })
        Name(PBIF, Package(0xd) {
            0x1,
            0x5,
            0x5,
            0x1,
            0x5,
            0x0190,
            0x32,
            0x40,
            0x40,
            "BAT1",
            " ",
            " ",
            " ",
        })
        Name(PBST, Package(0x4) {
            0x0,
            0x5,
            0x5,
            0x2710,
        })
        Name(UBIF, 0x01e9)
        Name(BP__, 0x1)
        Name(TMPB, 0x0)
        Name(TBAT, 0x0)
        Method(_STA) {
            If(\_SB_.PCI0.ISA_.EC0_.ECOK) {
                Acquire(\_SB_.PCI0.ISA_.EC0_.MUT0, 0x5000)
                Store(\_SB_.PCI0.ISA_.EC0_.BANK, TMPB)
                Store(0x4, \_SB_.PCI0.ISA_.EC0_.BANK)
                Store(\_SB_.PCI0.ISA_.EC0_.DBAT, TBAT)
                Store(TMPB, \_SB_.PCI0.ISA_.EC0_.BANK)
                And(TBAT, 0x1, Local0)
                If(Local0) {
                    Store(0x1, BP__)
                }
                Else {
                    Store(0x0, BP__)
                }
                Release(\_SB_.PCI0.ISA_.EC0_.MUT0)
            }
            If(BP__) {
                Return(0x1f)
            }
            Else {
                Return(0xf)
            }
        }
        Method(_BIF) {
            If(\_SB_.PCI0.ISA_.EC0_.ECOK) {
                Acquire(\_SB_.PCI0.ISA_.EC0_.MUT0, 0x5000)
                If(BP__) {
                    UPBI()
                }
                Else {
                    IVBI()
                }
                Release(\_SB_.PCI0.ISA_.EC0_.MUT0)
                Store(0x01e9, UBIF)
            }
            Return(PBIF)
        }
        Method(_BST) {
            If(\_SB_.PCI0.ISA_.EC0_.ECOK) {
                Acquire(\_SB_.PCI0.ISA_.EC0_.MUT0, 0x5000)
                Store(\_SB_.PCI0.ISA_.EC0_.BANK, TMPB)
                Store(0x4, \_SB_.PCI0.ISA_.EC0_.BANK)
                Store(\_SB_.PCI0.ISA_.EC0_.DBAT, TBAT)
                Store(TMPB, \_SB_.PCI0.ISA_.EC0_.BANK)
                If(And(0xc0, TBAT, )) {
                    Or(\_SB_.PCI0.ISA_.EC0_.BATF, 0x1, \_SB_.PCI0.ISA_.EC0_.BATF)
                }
                Else {
                    And(\_SB_.PCI0.ISA_.EC0_.BATF, 0xfffe, \_SB_.PCI0.ISA_.EC0_.BATF)
                }
                And(TBAT, 0x1, Local0)
                If(Local0) {
                    UPBS()
                }
                Else {
                    IVBS()
                }
                Release(\_SB_.PCI0.ISA_.EC0_.MUT0)
            }
            Return(PBST)
        }
        Method(UPBI) {
            Store(Zero, Local0)
            Store(0xc, Local1)
            Store(Buffer(0xd) {0x0, 0x18, 0x10, 0x0, 0x19, 0x0, 0x0, 0x0, 0x0, 0x21, 0x0, 0x22, 0x20 }, Local2)
            While(LGreater(Local1, 0x8)) {
                If(LNot(And(UBIF, VTOB(Local1), ))) {
                    GBFE(Local2, Local1, RefOf(Local3))
                    If(Local3) {
                        If(LNot(\_SB_.PCI0.ISA_.EC0_.SMRD(0xb, 0x16, Local3, RefOf(Local4)))) {
                            GBFE(Local4, 0x20, RefOf(Local5))
                            PBFE(Local4, Local5, 0x20)
                            Increment(Local5)
                            PBFE(Local4, Local5, 0x0)
                            Store(Local4, Index(PBIF, Local1, ))
                            Or(UBIF, VTOB(Local1), UBIF)
                            Store(Ones, Local0)
                        }
                    }
                }
                Decrement(Local1)
            }
            While(LGreater(Local1, 0x0)) {
                If(LNot(And(UBIF, VTOB(Local1), ))) {
                    GBFE(Local2, Local1, RefOf(Local3))
                    If(Local3) {
                        If(LNot(\_SB_.PCI0.ISA_.EC0_.SMRD(0x9, 0x16, Local3, RefOf(Local5)))) {
                            Store(Local5, Index(PBIF, Local1, ))
                            Or(UBIF, VTOB(Local1), UBIF)
                            Store(Ones, Local0)
                        }
                    }
                }
                Decrement(Local1)
            }
            Store(0xa, Local1)
            If(LNot(And(UBIF, VTOB(Local1), ))) {
                If(LNot(\_SB_.PCI0.ISA_.EC0_.SMRD(0x9, 0x16, 0x1c, RefOf(Local5)))) {
                    Store(ITOS(ToBCD(Local5, )), Index(PBIF, Local1, ))
                    Or(UBIF, VTOB(Local1), UBIF)
                    Store(Ones, Local0)
                }
            }
            Return(Local0)
        }
        Method(UPBS) {
            Store(Zero, Local0)
            Store(\_SB_.PCI0.ISA_.EC0_.BANK, Local1)
            Store(0x6, \_SB_.PCI0.ISA_.EC0_.BANK)
            Store(\_SB_.PCI0.ISA_.EC0_.MBCT, Local2)
            If(And(Local2, 0x8000, )) {
                Or(Local2, 0xffff0000, Local2)
                Add(Not(Local2, ), 0x1, Local2)
            }
            Store(\_SB_.PCI0.ISA_.EC0_.MBVT, Local3)
            Store(0x4, \_SB_.PCI0.ISA_.EC0_.BANK)
            Store(\_SB_.PCI0.ISA_.EC0_.Z00T, Local5)
            Store(Local1, \_SB_.PCI0.ISA_.EC0_.BANK)
            Multiply(Local3, 0x14, Local3)
            Divide(Local3, 0x40, Local4, Local3)
            If(LNot(LEqual(Local2, DerefOf(Index(PBST, 0x1, ))))) {
                Store(Local2, Index(PBST, 0x1, ))
                Store(Ones, Local0)
            }
            If(LNot(LEqual(Local3, DerefOf(Index(PBST, 0x3, ))))) {
                Store(Local3, Index(PBST, 0x3, ))
                Store(Ones, Local0)
            }
            If(LNot(LEqual(Local5, DerefOf(Index(PBST, 0x2, ))))) {
                Store(Local5, Index(PBST, 0x2, ))
                Store(Ones, Local0)
            }
            Store(0x0, Local4)
            Store(\_SB_.PCI0.ISA_.EC0_.BANK, TMPB)
            Store(0x4, \_SB_.PCI0.ISA_.EC0_.BANK)
            Store(\_SB_.PCI0.ISA_.EC0_.DBAT, TBAT)
            Store(TMPB, \_SB_.PCI0.ISA_.EC0_.BANK)
            If(And(TBAT, 0x0c00, )) {
                Or(0x2, Local4, Local4)
            }
            Else {
                Or(0x1, Local4, Local4)
            }
            If(LNot(LEqual(Local4, DerefOf(Index(PBST, 0x0, ))))) {
                Store(Local4, Index(PBST, 0x0, ))
                Store(Ones, Local0)
            }
            Return(Local0)
        }
        Method(IVBI) {
            Store(0x01e9, UBIF)
            Store(0x5, Index(PBIF, 0x1, ))
            Store(0x5, Index(PBIF, 0x2, ))
            Store(0x5, Index(PBIF, 0x4, ))
            Store("Bad", Index(PBIF, 0x9, ))
            Store("Bad", Index(PBIF, 0xa, ))
            Store("Bad", Index(PBIF, 0xb, ))
            Store("Bad", Index(PBIF, 0xc, ))
        }
        Method(IVBS) {
            Store(0x0, Index(PBST, 0x0, ))
            Store(0x5, Index(PBST, 0x1, ))
            Store(0x5, Index(PBST, 0x2, ))
            Store(0x2710, Index(PBST, 0x3, ))
        }
        Method(CHBP, 1) {
            Store(Zero, Local0)
            Store(VTOB(Subtract(_UID, 0x1, )), Local1)
            Or(ShiftLeft(Local1, 0xc, ), 0x0fff, Local2)
            Store(Zero, Local3)
            If(And(Arg0, Local1, )) {
                If(BP__) {
                    UPBS()
                }
                Else {
                    Sleep(0x03e8)
                    \_SB_.PCI0.ISA_.EC0_.SMWR(0x8, 0x14, 0x1, Local2)
                    \_SB_.PCI0.ISA_.EC0_.SMRD(0x9, 0x14, 0x1, RefOf(Local3))
                    If(LEqual(Local2, Or(Local3, 0x0fff, ))) {
                        UPBI()
                    }
                    UPBS()
                    Store(0x1, BP__)
                    Store(0x01e9, UBIF)
                }
            }
            Else {
                If(BP__) {
                    Store(0x0, BP__)
                    IVBI()
                    IVBS()
                    Or(0x4, Local0, Local0)
                }
            }
        }
    }
    Device(LID_) {
        Name(_HID, 0x0d0cd041)
        Method(_LID) {
            Return(\_SB_.PCI0.PM__.LIDS)
        }
        Name(_PRW, Package(0x2) {
            0x5,
            0x3,
        })
    }
}
Scope(_SI_) {
    Method(_SST, 1) {
    }
}
Name(_S0_, Package(0x2) {
    0x0,
    0x0,
})
Name(_S3_, Package(0x2) {
    0x3,
    0x3,
})
Name(_S4_, Package(0x2) {
    0x4,
    0x4,
})
Name(_S5_, Package(0x2) {
    0x5,
    0x5,
})
Method(_PTS, 1) {
    If(LEqual(Arg0, 0x0)) {
        Store("===== Prepare to Sleep S0 =====", Debug)
    }
    If(LEqual(Arg0, 0x1)) {
        Store("===== Prepare to Sleep S1 =====", Debug)
    }
    If(LEqual(Arg0, 0x2)) {
        Store("===== Prepare to Sleep S2 =====", Debug)
    }
    If(LEqual(Arg0, 0x3)) {
        Store("===== Prepare to Sleep S3 =====", Debug)
        Store(0x85, \_SB_.PCI0.ISA_.BCMD)
        Store(0x0, \_SB_.PCI0.ISA_.SMIC)
        Store(0x81, \_SB_.PCI0.ISA_.BCMD)
        Store(0x0, \_SB_.PCI0.ISA_.SMIC)
        Store(0x0, \_SB_.PCI0.PM__.PPCM)
        Store(0x0, \_SB_.PCI0.PM__.PVGA)
    }
    If(LEqual(Arg0, 0x4)) {
        Store("===== Prepare to Sleep S4 =====", Debug)
        Store(0x85, \_SB_.PCI0.ISA_.BCMD)
        Store(0x0, \_SB_.PCI0.ISA_.SMIC)
    }
    If(LEqual(Arg0, 0x5)) {
        Store("===== Prepare to Sleep S5 =====", Debug)
    }
}
Method(_WAK, 1) {
    Store("===== WAK =====", Debug)
    Notify(\_SB_.BAT1, 0x80)
    If(LEqual(Arg0, 0x1)) {
        Store("===== WAK from S1 =====", Debug)
    }
    If(LEqual(Arg0, 0x3)) {
        Store(0x1, \_SB_.PCI0.PM__.PPCM)
        Store(0x1, \_SB_.PCI0.PM__.PVGA)
        Store("===== WAK from S3 =====", Debug)
        If(LEqual(SizeOf(\_OS_), 0x27)) {
            Notify(\_SB_.SLPB, 0x2)
        }
        Else {
            If(\_SB_.PCI0.ISA_.PMES) {
                Store(0x1, \_SB_.PCI0.ISA_.PMES)
                Notify(\_SB_.SLPB, 0x2)
            }
        }
    }
    If(LEqual(Arg0, 0x4)) {
        Store("===== WAK from S4 =====", Debug)
        Notify(\_SB_.SLPB, 0x2)
    }
}
Name(SSTF, 0x0)

}
/*
BOOT: Length=40, Revision=1, Checksum=202,
	OEMID=PTLTD, OEM Table ID=$SBFTBL$, OEM Revision=0x6040005,
	Creator ID= LTP, Creator Revision=0x1
 */

----Next_Part(Mon_Dec_31_08:54:20_2001_393)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="pir-fiva.log"

$PIR table at 0x28139f20 version 1.0
PCI interrupt router at 0:3.8 vendor 0x10b9 device 0x1533
PCI-only interrupts [                                     ]
entry bus slot device
 00:  00   00    00  INTA  00  [            6       10 11       14   ]
                     INTB  00  [            6       10 11       14   ]
                     INTC  00  [            6       10 11       14   ]
                     INTD  00  [            6       10 11       14   ]
 01:  00   00    03  INTA  07  [            6       10 11       14   ]
                     INTB  00  [            6       10 11       14   ]
                     INTC  00  [            6       10 11       14   ]
                     INTD  00  [            6       10 11       14   ]
 02:  00   00    04  INTA  08  [            6       10 11       14   ]
                     INTB  00  [            6       10 11       14   ]
                     INTC  00  [            6       10 11       14   ]
                     INTD  00  [            6       10 11       14   ]
 03:  00   00    09  INTA  01  [      3 4 5 6 7   9 10 11 12    14 15]
                     INTB  00  [      3 4 5 6 7   9 10 11 12    14 15]
                     INTC  00  [      3 4 5 6 7   9 10 11 12    14 15]
                     INTD  00  [      3 4 5 6 7   9 10 11 12    14 15]
 04:  00   00    10  INTA  02  [                       11            ]
                     INTB  03  [                       11            ]
                     INTC  00  [      3 4 5 6 7   9 10 11 12    14 15]
                     INTD  00  [      3 4 5 6 7   9 10 11 12    14 15]
 05:  00   00    11  INTA  04  [                    10               ]
                     INTB  00  [      3 4 5 6 7   9 10 11 12    14 15]
                     INTC  00  [      3 4 5 6 7   9 10 11 12    14 15]
                     INTD  00  [      3 4 5 6 7   9 10 11 12    14 15]
 06:  00   00    12  INTA  05  [            6       10 11       14   ]
                     INTB  00  [            6       10 11       14   ]
                     INTC  00  [            6       10 11       14   ]
                     INTD  00  [            6       10 11       14   ]
 07:  00   05    13  INTA  01  [            6       10 11       14   ]
                     INTB  02  [            6       10 11       14   ]
                     INTC  03  [            6       10 11       14   ]
                     INTD  04  [            6       10 11       14   ]
 08:  00   00    15  INTA  00  [            6       10 11       14   ]
                     INTB  00  [            6       10 11       14   ]
                     INTC  00  [            6       10 11       14   ]
                     INTD  00  [            6       10 11       14   ]
 09:  00   00    20  INTA  59  [            6       10 11       14   ]
                     INTB  00  [            6       10 11       14   ]
                     INTC  00  [            6       10 11       14   ]
                     INTD  00  [            6       10 11       14   ]

----Next_Part(Mon_Dec_31_08:54:20_2001_393)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename=Ppci

Index: dev/acpica/acpi_pcib.c
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/sys/dev/acpica/acpi_pcib.c,v
retrieving revision 1.17
diff -u -r1.17 acpi_pcib.c
--- dev/acpica/acpi_pcib.c	2001/10/07 18:25:43	1.17
+++ dev/acpica/acpi_pcib.c	2001/12/31 15:19:43
@@ -431,12 +431,15 @@
      * Note that we could also check the 'decoding' bit in _STA, but can't depend on
      * it since it's not part of the spec.
      *
+     * some BIOSes lie to us.  They tell us that an interrupt is routed to
+     * this pin, but careful crosschecks of the $PIR shows that the interrupt
+     * is impossible.
+     *
      * XXX check ASL examples to see if this is an acceptable set of tests
      */
     if ((crsres->Data.Irq.NumberOfInterrupts == 1) && (crsres->Data.Irq.Interrupts[0] != 0)) {
 	device_printf(sc->ap_dev, "device is routed to IRQ %d\n", crsres->Data.Irq.Interrupts[0]);
 	interrupt = crsres->Data.Irq.Interrupts[0];
-	goto out;
     }
     
     /* 
@@ -479,6 +482,18 @@
     for (i = 0; i < prsres->Data.Irq.NumberOfInterrupts; i++)
 	printf("  %d", prsres->Data.Irq.Interrupts[i]);
     printf("\n");
+    /*
+     * We've set interrupt above if we think there's an interrupt already
+     * routed.  If we find it in the list, then we're done and can bail
+     * out at this point.  I don't know if we should put this before or
+     * after the above printf XXX.
+     */
+    for (i = 0; i < prsres->Data.Irq.NumberOfInterrupts; i++)
+	if (interrupt == prsres->Data.Irq.Interrupts[i])
+	    goto out;
+    if (interrupt != 255)
+        device_printf(sc->ap_dev, "The BIOS lied.  Routed IRQ %d not valid.\n",
+	    interrupt);
 
     if (crsbuf.Pointer != NULL)			/* should never happen */
 	AcpiOsFree(crsbuf.Pointer);
Index: dev/ata/ata-all.c
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/sys/dev/ata/ata-all.c,v
retrieving revision 1.124
diff -u -r1.124 ata-all.c
--- dev/ata/ata-all.c	2001/11/13 11:33:23	1.124
+++ dev/ata/ata-all.c	2001/12/31 15:19:44
@@ -218,7 +218,7 @@
     if (!dev)
 	return ENXIO;
     scp = device_get_softc(dev);
-    if (!scp || !scp->devices)
+    if (!scp)
 	return ENXIO;
 
     /* make sure channel is not busy SOS XXX */
Index: dev/pci/pci.c
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/sys/dev/pci/pci.c,v
retrieving revision 1.182
diff -u -r1.182 pci.c
--- dev/pci/pci.c	2001/10/25 04:44:50	1.182
+++ dev/pci/pci.c	2001/12/31 15:19:50
@@ -747,7 +747,18 @@
 		    && q->type == PCI_QUIRK_MAP_REG)
 			pci_add_map(pcib, b, s, f, q->arg1, rl);
 	}
-
+	/*
+	 * If there's an intpin, then we have to route the interrupt.  We
+	 * do this here so that the MD code can correct bogus values, for
+	 * some definition of bogus.  The MD code is assumed to know when
+	 * to do nothing.  We do not check to see if the intline is any
+	 * value for this because this is where we'll actually route the
+	 * interrupt.  The MD code is free to correct bad values, detect bad
+	 * configurations, etc, but does not have to do so.
+	 */
+device_printf(dev, "pin is %d\n", cfg->intpin);
+	if (cfg->intpin > 0)
+		cfg->intline = PCIB_ROUTE_INTERRUPT(pcib, dev, cfg->intpin);
 	if (cfg->intpin > 0 && cfg->intline != 255) {
 #ifdef __ia64__
 		/*
@@ -755,9 +766,6 @@
 		 * I/O SAPIC interrupt numbers (the BIOS leaves legacy
 		 * PIC interrupt numbers in the intline registers).
 		 */
-		cfg->intline = PCIB_ROUTE_INTERRUPT(pcib,
-						    dev,
-						    cfg->intpin);
 #endif
 		resource_list_add(rl, SYS_RES_IRQ, 0,
 				  cfg->intline, cfg->intline, 1);
Index: i386/include/pci_cfgreg.h
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/sys/i386/include/pci_cfgreg.h,v
retrieving revision 1.5
diff -u -r1.5 pci_cfgreg.h
--- i386/include/pci_cfgreg.h	2001/08/21 03:10:52	1.5
+++ i386/include/pci_cfgreg.h	2001/12/31 15:19:58
@@ -51,5 +51,6 @@
 extern u_int32_t	pci_cfgregread(int bus, int slot, int func, int reg, int bytes);
 extern void		pci_cfgregwrite(int bus, int slot, int func, int reg, u_int32_t data, int bytes);
 extern int		pci_cfgintr(int bus, int device, int pin);
+extern int		pci_cfgintr_illegal(int bus, int device, int pin, int intline);
 extern int		pci_kill_pcibios(void);
 extern int		pci_pcibios_active(void);
Index: i386/pci/pci_bus.c
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/sys/i386/pci/pci_bus.c,v
retrieving revision 1.76
diff -u -r1.76 pci_bus.c
--- i386/pci/pci_bus.c	2001/08/21 03:10:53	1.76
+++ i386/pci/pci_bus.c	2001/12/31 15:19:59
@@ -73,7 +73,13 @@
 static int
 nexus_pcib_route_interrupt(device_t pcib, device_t dev, int pin)
 {
-	return(pci_cfgintr(pci_get_bus(dev), pci_get_slot(dev), pin));
+	int bus = pci_get_bus(dev);
+	int slot = pci_get_slot(dev);
+	int intline = pci_get_irq(dev);
+
+	if (pci_cfgintr_illegal(bus, slot, pin, intline))
+		return (pci_cfgintr(bus, slot, pin));
+	return (intline);
 }
 
 static devclass_t	pcib_devclass;
Index: i386/pci/pci_cfgreg.c
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/sys/i386/pci/pci_cfgreg.c,v
retrieving revision 1.81
diff -u -r1.81 pci_cfgreg.c
--- i386/pci/pci_cfgreg.c	2001/11/26 21:25:03	1.81
+++ i386/pci/pci_cfgreg.c	2001/12/31 15:19:59
@@ -168,6 +168,7 @@
 u_int32_t
 pci_cfgregread(int bus, int slot, int func, int reg, int bytes)
 {
+	int	pin, line;
 #ifdef APIC_IO
     /*
      * If we are using the APIC, the contents of the intline register will probably
@@ -176,10 +177,6 @@
      * attempts to read them and translate to our private vector numbers.
      */
     if ((reg == PCIR_INTLINE) && (bytes == 1)) {
-	int	pin, line;
-
-	pin = pci_do_cfgregread(bus, slot, func, PCIR_INTPIN, 1);
-	line = pci_do_cfgregread(bus, slot, func, PCIR_INTLINE, 1);
 
 	if (pin != 0) {
 	    int airq;
@@ -207,6 +204,30 @@
 	}
 	return(line);
     }
+#else
+    /*
+     * Some BIOSes are braindead.  They fail to follow the pci standard that
+     * states that unrouted interrupts should be 255.  instead, they use things
+     * like 0, 128 or other random, bogus junk.  So we use the knowledge that
+     * really the only valid IRQ numbers are 1..15 (which isn't quite true,
+     * but is true enough to not cause problems).  Since we are the else
+     * branch of the apic ifdef, we know we don't have to worry about that case
+     * in this code.  See the warning for the apic case, because we do the same
+     * thing wrt write back.
+     *
+     * Sadly, there are also BIOSes out there that write a valid looking
+     * IRQ into the INTLINE register while the PIR table says that the
+     * register written isn't possible at all.  We handle that case in a post
+     * processing pass.
+     */
+    if ((reg == PCIR_INTLINE) && (bytes == 1)) {
+	pin = pci_do_cfgregread(bus, slot, func, PCIR_INTPIN, 1);
+	line = pci_do_cfgregread(bus, slot, func, PCIR_INTLINE, 1);
+	if (pin != 0) {
+	     if (line == 0 || line >= 16)
+		return (255);
+	}
+    }
 #endif /* APIC_IO */
     return(pci_do_cfgregread(bus, slot, func, reg, bytes));
 }
@@ -222,18 +243,58 @@
 	   pcireg_cfgwrite(bus, slot, func, reg, data, bytes));
 }
 
+static struct PIR_entry *
+pci_cfgfind_pir_entry(int bus, int device)
+{
+    int i;
+    struct PIR_entry	*pe;
+
+    /*
+     * Scan the entry table for a contender
+     */
+    for (i = 0, pe = &pci_route_table->pt_entry[0]; i < pci_route_count; i++, pe++) {
+	if (bus == pe->pe_bus && device == pe->pe_device)
+	    return (pe);
+    }
+    return (NULL);
+}
+
+/*
+ * check to see if the interrupt associated with this device is illegal.  For
+ * the purposes of this function, we consider 255 illegal because we'll do the
+ * sane thing and route it since we route all illegal interrupts.
+ */
+int
+pci_cfgintr_illegal(int bus, int device, int pin, int intline)
+{
+    struct PIR_entry	*pe;
+
+printf("%d:%d:%d for irq %d\n", bus, device, pin, intline);
+    if (intline == 255)
+	return (1);
+    pe = pci_cfgfind_pir_entry(bus, device);
+    if (pe == NULL)
+	return (0);
+printf("irqs 0x%x\n", pe->pe_intpin[pin - 1].irqs);
+    if ((1 << intline) & pe->pe_intpin[pin - 1].irqs)
+        return (0);
+    return (1);
+}
+
 /*
  * Route a PCI interrupt
  *
  * XXX we don't do anything "right" with the function number in the PIR table
  *     (because the consumer isn't currently passing it in).  We don't care
- *     anyway, due to the way PCI interrupts are assigned.
+ *     anyway, due to the way PCI interrupts are assigned.  They are assigned
+ *     based on the pin, which the function's cfg space should have set
+ *     correctly.
  */
 int
 pci_cfgintr(int bus, int device, int pin)
 {
     struct PIR_entry	*pe;
-    int			i, irq;
+    int			irq;
     struct bios_regs	args;
     u_int16_t		v;
     int already = 0;
@@ -248,45 +309,42 @@
     if ((bus < 0) || (bus > 255) || (device < 0) || (device > 255) ||
       (pin < 1) || (pin > 4))
 	return(255);
-
-    /*
-     * Scan the entry table for a contender
-     */
-    for (i = 0, pe = &pci_route_table->pt_entry[0]; i < pci_route_count; i++, pe++) {
-	if ((bus != pe->pe_bus) || (device != pe->pe_device))
-	    continue;
 
-	irq = pci_cfgintr_linked(pe, pin);
-	if (irq != 255)
-	     already = 1;
-	if (irq == 255)
-	    irq = pci_cfgintr_unique(pe, pin);
-	if (irq == 255)
-	    irq = pci_cfgintr_virgin(pe, pin);
+    pe = pci_cfgfind_pir_entry(bus, device);
+    if (pe == NULL)
+        goto out;
+
+    irq = pci_cfgintr_linked(pe, pin);
+    if (irq != 255)
+	already = 1;
+    if (irq == 255)
+	irq = pci_cfgintr_unique(pe, pin);
+    if (irq == 255)
+	irq = pci_cfgintr_virgin(pe, pin);
 
-	if (irq == 255)
-	    break;
+    if (irq == 255)
+	goto out;
 
+    /*
+     * Ask the BIOS to route the interrupt
+     */
+    args.eax = PCIBIOS_ROUTE_INTERRUPT;
+    args.ebx = (bus << 8) | (device << 3);
+    args.ecx = (irq << 8) | (0xa + pin - 1);	/* pin value is 0xa - 0xd */
+    if (bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL)) && !already) {
 	/*
-	 * Ask the BIOS to route the interrupt
+	 * XXX if it fails, we should try to smack the router
+	 * hardware directly.
+	 * XXX Also, there may be other choices that we can try that
+	 * will work.
 	 */
-	args.eax = PCIBIOS_ROUTE_INTERRUPT;
-	args.ebx = (bus << 8) | (device << 3);
-	args.ecx = (irq << 8) | (0xa + pin - 1);	/* pin value is 0xa - 0xd */
-	if (bios32(&args, PCIbios.ventry, GSEL(GCODE_SEL, SEL_KPL)) && !already) {
-	    /*
-	     * XXX if it fails, we should try to smack the router
-	     * hardware directly.
-	     * XXX Also, there may be other choices that we can try that
-	     * will work.
-	     */
-	    PRVERB(("pci_cfgintr: ROUTE_INTERRUPT failed.\n"));
-	    return(255);
-	}
-	printf("pci_cfgintr: %d:%d INT%c routed to irq %d\n", bus, device, 'A' + pin - 1, irq);
-	return(irq);
+	PRVERB(("pci_cfgintr: ROUTE_INTERRUPT failed.\n"));
+	return(255);
     }
+    printf("pci_cfgintr: %d:%d INT%c routed to irq %d\n", bus, device, 'A' + pin - 1, irq);
+    return(irq);
 
+out:;
     PRVERB(("pci_cfgintr: can't route an interrupt to %d:%d INT%c\n", bus, device, 'A' + pin - 1));
     return(255);
 }
Index: kern/subr_prf.c
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/sys/kern/subr_prf.c,v
retrieving revision 1.74
diff -u -r1.74 subr_prf.c
--- kern/subr_prf.c	2001/11/30 21:40:52	1.74
+++ kern/subr_prf.c	2001/12/31 15:20:03
@@ -576,6 +576,7 @@
 			}
 			break;
 		case 'd':
+		case 'i':
 			if (qflag)
 				uq = va_arg(ap, quad_t);
 			else if (lflag)
Index: pccard/pcic_pci.c
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/sys/pccard/pcic_pci.c,v
retrieving revision 1.108
diff -u -r1.108 pcic_pci.c
--- pccard/pcic_pci.c	2001/11/13 06:46:19	1.108
+++ pccard/pcic_pci.c	2001/12/31 15:20:31
@@ -740,7 +740,7 @@
 			syscntl |= TI113X_SYSCNTL_INTRTIE;
 		}
 		syscntl &= ~TI113X_SYSCNTL_SMIENB;
-		pci_write_config(dev, TI113X_PCI_SYSTEM_CONTROL, syscntl, 1);
+		pci_write_config(dev, TI113X_PCI_SYSTEM_CONTROL, syscntl, 4);
 	}
 	if (cardcntl & TI113X_CARDCNTL_RING_ENA)
 		printf("[ring enable]");

----Next_Part(Mon_Dec_31_08:54:20_2001_393)----
