diff options
Diffstat (limited to 'Board/EM/Isct')
39 files changed, 5738 insertions, 0 deletions
diff --git a/Board/EM/Isct/AcpiTables/Isct.asl b/Board/EM/Isct/AcpiTables/Isct.asl new file mode 100644 index 0000000..a98416b --- /dev/null +++ b/Board/EM/Isct/AcpiTables/Isct.asl @@ -0,0 +1,778 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctAcpiTables/Isct.asl 7 7/11/14 9:52a Mirayang $ +// +// $Revision: 7 $ +// +// $Date: 7/11/14 9:52a $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctAcpiTables/Isct.asl $ +// +// 7 7/11/14 9:52a Mirayang +// Remove override. +// +// 6 7/08/14 5:09a Mirayang +// EIP142924 iSCT 5.0 for Shark Bay Platform +// +// 5 5/14/13 6:29a Bensonlai +// [TAG] EIP123328 +// [Category] Spec Update +// [Severity] Normal +// [Description] [SBY] Intel Smart Connect Technology 4.x BIOS Reference +// Code +// +// 4 3/27/13 9:13a Bensonlai +// [TAG] EIP118307 +// [Category] New Feature +// [Description] Implementation of the ISCT Platform Design +// Specification 0.8. +// [Files] Isct.asl, IsctAcpi.c, IsctAcpi.mak +// +// 3 1/14/13 12:03a Bensonlai +// [TAG] EIP112064 +// [Category] Bug Fix +// [Severity] Normal +// [Symptom] [ISCT] GWLS,SWLS,GWWS and SWWS are fail while set wake up +// timer to RTC +// [Solution] Implement the GWLS,SWLS,GWWS and SWWS while set wake up +// timer to RTC +// [Files] Isct.asl +// +// 2 1/13/13 5:14a Bensonlai +// [TAG] EIP112064 +// [Category] Bug Fix +// [Severity] Normal +// [Symptom] [ISCT] GWLS,SWLS,GWWS and SWWS are fail while set wake up +// timer to RTC +// [Solution] Implement the GWLS,SWLS,GWWS and SWWS while set wake up +// timer to RTC +// [Files] Isct.asl +// +// 1 9/02/12 11:18p Bensonlai +// Intel Smart Connect Technology initially releases. +// +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: Isct.asl +// +// Description: This file provides the ACPI methods for the iSCT agent to use. +// +//<AMI_FHDR_END> +//********************************************************************** + +DefinitionBlock ( + "IsctAcpi.aml", + "SSDT", + 1, + "Intel_", + "IsctTabl", + 0x1000 + ) + +{ + External(ICNF) //Isct Configuration + External(\_SB.PCI0.LPCB.H_EC.IBT1) // Isct Byte1 for EC + External(\_SB.PCI0.LPCB.H_EC.IBT2) // Isct Byte2 for EC + External(\_SB.PCI0.LPCB.H_EC.ECMD, MethodObj) // EC Command method + External(\_SB.PCI0.LPCB.H_EC.WTMS) // EC Wake Timer Settings + External(\_SB.PCI0.LPCB.H_EC.AWT0) // EC Wake Timer Value (BIT7-0) + External(\_SB.PCI0.LPCB.H_EC.AWT1) // EC Wake Timer Value (BIT15-8) + External(\_SB.PCI0.LPCB.H_EC.AWT2) // EC Wake Timer Value (BIT23-16) + External(\_SB.PCI0.LPCB.H_EC.LSTE) // Lid State (Lid Open = 1) + External(\_SB.IFFS.FFSS) + + External(\_SB.PCI0.GFX0.TCHE) // Technology enabled indicator + External(\_SB.PCI0.GFX0.STAT) // State Indicator + External(\_SB.PCI0.GFX0.ASLE) // Reg 0xE4, ASLE interrupt register + External(\_SB.PCI0.GFX0.ASLC) // ASLE interrupt command/status + External(\_SB.PCI0.GFX0.PARD, MethodObj) // Check if the driver is ready to handle ASLE interrupts + External(\ADBG, MethodObj) // Print message to ACPI Debug Buffer + + Scope (\_SB) + { + Device (IAOE) + { + OperationRegion(ISCT,SystemMemory,0xFFFF0008,0xAA58) + Field(ISCT,AnyAcc,Lock,Preserve) + { + WKRS, 8, // (0) ISCT Wake Reason + AOCE, 8, // (1) ISCT is Enabled + FFSE, 8, // (2) IFFS Enabled + ITMR, 8, // (3) ISCT Timer Type: 0 = EC, 1 = RTC + ECTM, 32, // (4) ISCT EC Timer + RCTM, 32, // (8) ISCT RTC Timer + GNPT, 32, // (12)ISCT GlobalNvs Ptr + ATOW, 8, // (16)ISCT timer over write, 1 = overwrited as ISCT timer + } + Name (_HID, "INT33A0") + Name (_CID, "PNP0C02") + Name (_UID, 0x00) + + Name (IBT1, 0) // Isct Byte1 for EC (local) + Name (IBT2, 0) // Isct Byte2 for EC (local) + Name (INSB, 0) // Isct Notification Status Bit + Name (WTMS, 0) // EC Wake Timer Settings (local) + Name (AWT0, 0) // EC Wake Timer Value (BIT7-0) (local) + Name (AWT1, 0) // EC Wake Timer Value (BIT15-8) (local) + Name (AWT2, 0) // EC Wake Timer Value (BIT23-16) (local) + Name (PTSL, 0) // Platform Sleep Level + Name (SLPD, 0) // Sleep duration for when using NetDetect (dummy) + Name (IMDS, 0) // Isct Mode Select Bits + // Bits: Description + // 0 Reserved + // 1 ISCT Wake Mode Select: 0 = Normal ISCT Wake Mode, 1 = Extended ISCT Wake Mode + // 2 Wake From S4: 0 = No Wake from S4, 1 = Wake from S4 + // 3-7 Reserved + Name (IWDT, 0) // Isct Wake Duration Time + + /** + GABS - Get ISCT BIOS Enablign Setting + Input: None + Return: + Bits Description + - 0 ISCT Configured: 0 = Disabled, 1 = Enabled + - 1 ISCT Notification Control: 0 = Unsupported, 1 = Supported + - 2 ISCT WLAN Power Control : 0 = Unsupported, 1 = Supported + - 3 ISCT WWAN Power Control : 0 = Unsupported, 1 = Supported + - 4 Must be set to 1 (BIOS Program Timer) + - 5 Sleep duration value format: 0 = Actual time, 1 = Duration in Seconds + - 6 RF Kill Switch Type: 0 = Software, 1 = Hardware + - 7 Wake from S4: 0 = Unsupported, 1 = Supported + **/ + Method (GABS, 0, NotSerialized) { + Return (ICNF) + } + + // + // GAOS - Get ISCT Function Status + // Input: None + // Return: + // Bits Description + // 0 ISCT Mode: 0 = Disabled, 1 = Enabled + // 1 ISCT Wake Mode Select: 0 = ISCT Wake Mode, 1 = Extended ISCT Wake + // 2 - 7 Reserved + // + Method (GAOS, 0, NotSerialized) + { + // + // Check for RTC Timer, else EC timer + // + If (LEqual(ITMR, 1)) + { + // Get Isct Mode Enable and Get Isct Wake Mode Select + // + Return(Or(And(IBT1, 0x01), And(IMDS, 0x06))) + } + Else + { + // + //Get Isct Mode Enable + // + If (CondRefOf(\_SB.PCI0.LPCB.H_EC.IBT1)) + { + Store(\_SB.PCI0.LPCB.H_EC.IBT1, Local0) + } + Else + { + Store(IBT1, Local0) + } + And(Local0, 0x01, Local0) + // + // Get Isct Wake Mode Select + // + Or(Local0, And(IMDS, 0x02), Local0) + Return (Local0) + } + } + + /** + SAOS - Set ISCT Function Status + Input: + Bits Description + - 0 ISCT Mode: 0 = Disabled, 1 = Enabled + - 1 ISCT Wake Mode Select: 0 = Normal ISCT Wake Mode, 1 = Extended ISCT Wake Mode + - 2 Wake From S4: 0 = No Wake from S4, 1 = Wake from S4 + - 3 - 7 Reserved + **/ + Method (SAOS, 1, NotSerialized) + { + // + // If Graphics Driver supports disable display notification in ISCT mode + // + If (And(\_SB.PCI0.GFX0.TCHE, 0x100)) + { + // + // Check for RTC Timer, else EC timer + // + If (LEqual(ITMR, 1)) + { + // + // If iSCT Mode and agent is disabling iSCT Mode and the iSCT Wake Reason indicates display off + // Then notify graphics driver to turn on display + // + If (LAnd(LAnd(And(IBT1, 0x01), LNot(And(Arg0, 0x01))), And(\_SB.IAOE.WKRS, 0x10))) { + If (LNot(\_SB.PCI0.GFX0.PARD())) + { + Store(And(\_SB.PCI0.GFX0.STAT, Not(0x03)), \_SB.PCI0.GFX0.STAT) // STAT[1:0] = 00, Normal Resume to S0 + + Store(Or(\_SB.PCI0.GFX0.ASLC, 0x100), \_SB.PCI0.GFX0.ASLC) // ASLC[8] = 1, ISCT State Change Request + + Store(0x01, \_SB.PCI0.GFX0.ASLE) // Generate ASLE interrupt + } + } + } else { + If(CondRefOf(\_SB.PCI0.LPCB.H_EC.IBT1)) { + // + // If ISCT Mode and Wake Reason was ISCT wake (EC Timer or Network PME) and agent is disabling ISCT Mode + // Then notify graphics driver to turn on display + // + If (LAnd(LAnd(And(\_SB.PCI0.LPCB.H_EC.IBT1, 0x01), LOr(And(\_SB.IAOE.WKRS, 0x02), And(\_SB.IAOE.WKRS, 0x10))), LNot(And(Arg0, 0x01)))) { + If (LNot(\_SB.PCI0.GFX0.PARD())) + { + Store(And(\_SB.PCI0.GFX0.STAT, Not(0x03)), \_SB.PCI0.GFX0.STAT) // STAT[1:0] = 00, Normal Resume to S0 + + Store(Or(\_SB.PCI0.GFX0.ASLC, 0x100), \_SB.PCI0.GFX0.ASLC) // ASLC[8] = 1, ISCT State Change Request + + Store(0x01, \_SB.PCI0.GFX0.ASLE) // Generate ASLE interrupt + } + } + } + } + } + + // + // Check for RTC Timer, else EC timer + // + If (LEqual(ITMR, 1)) + { + // + // Set Isct Wake Mode Selection and Wake from S4 + // + Store(And(Arg0, 0x06), IMDS) + /// @note: Low Power Fan control for Extended Wake + // + // Set Isct Mode Enable + // + Or(And(IBT1, 0xFE), And(Arg0, 0x01), IBT1) + } + Else + { + // + //Set Isct Mode Enable + // + If (CondRefOf(\_SB.PCI0.LPCB.H_EC.IBT1)) + { + Store(\_SB.PCI0.LPCB.H_EC.IBT1, Local0) + } + Else + { + Store(IBT1, Local0) + } + And(Local0, 0xFE, Local0) + Or(Local0, And(Arg0, 0x01), Local0) + // + // Set Isct Wake Mode Select + // + Store(And(Arg0, 0x02), IMDS) + //TBD: Low Power Fan control + If (CondRefOf(\_SB.PCI0.LPCB.H_EC.IBT1)) + { + Store(Local0, \_SB.PCI0.LPCB.H_EC.IBT1) + //Send EC IsctUpdateCommand - 0x2B + \_SB.PCI0.LPCB.H_EC.ECMD (0x2B) + } + Else + { + Store(Local0, IBT1) + } + } + } + + // + // GANS - Get ISCT Notification Status + // Input: None + // Return: + // Bits Description + // 0 ISCT Notification : 0 = Disabled, 1 = Enabled + // 1 - 7 Reserved + // + Method (GANS, 0, NotSerialized) + { + Return (INSB) + } + + // + // SANS - Set ISCT Notification Status + // Input: + // Bits Description + // 0 ISCT Notification : 0 = Disabled, 1 = Enabled + // 1 - 7 Reserved + // + Method (SANS, 1, NotSerialized) + { + Store(And(Arg0, 0x01), INSB) + } + + // + // GWLS - Get WLAN Module Status + // Input: None + // Return: + // Bits Description + // 0 Reserved(set to 0) + // 1 WLAN Module Powered in S3: 0 = Disabled, 1 = Enabled + // 2 WLAN Module Powered in S4: 0 = Disabled, 1 = Enabled + // 3 WLAN Module Powered in S5: 0 = Disabled, 1 = Enabled + // 4 - 7 Reserved + // + Method (GWLS, 0, NotSerialized) + { + If(LEqual(And(ICNF, 0x04), Zero)) + { + Return (Zero) + } + // + // Check for RTC Timer, else EC timer + // + If (LEqual(ITMR, 1)) + { + Store(One, Local0) + Store(IBT1, Local1) + Or(Local0, And(Local1, 0x0E), Local0) + Return (Local0) + } + Else + { + // + // Set WLAN Wireless Disable Bit to 1 if EC + // + If (CondRefOf(\_SB.PCI0.LPCB.H_EC.IBT2)) + { + Store(\_SB.PCI0.LPCB.H_EC.IBT2, Local0) + Or(Local0, 1, Local0) + } + + // + // Get WLAN Powered States + // + If (CondRefOf(\_SB.PCI0.LPCB.H_EC.IBT1)) + { + Store(\_SB.PCI0.LPCB.H_EC.IBT1, Local1) + } + Else + { + Store(IBT1, Local1) + } + Or(Local0, And(Local1, 0x0E), Local0) + + Return (Local0) + } + } + // + // SWLS - Set WLAN Module Status + // Input: + // Bits Description + // 0 N/A (WLAN Wireless Disable is Read only) Always set to 0 + // 1 WLAN Module Powered in S3: 0 = Disabled, 1 = Enabled + // 2 WLAN Module Powered in S4: 0 = Disabled, 1 = Enabled + // 3 WLAN Module Powered in S5: 0 = Disabled, 1 = Enabled + // 4 - 7 Reserved + // + Method (SWLS, 1, NotSerialized) + { + If(LEqual(And(ICNF, 0x04), Zero)) + { + Return + } + // + // Check for RTC Timer, else EC timer + // + If (LEqual(ITMR, 1)) + { + Store(IBT1, Local0) + + // + // Set new Power States + // + And(Local0, 0xF1, Local0) + Or(Local0, And(Arg0, 0x0E), Local0) + If(CondRefOf(\_SB.IFFS.FFSS)) + { + If(LAnd(And(\_SB.IFFS.FFSS, 0x03), And(Arg0,0x02))) + { + Or(Local0, 0x04, Local0) + } + } + Store(Local0, IBT1) + } + Else + { + // + // Read ISCTByte1 from EC + // + If (CondRefOf(\_SB.PCI0.LPCB.H_EC.IBT1)) + { + Store(\_SB.PCI0.LPCB.H_EC.IBT1, Local0) + } + Else + { + Store(IBT1, Local0) + } + + // + // Set new Power States + // + And(Local0, 0xF1, Local0) + Or(Local0, And(Arg0, 0x0E), Local0) + + // + // If RapidStart is enabled and WLAN powered in S3, enable power in S4 + // + If(CondRefOf(\_SB.IFFS.FFSS)) + { + If(LAnd(And(\_SB.IFFS.FFSS, 0x03), And(Arg0,0x02))) + { + Or(Local0, 0x04, Local0) + } + } + + // + // Save ISCTByte1 to EC + // + If (CondRefOf(\_SB.PCI0.LPCB.H_EC.IBT1)) + { + Store(Local0, \_SB.PCI0.LPCB.H_EC.IBT1) + //Send EC IsctUpdateCommand - 0x2B + \_SB.PCI0.LPCB.H_EC.ECMD (0x2B) + } + Else + { + Store(Local0, IBT1) + } + } + } + + // + // GWWS - Get WWAN Module Status + // Input: None + // Return: + // Bits Description + // 0 WWAN Wireless Disable (W_DISABLE#) :0 = Disabled, 1 = Enabled + // 1 WWAN Module Powered in S3: 0 = Disabled, 1 = Enabled + // 2 WWAN Module Powered in S4: 0 = Disabled, 1 = Enabled + // 3 WWAN Module Powered in S5: 0 = Disabled, 1 = Enabled + // 4 - 7 Reserved + // + Method (GWWS, 0, NotSerialized) + { + If(LEqual(And(ICNF, 0x08), Zero)) + { + Return (Zero) + } + // + // Check for RTC Timer, else EC timer + // + If (LEqual(ITMR, 1)) + { + Store(One, Local0) + Store(IBT1, Local1) + Or(Local0, ShiftRight(And(Local1, 0x70), 3), Local0) + Return (Local0) + } + Else + { + // + // Set WWAN Wireless Disable Bit to 1 if EC + // + If (CondRefOf(\_SB.PCI0.LPCB.H_EC.IBT2)) + { + Store(\_SB.PCI0.LPCB.H_EC.IBT2, Local0) + ShiftRight(Or(Local0, 2), 1, Local0) + } + + // + // Get WWAN Powered States + // + If (CondRefOf(\_SB.PCI0.LPCB.H_EC.IBT1)) + { + Store(\_SB.PCI0.LPCB.H_EC.IBT1, Local1) + } + Else + { + Store(IBT1, Local1) + } + Or(Local0, ShiftRight(And(Local1, 0x70), 3), Local0) + + Return (Local0) + } + } + + // + // SWWS - Set WWAN Module Status + // Input: + // Bits Description + // 0 N/A (WWAN Wireless Disable is Read only) Always set to 0 + // 1 WWAN Module Powered in S3: 0 = Disabled, 1 = Enabled + // 2 WWAN Module Powered in S4: 0 = Disabled, 1 = Enabled + // 3 WWAN Module Powered in S5: 0 = Disabled, 1 = Enabled + // 4 - 7 Reserved + // + Method (SWWS, 1, NotSerialized) + { + If(LEqual(And(ICNF, 0x08), Zero)) + { + Return + } + // + // Check for RTC Timer, else EC timer + // + If (LEqual(ITMR, 1)) + { + Store(IBT1, Local0) + // + // Set new Power States + // + And(Local0, 0x8F, Local0) + Or(Local0, ShiftLeft(And(Arg0, 0x0E), 3), Local0) + + // + // If RapidStart is enabled and WWAN powered in S3, enable power in S4 + // + If(CondRefOf(\_SB.IFFS.FFSS)) + { + If(LAnd(And(\_SB.IFFS.FFSS, 0x03), And(Arg0,2))) + { + Or(Local0, ShiftLeft(0x04, 3), Local0) + } + } + Store(Local0, IBT1) + } + Else + { + // + // Read ISCTByte1 from EC + // + If (CondRefOf(\_SB.PCI0.LPCB.H_EC.IBT1)) + { + Store(\_SB.PCI0.LPCB.H_EC.IBT1, Local0) + } + Else + { + Store(IBT1, Local0) + } + + // + // Set new Power States + // + And(Local0, 0x8F, Local0) + Or(Local0, ShiftLeft(And(Arg0, 0x0E), 3), Local0) + + // + // If RapidStart is enabled and WWAN powered in S3, enable power in S4 + // + If(CondRefOf(\_SB.IFFS.FFSS)) + { + If(LAnd(And(\_SB.IFFS.FFSS, 0x03), And(Arg0,2))) + { + Or(Local0, ShiftLeft(0x04, 3), Local0) + } + } + + // + // Save ISCTByte1 to EC + // + If (CondRefOf(\_SB.PCI0.LPCB.H_EC.IBT1)) + { + Store(Local0, \_SB.PCI0.LPCB.H_EC.IBT1) + //Send EC IsctUpdateCommand - 0x2B + \_SB.PCI0.LPCB.H_EC.ECMD (0x2B) + } + Else + { + Store(Local0, IBT1) + } + } + } + + // + // SASD - Set Intel Smart Connect Technology Sleep Duration + // Input: + // Bits Description + // 0 - 30 Sleep Duration + // 31 : 0 = Sleep Duration in seconds + // 1 = Actual time + // + Method (SASD, 1, NotSerialized) + { + // + // Arg0 = 0 - NetDetect support + // > 0 - EC / RTC Based Timer + // Bit31 : 0 - Sleep Duration in seconds + // 1 - Actual Time + // + If(LAnd(And(ICNF, 0x10), LGreater(Arg0, 0))) + { + // + // See if RTC (1) or EC (0) Timer + // + If (LEqual(ITMR, 1)) + { + Store(Arg0, RCTM) + } + Else + { + Store(Arg0, ECTM) + } + + If (LAnd(CondRefOf(\_SB.PCI0.LPCB.H_EC.WTMS), LEqual(PTSL, 0x03))) + { + Store(And(ECTM, 0xFF), \_SB.PCI0.LPCB.H_EC.AWT0) + Store(ShiftRight(And(ECTM, 0xFF00), 8), \_SB.PCI0.LPCB.H_EC.AWT1) + Store(ShiftRight(And(ECTM, 0xFF0000), 16), \_SB.PCI0.LPCB.H_EC.AWT2) + // + // Enable EC timer - BIT7 + // Enable wake from S3 on timer exiry - BIT0 + // + Store(\_SB.PCI0.LPCB.H_EC.WTMS, Local0) + Store(Or(0x81,Local0), \_SB.PCI0.LPCB.H_EC.WTMS) + } + Else + { + Store(And(ECTM, 0xFF), AWT0) + Store(ShiftRight(And(ECTM, 0xFF00), 8), AWT1) + Store(ShiftRight(And(ECTM, 0xFF0000), 16), AWT2) + Store(WTMS, Local0) + Store(Or(0x81,Local0), WTMS) + } + } + Else + { + If (LEqual(ITMR, 1)) + { + Store(0, RCTM) + } else { + If(CondRefOf(\_SB.PCI0.LPCB.H_EC.WTMS)) + { + Store(0, ECTM) + Store(0, \_SB.PCI0.LPCB.H_EC.WTMS) + } + } + + Store(Arg0, SLPD) + } + } // Method (SASD) + + // + // GPWR - Get Wake Reason + // Input: None + // Return: + // Bits Description + // 0 User Pressed Power Button: 0 = False, 1 = True + // 1 EC / RTC caused wake (requested by iSCT agent): 0 = False, 1 = True + // 2 RTC Timer caused wake: 0 = False, 1 = True + // 3 Wake due to PME (Not Network Wake): 0 = False, 1 = True + // 4 Internal BIOS bit PME (Known Network Wake): 0 = False, 1 = True (Reserved for Agent- Must be 0) + // 5 - 7 Reserved + // + Method (GPWR, 0, NotSerialized) + { + // + // Return Wake Reason + // + If(And(WKRS,0x2F)) + { + // + // Mask out the Internal BIOS Network PME bit and the reserved bits. + // + Return(And(WKRS, 0x2F)) + } + Else + { + Return(0) + } + } // Method (GPWR) + + // + // GPCS - Get Platform Component State + // Input: None + // Return: + // Bits Description + // 0 LID State: 0 - Closed, 1 - Open + // 1 - 7 Reserved + // + Method (GPCS, 0, NotSerialized) + { + // + // See if EC (0) or RTC (1) Timer + // + If (LEqual(ITMR, 0)) + { + If (CondRefOf(\_SB.PCI0.LPCB.H_EC.LSTE)) + { + Return(And(\_SB.PCI0.LPCB.H_EC.LSTE,0x01)) + } + } + Else + { + Return(1) + } + } // Method (GPCS) + + // + // GAWD - Get Isct Wake Duration + // Input: None + // Return: + // Bits Description + // 0 - 7 Isct Wake Duration + // + Method (GAWD, 0, NotSerialized) + { + Return (IWDT) + } + + // + // SAWD - Set Isct Wake Duration + // Input: + // Bits Description + // 0 - 7 Isct Wake Duration + // + Method (SAWD, 1, NotSerialized) + { + Store (Arg0, IWDT) + //TBD Set EC Watchdog Timer + } + + } // Device (IAOE) + } // Scope (\_SB) +} // End SSDT + +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + diff --git a/Board/EM/Isct/AcpiTables/Isct.cif b/Board/EM/Isct/AcpiTables/Isct.cif new file mode 100644 index 0000000..4a8df02 --- /dev/null +++ b/Board/EM/Isct/AcpiTables/Isct.cif @@ -0,0 +1,12 @@ +<component> + name = "IsctAcpiTables" + category = ModulePart + LocalRoot = "Board\EM\Isct\AcpiTables" + RefName = "IsctAcpiTables" +[files] +"Isct.sdl" +"Isct.mak" +"Isct.sd" +"Isct.uni" +"Isct.asl" +<endComponent> diff --git a/Board/EM/Isct/AcpiTables/Isct.mak b/Board/EM/Isct/AcpiTables/Isct.mak new file mode 100644 index 0000000..8b49139 --- /dev/null +++ b/Board/EM/Isct/AcpiTables/Isct.mak @@ -0,0 +1,115 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctAcpiTables/Isct.mak 2 5/27/13 10:54p Bensonlai $ +# +# $Revision: 2 $ +# +# $Date: 5/27/13 10:54p $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctAcpiTables/Isct.mak $ +# +# 2 5/27/13 10:54p Bensonlai +# [TAG] EIP125007 +# [Category] Improvement +# [Description] [ISCT] Change IASL compiler path +# +# 1 9/02/12 11:18p Bensonlai +# Intel Smart Connect Technology initially releases. +# +# +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: Isct.mak +# +# Description: Make file to build Isct ASL components +# +# +#<AMI_FHDR_END> +#********************************************************************** +all : BuildIsct + +BuildIsct : $(BUILD_DIR)\Isct.ffs + +#--------------------------------------------------------------------------- +# Generic AcpiPlatform dependencies +#--------------------------------------------------------------------------- +$(BUILD_DIR)\Isct.mak : $(INTEL_ISCT_DIR)\Isct.cif $(BUILD_RULES) + $(CIF2MAK) $(INTEL_ISCT_DIR)\Isct.cif $(CIF2MAK_DEFAULTS) + +#--------------------------------------------------------------------------- +# Create ISCT Setup Screens +#--------------------------------------------------------------------------- +SetupSdbs : $(BUILD_DIR)\Isct.mak ISCTSDB + +ISCTSDB : + $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\ + /f $(BUILD_DIR)\Isct.mak all \ + TYPE=SDB NAME=Isct STRING_CONSUMERS=$(INTEL_ISCT_DIR)\Isct.sd + +#----------------------------------------------------------------------- +# ASL compiler definition +#----------------------------------------------------------------------- +!IF "$(ACPIPLATFORM_ASL_COMPILER)"=="" +!ERROR It is an invalid path, please check your ASL compiler path. +!ENDIF + +IASL = $(ACPIPLATFORM_ASL_COMPILER) +#----------------------------------------------------------------------- +$(BUILD_DIR)\Isct.aml : $(ISCT_ASL_FILE) + @cl /C /EP $(ISCT_ASL_FILE) > $(BUILD_DIR)\Isct.asl + $(IASL) -p $(BUILD_DIR)\Isct.aml $(BUILD_DIR)\Isct.asl + +$(BUILD_DIR)\Isct.sec: $(BUILD_DIR)\Isct.aml + $(GENSECTION) -I $*.aml -O $@ -S EFI_SECTION_RAW + +#Note. Expand the package with Isct tables. +# DXE phase will load the tables +# and update Aml contents if provided in IsctAcpi.c + +$(BUILD_DIR)\Isct.ffs: $(BUILD_DIR)\Isct.sec + $(GENFFSFILE) -B $(BUILD_DIR) -V -o $@ -P1 <<$(BUILD_DIR)\Isct.pkg + +PACKAGE.INF +[.] +BASE_NAME = Isct +FFS_FILEGUID = FA2DDC38-3F19-4218-B53E-D9D79D626767 +FFS_FILETYPE = EFI_FV_FILETYPE_FREEFORM +FFS_ATTRIB_CHECKSUM = TRUE + +IMAGE_SCRIPT = +{ + Compress (dummy) { + $(PROJECT_DIR)\$(BUILD_DIR)\Isct.sec + } +} +<<KEEP + +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* diff --git a/Board/EM/Isct/AcpiTables/Isct.sd b/Board/EM/Isct/AcpiTables/Isct.sd new file mode 100644 index 0000000..9278d87 --- /dev/null +++ b/Board/EM/Isct/AcpiTables/Isct.sd @@ -0,0 +1,190 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctAcpiTables/Isct.sd 2 8/02/13 3:30a Joshchou $ +// +// $Revision: 2 $ +// +// $Date: 8/02/13 3:30a $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctAcpiTables/Isct.sd $ +// +// 2 8/02/13 3:30a Joshchou +// [TAG] None +// [Category] Improvement +// [Description] Hide the item of timer choice on the platforms which +// don't have EC +// +// 1 9/02/12 11:18p Bensonlai +// Intel Smart Connect Technology initially releases. +// +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: Isct.sd +// +// Description: Create the setup item for Isct. +// +//<AMI_FHDR_END> +//********************************************************************** + +#ifdef SETUP_DATA_DEFINITION +//--------------------------------------------------------------------------- +// Put NVRAM data definitions here. +// For example: UINT8 Data1; +// These definitions will be converted by the build process +// to a definitions of SETUP_DATA fields. +//--------------------------------------------------------------------------- + UINT8 IsctConfiguration; + UINT8 ISCTNOTIFICATION; + UINT8 ISCTWLAN; + UINT8 ISCTWWAN; + UINT8 ISCTRFKillSwitch; + UINT8 IsctTimerChoice; +#endif + +#if defined(VFRCOMPILE) && !defined(CONTROLS_ARE_DEFINED) +#define CONTROL_DEFINITION +#endif +//--------------------------------------------------------------------------- + +//--------------------------------------------------------------------------- +#ifdef CONTROL_DEFINITION + +#define ISCT_ONEOF_CONFIGURATION\ + oneof varid = SETUP_DATA.IsctConfiguration,\ + prompt = STRING_TOKEN(STR_ISCT_CONFIGURATION_PROMPT),\ + help = STRING_TOKEN(STR_ISCT_CONFIGURATION_HELP),\ + option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED, key = 0;\ + option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = RESET_REQUIRED, key = 0;\ + endoneof; + +#define ISCT_ONEOF_NOTIFICATION\ + oneof varid = SETUP_DATA.ISCTNOTIFICATION,\ + prompt = STRING_TOKEN(STR_ISCT_NOTIFICATION_PROMPT),\ + help = STRING_TOKEN(STR_ISCT_NOTIFICATION_HELP),\ + option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = RESET_REQUIRED, key = 0;\ + option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED, key = 0;\ + endoneof; + +#define ISCT_ONEOF_WLAN\ + oneof varid = SETUP_DATA.ISCTWLAN,\ + prompt = STRING_TOKEN(STR_ISCT_WLAN_PROMPT),\ + help = STRING_TOKEN(STR_ISCT_WLAN_HELP),\ + option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = RESET_REQUIRED, key = 0;\ + option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED, key = 0;\ + endoneof; + +#define ISCT_ONEOF_WWAN\ + oneof varid = SETUP_DATA.ISCTWWAN,\ + prompt = STRING_TOKEN(STR_ISCT_WWAN_PROMPT),\ + help = STRING_TOKEN(STR_ISCT_WWAN_HELP),\ + option text = STRING_TOKEN(STR_DISABLED), value = 0, flags = RESET_REQUIRED, key = 0;\ + option text = STRING_TOKEN(STR_ENABLED), value = 1, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED, key = 0;\ + endoneof; + +#define ISCT_ONEOF_RFKILLSWITCH\ + oneof varid = SETUP_DATA.ISCTRFKillSwitch,\ + prompt = STRING_TOKEN(STR_ISCT_RF_KILL_SWITCH_PROMPT),\ + help = STRING_TOKEN(STR_ISCT_RF_KILL_SWITCH_HELP),\ + option text = STRING_TOKEN(STR_ISCT_SOFTWARE), value = 0, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED, key = 0;\ + option text = STRING_TOKEN(STR_ISCT_HARDWARE), value = 1, flags = RESET_REQUIRED, key = 0;\ + endoneof; + +#define ISCT_ONEOF_TIMERCHIOICE\ + oneof varid = SETUP_DATA.IsctTimerChoice,\ + prompt = STRING_TOKEN(STR_ISCT_TIMER_SELECTION_PROMPT),\ + help = STRING_TOKEN(STR_ISCT_TIMER_SELECTION_HELP),\ + option text = STRING_TOKEN(STR_ISCT_EC_TIMER), value = 0, flags = DEFAULT | RESET_REQUIRED, key = 0;\ + option text = STRING_TOKEN(STR_ISCT_RTC_TIMER), value = 1, flags = MANUFACTURING | RESET_REQUIRED, key = 0;\ + endoneof; + +#endif // CONTROL_DEFINITION + +#ifdef CONTROLS_WITH_DEFAULTS + ISCT_ONEOF_CONFIGURATION + ISCT_ONEOF_NOTIFICATION + ISCT_ONEOF_WLAN + ISCT_ONEOF_WWAN + ISCT_ONEOF_RFKILLSWITCH + ISCT_ONEOF_TIMERCHIOICE +#endif // CONTROLS_WITH_DEFAULTS + +//--------------------------------------------------------------------------- +// ADVANCED - CRB Configuration Form +//--------------------------------------------------------------------------- +#ifdef ADVANCED_FORM_SET + + #ifndef SUPPRESS_GRAYOUT_ENDIF //old Core + #define SUPPRESS_GRAYOUT_ENDIF endif; + #endif + + #ifdef FORM_SET_GOTO + // Define goto commands for the forms defined in this file + goto ISCTCONFIGURATION_FORM_ID, + prompt = STRING_TOKEN(STR_ISCTCONFIGURATION_FORM), + help = STRING_TOKEN(STR_ISCTCONFIGURATION_HELP); + #endif + + #ifdef FORM_SET_FORM + // Define forms + #ifndef ISCTCONFIGURATION_FORM_SETUP + #define ISCTCONFIGURATION_FORM_SETUP + + form formid = AUTO_ID(ISCTCONFIGURATION_FORM_ID), + title = STRING_TOKEN(STR_ISCTCONFIGURATION_FORM); + + grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER; + ISCT_ONEOF_CONFIGURATION + endif; + + SEPARATOR + + grayoutif ideqval SYSTEM_ACCESS.Access == SYSTEM_PASSWORD_USER; + suppressif ideqval SETUP_DATA.IsctConfiguration == 0; + ISCT_ONEOF_NOTIFICATION + ISCT_ONEOF_WLAN + ISCT_ONEOF_WWAN + ISCT_ONEOF_RFKILLSWITCH + #if defined (PCH_SKU) && (PCH_SKU == 1) + #if defined (LVC_BOARD) && (LVC_BOARD == 0) + ISCT_ONEOF_TIMERCHIOICE + #endif + #endif + SUPPRESS_GRAYOUT_ENDIF + + endform; // ISCT_FORM_ID + + #endif // ISCTCONFIGURATION_FORM_SETUP + #endif // FORM_SET_FORM + +#endif // ADVANCED_FORM_SET + +//************************************************************************* +//************************************************************************* +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//************************************************************************* +//************************************************************************* diff --git a/Board/EM/Isct/AcpiTables/Isct.sdl b/Board/EM/Isct/AcpiTables/Isct.sdl new file mode 100644 index 0000000..7e60112 --- /dev/null +++ b/Board/EM/Isct/AcpiTables/Isct.sdl @@ -0,0 +1,99 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctAcpiTables/Isct.sdl 1 9/02/12 11:18p Bensonlai $ +# +# $Revision: 1 $ +# +# $Date: 9/02/12 11:18p $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctAcpiTables/Isct.sdl $ +# +# 1 9/02/12 11:18p Bensonlai +# Intel Smart Connect Technology initially releases. +# +# +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: Isct.sdl +# +# Description: SDL file for Isct +# +# +#<AMI_FHDR_END> +#********************************************************************** + +TOKEN + Name = "ISCT_SUPPORT" + Value = "1" + Help = "Always On Always Connected" + TokenType = Boolean + TargetMAK = Yes + TargetH = Yes + Master = Yes +End + +TOKEN + Name = "ISCT_ASL_FILE" + Value = "$(INTEL_ISCT_DIR)\Isct.asl" + TokenType = Expression + TargetMAK = Yes +End + +PATH + Name = "INTEL_ISCT_DIR" +End + +MODULE + Help = "Includes Isct.mak to Project" + File = "Isct.mak" +End + +ELINK + Name = "$(BUILD_DIR)\Isct.sdb" + Parent = "SETUP_SDBS" + Priority = 40 + InvokeOrder = AfterParent +End + +ELINK + Name = "$(INTEL_ISCT_DIR)\Isct.sd" + Parent = "SETUP_DEFINITIONS" + Priority = 40 + InvokeOrder = AfterParent +End + +ELINK + Name = "$(BUILD_DIR)\Isct.ffs" + Parent = "FV_MAIN" + InvokeOrder = AfterParent +End + +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* diff --git a/Board/EM/Isct/AcpiTables/Isct.uni b/Board/EM/Isct/AcpiTables/Isct.uni Binary files differnew file mode 100644 index 0000000..f295d22 --- /dev/null +++ b/Board/EM/Isct/AcpiTables/Isct.uni diff --git a/Board/EM/Isct/Dxe/IsctAcpi.c b/Board/EM/Isct/Dxe/IsctAcpi.c new file mode 100644 index 0000000..6809e27 --- /dev/null +++ b/Board/EM/Isct/Dxe/IsctAcpi.c @@ -0,0 +1,701 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctDxeAcpi/IsctAcpi.c 14 7/16/14 12:20a Mirayang $ +// +// $Revision: 14 $ +// +// $Date: 7/16/14 12:20a $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctDxeAcpi/IsctAcpi.c $ +// +// 14 7/16/14 12:20a Mirayang +// Add complete function with iRST. +// +// 13 7/11/14 10:51a Mirayang +// +// 12 7/11/14 10:30a Mirayang +// Fix iRST bulid error. +// +// 11 7/08/14 5:10a Mirayang +// EIP142924 iSCT 5.0 for Shark Bay Platform +// +// 10 5/13/14 4:51a Mirayang +// [TAG] EIP167033 +// [Category] Improvement +// [Description] Variable's attribute needs to be reviewed by iSCT +// component driver +// [Files] IsctAcpi.c +// +// 9 8/02/13 3:26a Joshchou +// +// 8 6/02/13 10:52a Joshchou +// [TAG] EIP125348 +// [Category] Improvement +// [Description] [SBY] Intel Smart Connect Technology BIOS Sample Code +// 052413 Update +// +// 7 3/27/13 9:14a Bensonlai +// [TAG] EIP118307 +// [Category] New Feature +// [Description] Implementation of the ISCT Platform Design +// Specification 0.8. +// [Files] Isct.asl, IsctAcpi.c, IsctAcpi.mak +// +// 6 12/05/12 3:32a Bensonlai +// [TAG] EIP107708 +// [Category] Bug Fix +// [Severity] Normal +// [Symptom] RTC can't wake +// [RootCause] RTC didn't support Actual time yet. +// [Solution] RTC only supports "duration in seconds". +// [Files] IsctAcpi.c +// +// 5 11/20/12 8:02a Bensonlai +// [TAG] None +// [Category] Improvement +// [Description] Because GlobalNvsArea.h has changed the ICNF to +// IsctCfg, we modified the ICNF to IsctCfg. +// +// 4 10/29/12 2:32a Bensonlai +// [TAG] EIP105047 +// [Category] Improvement +// [Description] ISCT build error when RapidStart_SUPPORT is Disabled in +// Sharkbay platform. +// +// 3 10/15/12 6:55a Bensonlai +// [TAG] None +// [Category] Improvement +// [Description] [Category] Improvement +// [Description] Rename the IFFS to RapidStart for updating the +// 4.6.5.3_iRST-RC_071_006 +// [Files] IsctAcpi.c +// +// 2 9/26/12 2:04a Bensonlai +// [TAG] None +// [Category] Bug Fix +// [Severity] Normal +// [Symptom] System hung up when ISCT enabled on the debug mode +// [RootCause] Because we don't check the EFI stauts and use the +// ASSERT_EFI_ERROR directly. +// [Solution] Added the EFI stauts for checking. +// [Files] IsctAcpi.c, IsctWakeReason.c and IsctWakeReason.c +// +// 1 9/02/12 11:19p Bensonlai +// Intel Smart Connect Technology initially releases. +// +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: IsctAcpi.c +// +// Description: This Dxe driver will initialize ISCT Persistent Data Variable and also verify ISCT Store valid or not +// +//<AMI_FHDR_END> +//********************************************************************** + +#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000) +#include "EdkIIGlueDxe.h" + + +#include EFI_GUID_DEFINITION (AcpiVariable) +#include EFI_GUID_DEFINITION (IsctAcpiTableStorage) +#include EFI_GUID_DEFINITION (IsctPersistentData) + +#include EFI_PROTOCOL_PRODUCER (IsctNvsArea) +#include EFI_PROTOCOL_CONSUMER (FirmwareVolume) +#include EFI_PROTOCOL_CONSUMER (IgdOpRegion) +#include EFI_PROTOCOL_DEPENDENCY (AcpiTable) + +#endif + +#include "IsctAcpi.h" +ISCT_NVS_AREA_PROTOCOL mIsctNvsAreaProtocol; + +// +// GUID to AMI_ISCT Module +// +#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000) + +#define AMI_ISCT_HOB_GUID \ + { \ + 0x1af7b744, 0xcdfc, 0x4825, 0xa1, 0x77, 0xca, 0x48, 0xd2, 0xdf, 0xe2, 0xc6 \ + } +#else +#define AMI_ISCT_HOB_GUID \ + { \ + 0x1af7b744, 0xcdfc, 0x4825, \ + { \ + 0xa1, 0x77, 0xca, 0x48, 0xd2, 0xdf, 0xe2, 0xc6 \ + } \ + } +#endif + +#pragma pack (1) + +typedef struct { + EFI_HOB_GUID_TYPE EfiHobGuidType; + UINT16 ISCT_PM1_STS; + UINT8 WakeReason; +} AMI_ISCT_HOB; + +#pragma pack ()\ + +EFI_STATUS +IsctDxeUpdateSetupVariableToACPIGNVS ( + IN OUT SETUP_DATA *gSetupData + ) +/*++ + +Routine Description: + + Update ISCT SetupVariable to ACPI GNVS + +Arguments: + +Returns: + + EFI_SUCCESS Isct ACPI GNVS are updated successfully + EFI_NOT_FOUND Isct ACPI GNVS not found + +--*/ +{ + EFI_STATUS Status; + EFI_GUID gEfiGlobalNvsAreaProtocolGuid = EFI_GLOBAL_NVS_AREA_PROTOCOL_GUID; + EFI_GLOBAL_NVS_AREA_PROTOCOL *GlobalNvsAreaProtocol; + EFI_GLOBAL_NVS_AREA *mGlobalNvsAreaPtr; + + Status = gBS->LocateProtocol( &gEfiGlobalNvsAreaProtocolGuid, NULL, &GlobalNvsAreaProtocol ); + if ( EFI_ERROR(Status) ) { + return Status; + } + mGlobalNvsAreaPtr = GlobalNvsAreaProtocol->Area; + + // + // Intel Smart Connect Technology 4.0 Spec (Document Number: 507302) + // + // Table 4-2. IAOE Control Method GABS + // Bit0 Intel Smart Connect Technology Configured: 0 = Disabled, 1 = Enabled + // Bit1 Intel Smart Connect Technology Notification Control: 0 = Unsupported, 1 = Supported + // Bit2 Intel Smart Connect Technology WLAN Power Control:0 = Unsupported, 1 = Supported + // Bit3 Intel Smart Connect Technology WWAN Power Control: 0 = Unsupported, 1 = Supported + // Bit4 Must be set to 1 + // Bit5 Sleep duration value format: 0 = Actual time, 1 = duration in seconds (see SASD for actual format) + // Bit6 RF Kill Support (Radio On/Off): 0 = Soft Switch, 1 = Physical Switch + // Bit7 Reserved (must set to 0) + // + // ISCT configuration + // + mGlobalNvsAreaPtr->IsctCfg = 0; + if (gSetupData->IsctConfiguration) { + mGlobalNvsAreaPtr->IsctCfg = mGlobalNvsAreaPtr->IsctCfg | BIT0; + + if (gSetupData->ISCTNOTIFICATION) { + mGlobalNvsAreaPtr->IsctCfg = mGlobalNvsAreaPtr->IsctCfg | BIT1; + } + if (gSetupData->ISCTWLAN) { + mGlobalNvsAreaPtr->IsctCfg = mGlobalNvsAreaPtr->IsctCfg | BIT2; + } + if (gSetupData->ISCTWWAN) { + mGlobalNvsAreaPtr->IsctCfg = mGlobalNvsAreaPtr->IsctCfg | BIT3; + } + mGlobalNvsAreaPtr->IsctCfg = mGlobalNvsAreaPtr->IsctCfg | BIT4; + mGlobalNvsAreaPtr->IsctCfg = mGlobalNvsAreaPtr->IsctCfg | BIT5; // Duration in seconds + + if (gSetupData->ISCTRFKillSwitch) { + mGlobalNvsAreaPtr->IsctCfg = mGlobalNvsAreaPtr->IsctCfg | BIT6; + } +// ami override start + mGlobalNvsAreaPtr->IsctCfg |= BIT7; // Isct Wake from S4 Supported +// ami override end + } + + return Status; +} + +STATIC +EFI_STATUS +InitializeIsctAcpiTables ( + VOID + ) +/*++ + +Routine Description: + + Initialize ISCT ACPI tables + +Arguments: + +Returns: + + EFI_SUCCESS Isct ACPI tables are initialized successfully + EFI_NOT_FOUND Isct ACPI tables not found + +--*/ +{ + EFI_STATUS Status; + EFI_HANDLE *HandleBuffer; + UINTN NumberOfHandles; + EFI_FV_FILETYPE FileType; + UINT32 FvStatus; + EFI_FV_FILE_ATTRIBUTES Attributes; + UINTN Size; + UINTN Index; + EFI_FIRMWARE_VOLUME_PROTOCOL *FwVol; + INTN Instance; + EFI_ACPI_COMMON_HEADER *CurrentTable; + UINT8 *CurrPtr; + UINT8 *EndPtr; + UINT32 *Signature; + EFI_ACPI_DESCRIPTION_HEADER *IsctAcpiTable; + BOOLEAN LoadTable; + UINTN TableHandle; + EFI_ACPI_TABLE_VERSION Version; + EFI_ACPI_TABLE_PROTOCOL *AcpiTable; + + FwVol = NULL; + IsctAcpiTable = NULL; + + Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, &AcpiTable); + if ( EFI_ERROR(Status) ) { + DEBUG((EFI_D_INFO, "ISCT :gBS->LocateProtocol -> AcpiTable Status = %x\n", Status)); + return Status; + } + + // + // Locate protocol. + // There is little chance we can't find an FV protocol + // + Status = gBS->LocateHandleBuffer ( + ByProtocol, + &gEfiFirmwareVolumeProtocolGuid, + NULL, + &NumberOfHandles, + &HandleBuffer + ); + if ( EFI_ERROR(Status) ) { + DEBUG((EFI_D_INFO, "ISCT :gBS->LocateHandleBuffer Status = %x\n", Status)); + return Status; + } + + // + // Looking for FV with ACPI storage file + // + for (Index = 0; Index < NumberOfHandles; Index++) { + // + // Get the protocol on this handle + // This should not fail because of LocateHandleBuffer + // + Status = gBS->HandleProtocol ( + HandleBuffer[Index], + &gEfiFirmwareVolumeProtocolGuid, + &FwVol + ); + if ( EFI_ERROR(Status) ) { + DEBUG((EFI_D_INFO, "ISCT :gBS->HandleProtocol Status = %x\n", Status)); + return Status; + } + + // + // See if it has the ACPI storage file + // + Size = 0; + FvStatus = 0; + Status = FwVol->ReadFile ( + FwVol, + &gIsctAcpiTableStorageGuid, + NULL, + &Size, + &FileType, + &Attributes, + &FvStatus + ); + DEBUG((EFI_D_INFO, "ISCT :FwVol->ReadFile Status = %x\n", Status)); + // + // If we found it, then we are done + // + if (Status == EFI_SUCCESS) { + break; + } + } + // + // Free any allocated buffers + // + FreePool (HandleBuffer); + + // + // Sanity check that we found our data file + // + if (FwVol == NULL) { + return EFI_NOT_FOUND; + } + // + // By default, a table belongs in all ACPI table versions published. + // + Version = EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0; + + // + // Our exit status is determined by the success of the previous operations + // If the protocol was found, Instance already points to it. + // Read tables from the storage file. + // + Instance = 0; + CurrentTable = NULL; + while (Status == EFI_SUCCESS) { + Status = FwVol->ReadSection ( + FwVol, + &gIsctAcpiTableStorageGuid, + EFI_SECTION_RAW, + Instance, + &CurrentTable, + &Size, + &FvStatus + ); + DEBUG((EFI_D_INFO, "ISCT :FwVol->ReadSection Status = %x\n", Status)); + + if (!EFI_ERROR (Status)) { + LoadTable = FALSE; + // + // Check the table ID to modify the table + // + if (((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->OemTableId == EFI_SIGNATURE_64 ('I', 's', 'c', 't', 'T', 'a', 'b', 'l')) { + IsctAcpiTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable; + DEBUG((EFI_D_ERROR, "ISCT :Find out IsctTabl\n")); + // + // Locate the SSDT package + // + CurrPtr = (UINT8 *) IsctAcpiTable; + EndPtr = CurrPtr + IsctAcpiTable->Length; + + for (; CurrPtr <= EndPtr; CurrPtr++) { + Signature = (UINT32 *) (CurrPtr + 3); + if (*Signature == EFI_SIGNATURE_32 ('I', 'S', 'C', 'T')) { + LoadTable = TRUE; + if((*(UINT32 *) (CurrPtr + 3 + sizeof (*Signature) + 2) == 0xFFFF0008)) { + // + // ISCT NVS Area address + // + *(UINT32 *) (CurrPtr + 3 + sizeof (*Signature) + 2) = (UINT32) (UINTN) mIsctNvsAreaProtocol.Area; + DEBUG((EFI_D_INFO, "ISCT :Modify OpRegion Address to %x\n", (*(UINT32 *) (CurrPtr + 3 + sizeof (*Signature) + 2)))); + } + + if((*(UINT16 *) (CurrPtr + 3 + sizeof (*Signature) + 2 + sizeof (UINT32) + 1) == 0xAA58)) { + // + // ISCT NVS Area size + // + *(UINT16 *) (CurrPtr + 3 + sizeof (*Signature) + 2 + sizeof (UINT32) + 1) = sizeof (ISCT_NVS_AREA); + DEBUG((EFI_D_INFO, "ISCT :Modify OpRegion Size to %x\n", *(UINT16 *) (CurrPtr + 3 + sizeof (*Signature) + 2 + sizeof (UINT32) + 1))); + } + + /// + /// Add the table + /// + if (LoadTable) { + TableHandle = 0; + Status = AcpiTable->InstallAcpiTable ( + AcpiTable, + CurrentTable, + CurrentTable->Length, + &TableHandle + ); + if ( EFI_ERROR(Status) ) { + return Status; + } + } + return EFI_SUCCESS; + } + } + } + // + // Increment the instance + // + Instance++; + CurrentTable = NULL; + } + } + + return Status; +} + +VOID +IsctOnReadyToBoot ( + IN EFI_EVENT Event, + IN VOID *Context + ) +/*++ + +Routine Description: + + Install Isct ACPI tables only when Isct is enabled + +Arguments: + + Event - The event that triggered this notification function + Context - Pointer to the notification functions context + +Returns: + + None + +--*/ +{ + EFI_STATUS Status; + IGD_OPREGION_PROTOCOL *IgdOpRegionProtocol; + + DEBUG ((EFI_D_INFO, "IsctOnReadyToBoot()\n")); + + Status = InitializeIsctAcpiTables (); + if ( EFI_ERROR(Status) ) { + DEBUG((EFI_D_INFO, "Initializes ISCT SSDT tables Status = %x\n", Status)); + return; + } + + gBS->CloseEvent (Event); + + // + // Notify the Graphics Driver that Isct is enabled + // + Status = gBS->LocateProtocol ( + &gIgdOpRegionProtocolGuid, + NULL, + &IgdOpRegionProtocol + ); + if (Status == EFI_SUCCESS) { + IgdOpRegionProtocol->OpRegion->Header.PCON |= 0x60; + DEBUG((EFI_D_INFO, "IsctOnReadyToBoot() PCON = 0x%x\n", IgdOpRegionProtocol->OpRegion->Header.PCON)); + } else { + DEBUG ((EFI_D_ERROR, "IsctOnReadyToBoot() Unable to locate IgdOpRegionProtocol")); + } +} + +EFI_STATUS +IsctDxeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +/*++ + +Routine Description: + + ISCT DXE driver entry point function + +Arguments: + + ImageHandle - Image handle for this driver image + SystemTable - Pointer to the EFI System Table + +Returns: + + EFI_OUT_OF_RESOURCES - no enough memory resource when installing reference code information protocol + EFI_SUCCESS - function completed successfully + +--*/ +{ + EFI_STATUS Status; + EFI_EVENT Event; + PLATFORM_INFO_PROTOCOL *PlatformInfoProtocol; + ISCT_NVS_AREA *IsctNvs; + ISCT_PERSISTENT_DATA mIsctData; + UINT8 IsctEnabled; + AMI_ISCT_HOB *IsctDataHob; + EFI_GUID SetupGuid = SYSTEM_CONFIGURATION_GUID; + SETUP_DATA SetupData; + UINTN VarSize; + VOID *HobList; + EFI_GUID gIsctDataHobGuid = AMI_ISCT_HOB_GUID; + + DEBUG ((EFI_D_INFO, "IsctDxe: Entry Point...\n")); + + VarSize = sizeof (SETUP_DATA); + Status = gRT->GetVariable ( + L"Setup", + &SetupGuid, + NULL, + &VarSize, + &SetupData + ); + if ( EFI_ERROR(Status) ) { + DEBUG ((EFI_D_INFO, "ISCT: Get Variable Status = %x\n", Status)); + return Status; + } + + IsctEnabled = SetupData.IsctConfiguration; + + if(IsctEnabled == 0) { + DEBUG ((EFI_D_INFO, "ISCT is Disabled \n")); + return EFI_SUCCESS; + } + + Status = gBS->LocateProtocol ( + &gPlatformInfoProtocolGuid, + NULL, + &PlatformInfoProtocol + ); + if ( EFI_ERROR(Status) ) { + return Status; + } + + // + // Allocate pools for ISCT Global NVS area + // + Status = (gBS->AllocatePool) (EfiReservedMemoryType, sizeof (ISCT_NVS_AREA), &mIsctNvsAreaProtocol.Area); + if ( EFI_ERROR (Status) ) { + DEBUG ((EFI_D_ERROR, "Error to allocate pool for ISCT_NVS_AREA")); + ASSERT_EFI_ERROR (Status); + return Status; + } + ZeroMem ((VOID *) mIsctNvsAreaProtocol.Area, sizeof (ISCT_NVS_AREA)); + +//ami override start +// Status = (gBS->AllocatePool) (EfiReservedMemoryType, sizeof (ISCT_PERSISTENT_DATA), &mIsctNvsAreaProtocol.IsctData); +// if ( EFI_ERROR (Status) ) { +// DEBUG ((EFI_D_ERROR, "Error to allocate pool for ISCT_PERSISTENT_DATA")); +// ASSERT_EFI_ERROR (Status); +// return Status; +// } +// ZeroMem ((VOID *) mIsctNvsAreaProtocol.IsctData, sizeof (ISCT_PERSISTENT_DATA)); +//ami override end + + IsctNvs = mIsctNvsAreaProtocol.Area; + +//ami override start +// IsctNvs->IsctNvsPtr = (UINT32) (UINTN) IsctNvs; +//ami override end + // + // Isct WA: Add option for use of RTC timer on Mobile systems until EC wake through GP27 is working + // + IsctNvs->IsctTimerChoice = SetupData.IsctTimerChoice; //get timer choice from setup options + if(PlatformInfoProtocol->PlatformFlavor == FlavorDesktop) { + IsctNvs->IsctTimerChoice = 1; //use RTC timer for Desktop + } +#if defined (LVC_BOARD) && (LVC_BOARD == 1) + IsctNvs->IsctTimerChoice = 1; //use RTC timer for Lava Cayon Crb +#endif + + + IsctNvs->IsctEnabled = 1; +#ifdef RAPID_START_FLAG + IsctNvs->RapidStartEnabled = SetupData.RapidStartEnabled; +#else + IsctNvs->RapidStartEnabled = 0; +#endif + +//ami override start + // + // Assign IsctData pointer to GlobalNvsArea + // + mIsctData.IsctNvsPtr = (UINT32) (UINTN) IsctNvs; + mIsctData.IsctOverWrite = FALSE; +//ami override end + + // + // Look for Isct Data Hob + // + IsctDataHob = NULL; + Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, &HobList); + DEBUG ((EFI_D_INFO, "Get Isct Data HOB, Guid:%g \n", gIsctDataHobGuid)); + IsctDataHob = (AMI_ISCT_HOB*)GetNextGuidHob (&gIsctDataHobGuid, HobList); + if (IsctDataHob == NULL) { + DEBUG ((EFI_D_ERROR, "Isct Data HOB not available\n")); + return EFI_NOT_FOUND; + } + + // + // Populate wake reason with hob data. Will be 0 for S5. + // + + IsctNvs->IsctWakeReason = IsctDataHob->WakeReason; + DEBUG ((EFI_D_INFO, "Isct Data HOB found- Update Isct NVS with Wake Reason: %x\n", IsctNvs->IsctWakeReason)); + + + + // + // Install ISCT Global NVS protocol + // + Status = gBS->InstallMultipleProtocolInterfaces ( + &ImageHandle, + &gIsctNvsAreaProtocolGuid, + &mIsctNvsAreaProtocol, + NULL + ); + DEBUG((EFI_D_INFO, "Install IsctNvsAreaProtocolGuid = 0x%x\n", Status)); + + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_ERROR, "Error to install ISCT_NVS_AREA_PROTOCOL")); + ASSERT_EFI_ERROR (Status); + return Status; + } + + // + // Save ISCT Data to Variable + // + Status = gRT->SetVariable ( + ISCT_PERSISTENT_DATA_NAME, + &gIsctPersistentDataGuid, + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + sizeof (ISCT_PERSISTENT_DATA), + &mIsctData + ); + if (EFI_ERROR (Status)) { + DEBUG((EFI_D_INFO, "ISCT DXE: Save ISCT Data to Variable Status = %x\n", Status)); + return Status; + } + + // + // Update SetupVariable to ACPI GNVS + // + Status = IsctDxeUpdateSetupVariableToACPIGNVS (&SetupData); + if ( EFI_ERROR(Status) ) { + return Status; + } + + // + // Register ready to boot event for ISCT + // + + Status = EfiCreateEventReadyToBootEx ( + EFI_TPL_NOTIFY, + IsctOnReadyToBoot, + NULL, + &Event + ); + DEBUG((EFI_D_INFO, "Create ReadyToBoot event for ISCT Status = %x\n", Status)); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + + + DEBUG ((EFI_D_INFO, "(IsctDxe) entry End...\n")); + + return EFI_SUCCESS; +} + +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** diff --git a/Board/EM/Isct/Dxe/IsctAcpi.cif b/Board/EM/Isct/Dxe/IsctAcpi.cif new file mode 100644 index 0000000..9a52eb6 --- /dev/null +++ b/Board/EM/Isct/Dxe/IsctAcpi.cif @@ -0,0 +1,12 @@ +<component> + name = "IsctDxeAcpi" + category = ModulePart + LocalRoot = "Board\EM\Isct\Dxe" + RefName = "IsctAcpi" +[files] +"IsctAcpi.c" +"IsctAcpi.h" +"IsctAcpi.sdl" +"IsctAcpi.dxs" +"IsctAcpi.mak" +<endComponent> diff --git a/Board/EM/Isct/Dxe/IsctAcpi.dxs b/Board/EM/Isct/Dxe/IsctAcpi.dxs new file mode 100644 index 0000000..046b302 --- /dev/null +++ b/Board/EM/Isct/Dxe/IsctAcpi.dxs @@ -0,0 +1,77 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctDxeAcpi/IsctAcpi.dxs 1 9/02/12 11:19p Bensonlai $ +// +// $Revision: 1 $ +// +// $Date: 9/02/12 11:19p $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctDxeAcpi/IsctAcpi.dxs $ +// +// 1 9/02/12 11:19p Bensonlai +// Intel Smart Connect Technology initially releases. +// +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: IsctAcpi.dxs +// +// Description: Dependency expression file for IsctAcpi Driver. +// +//<AMI_FHDR_END> +//********************************************************************** + +#include "AutoGen.h" +#include "DxeDepex.h" +#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB) +#include "EfiDepex.h" + +#if (EFI_SPECIFICATION_VERSION >= 0x0002000A) +#include EFI_PROTOCOL_DEPENDENCY (AcpiTable) +#else +#include EFI_PROTOCOL_DEPENDENCY (AcpiSupport) +#endif +#include EFI_PROTOCOL_DEPENDENCY (FirmwareVolume) +#include EFI_PROTOCOL_DEPENDENCY (GlobalNvsArea) + +#endif + +DEPENDENCY_START +#if (EFI_SPECIFICATION_VERSION >= 0x0002000A) + EFI_ACPI_TABLE_PROTOCOL_GUID AND +#else + EFI_ACPI_SUPPORT_GUID AND +#endif + EFI_GLOBAL_NVS_AREA_PROTOCOL_GUID AND + EFI_FIRMWARE_VOLUME_PROTOCOL_GUID +DEPENDENCY_END + +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** diff --git a/Board/EM/Isct/Dxe/IsctAcpi.h b/Board/EM/Isct/Dxe/IsctAcpi.h new file mode 100644 index 0000000..1dd5a0a --- /dev/null +++ b/Board/EM/Isct/Dxe/IsctAcpi.h @@ -0,0 +1,146 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctDxeAcpi/IsctAcpi.h 2 6/02/13 10:52a Joshchou $ +// +// $Revision: 2 $ +// +// $Date: 6/02/13 10:52a $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctDxeAcpi/IsctAcpi.h $ +// +// 2 6/02/13 10:52a Joshchou +// [TAG] EIP125348 +// [Category] Improvement +// [Description] [SBY] Intel Smart Connect Technology BIOS Sample Code +// 052413 Update +// +// 1 9/02/12 11:19p Bensonlai +// Intel Smart Connect Technology initially releases. +// +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: IsctAcpi.h +// +// Description: AMI Override for IsctAcpi +// +//<AMI_FHDR_END> +//********************************************************************** + +// +// AMI Override for ISCT +// + +#ifndef _ISCTACPI_H_ +#define _ISCTACPI_H_ + +#include <token.h> +#include <SetupDataDefinition.h> +#define SYSTEM_CONFIGURATION_GUID { 0xEC87D643, 0xEBA4, 0x4BB5, 0xA1, 0xE5, 0x3F, 0x3E, 0x36, 0xB2, 0x0D, 0xA9 } + +#include "Board\EM\Platform\PlatformInfo\PlatformInfo.h" +#include EFI_PROTOCOL_PRODUCER (GlobalNvsArea) + +EFI_GUID gPlatformInfoProtocolGuid = EFI_PLATFORM_INFO_PROTOCOL_GUID; +EFI_GUID gIsctNvsAreaProtocolGuid = ISCT_NVS_AREA_PROTOCOL_GUID; +EFI_GUID gIsctPersistentDataGuid = ISCT_PERSISTENT_DATA_GUID; + + +#ifndef BIT0 +#define BIT0 0x0001 +#define BIT1 0x0002 +#define BIT2 0x0004 +#define BIT3 0x0008 +#define BIT4 0x0010 +#define BIT5 0x0020 +#define BIT6 0x0040 +#define BIT7 0x0080 +#define BIT8 0x0100 +#define BIT9 0x0200 +#define BIT10 0x0400 +#define BIT11 0x0800 +#define BIT12 0x1000 +#define BIT13 0x2000 +#define BIT14 0x4000 +#define BIT15 0x8000 +#define BIT16 0x00010000 +#define BIT17 0x00020000 +#define BIT18 0x00040000 +#define BIT19 0x00080000 +#define BIT20 0x00100000 +#define BIT21 0x00200000 +#define BIT22 0x00400000 +#define BIT23 0x00800000 +#define BIT24 0x01000000 +#define BIT25 0x02000000 +#define BIT26 0x04000000 +#define BIT27 0x08000000 +#define BIT28 0x10000000 +#define BIT29 0x20000000 +#define BIT30 0x40000000 +#define BIT31 0x80000000 +#define BIT32 0x100000000 +#define BIT33 0x200000000 +#define BIT34 0x400000000 +#define BIT35 0x800000000 +#define BIT36 0x1000000000 +#define BIT37 0x2000000000 +#define BIT38 0x4000000000 +#define BIT39 0x8000000000 +#define BIT40 0x10000000000 +#define BIT41 0x20000000000 +#define BIT42 0x40000000000 +#define BIT43 0x80000000000 +#define BIT44 0x100000000000 +#define BIT45 0x200000000000 +#define BIT46 0x400000000000 +#define BIT47 0x800000000000 +#define BIT48 0x1000000000000 +#define BIT49 0x2000000000000 +#define BIT50 0x4000000000000 +#define BIT51 0x8000000000000 +#define BIT52 0x10000000000000 +#define BIT53 0x20000000000000 +#define BIT54 0x40000000000000 +#define BIT55 0x80000000000000 +#define BIT56 0x100000000000000 +#define BIT57 0x200000000000000 +#define BIT58 0x400000000000000 +#define BIT59 0x800000000000000 +#define BIT60 0x1000000000000000 +#define BIT61 0x2000000000000000 +#define BIT62 0x4000000000000000 +#define BIT63 0x8000000000000000 +#endif + +#endif + +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** diff --git a/Board/EM/Isct/Dxe/IsctAcpi.mak b/Board/EM/Isct/Dxe/IsctAcpi.mak new file mode 100644 index 0000000..c221e2e --- /dev/null +++ b/Board/EM/Isct/Dxe/IsctAcpi.mak @@ -0,0 +1,127 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctDxeAcpi/IsctAcpi.mak 3 7/11/14 10:37a Mirayang $ +# +# $Revision: 3 $ +# +# $Date: 7/11/14 10:37a $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctDxeAcpi/IsctAcpi.mak $ +# +# 3 7/11/14 10:37a Mirayang +# Fix iRST bulid error. +# +# 2 3/27/13 9:14a Bensonlai +# [TAG] EIP118307 +# [Category] New Feature +# [Description] Implementation of the ISCT Platform Design +# Specification 0.8. +# [Files] Isct.asl, IsctAcpi.c, IsctAcpi.mak +# +# 1 9/02/12 11:19p Bensonlai +# Intel Smart Connect Technology initially releases. +# +# +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: IsctAcpi.mak +# +# Description: Make file to build IsctAcpi components +# +# +#<AMI_FHDR_END> +#********************************************************************** + +all : IsctAcpi + +IsctAcpi : $(BUILD_DIR)\IsctAcpi.mak IsctAcpi_Bin + +$(BUILD_DIR)\IsctAcpi.mak : $(IsctAcpi_DIR)\$(@B).cif $(IsctAcpi_DIR)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(IsctAcpi_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) + +IsctAcpi_INCLUDES=\ + $(EdkIIGlueLib_INCLUDES)\ + $(EDK_INCLUDES)\ + $(PLATFORM_INFO_PROTOCOL_INCLUDES)\ + /I$(ISCT_PLATFORM_DIR)\ + /I$(IntelPlatformProtocolLib_DIR)\ + $(INTEL_MCH_INCLUDES)\ + +IsctAcpi_LIBS=\ + $(EDKPROTOCOLLIB)\ + $(EFIGUIDLIB)\ + $(EdkIIGlueBaseLib_LIB)\ +!IF "$(x64_BUILD)"=="1" + $(EdkIIGlueBaseLibX64_LIB)\ +!ELSE + $(EdkIIGlueBaseLibIA32_LIB)\ +!ENDIF + $(EDKFRAMEWORKGUIDLIB)\ + $(EDKFRAMEWORKPROTOCOLLIB)\ + $(EdkIIGlueBaseIoLibIntrinsic_LIB)\ + $(EdkIIGlueBaseMemoryLib_LIB)\ + $(EdkIIGlueDxeReportStatusCodeLib_LIB)\ + $(EdkIIGlueDxeServicesTableLib_LIB)\ + $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\ + $(EdkIIGlueUefiBootServicesTableLib_LIB)\ + $(EdkIIGlueUefiDevicePathLib_LIB)\ + $(EdkIIGlueBasePciLibPciExpress_LIB)\ + $(EdkIIGlueEdkDxeRuntimeDriverLib_LIB)\ + $(IsctGuidLib_LIB)\ + $(IsctProtocolLib_LIB)\ + $(EdkIIGlueDxeHobLib_LIB)\ + $(INTEL_SA_PROTOCOL_LIB)\ + +IsctAcpi_DEFINES=\ + $(MY_DEFINES)\ + /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=IsctDxeEntryPoint"\ + /D __EDKII_GLUE_BASE_MEMORY_LIB__ \ + /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \ + /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \ + /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\ + /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \ + /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \ + /D __EDKII_GLUE_DXE_HOB_LIB__ \ + +IsctAcpi_Bin : $(IsctAcpi_LIBS) + $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\ + /f $(BUILD_DIR)\IsctAcpi.mak all\ + "MY_INCLUDES=$(IsctAcpi_INCLUDES)"\ + "MY_DEFINES=$(IsctAcpi_DEFINES)"\ + GUID=4839023B-4C12-4EB2-B2B8-C91B42D878A0 \ + ENTRY_POINT=_ModuleEntryPoint \ + EDKIIModule=DXEDRIVER\ + TYPE=BS_DRIVER \ + DEPEX1=$(IsctAcpi_DIR)\IsctAcpi.dxs \ + DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \ + COMPRESS=1\ + +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* diff --git a/Board/EM/Isct/Dxe/IsctAcpi.sdl b/Board/EM/Isct/Dxe/IsctAcpi.sdl new file mode 100644 index 0000000..ba8ec59 --- /dev/null +++ b/Board/EM/Isct/Dxe/IsctAcpi.sdl @@ -0,0 +1,78 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctDxeAcpi/IsctAcpi.sdl 1 9/02/12 11:19p Bensonlai $ +# +# $Revision: 1 $ +# +# $Date: 9/02/12 11:19p $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctDxeAcpi/IsctAcpi.sdl $ +# +# 1 9/02/12 11:19p Bensonlai +# Intel Smart Connect Technology initially releases. +# +# +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: IsctAcpi.sdl +# +# Description: SDL file for IsctAcpi +# +# +#<AMI_FHDR_END> +#********************************************************************** + +TOKEN + Name = "IsctAcpi_SUPPORT" + Value = "1" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + TargetH = Yes + Master = Yes + Help = "Main switch to enable ISCT support in Project in DXE Phase" +End + +MODULE + File = "IsctAcpi.mak" + Help = "Includes IsctAcpi.mak to Project" +End + +PATH + Name = "IsctAcpi_DIR" +End + +ELINK + Name = "$(BUILD_DIR)\IsctAcpi.ffs" + Parent = "FV_MAIN" + InvokeOrder = AfterParent +End +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* diff --git a/Board/EM/Isct/Guid/IsctAcpiTableStorage/IsctAcpiTableStorage.c b/Board/EM/Isct/Guid/IsctAcpiTableStorage/IsctAcpiTableStorage.c new file mode 100644 index 0000000..7ba5953 --- /dev/null +++ b/Board/EM/Isct/Guid/IsctAcpiTableStorage/IsctAcpiTableStorage.c @@ -0,0 +1,69 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctGuidLib/IsctAcpiTableStorage/IsctAcpiTableStorage.c 1 9/02/12 11:20p Bensonlai $ +// +// $Revision: 1 $ +// +// $Date: 9/02/12 11:20p $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctGuidLib/IsctAcpiTableStorage/IsctAcpiTableStorage.c $ +// +// 1 9/02/12 11:20p Bensonlai +// Intel Smart Connect Technology initially releases. +// +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: IsctAcpiTableStorage.c +// +// Description: The GUID definition for Isct ACPI table storage file name +// +//<AMI_FHDR_END> +//********************************************************************** + +// +// Statements that include other files +// +#include "EdkIIGlueDxe.h" +#include "IsctAcpiTableStorage.h" + +// +// Protocol GUID definition +// +EFI_GUID gIsctAcpiTableStorageGuid = ISCT_ACPI_TABLE_STORAGE_GUID; + +// +// Protocol description +// +EFI_GUID_STRING + (&gIsctAcpiTableStorageGuid, "Isct ACPI Table Storage File Name", "Isct ACPI Table Storage file name GUID"); + +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** diff --git a/Board/EM/Isct/Guid/IsctAcpiTableStorage/IsctAcpiTableStorage.h b/Board/EM/Isct/Guid/IsctAcpiTableStorage/IsctAcpiTableStorage.h new file mode 100644 index 0000000..822c7a6 --- /dev/null +++ b/Board/EM/Isct/Guid/IsctAcpiTableStorage/IsctAcpiTableStorage.h @@ -0,0 +1,64 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctGuidLib/IsctAcpiTableStorage/IsctAcpiTableStorage.h 1 9/02/12 11:20p Bensonlai $ +// +// $Revision: 1 $ +// +// $Date: 9/02/12 11:20p $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctGuidLib/IsctAcpiTableStorage/IsctAcpiTableStorage.h $ +// +// 1 9/02/12 11:20p Bensonlai +// Intel Smart Connect Technology initially releases. +// +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: IsctAcpiTableStorage.h +// +// Description: GUID definition for the Isct ACPI table storage file name +// +//<AMI_FHDR_END> +//********************************************************************** + +#ifndef _ISCT_ACPI_TABLE_STORAGE_H_ +#define _ISCT_ACPI_TABLE_STORAGE_H_ +//FA2DDC38-3F19-4218-B53E-D9D79D626767 +#define ISCT_ACPI_TABLE_STORAGE_GUID \ + { \ + 0xfa2ddc38, 0x3f19, 0x4218, 0xb5, 0x3e, 0xd9, 0xd7, 0x9d, 0x62, 0x67, 0x67 \ + } + +extern EFI_GUID gIsctAcpiTableStorageGuid; + +#endif + +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** diff --git a/Board/EM/Isct/Guid/IsctGuidLib.cif b/Board/EM/Isct/Guid/IsctGuidLib.cif new file mode 100644 index 0000000..153db99 --- /dev/null +++ b/Board/EM/Isct/Guid/IsctGuidLib.cif @@ -0,0 +1,14 @@ +<component> + name = "IsctGuidLib" + category = ModulePart + LocalRoot = "Board\EM\Isct\Guid" + RefName = "IsctGuidLib" +[files] +"IsctGuidLib.sdl" +"IsctGuidLib.mak" +"IsctGuidLib.inf" +"IsctAcpiTableStorage\IsctAcpiTableStorage.c" +"IsctAcpiTableStorage\IsctAcpiTableStorage.h" +"IsctPersistentData\IsctPersistentData.c" +"IsctPersistentData\IsctPersistentData.h" +<endComponent> diff --git a/Board/EM/Isct/Guid/IsctGuidLib.inf b/Board/EM/Isct/Guid/IsctGuidLib.inf new file mode 100644 index 0000000..b361803 --- /dev/null +++ b/Board/EM/Isct/Guid/IsctGuidLib.inf @@ -0,0 +1,68 @@ +# +# This file contains a 'Sample Driver' and is licensed as such +# under the terms of your license agreement with Intel or your +# vendor. This file may be modified by the user, subject to +# the additional terms of the license agreement +# +#/*++ +# +# Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved +# This software and associated documentation (if any) is furnished +# under a license and may only be used or copied in accordance +# with the terms of the license. Except as permitted by such +# license, no part of this software or documentation may be +# reproduced, stored in a retrieval system, or transmitted in any +# form or by any means without the express written consent of +# Intel Corporation. +# +# Module Name: +# +# PlatformPolicyUpdatePeiLib.inf +# +# Abstract: +# +# Component description file for PEI DxePlatformPolicyUpdateLib Library +# +#--*/ + +[defines] +BASE_NAME = IsctGuidLib +COMPONENT_TYPE = LIBRARY + +[sources.common] + IsctAcpiTableStorage\IsctAcpiTableStorage.c + IsctAcpiTableStorage\IsctAcpiTableStorage.h + IsctPersistentData\IsctPersistentData.c + IsctPersistentData\IsctPersistentData.h + +[sources.ia32] + +[sources.x64] + +[sources.ipf] + +[includes.common] + . + $(BUILD_DIR)\$(PROCESSOR) + $(EDK_SOURCE)\Foundation\Efi + $(EDK_SOURCE)\Foundation\Include + $(EDK_SOURCE)\Foundation\Efi\Include + $(EDK_SOURCE)\Foundation\Framework\Include + +# +# EDK II Glue Library utilizes some standard headers from EDK +# + $(EFI_SOURCE) + $(EDK_SOURCE)\Foundation + $(EDK_SOURCE)\Foundation\Framework + $(EDK_SOURCE)\Foundation\Include\IndustryStandard + $(EDK_SOURCE)\Foundation\Core\Dxe + $(EDK_SOURCE)\Foundation\Include\Pei + $(EDK_SOURCE)\Foundation\Library\Pei\Include + $(EDK_SOURCE)\Foundation\Library\Dxe\Include + $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\Include +# $(PLATFORM_ECP_PACKAGE)\Include + +[libraries.common] + +[nmake.common] diff --git a/Board/EM/Isct/Guid/IsctGuidLib.mak b/Board/EM/Isct/Guid/IsctGuidLib.mak new file mode 100644 index 0000000..09b58ad --- /dev/null +++ b/Board/EM/Isct/Guid/IsctGuidLib.mak @@ -0,0 +1,78 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctGuidLib/IsctGuidLib.mak 1 9/02/12 11:20p Bensonlai $ +# +# $Revision: 1 $ +# +# $Date: 9/02/12 11:20p $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctGuidLib/IsctGuidLib.mak $ +# +# 1 9/02/12 11:20p Bensonlai +# Intel Smart Connect Technology initially releases. +# +# +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: IsctGuidLib.mak +# +# Description: Make file to build IsctSmm components. +# +# +#<AMI_FHDR_END> +#********************************************************************** + +all : IsctGuidLib + +$(IsctGuidLib_LIB) : IsctGuidLib + +IsctGuidLib : $(BUILD_DIR)\IsctGuidLib.mak IsctGuidLibBin + +$(BUILD_DIR)\IsctGuidLib.mak : $(IsctGuidLib_DIR)\$(@B).cif $(IsctGuidLib_DIR)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(IsctGuidLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) + +IsctGuidLib_INCLUDES =\ + $(EDK_INCLUDES)\ + $(INTEL_PCH_INCLUDES)\ + $(EdkIIGlueLib_INCLUDES)\ + +IsctGuidLibBin : + $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\ + /f $(BUILD_DIR)\IsctGuidLib.mak all\ + "MY_INCLUDES=$(IsctGuidLib_INCLUDES)" \ + TYPE=LIBRARY +!IF "$(x64_BUILD)"=="1" + $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) BUILD_DIR=$(BUILD_DIR)\IA32\ + /f $(BUILD_DIR)\IsctGuidLib.mak all\ + "MY_INCLUDES=$(IsctGuidLib_INCLUDES)" \ + TYPE=PEI_LIBRARY +!ENDIF +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* diff --git a/Board/EM/Isct/Guid/IsctGuidLib.sdl b/Board/EM/Isct/Guid/IsctGuidLib.sdl new file mode 100644 index 0000000..ed843c9 --- /dev/null +++ b/Board/EM/Isct/Guid/IsctGuidLib.sdl @@ -0,0 +1,79 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctGuidLib/IsctGuidLib.sdl 1 9/02/12 11:20p Bensonlai $ +# +# $Revision: 1 $ +# +# $Date: 9/02/12 11:20p $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctGuidLib/IsctGuidLib.sdl $ +# +# 1 9/02/12 11:20p Bensonlai +# Intel Smart Connect Technology initially releases. +# +# +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: IsctGuidLib.sdl +# +# Description: SDL file for IsctGuidLib +# +# +#<AMI_FHDR_END> +#********************************************************************** + +TOKEN + Name = "IsctGuidLib_SUPPORT" + Value = "1" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + TargetH = Yes + Master = Yes + Help = "Main switch to enable ISCT GUID LIB support in Project" +End + +MODULE + File = "IsctGuidLib.mak" + Help = "Includes IsctGuidLib.mak to Project" +End + +PATH + Name = "IsctGuidLib_DIR" +End + +TOKEN + Name = "IsctGuidLib_LIB" + Value = "$$(LIB_BUILD_DIR)\IsctGuidLib.lib" + TokenType = Expression + TargetMAK = Yes +End +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* diff --git a/Board/EM/Isct/Guid/IsctPersistentData/IsctPersistentData.c b/Board/EM/Isct/Guid/IsctPersistentData/IsctPersistentData.c new file mode 100644 index 0000000..fd06f89 --- /dev/null +++ b/Board/EM/Isct/Guid/IsctPersistentData/IsctPersistentData.c @@ -0,0 +1,60 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctGuidLib/IsctPersistentData/IsctPersistentData.c 1 9/02/12 11:20p Bensonlai $ +// +// $Revision: 1 $ +// +// $Date: 9/02/12 11:20p $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctGuidLib/IsctPersistentData/IsctPersistentData.c $ +// +// 1 9/02/12 11:20p Bensonlai +// Intel Smart Connect Technology initially releases. +// +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: IsctPersistentData.c +// +// Description: The GUID definition for Isct Persistent Data +// +//<AMI_FHDR_END> +//********************************************************************** + +#include "EdkIIGlueDxe.h" +#include "IsctPersistentData.h" + +EFI_GUID gIsctPersistentDataGuid = ISCT_PERSISTENT_DATA_GUID; + +EFI_GUID_STRING + (&gIsctPersistentDataGuid, "Isct Persistent Data", "Isct Persistent Data GUID"); + +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** diff --git a/Board/EM/Isct/Guid/IsctPersistentData/IsctPersistentData.h b/Board/EM/Isct/Guid/IsctPersistentData/IsctPersistentData.h new file mode 100644 index 0000000..7846751 --- /dev/null +++ b/Board/EM/Isct/Guid/IsctPersistentData/IsctPersistentData.h @@ -0,0 +1,77 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctGuidLib/IsctPersistentData/IsctPersistentData.h 2 7/16/14 1:59a Mirayang $ +// +// $Revision: 2 $ +// +// $Date: 7/16/14 1:59a $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctGuidLib/IsctPersistentData/IsctPersistentData.h $ +// +// 2 7/16/14 1:59a Mirayang +// Add complete function with iRST. +// +// 1 9/02/12 11:20p Bensonlai +// Intel Smart Connect Technology initially releases. +// +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: IsctPersistentData.h +// +// Description: GUID definition for the Isct Persistent Data +// +//<AMI_FHDR_END> +//********************************************************************** + +#ifndef _ISCT_PERSISTENT_DATA_H_ +#define _ISCT_PERSISTENT_DATA_H_ + +// GUID {69A20012-B167-4e35-A999-98EE0835F02E} +#define ISCT_PERSISTENT_DATA_GUID \ + { \ + 0x69a20012, 0xb167, 0x4e35, 0xa9, 0x99, 0x98, 0xee, 0x8, 0x35, 0xf0, 0x2e \ + } + +#define ISCT_PERSISTENT_DATA_NAME L"IsctData" + +extern EFI_GUID gIsctPersistentDataGuid; + +#pragma pack(1) +typedef struct { + UINT32 IsctNvsPtr; + UINT8 IsctOverWrite; +} ISCT_PERSISTENT_DATA; +#pragma pack() + +#endif + +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** diff --git a/Board/EM/Isct/IsctPlatform.chm b/Board/EM/Isct/IsctPlatform.chm Binary files differnew file mode 100644 index 0000000..e29fe7f --- /dev/null +++ b/Board/EM/Isct/IsctPlatform.chm diff --git a/Board/EM/Isct/IsctPlatform.cif b/Board/EM/Isct/IsctPlatform.cif new file mode 100644 index 0000000..a73fd75 --- /dev/null +++ b/Board/EM/Isct/IsctPlatform.cif @@ -0,0 +1,17 @@ +<component> + name = "Intel Smart Connect Technology" + category = eModule + LocalRoot = "Board\EM\Isct" + RefName = "IsctPlatform" +[files] +"IsctPlatform.sdl" +"IsctPlatform.chm" + +[parts] +"IsctAcpiTables" +"IsctPeiWakeReason" +"IsctAcpi" +"IsctSmm" +"IsctGuidLib" +"IsctProtocolLib" +<endComponent> diff --git a/Board/EM/Isct/IsctPlatform.sdl b/Board/EM/Isct/IsctPlatform.sdl new file mode 100644 index 0000000..37a9e7f --- /dev/null +++ b/Board/EM/Isct/IsctPlatform.sdl @@ -0,0 +1,78 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctPlatform.sdl 2 9/26/12 2:14a Bensonlai $ +# +# $Revision: 2 $ +# +# $Date: 9/26/12 2:14a $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctPlatform.sdl $ +# +# 2 9/26/12 2:14a Bensonlai +# [TAG] None +# [Category] Improvement +# [Files] IsctPlatform.sdl +# IsctPlatform.chm +# +# 1 9/02/12 11:17p Bensonlai +# Intel Smart Connect Technology initially releases. +# +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: IsctPlatform.sdl +# +# Description: SDL file for IsctPlatform +# +# +#<AMI_FHDR_END> +#********************************************************************** + +TOKEN + Name = "ISCT_PLATFORM_SUPPORT" + Value = "1" + Help = "Main switch to enable ISCT support in Project" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + Master = Yes +End + +PATH + Name = "ISCT_PLATFORM_DIR" +End + +ELINK + Name = "/D ISCT_FLAG" + Parent = "GLOBAL_DEFINES" + InvokeOrder = AfterParent +End + +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* diff --git a/Board/EM/Isct/Pei/IsctWakeReason.c b/Board/EM/Isct/Pei/IsctWakeReason.c new file mode 100644 index 0000000..502aae6 --- /dev/null +++ b/Board/EM/Isct/Pei/IsctWakeReason.c @@ -0,0 +1,837 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctPeiWakeReason/IsctWakeReason.c 11 7/16/14 12:22a Mirayang $ +// +// $Revision: 11 $ +// +// $Date: 7/16/14 12:22a $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctPeiWakeReason/IsctWakeReason.c $ +// +// 11 7/16/14 12:22a Mirayang +// Add complete function with iRST. +// +// 10 7/11/14 10:27a Mirayang +// iRST bulid error. +// +// 9 7/08/14 5:07a Mirayang +// EIP 142924 iSCT 5.0 for Shark Bay Platform +// +// 8 10/29/13 4:21a Joshchou +// [TAG] EIP138184 +// [Category] Bug Fix +// [Severity] Important +// [Symptom] Panel will light up when entering into S0-iSCT from +// Rapid-Start-S4(iFFS) +// [RootCause] We only judge the boot mode of S3,but it will resume from +// S4 when enable iRST. +// [Solution] Add the judgement of S4 resume +// +// 7 6/02/13 10:54a Joshchou +// [TAG] EIP125348 +// [Category] Improvement +// [Description] [SBY] Intel Smart Connect Technology BIOS Sample Code +// 052413 Update +// +// 6 5/15/13 8:31a Bensonlai +// +// 5 5/14/13 6:28a Bensonlai +// [TAG] EIP123328 +// [Category] Spec Update +// [Severity] Normal +// [Description] [SBY] Intel Smart Connect Technology 4.x BIOS Reference +// Code +// +// 4 3/27/13 9:19a Bensonlai +// [TAG] EIP119288 +// [Category] Bug Fix +// [Severity] Normal +// [Symptom] When KB or mouse device plugged in P/S2, USB2.0 ports, it +// showed "PME Wake up event" by tool. +// [Solution] Change the USB2.0 wake reason to User pressed power button +// or HID event +// [Files] IsctWakeReason.c +// +// 3 1/11/13 5:09a Bensonlai +// [TAG] EIP112019 +// [Category] Bug Fix +// [Severity] Normal +// [Symptom] [ISCT] The wake up reason is incorrect for PME wake +// [RootCause] The PME status be cleared before IsctWakeReason.c. +// [Solution] Move the IsctGetWakeReason to gAmiPeiCompleteMRCGuid +// [Files] IsctWakeReason.c +// +// 2 9/26/12 2:10a Bensonlai +// [TAG] EIPNone +// [Category] Bug Fix +// [Severity] Normal +// [Symptom] System hung up when ISCT enabled on the debug mode +// [RootCause] Because we don't check the EFI stauts and use the +// ASSERT_EFI_ERROR directly. +// [Solution] Added the EFI stauts for checking. +// [Files] IsctAcpi.c, IsctWakeReason.c and IsctWakeReason.c +// +// 1 9/02/12 11:18p Bensonlai +// Intel Smart Connect Technology initially releases. +// +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: IsctWakeReason.c +// +// Description: Provide Wake Reason for ISCT. +// +//<AMI_FHDR_END> +//********************************************************************** + +#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000) +#include "EdkIIGluePeim.h" +#endif +#include "PchAccess.h" +//#include "PeiPlatformHookLib.h" +#include "PchPlatformLib.h" +#include "Pci.h" +// ami override Start +//#include "SetupVariable.h" +#include <token.h> +#include <SetupDataDefinition.h> +#if defined (RapidStart_SUPPORT) && (RapidStart_SUPPORT == 1) +#include <Ppi\RapidStart\RapidStart.h> +#endif +#define SYSTEM_CONFIGURATION_GUID { 0xEC87D643, 0xEBA4, 0x4BB5, 0xA1, 0xE5, 0x3F, 0x3E, 0x36, 0xB2, 0x0D, 0xA9 } + +#define KSC_D_PORT 0x62 +#define KSC_C_PORT 0x66 +#define KSC_S_IBF 0x02 /// Input buffer is full/empty +#define KSC_S_OBF 0x01 /// Output buffer is full/empty +#define KSC_TIME_OUT 0x20000 + +#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000) +// +// GUID to AMI_ISCT Module +// + +#define AMI_ISCT_HOB_GUID \ + { \ + 0x1af7b744, 0xcdfc, 0x4825, 0xa1, 0x77, 0xca, 0x48, 0xd2, 0xdf, 0xe2, 0xc6 \ + } +#else +#define AMI_ISCT_HOB_GUID \ + { \ + 0x1af7b744, 0xcdfc, 0x4825, \ + { \ + 0xa1, 0x77, 0xca, 0x48, 0xd2, 0xdf, 0xe2, 0xc6 \ + } \ + } +#endif + +#pragma pack (1) + +typedef struct { + EFI_HOB_GUID_TYPE EfiHobGuidType; + UINT16 ISCT_PM1_STS; + UINT8 WakeReason; +} AMI_ISCT_HOB; + +#pragma pack () +// ami override End + +#include EFI_GUID_DEFINITION (IsctPersistentData) +#include EFI_PPI_DEFINITION (EndOfPeiSignal) +//#include EFI_PPI_DEFINITION (MemoryDiscovered) + +EFI_GUID gEfiPeiEndOfPeiPhasePpiGuid = EFI_PEI_END_OF_PEI_PHASE_PPI_GUID; + + +#define KSC_GETWAKE_STATUS 0x35 +#define KSC_CLEARWAKE_STATUS 0x36 + +EFI_STATUS +IsctGetWakeReason ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, + IN VOID *Ppi + ); + +STATIC EFI_PEI_NOTIFY_DESCRIPTOR mIsctGetWakeReasonNotifyDesc = { + (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gEfiPeiEndOfPeiPhasePpiGuid, + IsctGetWakeReason +}; + + + + +/** + Checks for a PCIe Network Device attached to the root ports to see if it caused the PME + + @retval 1 An attached PCIe Network device caused a PME. + @retval 0 No PME caused by network device +**/ +UINT8 +IsNetworkDevicePME ( + ) +/*++ + +Routine Description: + + Checks for a PCIe Network Device attached to the root ports to see if it caused the PME + +Arguments: + + None + +Returns: + + UINT8 NetworkWakePME - 1 An attached PCIe Network device caused a PME. + 0 No PME caused by network device + +--*/ +{ + UINT8 NetworkWakePME; + UINT8 RpFunction; + UINTN RpBase; + UINTN EpBase; + UINT8 CapPtr; + UINT8 NxtPtr; + UINT8 CapID; + UINT8 PMCreg; + UINT8 PMCSR; +// ami override Start + UINT8 SecBusNum; +// ami override End + NetworkWakePME = 0; + + // + // Scan PCH PCI-EX slots (Root Port) : Device 28 Function 0~7 + // + for (RpFunction = 0; RpFunction < GetPchMaxPciePortNum (); RpFunction ++) { + RpBase = MmPciAddress (0, DEFAULT_PCI_BUS_NUMBER_PCH, PCI_DEVICE_NUMBER_PCH_PCIE_ROOT_PORTS, RpFunction, 0); + DEBUG ((EFI_D_INFO, "IsctPei: PCI-EX Root Port: 0x%x ...\n", RpFunction)); + + if ((MmioRead16 (RpBase + R_PCH_PCIE_SLSTS) & B_PCH_PCIE_SLSTS_PDS) != 0 && MmioRead16 (RpBase + R_PCH_PCIE_VENDOR_ID) == V_PCH_PCIE_VENDOR_ID) { +// ami override Start + // + // Set WLAN PortBus = 1 to Read Endpoint. + // +// MmioAndThenOr32(RpBase + R_PCH_PCIE_BNUM, 0xFF0000FF, 0x00010100); + SecBusNum = (UINT8) (MmioRead32 (RpBase + R_PCH_PCIE_BNUM) >> 8); +// EpBase = MmPciAddress (0, 1, 0, 0, 0); + EpBase = MmPciAddress (0, SecBusNum, 0, 0, 0); +// ami override End + + // + // A config write is required in order for the device to re-capture the Bus number, + // according to PCI Express Base Specification, 2.2.6.2 + // Write to a read-only register VendorID to not cause any side effects. + // + MmioWrite16 (EpBase + R_PCH_PCIE_VENDOR_ID, 0); + + // + // Check to see if the Device is a Network Device + // + if ((MmioRead16 (EpBase + PCI_CLASSCODE_OFFSET + 0x01) & 0xFF00) == (PCI_CLASS_NETWORK << 8)) { //PCI_CLASS_NETWORK_OTHER + DEBUG ((EFI_D_INFO, "IsctPei: Found a network device on Root Port - 0x%x and device ID is - 0x%x\n", RpFunction, MmioRead16 (EpBase + R_PCH_PCIE_DEVICE_ID))); + + // + // Find out PMCSR register + // + CapPtr = MmioRead8 (EpBase + R_PCH_PCIE_CAPP); + CapID = MmioRead8 (EpBase + CapPtr); + NxtPtr = (UINT8) (MmioRead16 (EpBase + CapPtr) >> 8); + PMCreg = CapPtr; + + while (CapID != 0x01) { + CapID = MmioRead8 (EpBase + NxtPtr); + if (CapID == 0x01) { + PMCreg = NxtPtr; + break; + } + NxtPtr = (UINT8) (MmioRead16 (EpBase + NxtPtr) >> 8); + + if (NxtPtr == 0){ + PMCreg = 0; + break; + } + } + + if (PMCreg != 0) { + PMCSR = PMCreg + 0x04; + + // + // Check whether PME enabled. Set NetworkWakePME to 1 if device caused PME. + // + if (MmioRead16 (EpBase + PMCSR) & BIT15) { + NetworkWakePME = 1; + DEBUG ((EFI_D_INFO, "IsctPei: The network device 0x%x caused the PME\n", MmioRead16 (EpBase + R_PCH_PCIE_DEVICE_ID))); +// ami override Start + // + // Restore bus numbers on the WLAN bridge. + // +// MmioAnd32(RpBase + R_PCH_PCIE_BNUM, 0xFF0000FF); +// ami override End + break; + } + } +// ami override Start + // + // Restore bus numbers on the WLAN bridge. + // +// MmioAnd32(RpBase + R_PCH_PCIE_BNUM, 0xFF0000FF); +// ami override End + } + } + } + + return NetworkWakePME; +} + +EFI_STATUS +IsctGetWakeReason ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, + IN VOID *Ppi + ) +/*++ + +Routine Description: + + Get system Wake Reason and save into CMOS 72/73 for ACPI ASL to use. + +Arguments: + + PeiServices General purpose services available to every PEIM. + +Returns: + +--*/ +{ + EFI_STATUS Status; + UINT32 PmBase; + UINT16 PM1STS; + UINT16 USB29VID; + UINT16 USB29STS; + UINT16 USB26VID; + UINT16 USB26STS; + UINT16 xHCIVID; + UINT16 xHCISTS; + UINT16 LanVID; + UINT16 LanSTS; + UINT8 WakeReason; + UINT8 KscStatus; + UINT8 WakeStatus; + UINTN Count; + UINTN Size; + UINT8 PcieWake; + ISCT_PERSISTENT_DATA IsctData; + PEI_READ_ONLY_VARIABLE_PPI *ReadOnlyVariable; + UINT8 *IsctNvsPtr; + PCH_SERIES PchSeries; +// ami override Start + AMI_ISCT_HOB *AmiIsctHobPtr; + EFI_GUID AmiIsctHobGuid = AMI_ISCT_HOB_GUID; + EFI_GUID gIsctPersistentDataGuid = ISCT_PERSISTENT_DATA_GUID; + +#if defined(RapidStart_SUPPORT) && (RapidStart_SUPPORT == 1) + RAPID_START_PPI *RapidStartPpi; + BOOLEAN RapidStartWake; + EFI_GUID gRapidStartPpiGuid = RAPID_START_PPI_GUID; + // + // Get Rapid Start wake info + // + RapidStartPpi = NULL; + RapidStartWake = FALSE; + Status = PeiServicesLocatePpi ( + &gRapidStartPpiGuid, + 0, + NULL, + (VOID **) &RapidStartPpi + ); + if (Status == EFI_SUCCESS) { + DEBUG ((EFI_D_INFO, "IsctPeiME: RapidStartPpi Found\n")); + if (RapidStartPpi->GetMode (RapidStartPpi) == RapidStartEntry) { + DEBUG ((EFI_D_INFO, "IsctPei: RapidStart Transition Wake\n")); + RapidStartWake = TRUE; + } else { + DEBUG ((EFI_D_INFO, "IsctPei: Not RapidStart Transition Wake\n")); + } + } +#endif +// ami override End + + // + // Locate PEI Read Only Variable PPI. + // + Status = (*PeiServices)->LocatePpi ( + PeiServices, + &gPeiReadOnlyVariablePpiGuid, + 0, + NULL, + &ReadOnlyVariable + ); + + if ( EFI_ERROR(Status) ) { + return Status; + } + + Size = sizeof (ISCT_PERSISTENT_DATA); + Status = ReadOnlyVariable->PeiGetVariable ( + PeiServices, + ISCT_PERSISTENT_DATA_NAME, + &gIsctPersistentDataGuid, + NULL, + &Size, + &IsctData + ); + + if ( EFI_ERROR(Status) ) { + DEBUG ((EFI_D_INFO, "IsctPei: GetVariable for IsctData Status = %x \n", Status)); + return Status; + } + + DEBUG ((EFI_D_INFO, "IsctPei: IsctNvsPtr = %x \n", IsctData.IsctNvsPtr)); + + // + // Clear Isct Wake Reason + // + DEBUG ((EFI_D_INFO, "IsctPei: Previous Isct Wake Reason = %x \n", *(UINT8 *) IsctData.IsctNvsPtr)); + IsctNvsPtr = (UINT8 *) IsctData.IsctNvsPtr; + *IsctNvsPtr = 0; + WakeReason = 0; + PcieWake = 0; + + DEBUG ((EFI_D_INFO, "IsctPei: Address for Isct Nvs Region = %x \n", IsctNvsPtr)); + DEBUG ((EFI_D_INFO, "IsctPei: Timer Value saved for RTC timer = %x \n", *(UINT32 *)(IsctData.IsctNvsPtr + 0x8))); + + PchSeries = GetPchSeries(); + // + // Initialize base address for Power Management + // + PmBase = PchLpcPciCfg16 (R_PCH_LPC_ACPI_BASE) & B_PCH_LPC_ACPI_BASE_BAR; + +// ami override Start + AmiIsctHobPtr = GetFirstGuidHob (&AmiIsctHobGuid); + if (AmiIsctHobPtr == NULL) { + DEBUG ((EFI_D_ERROR, "IsctPei: AmiIsctHobPtr not available\n")); + return EFI_NOT_FOUND; + } + +// PM1STS = IoRead16(PmBase + R_PCH_ACPI_PM1_STS); + PM1STS = AmiIsctHobPtr->ISCT_PM1_STS; +//ami override End// + PM1STS &= (B_PCH_ACPI_PM1_STS_PWRBTN | B_PCH_ACPI_PM1_STS_RTC | BIT14); + + // + // Check PM1_STS + // + DEBUG ((EFI_D_INFO, "IsctPei: PM1_STS Value= %x \n", PM1STS)); + DEBUG ((EFI_D_INFO, " Bit set in PM1_STS: \n")); + switch (PM1STS){ + case B_PCH_ACPI_PM1_STS_PWRBTN: + WakeReason |= 0x01; //User event + DEBUG ((EFI_D_INFO, " PowerButton\n")); + break; + case B_PCH_ACPI_PM1_STS_RTC: + WakeReason |= 0x04; //RTC Timer + DEBUG ((EFI_D_INFO, " RTC Timer\n")); + break; + case BIT14: //PCIe Wake + PcieWake = 1; + WakeReason |= 0x08; //PME + DEBUG ((EFI_D_INFO, " PCIe PME\n")); + break; + default: + WakeReason = 0; + DEBUG ((EFI_D_INFO, " Unknown\n")); + break; + } + DEBUG ((EFI_D_INFO, "IsctPei: PCIe Wake: %x\n", PcieWake)); + + // + // EHCI PME : Offset 0x54(15) + // + USB29VID = MmioRead16 ( + MmPciAddress ( + 0, + DEFAULT_PCI_BUS_NUMBER_PCH, + PCI_DEVICE_NUMBER_PCH_USB, + PCI_FUNCTION_NUMBER_PCH_EHCI, + R_PCH_USB_VENDOR_ID + )); + + USB29STS = MmioRead16 ( + MmPciAddress ( + 0, + DEFAULT_PCI_BUS_NUMBER_PCH, + PCI_DEVICE_NUMBER_PCH_USB, + PCI_FUNCTION_NUMBER_PCH_EHCI, + R_PCH_EHCI_PWR_CNTL_STS + )) & (B_PCH_EHCI_PWR_CNTL_STS_PME_STS | B_PCH_EHCI_PWR_CNTL_STS_PME_EN); + + if (USB29VID != 0xFFFF && USB29VID != 0){ + if (USB29STS == 0x8100){ + DEBUG ((EFI_D_INFO, "IsctPei: EHCI Wake\n")); + WakeReason |= 0x01; //User event + } + } + + if (PchSeries == PchH) { + USB26VID = MmioRead16 ( + MmPciAddress ( + 0, + DEFAULT_PCI_BUS_NUMBER_PCH, + PCI_DEVICE_NUMBER_PCH_USB_EXT, + PCI_FUNCTION_NUMBER_PCH_EHCI, + R_PCH_USB_VENDOR_ID + )); + + USB26STS = MmioRead16 ( + MmPciAddress ( + 0, + DEFAULT_PCI_BUS_NUMBER_PCH, + PCI_DEVICE_NUMBER_PCH_USB_EXT, + PCI_FUNCTION_NUMBER_PCH_EHCI, + R_PCH_EHCI_PWR_CNTL_STS + )) & (B_PCH_EHCI_PWR_CNTL_STS_PME_STS | B_PCH_EHCI_PWR_CNTL_STS_PME_EN); + + if (USB26VID != 0xFFFF && USB26VID != 0){ + if (USB26STS == 0x8100){ + DEBUG ((EFI_D_INFO, "IsctPei: EHCI Wake\n")); + WakeReason |= 0x01; //User Event + } + } + } + + // + // Intel GigaLAN PME : Offset 0xCC(15) + // + LanVID = MmioRead16 ( + MmPciAddress ( + 0, + PCI_BUS_NUMBER_PCH_LAN, + PCI_DEVICE_NUMBER_PCH_LAN, + PCI_FUNCTION_NUMBER_PCH_LAN, + R_PCH_LAN_VENDOR_ID + )); + + LanSTS = MmioRead16 ( + MmPciAddress ( + 0, + PCI_BUS_NUMBER_PCH_LAN, + PCI_DEVICE_NUMBER_PCH_LAN, + PCI_FUNCTION_NUMBER_PCH_LAN, + R_PCH_LAN_PMCS + )) & (B_PCH_LAN_PMCS_PMES | B_PCH_LAN_PMCS_PMEE); + + + if (LanVID != 0xFFFF && LanVID != 0){ + if (LanSTS == 0x8100){ + DEBUG ((EFI_D_INFO, "IsctPei: LAN PME Wake\n")); + WakeReason |= 0x08; //PME + } + } + + // + // xHCI PME : Offset 0x74(15) + // + xHCIVID = MmioRead16 ( + MmPciAddress ( + 0, + DEFAULT_PCI_BUS_NUMBER_PCH, + PCI_DEVICE_NUMBER_PCH_XHCI, + PCI_FUNCTION_NUMBER_PCH_XHCI, + R_PCH_USB_VENDOR_ID + )); + + xHCISTS = MmioRead16 ( + MmPciAddress ( + 0, + DEFAULT_PCI_BUS_NUMBER_PCH, + PCI_DEVICE_NUMBER_PCH_XHCI, + PCI_FUNCTION_NUMBER_PCH_XHCI, + R_PCH_XHCI_PWR_CNTL_STS + )) & (B_PCH_XHCI_PWR_CNTL_STS_PME_STS | B_PCH_XHCI_PWR_CNTL_STS_PME_EN); + + + if (xHCIVID != 0xFFFF && xHCIVID != 0){ + if (xHCISTS == 0x8100){ + DEBUG ((EFI_D_INFO, "IsctPei: xHCI Wake\n")); + WakeReason |= 0x08; //PME + } + } + + // + // Check if IsctTimerChoice is set to EC timer + // + if (*(UINT8 *)((UINTN)(IsctData.IsctNvsPtr + 0x3)) == 0) { + DEBUG ((EFI_D_INFO, "IsctPei: EC timer is being used\n")); + // + // Check KSC Input Buffer + // + Count = 0; + KscStatus = IoRead8 (KSC_C_PORT); + + while (((KscStatus & KSC_S_IBF) != 0) && (Count < KSC_TIME_OUT)) { + KscStatus = IoRead8 (KSC_C_PORT); + Count++; + } + + // + // Send EC GetWakeStatus command + // + IoWrite8(KSC_C_PORT, KSC_GETWAKE_STATUS); + + // + // Check KSC Output Buffer + // + Count = 0; + KscStatus = IoRead8 (KSC_C_PORT); + + while (((KscStatus & KSC_S_OBF) == 0) && (Count < KSC_TIME_OUT)) { + KscStatus = IoRead8 (KSC_C_PORT); + Count++; + } + + // + // Receive wake reason + // + WakeStatus = IoRead8 (KSC_D_PORT); + + // + // Check KSC Input Buffer + // + Count = 0; + KscStatus = IoRead8 (KSC_C_PORT); + + while (((KscStatus & KSC_S_IBF) != 0) && (Count < KSC_TIME_OUT)) { + KscStatus = IoRead8 (KSC_C_PORT); + Count++; + } + + // + // Send EC ClearWakeStatus command + // + IoWrite8(KSC_C_PORT, KSC_CLEARWAKE_STATUS); + DEBUG ((EFI_D_INFO, "IsctPei: EC Wake Status: %x\n", WakeStatus)); + switch (WakeStatus){ + case BIT1: // Lid Wake + WakeReason |= 0x01; //Bit0 is user event wake + break; + case BIT2: // Keyboard/Mouse Wake + WakeReason |= 0x01; //Bit0 is user event wake + break; + case BIT3: // EC Timer Wake + WakeReason |= 0x02; //Bit1 is EC timer wake + break; + case BIT4: // PCIe Wake + WakeReason |= 0x08; //Wake due to PME + break; + default: // Unknown + WakeReason |= 0x00; + break; + } + // + // Override because of EC timer wake from FFS_S3 or S4 (Need EC support it!) + // + if ((PM1STS == B_PCH_ACPI_PM1_STS_PWRBTN) && (WakeStatus == BIT3)) { + WakeReason = 0x02; + } + } + +// ami override Start +#if defined(RapidStart_SUPPORT) && (RapidStart_SUPPORT == 1) + DEBUG ((EFI_D_INFO, "IsctPei: IsctData.IsctOverWrite : %d \n",IsctData.IsctOverWrite)); + + DEBUG ((EFI_D_INFO, "IsctPei: RapidStartWake : %d \n",RapidStartWake)); + + if ((WakeReason & 0x04) == 0x04) { + if ((RapidStartWake == FALSE) && (IsctData.IsctOverWrite == TRUE)) { + DEBUG ((EFI_D_INFO, "IsctPei: RapidStartWake == FALSE && IsctData.IsctOverWrite == TRUE. \n")); + WakeReason |= 0x0002; + WakeReason &= ~0x04; + } + } +#else + // + //If RTC wake, check if IsctOverWrite is set to OS + // + if (WakeReason == 0x04) { + if ((IsctData.IsctOverWrite)) == 0) { + WakeReason = 0x04; + } else { + WakeReason = 0x02; + } + } +#endif +// ami override End + + // + // Check for Network Device PME from PCIe if PME wake reason + // + if(PcieWake == 1) //PME + { + DEBUG ((EFI_D_INFO, "IsctPei: PME wake reason- check if from network device\n")); + if(IsNetworkDevicePME()) + { + WakeReason |= BIT4; + DEBUG ((EFI_D_INFO, "IsctPei: IsNetworkDevicePME() returned Yes\n")); + } + } + + // + // Set Isct Wake Reason + // + DEBUG ((EFI_D_INFO, "IsctPei: Wake Reason reported to Agent= %x \n", WakeReason)); + *(UINT8 *)IsctData.IsctNvsPtr = WakeReason; + AmiIsctHobPtr->WakeReason = WakeReason; + return EFI_SUCCESS; +} + + +EFI_STATUS +EFIAPI +IsctPeiEntryPoint ( + IN EFI_FFS_FILE_HEADER *FfsHeader, + IN EFI_PEI_SERVICES **PeiServices + ) +/*++ + +Routine Description: + + Set up + +Arguments: + + PeiServices General purpose services available to every PEIM. + +Returns: + +--*/ +{ + EFI_STATUS Status; + UINT8 IsctEnabled; + EFI_GUID SetupGuid = SYSTEM_CONFIGURATION_GUID; + PEI_READ_ONLY_VARIABLE_PPI *ReadOnlyVariable; + SETUP_DATA SetupData; + UINTN VariableSize; +// ami override Start + + EFI_BOOT_MODE BootMode; + AMI_ISCT_HOB *AmiIsctHobPtr; + EFI_GUID AmiIsctHobGuid = AMI_ISCT_HOB_GUID; + UINT32 PmBase; + + DEBUG ((EFI_D_ERROR, "IsctPei Entry Point\n")); + IsctEnabled = 0; + + // + // Locate PEI Read Only Variable PPI. + // + Status = (**PeiServices).LocatePpi ( + PeiServices, + &gPeiReadOnlyVariablePpiGuid, + 0, + NULL, + &ReadOnlyVariable + ); + if ( EFI_ERROR(Status) ) { + DEBUG ((EFI_D_ERROR, "IsctPei: LocatePpi is fail\n")); + return Status; + } + + // + // Get Setup Variable + // + VariableSize = sizeof (SETUP_DATA); + Status = ReadOnlyVariable->PeiGetVariable ( + PeiServices, + L"Setup", + &SetupGuid, + NULL, + &VariableSize, + &SetupData + ); + if ( EFI_ERROR(Status) ) { + DEBUG ((EFI_D_ERROR, "IsctPei: Setup is fail\n")); + return Status; + } + + IsctEnabled = SetupData.IsctConfiguration; + + if (IsctEnabled == 0) { + DEBUG ((EFI_D_INFO, "Isct Disabled\n")); + return EFI_SUCCESS; + } + else { +// ami override Start + Status = PeiServicesGetBootMode (&BootMode); + if ( EFI_ERROR( Status ) ) { + DEBUG ((EFI_D_ERROR, "IsctPei: Get Boot Mode is fail\n")); + return Status; + } + + + Status = (*PeiServices)->CreateHob (PeiServices, EFI_HOB_TYPE_GUID_EXTENSION, sizeof (AMI_ISCT_HOB), (VOID **) &AmiIsctHobPtr); + if ( EFI_ERROR( Status ) ) { + DEBUG ((EFI_D_ERROR, "IsctPei: CreateHob is fail for AmiIsctHobPtr\n")); + return Status; + } + + // + // Initialize base address for Power Management + // + PmBase = PchLpcPciCfg16 (R_PCH_LPC_ACPI_BASE) & B_PCH_LPC_ACPI_BASE_BAR; + + AmiIsctHobPtr->EfiHobGuidType.Name = AmiIsctHobGuid; + AmiIsctHobPtr->ISCT_PM1_STS = IoRead16(PmBase + R_PCH_ACPI_PM1_STS); + DEBUG ((EFI_D_ERROR, "IsctPei: AmiIsctHobPtr->ISCT_PM1_STS = %x \n", AmiIsctHobPtr->ISCT_PM1_STS)); + + + // + // Get Rapid Start wake info + // + if ( (BootMode == BOOT_ON_S3_RESUME) || (BootMode == BOOT_ON_S4_RESUME) ) { + + Status = PeiServicesNotifyPpi (&mIsctGetWakeReasonNotifyDesc); + if ( EFI_ERROR(Status) ) { + DEBUG ((EFI_D_INFO, "IsctPei: Notify EFI_PEI_END_OF_PEI_PHASE_PPI_GUID Status = %x \n", Status)); + return Status; + } + + return Status; + } +// ami override end + } + + return EFI_SUCCESS; +} + +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** diff --git a/Board/EM/Isct/Pei/IsctWakeReason.cif b/Board/EM/Isct/Pei/IsctWakeReason.cif new file mode 100644 index 0000000..631341a --- /dev/null +++ b/Board/EM/Isct/Pei/IsctWakeReason.cif @@ -0,0 +1,11 @@ +<component> + name = "IsctPeiWakeReason" + category = ModulePart + LocalRoot = "Board\EM\Isct\Pei" + RefName = "IsctPeiWakeReason" +[files] +"IsctWakeReason.c" +"IsctWakeReason.dxs" +"IsctWakeReason.sdl" +"IsctWakeReason.mak" +<endComponent> diff --git a/Board/EM/Isct/Pei/IsctWakeReason.dxs b/Board/EM/Isct/Pei/IsctWakeReason.dxs new file mode 100644 index 0000000..f367bfe --- /dev/null +++ b/Board/EM/Isct/Pei/IsctWakeReason.dxs @@ -0,0 +1,73 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctPeiWakeReason/IsctWakeReason.dxs 2 9/26/12 2:08a Bensonlai $ +// +// $Revision: 2 $ +// +// $Date: 9/26/12 2:08a $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctPeiWakeReason/IsctWakeReason.dxs $ +// +// 2 9/26/12 2:08a Bensonlai +// [TAG] Nono +// [Category] Improvement +// [Description] Modified comment +// [Files] IsctWakeReason.dxs +// IsctWakeReason.sdl +// IsctWakeReason.mak +// +// 1 9/02/12 11:18p Bensonlai +// Intel Smart Connect Technology initially releases. +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: IsctWakeReason.dxs +// +// Description: Dependency expression file for IsctWakeReason Driver. +// +//<AMI_FHDR_END> +//********************************************************************** + +#include "AutoGen.h" +#include "PeimDepex.h" +#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB) +#include "EfiDepex.h" +#include EFI_PPI_DEPENDENCY (Variable) + +#include EFI_PPI_DEPENDENCY (PchPeiInitDone) +#endif + +DEPENDENCY_START + PEI_READ_ONLY_VARIABLE_ACCESS_PPI_GUID AND + PCH_PEI_INIT_DONE_PPI_GUID +DEPENDENCY_END + +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** diff --git a/Board/EM/Isct/Pei/IsctWakeReason.mak b/Board/EM/Isct/Pei/IsctWakeReason.mak new file mode 100644 index 0000000..ccb3b7d --- /dev/null +++ b/Board/EM/Isct/Pei/IsctWakeReason.mak @@ -0,0 +1,135 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctPeiWakeReason/IsctWakeReason.mak 5 7/16/14 12:22a Mirayang $ +# +# $Revision: 5 $ +# +# $Date: 7/16/14 12:22a $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctPeiWakeReason/IsctWakeReason.mak $ +# +# 5 7/16/14 12:22a Mirayang +# Add complete function with iRST. +# +# 4 7/11/14 10:29a Mirayang +# Fix iRST bulid error. +# +# 3 7/08/14 5:08a Mirayang +# EIP142924 iSCT 5.0 for Shark Bay Platform +# +# 2 9/26/12 2:08a Bensonlai +# [TAG] Nono +# [Category] Improvement +# [Description] Modified comment +# [Files] IsctWakeReason.dxs +# IsctWakeReason.sdl +# IsctWakeReason.mak +# +# 1 9/02/12 11:18p Bensonlai +# Intel Smart Connect Technology initially releases. +# +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: IsctWakeReason.mak +# +# Description: Make file to build IsctWakeReason components +# +# +#<AMI_FHDR_END> +#********************************************************************** + +all : IsctWakeReason +IsctWakeReason : $(BUILD_DIR)\IsctWakeReason.mak IsctWakeReasonBin + +$(BUILD_DIR)\IsctWakeReason.mak : $(IsctWakeReason_DIR)\$(@B).cif $(IsctWakeReason_DIR)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(IsctWakeReason_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) + +IsctWakeReason_INCLUDES=\ + $(EdkIIGlueLib_INCLUDES)\ + $(INTEL_PCH_INCLUDES)\ + $(INTEL_MCH_INCLUDES)\ + /I$(ISCT_PLATFORM_DIR)\ + /I$(IntelPlatformProtocolLib_DIR)\ +!IFDEF RapidStart_SUPPORT +!IF "$(RapidStart_SUPPORT)" == "1" + $(RAPIDSTART_INCLUDES)\ +!ENDIF +!ENDIF + +IsctWakeReason_DEFINES=\ + $(MY_DEFINES)\ + /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=IsctPeiEntryPoint"\ + /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \ + /D __EDKII_GLUE_BASE_MEMORY_LIB__\ + /D __EDKII_GLUE_PEI_DEBUG_LIB_REPORT_STATUS_CODE__ \ + /D __EDKII_GLUE_PEI_REPORT_STATUS_CODE_LIB__ \ + /D __EDKII_GLUE_PEI_SERVICES_LIB__ \ + /D __EDKII_GLUE_PEI_MEMORY_ALLOCATION_LIB__ \ + /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \ + /D __EDKII_GLUE_PEI_HOB_LIB__ \ + +IsctWakeReason_LIBS =\ + $(EdkIIGlueBaseIoLibIntrinsic_LIB)\ + $(EdkIIGlueBaseLib_LIB)\ + $(EdkIIGlueBaseLibIA32_LIB)\ + $(EdkIIGlueBasePrintLib_LIB)\ + $(EdkIIGluePeiMemoryAllocationLib_LIB)\ + $(EdkIIGluePeiDebugLibReportStatusCode_LIB)\ + $(EdkIIGluePeiReportStatusCodeLib_LIB)\ + $(EdkIIGluePeiServicesLib_LIB)\ + $(EdkIIGlueBasePciLibPciExpress_LIB)\ + $(EdkIIGlueBasePostCodeLibPort80_LIB)\ + $(EDKFRAMEWORKPPILIB)\ + $(PchPlatformPeiLib_LIB)\ + $(IntelPchPpiLib_LIB)\ + $(EdkIIGluePeiHobLib_LIB) \ + $(IsctGuidLib_LIB)\ +!IFDEF RapidStart_SUPPORT +!IF "$(RapidStart_SUPPORT)" == "1" + $(RapidStartPpiLib_LIB)\ +!ENDIF +!ENDIF + +IsctWakeReasonBin : $(IsctWakeReason_LIBS) $(PEILIB) + $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS) \ + /f $(BUILD_DIR)\IsctWakeReason.mak all \ + NAME=IsctWakeReason \ + MAKEFILE=$(BUILD_DIR)\IsctWakeReason.mak \ + GUID=0C3B7B59-28E5-4C99-85E5-D0116DBFAAF2 \ + ENTRY_POINT=_ModuleEntryPoint \ + "MY_INCLUDES = $(IsctWakeReason_INCLUDES)" \ + "MY_DEFINES = $(IsctWakeReason_DEFINES)" \ + TYPE=PEIM \ + EDKIIModule=PEIM \ + DEPEX1=$(IsctWakeReason_DIR)\IsctWakeReason.dxs \ + DEPEX1_TYPE=EFI_SECTION_PEI_DEPEX \ + COMPRESS=0 +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* diff --git a/Board/EM/Isct/Pei/IsctWakeReason.sdl b/Board/EM/Isct/Pei/IsctWakeReason.sdl new file mode 100644 index 0000000..a1b22c6 --- /dev/null +++ b/Board/EM/Isct/Pei/IsctWakeReason.sdl @@ -0,0 +1,86 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctPeiWakeReason/IsctWakeReason.sdl 2 9/26/12 2:08a Bensonlai $ +# +# $Revision: 2 $ +# +# $Date: 9/26/12 2:08a $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctPeiWakeReason/IsctWakeReason.sdl $ +# +# 2 9/26/12 2:08a Bensonlai +# [TAG] Nono +# [Category] Improvement +# [Description] Modified comment +# [Files] IsctWakeReason.dxs +# IsctWakeReason.sdl +# IsctWakeReason.mak +# +# 1 9/02/12 11:18p Bensonlai +# Intel Smart Connect Technology initially releases. +# +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: IsctWakeReason.sdl +# +# Description: SDL file for IsctWakeReason +# +# +#<AMI_FHDR_END> +#********************************************************************** + +TOKEN + Name = "IsctWakeReason_SUPPORT" + Value = "1" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + TargetH = Yes + Master = Yes + Help = "Main switch to enable IsctWakeReason support in PEI Phase" +End + +MODULE + Help = "Includes IsctWakeReason.mak to Project" + File = "IsctWakeReason.mak" +End + +PATH + Name = "IsctWakeReason_DIR" + Help = "IsctWakeReason DIR" +End + +ELINK + Name = "$(BUILD_DIR)\IsctWakeReason.ffs" + Parent = "FV_BB" + InvokeOrder = AfterParent +End +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* diff --git a/Board/EM/Isct/Protocol/IsctNvsArea/IsctNvsArea.c b/Board/EM/Isct/Protocol/IsctNvsArea/IsctNvsArea.c new file mode 100644 index 0000000..024cab8 --- /dev/null +++ b/Board/EM/Isct/Protocol/IsctNvsArea/IsctNvsArea.c @@ -0,0 +1,64 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctProtocolLib/IsctNvsArea/IsctNvsArea.c 1 9/02/12 11:20p Bensonlai $ +// +// $Revision: 1 $ +// +// $Date: 9/02/12 11:20p $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctProtocolLib/IsctNvsArea/IsctNvsArea.c $ +// +// 1 9/02/12 11:20p Bensonlai +// Intel Smart Connect Technology initially releases. +// +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: IsctNvsArea.c +// +// Description: Isct NVS Area description protocol implementation. +// +//<AMI_FHDR_END> +//********************************************************************** + +#include "EdkIIGlueDxe.h" + +#include "IsctNvsArea.h" + +EFI_GUID gIsctNvsAreaProtocolGuid = ISCT_NVS_AREA_PROTOCOL_GUID; + +EFI_GUID_STRING + ( + &gIsctNvsAreaProtocolGuid, "ISCT NVS Area Protocol", + "Protocol describing ISCT ACPI NVS memory region used by ACPI subsystem." + ); + +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** diff --git a/Board/EM/Isct/Protocol/IsctNvsArea/IsctNvsArea.h b/Board/EM/Isct/Protocol/IsctNvsArea/IsctNvsArea.h new file mode 100644 index 0000000..5802aa7 --- /dev/null +++ b/Board/EM/Isct/Protocol/IsctNvsArea/IsctNvsArea.h @@ -0,0 +1,102 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctProtocolLib/IsctNvsArea/IsctNvsArea.h 1 9/02/12 11:20p Bensonlai $ +// +// $Revision: 1 $ +// +// $Date: 9/02/12 11:20p $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctProtocolLib/IsctNvsArea/IsctNvsArea.h $ +// +// 1 9/02/12 11:20p Bensonlai +// Intel Smart Connect Technology initially releases. +// +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: IsctNvsArea.h +// +// Description: Data structures defined in this protocol are not naturally aligned. +// +//<AMI_FHDR_END> +//********************************************************************** + +#ifndef _ISCT_NVS_AREA_H_ +#define _ISCT_NVS_AREA_H_ + +// +// Includes +// +// +// Forward reference for pure ANSI compatability +// +EFI_FORWARD_DECLARATION (ISCT_NVS_AREA_PROTOCOL); + +// +// Isct NVS Area Protocol GUID +// +#define ISCT_NVS_AREA_PROTOCOL_GUID \ + { \ + 0x6614a586, 0x788c, 0x47e2, 0x89, 0x2d, 0x72, 0xe2, 0xc, 0x34, 0x48, 0x90 \ + } + +// +// Extern the GUID for protocol users. +// +extern EFI_GUID gIsctNvsAreaProtocolGuid; + +// +// Isct NVS Area definition +// +#pragma pack(1) +typedef struct { + UINT8 IsctWakeReason; //(0): Wake Reason + UINT8 IsctEnabled; //(1): 1 - Enabled, 0 - Disabled + UINT8 RapidStartEnabled; //(2): IFFS service enabled + UINT8 IsctTimerChoice; //(3): 1 - RTC timer, 0 - EC timer + UINT32 EcDurationTime; //(4): EC Duration Time + UINT32 RtcDurationTime; //(8): RTC Duration Time + UINT32 IsctNvsPtr; //(12): Ptr of Isct GlobalNvs + UINT8 IsctOverWrite; //(16): 1 - Isct , 0 - OS RTC +} ISCT_NVS_AREA; +#pragma pack() + +// +// Isct NVS Area Protocol +// +typedef struct _ISCT_NVS_AREA_PROTOCOL { + ISCT_NVS_AREA *Area; + VOID *IsctData; +} ISCT_NVS_AREA_PROTOCOL; + +#endif + +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** diff --git a/Board/EM/Isct/Protocol/IsctProtocolLib.cif b/Board/EM/Isct/Protocol/IsctProtocolLib.cif new file mode 100644 index 0000000..c96731d --- /dev/null +++ b/Board/EM/Isct/Protocol/IsctProtocolLib.cif @@ -0,0 +1,12 @@ +<component> + name = "IsctProtocolLib" + category = ModulePart + LocalRoot = "Board\EM\Isct\Protocol" + RefName = "IsctProtocolLib" +[files] +"IsctProtocolLib.inf" +"IsctProtocolLib.mak" +"IsctProtocolLib.sdl" +"IsctNvsArea\IsctNvsArea.h" +"IsctNvsArea\IsctNvsArea.c" +<endComponent> diff --git a/Board/EM/Isct/Protocol/IsctProtocolLib.inf b/Board/EM/Isct/Protocol/IsctProtocolLib.inf new file mode 100644 index 0000000..ea1f31d --- /dev/null +++ b/Board/EM/Isct/Protocol/IsctProtocolLib.inf @@ -0,0 +1,66 @@ +# +# This file contains a 'Sample Driver' and is licensed as such +# under the terms of your license agreement with Intel or your +# vendor. This file may be modified by the user, subject to +# the additional terms of the license agreement +# +#/*++ +# +# Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved +# This software and associated documentation (if any) is furnished +# under a license and may only be used or copied in accordance +# with the terms of the license. Except as permitted by such +# license, no part of this software or documentation may be +# reproduced, stored in a retrieval system, or transmitted in any +# form or by any means without the express written consent of +# Intel Corporation. +# +# Module Name: +# +# PlatformPolicyUpdatePeiLib.inf +# +# Abstract: +# +# Component description file for PEI DxePlatformPolicyUpdateLib Library +# +#--*/ + +[defines] +BASE_NAME = IsctProtocolLib +COMPONENT_TYPE = LIBRARY + +[sources.common] + IsctNvsArea\IsctNvsArea.h + IsctNvsArea\IsctNvsArea.c + +[sources.ia32] + +[sources.x64] + +[sources.ipf] + +[includes.common] + . + $(BUILD_DIR)\$(PROCESSOR) + $(EDK_SOURCE)\Foundation\Efi + $(EDK_SOURCE)\Foundation\Include + $(EDK_SOURCE)\Foundation\Efi\Include + $(EDK_SOURCE)\Foundation\Framework\Include + +# +# EDK II Glue Library utilizes some standard headers from EDK +# + $(EFI_SOURCE) + $(EDK_SOURCE)\Foundation + $(EDK_SOURCE)\Foundation\Framework + $(EDK_SOURCE)\Foundation\Include\IndustryStandard + $(EDK_SOURCE)\Foundation\Core\Dxe + $(EDK_SOURCE)\Foundation\Include\Pei + $(EDK_SOURCE)\Foundation\Library\Pei\Include + $(EDK_SOURCE)\Foundation\Library\Dxe\Include + $(EDK_SOURCE)\Foundation\Library\EdkIIGlueLib\Include +# $(PLATFORM_ECP_PACKAGE)\Include + +[libraries.common] + +[nmake.common] diff --git a/Board/EM/Isct/Protocol/IsctProtocolLib.mak b/Board/EM/Isct/Protocol/IsctProtocolLib.mak new file mode 100644 index 0000000..0645759 --- /dev/null +++ b/Board/EM/Isct/Protocol/IsctProtocolLib.mak @@ -0,0 +1,68 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctProtocolLib/IsctProtocolLib.mak 1 9/02/12 11:20p Bensonlai $ +# +# $Revision: 1 $ +# +# $Date: 9/02/12 11:20p $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctProtocolLib/IsctProtocolLib.mak $ +# +# 1 9/02/12 11:20p Bensonlai +# Intel Smart Connect Technology initially releases. +# +# +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: IsctProtocolLib.mak +# +# Description: Make file to build IsctProtocolLib components +# +# +#<AMI_FHDR_END> +#********************************************************************** + +all : IsctProtocolLib + +$(BUILD_DIR)\IsctProtocolLib.lib : IsctProtocolLib + +IsctProtocolLib : $(BUILD_DIR)\IsctProtocolLib.mak IsctProtocolLibBin + +$(BUILD_DIR)\IsctProtocolLib.mak : $(IsctProtocolLib_DIR)\$(@B).cif $(IsctProtocolLib_DIR)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(IsctProtocolLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) + +IsctProtocolLibBin : + $(MAKE) /$(MAKEFLAGS) $(EDK_DEFAULTS)\ + /f $(BUILD_DIR)\IsctProtocolLib.mak all\ + "MY_INCLUDES=$(EDK_INCLUDES) $(MISCFRAMEWORK_INCLUDES) $(EdkIIGlueLib_INCLUDES)" \ + TYPE=LIBRARY + +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* diff --git a/Board/EM/Isct/Protocol/IsctProtocolLib.sdl b/Board/EM/Isct/Protocol/IsctProtocolLib.sdl new file mode 100644 index 0000000..add6e76 --- /dev/null +++ b/Board/EM/Isct/Protocol/IsctProtocolLib.sdl @@ -0,0 +1,82 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctProtocolLib/IsctProtocolLib.sdl 1 9/02/12 11:20p Bensonlai $ +# +# $Revision: 1 $ +# +# $Date: 9/02/12 11:20p $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctProtocolLib/IsctProtocolLib.sdl $ +# +# 1 9/02/12 11:20p Bensonlai +# Intel Smart Connect Technology initially releases. +# +# +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: IsctProtocolLib.sdl +# +# Description: SDL file for IsctProtocolLib +# +# +#<AMI_FHDR_END> +#********************************************************************** + +TOKEN + Name = IsctProtocolLib_SUPPORT + Value = 1 + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + Master = Yes + Help = "Main switch to enable IsctProtocolLib support in Project" +End + +MODULE + Help = "Includes IsctProtocolLib.mak to Project" + File = "IsctProtocolLib.mak" +End + +PATH + Name = "IsctProtocolLib_DIR" +End + +ELINK + Name = "IsctProtocolLib_LIB" + InvokeOrder = ReplaceParent +End + +ELINK + Name = "$(BUILD_DIR)\IsctProtocolLib.lib" + Parent = "IsctProtocolLib_LIB" + InvokeOrder = AfterParent +End +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* diff --git a/Board/EM/Isct/Smm/IsctSmm.c b/Board/EM/Isct/Smm/IsctSmm.c new file mode 100644 index 0000000..9f9e95d --- /dev/null +++ b/Board/EM/Isct/Smm/IsctSmm.c @@ -0,0 +1,987 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctSmm/IsctSmm.c 8 7/16/14 12:28a Mirayang $ +// +// $Revision: 8 $ +// +// $Date: 7/16/14 12:28a $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctSmm/IsctSmm.c $ +// +// 8 7/16/14 12:28a Mirayang +// Add complete function with iRST. +// +// 7 7/11/14 10:31a Mirayang +// Fix iRST bulid error. +// +// 6 7/08/14 5:11a Mirayang +// EIP142924 iSCT 5.0 for Shark Bay Platform +// +// 5 6/02/13 10:53a Joshchou +// [TAG] EIP125348 +// [Category] Improvement +// [Description] [SBY] Intel Smart Connect Technology BIOS Sample Code +// 052413 Update +// +// 4 1/18/13 12:49a Bensonlai +// [TAG] EIP112016 +// [Category] Bug Fix +// [Severity] Normal +// [Symptom] ISCT can't use the actual time to wake up the system. +// [RootCause] Only support duration time +// [Solution] Implementation of the actual time for ISCT +// [Files] IsctSmm.c +// +// 3 1/11/13 4:43a Bensonlai +// [TAG] EIP112016 +// [Category] Bug Fix +// [Severity] Normal +// [Symptom] ISCT can't use the actual time to wake up the system. +// [RootCause] Only support duration time +// [Solution] Implementation of the actual time for ISCT +// [Files] IsctSmm.c +// +// 2 9/26/12 2:01a Bensonlai +// [TAG] None +// [Category] Improvement +// [Description] Modified comment +// [Files] +// +// 1 9/02/12 11:19p Bensonlai +// Intel Smart Connect Technology initially releases. +// +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: IsctSmm.c +// +// Description: Main implementation source file for the Isct SMM driver +// +//<AMI_FHDR_END> +//********************************************************************** + +#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000) +#include "EdkIIGlueDxe.h" + +#include "PchRegs.h" + +#include EFI_PROTOCOL_CONSUMER (LoadedImage) +#include EFI_PROTOCOL_DEPENDENCY (SmmBase) +#include EFI_PROTOCOL_DEPENDENCY (SmmSxDispatch) +#include EFI_PROTOCOL_DEPENDENCY (DevicePath) +#include EFI_PROTOCOL_DEPENDENCY (IsctNvsArea) +#include EFI_GUID_DEFINITION (IsctPersistentData) +#endif + +#include <token.h> +// +// Module global variables +// +EFI_GUID gIsctNvsAreaProtocolGuid = ISCT_NVS_AREA_PROTOCOL_GUID; + +ISCT_PERSISTENT_DATA *mIsctData; +ISCT_NVS_AREA *mIsctNvs; +// ami override start +EFI_RUNTIME_SERVICES *mySMMgRT = NULL; +// ami override end + +STATIC UINT8 mDaysOfMonthInfo[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + +#define R_PCH_RTC_INDEX_ALT 0x74 +#define R_PCH_RTC_TARGET_ALT 0x75 +#define R_PCH_RTC_EXT_INDEX_ALT 0x76 +#define R_PCH_RTC_EXT_TARGET_ALT 0x77 + +#define R_PCH_RTC_REGC 0x0C +#define B_PCH_RTC_REGC_AF 0x20 + +#define RTC_INDEX_MASK 0x7F +#define RTC_BANK_SIZE 0x80 + +#define R_PCH_RTC_SECOND 0x00 +#define R_PCH_RTC_ALARM_SECOND 0x01 +#define R_PCH_RTC_MINUTE 0x02 +#define R_PCH_RTC_ALARM_MINUTE 0x03 +#define R_PCH_RTC_HOUR 0x04 +#define R_PCH_RTC_ALARM_HOUR 0x05 +#define R_PCH_RTC_DAY_OF_WEEK 0x06 +#define R_PCH_RTC_DAY_OF_MONTH 0x07 +#define R_PCH_RTC_MONTH 0x08 +#define R_PCH_RTC_YEAR 0x09 + +#define DAY_IN_SEC (24 * 60 * 60) +// ami override Start +#if defined(RapidStart_SUPPORT) && (RapidStart_SUPPORT == 1) +#define RAPID_START_FLAG_ENTRY_DONE BIT0 +#endif +// ami override End + +#pragma pack(1) +typedef struct { + UINT16 Year; + UINT8 Month; + UINT8 Date; + UINT8 Hour; + UINT8 Minute; + UINT8 Second; +} RTC_TIME; +#pragma pack() + +// ami override Start +#define EFI_SMM_RUNTIME_SERVICES_TABLE_GUID \ + { 0x395c33fe, 0x287f, 0x413e, { 0xa0, 0x55, 0x80, 0x88, 0xc0, 0xe1, 0xd4, 0x3e } } + +EFI_GUID SmmRtServTableGuid = EFI_SMM_RUNTIME_SERVICES_TABLE_GUID; +EFI_SMM_BASE_PROTOCOL *mSmmBase; +EFI_SMM_SYSTEM_TABLE *mSmst = NULL; + +VOID* InternalGetSmstConfigurationTable(IN EFI_GUID *TableGuid) { + EFI_CONFIGURATION_TABLE *Table; + UINTN i; + EFI_STATUS Status; + + if (mSmmBase == NULL) { + Status = gBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, &mSmmBase); + if (EFI_ERROR(Status) || mSmmBase == NULL)return NULL; + } + + if (mSmst == NULL ) { + if (mSmmBase!=NULL) { + Status = mSmmBase->GetSmstLocation (mSmmBase, &mSmst); + if (EFI_ERROR(Status) || mSmst == NULL)return NULL; + } + } + + if (mSmst != NULL) { + Table = mSmst->SmmConfigurationTable; + i = mSmst->NumberOfTableEntries; + + for (; i; --i,++Table) + { + if (CompareGuid(&Table->VendorGuid,TableGuid)) + return Table->VendorTable; + } + } + return NULL; +} +// ami override End + +UINT8 +RtcRead ( + IN UINT8 Location + ) +/*++ + +Routine Description: + + Read specific RTC/CMOS RAM + +Arguments: + + Location Point to RTC/CMOS RAM offset for read + +Returns: + + The data of specific location in RTC/CMOS RAM. + +--*/ +{ + UINT8 RtcIndexPort; + UINT8 RtcDataPort; + + // + // CMOS access registers (using alternative access not to handle NMI bit) + // + if (Location < RTC_BANK_SIZE) { + // + // First bank + // + RtcIndexPort = R_PCH_RTC_INDEX_ALT; + RtcDataPort = R_PCH_RTC_TARGET_ALT; + } else { + // + // Second bank + // + RtcIndexPort = R_PCH_RTC_EXT_INDEX_ALT; + RtcDataPort = R_PCH_RTC_EXT_TARGET_ALT; + } + + IoWrite8 (RtcIndexPort, Location & RTC_INDEX_MASK); + return IoRead8 (RtcDataPort); +} + +BOOLEAN +RtcIsAlarmEnabled ( + VOID + ) +/*++ + +Routine Description: + + Check if RTC Alarm has been enabled. + +Arguments: + + None + +Returns: + + TRUE RTC Alarm is enabled + FALSE RTC Alarm is not enabled + +--*/ +{ + return (RtcRead (R_PCH_RTC_REGB) & B_PCH_RTC_REGB_AIE) != 0; +} + +STATIC +VOID +RtcWaitEndOfUpdate ( + VOID + ) +/*++ + +Routine Description: + + Wait for updating RTC process finished. + +Arguments: + + None + +Returns: + + None + +--*/ +{ + while (RtcRead (R_PCH_RTC_REGA) & B_PCH_RTC_REGA_UIP) { + } +} + +EFI_STATUS +RtcGetAlarm ( + OUT RTC_TIME *tm + ) +/*++ + +Routine Description: + + Get current RTC Alarm time. + +Arguments: + + tm A structure which will be updated with current RTC Alarm time + +Returns: + + EFI_NOT_STARTED RTC Alarm has not been enabled yet. + EFI_SUCCESS RTC Alarm enabled and RTC_TIME structure contain current Alarm time setting. + +--*/ +{ + ASSERT (tm != NULL); + if (!RtcIsAlarmEnabled ()) { + return EFI_NOT_STARTED; + } + + RtcWaitEndOfUpdate (); + tm->Second = BcdToDecimal8 (RtcRead (R_PCH_RTC_ALARM_SECOND)); + tm->Minute = BcdToDecimal8 (RtcRead (R_PCH_RTC_ALARM_MINUTE)); + tm->Hour = BcdToDecimal8 (RtcRead (R_PCH_RTC_ALARM_HOUR)); + tm->Date = BcdToDecimal8 (RtcRead (R_PCH_RTC_REGD) & 0x3F); + tm->Month = 0; + tm->Year = 0; + return EFI_SUCCESS; +} + +VOID +RtcWrite ( + IN UINT8 Location, + IN UINT8 Value + ) +/*++ + +Routine Description: + + Write specific RTC/CMOS RAM + +Arguments: + + Location Point to RTC/CMOS RAM offset for write + Value The data that will be written to RTC/CMOS RAM + +Returns: + + None + +--*/ +{ + UINT8 RtcIndexPort; + UINT8 RtcDataPort; + + // + // CMOS access registers (using alternative access not to handle NMI bit) + // + if (Location < RTC_BANK_SIZE) { + // + // First bank + // + RtcIndexPort = R_PCH_RTC_INDEX_ALT; + RtcDataPort = R_PCH_RTC_TARGET_ALT; + } else { + // + // Second bank + // + RtcIndexPort = R_PCH_RTC_EXT_INDEX_ALT; + RtcDataPort = R_PCH_RTC_EXT_TARGET_ALT; + } + + IoWrite8 (RtcIndexPort, Location & RTC_INDEX_MASK); + IoWrite8 (RtcDataPort, Value); +} + +EFI_STATUS +RtcSetAlarm ( + IN RTC_TIME *tm + ) +/*++ + +Routine Description: + + Set RTC Alarm with specific time + +Arguments: + + tm A time interval structure which will be used to setup an RTC Alarm + +Returns: + + EFI_SUCCESS RTC Alarm has been enabled with specific time interval + +--*/ +{ + UINT8 RegB; + + ASSERT (tm != NULL); + //EFI_DEADLOOP(); + RegB = RtcRead (R_PCH_RTC_REGB); + + RtcWaitEndOfUpdate (); + + // + // Inhibit update cycle + // + RtcWrite (R_PCH_RTC_REGB, RegB | B_PCH_RTC_REGB_SET); + + RtcWrite (R_PCH_RTC_ALARM_SECOND, DecimalToBcd8 (tm->Second)); + RtcWrite (R_PCH_RTC_ALARM_MINUTE, DecimalToBcd8 (tm->Minute)); + RtcWrite (R_PCH_RTC_ALARM_HOUR, DecimalToBcd8 (tm->Hour)); + RtcWrite (R_PCH_RTC_REGD, DecimalToBcd8 (tm->Date)); + + // + // Allow update cycle and enable wake alarm + // + RegB &= ~B_PCH_RTC_REGB_SET; + RtcWrite (R_PCH_RTC_REGB, RegB | B_PCH_RTC_REGB_AIE); + + return EFI_SUCCESS; +} + +EFI_STATUS +RtcGetTime ( + OUT RTC_TIME *tm + ) +/*++ + +Routine Description: + + Get current RTC time + +Arguments: + + tm RTC time structure including Second, Minute and Hour, Date, Month, Year. + +Returns: + + EFI_SUCCESS Operation successfully and RTC_TIME structure contained current time. + +--*/ +{ + ASSERT (tm != NULL); + RtcWaitEndOfUpdate (); + tm->Second = BcdToDecimal8 (RtcRead (R_PCH_RTC_SECOND)); + tm->Minute = BcdToDecimal8 (RtcRead (R_PCH_RTC_MINUTE)); + tm->Hour = BcdToDecimal8 (RtcRead (R_PCH_RTC_HOUR)); + tm->Date = BcdToDecimal8 (RtcRead (R_PCH_RTC_DAY_OF_MONTH)); + tm->Month = BcdToDecimal8 (RtcRead (R_PCH_RTC_MONTH)); + tm->Year = (UINT16)BcdToDecimal8 (RtcRead (R_PCH_RTC_YEAR)) + 2000; + return EFI_SUCCESS; +} + +STATIC +UINT32 +TimeToSeconds ( + IN RTC_TIME *tm + ) +/*++ + +Routine Description: + + Convert RTC_TIME structure data to seconds + +Arguments: + + tm A time data structure including second, minute and hour fields. + +Returns: + + A number of seconds converted from given RTC_TIME structure data. + +--*/ +{ + ASSERT (tm->Hour < 24); + ASSERT (tm->Minute < 60); + ASSERT (tm->Second < 60); + return ((tm->Hour * 60) + tm->Minute) * 60 + tm->Second; +} + +STATIC +VOID +SecondsToTime ( + OUT RTC_TIME *tm, + IN UINT32 Seconds + ) +/*++ + +Routine Description: + + Convert seconds to RTC_TIME structure data + +Arguments: + + tm A time data structure which will be updated with converted value. + Seconds Total seconds that will be converted into RTC_TIME + +Returns: + + None + +--*/ +{ + tm->Second = Seconds % 60; + Seconds /= 60; + tm->Minute = Seconds % 60; + Seconds /= 60; + tm->Hour = Seconds % 24; + tm->Date = 0; +} + +BOOLEAN +IsLeapYear ( + IN UINT16 Year +) +/*++ + +Routine Description: + + Check if it is leap year + +Arguments: + + Year year to be check + +Returns: + + True year is leap year + FALSE year is not a leap year + +--*/ +{ + return (Year%4 == 0) && ((Year%100 != 0) || (Year%400 == 0)); +} + +UINT8 +DaysOfMonth ( + IN UINT16 Year, + IN UINT8 Month +) +/*++ + +Routine Description: + + Get days of the month + +Arguments: + + Year Year number + Month Month number, January is 1, Feburary is 2, ... December is 12. + +Returns: + + Days Number of day of the Month of the Year + +--*/ +{ + UINT8 Days; + if (Month < 1 || Month > 12) { + return 0; + } + Days = mDaysOfMonthInfo[Month-1]; + if (Month == 2) { + Days += IsLeapYear(Year); + } + return (Days); +} + +BOOLEAN +IsOver2Days ( + IN RTC_TIME *tm1, + IN RTC_TIME *tm2 +) +/*++ + +Routine Description: + + check if tm2 is after 2 days of tm1 + +Arguments: + + tm1 First time to compare + tm2 Second time to compare + +Returns: + + True tm2 is 2 days after tm1 + FALSE tm2 is not 2 days after tm1 + +--*/ +{ + BOOLEAN RetVal; + RetVal = TRUE; + if (tm2->Date > tm1->Date) { + if (tm2->Date - tm1->Date == 1) { + RetVal = FALSE;; + } + } else if ((DaysOfMonth (tm1->Year, tm1->Month) == tm1->Date) && (tm2->Date == 1)) { + RetVal = FALSE;; + } + return RetVal; +} + +EFI_STATUS +GetISCTTime ( + IN UINT32 ISCTRtcDurationTime, + OUT RTC_TIME *tm +) +{ + ASSERT (tm != NULL); + ISCTRtcDurationTime &= ~BIT31; + tm->Second = (UINT8)(ISCTRtcDurationTime & 0x3F); + tm->Minute = (UINT8)((ISCTRtcDurationTime >> 6) & 0x3F); + tm->Hour = (UINT8)((ISCTRtcDurationTime >> 12) & 0x1F); + tm->Date = (UINT8)((ISCTRtcDurationTime >> 17) & 0x1F); + tm->Month = (UINT8)((ISCTRtcDurationTime >> 22) & 0x0F); + tm->Year = (UINT8)((ISCTRtcDurationTime >> 26) & 0x1F) + 2000; + return EFI_SUCCESS; +} + +// ami override Start +#if defined(RapidStart_SUPPORT) && (RapidStart_SUPPORT == 1) +EFI_STATUS +RapidStartGetFlag ( + OUT UINT8 *Value + ) +{ + *Value = RtcRead (FFS_NV_FLAG_REG); + return EFI_SUCCESS; +} +// ami override End +#endif + +STATIC +EFI_STATUS +IsctSxEntryCallback ( + IN UINT8 SleepState + ) +/*++ + +Routine Description: + + ISCT S3/S4 entry callback SMI handler + +Arguments: + + SleepState - Which sleep state is being entered + +Returns: + + EFI_SUCCESS - Function executed successfully + +--*/ +{ + EFI_STATUS Status; + RTC_TIME rtc_tm; + RTC_TIME wake_tm; + RTC_TIME alarm_tm; + RTC_TIME Isct_Actual_tm; + UINT32 IsctDuration; + UINT32 CurrentTime; + UINT32 AlarmTime; + UINT32 WakeTime; + UINT16 PmBase; + UINT8 RegB; + BOOLEAN UseIsctTimer; + BOOLEAN Over2Days; +//ami override begin + ISCT_PERSISTENT_DATA IsctData; + UINTN VarSize; + UINT32 Attributes = 0; +#if defined(RapidStart_SUPPORT) && (RapidStart_SUPPORT == 1) + BOOLEAN RapidStartFlag; +#endif +// ami override End + // + // Check iFFS exist. If iFFS exist, iFFS will handler RTC comparing. + // + + if ( mIsctNvs->RtcDurationTime == 0) { + return EFI_SUCCESS; + } + +// ami override Start +#if defined(RapidStart_SUPPORT) && (RapidStart_SUPPORT == 1) + Status = RapidStartGetFlag (&RapidStartFlag); + if ( !EFI_ERROR (Status) && ((RapidStartFlag & RAPID_START_FLAG_ENTRY_DONE) != 0)) { + DEBUG ((EFI_D_INFO, "IsctSMM: RapidStartFlag \n")); + return EFI_SUCCESS; + } +#endif +// ami override End + + UseIsctTimer = FALSE; + Over2Days = FALSE; + mIsctNvs->IsctOverWrite = 0; + IsctDuration = mIsctNvs->RtcDurationTime; + + // + // Make sure RTC is in BCD and 24h format + // + RegB = RtcRead (R_PCH_RTC_REGB); + RegB |= B_PCH_RTC_REGB_HOURFORM; + RegB &= ~B_PCH_RTC_REGB_DM; + RtcWrite (R_PCH_RTC_REGB, RegB); + + // + // Get RTC Timer and convert RTC_TIME to seconds + // + Status = RtcGetTime (&rtc_tm); + if ( EFI_ERROR(Status) ) { + return Status; + } + + CurrentTime = TimeToSeconds (&rtc_tm); + if ( (IsctDuration & BIT31) == BIT31 ) { //Actual time + GetISCTTime(IsctDuration, &Isct_Actual_tm); + IsctDuration = TimeToSeconds (&Isct_Actual_tm); + IsctDuration -= CurrentTime; + } + Status = RtcGetAlarm (&wake_tm); + if (Status == EFI_SUCCESS) { + AlarmTime = TimeToSeconds (&wake_tm); + // + // When OS set alarm date to zero, + // that would mean the alarm date is today or next day depending alarm time, + // and the alarm will happen in 24 hour. + if (wake_tm.Date != 0 && wake_tm.Date != rtc_tm.Date) { + // + // OS Wake-up time is over 1 day + // + AlarmTime += DAY_IN_SEC; + if (IsOver2Days (&rtc_tm, &wake_tm)) { + // + // OS Wake-up time is over 2 day + // + UseIsctTimer = TRUE; + Over2Days = TRUE; + } + } else if (AlarmTime < CurrentTime && wake_tm.Date == 0) { + // + // When alarm time behind current time and alarm date is zero, + // OS set the alarm for next day + // + AlarmTime += DAY_IN_SEC; + } + + if ((IsctDuration <= (AlarmTime - CurrentTime)) && (Over2Days == FALSE)) { + UseIsctTimer = TRUE; + } + } else { + UseIsctTimer = TRUE; + } + + // + // if ISCT Timer <= OS RTC alarm timer, then overwrite RTC alarm by ISCT timer + // + if (UseIsctTimer == TRUE) { + WakeTime = CurrentTime + IsctDuration; + SecondsToTime (&alarm_tm, WakeTime); + Status = RtcSetAlarm (&alarm_tm); + ASSERT_EFI_ERROR (Status); + + PmBase = (UINT16) (PciRead32 ( + PCI_LIB_ADDRESS (DEFAULT_PCI_BUS_NUMBER_PCH, + PCI_DEVICE_NUMBER_PCH_LPC, + PCI_FUNCTION_NUMBER_PCH_LPC, + R_PCH_LPC_ACPI_BASE) + ) & B_PCH_LPC_ACPI_BASE_BAR); + + // + // Clear RTC PM1 status + // + IoWrite16 (PmBase + R_PCH_ACPI_PM1_STS, B_PCH_ACPI_PM1_STS_RTC); + + // + // set RTC_EN bit in PM1_EN to wake up from the alarm + // + IoWrite16 ( + PmBase + R_PCH_ACPI_PM1_EN, + (IoRead16 (PmBase + R_PCH_ACPI_PM1_EN) | B_PCH_ACPI_PM1_EN_RTC) + ); + + mIsctNvs->IsctOverWrite = 1; + } + +// ami override Start + + // + // Update Isct RTC usage flag in ISCT persistent data struct. + // + VarSize = sizeof (ISCT_PERSISTENT_DATA); + + Status = mySMMgRT->GetVariable( ISCT_PERSISTENT_DATA_NAME, + &gIsctPersistentDataGuid, + &Attributes, + &VarSize, + &IsctData ); + + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + + IsctData.IsctOverWrite = mIsctNvs->IsctOverWrite; + + Status = mySMMgRT->SetVariable( ISCT_PERSISTENT_DATA_NAME, + &gIsctPersistentDataGuid, + Attributes, + VarSize, + &IsctData ); + + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } +//ami override end + + return EFI_SUCCESS; +} + +STATIC +EFI_STATUS +IsctS3EntryCallback ( + IN EFI_HANDLE DispatchHandle, + IN EFI_SMM_SX_DISPATCH_CONTEXT *DispatchContext + ) +/** + ISCT S3 entry callback SMI handler + + @param[in] DispatchHandle - The handle of this callback, obtained when registering + @param[in] DispatchContext - Pointer to the EFI_SMM_SW_DISPATCH_CONTEXT + @param[in] CommBuffer - Physical address of memory data passed from non-SMM to SMM mode + @param[in] CommBufferSize - Size of the CommBuffer +**/ +{ + EFI_STATUS Status; + DEBUG((EFI_D_INFO, "Inside ISCT S3 Entry SMM handler \n")); + Status = IsctSxEntryCallback(0x3); + if(Status == EFI_SUCCESS) { + return EFI_SUCCESS; + } else { + return EFI_ABORTED; + } +} + +STATIC +EFI_STATUS +IsctS4EntryCallback ( + IN EFI_HANDLE DispatchHandle, + IN EFI_SMM_SX_DISPATCH_CONTEXT *DispatchContext + ) +/*++ + +Routine Description: + + ISCT S4 entry callback SMI handler + +Arguments: + + DispatchHandle - The handle of this callback, obtained when registering + DispatchContext - Pointer to the EFI_SMM_SW_DISPATCH_CONTEXT + +Returns: + + EFI_SUCCESS - Function executed successfully + EFI_ABORTED - An error occurred. + +--*/ +{ + EFI_STATUS Status; + + Status = IsctSxEntryCallback(0x4); + if(Status == EFI_SUCCESS) { + return EFI_SUCCESS; + } else { + return EFI_ABORTED; + } +} +// ami override End + +EFI_STATUS +InstallIsctSmm ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +/*++ + +Routine Description: + + Isct SMM driver entry point function. + +Arguments: + + ImageHandle - image handle for this driver image + SystemTable - pointer to the EFI System Table + +Returns: + + EFI_SUCCESS - driver initialization completed successfully + +--*/ +{ + EFI_STATUS Status; +// ami override Start + EFI_HANDLE DispatchHandleS3; + EFI_HANDLE DispatchHandleS4; +// ami override End + EFI_SMM_SX_DISPATCH_PROTOCOL *SxDispatchProtocol; + EFI_SMM_SX_DISPATCH_CONTEXT EntryDispatchContext; + ISCT_NVS_AREA_PROTOCOL *IsctNvsAreaProtocol; +// ami override Start + VOID *ptrRs; +// ami override End + DEBUG ((EFI_D_INFO, "IsctSmm Entry Point- Install\n")); + +// ami override Start + ptrRs = InternalGetSmstConfigurationTable(&SmmRtServTableGuid); + if (ptrRs!=NULL) mySMMgRT = ptrRs; +// ami override End + + // + // Located ISCT Nvs Protocol + // + Status = gBS->LocateProtocol ( + &gIsctNvsAreaProtocolGuid, + NULL, + &IsctNvsAreaProtocol + ); + DEBUG((EFI_D_INFO, "(ISCT SMM) Located ISCT Nvs protocol Status = %x\n", Status)); + + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_ERROR, "No ISCT Nvs protocol available\n")); + return EFI_SUCCESS; + } + + + if (IsctNvsAreaProtocol->Area->IsctEnabled == 0) { + DEBUG ((EFI_D_INFO, "ISCT is Disbaled \n")); + return EFI_SUCCESS; + } + + // + // Assign NvsPointer to Global Module Variable + // + mIsctData = IsctNvsAreaProtocol->IsctData; + mIsctNvs = IsctNvsAreaProtocol->Area; + + // + // Loacted SxDispatchProtocol + // + Status = gBS->LocateProtocol ( + &gEfiSmmSxDispatchProtocolGuid, + NULL, + &SxDispatchProtocol + ); + if ( EFI_ERROR(Status) ) { + DEBUG((EFI_D_INFO, "(ISCT SMM) Located SxDispatchProtocol protocol Status = %x\n", Status)); + return Status; + } +// ami override Start + // + // Register S3 entry phase call back function + // + EntryDispatchContext.Type = SxS3; + EntryDispatchContext.Phase = SxEntry; + Status = SxDispatchProtocol->Register ( + SxDispatchProtocol, + IsctS3EntryCallback, + &EntryDispatchContext, + &DispatchHandleS3 + ); + DEBUG((EFI_D_INFO, "(ISCT SMM) Register IsctS3EntryCallback Status = %x\n", Status)); + EntryDispatchContext.Type = SxS4; + Status = SxDispatchProtocol->Register ( + SxDispatchProtocol, + IsctS4EntryCallback, + &EntryDispatchContext, + &DispatchHandleS4 + ); + DEBUG((EFI_D_INFO, "(ISCT SMM) Register S4 IsctSxEntryCallback Status = %x\n", Status)); + if (EFI_ERROR (Status)) { + DEBUG((EFI_D_INFO, "IsctSxEntryCallback failed to load.\n")); + ASSERT_EFI_ERROR (Status); + return Status; + } +// ami override End + return EFI_SUCCESS; +} + +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** diff --git a/Board/EM/Isct/Smm/IsctSmm.cif b/Board/EM/Isct/Smm/IsctSmm.cif new file mode 100644 index 0000000..1c0f19d --- /dev/null +++ b/Board/EM/Isct/Smm/IsctSmm.cif @@ -0,0 +1,11 @@ +<component> + name = "IsctSmm" + category = ModulePart + LocalRoot = "Board\EM\Isct\Smm" + RefName = "IsctSmm" +[files] +"IsctSmm.c" +"IsctSmm.dxs" +"IsctSmm.sdl" +"IsctSmm.mak" +<endComponent> diff --git a/Board/EM/Isct/Smm/IsctSmm.dxs b/Board/EM/Isct/Smm/IsctSmm.dxs new file mode 100644 index 0000000..24979e0 --- /dev/null +++ b/Board/EM/Isct/Smm/IsctSmm.dxs @@ -0,0 +1,69 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctSmm/IsctSmm.dxs 1 9/02/12 11:19p Bensonlai $ +// +// $Revision: 1 $ +// +// $Date: 9/02/12 11:19p $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctSmm/IsctSmm.dxs $ +// +// 1 9/02/12 11:19p Bensonlai +// Intel Smart Connect Technology initially releases. +// +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: IsctSmm.dxs +// +// Description: Dependency expression file for IsctSmm Driver. +// +//<AMI_FHDR_END> +//********************************************************************** + +#include "AutoGen.h" +#include "DxeDepex.h" + +#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB) +#include "EfiDepex.h" + +#include EFI_PROTOCOL_DEPENDENCY (SmmBase) +#include EFI_PROTOCOL_DEPENDENCY (SmmSxDispatch) +#include EFI_ARCH_PROTOCOL_DEFINITION (Variable) +#endif + +DEPENDENCY_START + EFI_SMM_BASE_PROTOCOL_GUID AND + EFI_SMM_SX_DISPATCH_PROTOCOL_GUID AND + EFI_VARIABLE_ARCH_PROTOCOL_GUID +DEPENDENCY_END + +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2012, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** diff --git a/Board/EM/Isct/Smm/IsctSmm.mak b/Board/EM/Isct/Smm/IsctSmm.mak new file mode 100644 index 0000000..932d3ba --- /dev/null +++ b/Board/EM/Isct/Smm/IsctSmm.mak @@ -0,0 +1,118 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctSmm/IsctSmm.mak 1 9/02/12 11:19p Bensonlai $ +# +# $Revision: 1 $ +# +# $Date: 9/02/12 11:19p $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctSmm/IsctSmm.mak $ +# +# 1 9/02/12 11:19p Bensonlai +# Intel Smart Connect Technology initially releases. +# +# +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: IsctSmm.mak +# +# Description: Make file to build IsctSmm components +# +# +#<AMI_FHDR_END> +#********************************************************************** + +EDK : IsctSmm + +IsctSmm : $(BUILD_DIR)\IsctSmm.mak IsctSmmBin + +$(BUILD_DIR)\IsctSmm.mak : $(IsctSmm_DIR)\$(@B).cif $(IsctSmm_DIR)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(IsctSmm_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) + +IsctSmm_INCLUDES=\ + $(INTEL_PCH_INCLUDES)\ + $(INTEL_MCH_INCLUDES)\ + $(EdkIIGlueLib_INCLUDES)\ + /I$(IntelPlatformProtocolLib_DIR)\ + /I$(ISCT_PLATFORM_DIR)\ + +IsctSmm_DEFINES = $(MY_DEFINES)\ + /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=InstallIsctSmm"\ + /D __EDKII_GLUE_BASE_LIB__ \ + /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \ + /D __EDKII_GLUE_BASE_MEMORY_LIB__ \ + /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \ + /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \ + /D __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__ \ + /D __EDKII_GLUE_UEFI_LIB__ \ + /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \ + /D __EDKII_GLUE_UEFI_DEVICE_PATH_LIB__ \ + /D __EDKII_GLUE_BASE_PCI_LIB_PCI_EXPRESS__ \ + +IsctSmm_LIB_LINKS =\ + $(EFIPROTOCOLLIB)\ + $(EDKPROTOCOLLIB)\ + $(EDKFRAMEWORKPROTOCOLLIB)\ + $(EdkIIGlueBaseLib_LIB)\ +!IF "$(x64_BUILD)"=="1" + $(EdkIIGlueBaseLibX64_LIB)\ +!ELSE + $(EdkIIGlueBaseLibIA32_LIB)\ +!ENDIF + $(ArchProtocolLib)\ + $(EdkIIGlueBaseIoLibIntrinsic_LIB)\ + $(EdkIIGlueBaseMemoryLib_LIB)\ + $(EdkIIGlueDxeMemoryAllocationLib_LIB)\ + $(EdkIIGlueDxeServicesTableLib_LIB)\ + $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\ + $(EdkIIGlueSmmRuntimeDxeReportStatusCodeLib_LIB)\ + $(EdkIIGlueBasePciLibPciExpress_LIB)\ + $(EdkIIGlueUefiLib_LIB)\ + $(EdkIIGlueUefiBootServicesTableLib_LIB)\ + $(EdkIIGlueUefiDevicePathLib_LIB)\ + $(PchPlatformSmmLib_LIB)\ + $(INTEL_PCH_PROTOCOL_LIB)\ + $(IsctGuidLib_LIB)\ + $(IsctProtocolLib_LIB)\ + +IsctSmmBin: $(IsctSmm_LIB_LINKS) + $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\ + /f $(BUILD_DIR)\IsctSmm.mak all \ + "MY_INCLUDES=$(IsctSmm_INCLUDES)" \ + "MY_DEFINES=$(IsctSmm_DEFINES)" \ + GUID=DBD5B6BA-6734-4C5D-BF53-2C210D93A012\ + ENTRY_POINT=_ModuleEntryPoint \ + TYPE=BS_DRIVER\ + EDKIIModule=SMMDRIVER\ + DEPEX1=$(IsctSmm_DIR)\IsctSmm.dxs\ + DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \ + COMPRESS=1 +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* diff --git a/Board/EM/Isct/Smm/IsctSmm.sdl b/Board/EM/Isct/Smm/IsctSmm.sdl new file mode 100644 index 0000000..da11043 --- /dev/null +++ b/Board/EM/Isct/Smm/IsctSmm.sdl @@ -0,0 +1,78 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctSmm/IsctSmm.sdl 1 9/02/12 11:19p Bensonlai $ +# +# $Revision: 1 $ +# +# $Date: 9/02/12 11:19p $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ISCT/IsctSmm/IsctSmm.sdl $ +# +# 1 9/02/12 11:19p Bensonlai +# Intel Smart Connect Technology initially releases. +# +# +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: IsctSmm.sdl +# +# Description: SDL file for IsctSmm +# +# +#<AMI_FHDR_END> +#********************************************************************** + +TOKEN + Name = "IsctSmm_SUPPORT" + Value = "1" + Help = "Main switch to enable IsctSmm support in Project" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + Master = Yes +End + +PATH + Name = "IsctSmm_DIR" +End + +MODULE + File = "IsctSmm.mak" + Help = "Includes IsctSmm.mak to Project" +End + +ELINK + Name = "$(BUILD_DIR)\IsctSmm.ffs" + Parent = "FV_MAIN" + InvokeOrder = AfterParent +End + +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2012, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* |