Jump to content
  • Announcements

    • Allan

      Forum Rules   04/13/2018

      Hello folks! As some things are being fixed, we'll keep you updated. Per hour the Forum Rules don't have a dedicated "Tab", so here is the place that we have our Rules back. New Users Lounge > [READ] - InsanelyMac Forum Rules - The InsanelyMac Staff Team. 
oldnapalm

AppleRTC patch (CMOS reset after sleep/wake)

49 posts in this topic

Recommended Posts

sudo perl -pi -e 's|\x75\x2e\x0f\xb6|\xeb\x2e\x0f\xb6|' /System/Library/Extensions/AppleRTC.kext/Contents/MacOS/AppleRTC
sudo touch /System/Library/Extensions
 

It's the same patch as ML, just different location, thanks rayap
 
 
10.8
< 0000000000001d32 jne 0x1d64
---
> 0000000000001d32 jmp 0x1d64
10.9
< 0000000000000d3e jne 0xd6e
---
> 0000000000000d3e jmp 0xd6e

 

Share this post


Link to post
Share on other sites

This patch does NOT work.

 

For me it worked pretty well! i've patched the original applertc from S/L/E and added in E/E , then i've restored the vanilla one in the original S/L/E folder...

Share this post


Link to post
Share on other sites

For me it worked pretty well! i've patched the original applertc from S/L/E and added in E/E , then i've restored the vanilla one in the original S/L/E folder...

 

well without a patched dsdt on 4 different machines that ive tested this on, cmos resets until i patch the dsdt, so.... i can confirm that it doesnt work.

Share this post


Link to post
Share on other sites

Without a patched DSDT you will have CMOS reset even without using sleep/wake on many machines.

 

AppleRTC patch avoids CMOS reset after sleep/wake.

 

It's a well known issue, anyway I've updated the title.

 

More info

http://www.insanelymac.com/forum/topic/253992-cmos-resets-on-restarts-after-sleep-and-wake-in-107-lion/

 

If it's not the case, how do you patch DSDT to avoid CMOS reset after sleep/wake?

Share this post


Link to post
Share on other sites
If it's not the case, how do you patch DSDT to avoid CMOS reset after sleep/wake?

 

Original code with comments on what to change.

Device (RTC)
{
    Name (_HID, EisaId ("PNP0B00"))  // _HID: Hardware ID
    Name (ATT0, ResourceTemplate ()
    {
        IO (Decode16,
            0x0070,             // Range Minimum
            0x0070,             // Range Maximum
            0x00,               // Alignment
            0x04,               // Length <-- Change from 4 to 2
            )
        IRQNoFlags () // <-- remove or comment 
            {8} // <-- these two lines
    })
    Name (ATT1, ResourceTemplate ()
    {
        IO (Decode16,
            0x0070,             // Range Minimum
            0x0070,             // Range Maximum
            0x00,               // Alignment
            0x04,               // Length <-- Change from 4 to 2
            )
    })
    Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
    {
        If (LGreaterEqual (OSFX, 0x03)) {
            If (HPTF) {
                Return (ATT1)
            } Else {
                Return (ATT0)
            }
        } Else {
            Return (ATT0)
        }
    }
}

Fixed without comments:

Device (RTC)
{
    Name (_HID, EisaId ("PNP0B00"))  // _HID: Hardware ID
    Name (ATT0, ResourceTemplate ()
    {
        IO (Decode16,
            0x0070,             // Range Minimum
            0x0070,             // Range Maximum
            0x00,               // Alignment
            0x02,               // Length
            )
    })
    Name (ATT1, ResourceTemplate ()
    {
        IO (Decode16,
            0x0070,             // Range Minimum
            0x0070,             // Range Maximum
            0x00,               // Alignment
            0x02,               // Length
            )
    })
    Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
    {
        If (LGreaterEqual (OSFX, 0x03)) {
            If (HPTF) {
                Return (ATT1)
            } Else {
                Return (ATT0)
            }
        } Else {
            Return (ATT0)
        }
    }
}

Share this post


Link to post
Share on other sites

On my Asus P5E this DSDT patch only fixes CMOS reset if I don't use sleep. After a sleep/wake CMOS is still reset if I don't patch AppleRTC.

Share this post


Link to post
Share on other sites

AppleRTC in DP2 can be patched with the same offset from the DP1

 

EDIT: Sorry, my mistake. Is the same kext. :P

Share this post


Link to post
Share on other sites

oldnapalm, thank you for nice tip.

 

 

I have on my DSTD the RTC block:

                Device (RTC)
                {
                    Name (_HID, EisaId ("PNP0B00"))
                    Name (BUF0, ResourceTemplate ()
                    {
                        IO (Decode16,
                            0x0070,             // Range Minimum
                            0x0070,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                    })
                    Name (BUF1, ResourceTemplate ()
                    {
                        IO (Decode16,
                            0x0070,             // Range Minimum
                            0x0070,             // Range Maximum
                            0x01,               // Alignment
                            0x08,               // Length
                            )
                        IRQNoFlags ()
                            {8}
                    })
                    Method (_CRS, 0, Serialized)
                    {
                        If (LEqual (HPTS, One))
                        {
                            Return (BUF0)
                        }
                        Else
                        {
                            Return (BUF1)
                        }
                    }
                }

If I remove the IRQNoFlags (), then comp will not go to the sleep at all. Has been reported that erasing IRQ from RTC breaks sleep under snow leopard 10.6.0 and 10.6.1, on 10.6.2 doesn´t breaks sleep. Seems that OS X 10.9 (13A603) removing the IRQNoFlags will break the sleep. 

 

I tested your suggestion to patch AppleRTC. Similar approach is also described on thedotnetter blog. 

 

Seems that this patch does NOT work for me. Any suggestions?

 

 

 

 

 

Share this post


Link to post
Share on other sites

This works for me on 10.9 Mavericks:

perl -pi -e 's|\x41\x89\xd7\x41\x89\xf4|\xe9\xb8\x00\x00\x00\x90|;' /System/Library/Extensions/AppleRTC.kext/Contents/MacOS/AppleRTC

 

Verify your source file before patching: 

md5 AppleRTC 

MD5 (AppleRTC) = 4b1d28ac48a2a7b35ed6b2034e0fd912

 

This patch completely disables all CMOS writes from AppleRTC

Share this post


Link to post
Share on other sites

This works for me on 10.9 Mavericks:

perl -pi -e 's|\x41\x89\xd7\x41\x89\xf4|\xe9\xb8\x00\x00\x00\x90|;' /System/Library/Extensions/AppleRTC.kext/Contents/MacOS/AppleRTC

 

Verify your source file before patching: 

md5 AppleRTC 

MD5 (AppleRTC) = 4b1d28ac48a2a7b35ed6b2034e0fd912

 

This patch completely disables all CMOS writes from AppleRTC

This patch worked for me on my Dell Inspiron 530 running 10.9. The one that [url=&quot;http://www.insanelymac.com/forum/topic/279450-why-insanelymac-does-not-support-tonymacx86/&quot;]#####[/url] 6 installed does not work for me - after restart, the cmos is corrupt (even after shutdown - sometimes).

But after 4 restarts & shutdowns, all seems OK.

Thx.

Share this post


Link to post
Share on other sites

post-1145065-0-41558700-1392377375_thumb.png

 

Friends. I did a "dump" of the RTC, the Eurotherm DarwinDumper. Can you tell me, why he reported "bugs" in the CMOS reset? 
 
There may be errors in my system after the "sleep"?

Share this post


Link to post
Share on other sites

 can some body  help me and patch my rtc kext its failing   some times it goes to the wheel to restart  other times just  resets my cmos right away  but prob is its causing a cmos reset n i have the patch kext installed  

Share this post


Link to post
Share on other sites

Just apply the patch above (which i mention in prev comment). You will no longer have RTC/cmos errors. Verify md5 before patching.

Share this post


Link to post
Share on other sites

Just apply the patch above (which i mention in prev comment). You will no longer have RTC/cmos errors. Verify md5 before patching.

could you specify which build. 10.9.?

Share this post


Link to post
Share on other sites

Im use the patch for ML and always after from shutdown or restart  when im starting windows my clock is 3 hrs back!  How to fix that.

 

I have windows & mac in same hdd.

Share this post


Link to post
Share on other sites
@windowsX1
joust the first time zone in mac OSX. 
then in windows. 
Even in windows add this file to the registry. 
After that restart switching between windows and mac about 3 times
to synchronize the system and voila, you are done, you will see that your time will be the same in both systems.
credits:iddpioneer

 

Corrigir_Horario_Win_Mac.zip

Share this post


Link to post
Share on other sites

Im use the patch for ML and always after from shutdown or restart  when im starting windows my clock is 3 hrs back!  How to fix that.

 

I have windows & mac in same hdd.

You may install BootCamp on Windows. (reading HFS+ partitions is a benefit)

Share this post


Link to post
Share on other sites

Hi,

I have recently updated my system to Mavericks, and now if the system sleeps the CMOS is corrupted. I realise looking through some threads here that this is pretty old news, but I had a DSDT file in Mountain Lion which I guess took care of this issue (came via a Kakewalk install), so it wasn't a problem for me. Now in Mavericks I don't have a DSDT file. (I used MyHack.) 

As I am new to this topic any guidance is welcome:

 

1. Can I use an off-the-shelf DSDT.aml file for my motherboard or do I need to compile one myself somehow? If so, how?

2. Once I have a DSDT.aml file, will adding the patch above solve my problem?

 

My system: a venerable GA-EX58-UD5, 2.7GHz Intel Core i7, GeForce 9800 GT 512MB, 6GB Corsair memory. Still going strong after a number of years.

Extras installed: just what came with MyHack, namely:

 

AppleACPIPS2Nub.kext

ApplePS2Controller.kext

FakeSMC.kext

lspcidrv.kext

NullCPUPowerManagement.kext

Patched_10.7_AppleRTC.kext

 

As a side note, my boot up time since upgrading is very long - about 2mins to the login screen, another long while before I can actually log in. Fine once in. Is a DSDT file likely to help with this issue?

 

Thanks.

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.



×