4G decode / PCI bug fix

System is dell inspiron 5576, work with latest BIOS.

Above 4G decode is hidden in BIOS (broken menu) but can be enabled from efi shell.

At that point win10 is stuck and laptop restarts.

I found guide about DSDT patching at [GUIDE] DSDT override to fix error 12 - DIY e-GPU Projects - Tech|Inferno Forums and applied that, guide includes single CRS patch while this system have CRS1 and CRS2, unsure what does CRS2 do and which values to put there i patched CRS1 only.

Without 4G decode enabled win10 boots and large memory appears in dev manager.

With 4G decode enabled win10 crashes like before, while Ubuntu 22.04 with pci=nocrs boots until internal graphics crash - dmesg posted at Laptop Support · Issue #16 · xCuri0/ReBarUEFI · GitHub

Is this large memory feature exclusive to above 4g decoding, or it can exist independently?
What is CRS2 used for and should i patch that too?

Another problem, not related to 4G decoding, after trying to load different vBIOS for dGPU i got AE_AML_BUFFER_LIMIT

   Capabilities: [270 v1] Secondary PCI Express
       LnkCtl3: LnkEquIntrruptEn- PerformEqu-
       LaneErrStat: 0

changed to

Capabilities: [270 v1] #19

updates: Capabilities: [270 v1] #19 shows up on ubuntu 16.04 with kernel 5.6, on ubuntu 22.04 it is properly shown again. most likely not related to the bug.

ATRM method is part of SSDT.
Checking all the capabilities in pci space revealed there are missing IO space, memory space, bus mastering and MSI enable bits on win7.

With linux drivers, only bus mastering and MSI are disabled. Yes, MSI address is zero, one more flag is indicatibg disabled feature - DisINTx

There is one issue with mmio values from techinferno guide: HDMI Audio not starting in win10

Start of the range is C2000000 which is far beyond assigned range for audio bus with unmodified DSDT so no overlap here. But something else breaks it.

In mmio space, realtek audio is just after HDMI audio and it works with patched DSDT. Anyone know what the problem is with this?

Is there anything ACPI or PCI related in GOP file? I have UEFI enabled with CSM disabled and secure boot off, so far i know if GOP is not patched secure boot breaks.
Does it affect non secure boot in any way?
After enabling Above 4G decode the screen is just stuck on dell logo, in background it boots untill gfx_ring crash

Getting nowhere with this. Aside from broken HDMI audio, large memory is available and few different assignments of space in sizes of ~8 to 64GB all giving same behaviour regarding audio bus.
It might be enough for dGPU resizable bar, but i doubt remapping will work as expected.

Tried to handle this bug, output is with above 4g decode and DSDT large memory enabled + pci=nocrs

[    0.313218] kernel: ACPI BIOS Error (bug): AE_AML_BUFFER_LIMIT, Field [MN8H] at bit offset/length 13216/32 exceeds size of target Buffer (1920 bits) (20220331/dsopcode-198)
[    0.313225] kernel: fbcon: Taking over console
[    0.313242] kernel: 
[    0.313244] kernel: 
                       Initialized Local Variables for Method [_CRS]:
[    0.313245] kernel:   Local0: 00000000b7d2daba <Obj>           Integer 0000000000000674
[    0.313256] kernel: 
[    0.313257] kernel: No Arguments are initialized for method [_CRS]
[    0.313258] kernel: 
[    0.313260] kernel: ACPI Error: Aborting method \_SB.PCI0._CRS due to previous error (AE_AML_BUFFER_LIMIT) (20220331/psparse-529)
[    0.313315] kernel: ACPI Error: Method execution failed \_SB.PCI0._CRS due to previous error (AE_AML_BUFFER_LIMIT) (20220331/uteval-68)

by patching MN8H to qword

This is what happens in different scenarios:

No any kind of patches, above 4g disabled ---------------------------------------> both GPU start
No any kind of patches, above 4g disabled, boot with pci=nocrs -----> int gfx start, dGPU breaks with the message as above pointing at MN8H
Patch MN8H to qword, above 4g disabled, boot with pci=nocrs ------> both GPU start and no ACPI error in log

Patch DSDT to enable large memory, above 4g enabled, pci=nocrs → breaks at int gfx, output in github
Patch DSDT to enable large memory and MN8H to qword, above 4g enabled, pci=nocrs → breaks at int gfx, same as above
Patch DSDT to enable large memory and MN8H to qword, above 4g enabled → unknown, the boot hangs, stuck on dell logo, breaks very early and there is no dmesg file in log directory for this boot attempt