[Request] Above 4G decoding for AsRock z97 Extreme 9 and Asus P8P67 evo

Nice!

@prazola Now that all problems with 4G Decoding are fixed I inserted the Resizable BAR DXE driver before PciHostBridge with UEFITool.

Z97Ex9ReBar.zip (4.4 MB)

After flashing that BIOS. I recommend you compile the tool RebarState from source code ReBarState.cpp · GitHub because it’s most likely going to set off antivirus warnings since it writes to UEFI variables. If you don’t want to compile it you can find it in the ZIP below.

ReBarState.zip (8.5 KB)

Start by setting it to 9 and reboot. Keep increasing it by 1 until either you get Resizable BAR full size (16GB for you) or you get black screen/POST error (this means PciHostBridge needs patching).

Always make sure 4G decoding is enabled if RebarState is set or you will get black screen

If you get black screen/POST error you can fix it by booting without GPU inserted and setting RebarState to 0. Or restore the previous BIOS through flashing or swapping chip.

2 Likes

I cannot build it, SetFirmwareEnvironmentVariableEx function is not declared.

@prazola
Using Visual Studio ? I don’t get any errors building it on Visual Studio 2022. SetFirmwareEnvironmentVariableEx is included in the Windows.h header

Also make sure to build it x64

1 Like

Was using codeblocks. I’m using your exe now.
Ok, the max I get is 2^13, then black screen:

Ok @Kuri0 I think you just made my day! REBAR working also for AMD control panel. If you’ll ever get in Trento (Italy) I owe you dinner and drinks.

Thank you very much, I really wasn’t expecting this responsivness, felt like better than an official AsRock support! <3

1 Like

If you want for safety i can mod your modded bios with default option above 4g to always enabled.
because if you reset the bios the setup_var will be changed and you will take black screen or i am wrong?

No, I think Kuri0’s BIOS is already defaulting on 4G enabled. Thak you anyway!
The cherry on top would be the BIOS submenu, so I could switch the setting to test the performance impact.

And maybe it’s possible to hardcode the 8GB BAR into the BIOS?

1 Like

i believe that the setup var will change when you reset the bios. Lets wait @Kuri0 .
If that the case i can unlock the submenu and change above 4g to default to enabled.

this is such a discovery, congrats at both of u, this is awesome!

1 Like

I did like 4-5 CMOS and the setting persisted.

This is nice.
Another thing is that this motherboard has code that if has csm disabled and don’t found a monitor it enable csm automatically. This may skrew the modification. I search for this a long time and i didn’t find a solution.

so this fix @Kuri0 did is hard coding the thing in the bios? so u flashed that BIOS and it worked 8gb? oh and also, what happens if u disable it, say from all stock with 4G decode disabled will it still work?

im kinda curious if all u need is just to toggle the 4G Decode option (cause it’s alrd coded in the bios the rebar thing) to make it enable the rebar

The 8Gb are not hardcoded, right now you set the size variable to the UEFI via the software he/she developed and posted above.

Maybe I’m wrong but I don’t think you can disable 4G decode as you would mess with the address table and the system won’t boot.

GPU-Z says REBAR is on starting from 2GB.

the best SAFE option would be fixed dsdt in bios and default csm to enabled and above 4g to disabled.
So if you reset the bios you can enable it by disabling csm and enabling above 4g decoding manually.

you have csm disabled in bios?

Yes, CSM disabled but I’ve never experienced the problem you reported.

oh so the 8gb was added? i was curious of the changes he has done, if you could take the time maybe compare the stock bios vs the final modded bios? and say what changes he did and which to change/replace?

It’s all in the thread, Kuri0’s BIOS has 4G deconding enabled, DSDT hard corded and REBAR DXE driver.
You set the BAR size via windows CLI with ReBarState.

Changes I did

  1. Fix DSDT bug with 4G Decoding
  2. Add Resizable BAR DXE

TODO: if i can figure out and have time for
Modify PciHostBridge limit so 16GB BAR works

1 Like

@prazola Looks like the limit in PciHostBridge needs modification for 16GB BAR to work. A screenshot of Device Manager → Resource by Type → Memory (not Large Memory) showing the last items would be helpful. And also a screenshot of Large Memory (with the 8GB BAR)

1 Like

Later, I’m in the forest looking for mushrooms now :smiley:

@Kuri0 screenshots:


2 Likes

For anyone with assembly experience here’s the part of PciHostBridge which I think is relevant to patching (in Ghidra). The first 2 lines are for reading the TOUUD afaik.

I guess changing uVar9 = 0x400000000; to a higher number will make it work for 16GB RAM atleast. But the rest (32GB RAM and higher) is very confusing