While looking at boot and runtime misbehaviour on UEFI systems I would like to know if CSM is enabled or not, but the question is how does one detect CSM support? Well, making the assumption that CSM is generally enabled to support Int 10h video calls, we look for any video option ROMs and see if the real mode Int 10h vector is set to jump to a handler in one of the ROMs.
Option ROMs are found in the region 0xc0000 to 0xe0000 and normally the video option ROM is found at 0xc0000. Option ROMs are found on 512 byte boundaries with a header bytes containing 0x55, 0xaa and ROM length (divided by 512) so we just mmap in 0xc0000..xe0000 and then scan the memory for headers to locate option ROM images.
My assumption for CSM being enabled is that Int 10h vectors into one of these option ROMs, and we can assume it is a video option ROM if it contains the string "VGA" somewhere in the ROM image. Yes, it is a hack, but it seems to work on the range of UEFI enabled systems I've so far used.
For reference, I've put the code in my debug-code git repository and available for anyone to use.
I've also added a CSM test to the Firmware Test Suite (fwts). One can install fwts and run the test on Ubuntu by using:
sudo apt-get install fwts
sudo fwts csm -
I realize this is an old post, but I hope you see this and comment, would you know how I would find a video card that works with UEFI Secure Boot, which requires CSM to be disabled? I have an EVGA GTX 580 and when I boot with Secure Boot enabled, it says something about the VGA card lacking a UEFI driver, so CSM is forced enabled, which disables or degrades Secure Boot. I can find so little information on this, so would you know any way to about this? I want a GTX 680 that does not require CSM to be disabled, preferably a 4GB RAM version..
ReplyDelete