[Guide] Asus Z97-K MB with 24GB Tesla P40 GPU

Hardware Setup:

  • Motherboard: ASUS Z97-K (Intel 9-Series)
  • CPU: Intel Core i7-4790
  • GPU: NVIDIA Tesla P40 (24GB GP102)
  • OS: Windows Server 2019
  • Flasher: CH341A Hardware Programmer

The Problem: I bought a 24GB Tesla P40 for local AI inference, but encountered the dreaded “Code 12: This device cannot find enough free resources” in Windows. Enabling “Above 4G Decoding” in the native ASUS BIOS did nothing, and the 24GB BAR was completely missing from Linux lspci.

The Z97 PciHostBridge has a hardcoded 16GB MMIO limit. When the P40 requests a single contiguous 32GB block (powers of 2), the BIOS mathematically cannot map it and drops the request during POST. Simply injecting rebar.ffs is not enough; the legacy 32-bit limits must be removed using UEFIPatch.

However, standard UEFIPatch files cause a fatal hard-freeze at the ASUS boot logo on the Z97 chipset because the buggy PciBus tries to map the USB controller into the massive new 64-bit space, which immediately crashes the board.

Required Tools & Downloads

  • UEFITool (v0.28.0): Releases · LongSoft/UEFITool · GitHub (Note: You must use the older v0.28.0. Do not use the newer “NE” versions as they are read-only and cannot insert modules).
  • UEFIPatch: same link as above (Available on the same LongSoft releases page).
  • ReBarUEFI (rebar.ffs & standard patches.txt): Releases · xCuri0/ReBarUEFI · GitHub
    Here is the exact step-by-step to fix the USB crash, expand the MMIO to 512GB, and successfully map the 24GB VRAM.

Step 1: Inject ReBarUEFI

Before patching, you need to insert the ReBar module into your BIOS file.

  1. Open a clean Z97-K BIOS backup in UEFITool (v0.28.0).
  2. Navigate to the bottom of the DXE volume, right-click the last module → Insert after…
  3. Inject rebar.ffs and save the new .bin file.

Step 2: The Custom Z97 patches.txt

The default ReBarUEFI patches.txt provides a USB blacklist fix, but it is hardcoded for Intel 8-Series boards (Device ID 9C31). You must modify this for the Intel 9-Series (Device ID 8CB1) or your system will freeze during PCIe enumeration.

Open patches.txt and ensure you use this exact block. Notice the hex replacement in the USB patch uses B18C to target the Z97 XHCI controller:

# PciBus | Remove <16GB BAR size limit (Sandy/Ivy Bridge/Haswell/Broadwell)
3C1DE39F-D207-408A-AACC-731CFB7F1DD7 10 P:B8FFFFFFFF030000004C3B:B8FFFFFFFFFFFFFF004C3B

# PciBus | Don't downgrade 64-bit BARs to 32-bit (Haswell/Broadwell)
3C1DE39F-D207-408A-AACC-731CFB7F1DD7 10 P:833E067506C70604000000833E077506C70605000000:66906690669066906690669066906690669066906690

# NvramSmi NVRAM whitelist unlock (by @vit9696)
842A454A-75E5-408B-8B1C-36420E4E3F21 10 P:9801000072:0000000072

# PciHostBridge | Remove 4GB limit for PciRootBridgeIo.Mem
8D6756B9-E55E-4D6A-A3A5-5E4D72DDF772 10 P:493B4C24C0771B:66906690669090

# PciBus | Add Intel 9 Series XHCI Controller to 64-bit blacklist (Custom Z97 Fix)
3C1DE39F-D207-408A-AACC-731CFB7F1DD7 10 P:DE10D301FFFF00000B00000014:8680B18CFFFF00000B00000010

# NBPEI | Correct EFI_HOB_TYPE_CPU SizeOfMemorySpace from 36-bit to 39-bit (512GB) (Haswell/Broadwell)
79AA6086-035A-4AD9-A89A-A6D5AA27F0E2 10 P:8B45FCC64008248B45FCC6400910:8B45FCC64008278B45FCC6400910

# PciHostBridge | Replace 32/48GB - 63GB MMIO region with complete use of 512GB physical address space (Haswell/Broadwell)
8D6756B9-E55E-4D6A-A3A5-5E4D72DDF772 10 P:BB00000000080000004823C1483BC3763C48BB000000000C000000....................................................................................................................................................................................................488B05........:BE000000007F0000004823C14889C34829DEEB6966906690669090....................................................................................................................................................................................................488B05........

Step 3: Patch the Modified BIOS

Drag the .bin file you just saved from UEFITool directly onto UEFIPatch.exe utilizing the custom patches.txt above. Verify via command prompt that the patches were successfully applied. This .patched file is your final image.

Step 4: Hardware Flashing & Avoiding Black Screens

Because patching the DXE volume alters the checksums, standard BIOS flashback utilities will reject it. You must flash the chip directly using a CH341A programmer.

After flashing, you must configure the BIOS before installing the GPU to avoid headless black screens:

  1. Leave the PCIe slot empty and boot using the iGPU to clear the mandatory CMOS Checksum Error halt.
  2. Enter BIOS → Enable Above 4G Decoding → Disable CSM.
  3. CRITICAL: Navigate to System Agent Configuration. Set Primary Display to iGPU AND explicitly enable iGPU Multi-Monitor. If you do not enable Multi-Monitor, plugging the P40 into the main slot will forcefully disable your display output.
  4. Save, shut down, install the Tesla P40, and boot into Windows.

Final Notes & Warnings

  • DO NOT run ReBarState.exe: The Tesla P40 is a Pascal architecture card. Forcing a Resizable BAR state on it in Windows could cause immediate driver crashes. The BIOS modification is strictly to give the motherboard the vocabulary to execute standard Above 4G Decoding for the 32GB BAR request. Just the bios update should give you all that you need.
  • This should enable the usage of modern GPUs for other purposes like Gaming too.

GPU-Z now correctly reports the full 24576 MB of memory size, and local LLM inference engines (like llama.cpp) can now map and utilize the entire VRAM pool seamlessly in TCC mode.

I have the file but I am unable to upload as a new user. Let me see if I can upload to the offer section.


Edit by Fernando: Thread moved into the „BIOS Modding Guides“ Category and title shortened/customized

1 Like

You should also extract as is guid FD44 from your own bios dump, and replace it to the stock bios to keep the UUID, SN, and mac address. GBE region too, Nvram optional.

@wa5her
Congratulations for having solved your problem yourself and for having written the related Guide.

Tip: As long as you cannot directly attach the modded BIOS, it would be a good idea to upload it to a hoster and post the link.

I did not know that. And I actually don’t have a backup from my original bios. Before I bought the programmer I used the asdos /gan flashing method and bricked my motherboard. I then trimmed the official Asus cap to generate my 8MB bin file as a starting point. Is there any way to recover my original values ?

The default ReBarUEFI patches.txt provides a USB blacklist fix, but it is hardcoded for Intel 8-Series boards (Device ID 9C31)

I guess you used the HswUSB3.txt (Intel 8) instead of the BdwUSB3.txt (Intel 9).

Step 4: Hardware Flashing & Avoiding Black Screens

Maybe that’s necessary for that gpu, but I didn’t have to do any of that for my AMD.
I had issues with UefiTool and had to use MMTool.
Going to try again with UefiTool.

Open patches.txt and ensure you use this exact block.

Is there a reason you left this one out?

  • PciHostBridge | Remove 4GB limit for PciRootBridgeIo.Mem (you only added the ‘771B‘)
    8D6756B9-E55E-4D6A-A3A5-5E4D72DDF772 10 P:493B4C24C0771C:66906690669090

I think this was due to Tesla P40 having no display capabilities, so after it flashes, the bios auto assign the pcie gpu as a main display. So OP did the right thing (as per title), use igpu only in the system for flashing the modded bios, and set it to igpu for main display, alongside with disabling csm and enabling above 4g decoding, and after the value is saved, you can safely plug the gpu and it’ll boot just fine.

Im curious abt this decision too :sweat_smile:

I tried this again, now I patched the bios with UefiTool and the 8 patches and it booted, so I guess this means there is no pad-file issue, but somehow ReBar is not enabled.
I set ReBarState to 16MB. Should BAR0 have the 16MB instead of BAR1?
Is the Large Memory correct?
Anyone has an idea of what I missed?

Large memory is already at the correct value, afaik most of Asus 7 series (except X79) and 9 series (except x99, it does not need dsdt patch but need to see if MMIOCFG is at 2GB at the very least, optionally set the MMIO High Size to the max available), has already a correct value/uses External References for M64L and M64B, and therefore dsdt patching is not required at all, in fact even doing these might brick the bios EVEN if there is no padding issues (only X79 could be dsdt patchrd with no issue whatsoever)… seems asus is sensitive to dsdt patching.

Anyways, if you set it at unlimited (assuming you do also use the nbpei uefi patch), and it run at 16GiB of bar size, it should be normal.

This might be out of topic, there is another alternative if NvramSmi patch is not working (board beeps when csm is disabled while using gpu, but with igpu it is fine), is by taking the last 2014 bios release of the z97 board (i think this is across H97 and Z97 asus boards), extract PE32 Body of the mentioned bios, and replace PE32 Body of the latest bios using the extracted old release PE32 Body bios.

I’ve set ReBarState to unlimited (32) and now it works, go figure…
Also, BAR0 is now the one with 16MB.
Going to do some games benchmarks to see if this helps or degrades performance.

I had already tried ReBar (see here) and it’s not that performance was the same, it was alot worse and I thought that maybe I did something wrong, but no, results are the same.
Even if I set ReBarState 0 (disabled) I get exact same bad performance.
ReBar isn’t working properly or there is some inefficiency handling it.
Don’t know why this happens. It’s not worth it.

Horizon Zero Dawn Remastered:

Red Dead Redemption 2:

I guess you used the HswUSB3.txt (Intel 8) instead of the BdwUSB3.txt (Intel 9).

Ah that is very possible that I used the wrong patch. I can find out later today.

Is there a reason you left this one out?

So what happened was I did just the rebar.ffs inclusion in the bios and it booted but my issue of Code 12 did not get solved. So I added all the patches and tried again. That did not work. So I only included the minimum set that made it work. It was a lot of trial and error. :smiley:

I never realised that BIOS can have that big an impact. Never cheaping out on a Mobo again. :sweat_smile: It is really interesting to see your bench… although it doesnt affect me as much since I dont intend to game on this machine. Plus the Tesla P40 GPU doesn’t have rebar support even. My use case is more for CUDA and local LLMs for :lobster:

The files have the names switched (some admin should change that…), since Hsw is Haswell and Bdw Broadwell and that led you to use the wrong one.

The problem is the bios patching, not even Rebar itself, because when I set ReBarState 0 (disabled) I still get the same exact bad performance as with 16MB set.
So, ReBar isn’t even working, worse, I think it must be using like 1MB or whatever instead of the 256MB default.

When I set it to 32 (unlimited), Windows changed device to ‘PCI BUS’, made me reboot 2x. I thought the problem was that PCI BUS, but since I flashed it on an extra 25Q64FVAIQ chip, I just switched back to my original bios chip and I got my performance back, so the issue is the bios patching.

Now, I wonder if this only happens with this board or with this gpu/board/cpu combination, OR, it doesn’t really help, because according to AMD, I would need a 10th gen cpu.
I don’t know if anyone that used ReBarUEFI did benchmarks in games like I did.

Check this out: P40 working on Z87 + E3 without BIOS flashing using DSDT override