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

📄 superio.asl

📁 <BIOS研发技术剖析>书的源代码,包括完整的BIOS汇编语言源程序.
💻 ASL
📖 第 1 页 / 共 3 页
字号:

// Set Base IO Address
        Store(LOEP, IOAL)
        Store(HIEP, IOAH)

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

// Set DMA
        If(DMAE)
        {
                FindSetRightBit(DMAE, Local0)
                Subtract(Local0, 1, DMCH)
        }
        Else    // No DMA
        {
                Store(4, DMCH)
        }


        Store(One, ACTR)        // Enable ACTR
        EXFG()                  // Exit Config Mode
}                               // End of _SRS Method
// End //////////////////////////////////////////////////////////

// IR Port definitions
        Name(CNBF, Buffer() {0xF8, 0x3})// Buffer to provide word/byte access
                                        // to UART2 base address
// Device's Base address detecting
// Arg0 - has a proper LDN
        Method(UABS, 1) {

        ENFG()
        Store(Arg0, LDN)                // Select Appropriate LDN

        CreateByteField(CNBF, 0, IOLO)
        CreateByteField(CNBF, 1, IOHI)
        CreateWordField(CNBF, 0, IOAD)
        Store(IOAL, IOLO)
        Store(IOAH, IOHI)

        EXFG()
        Return(IOAD)
        }

//---------Power Resources for UART1 -------------------------
        Name(CSCP, 0)                   // Power state status
   PowerResource(URP1, 1, 0) {   // SystemLevel Parameter=0,
                                                // which means UART can be turned off
                                                // in any sleep state
                Method(_STA, 0) {
                        Return(CSCP)            // Get Power Status
                }                               // end of _STA
                Method(_ON) {
//         Store(LDU1, LDN)  // Enable ACTivate register
//         Store(1, ACTR)
                        Store(1, CSCP)
                }                               // end of _ON
                Method(_OFF){
//         Store(LDU1, LDN)  // Disable ACTivate register
//         Store(0, ACTR)
                        Store(0, CSCP)
                }                               // end of _OFF
        }
//---------Power Resources for UART2 -------------------------
        PowerResource(URP2, 0, 0) {     // SystemLevel Parameter=0,
                                        // which means UART can be turned off
                                        // in any sleep state
                                        // in any sleep state
                Method(_STA, 0) {
                        Return(CSCP)            // Get Power Status
                }                               // end of _STA
                Method(_ON) {
                        Store(1,CSCP)
                }                               // end of _ON
                Method(_OFF){
                        Store(0,CSCP)
                }                               // end of _OFF
        }
//---------Power Resources for FDD -------------------------
        PowerResource(FDDP, 0, 0) {     // SystemLevel Parameter=0,
                                        // which means FDD can be turned off
                                        // in any sleep state
                                        // in any sleep state
                Method(_STA, 0) {
                        Return(CSCP)            // Get Power Status
                }                               // end of _STA
                Method(_ON) {
                        Store(1,CSCP)
                }                               // end of _ON
                Method(_OFF){
                        Store(0,CSCP)
                }                               // end of _OFF
        }
//---------Power Resources for LPT -------------------------
        PowerResource(LPTP, 0, 0) {     // SystemLevel Parameter=0,
                                        // which means LPT can be turned off
                                        // in any sleep state
                                        // in any sleep state
                Method(_STA, 0) {
                        Return(CSCP)            // Get Power Status
                }                               // end of _STA
                Method(_ON) {
                        Store(1,CSCP)
                }                               // end of _ON
                Method(_OFF){
                        Store(0,CSCP)
                }                               // end of _OFF
        }

/// end Power resources /////////
//////////////////////////////////////////////////////////////////
// Generic devices Current Resources Buffers /////////////////////
//////////////////////////////////////////////////////////////////

// FDC Current Resource Settings (to be returned by _CRS)
        Name(FCRS, ResourceTemplate() {
                IO(Decode16, 0x3f2, 0x3f2, 1, 2, FCP1)
                IO(Decode16, 0x3f4, 0x3f4, 1, 2, FCP2)
                IO(Decode16, 0x3f7, 0x3f7, 1, 1, FCP3)
                IRQNoFlags(FCI1) {6}
                DMA(Compatibility, NotBusMaster, Transfer8, FCD1) {2}
        })

// Ports (COMx and LPT) Current Resource Settings
// (to be initialized and returned by _CRSreturned by COMx._CRS/LPT._CRS)
        Name(PBUF, ResourceTemplate() {
                IO(Decode16, 0, 0, 1, 8, PBP1)
                IRQNoFlags(PBI1) {0}
        })

// ECP DEVICE Current Resource Settings
        Name(EBUF, ResourceTemplate() {
                IO(Decode16, 0x378, 0x378, 1, 8, EBP1)
                IO(Decode16, 0x778, 0x778, 1, 4, EBP2)
                IRQNoFlags(EBI1) {7}
                DMA(Compatibility, NotBusMaster, Transfer8, EBD1) {}
        })

//////////////////////////////////////////////////////////////////
// Generic devices Possible Resources Buffers ////////////////////
//////////////////////////////////////////////////////////////////

// FDC Possible Resources
        Name(FPRS, ResourceTemplate() {
                StartDependentFn(0, 0) {
                        IO(Decode16, 0x3f2, 0x3f2, 1, 2)
                        IO(Decode16, 0x3f4, 0x3f4, 1, 2)
                        IO(Decode16, 0x3f7, 0x3f7, 1, 1)
                        IRQNoFlags() {6}
                        DMA(Compatibility, NotBusMaster, Transfer8) {2}
                }
                EndDependentFn()
        })

// UART1 Possible Resources
        Name(C1PR, ResourceTemplate() {
                StartDependentFn(0, 0) {
                        IO(Decode16, 0x3f8, 0x3f8, 4, 8)
                        IRQNoFlags() {4}
                }
                StartDependentFnNoPri() {
                        IO(Decode16, 0x3f8, 0x3f8, 4, 8)
                        IRQNoFlags() {3,4,10,11}
                }
                StartDependentFnNoPri() {
                        IO(Decode16, 0x2f8, 0x2f8, 4, 8)
                        IRQNoFlags() {3,4,10,11}
                }
                StartDependentFnNoPri() {
                        IO(Decode16, 0x3e8, 0x3e8, 4, 8)
                        IRQNoFlags() {3,4,10,11}
                }
                StartDependentFnNoPri() {
                        IO(Decode16, 0x2e8, 0x2e8, 4, 8)
                        IRQNoFlags() {3,4,10,11}
                }
                EndDependentFn()
        })

// UART2 Possible Resources
        Name(C2PR, ResourceTemplate() {
                StartDependentFn(0, 0) {
                        IO(Decode16, 0x2f8, 0x2f8, 4, 8)
                        IRQNoFlags() {3}
                }
                StartDependentFnNoPri() {
                        IO(Decode16, 0x2f8, 0x2f8, 4, 8)
                        IRQNoFlags() {3,4,10,11}
                }
                StartDependentFnNoPri() {
                        IO(Decode16, 0x3f8, 0x3f8, 4, 8)
                        IRQNoFlags() {3,4,10,11}
                }
                StartDependentFnNoPri() {
                        IO(Decode16, 0x3e8, 0x3e8, 4, 8)
                        IRQNoFlags() {3,4,10,11}
                }
                StartDependentFnNoPri() {
                        IO(Decode16, 0x2e8, 0x2e8, 4, 8)
                        IRQNoFlags() {3,4,10,11}
                }
                EndDependentFn()
        })

// LPT Possible Resources
        Name(LPPR, ResourceTemplate() {
                StartDependentFn(0, 0) {
                        IO(Decode16, 0x378, 0x378, 1, 8)
                        IRQNoFlags() {7}
                }
                StartDependentFnNoPri() {
                        IO(Decode16, 0x378, 0x378, 1, 8)
                        IRQNoFlags() {5, 7}
                }
                StartDependentFnNoPri() {
                        IO(Decode16, 0x278, 0x278, 1, 8)
                        IRQNoFlags() {5, 7}
                }
                StartDependentFnNoPri() {
                        IO(Decode16, 0x3bc, 0x3bc, 1, 4)
                        IRQNoFlags() {5, 7}
                }
                EndDependentFn()
        })

// ECP Possible Resources
        Name(EPRS, ResourceTemplate() {
                StartDependentFn(0, 0) {
                        IO(Decode16, 0x378, 0x378, 1, 8)
                        IO(Decode16, 0x778, 0x778, 1, 4)
                        IRQNoFlags() {7}
                        DMA(Compatibility, NotBusMaster, Transfer8) {1}
                        }
                StartDependentFnNoPri() {
                        IO(Decode16, 0x378, 0x378, 1, 8)
                        IO(Decode16, 0x778, 0x778, 1, 4)
                        IRQNoFlags() {5, 7}
                        DMA(Compatibility, NotBusMaster, Transfer8) {0, 1, 3}
                        }
                StartDependentFnNoPri() {
                        IO(Decode16, 0x278, 0x278, 1, 8)
                        IO(Decode16, 0x678, 0x678, 1, 4)
                        IRQNoFlags() {5, 7}
                        DMA(Compatibility, NotBusMaster, Transfer8) {0, 1, 3}
                        }
                StartDependentFnNoPri() {
                        IO(Decode16, 0x3bc, 0x3bc, 1, 4)
                        IO(Decode16, 0x7bc, 0x7bc, 1, 4)
                        IRQNoFlags() {5, 7}
                        DMA(Compatibility, NotBusMaster, Transfer8) {0, 1, 3}
                }
// No DMA
                StartDependentFnNoPri() {
                        IO(Decode16, 0x378, 0x378, 1, 8)
                        IO(Decode16, 0x778, 0x778, 1, 4)
                        IRQNoFlags() {5, 7}
                        DMA(Compatibility, NotBusMaster, Transfer8) {}
                        }
                StartDependentFnNoPri() {
                        IO(Decode16, 0x278, 0x278, 1, 8)
                        IO(Decode16, 0x678, 0x678, 1, 4)
                        IRQNoFlags() {5, 7}
                        DMA(Compatibility, NotBusMaster, Transfer8) {}
                        }
                StartDependentFnNoPri() {
                        IO(Decode16, 0x3bc, 0x3bc, 1, 4)
                        IO(Decode16, 0x7bc, 0x7bc, 1, 4)
                        IRQNoFlags() {5, 7}
                        DMA(Compatibility, NotBusMaster, Transfer8) {}
                }
                EndDependentFn()
        })

⌨️ 快捷键说明

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