diff --git a/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/Bat0Virt.asl b/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/Bat0Virt.asl index bd8efbe9..d8e91208 100644 --- a/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/Bat0Virt.asl +++ b/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/Bat0Virt.asl @@ -18,7 +18,7 @@ Device (BAT0) Method (_STA, 0) { - If (And (BATP, BIT1)) // Virtual Battery is supported. + If (And (BATS, BIT1)) // Virtual Battery is supported. { If (And (BNUM, 3)) // Real Battery 1 or 2 present? { diff --git a/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/Bat1Real.asl b/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/Bat1Real.asl index c67d51e1..473216f9 100644 --- a/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/Bat1Real.asl +++ b/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/Bat1Real.asl @@ -17,7 +17,7 @@ Device (BAT1) { Name (_UID, 1) Method (_STA, 0) { - If (And (BATP, BIT0)) { // Battery is supported. + If (And (BATS, BIT0)) { // Battery is supported. If (And (BNUM, BIT0)) { // Real Battery 1 present? Return (0x001F) // Yes. Show it. } Else { @@ -45,13 +45,13 @@ Device (BAT1) { }) If (ECAV) { - If (LAnd (LAnd (ECRD (RefOf (B1DV)), ECRD (RefOf (^^B1FC))), ECRD (RefOf (B1DC)))) { + If (LAnd (LAnd (ECRD (RefOf (B1DV)), ECRD (RefOf (B1FC))), ECRD (RefOf (B1DC)))) { // Convert mAh and mV to mWh Store (Divide (Multiply (ECRD (RefOf (B1DC)), ECRD (RefOf (B1DV))), 1000), Index (BPK1, 1)) - Store (Divide (Multiply (ECRD (RefOf (^^B1FC)), ECRD (RefOf (B1DV))), 1000), Index (BPK1, 2)) + Store (Divide (Multiply (ECRD (RefOf (B1FC)), ECRD (RefOf (B1DV))), 1000), Index (BPK1, 2)) Store (B1DV, Index (BPK1, 4)) - Store (Divide (Multiply (ECRD (RefOf (^^B1FC)), ECRD (RefOf (B1DV))), 10000), Index (BPK1, 5)) - Store (Divide (Multiply (ECRD (RefOf (^^B1FC)), ECRD (RefOf (B1DV))), 25000), Index (BPK1, 6)) + Store (Divide (Multiply (ECRD (RefOf (B1FC)), ECRD (RefOf (B1DV))), 10000), Index (BPK1, 5)) + Store (Divide (Multiply (ECRD (RefOf (B1FC)), ECRD (RefOf (B1DV))), 25000), Index (BPK1, 6)) Store (0x100, Index (BPK1, 7)) Store (0x40, Index (BPK1, 8)) } @@ -64,7 +64,7 @@ Device (BAT1) { 0x01, // Integer Revision 0x00000000, // Power Unit = mWh. 0x0 indicates units are mW/mWh 0xFFFFFFFF, // Unknown Design Capacity. - 0xFFFFFFFF, // Unknown Last Full Charge. + 0xFFFFFFFF, // Unknown Last Full Charge Capacity. 0x00000001, // Secondary Battery Technology. 0xFFFFFFFF, // Unknown Design Voltage. 0x00000000, // 10% Warning Level. @@ -85,17 +85,18 @@ Device (BAT1) { }) If (ECAV) { - If (LAnd (LAnd (ECRD (RefOf (B1DV)), ECRD (RefOf (^^B1FC))), ECRD (RefOf (B1DC)))) { + If (LAnd (LAnd (ECRD (RefOf (B1DV)), ECRD (RefOf (B1FC))), ECRD (RefOf (B1DC)))) { // Convert mAh and mV to mWh - Store (Divide (Multiply (ECRD (RefOf (B1DC)), ECRD (RefOf (B1DV))), 1000), Index (BPK1, 2)) - Store (Divide (Multiply (ECRD (RefOf (^^B1FC)), ECRD (RefOf (B1DV))), 1000), Index (BPK1, 3)) - Store (ECRD (RefOf (B1DV)), Index (BPK1, 5)) - Store (Divide (Multiply (ECRD (RefOf (^^B1FC)), ECRD (RefOf (B1DV))), 10000), Index (BPK1, 6)) - Store (Divide (Multiply (ECRD (RefOf (^^B1FC)), ECRD (RefOf (B1DV))), 25000), Index (BPK1, 7)) + // mAh * mV = (1/1000) mWh + Store (Divide (Multiply (ECRD (RefOf (B1DC)), ECRD (RefOf (B1DV))), 1000), Index (BPK1, 2)) // Update Design Capacity + Store (Divide (Multiply (ECRD (RefOf (B1FC)), ECRD (RefOf (B1DV))), 1000), Index (BPK1, 3)) // Update Last Full Charge Capacity + Store (ECRD (RefOf (B1DV)), Index (BPK1, 5)) // Update Design Voltage + Store (Divide (Multiply (ECRD (RefOf (B1FC)), ECRD (RefOf (B1DV))), 10000), Index (BPK1, 6)) // Update Design capacity of Warning + Store (Divide (Multiply (ECRD (RefOf (B1FC)), ECRD (RefOf (B1DV))), 25000), Index (BPK1, 7)) // Update Design capacity of Low + Store (ECRD (RefOf (BICC)), Index (BPK1, 8)) // Update Cycle Count Store (0x40, Index (BPK1, 9)) - Store (0x320, Index (BPK1, 11)) Store (0x251C, Index (BPK1, 10)) - Store (ECRD (RefOf (BICC)), Index (BPK1, 8)) // Battery cycle count + Store (0x320, Index (BPK1, 11)) } } Return (BPK1) @@ -126,10 +127,10 @@ Device (BAT1) { Store (Local0, Index (PKG1, 1)) } // Calculate Remaining Capacity in mWh = - // (Remaininng Capacity (mAh) * Design Voltage (mV))/1000 - // Use Remaininng Capacity in mAh multiply with a fixed Design Voltage - // for Remaininng Capacity in mWh - Store (Divide (Multiply (ECRD (RefOf (^^B1RC)), ECRD (RefOf (B1DV))), 1000), Index (PKG1, 2)) + // Remaining Capacity (mAh) * Design Voltage (V) + // Use Remaining Capacity in mAh multiply with a fixed Design Voltage + // for Remaining Capacity in mWh + Store (Divide (Multiply (ECRD (RefOf (B1RC)), ECRD (RefOf (B1DV))), 1000), Index (PKG1, 2)) // Report Battery Present Voltage (mV) Store (ECRD (RefOf (B1FV)), Index (PKG1, 3)) } // If (ECAV) @@ -140,8 +141,8 @@ Device (BAT1) { If (ECAV) { // arg2 = Battery wake level in mWh, sent to EC as Threshold. // transfer input value from mWh to % - If (LAnd (LNotEqual (ECRD (RefOf (^^B1FC)), 0), LNotEqual (ECRD (RefOf (B1FV)), 0))) { - Store (Divide (Multiply (Arg2, 100), Divide (Multiply (ECRD (RefOf (^^B1FC)), ECRD (RefOf (B1FV))), 1000)), Local0) + If (LAnd (LNotEqual (ECRD (RefOf (B1FC)), 0), LNotEqual (ECRD (RefOf (B1FV)), 0))) { + Store (Divide (Multiply (Arg2, 100), Divide (Multiply (ECRD (RefOf (B1FC)), ECRD (RefOf (B1FV))), 1000)), Local0) // adjust offset between OS & EC Add (Local0, 1, Local0) // store TP value in EC name space offset 219 @@ -151,6 +152,7 @@ Device (BAT1) { } } } + // Return that everything runs off Battery. Method (_PCL, 0) { diff --git a/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/ConvertibleIndicator.asl b/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/ConvertibleIndicator.asl index dde7aafe..67095064 100644 --- a/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/ConvertibleIndicator.asl +++ b/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/ConvertibleIndicator.asl @@ -7,8 +7,7 @@ Device (CIND) // Convertible Indicators. { - External (\OSYS) - External (\IUCE, IntObj) + External (\OSYS, IntObj) Name (_HID, "INT33D3") Name (_CID, "PNP0C60") diff --git a/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/DockingIndicator.asl b/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/DockingIndicator.asl index 38118dc1..a84b9a05 100644 --- a/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/DockingIndicator.asl +++ b/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/DockingIndicator.asl @@ -7,8 +7,7 @@ Device (DIND) // Docking Indicators. { - External (\OSYS) - External (\IUDE, IntObj) + External (\OSYS, IntObj) Name (_HID, "INT33D4") Name (_CID, "PNP0C70") diff --git a/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/Lid0.asl b/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/Lid0.asl index ab5dcbab..d34b9d1b 100644 --- a/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/Lid0.asl +++ b/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/Devices/Lid0.asl @@ -14,8 +14,6 @@ Device (LID0) { External (\PFLV, IntObj) - External (LSWP, IntObj) - External (IUBE, IntObj) External (\GPRW, MethodObj) External (\GGPE, MethodObj) @@ -30,8 +28,13 @@ Device (LID0) Method (_LID, 0) { // 0 = Closed, 1 = Open. - - Return (ECRD (RefOf (LSTE))) + If ((ECRD (RefOf (LSTE))) == LIDS) { + Return (LIDS) + } Else { + Store(LIDS, Local0) + Store(ECRD (RefOf (LSTE)), LIDS) + Return (Local0) + } } // // Enable SCI wake for LID SWITCH diff --git a/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/EcNvs.asl b/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/EcNvs.asl index d6dc9d51..0b470cff 100644 --- a/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/EcNvs.asl +++ b/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/EcNvs.asl @@ -24,22 +24,21 @@ Offset(2), IUDE, 8, // Offset(2), IUER Dock Enable Offset(3), ECNO, 8, // Offset(3), EC Notification of Low Power S0 Idle State Offset(4), ECLP, 8, // Offset(4), EC Low Power Mode: 1 - Enabled, 0 - Disabled - Offset(5), BATP, 8, // Offset(5), Battery Present - Bit0: Real Battery is supported on this platform. Bit1: Virtual Battery is supported on this platform. - Offset(6), SRSP, 32, // Offset(6), SMC Runtime Sci Pin - Offset(10), EHK3, 8, // Offset(10), Ec Hotkey F3 Support - Offset(11), EHK4, 8, // Offset(11), Ec Hotkey F4 Support - Offset(12), EHK5, 8, // Offset(12), Ec Hotkey F5 Support - Offset(13), EHK6, 8, // Offset(13), Ec Hotkey F6 Support - Offset(14), EHK7, 8, // Offset(14), Ec Hotkey F7 Support - Offset(15), EHK8, 8, // Offset(15), Ec Hotkey F8 Support - Offset(16), VBVP, 8, // Offset(16), Virtual Button Volume Up Support - Offset(17), VBVD, 8, // Offset(17), Virtual Button Volume Down Support - Offset(18), VBHB, 8, // Offset(18), Virtual Button Home Button Support - Offset(19), VBRL, 8, // Offset(19), Virtual Button Rotation Lock Support - Offset(20), SMSS, 8, // Offset(20), Slate Mode Switch Support - Offset(21), ADAS, 8, // Offset(21), Ac Dc Auto Switch Support - Offset(22), PPBG, 32, // Offset(22), Pm Power Button Gpio Pin - Offset(26), EGPE, 32, // Offset(26), Ecdt GPE bit value - //Offset(30), LSWP, 32, // Offset(30), Lid Switch Wake Gpio - //Offset(34), PGED, 8, // Offset(34), Pseudo G3 counter Enable/Disable + Offset(5), BATS, 8, // Offset(5), Battery Support - Bit0: Real Battery is supported on this platform. Bit1: Virtual Battery is supported on this platform. + Offset(6), EHK3, 8, // Offset(6), Ec Hotkey F3 Support + Offset(7), EHK4, 8, // Offset(7), Ec Hotkey F4 Support + Offset(8), EHK5, 8, // Offset(8), Ec Hotkey F5 Support + Offset(9), EHK6, 8, // Offset(9), Ec Hotkey F6 Support + Offset(10), EHK7, 8, // Offset(10), Ec Hotkey F7 Support + Offset(11), EHK8, 8, // Offset(11), Ec Hotkey F8 Support + Offset(12), VBVP, 8, // Offset(12), Virtual Button Volume Up Support + Offset(13), VBVD, 8, // Offset(13), Virtual Button Volume Down Support + Offset(14), VBHB, 8, // Offset(14), Virtual Button Home Button Support + Offset(15), VBRL, 8, // Offset(15), Virtual Button Rotation Lock Support + Offset(16), SMSS, 8, // Offset(16), Slate Mode Switch Support + Offset(17), ADAS, 8, // Offset(17), Ac Dc Auto Switch Support + Offset(18), PPBG, 32, // Offset(18), Pm Power Button Gpio Pin + Offset(22), EGPE, 32, // Offset(22), Ecdt GPE bit value + Offset(26), LSWP, 32, // Offset(26), Lid Switch Wake Gpio + Offset(30), PGED, 8, // Offset(30), Pseudo G3 counter Enable/Disable } \ No newline at end of file diff --git a/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/EcQevent.asl b/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/EcQevent.asl index e2a77ac9..f9ba2049 100644 --- a/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/EcQevent.asl +++ b/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/EcQevent.asl @@ -1366,15 +1366,21 @@ Method(_QF2) ECWT(0, RefOf(FRTS)) // clear all status bits If(And(Local0, 0x4)) { // BIT2: Fan3 RPM Threshold Crossed - Notify(\_SB.IETM.TFN3, 0x90) + If(CondRefOf(\_SB.IETM.TFN3)){ + Notify(\_SB.IETM.TFN3, 0x90) + } } If(And(Local0, 0x2)) { // BIT1: Fan2 RPM Threshold Crossed - Notify(\_SB.IETM.TFN2, 0x90) + If(CondRefOf(\_SB.IETM.TFN2)){ + Notify(\_SB.IETM.TFN2, 0x90) + } } If(And(Local0, 0x1)) { // BIT0: Fan1 RPM Threshold Crossed - Notify(\_SB.IETM.TFN1, 0x90) + If(CondRefOf(\_SB.IETM.TFN1)){ + Notify(\_SB.IETM.TFN1, 0x90) + } } Store(ECRD(RefOf(FRTS)), Local0) } diff --git a/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/EcSsdt.asl b/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/EcSsdt.asl index aa1afd20..f8f54c19 100644 --- a/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/EcSsdt.asl +++ b/Platform/MeteorlakeBoardPkg/AcpiTables/EcSsdt/EcSsdt.asl @@ -19,7 +19,7 @@ DefinitionBlock ( External (\_SB.PC00.LPCB, DeviceObj) External (\_SB.HIDD, DeviceObj) - //Include ("EcNvs.asl") + Include ("EcNvs.asl") Scope (\_SB.PC00.LPCB) { Include ("EcDevice.asl")