Contribute
Register

[Guide]Another method to fix Kernel Panic on many new BIOS(Asrock, Gigabyte)

Joined
Nov 3, 2018
Messages
310
Motherboard
ASRock B360-HDV
CPU
i5-8400
Graphics
RX 470
Mobile Phone
iOS
though this one tells why, but not recommended, because bios reset or update needs to set the variable again, for better method see post #2

So many of you may have kernel panic issue after flashing newer version bios, examples:
Asrock Z390
Z370-AORUS-Gaming-7
And i posted my DSDT method here

These fixes of course solved the issue. but i can't stop thinking what these fixes did? it turns out they either return the RTC._STA to 0x0F or just delete the whole RTC._STA code. Because these BIOS default return RTC._STA to Zero, macOS can't find RTC devices then kernel panic, what if i could change the default BIOS settings to let RTC._STA return non-zero?

1. First of all, let's see why default RTC._STA return Zero? I checked orig DSDT from Asrock B360M-HDV, BIOS v4.10, and found:

Code:
     Device (RTC)
        {
            Name (_HID, EisaId ("PNP0B00") /* AT Real-Time Clock */)  // _HID: Hardware ID
            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
            {
                IO (Decode16,
                    0x0070,             // Range Minimum
                    0x0070,             // Range Maximum
                    0x01,               // Alignment
                    0x08,               // Length
                    )
                IRQNoFlags ()
                    {8}
            })
            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                If ((STAS == One))
                {
                    Return (0x0F)
                }
                Else
                {
                    Return (Zero)
                }
            }
        }
as the if else says, it returns Zero because STAS is not One, then what is STAS? what if i can set STAS to One?

2. Finding the meaning of STAS

As i have experience of disabling hidden CFG Lock BIOS options, i decided to use the knowledge to see if i can find some hints. the trick is to use UEFITool.app to extract BIOS Set up section from downloaded BIOS ROM to a .efi file, and then use ifrextract to extract the .efi to plain txt. I'm not going to talk about this here, but there are guides out there. i then search RTC within that decoded txt, and i found:

Code:
One Of: System Time and Alarm Source, VarStoreInfo (VarOffset/VarName): 0x582, VarStore: 0x1, QuestionId: 0x375, Size: 1, Min: 0x0, Max 0x1, Step: 0x0 {05 91 0A 14 0B 14 75 03 01 00 82 05 10 10 00 01 00}
0x3E2CF             One Of Option: ACPI Time and Alarm Device, Value (8 bit): 0x0 (default) {09 07 0C 14 30 00 00}
0x3E2D6             One Of Option: Legacy RTC, Value (8 bit): 0x1 {09 07 0D 14 00 00 01}
0x3E2DD         End One Of {29 02}
now i see, the STAS in DSDT stands for System Time and Alarm Source, it's defaul value is 0x0, if we go back to see the RTC DSDT, it says if STAT==one, return 0x0F, else return Zero, but the BIOS default STAS==0x0 (Zero), so default RTC_STA return Zero, that means the RTC device is disabled by default. if i don't want to patch DSDT, i have to change STAS default value to 0x1 (One)

3. Change the STAS to 0x1

Now things become easier, of cause the System Time and Alarm Source option is hidden in BIOS settings, just like CFG LOCK on some of motherboards. but the trick is the same, the modified grub shell can do the same thing. as we see from above the offset of System Time and Alarm Source is 0x582 (every motherboard, BIOS version is different) for my motherboard BIOS v4.1, all i have to do is to boot grub shell from USB stick, and run:

setup_var 0x582 0x1

4. Remove RTC._STA DSDT patch

Now it is safe to remove or disable the DSDT patch. By the way with this method, i also made the AWAC device gone.

5. Reference:
How to change hidden CFG Lock setting
 
Last edited:
Joined
Nov 3, 2018
Messages
310
Motherboard
ASRock B360-HDV
CPU
i5-8400
Graphics
RX 470
Mobile Phone
iOS
Cleaner SSDT method to set STAS=one

 
Last edited:
Top