Hi yannic — I hit exactly the same wall on the same board and I have it working now, so here is
the full answer.
Short version: 0x2a9 is the wrong offset. On this board Setup[0x2a9] is
“Prefetchable Memory above 4G”, a per-root-bridge resource-allocation knob — not the option
you want. The real one is:
Setup[0x001] = 0x01 -> "Above 4G Decoding"
That offset is the very first byte of the Setup varstore, which is why nothing visible happened
when you poked 0x2a9. And that 0x2a9 figure is not harmless folklore either — it is the number
that gets copy-pasted around for other AMI boards, and it is the same wrong offset behind the
bricked boards in ReBarUEFI issue #113. Do not write it blindly.
My board: MSI Z97 GAMING 3 (MS-7918), BIOS V2.10 (2016-02-16), i7-4790K. You are on 2.9, so
verify the offset on your own dump before writing anything — offsets do move between BIOS
revisions. The procedure below is how I got it, and it needs no hardware programmer.
1. Dump your own BIOS (from Linux, no programmer needed)
apt install flashrom
flashrom -p internal -r bios-dump1.bin
flashrom -p internal -r bios-dump2.bin
sha256sum bios-dump1.bin bios-dump2.bin # must match, otherwise the read is unreliable
flashrom will complain about the chipset being in a “restricted” state — the BIOS region is
still readable, which is all we need. We are only reading; nothing is flashed at any point in this
guide.
2. Extract the HII data and find the real offset
pip install uefi_firmware
python3 -m uefi_firmware parse -e bios-dump1.bin
Then walk the extracted volumes for the Setup form set: you are looking for HII package lists
containing a forms package (type 0x02) and a strings package (type 0x04). In the strings
package the entries are EFI_HII_SIBT_STRING_UCS2 (opcode 0x14); build a string-id → text map
from it. In the forms package parse the IFR opcodes and pick out:
EFI_IFR_VARSTORE (0x24) — gives you the varstore named Setup and its GUID
EFI_IFR_ONE_OF (0x05) — each one carries a prompt string-id and a VarStoreInfo field,
which is the byte offset inside that varstore
Cross-reference the two and you get a full list of every question with its offset. On mine that
was 1356 questions. The two relevant lines:
0x001 Above 4G Decoding Enables or Disables 64bit capable Devices to be Decoded in Above 4G Address Space
0x2a9 Prefetchable Memory above 4G Prefetchable Memory above 4G
That is the whole story: two different options whose names both contain “above 4G”.
The varstore GUID on this board is ec87d643-eba4-4bb5-a1e5-3f3e36b20da9 (standard AMI Setup GUID).
3. Write it — efivarfs, no modified GRUB needed
You do not need setup_var_cv or a patched GRUB at all. From a booted Linux with efivarfs
mounted:
V=/sys/firmware/efi/efivars/Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9
cp $V /root/Setup-nvram-backup.bin # BACK IT UP FIRST
chattr -i $V
python3 - <<'PY'
p="/sys/firmware/efi/efivars/Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9"
d=bytearray(open(p,"rb").read())
d[4+0x001] = 0x01 # +4 skips the attribute header
open(p,"wb").write(bytes(d))
PY
printf "now: 0x%02x\n" $(od -An -tu1 -j $((4+1)) -N 1 $V)
reboot
Two things that bite people here:
- The efivarfs file has a 4-byte attribute prefix in front of the data. Your setting at
varstore offset N lives at file offset N+4. Get this wrong and you are writing a neighbouring
option.
- The write must be a single
write() of attributes + data. Do not dd into it, do not
open it for partial modification — read the whole thing, patch the byte, write the whole thing
back in one go, exactly as above.
The option still will not appear in the BIOS GUI afterwards — MSI suppressed it there. That is
expected and does not mean it failed. Judge it by the result, not by the menu.
4. Verify it actually took effect
cat /proc/iomem | grep -i pci
Before, there was nothing above the 4 GB line. After, I get a 31 GiB MMIO window:
800000000-fbfffffff : PCI Bus 0000:00
That window is what a large-BAR card needs.
5. You will probably also need pci=realloc
This is the part nobody mentions and it cost me an evening. Above 4G Decoding alone was not
enough on this board. The PEG port’s non-prefetchable window is only 1 MB, too small for the
card’s BAR 5 + option ROM + the two bridge windows, so the kernel gives up on the whole device.
Add to /etc/default/grub:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pci=realloc"
then update-grub and reboot. With both Above 4G Decoding and pci=realloc my AMD Instinct
MI50 comes up fully:
Memory at 800000000 (64-bit, prefetchable) [size=16G]
Memory at c00000000 (64-bit, prefetchable) [size=2M]
rocm-smi: VRAM Total Memory (B): 34342961152 # full 32 GB usable
Do not try pci=nocrs as a substitute — on this board it breaks the boot and drops you to
initramfs. I tested it; it is a dead end here.
6. Two warnings
- The setting is lost on every power loss. Cut the mains or pull the card and
Setup[0x001]
goes back to 0x00 and your GPU comes up without its BARs. If yours resets on a warm reboot
too, check the CMOS battery (CR2032) — replacing mine fixed exactly that symptom.
- If the box then hangs at
shutdown[1]: Rebooting., add reboot=pci to the kernel command line.
Unrelated to the above, but it is the other thing that bit me on this board.
Net result on MSI Z97 GAMING 3 + i7-4790K: MI50 32 GB running at full VRAM, 1725 MHz SCLK,
~160 W, stable. So yes — it works on this board. The offset is 0x001, not 0x2a9.