Detecting a CMOS reset


Hi I've made a module to enable Resizable BAR on older systems which uses an NVRAM variable to be enabled/set the maximum BAR size. It works without any issues however I've found that not all motherboards clear the NVRAM variables with a CMOS reset.

This is an issue since a CMOS reset will disable 4G decoding which is required for Resizable BAR and having it disabled will result in no POST, the only way to fix it being boot with iGPU/non-rebar GPU to set NVRAM variable to disabled. So I'm looking for a way to detect a CMOS reset so my module can disable itself/delete the NVRAM variable.

I've looked through the EDK2 documentation but haven't found any ways of detecting a CMOS reset.


Generally, There is a byte reserved for checksum, if the checksum corrupted, a cmos reset is supposed happened.