Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boots into windows but unable to access bios with ReBAR at or greater than 4gb #4

Open
SqueakyAlex opened this issue Oct 29, 2022 · 20 comments
Labels
bios issue with firmware that needs patching help wanted Extra attention is needed

Comments

@SqueakyAlex
Copy link

  • Motherboard: Gigabyte z170x-Gaming 7 rev. 1.0
  • BIOS Version: F22m
  • GPU: Radeon RX6800

Easily managed to set it up and get it running.
After some quick testing I found out that...

1gb = According to Radeon drivers (ver22.10.2) and GPU-Z, ReBAR gets enabled, works as expected.
2gb = Halts on bootlogo, unable to enter bios. Need to reset bios.
4gb+ = Boots into Windows but unable to see bootlogo during boot and unable to enter bios, trying to enter bios using the Windows troubleshooting menu also fails. (tested up to 16gb with the same behavior)

Did some benchmarks on 4gb and 16gb to test for system instability, all seemed fine except that I was unable to see the bootlogo on boot or access the bios which can be confusing because during the whole booting process it does seem like the computer has failed to post.

rebar enabled

@xCuri0 xCuri0 added bios issue with firmware that needs patching help wanted Extra attention is needed labels Oct 30, 2022
@xCuri0
Copy link
Owner

xCuri0 commented Oct 30, 2022

CSM is off right ? Don't believe what GPU-Z says about CSM or 4G decode because it's often wrong

@SqueakyAlex
Copy link
Author

Yes, verified that CSM is off and 4G decode is enabled.

I do get a performance boost when its set to 4gb+, its just that I'm unable to enter the bios and the screens stay off during boot until windows logon screen shows.

Just noticed on your winraid forum post that someone else is having a similar problem with the same board, just diff gpu.

@xCuri0
Copy link
Owner

xCuri0 commented Oct 30, 2022

@SqueakyAlex yeah the bios probably needs patching. I had to patch my bios (gigabyte b75m-d3h) to get BARs over 2GB to work. But I haven't made a patch to fix this issue since I don't have it.

Can you send a screenshot of Device Manager resources tab for your GPU when using 1GB BAR ?

@SqueakyAlex
Copy link
Author

SqueakyAlex commented Oct 30, 2022

1GB Bar
gpu resources 1gb

Some unrequested extras
4GB Bar
gpu resources 4gb

16GB Bar
gpu resources 16gb

Had not noticed before, high definition audio bus gets disabled when using 4GB+ bar.
Hi Def Audio Bus no resources

@xCuri0
Copy link
Owner

xCuri0 commented Oct 30, 2022

@SqueakyAlex the issue of High Definition Audio Bus not having enough resources can be fixed by patching the PciHostBridge module's call to AddMemorySpace to increase the size it uses (and DSDT QWordMemory too if needed).

EDIT: This isn't the case, AddMemorySpace adds a 64GB region which is more than enough

image

@SqueakyAlex
Copy link
Author

Assuming your patches would not work for Skylake, I spent a few hours checking pcihostbrige on ghidra and came to the conclusion that I don’t know what I’m looking for and that I know nothing about assembly.

Eventually I did try your patches and as expected the result was "No patches can be applied to input file"

I did manage to extract my DSDT and found this

                CreateDWordField (BUF0, \_SB.PCI0._Y0E._MIN, M1MN)  // _MIN: Minimum Base Address
                CreateDWordField (BUF0, \_SB.PCI0._Y0E._MAX, M1MX)  // _MAX: Maximum Base Address
                CreateDWordField (BUF0, \_SB.PCI0._Y0E._LEN, M1LN)  // _LEN: Length
                Store (M32L, M1LN) /* \_SB_.PCI0._CRS.M1LN */
                Store (M32B, M1MN) /* \_SB_.PCI0._CRS.M1MN */
                Subtract (Add (M1MN, M1LN), One, M1MX) /* \_SB_.PCI0._CRS.M1MX */
                If (LGreaterEqual (OSYS, 0x07D6))
                {
                    If (LEqual (M64L, Zero))
                    {
                        CreateQWordField (BUF0, \_SB.PCI0._Y0F._LEN, MSLN)  // _LEN: Length
                        Store (Zero, MSLN) /* \_SB_.PCI0._CRS.MSLN */
                    }
                    Else
                    {
                        CreateQWordField (BUF0, \_SB.PCI0._Y0F._LEN, M2LN)  // _LEN: Length
                        CreateQWordField (BUF0, \_SB.PCI0._Y0F._MIN, M2MN)  // _MIN: Minimum Base Address
                        CreateQWordField (BUF0, \_SB.PCI0._Y0F._MAX, M2MX)  // _MAX: Maximum Base Address
                        Store (M64L, M2LN) /* \_SB_.PCI0._CRS.M2LN */
                        Store (M64B, M2MN) /* \_SB_.PCI0._CRS.M2MN */
                        Subtract (Add (M2MN, M2LN), One, M2MX) /* \_SB_.PCI0._CRS.M2MX */
                    }
                }

@xCuri0
Copy link
Owner

xCuri0 commented Oct 30, 2022

@SqueakyAlex Just send a screenshot of Device Manager showing Resources By Type Large Memory it will show how much the space the DSDT gives.

The only patches I developed are for Ivy Bridge systems and maybe a few Haswell ones which is why it finds nothing to patch. I hope that more patches are contributed in the future because I can't test hardware that I don't have.

@SqueakyAlex
Copy link
Author

SqueakyAlex commented Oct 30, 2022

devman large memory

If I didnt mess up, thats about 64GB?

@Pentium320
Copy link

Hi,
Looks, like I'm having the same issue on X99 platform, maybe there is something, that could be helpful.

  • CPU: Intel Xeon E5-2697 v3 2.6GHz
  • Motherboard: ASRock X99 Extreme4
  • BIOS Version: 3.60 (with Turbo Unlock mod)
  • GPU: AMD Radeon RX 6700 XT 12GB

Behaviour is the same as in this thread after applying ReBAR patch:
up to 1024M (2^10) - ReBAR seems to be working as intended
2048M (2^11) - system doesn't post at all, speaker gives 8 beeps (AFAIK it indicates GPU error). CMOS reset needed.
4096M (2^12) and above - unable to enter BIOS, no Post Screen, speaker gives 5 beeps, PC boots directly into Windows and ReBAR seems to be working. AMD HD Audio is broken (error code: 12). Performance has increased a bit.

Screenshot 2022-11-07 163425fsafas

CSM disabled, 4G decode enabled.

If there is anything useful, that I could provide to resolve the issue, tell me. Thanks for your work!

@xCuri0
Copy link
Owner

xCuri0 commented Nov 8, 2022

If anyone wants to try and develop patches to fix it you can search for "ffffffff000" in the PciBus module on your disassembler to find the code that reads the BAR size and categorizes them as 32-bit (4/5) or 64-bit (6/7).

@soulpower11
Copy link

My High Definition Audio Bus got disabled too
image

Not sure what to do as I am new to bios modding

@xCuri0
Copy link
Owner

xCuri0 commented Nov 13, 2022

Try booting Linux with 4GB+ BAR and seeing what dmesg says.

@zirblazer
Copy link

Try booting Linux with 4GB+ BAR and seeing what dmesg says.

Unrelated to your ReBarUEFI, but while testing different Above 4G settings to do comparisons on PCIe Root Port default allocations between AMI BIOS and Coreboot to track a bug, I discovered that recent amdgpu versions can enable Above 4G Decoding and ReBAR completely OS side even if they're disabled on Firmware: Dasharo/dasharo-issues#245
This means than with AMD cards is a hit-or-miss to check Linux unless you're paying attention to original allocations before amdgpu forces a PCI MMIO reconfiguration. Or maybe if amdgpu has a parameter to disable this default behavior and obey Firmware resource allocation.

@xCuri0
Copy link
Owner

xCuri0 commented Dec 24, 2022

One Asrock X99 Taichi user on win-raid found this out
image

So try disabling the option Above 4G Decoding Patch using the IFR method if it's hidden

@Dadovvv
Copy link

Dadovvv commented Jun 9, 2023

can anyone tell me how to disable Above 4g Decoding Patch? what line should i edit and what?

i extracted body from my bios where search find 4g decoding but im unable to find any string related to above 4g decoding patch. is that mean i cant disable 4g Decoding patch or ?

@xCuri0
Copy link
Owner

xCuri0 commented Jun 9, 2023

@Dadovvv please read wiki common issues and fixes. if you can't find the string then the setting doesn't exist

@Igo131
Copy link

Igo131 commented Jan 18, 2024

One Asrock X99 Taichi user on win-raid found this out image

So try disabling the option Above 4G Decoding Patch using the IFR method if it's hidden

This works only for mobos that don't have native Above 4G Decoding option or i should try this even if i have the switch in my mobo?
Disabling Above 4G Decoding option in GA-Z170m-D3H bios while ReBarState is on leads me to B1InitializeLirary failed 0xc00000bb code on a distorted and freezed BIOS splash screen (first seconds screen is normal and i can enter bios but the OS won't load further).

@MrAnonymous7122
Copy link

Hi, I have a H110M-R which has a LGA1151 socket. For me, display blacks out mid way through the booting process (it's past the boot screen with del for bios and then past the asus logo with win11 spin). My CPU does has an iGPU but the problem is I didn't build this PC myself and the motherboard IO shield has something physically blocking the port from being used. Is there anyway around this or do I have to remove the motherboard from the case and remove the blocker? I'm not sure if this is relevant but the mouse and keyboard are still receiving power and it shuts down normally upon pressing the power button on the case.

@MrAnonymous7122
Copy link

Strangely, after writing this comment it works? It's booted to windows normally and display and sound work fine through HDMI. I will add to working motherboards in a sec.

@mirh
Copy link

mirh commented Mar 18, 2024

FWIW I had found out that when I'm just using the igp of my i5-9600K (on a Z390 GAMING X with F10i bios) I'm getting a black screen with aperture sizes higher than 1024MB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bios issue with firmware that needs patching help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

9 participants