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 MaLd0n
      ---INSTALLATION TUTORIAL---
       
      ---Original Post---
      https://olarila.com/forum/viewtopic.php?f=45&t=9172
       
      ---USB---
      https://pikeralpha.wordpress.com/2016/07/13/simple-skylake-usb-fix-no-kexts-required/
       
      ---CLOVER FOLDER---
       
      CLOVER.zip
       
       
      --MOBO
      GigaByte Z390 M Gaming



      --PROCESSOR
      Intel Core i9-9900K


      --COOLER
      CoolerMaster MasterLiquid ML120R RGB


      --MEMORY
      Corsair Dominator Platinum 16GB (2 x 8GB)


      --GPU
      Sapphiretech Radeon RX 590 8 GB GDDR5


       
      --SSD
      Samsung 970 EVO NVMe M2 Flash Drive


      --POWER SUPPLY
      EVGA 750 N1, 750W


      --WIRELESS
      TP-Link Archer T9E


      --BLUETOOTH
      Orico BTA-403


      --CASE
      Thermaltake View 21 Tempered Glass Edition


      --DSDT Patches--
      -FIX ERRORS AND WARNINGS -FIX ACPI ERRORS -REMOVE UNUSED SCOPES / DEVICES -HIGH PRECISION EVENT TIMER -SATA SERIE 10 ID -DMAC -REMOVE 22K LINES, PROBLEMATIC and UNUSED -FIX K.P in REBOOT -NVRAM / REAL TIME CLOCK -SLPB -DARWIN / WINDOWS 2015 -XHCI -PLUGIN TYPE -HDAS to HDEF -HDEF -REAL TIME CLOCK -ARTC -IRQs -SBUS -MIKEY -BUS1 -MCHC -ALS0 -SHUTDOWN -UAR1 -LAN -FWHD -USBX -PMCR -PPMC -XSPI -GMM -IMEI -EC -PNLF -ARPT -GFX0 -NVME -DTGP -ACQUIRE MUT0 0XFFFF -OPERATION REGION GPIO -MUTEX MUT0 0x00 -EXTERNAL REFERENCES -UNKNOWNOBJ -HDMI / HDAU -FULL RENAMED DEVICES  
      --SCREENSHOTS--





























      --BruceX--
       
      --USB-C-- test with SanDisk Ultra USB-STICK 128gb


       
      -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, Sampath007, onemanosx, erroruser, Jenny David, Olarila Facebook Community, Hackintosh Facebook Community and many others!
      We're all here to have fun and learn from each other!
    • By AppleBytes
      Hello,
      I'm working on a re-install of OSX on a dell inspiron 9400. I was finally able to get a copy of SL on it. But it still needs MUCH work, as the graphics (NVIDIA Geforce Go 7800) isn't properly recognized -- either by model, or installed VRAM.
      It has 512Mb, but only initializes 256Mb VESA.
      Anyway, as a start, I thought it best to use a valid dsdt.dsl for compilation, and start there. I've managed to remove all the warnings, and errors save 2
      OUTPUT:
      # sudo iasl -ta ./dsdt.dslll Intel ACPI Component Architecture ASL Optimizing Compiler version 20110527-64 [May 27 2011] Copyright (c) 2000 - 2011 Intel Corporation ./dsdt.dslll   3519:                                 Return (0x00) Error    4080 -           Invalid object type for reserved name ^  (found INTEGER, requires Buffer) ./dsdt.dslll   3956:                     Return (Package (0x00) {}) Remark   5072 -         Effective AML package length is zero ^ ASL Input:  ./dsdt.dslll - 4997 lines, 158533 bytes, 1633 keywords Compilation complete. 1 Errors, 0 Warnings, 1 Remarks, 577 Optimizations I'm attaching a copy of the above output, and the dsdt.dsl file in a tarball to this post in hopes someone with the required knowledge can help me fix it.
      FWIW
      SMBIOS I'm using indicates this is a MBP 3,1
      cpu: cd2 (T7400 @2.16Ghz)
      graphics: NVIDIA Geforce Go 7800 ( G70M? )
      ram: 4Gb
      dell inspiron 9400 (Laptop)
       
      Thank you for all your time, and consideration!
       
      --Chris
       
      DSDT-DSL.tar
    • By penghubingzhou
      URL:https://github.com/penghubingzhou/VoodooI2C-DSDT
       
      VoodooI2C-DSDT is a repository that is aiming at collecting various successful DSDTs for Voodoo I2C.
      Purpose
      The purpose of this repository is to provide some useful code examples for people who haven't yet make Voodoo I2C work. Maybe It don't have your model of laptop, but code in this repository may have some help and references for you.
      Note that the code in this repository is ONLY FOR REFERENCES and it can‘t replace your own work!
      For Submission
      This repository welcomes everyone to submit DSDT code examples that have successfully made VoodooI2C work by PR. To submit your example, please put the DSDT file (or Hotpatch SSDT file), an ioreg without Voodoo I2C installed, and Info.txt in a folder named by your laptop model. Info.txt should include:
      Your CPU model (better for including CPU platform)
      Your touchpad Device ID
      The mode you use (GPIO interrupt or polling)
      Satellite Driver You Use
      Then, fork this repository and clone it, put your file in and commit it to your repository. After checking the conflicts, you can send your commit as a PR to me.
      An example for submitting can be found in Lenovo Xiaoxin Chao 7000-14.
      Credits
      @Alexandred for VoodooI2C @daggeryu for the idea in this repository @penghubingzhou and @williambj1 for maintaining
    • By Gorec
      Hi.
      I apologize in advance if I didn't post in the right category and if my title and description aren't specific enough :c
       
      My config in a nutshell:
      CPU: i7 5820k GPU: MSI GTX 1060 3GB RAM: 16 GB MOBO: MSI X99 SLI PLUS I attached RunMe output with all the details of my built.
       
      Some background:
      I have my Hackintosh for about half a year. That time I managed to make it works and fix major issues, but some of them left unresolved since then and I ignored them until now.
      I use my Hackintosh for Adobe projects (PR, AE, PS, IL, AU and a lot more) - most of them connected with video editing of course browsing with Chrome and other small tasks.
       
      Problems:
      Random restarts - this is the biggest one. I'm starting to work on bigger and bigger projects and at this time I think I can't allow this to happen that often. In the past, they happened like once a day or a couple of times a week. However, now it's just frustrating when it happens even 5 or more times a day. I've tried to observe and find out what can be the cause but I haven't managed to find any connections. I thought it happens when Premiere or another app is using GPU, but I haven't seen increased usage when it restarts. I think that it can be connected with GPU, memory or PSU or... meh, anything else. I don't have resources to check if it'll work with other components. There should be some fix for this. I will really appreciate any help with this :c Restart instead of shutdown & sleep doesn't work. I've tried to look through some Google results for this and tried many solutions (as you can see in attached Clover folder), but I think the right one for many of these issues is to make my own DSDT. Glitches, freezes and other things while encoding a video. It happens very often when I try to do this. Maybe it is an issue with GPU or (hopefully) only with GPU drivers which can be fixed with some patch. Today my headphones stopped working. I have a multi-output device configured in the Audio MIDI Setup app which includes my headphones (HyperX Cloud via USB) and Soundflowerbed virtual audio device for capturing system audio. Today while I was trying (like 15 times) to encode a video in Media Encoder in the background and watch video on YouTube I stopped hearing anything from my system. Of course, it restarted a couple of times as always, but even this didn't solve this. If I plug them directly with mini jack (not via USB Soundcard which was in the box and which I always used) in the front IO or the back I only hear some loud noise It takes EX-Fat formatted volumes a few minutes to mount after each restart. I found a workaround to format it with NTFS since I have Tuxera installed and I will reformat these volumes when I will find time for this, but maybe there is some fix for this. GPU is a little bit hot. HW Monitor shows it is only 45-55 degrees, but for my hand is a little bit hot, idk. Also related to GPU - glitch after POST but before entering Clover boot menu. It is a black screen with little white squared glitches for a few seconds. Maybe it indicates the GPU drivers are loading, but maybe it shouldn't be like this. And if I can ask about that - I can't make all applications hide on startup. I, obviously, have "Hide" checkbox checked on every login item in settings, but it doesn't work, none of the apps is hidden in the dock. Is there a way to fix this? Also a small but annoying problem - I can't turn off permanently Mojave update notification (since I tried to install it, and I had to reverse to High Sierra because I had a black screen and I didn't have time for repairing all of them. Tags are not working in Finder - every time I tag a file or folder and make a change in it (for example save a text file) the tag disappears.  
      So, with knowing all of that, is there a way to make a proper DSDT file for my Hackintosh? I tried to look through some guides on how to make it but I think I reached my abilities to understand how Mac OS works and what all of these things are, so I'm asking you guys politely, would someone like to help me? At least with these random restarts? :/
      I really begin to think that I'm a newbie in configuring all of that Clover things - even after what I managed to do with my PC. Help me, pleease... :c
       
      If you have any questions post it below, I will really appreciate any help <3
      Send me MBP-Gorec.home.zip
    • By tom666
      osx10.14
      i5-4250u
      i have added "irq hdef hdau  mutex osys10" patch
      and install acpibettery on clover ,but the battery management still donot work

      my audio card is alc269vc ,i try to use applealc,and tried all the layoutid, all of those colud not work.
      2019-03-31 20:18:23.389590+0800  localhost kernel[0]: (kernel) AppleALC:     alc @ failed to find IOHDACodecVendorID, retrying 0
      i have also use linux to find the codec
      i uploaded the clover , dsdt,codec.
      This problem has been bothering me for two days.
      thanks
       
       
      all.zip
      2019-03-31 20:18:17.997435+0800  localhost kernel[0]: calling mpo_policy_init for Lilu
      2019-03-31 20:18:18.003796+0800  localhost kernel[0]: Security policy loaded: Lilu Kernel Extension 1.3.5 (Lilu)
      2019-03-31 20:18:23.389590+0800  localhost kernel[0]: (kernel) AppleALC:     alc @ failed to find IOHDACodecVendorID, retrying 0
      2019-03-31 20:18:23.398483+0800  localhost kernel[0]: (kernel) Lilu: patcher @ lookup patching applied only 0 patches out of 1
×