How did UEFI or legacy BIOS access video ROM?
-
- Member
- Posts: 25
- Joined: Sat May 04, 2024 7:48 am
- Libera.chat IRC: wishedtobe
How did UEFI or legacy BIOS access video ROM?
I think it is possible to use GOP after exiting boot services by pretending your program as UEFI and execute the video expansion ROM.But how does UEFI execute it?By the way,I found that my video card's expansion ROM contains nothing except a great deal of 0xff.I found the ROM header 0xaa55 in the mapping area of its BAR.Then I started wondering what the BIOS did.Many thanks for your answer.
-
- Member
- Posts: 5560
- Joined: Mon Mar 25, 2013 7:01 pm
Re: How did UEFI or legacy BIOS access video ROM?
It works the same as any other EFI driver. The UEFI specification explains it in more detail.wishedtobe wrote:But how does UEFI execute it?
Is it an onboard video device? Onboard devices usually don't have option ROMs attached to them. The option ROM (or at least the EFI driver) will be packed inside the main UEFI ROM.wishedtobe wrote:By the way,I found that my video card's expansion ROM contains nothing except a great deal of 0xff.
Which BAR? The ROM BAR is separate from the usual BARs, and it'll be disabled by default. You'll have to enable it and assign an address that doesn't conflict with anything before you can read the ROM.wishedtobe wrote:I found the ROM header 0xaa55 in the mapping area of its BAR.
Re: How did UEFI or legacy BIOS access video ROM?
You don't need to pretend anything, rather opposite, - read the spec and you'll know, how one could use GOP correctly, without pretending. If by "using" GOP, you mean being able to call the protocol's functions after ExitBootServices(), then, no, you can't do it, at least because all the protocols code and data belong to the EfiBootServicesCode and EfiBootServicesData types and after ExitBootServices(), your OS is free to use these pages as it wants, they won't be properly mapped in the new address space anyway and overall, Boot Services have shutdown themselves and aren't accessible for many reasons, hidden behind implementation details. If you mean accessing the framebuffer, reported by GOP, with the set resolution, then you can access it, given you mapped it correctly in your environment address space (virtual, process, processor, whatever you call it).wishedtobe wrote: I think it is possible to use GOP after exiting boot services by pretending your program as UEFI and execute the video expansion ROM.
On UEFI platforms, you don't have to bother with all this - expansion ROM etc, just use GOP reported resources. Only when your fully fledged display controller driver is ready to get its hands dirty in handling its hardware, you start to worry about proper setting/configuring the hardware in question, reading its specification, given such exists.But how does UEFI execute it?By the way,I found that my video card's expansion ROM contains nothing except a great deal of 0xff.I found the ROM header 0xaa55 in the mapping area of its BAR.Then I started wondering what the BIOS did.Many thanks for your answer.
Of course, if your goal is a normal OS, not some frankenstein, that would want to "pretend" of being a UEFI application or something else.