Page 1 of 2
uefi error unsupported when opening graphics output protocol
Posted: Tue Nov 10, 2020 7:22 pm
by austanss
Konichiwa, my OS dev friends.
<meme>
I am once again asking for your
electoral developmental support.
</meme>
Anyway, I've been working on my bootloader. There's a few bugs I need to fix before I can get it booting on real/random hardware. I've fixed majority of them, including a weird serial port dependency bug, a related memory map bug, and an ISO imaging bug.
With all this working, I've decided to test my OS again. It "boots". It'll launch the UEFI app, and stay there. However, there's a graphical bug that really hinders everything. It'll just
not open the Graphics Output Protocol. I get an EFI_UNSUPPORTED error. I don't know if it's an error in my code, or a problem with my machine. Either way, it's a critical bug for me if it means I have no way of testing my hopes and dreams. Anyway, I read somewhere that GOP was newer. My machine is relatively older for a UEFI machine (2012). Does my machine just not support GOP?
Supporting information:
--Bootloader Source--
https://github.com/microNET-OS/microCOR ... bootloader
--My Machine--
Model: HP Compaq Elite 8300 CMT (with some storage, ram, and graphics upgrades)
CPU: Intel Core i5-3470 (2012, Ivy Bridge, DDR3-era, Intel HD Graphics 2500)
BIOS: American Megatrends K01 v3.03 (HP version) [version that comes out-of-the-box with my computer is v2.02]
Year: 2012
Chipset: Intel Q77 Express
Misc: contains a serial port
Re: uefi error unsupported when opening graphics output prot
Posted: Tue Nov 10, 2020 7:26 pm
by nexos
How old is your machine? It might not support GOP and use UGA instead. I think one of my machines has that problem.
Re: uefi error unsupported when opening graphics output prot
Posted: Tue Nov 10, 2020 7:28 pm
by austanss
nexos wrote:How old is your machine? It might not support GOP and use UGA instead. I think one of my machines has that problem.
rizxt wrote:2012
8 years old...
I restated the age of my computer a few times ffs
Also I didn't specify the graphics card I used. My graphics card is a nVidia GTX 1050 Ti, so I don't think I have problems there, as it came out in 2017.
Re: uefi error unsupported when opening graphics output prot
Posted: Tue Nov 10, 2020 8:05 pm
by zaval
try this code:
Code: Select all
/* locating GOP. if we have it, we draw boot screen there */
Status = pbs->LocateProtocol(&gEfiGopGuid, NULL, &gGop);
if(Status != EFI_SUCCESS)gGop = NULL;
sorry, I don't use neither gcc nor gnuefi, so you need to translate into that. this function does fill interface pointer for GOP or returns EFI_NOT_FOUND if there is nothing to fill. gEfiGopGuid is the GOP GUID, gGop is a pointer to GOP interface (out parameter).
Re: uefi error unsupported when opening graphics output prot
Posted: Tue Nov 10, 2020 8:16 pm
by austanss
zaval wrote:try this code:
Code: Select all
/* locating GOP. if we have it, we draw boot screen there */
Status = pbs->LocateProtocol(&gEfiGopGuid, NULL, &gGop);
if(Status != EFI_SUCCESS)gGop = NULL;
sorry, I don't use neither gcc nor gnuefi, so you need to translate into that. this function does fill interface pointer for GOP or returns EFI_NOT_FOUND if there is nothing to fill. gEfiGopGuid is the GOP GUID, gGop is a pointer to GOP interface (out parameter).
that still doesn't help because if I don't have a functioning GOP I can't do jack ****. ofc there is the serial port but my pc is the only pc in the house with a serial port.
Re: uefi error unsupported when opening graphics output prot
Posted: Tue Nov 10, 2020 8:23 pm
by zaval
rizxt wrote:zaval wrote:try this code:
Code: Select all
/* locating GOP. if we have it, we draw boot screen there */
Status = pbs->LocateProtocol(&gEfiGopGuid, NULL, &gGop);
if(Status != EFI_SUCCESS)gGop = NULL;
sorry, I don't use neither gcc nor gnuefi, so you need to translate into that. this function does fill interface pointer for GOP or returns EFI_NOT_FOUND if there is nothing to fill. gEfiGopGuid is the GOP GUID, gGop is a pointer to GOP interface (out parameter).
that still doesn't help because if I don't have a functioning GOP I can't do jack ****. ofc there is the serial port but my pc is the only pc in the house with a serial port.
well, if your FW doesn't have GOP, it won't appear magically. there is also ConOut (a combo, collecting SIMPLE_TEXT_OUTPUT_PROTOCOL to various output devices), I don't know why you ignore it and my note about it in yet another thread of yours about UEFI. try using it, it's easier, than GOP, just printing letters onto diplay, my 2011 HP laptop with UEFI does support it fine.
Code: Select all
pout = pSystemTable->ConOut;
// ... and then
pout->OutputString(pout, L"lalalalala");
I mean, ConOut will print to all detected output devices, not only to serial port. you definitely should see your print with it on the screen (if you have done all correctly), because FW definitely will attach this to the display. in fact, you can both OutputString() and BitBlt() to the display (if that's a good idea
).
Re: uefi error unsupported when opening graphics output prot
Posted: Tue Nov 10, 2020 8:48 pm
by austanss
zaval wrote:rizxt wrote:zaval wrote:try this code:
Code: Select all
/* locating GOP. if we have it, we draw boot screen there */
Status = pbs->LocateProtocol(&gEfiGopGuid, NULL, &gGop);
if(Status != EFI_SUCCESS)gGop = NULL;
sorry, I don't use neither gcc nor gnuefi, so you need to translate into that. this function does fill interface pointer for GOP or returns EFI_NOT_FOUND if there is nothing to fill. gEfiGopGuid is the GOP GUID, gGop is a pointer to GOP interface (out parameter).
that still doesn't help because if I don't have a functioning GOP I can't do jack ****. ofc there is the serial port but my pc is the only pc in the house with a serial port.
well, if your FW doesn't have GOP, it won't appear magically. there is also ConOut (a combo, collecting SIMPLE_TEXT_OUTPUT_PROTOCOL to various output devices), I don't know why you ignore it and my note about it in yet another thread of yours about UEFI. try using it, it's easier, than GOP, just printing letters onto diplay, my 2011 HP laptop with UEFI does support it fine.
Code: Select all
pout = pSystemTable->ConOut;
// ... and then
pout->OutputString(pout, L"lalalalala");
I mean, ConOut will print to all detected output devices, not only to serial port. you definitely should see your print with it on the screen (if you have done all correctly), because FW definitely will attach this to the display. in fact, you can both OutputString() and BitBlt() to the display (if that's a good idea
).
There is one big problem with that, and I'll let you try to figure that one out.
(hint: exitbootservices/kernel)
Re: uefi error unsupported when opening graphics output prot
Posted: Tue Nov 10, 2020 9:16 pm
by zaval
you cannot use Boot Services and any protocols after that. you should check for GOP before, take its framebuffer paramateres, if it's present and use them after ExitBootServices(). if your system happened to not have GOP, then
\_(-.-)_/ but, it looks like there is something wrong with your approaches. did you at least check for the GOP presence as in the above example?
Re: uefi error unsupported when opening graphics output prot
Posted: Wed Nov 11, 2020 7:11 am
by austanss
zaval wrote:you cannot use Boot Services and any protocols after that. you should check for GOP before, take its framebuffer paramateres, if it's present and use them after ExitBootServices(). if your system happened to not have GOP, then
\_(-.-)_/ but, it looks like there is something wrong with your approaches. did you at least check for the GOP presence as in the above example?
I need to use GOP or alternative protocols that work after the boot services bite the dust.
As a side note, I've been attempting to update my BIOS in hopes that it works. (K01 3.03 -> K01 3.08)
Re: uefi error unsupported when opening graphics output prot
Posted: Wed Nov 11, 2020 3:51 pm
by Octocontrabass
You can use GOP before ExitBootServices() to find the frame buffer.
You can use the frame buffer after ExitBootServices(), but you'll have to provide your own font in order to display text.
You can find more information here.
Re: uefi error unsupported when opening graphics output prot
Posted: Wed Nov 11, 2020 4:30 pm
by zaval
rixzt, you seem to not understand, that all these things (text I/O prtocols, serial protocol, GOP and actually all protocols) are for the OS Loader and not for the OS. the concept is that after you call ExitBootServices() the FW doesn't own the system anymore and except Runtime Services isn't accessible. for the early stages of the OS initialization, there is video framebuffer, about which you get to know from GOP functions/fields. after your OSL owns the system, you can draw in that framebuffer by yourself. if your computer has diplay and is UEFI compliant (most probably), then it does have GOP. so get it through LocateProtocol() and take the needed information (metrics, address, pixels per scanline). then draw to it. if you cannot get GOP (improbably), then you are unlucky with this machine, try emulators.
Re: uefi error unsupported when opening graphics output prot
Posted: Thu Nov 12, 2020 2:09 pm
by bzt
rizxt wrote:I need to use GOP or alternative protocols that work after the boot services bite the dust.
There are no alternatives. It is a mandatory protocol for UEFI, it must be supported (so no alternatives exist). If you don't have GOP, that could only mean you have EFI 1.x (and not UEFI), for which only UGA exists.
You can use UGA to set the resolution, but sadly it does not return the frame buffer's address like GOP does, so
it sucks big time. You could use UGADraw's blit before ExitBootServices to store some magic bytes on the screen, then iterate on the GetMemoryMap list and match those magic bytes to figure out which memory entry record corresponds to the frame buffer. GRUB for example
parses the PCI bus to find the display device and then it reads the PCI BARs to get the frame buffer's address.
rizxt wrote:As a side note, I've been attempting to update my BIOS in hopes that it works. (K01 3.03 -> K01 3.08)
Upgrading from EFI to UEFI would definitely solve your issue of missing GOP. But K01 3.03 -> K01 3.08 doesn't sounds like a major upgrade.
Cheers,
bzt
Re: uefi error unsupported when opening graphics output prot
Posted: Thu Nov 12, 2020 9:20 pm
by austanss
zaval wrote:rixzt, you seem to not understand, that all these things (text I/O prtocols, serial protocol, GOP and actually all protocols) are for the OS Loader and not for the OS. the concept is that after you call ExitBootServices() the FW doesn't own the system anymore and except Runtime Services isn't accessible. for the early stages of the OS initialization, there is video framebuffer, about which you get to know from GOP functions/fields. after your OSL owns the system, you can draw in that framebuffer by yourself. if your computer has diplay and is UEFI compliant (most probably), then it does have GOP. so get it through LocateProtocol() and take the needed information (metrics, address, pixels per scanline). then draw to it. if you cannot get GOP (improbably), then you are unlucky with this machine, try emulators.
I know this. However you seem to know nothing about this at all. If you actually used UEFI at all, you must know that I know for a fact that you can use the GOP framebuffer after you exit boot services. It's undeniable. Cold hard evidence.
How can someone so unqualified say that I seem to "not understand"?
Re: uefi error unsupported when opening graphics output prot
Posted: Thu Nov 12, 2020 9:39 pm
by zaval
uhm, excuse me, can you read? then read yet once this:
for the early stages of the OS initialization, there is video framebuffer, about which you get to know from GOP functions/fields. after your OSL owns the system, you can draw in that framebuffer by yourself.
or any other response from several ones from other people, saying to you the same. no more responses from me. because of your clowning.
Re: uefi error unsupported when opening graphics output prot
Posted: Fri Nov 13, 2020 2:49 pm
by nexos
@zaval: How would UEFI prevent you from drawing to the framebuffer before ExitBootServices? It has no way of doing so! The OSL is running in kernel mode. It can draw to the framebuffer.