⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 superio.asl

📁 <BIOS研发技术剖析>书的源代码,包括完整的BIOS汇编语言源程序.
💻 ASL
📖 第 1 页 / 共 3 页
字号:
//                                        // LDN = 62
//                Return(GSTA(LDIR))      // Get status
//                }
//                Return(0)               // Not present
//        }
//
//        Method(_DIS, 0) {
//                DDIS(4)                 // Disable IRD (LDN = 4)
//        }
//
//        Method(_CRS, 0) {
//                Return(PCRS(4, 1, 8))   // Get IRD current resources
//
//        }
//
//        Method(_SRS, 1) {
//                PSRS(Arg0, 4)           // Set IRD recources
//        }
//
//        Method(_PRS) {Return(C2PR)}     // Return IRD possible resources
//
//}                               // End IRDA

//// ECP DEVICE
//Device(ECP)
//{
// Name(_HID,EISAID("PNP0401"))   // PnP ID ECP Port
//
//        Method(_STA, 0) {
//                ENFG()                          // Enter Config Mode
//                Store(3, LDN)                   // ECP LDN = 1
//                And(OPT1, 0x02, Local0)
//                EXFG()                  // Exit Config Mode
//                If (Local0)             // ECP Mode?
//                {
//                 If(LPST) { Return(GSTA(3))}// Yes - get ECP status
//                }
//                Else {
//                        Return(Zero)    // No - ECP is not present
//                }
//
//        }
//
//        Method(_DIS, 0) {
//                DDIS(3)                 // Disable ECP (LDN = 3)
//        }
//
//        Method(_CRS, 0) {
//                Return(ECRS(3))         // Get LPT current resources
//        }
//
//        Method(_SRS, 1) {               // Set ECP resources
//                ESRS(Arg0, 3)           // Set resources
//        }
//
//        Method(_PRS) {Return(EPRS)}     // Return ECP possible resources
//
//}                                               // End ECP Device

// End of ITE8661F
////////////////////////////////////////////////////////////////////////
// SET OF DIFFERENT IO DEVICES CONTROL METHOD ROUTINES                //
////////////////////////////////////////////////////////////////////////

// Detect on board Super IO devices
        Name(FDST,0)
        Name(U1ST,0)
        Name(U2ST,0)
        Name(IRST,0)
        Name(LPST,0)
//      Name(EPST,0)

        Method(IODT)                    // Start up code to detect
        {                               // the presence of Super IO devices
// FDC
                If(LEqual(GSTA(LDFD), 0xf)) // Get device status
                {
                Store(1, FDST)           // device present
                }
// UART 1
                If(LEqual(GSTA(LDU1), 0xf)) // Get device status
                {
                Store(1, U1ST)           // device present
                }
// UART 2
                If(LEqual(GSTA(LDU2), 0xf)) // Get device status
                {
                Store(1, U2ST)           // device present
                }
// IR
                If(LEqual(GSTA(LDIR), 0xf)) // Get device status
                {
                Store(1, IRST)           // device present
                }
// LPT,ECP
                If(LEqual(GSTA(LDLP), 0xf)) // Get device status
                {
                Store(1, LPST)           // device present
                }
        }


// GET SIO DEVICE STATUS according to ACTR/IOAH/IOAL ///////////////////
// Note: device must be selected

Method(GSTA, 1) {               // Get UART status

        ENFG()                                  // Enter Config Mode
        Store(Arg0, LDN)                        // Select Appropriate LDN
        If(ACTR) {Store(0x0F, Local0)}          // Present & Active

        Else {
                If(Or(IOAH, IOAL)) {            // If device address <> 0
                        Store(0x0D, Local0)     // then present &! active
                }
                Else {Store(0, Local0)}         // !present
//              Else {Store(0x1, Local0)}       // present/not decode IO/disabled
        }

        EXFG()                                  // Exit Config Mode
        Return(Local0)          // Return device status

} // EndOf GSTA

// Disable SIO device ///////////////////////////////////////////
// Note: device must be selected

Method(DDIS, 1) {

// Arg0 - LDN
        ENFG()                  // Enter Config Mode
        Store(Arg0, LDN)        // Select Appropriate LDN
        Store(Zero, ACTR)       // Set Activate Register to zero
        EXFG()                  // Exit Config Mode
} // End DDIS

Method(DENB, 1) {               // Enable SIO device

// Arg0 - LDN
        ENFG()                  // Enter Config Mode
        Store(Arg0, LDN)        // Select Appropriate LDN
        Store(One, ACTR)        // Set Activate Register to zero
        EXFG()                  // Exit Config Mode
} // End DDIS

// COMx and LPT _CRS implementation //////////////////////////

Method(PCRS, 3) {
// Arg0 - LDN
// Arg1 - Alignment
// Arg2 - IO Length

        CreateByteField(PBUF, 0x02, IOLO)       // Range Min Base LSB
        CreateByteField(PBUF, 0x03, IOHI)       // Range Min Base MSB
        CreateWordField(PBUF, 0x02, IOHL)       // Range Min Base Word
        CreateWordField(PBUF, 0x04, IORL)       // Range Max Base Word
        CreateByteField(PBUF, 0x06, ALMN)       // Alignment
        CreateByteField(PBUF, 0x07, LENG)       // Number of IO ports
        CreateByteField(PBUF, 0x09, IRQL)       // IRQ Mask


        ENFG()                  // Enter Config Mode
        Store(Arg0, LDN)        // Select Appropriate LDN

// Write Current Settings into Buffer for IO Descriptor
        Store(IOAH, IOHI)       // Get IO Base MSB
        Store(IOAL, IOLO)       // Get IO Base LSB
        Store(IOHL, IORL)       // Set MaxBase = MinBase
        Store(Arg1, ALMN)       // Set alignment
// adjust base/aligment size if base ports are 0x3bc/0x7bc
        If(LEqual(IOLO, 0xbc)) {Store(0x04, LENG)}
        Else {
        Store(Arg2, LENG)       // Set IO length
        }

// Write Current Settings into IRQ descriptor
        Store(One, Local0)
        ShiftLeft(Local0, INTR, IRQL)

        EXFG()                  // Exit Config Mode
        Return(PBUF)            // Return Byte Stream
}
// End //////////////////////////////////////////////////////////

// COMx and LPT _SRS implementation //////////////////////////

Method(PSRS, 2) {
// Arg0 - PnP Resource String to set
// Arg1 - LDN

        CreateByteField (Arg0, 0x02, POLB)      // Range Min Base LSB
        CreateByteField (Arg0, 0x03, POHB)      // Range Min Base MSB
        CreateByteField (Arg0, 0x09, PIRQ)      // IRQ number

        ENFG()                  // Enter Config Mode
        Store(Arg1, LDN)        // Select Appropriate LDN

// Set Base IO Address
        Store(POLB, IOAL)       // Set IO Base LSB
        Store(POHB, IOAH)       // Set IO Base MSB

// Set IRQ
        FindSetRightBit(PIRQ, Local0)
        Subtract(Local0, 1, INTR)

        Store(One, ACTR)        // Activate
        EXFG()                  // Exit Config Mode
}
// End //////////////////////////////////////////////////////////

// ECP _CRS implementation //////////////////////////////////////

Method(ECRS, 1) {
// Arg0 - LDN
        CreateByteField(EBUF, 0x02, EPLO)       // Range Min Base LSB
        CreateByteField(EBUF, 0x03, EPHI)       // Range Min Base MSB
        CreateWordField(EBUF, 0x02, EPHL)       // Range Min Base Word
        CreateWordField(EBUF, 0x04, EPRL)       // Range Max Base Word
        CreateWordField(EBUF, 0x06, ALM1)       // Alignment
        CreateWordField(EBUF, 0x0a, E4LO)       // IO Port+400h Low
        CreateWordField(EBUF, 0x0c, E4RL)       // IO Range+400h Low
        CreateWordField(EBUF, 0x11, EIRQ)       // IRQ
        CreateWordField(EBUF, 0x14, EDMA)       // DMA


        ENFG()                          // Enter Config Mode
        Store(Arg0, LDN)                // Select Appropriate LDN (LPT)

// Write Current Settings into Buffer for IO Descriptor
        Store(IOAH, EPHI)               // Get Min Base MSB
        Store(IOAL, EPLO)               // Get Min Base LSB

        Store(EPHL, EPRL)               // Set Max Base Word

        Add(EPHL, 0x400, E4LO)
        Store(E4LO, E4RL)

// adjust base/aligment size if base ports are 0x3bc/0x7bc
        If(LEqual(EPHL, 0x3bc)) {Store(0x0401, ALM1)}
        Else                    {Store(0x0801, ALM1)}

// Write Current Settings into IRQ descriptor
        Store(One, Local0)
        Store(INTR, Local1)
        ShiftLeft(Local0, Local1, EIRQ)

// Write Current Settings into DMA descriptor
        Store(DMCH, Local1)
        If(LGreater(Local1, 0x3))
        {
                Store(0, EDMA)                  // No DMA
        }
        Else
        {
                Store(One, Local0)
                ShiftLeft(Local0, Local1, EDMA)
        }

        EXFG()                          // Exit Config Mode

        Return(EBUF)                    // Return Current Resources
}
// End //////////////////////////////////////////////////////////

// ECP _SRS implementation //////////////////////////////////////

Method(ESRS, 2) {
// Arg0 - PnP Resource String to set
// Arg1 - LDN
        CreateByteField (Arg0, 0x02, LOEP)      // IO Port Low
        CreateByteField (Arg0, 0x03, HIEP)      // IO Port Low
        CreateWordField (Arg0, 0x11, IRQE)      // IRQ
        CreateWordField (Arg0, 0x14, DMAE)      // DMA Channel

        ENFG()                  // Enter Config Mode
        Store(Arg1, LDN)        // Select Appropriate LDN (LPT)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -