-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hibernation Fix #44
Comments
Small update:
|
S3 sleep is working well for me (hibernate = 3). |
@Ranguvar Could you try setting hibernate mode to 25 and see what happens on your machine? |
Hi @tylernguyen I've been using your guide for 1 day, just finished on my X1C and noticed that the computer didn't sleep on LID closed or Apple --> Sleep as well. Because when I open the lid, it almost screened up instantly and the plate is warm, I also lost 25% in 1hr of sleep and LED light won't blink but constantly on. That was during the hibernation = 0. |
Leave standby 0 or 1? |
With hibernatremode on 25 and standby on 1, I left my laptop alone. I had an error display, 0251: System CMOS Checksum bad - Default configuration used. macOS did then fail to boot once, but I don't have the log. It is working again now. |
With hibernatemode on 25 and standby on 0, it seems I got the normal sleep I did with hibernate mode on 3? |
@duylenfq You need to turn Power Nap off. I'll update this in the 5_README-other so others can see.
@Ranguvar Can you do an extended test and confirm power drainage with hibernatenmode=25? |
hi @tylernguyen I didn't have Power nap enabled, it was disabled from day 1 |
Make sure you don't have powernap enabled for the power adapter either. Also, how are you using intel wifi? which kext are you using? What's your machine model? In addition, what's your bios settings? Is wake-on-lan disabled? Are there any USB devices connected during sleep? Please check Btw, Hackintool is not good for mapping USB ports, it uses an outdated version of USBMap. It's better for you just to use USBMap directly instead. |
@tylernguyen my model is exactly as yours with identical specs, except my wifi card is not replaced yet (waiting for DW1560 to be shipped. Some details below: I did a double check AHCI mapping and I have the same rooting as yours, |
I just had the machine stay sleeping and it required a reboot when trying to resume, using standby 0 and hibernatemode 25. I did also have Power Nap on, as I was plugged into an AC adapter this time, though. Not sure how to run an extended test other than recording battery percentages before/after sleep of say 1hr? So far hibernatemode 25 is either as good as or better than 3 with standby 0 and Power Nap off, I can't be sure yet. |
@duylenfq from the first output, HID activity is usually an issue from USB mapping, what power injection did you use? Please clear NVRAM and check if it works. Also, please upload a zip of your EFI with SMBIOS info removed. I will inspect your EFI and try to guess what's wrong. But so, I would recommend you do a fresh install and test sleep before installing any 3rd-party apps or tools. Sleep was never an issue with this project, I suspect it maybe caused by the Intel WiFi kext, since it is really the only thing different from our two machines (I recommend against intel wifi currently anyway because it's very buggy and incomplete.) @Ranguvar Be sure to record your For now, I suggest you keep standby constant and only change hibernatemode when testing. |
hi @tylernguyen I have some updates:
--> The sleep problem is not as annoying as [HDMI port not working at all + dark screen on mistaken combo key to screenshot] This drives me crazy when I need to work and present a screen. Spent more than 1 week on this now :( if you could help I would gladly donate for your great work thus far. |
@duylenfq
Please read my ACPI doc: https://github.com/tylernguyen/x1c6-hackintosh/blob/master/docs/4_README-ACPIpatching.md Specifically, please pay attention to the
But overall, please take a look at all my comments and clean your setup. It seems very messy. It seems like this |
Thanks @tylernguyen for the response and check. Due to the instability of the OS so far, mostly with sleep and HDMI totally unusable I set it aside (for now) and back to Windows to be able to work and collaborate with my colleagues. I did a check as you said + another attempt on using your exact folders (except changed platform info, CPU friend, and USBinjectall). So far it only costs time and effort, although I could use the machine just with the internal display, without HDMI it's a deal-breaker for me though..... I think as of now just for my case, the OS is far less stable compared to my hack desktop, I will stick to it for awhile.... |
@tylernguyen I've briefly tried to make hibernatemode 25 work and it did - but resulted in the same CMOS-error you observed. I did it out of curiosity while beeing happy with mode 3. I think the problem we are facing is takled by the following kext, butI didn't try to debug my RTC-Banks to make it work. If you are interested: https://github.com/acidanthera/RTCMemoryFixup |
Just stumbled upon this issue which may be related: acidanthera/bugtracker#765 |
@benbender Thanks for bringing this to my attention. I will look into that issue and continue testing hibernate mode 25. |
@benbender With the fixes on that issue applied, I'm still getting CMOS error. Could you confirm that behavior? It seems that we would need to create our own exclusions after all. |
I didn't investigate yet, but plan to do so because there seems to be more functionality depending on working RTC/CMOS. The important information for me are a) there are changes from 10.15.4 onwards and b) there are new options in OC 0.5.9 to handle it. Rest is object to fiddling around. Important first question is size and correctness of our RTC-ACPI-definition. To get started, some questions to clearify: a) my RTC-Definition (stock ACPI, latest Bios) - same for you?
b) I had messages in the past that I have only 128bytes of RTC-Memory. We need to confirm if this is correct? c) I didn't find any informations about this IRQ-TIMR-RTC-patches and if they are needed or not (besides "something" with the audio-devices). Do you have any informations about the purpose of that patch and if its needed on x1c6/t480/t480s? |
@benbender
b) How would we confirm that?
If someone still has Windows, could confirm this in TIMR should be one that's related to sound, that patch is not needed as far as I know and is really for legacy hardware. RTC likely our culprit for our hibernation error. Just as we previous suspected, it is likely some conflicts with AppleRTC our own, and bad RTC regions will need to be excluded. EDIT: I'm going to try the suggested default exclusions in |
Regarding a) Fine :) b)
That one shows entries for 00-FF, so we would have full 256bytes and no need to fix here. For c) So I wouldn't try to patch until necessity is clear. Btw, where did you get the IRQ-Listing from? Regarding testing with I would try to approach like this, but don't have time because of work: acidanthera/bugtracker#765 (comment) 0x5859 might be actually the wrong values for us. |
BTW, if it's not clear: Testing should be done with a debug-build of opencore and target=67/0x43 so it writes log-files for early boot in boot.efi. rtc-blacklist will most likely be handled in boot.efi. And I would suggest to remove every other hack (ACPI, RtcMemoryFixup, boot-args, etc) around RTC-handling for testing and only try rtc-blacklist and DisableRTCChecksum. |
Source for IRQ assignments: https://www.helpwithpcs.com/upgrading/change-irq-settings.htm
The problem is that CMOS reset doesn't happen on boot, it happens on wake of hibernation. But it doesn't really create a KP panic so what logs am I even supposed to look at to see the problem? Also, this is likely the best description of our issue: EDIT: For reference, this is AppleRTC table: https://github.com/acidanthera/VirtualSMC/blob/master/Tools/rtcread/rtcread.c#L45 |
From OC-Source. So From my rtcdump:
And:
00 7D would be 58/59. I think this handles checksums on apple's software-side, but we have an additional problem in case of mode 25 hibernation where the encryption-keys for the memory-images are written to the rtc and, because of that, the rtc-checksum is b0rked at bios-level which eventually results in the bios-error at the reboot after hibernation. So we need to fix both. From HibernationFixup-Changelog:
I would assume that holding the hibernation-keys in nvram should fix the issue. So my suggestion:
|
Hello! Information is inside your firmware. I reversed DxeCmosInit module (95BF86AD-A1E0-4143-B487-004B1C2E05FA) which performs RTC initialization and various validation checks in upper-bank. It is clearly seen that operations are performed at port addresses 0x72, 0x73, which corresponds to 0x80-0xFF RTC Memory. Also there is routine which validates some values in upper bank, and return EFI_VOLUME_CORRUPTED if it is wrong, that causes to execute code which perform call to LenovoErrorProtocol (my guess) interface to spawn 251 error code with given text.
About CSM. I agree that it's not a right solution, but it gives me the vector to perform research – memory map. |
|
@savvamitrofanov Very interesting stuff and way above my knowledge. Will try to find time to test tomorrow. Thank you very much and keep us informed of any other findings/improvements you may make! |
The above driver helped with my X1 Extreme's black screen, though it reboots shortly after displaying the lock screen so I have some further debugging to do I think. Thanks! Edit: Needed to enable DiscardHibernateMap and now it's working |
Can confirm. Same result as for @1Revenger1. Thanks @savvamitrofanov! 👍 |
This is great news. Thank you @savvamitrofanov ! |
Do not push the driver to the repository. It was meant to be a dirty test not ready for producfion. Use OpenCore 0.6.2 that has this functionality builtin via |
@vit9696 That's awesome! I'll update the repo next Monday when 0.6.2 comes out then. Thank you for your work. |
@tylernguyen Jfyi it's already implemented in https://github.com/EETagent/T480-OpenCore-Hackintosh and works fine. But from my point of view it shouldn't be the default because it's not the default on genuine Macbooks and takes substantially longer to wake. But it's a "nice to have" in case you are suffering from battery drain on sleep and for completeness. |
The default for a macbook pro afaik is Sleepmode 3 (looking at |
Follow up on my previous testing - so I was having an issue where if I rebooted before attempting to go into hibernate then waking up, I would see the login screen before it abruptly reset due to some error. Turns out it was possibly RebuildAppleMemoryMap causing issues. Disabling that + DiscardHibernateMap, and then enabling EnableWriteUnprotector fixed this. |
Hibernation mode 25 now supported on the repo as of 985d3a2. Enable it via the command line if that is your preferred mode. Thank you @benbender @1Revenger1 @savvamitrofanov @vit9696 |
Hi folks! I am currently using Tyler's EFI from before 2022-8-24 and after 2022-4-20, with OC 0.8.2. The date of the entry in the changelog is not there anymore. Not sure why! I was able to get everything working but noticed that I was encountering the 0251 CMOS bad checksum error when turning on the computer from hibernation using hibernatemode 25. My BIOS config is not reset when this happens, but it is annoying to encounter that (and the beeping) every time I wake from hibernate. I did not understand why this was happening (especially after reading this thread) until I noticed in the changelog that "RTCMemoryFixup.kext" was removed on 2022-2-21. Out of curiosity, I added that kext back in the Kexts folder and config.plist, and set rtcfx_exclude=80-AB in my boot-args (per one of savvamitrofanov's previous comments.) After applying the change and rebooting twice (just in case), I no longer see the error. It has only been a day and I have only tried this about 6 times, so I'll be testing this long term. Thought I would share this for anyone who might still be encountering this issue. |
Sorry. I was intending to update this fix with one that doesn't depend on I'll double check the issue in the coming days and get back to you. |
@tylernguyen no worries! Just wanted to share the solution if anyone else encountered it. I appreciate you replying and wanted to express gratitude to you for sharing your EFI for the x1c6! |
Hi, Just wanted to share another fix for the CMOS checksum error which is to simply remove the "DxeCmosInit" (thanks @savvamitrofanov for the info) module from the UEFI Bios (with UEFITool for ex.) then flash it back (you'll need a CH341A programmer). Then no more complains about CMOS at boot. Regards! |
Currently. it is recommended to disable hibernation to avoid problems. However, with all the time suddenly on my hand. It seems about time to try and figure out hibernation mode 25 on x1c6-hackintosh.
The biggest benefit from hibernation mode 25 would be saving power for users to who often put their x1c6 to sleep for semi-long periods of time, like me.
I hope that hibernation mode 25 will work. Even if not, I want to be get to the end of this issue.
Updates soon in the coming two weeks. Meanwhile, if anyone knows anything, feel free to chime in.
The text was updated successfully, but these errors were encountered: