The module is added to the UEFI firmware's DXE volume so it gets executed on every boot. The ReBarDxe module replaces the function PreprocessController of PciHostBridgeResourceAllocationProtocol with a function that checks for Resizable BAR capability and then sets it to the size from the ReBarState NVRAM variable after running the original function.

The new PreprocessController function later gets called during PCI enumeration by the PciBus module which will detect the new BAR size and allocate it accordingly.

Requirements

  • (optional) 4G Decoding enabled. See wiki page Enabling hidden 4G decoding if you can't find an option for it. Without 4G Decoding you will be limited to 1GB BAR and in some cases 512MB you can try to increase this upto 2GB by reducing TOLUD
  • (optional) BIOS support for Large BARs. Patches exist to fix most issues relating to this

Usage

  • Follow the wiki guide Adding FFS module and continue through the steps. It covers adding the module and the additional modifications needed if required.
  • Once running the modified firmware make sure that 4G decoding is enabled and CSM is off.
  • Next run ReBarState which can be found in Releases (if you're on Linux build with CMake) and set the Resizable BAR size. In most cases you should be able to use 32 (unlimited) without issues but you might need to use a smaller BAR size if 32 doesn't work
  • If Resizable BAR works for you reply to List of working motherboards so I can add it to the list. Most firmware will accept unsigned/patched modules with Secure Boot on so you won't have any problems running certain games.
  • If you have any issues after enabling Resizable BAR see Common Issues (and fixes)

UEFI Patching

Most UEFI firmwares have problems handling 64-bit BARs so several patches were created to fix these issues. You can use UEFIPatch to apply these patches located in the UEFIPatch folder. See wiki page Using UEFIPatch for more information on using UEFIPatch. Make sure to check that pad files aren't changed and if they are use the workaround

Working patches

  • <4GB BAR size limit removal
  • <16GB BAR size limit removal
  • <64GB BAR size limit removal
  • Prevent 64-bit BARs from being downgraded to 32-bit
  • Increase MMIO space to 64GB (Haswell/Broadwell). Full 512GB/39-bit isn't possible yet.
  • Increase MMIO space from 16GB to full usage of 64GB/36-bit range (Sandy/Ivy Bridge). Requires DSDT modification on certain motherboards. See wiki page DSDT Patching for more information.
  • Remove NVRAM whitelist to solve ReBarState GetLastError: 5
  • Fix USB 3 ports not working in BIOS with 4G Decoding enabled (Ivy Bridge/Haswell/Broadwell)
  • X79 Above 4G Decoding fix

Build

Use the provided buildffs.py script after cloning inside an edk2 tree to build the DXE driver. ReBarState can be built on Windows or Linux using CMake.

What's New

  • Add CMOS reset detection
  • CMOS reset should now disable Resizable BAR so you won't have any boot issues after doing one. This works by checking if the system date is before 2023.