xCuri0 / ReBarUEFI

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

MMTool method creates unusable bios, UEFITool OC issue. #98

Closed FPSUsername closed 11 months ago

FPSUsername commented 11 months ago

System

Description

Unfortunately, this is one of those motherboards that will break overclocking and post issues when the bios get modified by UEFITool. I first found out when I used UBU Tool to update microcode and other firmwares in the past and since just used the 3503 provided by ASUS ROG (original).

I found out about ReBar to add support for my newly acquired RX6600 and went with the normal method of using UEFITool and UEFIPatch. The bios flashes successfully and ReBar works, except overclocking now doesn't work (which is quite essential on DDR3 ram in my case).

I used MMTool 5.0.0.7 and 5.2.0.24 and they both modify the bios in the exact same way (but different to UEFITool of course). After successfully applying the patches with UEFIPatch, the system rejects the bios as an update via the EZ Update tool, nor does it accept via the flashback method (the indicator stays turned on instead of blinking).

Did I miss any step when using MMTool (I followed the steps in the wiki)? Or am I supposed to use MMTool v4.x instead?

xCuri0 commented 11 months ago

It was fixed here https://winraid.level1techs.com/t/asus-z97-maximus-vii-hero-readjustable-bar/90930/38

@Koekieezz do you remember how you fixed this ? Want to add it to the guide

FPSUsername commented 11 months ago

Yes! The keyboard bug was indeed present as well on my end as well. The patch seems to be in the nvramsmi module. I'm not sure how to extract it and compare (I wouldn't risk using the patched module from another bios honestly).

xCuri0 commented 11 months ago

Have you tried other versions of MMTool ?

FPSUsername commented 11 months ago

It seems that MMTool 4.50.023 generates a different output than 5.0.0.7 (which does the same as 5.2.0.24). I'll try to flash that later today but I doubt it'll work, as the VII Hero required a patched nvramsmi module, I bet it's the same case here. I extracted the NvramSmi from the ranger bios using UEFITool A67. The tool reports a different full size, so I think it needs to be patched separately and not replace it with the patched version for the Hero motherboard. MAXIMUS VII Ranger 3503 NvramSmi.zip

xCuri0 commented 11 months ago

@FPSUsername don't replace any modules

follow the method in UEFIPatch wiki page so only MMTool 4.5 is used on the final BIOS, preventing any corruption. You should end up replacing your NvramSmi module with your own generated patched one using this method.

FPSUsername commented 11 months ago

What I did before was to add the rebar through MMTool 5.x and then apply the patch with UEFIpatch v28. The issue is that the bios (either flashback or ez flash) doesn't accept it. I'll try with MMTool 4 later and see if it will be accepted, but I doubt it.

I'm not sure how to modify the NvramSmi as there's no documentation on that and what to change. Koekieezz mentioned that he used UBU Tool to update the microcode, and using only that already causes the overclock issue on the VII Ranger. I believe the NvramSmi needs to be patched either way and that MMTool won't solve the issue in this case.

xCuri0 commented 11 months ago

@FPSUsername NvramSmi patch is done by UEFIPatch, you don't need to do anything but follow the written pad file workaround in the guide.

NvramSmi patch to resolve an issue that causes ReBarState to not work.

Overclocking issue is something else I think, I asked Koekieezz on Discord if he remembers what was changed and he doesn't.

FPSUsername commented 11 months ago

image Unfortunately the bios is rejected when patching with MMTool 4.50.023 and using UEFIPatch afterwards. If it's rejected by EZ Flash, it's rejected by flashback.

I attached the original, modified and patched bios files.

The patches that were applied

parseImageFile: Aptio capsule signature may become invalid after image modifications
patch: replaced 16 bytes at offset B80h 3BC3771548BE000000C00F000000482B -> 3BC3771548BE0000000010000000482B
patch: replaced 11 bytes at offset 87F7h B8FFFFFFFF030000004C3B -> B8FFFFFFFFFFFFFF004C3B
patch: replaced 22 bytes at offset 710Ah 833E067506C70604000000833E077506C70605000000 -> 66906690669066906690669066906690669066906690
patch: replaced 5 bytes at offset 6A5h 9801000072 -> 0000000072
patch: replaced 7 bytes at offset 1922h 493B4C24C0771B -> 66906690669090
patch: replaced 7 bytes at offset 19C9h 493B4C24C0771C -> 66906690669090
Image patched

VII Ranger 3503 ReBar MMTool 4.50.023.zip

xCuri0 commented 11 months ago

@FPSUsername You should NOT run UEFIPatch directly on the BIOS you're going to flash because it will cause issues like what you have with OC.

https://github.com/xCuri0/ReBarUEFI/wiki/Using-UEFIPatch#pad-file-issue-workaround this is what you should do so the BIOS you flash only get's touched by MMTool, and make sure you insert ReBarDxe with MMTool too

Use version 4.5.023 it's what others have been successful with

FPSUsername commented 11 months ago

@xCuri0 It doesn't seem to matter. I created the patched bios files with MMTool 4.50 and UEFITool v28 method and both generate the exact same file before patching with UEFIPatch. The hashes are the same, pad file is not altered.

So it seems like the VII Ranger is not affected by the bug, however, the OC issue still stands.

Continuing from the pad file workaround, I extracted the PciBus and PciHostBridge from the patched bios and replaced the PciBus and PciHostBridge from the bios with ReBar injection via MMTool and just to try, also the stock bios.

Reopening the bios files in UEFITool to verify, the PciBus full size and body size is different on the files with the patched ffs injected via MMTool. I'll try to flash both and see what happens.

To clarify, ReBar does work, but altering the bios in any way breaks overclocking and adds the no keyboard bug found in the VII Hero motherboard, before Kookieezz found a solution.

xCuri0 commented 11 months ago

@FPSUsername It's a know issue that UEFITool causes stuff like this.

If you can figure out how to flash the MMTool BIOS it will most likely work

FPSUsername commented 11 months ago

@xCuri0 UEFITool causes issues, but if the finalized bios is exactly the same (matching SHA256) using MMTool 4.50, then the same issue (OC) will exist. I'll try to start from a clean slate and do everything with MMTool 4.50 again and see if I can get OC to work after adding ReBar.

I really hope Koekieezz can help with the NvramSmi for this motherboard, because I believe that's where a potential fix is. I have little knowledge about bios modding, I hope to figure out extracting the NvramSmi from the VII Hero bios and compare it to the modified variant to get some more insight in what changed.

xCuri0 commented 11 months ago

@FPSUsername Your issue is not NvramSmi, that module only handles NVRAM like ReBarState and gets fixed by UEFIPatch.

If you do MMTool 4.5 like I said you're BIOS will probably work with OC and everything, not just Z97 I saw this exact issue on a Z170 board too fixed by using MMTool exclusively.

FPSUsername commented 11 months ago

I've used this bios as a base (as it's updated and it works with overclocking), then did the following:

  1. Add ReBar to the PCIe bus with MMTool v4.50.023
  2. Ran UEFIPatch with the patch.txt from this repo
  3. Opened the .patched bios in UEFITool A67 and extracted "as is" the PCIeBus and PCIeHostBridge
  4. Opened the ReBar bios (from step 1) in MMTool v4.50.23 and replaced the PCIeBus and PCIeHostBridge with the extracted ffs files.
  5. Save as M7R.CAP and flash
  6. Overclocking works, rebar doesn't as it shows not enabled in BIOS.

image

It is recommended to first try smaller sizes above 256MB in case BIOS doesn't support large BARs.

Enter ReBarState Value
0: Disabled
Above 0: Maximum BAR size set to 2^x MB
32: Unlimited BAR size                                        

13
Writing value of 13 / 8192 MB to ReBarState        

Failed to write ReBarState UEFI variable
GetLastError: 5
You can close the app now
xCuri0 commented 11 months ago

@FPSUsername You have to do the same thing you did with PciBus to NvramSmi.

It will work then, that's the module causing this error.

xCuri0 commented 11 months ago

Also later once you have it all working can you test using UEFITool for the first step only (adding ReBarDxe) and the same MMTool steps for the rest ?

I want to know if I have to update first step of guide to say use MMTool on ASUS.

FPSUsername commented 11 months ago

image I had to do the same to NvramSmi to get ReBar working. Overclock & ReBar.

I did get the no keyboard bug. I'll investigate it later and also using UEFITool. The issue I believe is UEFIPatch, because UEFITool makes identical files compared to MMTool 4.50.23.

So a preliminary conclusion: for ASUS motherboards, you'll have to replace the modules with MMTool after extracting them from a patched version.

xCuri0 commented 11 months ago

I'll investigate it later and also using UEFITool. The issue I believe is UEFIPatch, because UEFITool makes identical files compared to MMTool 4.50.23.

If that's the case then there's no need to do what I said.

About the keyboard bug did you apply this patch image

It modifies PciBus btw, so you will need to apply both patches before extracting the PciBus module for using in MMTool

FPSUsername commented 11 months ago

@xCuri0 Thank you for guiding me through, it worked!

To make things easier in the future, I believe the trick is as following:

  1. Inject/update/do anything with UEFITool/MMTool/UBU and save the bios
  2. Apply patches with UEFIPatch
  3. Extract what's patched and the NvramSmi using UEFITool from the patched bios
  4. Open the BIOS from step 1 with MMTool 4.50.023 and replace the modules with the extracted ffs modules

So this bios can also be added to the list:

User Motherboard GPU BAR size tested UEFIPatch req (Y/N) Notes
@FPSUsername ASUS VII Ranger RX 6600 8GB 8GB Y Need to extract PCIeBus, PCIeHostBridge and NvramSmi from the UEFIPatch patched bios and replace the modules in an unpatched bios. BdwUSB3.txt patch must also be included.

As a treat, here is the modified ReBar bios with the following changes (Thanks to voron00 for updating the BIOS in 2019 with pretty much the final updates).

Modules:

Microcode:

MAXIMUS-VII-RANGER-ASUS-3503-REBAR.zip

SHA256 from M7R.CAP 4CCCB56ABB490E7A0745E1D2C8F90EB9B4BA582169524754314F32F06ECBD9AF

iulisan27 commented 5 months ago

@FPSUsername Hey, how are you doing? I was trying to flash the 3503 rebar bios you uploaded here but i get the error saying "Selected File is not a proper BIOS". Do you know what could it be?

FPSUsername commented 5 months ago

You need to flash it via the emergency flasher. Note the following:

  1. The file needs to be renamed using the rename tool. For this specific motherboard it's M7R.CAP, so you can manually rename it.
  2. The file should be placed on a FAT32 formatted USB stick.
  3. The motherboard doesn't accept all USB sticks. I used an old 2GB stick that works, my other 16GB stick didn't work. (You'll see the light flicker constantly when it's flashing. If it doesn't, it's not working).
iulisan27 commented 5 months ago

The strange thing is that i could flash another bios with the same usb stick on fat32. I'll try again but with the flashback button as you said. Thank you!

iulisan27 commented 5 months ago

@FPSUsername I think i managed to install it with the flashback button but i don't see the rebar option in the bios. Do you know where is that located? image

FPSUsername commented 5 months ago

If you didn't flash the bios by voron00 and use the latest provided by Asus, then try the following.

With one of the (quite terrible) tools from Asus (also provided in the AI suite package), you can read the current bios on your system (I assume you already have it as you tried to flash it the normal way first).

Make a backup/readout of your current installed bios. Then open it in UBU tool and see if the modules have older versions than what I posted in this comment. Note that they're the same as the bios provided by voron00. All I did was take his bios and add rebar.

I don't exactly remember how the light is supposed to react, but I think it blinks 3 times, then starts flashing rapidly till the bios is flashed. If it continues doing the same slow flashing pattern, then it's waiting for a device with the bios.

I believe if you read back the bios, the hash would be exactly the same as the bios file you use to flash it. So maybe check the hash of the backup and see if it matches the original, voron00 (if installed) or mine.

iulisan27 commented 5 months ago

@FPSUsername I installed the one you uploaded on November 25 2023. https://github.com/xCuri0/ReBarUEFI/files/13465265/MAXIMUS-VII-RANGER-ASUS-3503-REBAR.zip is this the right one?

FPSUsername commented 5 months ago

Yes, that's the correct one

iulisan27 commented 5 months ago

@FPSUsername do you know where the rebar option should be located? Im gonna check the module versions you mentioned but they should be the same.

FPSUsername commented 5 months ago

There's no new option in the bios. Run the rebar tool in your operating system and set rebar to 8GB. Reboot and check.

iulisan27 commented 5 months ago

Oh i think i missed that step, i'm sorry. I'm gonna check it and inform you later.

iulisan27 commented 5 months ago

@FPSUsername what value should i set for it to be 8192mb?

image

FPSUsername commented 5 months ago

2^13 = 8192. It's simple math

iulisan27 commented 5 months ago

Yeah you are right. Now i feel dumb

iulisan27 commented 5 months ago

I got it working thanks to you! Now i got to squeeze the last bit of juice of this old system image

FPSUsername commented 5 months ago

You need a compatible GPU to make use of ReBar, for now it's enabled on the motherboard, but it will do nothing (as BAR1 is still at 256MB).

Once you get a compatible GPU, set the rebar size to the same size as the amount of memory on the GPU (mine is 8GB so I chose 8GB for ReBar).

From ny understanding (and correct me if I'm wrong), ReBar allows the CPU to grab chunks of data from the GPU, by default limited to 256MB. Increasing it to 8GB makes it possible to grab all data at once, reducing the need of grabbing multiple chunks, freeing up CPU time.

So I think you'll see massive improvements if a system is bottlenecked by the CPU (as is with mine, the RX6600 was however the best bang for the buck, it didn't make sense to settle with less for only a 20 euro difference).

xCuri0 commented 5 months ago

RX Vega supports Resizable BAR, just make sure to enable it in registry (wiki says how). BAR0 is what's used for the VRAM on AMD

iulisan27 commented 5 months ago

I'm currently using a Rx Vega 64 with 8gb vram so i set that bar size. Its as xCuri0 said so it should work fine with my gpu. I'm not sure how much performance I may able to gain, but I wanted to try this since i've heard old cpus take more advantage from this (mine is an i7 4790k).

Nero10578 commented 4 months ago

@xCuri0 Thank you for guiding me through, it worked!

To make things easier in the future, I believe the trick is as following:

  1. Inject/update/do anything with UEFITool/MMTool/UBU and save the bios
  2. Apply patches with UEFIPatch
  3. Extract what's patched and the NvramSmi using UEFITool from the patched bios
  4. Open the BIOS from step 1 with MMTool 4.50.023 and replace the modules with the extracted ffs modules

So this bios can also be added to the list:

User Motherboard GPU BAR size tested UEFIPatch req (Y/N) Notes @FPSUsername ASUS VII Ranger RX 6600 8GB 8GB Y Need to extract PCIeBus, PCIeHostBridge and NvramSmi from the UEFIPatch patched bios and replace the modules in an unpatched bios. BdwUSB3.txt patch must also be included. As a treat, here is the modified ReBar bios with the following changes (Thanks to voron00 for updating the BIOS in 2019 with pretty much the final updates).

Modules:

  • OROM IRST RAID for SATA v13.0.0.2075 -> v14.8.2.2397
  • EFI IRST RAID for SATA v13.0.0.2075 -> v14.8.2.2397
  • EFI GOP Driver HSW-BDW v5.5.1024 -> v5.5.1034
  • OROM Intel Boot Agent GE v1.5.47 -> v1.5.62
  • EFI Intel PRO/1000 UNDI v6.0.03 -> v6.6.04
  • ReBarDxe -> v0.3

Microcode:

  • Haswell: 27 - cpu306C3_plat32_ver00000027_2019-02-26_PRD_4F5914B9.bin
  • Broadwell: 20 - cpu40671_plat22_ver00000020_2019-03-07_PRD_5246E87E.bin

MAXIMUS-VII-RANGER-ASUS-3503-REBAR.zip

SHA256 from M7R.CAP 4CCCB56ABB490E7A0745E1D2C8F90EB9B4BA582169524754314F32F06ECBD9AF

Hey can I ask for clarification for the steps? I am trying to add Rebar to an Asus Rampage V Edition 10 which according to the supported motherboard list requires this method your showed.

Specifically I want to ask what do you mean in step 3 by extract what's patched? Then for step 4 you put the patched modules back in to the bios that was already modified in step 1?

Any help is appreciated. Thanks!

FPSUsername commented 4 months ago

You need to extract the patched modules using MMTool. Then open the modified bios (before it was run with UEFIPatch for rebar) inMMTool and there replace the modules with the extracted patched modules. Don't forget the USB patch if the keyboard doesn't work.