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 fusion71au
      This is a brief guide on how to create a vanilla El Capitan (also same process for Sierra) OS X Installer USB with an updated prelinked kernel containing FakeSMC.

      It is tailored for those users who want to understand the “nuts and bolts” of how to create an installer and also to help brush up on their terminal skills (rather than have one made for them with the numerous automated “tools” available or even Apple’s createinstallmedia) :
       
       
      Specifically, it is also a “Proof of Concept” which shows that installation is possible without even having to rely on boot loader kext injection.

      Prerequisites
      Existing Yosemite installation (or Mavericks - see post#4 for steps 7,8) “Install OS X El Capitan.app" downloaded to the Applications folder Pacifist FakeSMC.kext - Slice or Kozlek branch Bootloader - Clover or Chameleon 8GB or larger USB drive (16GB recommended), formatted HFS+ (MBR or GUID) named “Installer”  
      Procedure
      1.  Boot into Yosemite with the kext-dev-mode=1 boot flag
      2.  Open OS X terminal and type the following lines, followed by <Enter> after each line.
          The image restore and file copying may take a while to complete, and at the end of the process, the Installer volume is renamed to “OS X Base System"....
       
      sudo -s hdiutil attach /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/SharedSupport/InstallESD.dmg asr restore -source /Volumes/OS\ X\ Install\ ESD/BaseSystem.dmg  -target /Volumes/Installer -erase -format HFS+ -noprompt -noverify rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages cp -av /Volumes/OS\ X\ Install\ ESD/Packages /Volumes/OS\ X\ Base\ System/System/Installation cp -av /Volumes/OS\ X\ Install\ ESD/BaseSystem.dmg /Volumes/OS\ X\ Install\ ESD/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System diskutil unmount /Volumes/OS\ X\ Install\ ESD exit 3.  Right click on the “OS X Base System” Volume and click “Get Info”
       

      4.  Click on the lock icon and untick “Ignore ownership on this volume”
       

      5.  Extract/Copy the El Capitan Kernels folder into /System/Library/ of the USB with Pacifist.  NB It is found in the "Essentials.pkg" in /System/Installation/Packages
       

      6.  Delete or Rename the original /System/Library/PrelinkedKernels/prelinkedkernel —> OG.prelinkedkernel
       

      7.  Copy FakeSMC.kext and other necessary kexts (e.g. VoodooPS2Controller.kext for laptops) into the /Library/Extensions folder of the installer USB using Finder.
       

      8.  Back in terminal, type the following lines, followed by <Enter> after each line to rebuild the prelinkedkernel…..
       
      sudo -s chmod -R 755 /Volumes/OS\ X\ Base\ System/Library/Extensions chown -R 0:0 /Volumes/OS\ X\ Base\ System/Library/Extensions touch /Volumes/OS\ X\ Base\ System/System/Library/Extensions kextcache -u /Volumes/OS\ X\ Base\ System exit Any errors should be noted but the output below is normal e.g.


      9. Install your Bootloader targeting the OS X Base System volume
       
       
       
       
      10.  Boot your system with the USB without injected kexts into the OS X Installer GUI....
       
       
       
       
       
      Post Install
      The original prelinked kernel in a fresh install of El Capitan will also lack FakeSMC ie it will only be linked to Apple signed kexts.  In order to boot into El Capitan the first time around without boot loader kext injection, the PLK needs to be rebuilt for the El Capitan volume like we did for the installer:
       
      1.  Boot into Yosemite with the kext-dev-mode=1 boot flag
      2.  Delete or Rename the original /System/Library/PrelinkedKernels/prelinkedkernel for the El Capitan volume —> OG.prelinkedkernel
      3.  Copy FakeSMC.kext and other necessary kexts (e.g. VoodooPS2Controller.kext for laptops) into the /Library/Extensions folder of El Capitan using Finder
      4.  Back in terminal, type the following lines, followed by <Enter> after each line to rebuild the prelinkedkernel.  In this example, the El Capitan volume is named "El_Capitan" - change if you have named it something else...
      sudo -s chmod -R 755 /Volumes/El_Capitan/Library/Extensions chown -R 0:0 /Volumes/El_Capitan/Library/Extensions touch /Volumes/El_Capitan/System/Library/Extensions kextcache -u /Volumes/El_Capitan exit 5. Install your Bootloader targeting the El Capitan volume.  This step is only necessary if you are installing El Capitan on a new drive without existing boot loader (not required if installing on a disk with existing boot loader beside Yosemite).
      6. Reboot your system without injected kexts into El Capitan!
       
       
      Other links
      The All-In-One Guide to Vanilla OS X for beginners
       
      Updates for Sierra and High Sierra   Custom Prelinkedkernel Generator Tool I have made a custom prelinkedkernel generator "PLK.tool" for Sierra + El Capitan.  Instructions:   1.  Download and extract the attached BaseSystem_PLK.tool.zip into your ~/Downloads folder.   2.  Copy any extra kexts necessary for booting your hack to ~/Downloads/BaseSystem/ExtraKexts (e.g. FakeSMC, VoodooPS2Controller), making sure SIP is disabled. 3.  Copy BaseSystem.dmg to ~/Downloads/BaseSystem  4.  Open terminal and run the following commands... cd ~/Downloads/BaseSystem chmod +x PLK.tool ./PLK.tool ---> supply your admin password ---> will place your new custom prelinkedkernel on the desktop.       macOS High Sierra bypass Firmware and MBR checks in post#13.
      BaseSystem_PLK.tool_ElCap.zip
      BaseSystem_PLK.tool_Sierra.zip
      BaseSystem_PLK.tool_Mojave.zip (need to run in Mojave to avoid dependency errors)
       
    • By Haive_Music
      Hey guys,
       
      I'm really hoping someone has the experience and ability to help me iron out the last remaining issue on my build.  
       
      The motherboard is: Gigabyte Z370 Aorus Gaming 7 and I'm running a Alpine Ridge thunderbolt card (Revision 2).   I've gotten everything working for the most part with the exception of Thunderbolt hotplug.  This is the last piece of the puzzle.  I've tried so many different DSDT/SSDT's, cable plugged in, and unplugged, without any luck at all. 
      I've managed to get my Focusrite Clarett 8Pre Thunderbolt working and it's showing up under the PCI section.  It works great, until I shut the device off and turn it back on.  I'd really like to try to get this hotplug issue sorted out, but I've had absolutely no luck so far.
       
      I've managed to get the Alpine Ridge NHI and USB controllers showing up in the PCI section too, but for some reason, the USB lists a bunch of ',,,,,,,,' after the name. 
       
       
      I'll be the first to admit - I don't really know a whole lot about what I'm doing with this stuff, but I've attached relevant files in hopes someone more experienced and knowledable can help me get this working.  
       
      Thanks guys!
      config.plist
      DSDT.aml
      John’s iMac.iojones

      SSDT-TB3.aml
    • By neo_fox33
      DSDT patched for GA-Z97x-Gaming 3 V2 NVIDIA
       
      ACPI Specification 6.2a
    • By kylon
      ACPI and Clover config for Acer Aspire v5-571PG intel i5-U IvyBridge
       
       
      Not Working:
      - sd card reader
       
       
      Tested on High Sierra 10.13.6 and Clover EFI 4678
       
       
      Notes:
      Somehow boot Clover EFI.
      You may need to disable UEFI and boot Clover as Legacy with EmuVariable.
      After that, you should install and boot macOS to install clover as legacy in your EFI partition.
      Now disable Secure Boot and enable UEFI Mode. (remove EmuVariable)
      You may need more steps if you are dual-booting with Windows.
       
       
      **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)**
       
       
      Feel free to ask for help.
       
      You will need:
      Clover install options: Install in EFI Partition, Install boot0af, Enable OsxAptioFixDrv-64 and script RC Latest Clover config (acerAspirev5-571PG - CCE Bank) from here ATH9KFixup (here) WhateverGreen (here) Rehabman AppleIntelBacklightInjector (here) in L\E + rebuild cache Rehabman Voodoo PS2 Controller (here) Rehabman ACPI Battery Driver (here) vit9696 AppleALC (here) + Lilu (here) Mieze Realtek RTL8111 (here)
    • By kylon
      A big thanks to wegface for teaching me a lot of things.
       
       
      Tested on High Sierra 10.13.6 and Clover EFI 4679
       
      Not Working:
      - realtek sd card reader (pm me if you have a fix)
       
      Notes:
      **CPU patches are disabled, if you are using a locked BIOS you must enable them**
       
      Clover EFI:
      - Install it in UEFI Mode and change your hdd partition table to GPT.
      - You will be able to install ANY OS in EFI mode, even if this pc does not support EFI at all! (No guide available for this)
       
      You will need:
      My unlocked BIOS (OPTIONAL) (here) Latest Clover config from CCE Bank (here) (asus k53sj-kylon) Rehabman AppleIntelBacklightInjector (here) in L\E + rebuild cache Rehabman Voodoo PS2 Controller (here) Rehabman ACPI Battery Driver (here) vit9696 AppleALC (here) + Lilu (here) Mieze Realtek RTL8111 (here) FakeSMC 3.5.1 from Clover EFI source
×