[Release] Resizable BAR BIOS EFI Module

Here is resources tab on my gpu.

image

Z170 and some Z97 boards seem to have a problem where they force GPU resources to be allocated in 32 bit region ignoring if 4G decoding is enabled (for compatibility with CSM I guess). Even without resizable bar my B75 board allocates my rx 580 in the 64 bit region if 4g decoding is on (which breaks CSM).

Probably can be patched to be fixed tho. I can’t develop a patch because not my board but I hope someone does figure it out

1 Like

Linux is also using below 4G: 80000000-c07fffff : PCI Bus 0000:01
Looking at DSDT to check the range, it looks like some variables are defined outside the AmiBoardInfo module.

    If ((M64L == Zero))                                                              
    {                                                                                
        CreateDWordField (BUF0, \_SB.PCI0._Y1E._LEN, MSLN)  // _LEN: Length          
        MSLN = Zero                                                                  
    }                                                                                
    Else                                                                             
    {                                                                                
        CreateQWordField (BUF0, \_SB.PCI0._Y1E._LEN, M2LN)  // _LEN: Length          
        CreateQWordField (BUF0, \_SB.PCI0._Y1E._MIN, M2MN)  // _MIN: Minimum Base Address         
        CreateQWordField (BUF0, \_SB.PCI0._Y1E._MAX, M2MX)  // _MAX: Maximum Base Address             
        M2LN = M64L /* External reference */
        M2MN = M64B /* External reference */                                         
        M2MX = ((M2MN + M2LN) - One)
    }   
        
    Return (BUF0) /* \_SB_.PCI0.BUF0 */

I tried to include all tables in the disassembly of DSDT and some external symbols were resolved, but not M64L and M64B.

ls /sys/firmware/acpi/tables/
APIC  BGRT  data  DSDT	dynamic  FACP  FACS  FPDT  HPET  MCFG  SSDT1  SSDT2  SSDT3  SSDT4  SSDT5  UEFI
ls /sys/firmware/acpi/tables/dynamic/
SSDT6  SSDT7  SSDT8
cat /proc/iomem
f0000000-f07fffff : PCI Bus 0000:01
  f0000000-f07fffff : 0000:01:00.0
f7400000-f77fffff : 0000:00:02.0
f7800000-f7afffff : PCI Bus 0000:06
  f7800000-f79fffff : 0000:06:00.0
  f7a00000-f7a07fff : 0000:06:00.0
f7b00000-f7bfffff : PCI Bus 0000:01
  f7b00000-f7bfffff : PCI Bus 0000:02
    f7b00000-f7bfffff : PCI Bus 0000:04
      f7b00000-f7b03fff : 0000:04:00.0
...
100000000-41fdfffff : System RAM
  179e00000-17ae025c7 : Kernel code
  17b000000-17ba87fff : Kernel rodata
  17bc00000-17c0455ff : Kernel data
  17c393000-17c9fffff : Kernel bss
41fe00000-41fffffff : RAM buffer
[    0.196147] pci 0000:00:02.0: reg 0x18: [mem 0xe0000000-0xefffffff 64bit pref]
[    0.199521] pci 0000:01:00.0: reg 0x10: [mem 0xf0000000-0xf07fffff 64bit pref]
[    0.199685] pci 0000:00:01.0:   bridge window [mem 0xf0000000-0xf07fffff 64bit pref]
[    0.200388] pci 0000:03:00.0: reg 0x18: [mem 0x00000000-0x1ffffffff 64bit pref]
[    0.200403] pci 0000:03:00.0: reg 0x30: [mem 0x00000000-0x001fffff pref]
[    0.215439] pnp 00:00: disabling [mem 0xfed40000-0xfed44fff] because it overlaps 0000:03:00.0 BAR 2 [mem 0x00000000-0x1ffffffff 64bit pref]
[    0.216329] pnp 00:06: disabling [mem 0xfed1c000-0xfed1ffff] because it overlaps 0000:03:00.0 BAR 2 [mem 0x00000000-0x1ffffffff 64bit pref]
[    0.216331] pnp 00:06: disabling [mem 0xfed10000-0xfed17fff] because it overlaps 0000:03:00.0 BAR 2 [mem 0x00000000-0x1ffffffff 64bit pref]
[    0.216333] pnp 00:06: disabling [mem 0xfed18000-0xfed18fff] because it overlaps 0000:03:00.0 BAR 2 [mem 0x00000000-0x1ffffffff 64bit pref]
[    0.216334] pnp 00:06: disabling [mem 0xfed19000-0xfed19fff] because it overlaps 0000:03:00.0 BAR 2 [mem 0x00000000-0x1ffffffff 64bit pref]
[    0.216336] pnp 00:06: disabling [mem 0xf8000000-0xfbffffff] because it overlaps 0000:03:00.0 BAR 2 [mem 0x00000000-0x1ffffffff 64bit pref]
[    0.216337] pnp 00:06: disabling [mem 0xfed20000-0xfed3ffff] because it overlaps 0000:03:00.0 BAR 2 [mem 0x00000000-0x1ffffffff 64bit pref]
[    0.216338] pnp 00:06: disabling [mem 0xfed90000-0xfed93fff] because it overlaps 0000:03:00.0 BAR 2 [mem 0x00000000-0x1ffffffff 64bit pref]
[    0.216340] pnp 00:06: disabling [mem 0xfed45000-0xfed8ffff] because it overlaps 0000:03:00.0 BAR 2 [mem 0x00000000-0x1ffffffff 64bit pref]
[    0.216341] pnp 00:06: disabling [mem 0xff000000-0xffffffff] because it overlaps 0000:03:00.0 BAR 2 [mem 0x00000000-0x1ffffffff 64bit pref]
[    0.216342] pnp 00:06: disabling [mem 0xfee00000-0xfeefffff] because it overlaps 0000:03:00.0 BAR 2 [mem 0x00000000-0x1ffffffff 64bit pref]
[    0.216344] pnp 00:06: disabling [mem 0xf7fe0000-0xf7feffff] because it overlaps 0000:03:00.0 BAR 2 [mem 0x00000000-0x1ffffffff 64bit pref]
[    0.216345] pnp 00:06: disabling [mem 0xf7ff0000-0xf7ffffff] because it overlaps 0000:03:00.0 BAR 2 [mem 0x00000000-0x1ffffffff 64bit pref]
[    0.225125] pci 0000:01:00.0: BAR 15: no space for [mem size 0x200000000 64bit pref]
[    0.225127] pci 0000:01:00.0: BAR 15: failed to assign [mem size 0x200000000 64bit pref]
[    0.225129] pci 0000:02:01.0: BAR 15: no space for [mem size 0x200000000 64bit pref]
[    0.225130] pci 0000:02:01.0: BAR 15: failed to assign [mem size 0x200000000 64bit pref]
[    0.225135] pci 0000:03:00.0: BAR 2: no space for [mem size 0x200000000 64bit pref]
[    0.225136] pci 0000:03:00.0: BAR 2: failed to assign [mem size 0x200000000 64bit pref]
[    0.225140] pci 0000:03:00.0: BAR 6: no space for [mem size 0x00200000 pref]
[    0.225141] pci 0000:03:00.0: BAR 6: failed to assign [mem size 0x00200000 pref]
[    0.225176] pci 0000:00:01.0:   bridge window [mem 0xf0000000-0xf07fffff 64bit pref]
[    0.225201] pci_bus 0000:01: resource 2 [mem 0xf0000000-0xf07fffff 64bit pref]

Moved investigation for z97 issue to Z97 board can't allocate above 4G even with above 4g decoding enable in BIOS · Issue #10 · xCuri0/ReBarUEFI · GitHub

Hi, noob here, I’m having a go at the ReBAR mod with an ASUS Z170-WS, just having a little trouble adding the module, I put it at the end of this table hopefully its the correct one, it boots, enable 4G encoding but when it comes to the ReBarState script, its successful but on reboot, setting “unlimited” results in a black screen and setting 1024MB results in the POST code 62 hanging, I have already extracted and replaced the module but it says somewhere to place the module above the PCIehostbridge module which i can’t find…
What am I doing wrong here?

@Latios

but it says somewhere to place the module above the PCIehostbridge module which i can’t find

this was thought to be true before but it turns out that it’s not needed and you can just place it at the end which causes less problems.

First make sure that CSM is off because you never mentioned it. I am sure that a workstation motherboard which advertises as being compatible with workstation gpus (which use large BARs) won’t have any problems handling large BARs.

If it still doesn’t work with CSM off try 512mb so you can see if it’s a problem with the module insertion. If it works then it isn’t.

You might be inserting it into the wrong DXE volume. It needs to be in the same one as PciBus or PciHostBridge.

I downloaded the latest BIOS for your board to check and there is a PciHostBridge but you can only see it with UEFITool NE (not 0.28). But since you can see it with NE you can then know which DXE volume to insert the ReBarDxe ffs into.

You could also try inserting it with MMTool. UEFITool 0.28 hasn’t been updated in a long time and seems to be having some problems parsing this BIOS

1 Like

Sorry, neglected to mention Yes CSM has been disabled the whole time, the DXE volume does seem to be correct but just in case i’ll upload my BIOS here, I got as far as GPU-Z saying "Above 4G Decode enabled: yes, Resizable BAR enabled in BIOS: no, CSM Disabled: Yes and the 512MB i set showed up in BAR1 at the bottom, tried to bump it up to 1024MB and it just hangs in POST as if it finished all the checks and hangs before loading the splash screen
Could it be a problem with any of the hardware?
ASUS Z170-WS, Intel Xeon E-2286M, RTX 3080 Ti FE
Z170WS_test.zip (7.4 MB)

I recommend you create an issue on Github about it. Then other users who have the same problem will be able to help with fixing it.

1 Like

@dsanke a few patches exist now to fix the issues you had on the Z170 boards such as not allocating 64-bit address. they are in the github repo UEFIPatch folder

if you do have any issues with them create an issue on github so it’s easier to find.

3 Likes

Hello @Kuri0 o/ Many thanks for doing this. I have it working on my mainboard.

The board is an Asus Maximus VIII Gene (Z170)

GPU is Intel ARC A770 16GB

I had to apply one of the patches to enable over 512MB BAR

PciBus | Don’t downgrade 64-bit BARs to 32-bit (by @Mak3rde)

I will do some testing to see what effect the larger BAR has on my games.

Thanks again

  • 68k
1 Like

I will test it half month later when I get home through a 4000km trip.

2 Likes

Would it be possible to get this and enable 4g decoding on a laptop bios as well? I have a Haswell Laptop with Insyde BIOS. I recently got my hands on a very special GPU and was wondering if this may help my code 43 problem.


bios.zip (2.4 MB)

@Kuri0 Hi, first of all thank you for give us the posibility for get more juice of our hardware. I have a QQLT and a Aorus Elite B365M motherboard (Bios is modified, it has an extra cpu code, has a bypassing 64GB ram limit to 128GB and it has the intel ME parts disabled at all cause this CPU needs to be that way.
I inserted the rebar file, flash both bios chips with moded bin, the rebar state says all is fine, csm disable, above 4g enable (natively support by mb) and when i set any bar size larger than 256 it sets 128 bar size instead. I have read that i will need to use a patch for by pass this limit so could you a provide me a guide to do that in case it could be the fix. Thank you ! (bios file without modification and with it)


@Adiel235 hi what is the gpu ?

also send a screenshot of hwinfo64 showing the supported sizes like this

2 Likes



Wow hi that was fast, is an rtx 3060ti

@Adiel235 it’s an RTX 3060 Ti you probably need to do the VBIOS update.

1 Like

nvidia firmaware update says: RTX 3060Ti status: already updated.
Same problem, if i set any number nore than 0 sets 128 instead, if a set 0 set default bar sizes. If a set 4GB bar size, no display output. :persevere:

@Adiel235 send a screenshot of device manager resources tab (with default BAR)
image
can then see if it needs a new patch needs to be developed which i’ll try to make later if that’s the case.

2 Likes