Jump to content
Slice

[HOWTO] ACPI access for monitoring

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

Share this post


Link to post
Share on other sites
Advertisement

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.

Share this post


Link to post
Share on other sites

@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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

@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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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())
                    }

Share this post


Link to post
Share on other sites

Then with this device FSAM, can I use it to show the rpm of the fan in HWMonitor of kozlek and maybe modify FakeSMC?

If so, how can I do it? 

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

"anywhere" - yes, probably inside Device (LPCB)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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.

Share this post


Link to post
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...

Share this post


Link to post
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!

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Bazza08
      Hi Guys I have been trying to get my hackintosh to work using High Sierra... My Build is:--
       
      Asus Z87-K Mother board
      Intel i5 processor
      8 gig of Memory
      Nvidia Geforce GT 730 4gb DDR3 
      500gb SSD hard drive 
      I can get it up and running if I take Graphics card out and use Internal graphics, but when I have my graphics card in the only way I can get it to work is to use boot flag nv_disabe=1 .... and the graphics are rubbish..... I am trying to get it working by creating my own DSDT file..
       
      what I have tried is to download and used  RwPortableX64V1.7 to extract 4 SSDT.aml files and one DSDT.aml ... I was looking on this forum for any clues what to do next
      but I a am afraid I am stuck... I have uploaded the files I extracted from  RwPortableX64V1.7
       
      Any Help would be appreciated 
       
      Bazza
      DSDT.aml
      SSDT-1.aml
      SSDT-3.aml
      SSDT.aml
      SSDT-2.aml
    • By Duyhaicx
      Hi everybody. I am not a programmer and English is not my native language. So I'm very sorry if it bothers you.
      I want to use an EGPU but that requires editing the DSDT file. I have added the necessary lines of code. The other is to remove the Warning and Remark. It was really hard for me. So I look forward to getting help from a kind person.
      I use HP 8570w and this is my DSDT.dsl file.
      https://drive.google.com/open?id=1Th5DhYm7L08Ufj8AeQHFrLPSzrTaxFC6
      Thank you and have a nice day.
    • By MaLd0n
      Now have a Olarila app, just download app and clover folder for your Chipset! https://olarila.com/forum/viewtopic.php?f=81&amp;t=6771   Nehalem, SandyBridge, IvyBridge, Haswell, Broadwell     Skylake, Kabylake and Coffeelake is here http://www.insanelymac.com/forum/topic/321872-guide-sierra-on-gigabyte-mobos-serie-200-kabylake-dsdt/   Install MacOS with Olarila Image, Step by Step, Install and Post Install
       
      https://olarila.com/forum/viewtopic.php?f=50&t=8685
        Mojave Full DSDT patch   http://olarila.com/forum/viewtopic.php?f=59&amp;t=6428   First...   ***Update bios to last available version!***   If you need a full patched DSDT...  -Extract tables with F4 key in Clover boot screen! -Run it and send me files! RunMe.app   Installation   --Create a bootable copy of macOS Sierra / High Sierra / Mojave   https://github.com/chris1111/Create-Install-Media/releases   --Install Clover in USB stick   https://sourceforge.net/projects/cloverefiboot/files/Installer/   --Replace with my Clover folder https://olarila.com/files/Clover.Folder/CLOVER.SERIES.CHIPSET.zip   --Install Sierra/High Sierra and boot into system!   Post Installation --Install Clover and replace with my folder   https://olarila.com/forum/viewtopic.php?f=28&t=8222   --Reboot and activate video!   Bingo!   Now you need a fine tune! DSDT time!   --DSDT   Patches -FIX ERRORS AND WARNINGS -HPET -SATA -DMAC -SLPB -DARWIN -LPC -XHCI -PLUGIN TYPE -XXXX to HDEF -HDEF -RTC -IRQs -SBUS -BUS1 -MCHC -ALS0 -SHUTDOWN -LAN -USBX -PMCR -EC -PNLF -HDMI
       
      --Power Management
      - 1 Generation Intel Processors, use Generate P and C States in config.plist
      - 2 and 3 Generations Intel Processors, Generate SSDT with Piker script and drop CpuPm and Cpu0Ist SSDTs
      ssdtPRGen.command.zip
      Credits-https://github.com/Piker-Alpha/ssdtPRGen.sh
      - 4 Generation+ Intel Processors, use PluginType=1 in DSDT, SSDT or Clover config.plist
       
      for check Power, Frequency, Temperature and Utilization, use it
       
      Install Intel Power Gadget.pkg.zip
       
      --Brightness
      Install .app, select the required permission and reboot. Work in F1 / F2 keys!
      NativeDisplayBrightness.app.zip


      https://github.com/Bensge/NativeDisplayBrightness/releases
      *in some cases .app don't work, check patches in config.plist inside Clover folder Post Install
       
      --Clover
       
      https://sourceforge.net/projects/cloverefiboot/files/Installer/
       
      --AUDIO
       
      Use DSDT + AppleAlc
       
      --install Lan driver by Mieze
        -Atheros   http://www.insanelymac.com/forum/files/file/313-atherose2200ethernet/   -Intel   http://www.insanelymac.com/forum/files/file/396-intelmausiethernet/   -Realtek   http://www.insanelymac.com/forum/files/file/88-realtekrtl8111-binary/   --Links   -FakeSMC   https://bitbucket.org/RehabMan/os-x-fakesmc-kozlek   -Audio   https://github.com/vit9696/AppleALC http://www.insanelymac.com/forum/topic/314406-voodoohda-289/   -USB   https://bitbucket.org/RehabMan/os-x-usb-inject-all/downloads   It's time to Rock   -Credits and thanks to the old and new people in the community who developed patches, kexts and bootloaders!   Apple, Slice, Kabyl, usr-sse2, jadran, Blackosx, dmazar, STLVNUB, pcj, apianti, JrCs, pene, FrodoKenny, skoczy, ycr.ru, Oscar09, xsmile, SoThOr, RehabMan, Download-Fritz, Zenit432, cecekpawon, Intel, Oracle, Chameleon Team, crazybirdy, Mieze, Mirone, Oldnapalm, netkas, Elconiglio, artut-pt, ErmaC, Pavo, Toleda, Master Chief and family, bcc9, The King, PMheart, Sherlocks, Micky1979, vit9696, vandroiy2013, Voodoo Team, Pike R. Alpha, lvs1974, Austere.J, CVad and many, many, many others!   We're all here to have fun and learn from each other!  
    • By MaLd0n
      Now have a Olarila app, just download app and clover folder for your Chipset! https://olarila.com/forum/viewtopic.php?f=81&amp;t=6771   Install MacOS with Olarila Image, Step by Step, Install and Post Install
       
      https://olarila.com/forum/viewtopic.php?f=50&t=8685
        First... If you need DSDT edits... -Extract tables with F4 key in Clover boot screen! -Run it and send me files! RunMe.app   Installation --Create a bootable copy of El Capitan /  Sierra / High Sierra / Mojave   https://github.com/chris1111/Create-Install-Media/releases   --Install Clover in USB stick https://sourceforge.net/projects/cloverefiboot/files/Installer/   --Replace with my Clover folder   https://olarila.com/files/Clover.Folder/CLOVER.LGA775.zip   --Install EL Capitan / Sierra / High Sierra and boot into system!     Post Installation   --Install Clover and replace with my folder   https://olarila.com/forum/viewtopic.php?f=28&t=8222     --Reboot and activate video!   Bingo! Now you need a fine tune! DSDT Time!   My DSDT GA P35-DS3   DSDT.MaLd0n.zip     Patches -FIX ERRORS AND WARNINGS -HPET -SATA -SLPB -DARWIN -LPC -HDEF -RTC -EHCI -UHCI -IRQs -SBUS -BUS1 -MCHC -ALS0 -SHUTDOWN -LAN -EC -PNLF --Native Power Management
       
      Use Clover, check Generate P and C States
       
      --Brightness
      Install .app, select the required permission and reboot. Work in F1 / F2 keys!
      NativeDisplayBrightness.app.zip


      https://github.com/Bensge/NativeDisplayBrightness/releases
      *in some cases .app don't work, check patches in config.plist inside Clover folder Post Install
       
      --AUDIO
       
      Device HDEF + AppleAlc + Lilu
       
      --install Lan driver by Mieze
        -Atheros   http://www.insanelymac.com/forum/files/file/313-atherose2200ethernet/   -Intel   http://www.insanelymac.com/forum/files/file/396-intelmausiethernet/   -Realtek   http://www.insanelymac.com/forum/files/file/88-realtekrtl8111-binary/   --Links   -FakeSMC   https://bitbucket.org/RehabMan/os-x-fakesmc-kozlek   -Audio   https://github.com/vit9696/AppleALC http://www.insanelymac.com/forum/topic/293863-applehda-patch-requests/   -Credits and thanks to the old and new people in the community who developed patches, kexts and bootloaders!   Slice, Kabyl, usr-sse2, jadran, Blackosx, dmazar, STLVNUB, pcj, apianti, JrCs, pene, FrodoKenny, skoczy, ycr.ru, Oscar09, xsmile, SoThOr, RehabMan, Download-Fritz, Zenit432, cecekpawon, Intel, Apple, Oracle, Chameleon Team, crazybirdy, Mieze, Mirone, Oldnapalm, netkas, Elconiglio, artut-pt, ErmaC, Pavo, Toleda, Master Chief and family, bcc9, The King, PMheart, Sherlocks, Micky1979, vit9696, vandroiy2013, Voodoo Team, Pike R. Alpha, lvs1974, Austere.J, CVad and many, many, many others!   We're all here to have fun and learn from each other!   ENJOY!  
    • By kylon
      ACPI and Clover config for Acer Aspire v5-571PG
       
      Tested on Catalina 10.15.1 and Clover EFI 5098 (Should work on MacOS 10.9.x - 10.15.x)
       
      Not Working:
      - sd card reader
      - Atheros AR9462 (use a compatible USB wireless adapter, see below)
      - Touchscreen (MacOS 10.15 only)
       
       
      Notes:
      Disable Secure Boot and enable Legacy Boot. Legacy Mode is recommended.  
      **To reset your BIOS, power on the pc and hold the power button for about 30-40 seconds or you can short G2101 (RAM SLOT 1)**
       
       
      About the Atheros card:
      You can install ATH9KFixup (you will also need additional patches on 10.14+ to restore Atheros support) to enable this card, however,
      it will break sleep on MacOS 10.14+, it can freeze your OS at any time and it can freeze your network settings.
      Because of its instability it is highly recommended to buy a USB wireless adapter.
       
      You can find a list of working adapters, and the drivers, here.
       
       
      Additional things you will need:
      Latest Clover config (AcerAspireV5-571pg - CCE Bank) from here CloverEFI (download) or OpenCore (download - Untested) WhateverGreen (download) VoodooPS2 (download) VirtualSMC + SMCBatteryManager (download) AppleALC (download) Lilu (download) Mieze Realtek RTL8111 (download)  
      CloverEFI drivers you will need:
      ApfsDriverLoader EmuVariableUefi FSInject DataHubDxe VBoxHfs (if you have hfs partitions)  
      Remember to install BIOS drivers if you enable Legaby Boot.
       
       
       
      Feel free to ask for help.
      Please send me a PM if you have fixes or improvements, thanks.
×