xCuri0 / ReBarUEFI

Resizable BAR for (almost) any UEFI system
MIT License
1.29k stars 57 forks source link

Using patches provided with Rebar UEFI module prevents BIOS from functioning on ASRock Z77 OC Formula #111

Open pntsrgd opened 4 months ago

pntsrgd commented 4 months ago

System

Description

DSDT patching has been applied as per wiki.   The following patches appear to prevent this motherboard from booting: PciHostBridge | Replace 16GB MMIO region with complete use of physical address space (Ivy Bridge). PciHostBridge | Remove 4GB limit for PciRootBridgeIo.Mem

The following patches do not appear to cause issues: PciHostBridge | Remove <4GB BAR size limit in SubmitResources (Ivy Bridge) PciBus | Remove <16GB BAR size limit (Ivy Bridge/Haswell) Runtime | Remove 4GB limit for CpuIo2

If I do not patch UEFI, I can get Rebar to work up to 2 GB as expected. Applying PciHostBridge | Replace 16GB MMIO region with complete use of physical address space (Ivy Bridge). with DSDT will POST, enter Windows, and allow RebarState to be set. Attempting to enter BIOS configuration with this patch applied, however, results in a hard lock of the system. The system freezes with "A2" on the screen. PciHostBridge | Remove 4GB limit for PciRootBridgeIo.Mem results in a failed POST if PciHostBridge | Replace 16GB MMIO region with complete use of physical address space (Ivy Bridge) is not applied.

Windows does not show "PCI Bus" under "Large Memory." I saw that this was an issue seen on Haswell systems and wondered if I may need a similar patch.

GPU-Z does show ReBAR and Above 4G Decoding enabled.

This does not appear to be a case of losing display during POST - the BIOS initially shows up and just hangs if I attempt to enter configuration. Trying to use the IGP doesn't fix the problem.

It appears that the patches only cause this failure after turning on Above 4G Decoding. While Above 4G Decoding is disabled, BIOS setup can be entered without issue. I've attached my modification that includes only changes to option visibility (to display Above 4G Decoding and CSM options) and the procedures outlines in the Wiki. DSDT has been modified. All files were injected with MMTool to prevent any pad file issues.

rebarZ77OCF2.zip

DSDT:

                    CreateQWordField (BUF0, \_SB.PCI0._Y0F._LEN, M2LN)  // _LEN: Length
                    CreateQWordField (BUF0, \_SB.PCI0._Y0F._MIN, M2MN)  // _MIN: Minimum Base Address
                    CreateQWordField (BUF0, \_SB.PCI0._Y0F._MAX, M2MX)  // _MAX: Maximum Base Address
                    M2MX = 0xFFFFFFFFF
                    If ((TUUD >= 0x1000))
                    {
                        M2MN = (TUUD << 0x14)
                    }
                    Else
                    {
                        M2MN = 0x0000000100000000
                    }

                    M2LN = (M2MX - M2MN) + One
                }

                Return (BUF0) /* \_SB_.PCI0.BUF0 */
pntsrgd commented 4 months ago

Looking further into it, it looks like "PCI Express Root Complex" and "PCI Bus" may be the same device. Furthermore, the patching actually seems to work - setting any value (including 32) works without issue, but attempting to enter BIOS setup fails when patches are applied.

While this allows me to use whatever BAR I want, it does prevent any access to BIOS to load settings after flashing the patched image. Once the patch is applied, attempting to enter BIOS setup is nonfunctional.

ReBAR works once everything is patched, but I can't access BIOS.

Additionally, it appears that the boot option select menu loads fine when patched. It attempting to access UEFI setup from this menu also results in a hard lock. The hard lock shows a cursor and "A9" on the lower right of the screen.