Jump to content

[HOWTO] ACPI access for monitoring


Slice
 Share

48 posts in this topic

Recommended Posts

This is the guide how to make monitoring of hardware parameters (temperatures, fan speeds, voltages etc) using DSDT programming.
The method invented by me with THeKiNG presence and improved by Kozlek.
 
Prerequisites
There is FakeSMC plugin named ACPImonitor in my branch or renamed to ACPISensors in kozlek's branch. They are the same.
HWMonitor or other monitoring application: iStat, K-Stat-i, ...
 
How it works.
HWMonitor or other software make a request for known SMC key, for example TA0P (ambient temperature), every 1 seconds.
The request catched by FakeSMC which knows that the key registered by ACPImonitor plugin.
This plugin knows that the value for the key must be read from ACPI device "monitor" by method "TCRR" and make a request to AppleACPIPlatform for evaluate this method.
AppleACPIPlatform interpretates AML codes written into DSDT, finds the method and calculates the value using hardware access.
The value return back to ACPImonitor -> FakeSMC -> AppleSMC -> HWMonitor which shows the "temperature".
 
The kext ACPImonitor will not work OOB. It will work only with DSDT patches for the usage.
 
Simple example DSDT.

                Device (FSAM)
                {
                    Name (_HID, EisaId ("APP0111"))
                    Name (_CID, "monitor")
                    Name (TCRK, Zero)
                    Method (TCRR, 0, NotSerialized)
                    {
                        Return (TCRK)
                    }

                    Method (TCRW, 1, NotSerialized)
                    {
                        Store (Arg0, TCRK)
                        Return (TCRK)
                    }

                    Method (TCPP, 1, NotSerialized)
                    {
                        Store (\_TZ.THM._TMP (), Local0)
                        Return (Local0)
                    }
                }

You have to create new device. It must have
Name (_CID, "monitor")
This is the key for ACPImonitor attached to it.
Then see Method (TCRR,0, NotSerialized) mentioned above. It will return a value or variable TCRK.
In this demo I made a method TCRW which will fill the variable TCRK from SMC key.
The I have to make correspondence ACPI_methodSMC_key in ACPImonitor.kext/info.plist
Снимок экрана 2015-11-11 в 11.50.42.png
I can write values to the SMC key TA1P
./SMC_util3 -kTA1P -w28
and see the value 28 appears in HWMonitor as "Ambient temperature" ;)
Value conversions must be provided in DSDT.
 
Predefined keys
ACPI        SMC     Name
TCPU        Th0H    CPU heatsink
TSYS        TN0P    Northbridge temperature
TDIM        Tm0P    DIMM temperature
TAMB        TA0P    Ambient
TCPP        TC0P    CPU proximity
VCPU        VC0C    CPU voltage
VMEM        VM0R    DIMM voltage
ACDC        ACIN, ACEN  Presence of AC power
FAN0 - FAN9 for FAN speed
FTN0 -FTN9 for FAN rotation time
 
In the case of FAN reading we also want to assign name to them. It is also possible with the Info.plist
Снимок экрана 2015-11-11 в 12.08.50.png
 
 
What to monitor in real DSDT?
This is individual. So why the ACPImonitor will not work OOB.
See example from my notebook. looking through DSDT I found the follow region.

                    OperationRegion (TMIF, SystemMemory, 0xFF800160, 0x20)
                    Field (TMIF, ByteAcc, Lock, Preserve)
                    {
                        THS0,   8, 
                        THS1,   8, 
                        THS2,   8, 
                        Offset (0x08), 
                        FAN1,   8, 
                        Offset (0x10), 
                        TSP0,   8, 
                        TSC0,   8, 
                        TSP1,   8, 
                        TSC1,   8
                    }

Looks like three temperatures and one FAN.
 
As well I found ThermalZone

    Scope (_TZ)
    {
        ThermalZone (THM)
        {
            Method (_CRT, 0, NotSerialized)
            {
                Store (\_SB.PCI0.LPCB.WSEC.C2K (\_SB.PCI0.LPCB.WSEC.TSC0), Local0)
                Return (Local0)
            }

            Method (_TMP, 0, NotSerialized)
            {
                Store (\_SB.PCI0.LPCB.WSEC.C2K (\_SB.PCI0.LPCB.WSEC.THS0), Local0)
                Return (Local0)
            }

 

 
_CRT - critical temperature
_TMP - current temperature
_SB.PCI0.LPCB.WSEC.C2K is a method to convert Celsius to Kelvin degrees.
So I see that the field THS0 is really CPU temperature.
 
Using ACPImonitor is only way to do monitoring on notebooks because no other methods works and because it usually contains ThermalZone.
 
I know my guide is too short and hope some users shows own examples how to do ACPI monitoring.
 
Note. This method is useful mostly for notebook where temperature and FANs control present in DSDT.
For desktops there are plugins like ITE87xx, Winbond, Fintek depending on you LPC chip installed.
 
 
10.10.2017 ACPIMonitor version 1.0.3
There is a possibility to define some types and sizes for custom keys

            <key>keysToAdd</key>
            <dict>
                <key>TCRR</key>
                <string>TA0P-2</string>
                <key>TCRW</key>
                <string>TA1P-3</string>
                <key>MSLD</key>
                <string>MSLD-1</string>
            </dict>

 
The number after key name means follow
0 -> "flag", len 1
1 -> "ui8 ", len 1
2 -> "ui16", len 2
3 -> "sp78", len 2
4 -> "ui32", len 4

  • Like 11
Link to comment
Share on other sites

May this plugin live with the other plugins?

Yes. Making plugins we checked for compatibility.

Fans will be doubled. So If one plugin uses FAN0 then other plugin take next number FAN1.  And so on.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

@slice

here is fan related code 

 

Scope (_SB.PCI0.LPCB.SIOR)
    {
        Name (SNCT, Zero)
        Name (E1BK, Zero)
        Method (HWV0, 0, NotSerialized)
        {
            Return (Multiply (VCOR, 0x08))
        }
 
        Method (HWV1, 0, NotSerialized)
        {
            Return (Multiply (V12V, 0x08))
        }
 
        Method (HWV3, 0, NotSerialized)
        {
            Return (Multiply (V33V, 0x08))
        }
 
        Method (HWV4, 0, NotSerialized)
        {
            Return (Multiply (V50V, 0x08))
        }
 
        Method (HWT0, 0, NotSerialized)
        {
            ENFG (0x0C)
            Store (CR20, Local0)
            EXFG ()
            If (LEqual (Local0, 0xB3))
            {
                Store (Zero, BSEL)
                Store (Zero, SR7D)
                Store (SR7E, Local1)
            }
            Else
            {
                Store (MBTE, Local1)
            }
 
            If (And (Local1, 0x80))
            {
                Or (Local1, 0xFFFFFF00, Local1)
            }
 
            Multiply (Local1, 0x0A, Local1)
            Return (Local1)
        }
 
        Method (HWT1, 0, NotSerialized)
        {
            Store (One, BSEL)
            Store (TSR1, Local1)
            If (And (Local1, 0x80))
            {
                Or (Local1, 0xFFFFFF00, Local1)
            }
 
            WBYT (0x80, 0x1D, Local1)
            Multiply (Local1, 0x0A, Local1)
            Store (TSR2, Local2)
            Multiply (Local2, 0x05, Local2)
            Add (Local1, Local2, Local1)
            Return (Local1)
        }
 
        Method (HWT2, 0, NotSerialized)
        {
            Store (0x02, BSEL)
            Store (TSR1, Local1)
            If (And (Local1, 0x80))
            {
                Or (Local1, 0xFFFFFF00, Local1)
            }
 
            Multiply (Local1, 0x0A, Local1)
            Store (TSR2, Local2)
            Multiply (Local2, 0x05, Local2)
            Add (Local1, Local2, Local1)
            Return (Local1)
        }
 
        OperationRegion (DBGE, SystemIO, 0x80, 0x04)
        Field (DBGE, WordAcc, NoLock, Preserve)
        {
            DBGG,   22
        }
 
        Method (HWF0, 0, NotSerialized)
        {
            Store (FAN1, Local0)
            Store (Zero, BSEL)
            And (FD21, 0x20, Local1)
            ShiftRight (Local1, 0x05, Local1)
            Multiply (Local1, 0x04, Local1)
            And (FDR1, 0x30, Local2)
            ShiftRight (Local2, 0x04, Local2)
            Add (Local1, Local2, Local1)
            If (LOr (LGreater (Local1, 0x05), LLess (Local1, 0x02)))
            {
                If (LGreater (Local0, 0xF0))
                {
                    Store (0x02, Local1)
                }
                Else
                {
                    If (LLess (Local0, 0x1E))
                    {
                        Store (0x05, Local1)
                    }
                    Else
                    {
                        Store (0x03, Local1)
                    }
                }
 
                Divide (Local1, 0x04, Local2, Local3)
                ShiftLeft (Local3, 0x05, Local3)
                Store (FD21, Local4)
                And (Local4, 0xDF, Local4)
                Or (Local3, Local4, FD21)
                Store (FDR1, Local4)
                And (Local4, 0xCF, Local4)
                ShiftLeft (Local2, 0x04, Local2)
                Or (Local4, One, Local4)
                Or (Local4, Local2, FDR1)
                Sleep (0x32)
                Store (FAN1, Local0)
            }
 
            While (LOr (LAnd (LGreater (Local0, 0xF0), LLess (Local1, 0x05)), LAnd (
                LLess (Local0, 0x1E), LGreater (Local1, 0x02))))
            {
                If (LAnd (LGreater (Local0, 0xF0), LLess (Local1, 0x05)))
                {
                    Add (Local1, One, Local1)
                    Divide (Local1, 0x04, Local2, Local3)
                    Store (Zero, BSEL)
                    ShiftLeft (Local3, 0x05, Local3)
                    Store (FD21, Local4)
                    And (Local4, 0xDF, Local4)
                    Or (Local3, Local4, FD21)
                    Store (FDR1, Local4)
                    And (Local4, 0xCF, Local4)
                    ShiftLeft (Local2, 0x04, Local2)
                    Or (Local4, One, Local4)
                    Or (Local4, Local2, FDR1)
                    Sleep (0x32)
                    Store (FAN1, Local0)
                    Sleep (0x32)
                    Store (FAN1, Local0)
                    Sleep (0x32)
                    Store (FAN1, Local0)
                }
                Else
                {
                    Subtract (Local1, One, Local1)
                    Divide (Local1, 0x04, Local2, Local3)
                    Store (Zero, BSEL)
                    ShiftLeft (Local3, 0x05, Local3)
                    Store (FD21, Local4)
                    And (Local4, 0xDF, Local4)
                    Or (Local3, Local4, FD21)
                    Store (FDR1, Local4)
                    And (Local4, 0xCF, Local4)
                    ShiftLeft (Local2, 0x04, Local2)
                    Or (Local4, One, Local4)
                    Or (Local4, Local2, FDR1)
                    Sleep (0x32)
                    Store (FAN1, Local0)
                    Sleep (0x32)
                    Store (FAN1, Local0)
                    Sleep (0x32)
                    Store (FAN1, Local0)
                }
            }
 
            If (LAnd (LEqual (Local0, 0xFF), LEqual (Local1, 0x05)))
            {
                Return (Zero)
            }
 
            If (LAnd (LEqual (Local0, Zero), LEqual (Local1, 0x02)))
            {
                Return (0xFFFF)
            }
 
            Store (One, Local2)
            While (Local1)
            {
                Multiply (Local2, 0x02, Local2)
                Decrement (Local1)
            }
 
            Multiply (Local0, Local2, Local0)
            Divide (0x00149970, Local0, Local1, Local0)
            Return (Local0)
        }
 
        Method (HWF1, 0, NotSerialized)
        {
            Store (Zero, BSEL)
            Store (FAN2, Local0)
            And (FD21, 0x40, Local1)
            ShiftRight (Local1, 0x06, Local1)
            Multiply (Local1, 0x04, Local1)
            And (FDR1, 0xC0, Local2)
            ShiftRight (Local2, 0x06, Local2)
            Add (Local1, Local2, Local1)
            If (LOr (LGreater (Local1, 0x05), LLess (Local1, 0x02)))
            {
                If (LGreater (Local0, 0xF0))
                {
                    Store (0x02, Local1)
                }
                Else
                {
                    If (LLess (Local0, 0x1E))
                    {
                        Store (0x05, Local1)
                    }
                    Else
                    {
                        Store (0x03, Local1)
                    }
                }
 
                Divide (Local1, 0x04, Local2, Local3)
                ShiftLeft (Local3, 0x06, Local3)
                Store (FD21, Local4)
                And (Local4, 0xBF, Local4)
                Or (Local3, Local4, FD21)
                Store (FDR1, Local4)
                And (Local4, 0x3F, Local4)
                ShiftLeft (Local2, 0x06, Local2)
                Or (Local4, One, Local4)
                Or (Local4, Local2, FDR1)
                Sleep (0x32)
                Store (Zero, BSEL)
                Store (FAN2, Local0)
            }
 
            While (LOr (LAnd (LGreater (Local0, 0xF0), LLess (Local1, 0x05)), LAnd (
                LLess (Local0, 0x1E), LGreater (Local1, 0x02))))
            {
                If (LAnd (LLess (Local0, 0x1E), LGreater (Local1, 0x02)))
                {
                    Subtract (Local1, One, Local1)
                    Divide (Local1, 0x04, Local2, Local3)
                    Store (Zero, BSEL)
                    ShiftLeft (Local3, 0x06, Local3)
                    Store (FD21, Local4)
                    And (Local4, 0xBF, Local4)
                    Or (Local3, Local4, FD21)
                    Store (FDR1, Local4)
                    And (Local4, 0x3F, Local4)
                    ShiftLeft (Local2, 0x06, Local2)
                    Or (Local4, One, Local4)
                    Or (Local4, Local2, FDR1)
                    Sleep (0x32)
                    Store (Zero, BSEL)
                    Store (FAN2, Local0)
                    Sleep (0x32)
                    Store (FAN2, Local0)
                    Sleep (0x32)
                    Store (FAN2, Local0)
                }
                Else
                {
                    Add (Local1, One, Local1)
                    Divide (Local1, 0x04, Local2, Local3)
                    Store (Zero, BSEL)
                    ShiftLeft (Local3, 0x06, Local3)
                    Store (FD21, Local4)
                    And (Local4, 0xBF, Local4)
                    Or (Local3, Local4, FD21)
                    Store (FDR1, Local4)
                    And (Local4, 0x3F, Local4)
                    ShiftLeft (Local2, 0x06, Local2)
                    Or (Local4, One, Local4)
                    Or (Local4, Local2, FDR1)
                    Sleep (0x32)
                    Store (Zero, BSEL)
                    Store (FAN2, Local0)
                    Sleep (0x32)
                    Store (FAN2, Local0)
                    Sleep (0x32)
                    Store (FAN2, Local0)
                }
            }
 
            If (LAnd (LEqual (Local0, 0xFF), LEqual (Local1, 0x05)))
            {
                Return (Zero)
            }
 
            If (LAnd (LEqual (Local0, Zero), LEqual (Local1, 0x02)))
            {
                Return (0xFFFF)
            }
 
            Store (One, Local2)
            While (Local1)
            {
                Multiply (Local2, 0x02, Local2)
                Decrement (Local1)
            }
 
            Multiply (Local0, Local2, Local0)
            Divide (0x00149970, Local0, Local1, Local0)
            Return (Local0)
        }
 
        Method (HWF2, 0, NotSerialized)
        {
            Store (FAN3, Local0)
            Store (Zero, BSEL)
            And (FD21, 0x80, Local1)
            ShiftRight (Local1, 0x07, Local1)
            Multiply (Local1, 0x04, Local1)
            Divide (FD13, 0x40, Local2, Local3)
            Add (Local1, Local3, Local1)
            If (LOr (LGreater (Local1, 0x05), LLess (Local1, 0x02)))
            {
                If (LGreater (Local0, 0xF0))
                {
                    Store (0x02, Local1)
                }
                Else
                {
                    If (LLess (Local0, 0x1E))
                    {
                        Store (0x05, Local1)
                    }
                    Else
                    {
                        Store (0x03, Local1)
                    }
                }
 
                Divide (Local1, 0x04, Local2, Local3)
                ShiftLeft (Local3, 0x07, Local3)
                Store (FD21, Local4)
                And (Local4, 0x7F, Local4)
                Or (Local3, Local4, FD21)
                Store (FD13, Local3)
                And (Local3, 0x3F, Local3)
                Multiply (Local2, 0x40, Local2)
                Add (Local3, Local2, Local2)
                Store (Local2, FD13)
                Sleep (0x32)
                Store (FAN3, Local0)
            }
 
            While (LOr (LAnd (LGreater (Local0, 0xF0), LLess (Local1, 0x05)), LAnd (
                LLess (Local0, 0x1E), LGreater (Local1, 0x02))))
            {
                If (LAnd (LGreater (Local0, 0xF0), LLess (Local1, 0x05)))
                {
                    If (LEqual (Local0, 0xFF))
                    {
                        Store (0x05, Local1)
                    }
                    Else
                    {
                        Add (Local1, One, Local1)
                    }
 
                    Divide (Local1, 0x04, Local2, Local3)
                    Store (Zero, BSEL)
                    ShiftLeft (Local3, 0x07, Local3)
                    Store (FD21, Local4)
                    And (Local4, 0x7F, Local4)
                    Or (Local3, Local4, FD21)
                    Store (FD13, Local3)
                    And (Local3, 0x3F, Local3)
                    Multiply (Local2, 0x40, Local2)
                    Add (Local3, Local2, Local2)
                    Store (Local2, FD13)
                    If (LNotEqual (Local0, 0xFF))
                    {
                        Sleep (0x32)
                    }
 
                    Store (FAN3, Local0)
                    Sleep (0x32)
                    Store (FAN3, Local0)
                    Sleep (0x32)
                    Store (FAN3, Local0)
                }
                Else
                {
                    Subtract (Local1, One, Local1)
                    Divide (Local1, 0x04, Local2, Local3)
                    Store (Zero, BSEL)
                    ShiftLeft (Local3, 0x07, Local3)
                    Store (FD21, Local4)
                    And (Local4, 0x7F, Local4)
                    Or (Local3, Local4, FD21)
                    Store (FD13, Local3)
                    And (Local3, 0x3F, Local3)
                    Multiply (Local2, 0x40, Local2)
                    Add (Local3, Local2, Local2)
                    Store (Local2, FD13)
                    Sleep (0x32)
                    Store (FAN3, Local0)
                    Sleep (0x32)
                    Store (FAN3, Local0)
                    Sleep (0x32)
                    Store (FAN3, Local0)
                }
            }
 
            If (LAnd (LEqual (Local0, 0xFF), LEqual (Local1, 0x05)))
            {
                Return (Zero)
            }
 
            If (LAnd (LEqual (Local0, Zero), LEqual (Local1, 0x02)))
            {
                Return (0xFFFF)
            }
 
            Store (One, Local2)
            While (Local1)
            {
                Multiply (Local2, 0x02, Local2)
                Decrement (Local1)
            }
 
            Multiply (Local0, Local2, Local0)
            Divide (0x00149970, Local0, Local1, Local0)
            Return (Local0)
        }
 
        Method (HWF4, 0, NotSerialized)
        {
            Store (0x05, BSEL)
            Store (FAN4, Local0)
            Store (Zero, BSEL)
            And (FND4, 0x80, Local1)
            ShiftRight (Local1, 0x07, Local1)
            Multiply (Local1, 0x04, Local1)
            And (FND4, 0x0C, Local2)
            ShiftRight (Local2, 0x02, Local2)
            Add (Local1, Local2, Local1)
            If (LOr (LGreater (Local1, 0x05), LLess (Local1, 0x02)))
            {
                If (LGreater (Local0, 0xF0))
                {
                    Store (0x02, Local1)
                }
                Else
                {
                    If (LLess (Local0, 0x1E))
                    {
                        Store (0x05, Local1)
                    }
                    Else
                    {
                        Store (0x03, Local1)
                    }
                }
 
                Divide (Local1, 0x04, Local2, Local3)
                ShiftLeft (Local3, 0x07, Local3)
                ShiftLeft (Local2, 0x02, Local2)
                Store (FND4, Local4)
                And (Local4, 0x73, Local4)
                Or (Local3, Local2, Local3)
                Or (Local3, Local4, FND4)
                Sleep (0x32)
                Store (0x05, BSEL)
                Store (FAN4, Local0)
            }
 
            While (LOr (LAnd (LGreater (Local0, 0xF0), LLess (Local1, 0x05)), LAnd (
                LLess (Local0, 0x1E), LGreater (Local1, 0x02))))
            {
                If (LAnd (LGreater (Local0, 0xF0), LLess (Local1, 0x05)))
                {
                    Add (Local1, One, Local1)
                    Divide (Local1, 0x04, Local2, Local3)
                    Store (Zero, BSEL)
                    ShiftLeft (Local3, 0x07, Local3)
                    ShiftLeft (Local2, 0x02, Local2)
                    Store (FND4, Local4)
                    And (Local4, 0x73, Local4)
                    Or (Local3, Local2, Local3)
                    Or (Local3, Local4, FND4)
                    If (LNotEqual (Local0, 0xFF))
                    {
                        Sleep (0x32)
                    }
 
                    Store (0x05, BSEL)
                    Store (FAN4, Local0)
                    Sleep (0x32)
                    Store (FAN4, Local0)
                    Sleep (0x32)
                    Store (FAN4, Local0)
                    Store (Zero, BSEL)
                }
                Else
                {
                    Subtract (Local1, One, Local1)
                    Divide (Local1, 0x04, Local2, Local3)
                    Store (Zero, BSEL)
                    ShiftLeft (Local3, 0x07, Local3)
                    ShiftLeft (Local2, 0x02, Local2)
                    Store (FND4, Local4)
                    And (Local4, 0x73, Local4)
                    Or (Local3, Local2, Local3)
                    Or (Local3, Local4, FND4)
                    Sleep (0x32)
                    Store (0x05, BSEL)
                    Store (FAN4, Local0)
                    Sleep (0x32)
                    Store (FAN4, Local0)
                    Sleep (0x32)
                    Store (FAN4, Local0)
                    Store (Zero, BSEL)
                }
            }
 
            If (LAnd (LEqual (Local0, 0xFF), LEqual (Local1, 0x05)))
            {
                Return (Zero)
            }
 
            If (LAnd (LEqual (Local0, Zero), LEqual (Local1, 0x02)))
            {
                Return (0xFFFF)
            }
 
            Store (One, Local2)
            While (Local1)
            {
                Multiply (Local2, 0x02, Local2)
                Decrement (Local1)
            }
 
            Multiply (Local0, Local2, Local0)
            Divide (0x00149970, Local0, Local1, Local0)
            Return (Local0)
        }
 
        Name (FNDT, Package (0x08)
        {
            One, 
            0x02, 
            0x04, 
            0x08, 
            0x10, 
            0x20, 
            0x40, 
            0x80
        })
        Method (HWF3, 0, NotSerialized)
        {
            Store (Zero, BSEL)
            Store (CFN3, Local0)
            And (FD15, 0x80, Local1)
            ShiftRight (Local1, 0x05, Local1)
            And (FND4, 0x03, Local2)
            Or (Local1, Local2, Local1)
            If (LOr (LGreater (Local1, 0x05), LLess (Local1, 0x02)))
            {
                If (LGreater (Local0, 0xF0))
                {
                    Store (0x02, Local1)
                }
                Else
                {
                    If (LLess (Local0, 0x1E))
                    {
                        Store (0x05, Local1)
                    }
                    Else
                    {
                        Store (0x03, Local1)
                    }
                }
 
                ShiftLeft (Local1, 0x05, Local2)
                And (Local2, 0x80, Local2)
                And (FD15, 0x7F, Local3)
                Or (Local2, Local3, Local3)
                Store (Local3, FD15)
                And (Local1, 0x03, Local2)
                And (FND4, 0xFC, Local3)
                Or (Local2, Local3, Local3)
                Store (Local3, FND4)
                Sleep (0x32)
                Store (CFN3, Local0)
            }
 
            While (LOr (LAnd (LGreater (Local0, 0xF0), LLess (Local1, 0x05)), LAnd (
                LLess (Local0, 0x1E), LGreater (Local1, 0x02))))
            {
                If (LAnd (LGreater (Local0, 0xF0), LLess (Local1, 0x05)))
                {
                    Increment (Local1)
                }
                Else
                {
                    Decrement (Local1)
                }
 
                ShiftLeft (Local1, 0x05, Local2)
                And (Local2, 0x80, Local2)
                And (FD15, 0x7F, Local3)
                Or (Local2, Local3, Local3)
                Store (Local3, FD15)
                And (Local1, 0x03, Local2)
                And (FND4, 0xFC, Local3)
                Or (Local2, Local3, Local3)
                Store (Local3, FND4)
                Sleep (0x32)
                Store (CFN3, Local0)
                Sleep (0x32)
                Store (CFN3, Local0)
                Sleep (0x32)
                Store (CFN3, Local0)
            }
 
            If (LAnd (LEqual (Local0, 0xFF), LEqual (Local1, 0x05)))
            {
                Return (Zero)
            }
 
            If (LAnd (LEqual (Local0, Zero), LEqual (Local1, 0x02)))
            {
                Return (0xFFFF)
            }
 
            Store (DerefOf (Index (FNDT, Local1)), Local2)
            Multiply (Local0, Local2, Local0)
            Divide (0x00149970, Local0, Local1, Local0)
            Return (Local0)
        }
 
        OperationRegion (HWRE, SystemIO, IOHW, 0x0A)
        Field (HWRE, ByteAcc, NoLock, Preserve)
        {
                    Offset (0x05), 
            HIDX,   8, 
            HDAT,   8
        }
 
        IndexField (HIDX, HDAT, ByteAcc, NoLock, Preserve)
        {
                    Offset (0x04), 
            CHNM,   1, 
            CFNM,   1, 
            CHNS,   2, 
            CFNS,   2, 
                    Offset (0x05), 
            SYST,   8, 
            TRGT,   8, 
                    Offset (0x08), 
            SSDN,   8, 
            CSDN,   8, 
            SSUP,   8, 
            CSUP,   8, 
                    Offset (0x20), 
            VCOR,   8, 
            V12V,   8, 
                    Offset (0x23), 
            V33V,   8, 
            V50V,   8, 
                    Offset (0x27), 
            MBTE,   8, 
            FAN1,   8, 
            FAN2,   8, 
            FAN3,   8, 
                    Offset (0x3F), 
            CFN3,   8, 
                    Offset (0x47), 
            FDR1,   8, 
                    Offset (0x4B), 
            FD13,   8, 
            FD15,   8, 
                    Offset (0x4E), 
            BSEL,   4, 
                    Offset (0x4F), 
                    Offset (0x50), 
            TSR1,   8, 
                ,   7, 
            TSR2,   1, 
                    Offset (0x53), 
            FAN4,   8, 
                    Offset (0x59), 
            FND4,   8, 
                    Offset (0x5D), 
            FD21,   8, 
                    Offset (0x7D), 
            SR7D,   8, 
            SR7E,   8
        }
    }

how to get fan RPM in HWmonitors

  • Like 2
Link to comment
Share on other sites

Make the Device as in my example.

Provide a method that will call one of your methods.

Write a line into ACPImonitor.kext/info.plist with correspondence of ACPI method and SMC keys.

Install the kext and see into HWMonitor.

  • Like 3
Link to comment
Share on other sites

  • 8 months later...

@Slice I really have no idea what code is for fan and for temperatures in this laptop. I am only familiar with other devices in my ACPI files.

Could you give me a hand please? What should I do and in what order?

 

ASUS X550LDV dsl files.zip

 

I am wanting to get rid of kozlek's HWSENSORS and my old FakeSMC version and use yours, but I need some help for that.

Thanks :D

 

post-1517295-0-11906500-1471950856_thumb.png

Link to comment
Share on other sites

See

            Method (_TMP, 0, NotSerialized)  // _TMP: Temperature
            {
                Store (0x05, Local1)
                While (Local1)
                {
                    Store (RTMP (), Local0)
                    If (LGreater (Local0, \_SB.TCRT))
                    {
                        Decrement (Local1)
                    }
                    Else
                    {
                        Store (Zero, Local1)
                    }
                }

                Return (KELV (Local0))
            }

KELV () - is a procedure to convert Celsius to Kelvin. 

But you need Celsius and the method Store (RTMP (), Local0) gives you the value.

 

See about fans

Name (FANS, Zero)
        Method (RFAN, 1, NotSerialized)
        {
            If (\_SB.PCI0.LPCB.EC0.ECAV ())
            {
                Store (\_SB.PCI0.LPCB.EC0.ST83 (Arg0), Local0)
                If (LEqual (Local0, 0xFF))
                {
                    Return (Local0)
                }

                Store (\_SB.PCI0.LPCB.EC0.TACH (Arg0), Local0)
                Divide (Local0, 0x64, Local1, Local0)
                Add (Local0, One, Local0)
                If (LLessEqual (Local0, 0x3C))
                {
                    Store (Local0, FANS)
                }
                Else
                {
                    Store (FANS, Local0)
                }
            }
            Else
            {
                Store (Zero, Local0)
            }

            Return (Local0)
        }

You can use the method RFAN to get a speed of it. I don't know what is the value so you should make observations what value will be shown by HWmonitor and then created additional recalculation to see rpm.

Link to comment
Share on other sites

See

            Method (_TMP, 0, NotSerialized)  // _TMP: Temperature
            {
                Store (0x05, Local1)
                While (Local1)
                {
                    Store (RTMP (), Local0)
                    If (LGreater (Local0, \_SB.TCRT))
                    {
                        Decrement (Local1)
                    }
                    Else
                    {
                        Store (Zero, Local1)
                    }
                }

                Return (KELV (Local0))
            }

KELV () - is a procedure to convert Celsius to Kelvin. 

But you need Celsius and the method Store (RTMP (), Local0) gives you the value.

 

See about fans

Name (FANS, Zero)
        Method (RFAN, 1, NotSerialized)
        {
            If (\_SB.PCI0.LPCB.EC0.ECAV ())
            {
                Store (\_SB.PCI0.LPCB.EC0.ST83 (Arg0), Local0)
                If (LEqual (Local0, 0xFF))
                {
                    Return (Local0)
                }

                Store (\_SB.PCI0.LPCB.EC0.TACH (Arg0), Local0)
                Divide (Local0, 0x64, Local1, Local0)
                Add (Local0, One, Local0)
                If (LLessEqual (Local0, 0x3C))
                {
                    Store (Local0, FANS)
                }
                Else
                {
                    Store (FANS, Local0)
                }
            }
            Else
            {
                Store (Zero, Local0)
            }

            Return (Local0)
        }

You can use the method RFAN to get a speed of it. I don't know what is the value so you should make observations what value will be shown by HWmonitor and then created additional recalculation to see rpm.

 

HOW SHOULD I PROCEED TO USE THE METHOD RTMP THEN??

ALSO, AS YOU CAN SEE IN THIS FOLLOWING IMAGE, HWSENSORS DOESNT SHOW ANY FANS.

 

post-1517295-0-53320400-1472193014_thumb.png

Link to comment
Share on other sites

The plugin is not intended to work OOB.

You must be a programmer to write an monitoring method in your DSDT.

                Device (FSAM)
                {
                    Name (_HID, EisaId ("APP0111"))
                    Name (_CID, "monitor")
                    Method (FAN0, 0, NotSerialized)
                    {
                        Return (\_SB.TZ.RFAN())
                    }

Link to comment
Share on other sites

Yes, kozlek's FakeSMC+kozlek's ACPISensors+kozlek's HWMonitor + this DSDT

Don't mix different thing.

But I am not sure that kozlek was not change something again and the method will not work occasionally.

Link to comment
Share on other sites

  • 1 month later...

i run sierra on w520...but hW can't show system fan....so i watch this DSDT edit  gothic860 who run also w520 provide

 Device (SMCD)

                 {
                     Name (_HID, "MONITOR")
                     Method (FAN0, 0, NotSerialized)
                     {
                         Store (^ ^ EC.HFN1, Local0)
                         Return (Local0)
                     }
                     Method (TCPU, 0, NotSerialized)
                     {
                         Store (^ ^ EC.TMP0, Local0)
                         Return (Local0)
                     }
                 }

but i dont know how to modify acpisensors...the picture  gothic860 provide can't open....any ideas about it ?

Link to comment
Share on other sites

  • 5 weeks later...

Slice. Sorry to bother you again

I used a monitoring program for sensors and frequencies in Windows, and I saved the sensor information from the hardware.
It is in this document:
 
 
In this document, inform the voltages and clocks of my GPU (Radeon HD7850), can that with this information, can be inserted in the kexts of sensor plugins?
 
Thanks for your attention
Link to comment
Share on other sites

  • 4 months later...

It is not enough. You must write methods to get values found in your DSDT.

This values:

ACPI        SMC     Name
TCPU        Th0H    CPU heatsink
TSYS        TN0P    Northbridge temperature
TDIM        Tm0P    DIMM temperature
TAMB        TA0P    Ambient
TCPP        TC0P    CPU proximity
VCPU        VC0C    CPU voltage
VMEM        VM0R    DIMM voltage
FAN0 - FAN9 for FAN speed
FTN0 -FTN9 for FAN rotation time

I didn't found anything related in my DSDT.

Link to comment
Share on other sites

This values:

ACPI        SMC     Name
TCPU        Th0H    CPU heatsink
TSYS        TN0P    Northbridge temperature
TDIM        Tm0P    DIMM temperature
TAMB        TA0P    Ambient
TCPP        TC0P    CPU proximity
VCPU        VC0C    CPU voltage
VMEM        VM0R    DIMM voltage
FAN0 - FAN9 for FAN speed
FTN0 -FTN9 for FAN rotation time

I didn't found anything related in my DSDT.

They absent until you will write procedures to support this.

This is a table of names that known to ACPImonitor plugin that should be used by a programmer to write own monitoring method.

  • Like 1
Link to comment
Share on other sites

They absent until you will write procedures to support this.

This is a table of names that known to ACPImonitor plugin that should be used by a programmer to write own monitoring method.

Hmmm got it!

 

Can you help me to do that? I'm not ACPI expert...

Link to comment
Share on other sites

Great work and thank you for putting this together.

 

I am trying to get access to values in my sensor hub on my MS Surface Pro 3.  I would also like to enable the volume rocker, power button and windows home button on the digitizer.  The sensor hub is on i2c and I have it enumerated but I believe there is more to it as I've not been able to pull any value data out of it aside from looking at the properties.

 

Id started  to look into enabling the buttons and apparently they are handled via monitoring the gpio and sending acpi events.  I've enabled the Rehabman's ACPI debug kext and made the needed dsdt changes but don't see any acpi events being generated.  Apparently based on some linux driver support the buttons use a non-standard pin config for the gpio.  

 

Would any of this fit into the acpi sensors detection hwsensors uses and if possible, monitoring the rotation/axis/accelerometer and other sensors thru this though, I am not sure what their sam acpi value equivalent would be.  

 

I was able to verify the lid sensor for the typecover is infact working as it follows the acpi spec.  I did also discover a type of tilt sensor built into the typecover that can detect rotation and built a discovery app that uses iokit to output the values.  

 

https://bugzilla.kernel.org/show_bug.cgi?id=84651

 

Any help is appreciated.

 

Thanks!

Link to comment
Share on other sites

But the purpose of the project is monitoring temperature and fans speed as it does real mac by SMC controller.

Are there SMC keys on real Macs corresponding to rotation/axis/accelerometer?

Or it should be other drivers like mouse/keyboard/HID system?

Link to comment
Share on other sites

 Share

×
×
  • Create New...