CMOS Resets on Restarts after Sleep and Wake in 10.7 (Lion)
#301
Posted 06 July 2011 - 02:13 PM
GA-EP45-DS3R
Core 2 Quad Q6600
NVidia 8800GT 512MB
#302
Posted 06 July 2011 - 02:25 PM
Sleep problem topic here: WakeUp the Lion from Sleep
Javimdq, on Jul 6 2011, 01:05 PM, said:
Yes, where to get it?
stevekicks, on Jul 6 2011, 02:13 PM, said:
Simply had to run the patch from this thread and enable "Startup automatically after a power failure" in energy settings.
Beautiful!
Not for Gigabyte Z68X Mobo!
#303
Posted 06 July 2011 - 03:12 PM
Taruga, on Jul 6 2011, 10:48 AM, said:
Attached is my dsdt for the P5QC
P5Q Deluxe here. My RTC Section looks same except device names.
Device (RTC0)
{
Name (_HID, EisaId ("PNP0B00"))
Name (_CRS, ResourceTemplate ()
{
IO (Decode16,
0x0070, // Range Minimum
0x0070, // Range Maximum
0x00, // Alignment
0x02, // Length
)
})
}
AutoSleep, S3 Sleep also Wake works OOB but under 10.7 GM CMOS Reset when wake by keyboard!!! Its very important coz when i wake my HA by power button all is okay. I mean system Wakes at once without CMOS Reset.
#304
Posted 06 July 2011 - 03:18 PM
#305
Posted 06 July 2011 - 03:27 PM
#306
Posted 06 July 2011 - 05:15 PM
In 10.6, checksuming occurs via the tracepoint handler code, which is only enabled if the RTC portion of the CMOS is 256 bytes or longer. So the DSDT change where you set the RTC device's length to 2 (128 bytes) avoids the problem.
In 10.7, the tracepoint code is now *also* triggered by AppleRTC::setAlarmEnable(), even when the RTC CMOS is just 128 bytes, so the problem persists.
The patch makes skipping of the call to AppleRTC::updateChecksum() from the tracepoint code unconditional. Since the checksuming code is doing nothing else, this appears to be a safe patch.
There's no obvious value (such as in the dsdt) to set to cause the checksum to be skipped without patching the rtcRecordTracePoint() call, as was done by the patch.
On the other hand, the tracepoints are only happening when AppleRTC::setAlarmEnable() is called with certain magic values and I'm not seeing where those calls are being made. Presumably these are triggered by the PM code in the kernel and wouldn't be safe to alter.
#307
Posted 06 July 2011 - 06:45 PM
bcc9, on Jul 6 2011, 06:15 PM, said:
#308
Posted 06 July 2011 - 10:13 PM
bcc9, on Jul 6 2011, 05:15 PM, said:
In 10.6, checksuming occurs via the tracepoint handler code, which is only enabled if the RTC portion of the CMOS is 256 bytes or longer. So the DSDT change where you set the RTC device's length to 2 (128 bytes) avoids the problem.
In 10.7, the tracepoint code is now *also* triggered by AppleRTC::setAlarmEnable(), even when the RTC CMOS is just 128 bytes, so the problem persists.
The patch makes skipping of the call to AppleRTC::updateChecksum() from the tracepoint code unconditional. Since the checksuming code is doing nothing else, this appears to be a safe patch.
There's no obvious value (such as in the dsdt) to set to cause the checksum to be skipped without patching the rtcRecordTracePoint() call, as was done by the patch.
On the other hand, the tracepoints are only happening when AppleRTC::setAlarmEnable() is called with certain magic values and I'm not seeing where those calls are being made. Presumably these are triggered by the PM code in the kernel and wouldn't be safe to alter.
In case you missed it: http://www.insanelym...p...t&p=1701654
The interesting questions IMHO are: What does recordTracePoint actually do, and why would it need to recalculate the CMOS checksum? Why does it look like it's writing to offset 58,59 when it's actually writing to 2e, 2f? Why is the result of updateChecksum off by one and is that true in general?
It simply doesn't make any sense to me.
#309
Posted 06 July 2011 - 10:53 PM
tseug, on Jul 6 2011, 03:13 PM, said:
So I've looked into the underlying code and now I think I understand
What does recordTracePoint actually do
Recordtracepoint is recording trace information about hibernate/suspend, such as the reason for suspending, and the thread that initiated it.
why would it need to recalculate the CMOS checksum?
Since the trace information is written to CMOS, apple wants to update their checksum after writing the trace information.
Why does it look like it's writing to offset 58,59 when it's actually writing to 2e, 2f?
? You said in post #212 that it is writing offsets 58&59.
Why is the result of updateChecksum off by one
Where do you see it being off by 1?
blackosx, on Jul 6 2011, 11:45 AM, said:
So maybe a possible area for further research? though taking heed of your last note, better to just leave alone.
I tried adding:
OperationRegion(CMS1, SystemCMOS, 0x80, 0x80)
to Device RTC0 in my dsdt but it made no difference.
#310
Posted 06 July 2011 - 11:49 PM
Javimdq, on Jul 6 2011, 07:05 AM, said:
for On board network card
RealtekR1000Lion.kext.zip 65.78K
38 downloads
#311
Posted 07 July 2011 - 04:49 AM
I confirm that rtc patch prevents clearbios after sleep for P35 DS4 and EP45DS3 ( don't know if it's normal & important but had to use sudo -s in shell before applying patch)
out of topic : i didn't use like karaakeha 1 realtekR1000Lion.kext but IONetworkingFamily.kext from SL for ethernet
out of topic 2 : for auto-sleep I used RIP2 (added in system preference, users and groups)
Thank you to authors of this found
fred
#312
Posted 07 July 2011 - 07:04 AM
bcc9, on Jul 6 2011, 11:53 PM, said:
So I've looked into the underlying code and now I think I understand
Great! Then you can explain it to me
Quote
Recordtracepoint is recording trace information about hibernate/suspend, such as the reason for suspending, and the thread that initiated it.
OK.
Quote
Since the trace information is written to CMOS, apple wants to update their checksum after writing the trace information.
Although that would seem to make sense the overwritten checksum (in offset 2e, 2f) only corresponds to a subset of the CMOS. None of the values in that subset has anything to do with hibernate/sleep information. It would be a rather exotic choice to write nonstandard information in this area just for the hell of it, and indeed the values are the same before and after sleep. The patch only stops AppleRTC from updating the checksum so if something was actually written in the area there ought to be a checksum error. Since there isn't and DumpCMOS isn't showing any differences in this area it seems unlikely.
Quote
? You said in post #212 that it is writing offsets 58&59.
It is. It is also writing to 2e, 2f although there is no reference to 2e, 2f in the code. In all the other cases I could find the value in ESI seemed to correspond with the offset, but here it doesn't.
Quote
Where do you see it being off by 1?
I used DumpCMOS from #212 and it showed the checksum in 2e, 2f to be off by one in 2e. 2f was fine though. Blackosx then did the same and got the same result. In other words, the checksum is 0x100 less than it ought to be.
#313
Posted 07 July 2011 - 04:26 PM
#314
Posted 07 July 2011 - 04:43 PM
bcc9, on Jul 6 2011, 11:53 PM, said:
I tried adding:
OperationRegion(CMS1, SystemCMOS, 0x80, 0x80)
to Device RTC0 in my dsdt but it made no difference.
Looking at the predefined Operation Region types in ACIPspec I see there is one for CMOS, so in the case of your example would that translate to?:
OperationRegion(CMS1, CMOS, 0x80, 0x80)
EDIT:
Looking further at the ACPIspec, they show an example for an RTC device with ID of PNP0B00:
Device (RTC)
{
Name (_HID, EisaId ("PNP0B00"))
Name (_FIX, Package(1) { EisaId ("PNP0B00") }
Name (_CRS, ResourceTemplate () {
IO (Decode16, 0x0070, 0x0070, 0x00, 0x02, )
}
OperationRegion (CMS1, CMOS, 0, 0x40)
Field(CMS1,ByteAcc,NoLock,Preserve)
{
AccessAs(ByteAcc,0),
CM00, 8,
,256,
CM01, 8,
CM02, 16,
,216,
CM03, 8
}
}
I know cartri suggest using _FIX previously, so maybe the rest of the OperationRegion part above is something that I maybe he could throw more light on? Like could something like that work?
#315
Posted 07 July 2011 - 05:07 PM
another thing. alignment. why 00 and 02 . in mbp is 01 .. in my laptop was 10.. i changed to 01.
my after sleep reboots to slow bios post i believe is related to drive detection or DMI reset but maybe it is related to this RTC
(not sure how to debug this issue)
#316
Posted 07 July 2011 - 07:54 PM
tseug, on Jul 7 2011, 04:04 AM, said:
OK.
Although that would seem to make sense the overwritten checksum (in offset 2e, 2f) only corresponds to a subset of the CMOS. None of the values in that subset has anything to do with hibernate/sleep information. It would be a rather exotic choice to write nonstandard information in this area just for the hell of it, and indeed the values are the same before and after sleep. The patch only stops AppleRTC from updating the checksum so if something was actually written in the area there ought to be a checksum error. Since there isn't and DumpCMOS isn't showing any differences in this area it seems unlikely.
It is. It is also writing to 2e, 2f although there is no reference to 2e, 2f in the code. In all the other cases I could find the value in ESI seemed to correspond with the offset, but here it doesn't.
I used DumpCMOS from #212 and it showed the checksum in 2e, 2f to be off by one in 2e. 2f was fine though. Blackosx then did the same and got the same result. In other words, the checksum is 0x100 less than it ought to be.
You mobo has an ESI defined? Gigabyte don't define it usually, i use a customized bios to do that, but is for me cosmetic, a device tree organization, nothing else.
blackosx, on Jul 7 2011, 01:43 PM, said:
Looking at the predefined Operation Region types in ACIPspec I see there is one for CMOS, so in the case of your example would that translate to?:
OperationRegion(CMS1, CMOS, 0x80, 0x80)
EDIT:
Looking further at the ACPIspec, they show an example for an RTC device with ID of PNP0B00:
Device (RTC)
{
Name (_HID, EisaId ("PNP0B00"))
Name (_FIX_ Package(1) { EisaId ("PNP0B00") }
Name (_CRS, ResourceTemplate () {
IO (Decode16, 0x0070, 0x0070, 0x00, 0x02, )
}
OperationRegion (CMS1, CMOS, 0, 0x40)
Field(CMS1,ByteAcc,NoLock,Preserve)
{
AccessAs(ByteAcc,0),
CM00, 8,
,256,
CM01, 8,
CM02, 16,
,216,
CM03, 8
}
}
CMOS has been replaced by SystemCMOS (like in the code i did input earlier) in the latest versions of intel and Microsoft ACPI to avoid legacy related problems, it will depend on the version of your compiler if it will work or not, in fact CMOS has been used as a device or operation region in many mobs, thats why they changed.
LatinMcG, on Jul 7 2011, 02:07 PM, said:
another thing. alignment. why 00 and 02 . in mbp is 01 .. in my laptop was 10.. i changed to 01.
my after sleep reboots to slow bios post i believe is related to drive detection or DMI reset but maybe it is related to this RTC
(not sure how to debug this issue)
----
Sorry again for the absence, only now i got dp4 running fine (i don't sleep anyway, neither my computer, so no problem if i still have the sleep bug) because of the led cinema display, and updating to GM is unpredictable... my installation is a mess right now, i have been checking the topic trough the iPhone mails i receive when someone posts.
It is interesting on this that we have SystemIO 0x74 defined in a pnp0c02 device (unfortunately gigabyte has many 0c02 devices, each one with a unique ID to differ) as something else, this can be other part of the cmos.
It is quite normal that the RTC (which is just a part of the CMOS, not it all) marks it's status, what is strange is doing the checksum change as Tseug showed with his kext. It is notable that our rtc has 2 different options of length, using 128 or 256bytes (length 2 or 4, being each "1" 64byte, ICH10 RTC is always organized in one or 2 banks of 128Bytes, first 64 for read last for write, like tseug showed us in the ports 70/71 for those using length 2) and each with or without the IRQ8.
Setting IRQ8 activates the STS bit.
I know i sound confuse, sorry its hard to organize technical ideas in English for me (my language has the adjectives after the substantives as so i get a little confused)
For reference, our RTC (ICH10) uses Motorola MC146818A-compatible rtc with 256 bytes of battery-backed RAM, it will be configured in 2 modes single (128B) or dual (256B) bank, with or without STS support (which is set by IRQ8ing it in the DSDT). It is inside the ICH10 and stores info about the clock and at what time power management events happened, resyncing the clock when the system wakes, or for supporting timed execution of some stuff, like when you set auto-sleep or auto-wake: the RTC is the responsible to know what time is it in UTC to wake your computer for instance.
As so, we cannot just dump the RTC full banks (256Bytes) and write it later as it was, cause time has changed and this would desync our sleep. But, we do have a RTC register in ICH10 spreadsheet that tells us:
10.1.73 RC—RTC Configuration Register Offset Address: 3400–3403h Attribute: R/W, R/WLO Default Value: 00000000h Size: 32-bit Bit Description 31:5 Reserved 4 Upper 128 Byte Lock (UL) — R/WLO. 0 = Bytes not locked. 1 = Bytes 38h-3Fh in the upper 128-byte bank of RTC RAM are locked and cannot be accessed. Writes will be dropped and reads will not return any ensured data. Bit reset on system reset. 3 Lower 128 Byte Lock (LL) — R/WLO. 0 = Bytes not locked. 1 = Bytes 38h-3Fh in the lower 128-byte bank of RTC RAM are locked and cannot be accessed. Writes will be dropped and reads will not return any ensured data. Bit reset on system reset. 2 Upper 128 Byte Enable (UE) — R/W. 0 = Bytes locked. 1 = The upper 128-byte bank of RTC RAM can be accessed. 1:0 Reserved
With that we could lock the RTC info for the OS, what could or solve our problem or really make the system unbootable.
I know i did not help a lot, besides interested in the subject, i can't test it on GM as i am using a mix of video drivers to make my gpu work correctly with lion's opengl3 x3000 kext and the miniDP, and bc of this I have no wake at all, even if everything were fine with my RTC wake
#317
Posted 07 July 2011 - 08:13 PM
cartri, on Jul 7 2011, 07:54 PM, said:
No, I meant the ESI register (Extended Source Index). If you look at the code in AppleRTC you'll notice that it usually corresponds to a reasonable offset value in the current context. It seems to be a reasonable assumption that it holds the CMOS offset value. That assumption breaks down when looking at the updateChecksum but it seems told hold otherwise which seems significant.
The question is whether updateChecksum is supposed to update 2e, 2f and does it incorrectly or if something causes the function to write in an area it shouldn't be writing in. The latter seems the most probable since there shouldn't be any reason to update that particurlar checksum (the clock stuff resides in 0x00-0x10 which isn't part of the checksum).
Is it possible to debug AppleRTC while it's reacting to a sleep event?
#318
Posted 07 July 2011 - 09:39 PM
tseug, on Jul 7 2011, 05:13 PM, said:
The question is whether updateChecksum is supposed to update 2e, 2f and does it incorrectly or if something causes the function to write in an area it shouldn't be writing in. The latter seems the most probable since there shouldn't be any reason to update that particurlar checksum (the clock stuff resides in 0x00-0x10 which isn't part of the checksum).
Is it possible to debug AppleRTC while it's reacting to a sleep event?
If yes, it is interesting to notice that gigabyte defines it under its LDRC (SYSR i guess, renamed long ago is the UID1 0c02 device) going from 74 with length C, finishing in 80 like our cmos. All pair registers from 70 till 76 are index and odd until 77 are targets, being the last ones extended ram registers...
Sorry, I am not really understanding what you are talking about....
BTW, its possible to update your Kext (edit: dictionary keeps renaming my "kexts" to "nexts") to make it dump all ports, one by one from 70 till 77?
Are you based on bundled ichs in the north bridge (like p55) or separate ones like ich10?
#319
Posted 07 July 2011 - 11:53 PM
tseug, on Jul 7 2011, 12:04 AM, said:
Also I've found that your patch doesn't work on my laptop (nvidia mcp79 chipset) so apparently I don't yet understand enough
tseug, on Jul 7 2011, 12:04 AM, said:
blackosx, on Jul 7 2011, 09:43 AM, said:
OperationRegion(CMS1, CMOS, 0x80, 0x80)
cartri, on Jul 7 2011, 02:39 PM, said:
tseug, on Jul 7 2011, 12:04 AM, said:
tseug, on Jul 7 2011, 12:04 AM, said:
It's not exotic to record information about why sleep&wake are occuring. sleep/wake problems are very difficult to debug otherwise (I dread trying to debug such problems under windows).
#320
Posted 08 July 2011 - 01:18 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users



Sign In
Create Account








