AppleSMCRTC.kext panics…

Are you getting panics with some text about AppleSMCRTC.kext (adds support for boot argument rtc=0x03) and some dependancy failures for AppleSMC.kext (supports boot arguments smc= and smcdebug=0xf0) and AppleACPIPlatform.kext? Well. Someone asked me to look into this, and I did. Let’s start by showing you the ACPI device that Apple started to use (taken from the DSDT from the iMac19,1):

Device (ARTC)
{
	Name (_HID, "ACPI000E")
	Method (_GCP, 0, NotSerialized) // Get Capability (AppleACPIPlatform.kext)
	{
		// Bit [0] - 1 = AC wake implemented, 0 = not supported
		// Bit [1] - 1 = DC wake implemented, 0 = not supported
		// Bit [2] - 1 = Get/Set real time features implemented, 0 = not supported
		// Bit [3] - 1 = Real time accuracy in milliseconds, 0 = Real time accuracy in seconds
		// Bit [4] - 1 = _GWS returns correct values for wakes from S4/S5 caused by timer. 0 = not supported
		// Bit [5] to Bit [31] are reserved and must be 0.
		Return (0x05)
	}
	
	Method (_GRT, 0, Serialized) // Get Real Time (AppleACPIPlatform.kext)
	{
		Name (BUFF, Buffer (0x10) {})
		Store (^^EC.YRLB, Index (BUFF, Zero))
		Store (^^EC.YRMB, Index (BUFF, One))
		Store (^^EC.MNTH, Index (BUFF, 0x02))
		Store (^^EC.DAYB, Index (BUFF, 0x03))
		Store (^^EC.HOUR, Index (BUFF, 0x04))
		Store (^^EC.MINT, Index (BUFF, 0x05))
		Store (^^EC.SECD, Index (BUFF, 0x06))
		Store (^^EC.PAD0, Index (BUFF, 0x07))
		Store (^^EC.MSLB, Index (BUFF, 0x08))
		Store (^^EC.MSMB, Index (BUFF, 0x09))
		Store (^^EC.TZLB, Index (BUFF, 0x0A))
		Store (^^EC.TZMB, Index (BUFF, 0x0B))
		Store (^^EC.DAYL, Index (BUFF, 0x0C))
		Store (^^EC.PAD1, Index (BUFF, 0x0D))
		Store (^^EC.PAD2, Index (BUFF, 0x0E))
		Store (^^EC.PAD3, Index (BUFF, 0x0F))
		Return (BUFF)
	}
	
	Method (_SRT, 1, Serialized) // Set Real Time (AppleACPIPlatform.kext)
	{
		Store (Index (Arg0, Zero), ^^EC.YRLB)
		Store (Index (Arg0, One), ^^EC.YRMB)
		Store (Index (Arg0, 0x02), ^^EC.MNTH)
		Store (Index (Arg0, 0x03), ^^EC.DAYB)
		Store (Index (Arg0, 0x04), ^^EC.HOUR)
		Store (Index (Arg0, 0x05), ^^EC.MINT)
		Store (Index (Arg0, 0x06), ^^EC.SECD)
		Store (Index (Arg0, 0x08), ^^EC.MSLB)
		Store (Index (Arg0, 0x09), ^^EC.MSMB)
		Store (Index (Arg0, 0x0A), ^^EC.TZLB)
		Store (Index (Arg0, 0x0B), ^^EC.TZMB)
		Store (Index (Arg0, 0x0C), ^^EC.DAYL)
		Return (Zero)
	}
	
	Method (_STV, 2, Serialized) // Set Timer Value (AppleSMCRTC.kext)
	{
		Store (And (Arg1, 0xFF), ^^EC.ALR0)
		Store (And (ShiftRight (Arg1, 0x08), 0xFF), ^^EC.ALR1)
		Store (And (ShiftRight (Arg1, 0x10), 0xFF), ^^EC.ALR2)
		Store (And (ShiftRight (Arg1, 0x18), 0xFF), ^^EC.ALR3)
		Return (Zero)
	}
	
	Method (_CWS, 1, Serialized) // Clear Wake alarm status (AppleSMCRTC.kext)
	{
		Store (Zero, ^^EC.TMRF)
		Store (Zero, ^^EC.TMRW)
		Return (Zero)
	}
}

Our hacks do not have such device and thus AppleSMCRTC.kext will fail. What I did notice is that there was no problem when I used the prelinkedkernel, but when I tried to boot without a prelinkedkernel, and let RevoBoot load the individual kexts, then it failed to boot. A real Mac boots with the prelinkedkernel. Not by loading individual kexts. That explains why it works on a Mac.

The next thing I did was to run:

LZVN -d /System/Library/Prelinkedkernels/prelinkedkernel list

Low and behold. AppleSMC.kext is included. This despite the fact that the OSBundleRequired is set to “Safe Boot“. Hmm. Interesting.

Note: IOBluetoothHostControllerTransport.kext, IOBluetoothHostControllerUSBTransport.kext and IOBluetoothFamily.kext are three other kexts that are included in the prelinkedkernel – with OSBundleRequired set to “Safe Boot”.

This breaks the load of individual kexts, because then it won’t get loaded. Not if you boot without a prelinkedkernel. Which is what I do most of the time. Anyway. Adding a few lines of new code to RevoBoot worked around this problem (for me).

In short. It turned out that DP-2 was changed and as a result AppleSMC.kext no longer loads – on certain computers – due to the fact that the OSBundleRequired is set to “Safe Boot“. Changing it into “Root” solved the problem. As a workaround. Forcing it to load from the boot loader solved it – with the OSBundleRequired set to “Safe Boot”.

Note: The OSBundleRequired this did not change, but it no longer loads in High Sierra.

There may be other reasons that AppleSMC.kext isn’t loading, but you should try the work around. Or in case Chameleon or Clover – whichever boot loader you use – can force a kext to load. Then use that. You may also check your ACPI tabled for

Name (_HID, "ACPI000E")

because if you have that set on a different kind of device, which shouldn’t be the case, then that driver will try to load for the wrong kind of device 😉

Edit: The exact cause of the error will (hopefully) be documented later. My first thought is that the kextd (daemon) has changed, and now no longer loads the kexts that we need for our hardware. Apple may also have changed kextcache (command line tool) to make it include all kexts that are required, but I have yet to check this myself.

I also added a tiny SSDT, to inject the missing ACPI device, and used boot arguments rtc=0x03 and smcdebug=0xf0 to find the output of the kexts in the log.

Advertisements

6 thoughts on “AppleSMCRTC.kext panics…

  1. AppleSMCRTC.kext loads with this SMCKey “CLKO”
    and there is a new key for SMC generation “RGEN”
    do you now how we can get IOMode MMIO instead of PMIO?

    thx for your nice work 🙂

    • Thanks. Not here. Did you get these in your log with the FakeSMC debug option or the smcdebug one?

      About using MMIO. By replacing the smcReadMMIO and underlaying functions in a Lilu style extension?

  2. here is kernel log
    kernel: (AppleSMCRTC) PMU monotonic clock rate is 1478885632
    kernel: (AppleSMCRTC) PMU monotonic clock rate is 1478885632
    kernel: (AppleSMCRTC) Using ASynchornous PMU monotonic clock read
    kernel: (AppleSMCRTC) SMCRTC: setPowerState 1
    kernel: (AppleSMCRTC) Cleared alarm successfully
    kernel: (AppleACPIPlatform) Matched against SMCRTC
    kernel: (AppleRTC) Setting SMC based RTC to true. Disabling wakes thru AppleRTC
    kernel: (AppleRTC) Setting SMC based RTC to true. Disabling wakes thru AppleRTC

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s