[Request] Above 4G decoding for AsRock z97 Extreme 9 and Asus P8P67 evo

Hi @Kuri0 , are you talking about the z97 motherboard?

@prazola Yes

1 Like

Ok, I’ll search for a spare SSD and I’ll go with something fast to install like Ubuntu.
I’ll get back to you asap.

@Kuri0 Ok, linux works fine with the option enabled in BIOS.
lspci says BAR is still 256Mb but amdgpu drivers are working correctly.

This is the dmesg output:

[    0.158658] pci 0000:00:01.0:   bridge window [mem 0xbe0000000-0xbf01fffff 64bit pref]
[    0.158951] pci 0000:01:00.0:   bridge window [mem 0xbe0000000-0xbf01fffff 64bit pref]
[    0.159203] pci 0000:02:08.0:   bridge window [mem 0xbe0000000-0xbf01fffff 64bit pref]
[    0.159459] pci 0000:03:00.0:   bridge window [mem 0xbe0000000-0xbf01fffff 64bit pref]
[    0.159514] pci 0000:05:00.0: reg 0x10: [mem 0xbe0000000-0xbefffffff 64bit pref]
[    0.159525] pci 0000:05:00.0: reg 0x18: [mem 0xbf0000000-0xbf01fffff 64bit pref]
[    0.159933] pci 0000:04:00.0:   bridge window [mem 0xbe0000000-0xbf01fffff 64bit pref]
[    0.174352] pci 0000:04:00.0:   bridge window [mem 0xbe0000000-0xbf01fffff 64bit pref]
[    0.174365] pci 0000:03:00.0:   bridge window [mem 0xbe0000000-0xbf01fffff 64bit pref]
[    0.174375] pci 0000:02:08.0:   bridge window [mem 0xbe0000000-0xbf01fffff 64bit pref]
[    0.174389] pci 0000:01:00.0:   bridge window [mem 0xbe0000000-0xbf01fffff 64bit pref]
[    0.174396] pci 0000:00:01.0:   bridge window [mem 0xbe0000000-0xbf01fffff 64bit pref]
[    0.174451] pci_bus 0000:01: resource 2 [mem 0xbe0000000-0xbf01fffff 64bit pref]
[    0.174454] pci_bus 0000:02: resource 2 [mem 0xbe0000000-0xbf01fffff 64bit pref]
[    0.174456] pci_bus 0000:03: resource 2 [mem 0xbe0000000-0xbf01fffff 64bit pref]
[    0.174459] pci_bus 0000:04: resource 2 [mem 0xbe0000000-0xbf01fffff 64bit pref]
[    0.174461] pci_bus 0000:05: resource 2 [mem 0xbe0000000-0xbf01fffff 64bit pref]


@prazola yeah it is a DSDT problem like I said. Fixed DSDT will get resizable BAR working on Linux too.

Can you also send the output of “sudo cat /proc/iomem”. I want to make sure there aren’t any resource conflicts when making the DSDT.

Also “cat /proc/cpuinfo”. I think your CPU has 39 bit physical address but I want to make sure.

And send a DSDT dump from “/sys/firmware/acpi/tables/DSDT” so we can test DSDT before BIOS flash.

iomem:

00000000-00000fff : Reserved
00001000-00057fff : System RAM
00058000-00058fff : Reserved
00059000-0009dfff : System RAM
0009e000-0009ffff : Reserved
000f0000-000fffff : System ROM
00100000-d6a5d017 : System RAM
d6a5d018-d6a7ae57 : System RAM
d6a7ae58-d704dfff : System RAM
d704e000-d7054fff : ACPI Non-volatile Storage
d7055000-d7cfbfff : System RAM
d7cfc000-d81ecfff : Reserved
d81ed000-de3e8fff : System RAM
de3e9000-de463fff : Reserved
de464000-de4acfff : System RAM
de4ad000-de5f2fff : ACPI Non-volatile Storage
de5f3000-deffefff : Reserved
defff000-deffffff : System RAM
df000000-dfffffff : RAM buffer
efb00000-efefffff : PCI Bus 0000:01
  efb00000-efdfffff : PCI Bus 0000:02
    efb00000-efdfffff : PCI Bus 0000:03
      efb00000-efcfffff : PCI Bus 0000:04
        efb00000-efcfffff : PCI Bus 0000:05
          efb00000-efbfffff : 0000:05:00.0
          efc00000-efc1ffff : 0000:05:00.0
          efc20000-efc23fff : 0000:05:00.1
          efc20000-efc23fff : ICH HD audio
      efd00000-efd03fff : 0000:03:00.0
  efe00000-efe3ffff : 0000:01:00.0
eff00000-eff1ffff : 0000:00:19.0
  eff00000-eff1ffff : e1000e
eff20000-eff207ff : 0000:00:1f.2
  eff20000-eff207ff : ahci
eff21000-eff213ff : 0000:00:1d.0
  eff21000-eff213ff : ehci_hcd
eff22000-eff223ff : 0000:00:1a.0
  eff22000-eff223ff : ehci_hcd
eff23000-eff23fff : 0000:00:19.0
  eff23000-eff23fff : e1000e
effe0000-effeffff : pnp 00:06
f0000000-f7ffffff : PCI MMCONFIG 0000 [bus 00-7f]
  f0000000-f7ffffff : Reserved
    f0000000-f7ffffff : pnp 00:06
fec00000-fec00fff : Reserved
  fec00000-fec003ff : IOAPIC 0
fed00000-fed03fff : Reserved
  fed00000-fed003ff : HPET 0
    fed00000-fed003ff : PNP0103:00
fed10000-fed17fff : pnp 00:06
fed18000-fed18fff : pnp 00:06
fed19000-fed19fff : pnp 00:06
fed1c000-fed1ffff : Reserved
  fed1c000-fed1ffff : pnp 00:06
    fed1f410-fed1f414 : iTCO_wdt.1.auto
      fed1f410-fed1f414 : iTCO_wdt.1.auto iTCO_wdt.1.auto
fed20000-fed3ffff : pnp 00:06
fed40000-fed44fff : pnp 00:00
fed45000-fed8ffff : pnp 00:06
fed90000-fed90fff : dmar0
fee00000-fee00fff : Local APIC
  fee00000-fee00fff : Reserved
ff000000-ffffffff : Reserved
  ff000000-ffffffff : INT0800:00
    ff000000-ffffffff : pnp 00:06
100000000-41fffffff : System RAM
  406000000-407002547 : Kernel code
  407200000-407d20fff : Kernel rodata
  407e00000-40811a77f : Kernel data
  40894c000-408dfffff : Kernel bss
be0000000-bf01fffff : PCI Bus 0000:01
  be0000000-bf01fffff : PCI Bus 0000:02
    be0000000-bf01fffff : PCI Bus 0000:03
      be0000000-bf01fffff : PCI Bus 0000:04
        be0000000-bf01fffff : PCI Bus 0000:05
          be0000000-befffffff : 0000:05:00.0
          bf0000000-bf01fffff : 0000:05:00.0
bfff00000-bfff0ffff : 0000:00:14.0
  bfff00000-bfff0ffff : xhci-hcd
bfff10000-bfff13fff : 0000:00:1b.0
  bfff10000-bfff13fff : ICH HD audio
bfff14000-bfff140ff : 0000:00:1f.3
7c00000000-7fffffffff : 0000:05:00.0

cpuinfo:

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 60
model name	: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
stepping	: 3
microcode	: 0x28
cpu MHz		: 933.202
cache size	: 8192 KB
physical id	: 0
siblings	: 8
core id		: 0
cpu cores	: 4
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts md_clear flush_l1d
vmx flags	: vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple
bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit srbds
bogomips	: 7981.78
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

DSDT dump in the attachment:
cat_n_dd.zip (23.7 KB)

I did these changes to the DSDT.

Added QWordMemory region. EDIT: Added - One to fix error

				QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x0000000000000000, // Granularity
                    0x0000000000010000, // Range Minimum
                    0x000000000001FFFF, // Range Maximum
                    0x0000000000000000, // Translation Offset
                    0x0000000000010000, // Length
                    ,, _YAF, AddressRangeMemory, TypeStatic)
                CreateQWordField (BUF0, \_SB.PCI0._YAF._LEN, M2LN)  // _LEN: Length
				CreateQWordField (BUF0, \_SB.PCI0._YAF._MIN, M2MN)  // _MIN: Minimum Base Address
				CreateQWordField (BUF0, \_SB.PCI0._YAF._MAX, M2MX)  // _MAX: Maximum Base Address

				// 39-bit for Haswell
				M2MX = 0x8000000000 - One

				If ((TUUD >= 0x1000))
				{
					M2MN = (TUUD << 0x14)
				}
				Else
				{
					M2MN = 0x0000000100000000
				}
				
				M2LN = (M2MX - M2MN) + One

And removed some entries I think aren’t needed (like lid, dock and battery) to reduce the size (this only matters when modifying it in BIOS but better to test now). Resizable BAR should work on Linux now and test stuff like sleep too.

If anything doesn’t work send dmesg output.

DSDTMod.zip (22.3 KB)

Copy DSDTMod.aml to /boot/. While on the GRUB menu press e to edit the Ubuntu entry and add a line acpi /boot/DSDTMod.aml at the end and press CTRL+X to boot.

If it all works we can go to the next step of getting the modded DSDT into the BIOS so it works on Windows.

1 Like

Grat job Kuri0, it works!

Awesome now I’ll send modded BIOS with the DSDT. Hope you have a BIOS flasher though in-case anything goes wrong

Not anymore, but the Mobo has two removable BIOS chip, so I should be safe.

Z97Ex9_200_DSDT.zip (4.4 MB)

@prazola Here is the BIOS with modded DSDT. I used AmiBoardInfoTool to edit it.

If it all works next step is adding the Resizable BAR DXE and hope we don’t need modifications to PciHostBridge (difficult)

Windows 10 show a blue screen with acpi error.
Stop code acpi bios error.

Fedora works fine.

The PCI submenu is not present in BIOS

@prazola Can you send full dmesg log ? I probably did something wrong when reducing size which caused the ACPI error and Linux should tell why. I didn’t base it on the BIOS by boombastik so it won’t have the submenu (still can use setup_var to enable 4g)

4G was enabled by default in your BIOS.
dmesg.zip (23.8 KB)

It’s most likely this error causing the BSOD:

acpi PNP0A08:00: host bridge window [mem 0x420000000-0x8000000000 window] ([0x8000000000-0x8000000000] ignored, not CPU addressable)

I’ll fix that and send another BIOS

@prazola
Here is fixed DSDT BIOS. I’ve fixed the error I mentioned.
Z97Ex9DSDTFIXED.zip (4.4 MB)

2 Likes

Great, it boots!

1 Like

Nice!

@prazola Now that all problems with 4G Decoding are fixed I inserted the Resizable BAR DXE driver before PciHostBridge with UEFITool.

Z97Ex9ReBar.zip (4.4 MB)

After flashing that BIOS. I recommend you compile the tool RebarState from source code ReBarState.cpp · GitHub because it’s most likely going to set off antivirus warnings since it writes to UEFI variables. If you don’t want to compile it you can find it in the ZIP below.

ReBarState.zip (8.5 KB)

Start by setting it to 9 and reboot. Keep increasing it by 1 until either you get Resizable BAR full size (16GB for you) or you get black screen/POST error (this means PciHostBridge needs patching).

Always make sure 4G decoding is enabled if RebarState is set or you will get black screen

If you get black screen/POST error you can fix it by booting without GPU inserted and setting RebarState to 0. Or restore the previous BIOS through flashing or swapping chip.

2 Likes

I cannot build it, SetFirmwareEnvironmentVariableEx function is not declared.

@prazola
Using Visual Studio ? I don’t get any errors building it on Visual Studio 2022. SetFirmwareEnvironmentVariableEx is included in the Windows.h header

Also make sure to build it x64

1 Like

Was using codeblocks. I’m using your exe now.
Ok, the max I get is 2^13, then black screen:

Ok @Kuri0 I think you just made my day! REBAR working also for AMD control panel. If you’ll ever get in Trento (Italy) I owe you dinner and drinks.

Thank you very much, I really wasn’t expecting this responsivness, felt like better than an official AsRock support! <3

1 Like