fix: [MTL] Update EC ACPI table (#2087)

Update latest EC ACPI table reference
from BIOS.

Signed-off-by: jinjhuli <jin.jhu.lim@intel.com>
This commit is contained in:
jinjhuli 2023-12-15 14:40:26 +08:00 committed by GitHub
parent 7e3a4cb601
commit fe3bee32dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 59 additions and 51 deletions

View File

@ -18,7 +18,7 @@ Device (BAT0)
Method (_STA, 0) 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? If (And (BNUM, 3)) // Real Battery 1 or 2 present?
{ {

View File

@ -17,7 +17,7 @@ Device (BAT1) {
Name (_UID, 1) Name (_UID, 1)
Method (_STA, 0) { 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? If (And (BNUM, BIT0)) { // Real Battery 1 present?
Return (0x001F) // Yes. Show it. Return (0x001F) // Yes. Show it.
} Else { } Else {
@ -45,13 +45,13 @@ Device (BAT1) {
}) })
If (ECAV) { 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 // Convert mAh and mV to mWh
Store (Divide (Multiply (ECRD (RefOf (B1DC)), ECRD (RefOf (B1DV))), 1000), Index (BPK1, 1)) 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 (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))), 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))), 25000), Index (BPK1, 6))
Store (0x100, Index (BPK1, 7)) Store (0x100, Index (BPK1, 7))
Store (0x40, Index (BPK1, 8)) Store (0x40, Index (BPK1, 8))
} }
@ -64,7 +64,7 @@ Device (BAT1) {
0x01, // Integer Revision 0x01, // Integer Revision
0x00000000, // Power Unit = mWh. 0x0 indicates units are mW/mWh 0x00000000, // Power Unit = mWh. 0x0 indicates units are mW/mWh
0xFFFFFFFF, // Unknown Design Capacity. 0xFFFFFFFF, // Unknown Design Capacity.
0xFFFFFFFF, // Unknown Last Full Charge. 0xFFFFFFFF, // Unknown Last Full Charge Capacity.
0x00000001, // Secondary Battery Technology. 0x00000001, // Secondary Battery Technology.
0xFFFFFFFF, // Unknown Design Voltage. 0xFFFFFFFF, // Unknown Design Voltage.
0x00000000, // 10% Warning Level. 0x00000000, // 10% Warning Level.
@ -85,17 +85,18 @@ Device (BAT1) {
}) })
If (ECAV) { 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 // Convert mAh and mV to mWh
Store (Divide (Multiply (ECRD (RefOf (B1DC)), ECRD (RefOf (B1DV))), 1000), Index (BPK1, 2)) // mAh * mV = (1/1000) mWh
Store (Divide (Multiply (ECRD (RefOf (^^B1FC)), ECRD (RefOf (B1DV))), 1000), Index (BPK1, 3)) Store (Divide (Multiply (ECRD (RefOf (B1DC)), ECRD (RefOf (B1DV))), 1000), Index (BPK1, 2)) // Update Design Capacity
Store (ECRD (RefOf (B1DV)), Index (BPK1, 5)) Store (Divide (Multiply (ECRD (RefOf (B1FC)), ECRD (RefOf (B1DV))), 1000), Index (BPK1, 3)) // Update Last Full Charge Capacity
Store (Divide (Multiply (ECRD (RefOf (^^B1FC)), ECRD (RefOf (B1DV))), 10000), Index (BPK1, 6)) Store (ECRD (RefOf (B1DV)), Index (BPK1, 5)) // Update Design Voltage
Store (Divide (Multiply (ECRD (RefOf (^^B1FC)), ECRD (RefOf (B1DV))), 25000), Index (BPK1, 7)) 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 (0x40, Index (BPK1, 9))
Store (0x320, Index (BPK1, 11))
Store (0x251C, Index (BPK1, 10)) Store (0x251C, Index (BPK1, 10))
Store (ECRD (RefOf (BICC)), Index (BPK1, 8)) // Battery cycle count Store (0x320, Index (BPK1, 11))
} }
} }
Return (BPK1) Return (BPK1)
@ -126,10 +127,10 @@ Device (BAT1) {
Store (Local0, Index (PKG1, 1)) Store (Local0, Index (PKG1, 1))
} }
// Calculate Remaining Capacity in mWh = // Calculate Remaining Capacity in mWh =
// (Remaininng Capacity (mAh) * Design Voltage (mV))/1000 // Remaining Capacity (mAh) * Design Voltage (V)
// Use Remaininng Capacity in mAh multiply with a fixed Design Voltage // Use Remaining Capacity in mAh multiply with a fixed Design Voltage
// for Remaininng Capacity in mWh // for Remaining Capacity in mWh
Store (Divide (Multiply (ECRD (RefOf (^^B1RC)), ECRD (RefOf (B1DV))), 1000), Index (PKG1, 2)) Store (Divide (Multiply (ECRD (RefOf (B1RC)), ECRD (RefOf (B1DV))), 1000), Index (PKG1, 2))
// Report Battery Present Voltage (mV) // Report Battery Present Voltage (mV)
Store (ECRD (RefOf (B1FV)), Index (PKG1, 3)) Store (ECRD (RefOf (B1FV)), Index (PKG1, 3))
} // If (ECAV) } // If (ECAV)
@ -140,8 +141,8 @@ Device (BAT1) {
If (ECAV) { If (ECAV) {
// arg2 = Battery wake level in mWh, sent to EC as Threshold. // arg2 = Battery wake level in mWh, sent to EC as Threshold.
// transfer input value from mWh to % // transfer input value from mWh to %
If (LAnd (LNotEqual (ECRD (RefOf (^^B1FC)), 0), LNotEqual (ECRD (RefOf (B1FV)), 0))) { 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) Store (Divide (Multiply (Arg2, 100), Divide (Multiply (ECRD (RefOf (B1FC)), ECRD (RefOf (B1FV))), 1000)), Local0)
// adjust offset between OS & EC // adjust offset between OS & EC
Add (Local0, 1, Local0) Add (Local0, 1, Local0)
// store TP value in EC name space offset 219 // store TP value in EC name space offset 219
@ -151,6 +152,7 @@ Device (BAT1) {
} }
} }
} }
// Return that everything runs off Battery. // Return that everything runs off Battery.
Method (_PCL, 0) { Method (_PCL, 0) {

View File

@ -7,8 +7,7 @@
Device (CIND) // Convertible Indicators. Device (CIND) // Convertible Indicators.
{ {
External (\OSYS) External (\OSYS, IntObj)
External (\IUCE, IntObj)
Name (_HID, "INT33D3") Name (_HID, "INT33D3")
Name (_CID, "PNP0C60") Name (_CID, "PNP0C60")

View File

@ -7,8 +7,7 @@
Device (DIND) // Docking Indicators. Device (DIND) // Docking Indicators.
{ {
External (\OSYS) External (\OSYS, IntObj)
External (\IUDE, IntObj)
Name (_HID, "INT33D4") Name (_HID, "INT33D4")
Name (_CID, "PNP0C70") Name (_CID, "PNP0C70")

View File

@ -14,8 +14,6 @@
Device (LID0) Device (LID0)
{ {
External (\PFLV, IntObj) External (\PFLV, IntObj)
External (LSWP, IntObj)
External (IUBE, IntObj)
External (\GPRW, MethodObj) External (\GPRW, MethodObj)
External (\GGPE, MethodObj) External (\GGPE, MethodObj)
@ -30,8 +28,13 @@ Device (LID0)
Method (_LID, 0) Method (_LID, 0)
{ {
// 0 = Closed, 1 = Open. // 0 = Closed, 1 = Open.
If ((ECRD (RefOf (LSTE))) == LIDS) {
Return (ECRD (RefOf (LSTE))) Return (LIDS)
} Else {
Store(LIDS, Local0)
Store(ECRD (RefOf (LSTE)), LIDS)
Return (Local0)
}
} }
// //
// Enable SCI wake for LID SWITCH // Enable SCI wake for LID SWITCH

View File

@ -24,22 +24,21 @@
Offset(2), IUDE, 8, // Offset(2), IUER Dock Enable Offset(2), IUDE, 8, // Offset(2), IUER Dock Enable
Offset(3), ECNO, 8, // Offset(3), EC Notification of Low Power S0 Idle State 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(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(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), SRSP, 32, // Offset(6), SMC Runtime Sci Pin Offset(6), EHK3, 8, // Offset(6), Ec Hotkey F3 Support
Offset(10), EHK3, 8, // Offset(10), Ec Hotkey F3 Support Offset(7), EHK4, 8, // Offset(7), Ec Hotkey F4 Support
Offset(11), EHK4, 8, // Offset(11), Ec Hotkey F4 Support Offset(8), EHK5, 8, // Offset(8), Ec Hotkey F5 Support
Offset(12), EHK5, 8, // Offset(12), Ec Hotkey F5 Support Offset(9), EHK6, 8, // Offset(9), Ec Hotkey F6 Support
Offset(13), EHK6, 8, // Offset(13), Ec Hotkey F6 Support Offset(10), EHK7, 8, // Offset(10), Ec Hotkey F7 Support
Offset(14), EHK7, 8, // Offset(14), Ec Hotkey F7 Support Offset(11), EHK8, 8, // Offset(11), Ec Hotkey F8 Support
Offset(15), EHK8, 8, // Offset(15), Ec Hotkey F8 Support Offset(12), VBVP, 8, // Offset(12), Virtual Button Volume Up Support
Offset(16), VBVP, 8, // Offset(16), Virtual Button Volume Up Support Offset(13), VBVD, 8, // Offset(13), Virtual Button Volume Down Support
Offset(17), VBVD, 8, // Offset(17), Virtual Button Volume Down Support Offset(14), VBHB, 8, // Offset(14), Virtual Button Home Button Support
Offset(18), VBHB, 8, // Offset(18), Virtual Button Home Button Support Offset(15), VBRL, 8, // Offset(15), Virtual Button Rotation Lock Support
Offset(19), VBRL, 8, // Offset(19), Virtual Button Rotation Lock Support Offset(16), SMSS, 8, // Offset(16), Slate Mode Switch Support
Offset(20), SMSS, 8, // Offset(20), Slate Mode Switch Support Offset(17), ADAS, 8, // Offset(17), Ac Dc Auto Switch Support
Offset(21), ADAS, 8, // Offset(21), Ac Dc Auto Switch Support Offset(18), PPBG, 32, // Offset(18), Pm Power Button Gpio Pin
Offset(22), PPBG, 32, // Offset(22), Pm Power Button Gpio Pin Offset(22), EGPE, 32, // Offset(22), Ecdt GPE bit value
Offset(26), EGPE, 32, // Offset(26), Ecdt GPE bit value Offset(26), LSWP, 32, // Offset(26), Lid Switch Wake Gpio
//Offset(30), LSWP, 32, // Offset(30), Lid Switch Wake Gpio Offset(30), PGED, 8, // Offset(30), Pseudo G3 counter Enable/Disable
//Offset(34), PGED, 8, // Offset(34), Pseudo G3 counter Enable/Disable
} }

View File

@ -1366,15 +1366,21 @@ Method(_QF2)
ECWT(0, RefOf(FRTS)) // clear all status bits ECWT(0, RefOf(FRTS)) // clear all status bits
If(And(Local0, 0x4)) If(And(Local0, 0x4))
{ // BIT2: Fan3 RPM Threshold Crossed { // BIT2: Fan3 RPM Threshold Crossed
Notify(\_SB.IETM.TFN3, 0x90) If(CondRefOf(\_SB.IETM.TFN3)){
Notify(\_SB.IETM.TFN3, 0x90)
}
} }
If(And(Local0, 0x2)) If(And(Local0, 0x2))
{ // BIT1: Fan2 RPM Threshold Crossed { // BIT1: Fan2 RPM Threshold Crossed
Notify(\_SB.IETM.TFN2, 0x90) If(CondRefOf(\_SB.IETM.TFN2)){
Notify(\_SB.IETM.TFN2, 0x90)
}
} }
If(And(Local0, 0x1)) If(And(Local0, 0x1))
{ // BIT0: Fan1 RPM Threshold Crossed { // 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) Store(ECRD(RefOf(FRTS)), Local0)
} }

View File

@ -19,7 +19,7 @@ DefinitionBlock (
External (\_SB.PC00.LPCB, DeviceObj) External (\_SB.PC00.LPCB, DeviceObj)
External (\_SB.HIDD, DeviceObj) External (\_SB.HIDD, DeviceObj)
//Include ("EcNvs.asl") Include ("EcNvs.asl")
Scope (\_SB.PC00.LPCB) { Scope (\_SB.PC00.LPCB) {
Include ("EcDevice.asl") Include ("EcDevice.asl")