xCuri0 / ReBarUEFI

Resizable BAR for (almost) any UEFI system
MIT License
1.29k stars 57 forks source link

QUESTION ReBar setting in BIOS #203

Open xtomasnemec opened 1 month ago

xtomasnemec commented 1 month ago

Is there a way of adding the ReBar setting to the BIOS (AMI) trough AMIBCP?

xCuri0 commented 1 month ago

Not to my knowledge but it should be technically possible.

You will first need to modify ReBarDxe to read an offset in the Setup variable which will be the easiest part.

The hard part will be modifying the UEFI Internal Form Representation (IFR) to add an entry for Resizable BAR that controls the offset at in the Setup variable that you previously set. But no such IFR editor currently exists

@NikolajSchlej I've seen your work on IFR Extractor and UEFITool do you think it would be possible to modify the UEFI IFR structures to add (or replace if size limitation) a new entry ?

NikolajSchlej commented 1 month ago

Not via AMIBCP, no, but a DXE driver can indeed publish its own HII structures without a need to modify anything. Intel RAID OROMs do so, so do network card drivers and some other stuff. You can add this to ReBarDxe by reading this part of Driver Writers Guide: https://github.com/tianocore-docs/edk2-UefiDriverWritersGuide/tree/master/12_uefi_driver_configuration

NikolajSchlej commented 1 month ago

This assumes that ReBarDxe can be loaded before BIOS Setup is shown, which can be achieved by either adding it to DXE volume, or using DriverXXXX mechanism to load it in early BDS.

xCuri0 commented 1 month ago

@NikolajSchlej Didn't know this existed thanks for sharing. Would have gone with this method instead of current NVRAM variable if I knew at the start

And yes it's loaded very early during boot before PCI resources are even allocated

xtomasnemec commented 1 month ago

Thanks for the info