Jump to content
Slice

[HOWTO] ACPI access for monitoring

42 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 DaHarry
      I have installed Hackintosh on to my System, but the CPU cooler is obviously louder then on Windows.
      I am using right now VirtualSMC.kext, but since FakeSMC provides temperature measurement tools, and VirtualSMC not, I asked my self if that might be a hint for my loud cooler?
      My question, has somebody tried maybe both and even compared them? And is FakeSMC maybe less noisy?
      Is it enough to just mount EFI partition, and delete the VirtualSMC.kext and put instead FakeSMC.kexts ? Without any fancy kext installation tool or terminal commands, just replace files and restart in enough?
      My System:
      Mainboard: Gigabyte Aorus Z390 Ultra
      CPU: Intel i9 9900k
      CPU Cooler: BeQuiet! Dark Rock 4
      GPU: Vega 64
      Ram: 2x16GB Corsair 3200
      SSD: 1TB Adata M.2
       
      The Tutorial i have used - https://github.com/cmer/gigabyte-z390-aorus-master-hackintosh/blob/master/STEP_BY_STEP.md
       
      Really works like a charm besides, the more noisy cooler, which i bought because it is extra quietly.
      I asked first at tonymac's forum, but they deleted the post because I haven't used their tool, really disgustig.. I really hope to never use their tools, and I hope here the information freedom is more respected.
      #f. tonyhoremacs
    • By bbritton
      Hi
       
      I am trying to create a clean DSDT for my new hackintosh.  It is all working very well and I hope this will make things even better.
      I have a Gigabyte Z390 AORUS MASTER,
      I9-9900K
      32 gb Ram
      gigabyte vega 64 OC
       
      I extracted the DSDT and SSDT files using F4 in Clover.  I have supplied the resulting DSDT below.  THese are the four errors I get when trying to compile in MACIasl.  ALso I am using ACPI 5.1 in maciasl.
       
      12891, 6126, syntax error, unexpected PARSEOP_NAMESEG, expecting '('
      12900, 6126, syntax error, unexpected PARSEOP_CASE
      12904, 6126, syntax error, unexpected PARSEOP_NAMESEG, expecting '('
      12913, 6126, syntax error, unexpected PARSEOP_CASE, expecting $end and premature End-Of-File
       
      I am newbie to hackintosh so am learning as much as I can as i go.  I am not a programmer so the syntax errors I am not sure what to do with yet.  Any assistance would be appreciated.
       
      Thanks
       
      DSDT.dsl
      DSDT.aml
    • 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 for SkyLake, KabyLake or CoffeeLake... -Post your full Clover folder with original tables in Origin folder(Extract with F4 in Clover boot screen) -Post Ioreg, extract with Ioreg Explorer http://www.insanelymac.com/forum/index.php?app=core&module=attach&section=attach&attach_id=222606 -Run it, post files generated in your desktop http://www.insanelymac.com/forum/index.php?app=core&module=attach&section=attach&attach_id=222609  Installation   --Create a bootable copy of macOS Sierra Check out the link http://www.insanelymac.com/forum/files/file/559-flash-drive-maker/   --Create a bootable copy of macOS HighSierra Check out the link http://diskmakerx.com/   --Install Clover in USB stick https://sourceforge.net/projects/cloverefiboot/files/Installer/   --Replace with my Clover folder  CLOVER.zip   --Install Sierra/High Sierra and boot into system!   Post Installation   --Install Clover in HDD/SSD and replace with my folder CLOVER.zip   --Reboot and activate video!   -Nvidia WebDriver Sierra http://www.insanelymac.com/forum/topic/312525-nvidia-web-driver-updates-for-macos-sierra-update-07212017/ -Nvidia WebDriver High Sierra http://www.insanelymac.com/forum/topic/324195-nvidia-web-driver-updates-for-macos-high-sierra-update-10162017/ -Cuda http://www.insanelymac.com/forum/topic/302795-cuda-90214-is-out-update-10162017/   --DSDT My DSDT with Skylake patches DSDT.MaLd0n GA H110M-S2.zip Patches -FIX ERRORS AND WARNINGS -HPET -SATA -DMAC -SLPB -DARWIN -LPC -XHCI -PLUGIN TYPE -HDAS to HDEF -HDEF -RTC -IRQs -SBUS -BUS1 -MCHC -ALS0 -SHUTDOWN -LAN -USBX -PMCR -EC -PNLF -HDMI --FakeSMC https://bitbucket.org/RehabMan/os-x-fakesmc-kozlek --Audio https://github.com/vit9696/AppleALC --USB https://bitbucket.org/RehabMan/os-x-usb-inject-all/downloads --LAN http://www.insanelymac.com/forum/topic/287161-new-driver-for-realtek-rtl8111/   -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 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
            Create a bootable copy of macOS Sierra Check out the link http://www.insanelymac.com/forum/files/file/559-flash-drive-maker/   --Install Clover UEFI in USB stick https://sourceforge.net/projects/cloverefiboot/files/Installer/   --Replace Folder CLOVER INSTALLATION.zip   --Install Sierra and boot into system!   --Install Clover UEFI and replace with my folder  CLOVER POST INSTALLATION.zip   --Reboot and activate video!   Bingo!   Now you need a fine tune! I prefer DSDT way, apply all patches in one file, many people prefer many SSDTs or Clover patches!   If you need DSDT edit... Run it RunMe.app   --DSDT My DSDT DSDT.ASUS H61M-A MaLd0n.zip   Patches -FIX ERRORS AND WARNINGS -HPET -SATA -SLPB -DARWIN -EHCx -LPC -HDEF -RTC -IRQs -SBUS -BUS1 -MCHC -ALS0 -SHUTDOWN -LAN -PNLF Clear NVRAM, Purge and Kextcache
          --FakeSMC http://www.hwsensors.com/releases --Audio https://github.com/vit9696/AppleALC --USB https://bitbucket.org/RehabMan/os-x-usb-inject-all/downloads --LAN http://www.insanelymac.com/forum/topic/287161-new-driver-for-realtek-rtl8111/   Credits and thanks to the old and new people in the community who developed patches, kexts and bootloaders!
    • 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/files/Clover.Folder/CLOVER.SERIES.CHIPSET.zip   --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!  
×