OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Apr 27, 2024 1:07 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Strange GOP handle
PostPosted: Tue Jan 02, 2024 9:15 pm 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 1071
Hello,
I have recently made my bootloader work on EFI based systems. However, when I call locate LocateHandle for the GOP, two handles are returned, even though I only have one display. This is true on OVMF and most hardware I've tested (an HP Pavillion and a MacBook Pro), but was not true on a Dell OptiPlex. Even stranger is that the only supported mode is 1x120, which doesn't even seem valid to me. My only guess is that this is GOP representation of ConOut, but I'm not sure. Does anyone know what this mysterious handle is?

Thanks,
nexos

_________________
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg


Top
 Profile  
 
 Post subject: Re: Strange GOP handle
PostPosted: Tue Jan 02, 2024 10:38 pm 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
One of the GOP entry is the "Console Splitter". It is basically a virtual device used to draw on all screens at the same time. It doesn't represent a real hardware device. You can identify this entry by checking if it has a device path. Here is how I handle it:

Code:
for (auto handle : handles)
    {
        efi::DevicePathProtocol* dpp = nullptr;
        if (efi::Error(bootServices->HandleProtocol(handle, &efi::kDevicePathProtocolGuid, (void**)&dpp)))
            continue;

        // If dpp is null, this is the "Console Splitter" driver. It is used to draw on all
        // screens at the same time and doesn't represent a real hardware device.
        if (!dpp)
            continue;

        ...



Having only one supported mode of 1x120 doesn't make sense, verify that your structures/protocols are properly defined.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: Strange GOP handle
PostPosted: Wed Jan 03, 2024 4:10 pm 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 1071
That makes sense. I'll check on why it only reports on that resolution

_________________
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg


Top
 Profile  
 
 Post subject: Re: Strange GOP handle
PostPosted: Thu Jan 04, 2024 10:41 am 
Offline
Member
Member
User avatar

Joined: Fri Feb 17, 2017 4:01 pm
Posts: 642
Location: Ukraine, Bachmut
Also, some firmwares expose funny bugs on that instance. e.g. my old laptop HP Probook 4530s. This handle's GOP instance doesn't cause drawing, when using its Blt() even though the latter returns success. But the drawing appears on the screen after the loader exits to the fw, for short duration before the fw's Boot Manager redraws its own UI. You also can make it stay for longer, just don't turn off the event on the redrawing callback. :mrgreen:


To kzinti, I am wondering, what made you include that code into your loader? I am asking because for the vast majority of machines, both VMs and real hardware this no DevicePath instance handle works just as fine as the other one. For me, only for the aforementioned laptop it didn't. I didn't see any hints on this in the spec. Without them this trickery looks like a bitter experience, trial and error. I refused to insert this hack, thinking it's just an oddity of a particular FW on a particular group of one vendor hw. What inspired to you insert it?

Also, interesting to note, that the spec says, all the handles must have Device Path instance installed. This weirdo handle returns EFI_NOT_SUPPORTED btw. even the reference implementation screws the spec up.

_________________
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).


Top
 Profile  
 
 Post subject: Re: Strange GOP handle
PostPosted: Thu Jan 04, 2024 11:03 am 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
zaval wrote:
To kzinti, I am wondering, what made you include that code into your loader?

I am simply doing this to enumerate available display devices that can be used by my kernel. At this time I only have a generic display driver that needs memory-mapped framebuffers.

I discovered this "fake display" while attempting to retrieve EDID data for each display. IIRC, it doesn't have any.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: Strange GOP handle
PostPosted: Thu Jan 04, 2024 1:09 pm 
Offline
Member
Member
User avatar

Joined: Fri Feb 17, 2017 4:01 pm
Posts: 642
Location: Ukraine, Bachmut
I see, thank you. Well, I just pass the framebuffer base in the loader block so far. :D

_________________
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).


Top
 Profile  
 
 Post subject: Re: Strange GOP handle
PostPosted: Thu Jan 04, 2024 3:53 pm 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 1071
The only problem with checking if the handle has a device path is that U-Boot (oddly) appears to not put device paths on any GOP handles. Which IMO is a bug on their part.

_________________
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg


Top
 Profile  
 
 Post subject: Re: Strange GOP handle
PostPosted: Mon Jan 15, 2024 9:51 am 
Offline
Member
Member
User avatar

Joined: Fri Feb 17, 2017 4:01 pm
Posts: 642
Location: Ukraine, Bachmut
nexos wrote:
The only problem with checking if the handle has a device path is that U-Boot (oddly) appears to not put device paths on any GOP handles. Which IMO is a bug on their part.

If so, it is certainly a bug. Are you sure, uboot doesn't put a DPP instance at any GOP handles?

After this topic kicked in, I gave it a thought and decided to add filtering out this DDP-less handle in my code. Now my work HP Probook 4530s happily paints the Boot Screen,
Image
but I realized, this new code wouldn't paint anything on "powered by uboot" :mrgreen: ARM machines. Which I can't test now on my own, unfortunately.

_________________
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).


Top
 Profile  
 
 Post subject: Re: Strange GOP handle
PostPosted: Thu Jan 18, 2024 6:21 pm 
Offline
Member
Member
User avatar

Joined: Fri Feb 17, 2017 4:01 pm
Posts: 642
Location: Ukraine, Bachmut
btw, nexos, in addition to the previous question, could you please tell the board(s), which you've experienced this behavior with? I went through the list of defconfigs in mainline uboot and was shocked to see, that basically only some rk3399 ones have GOP support. Personally, I worked with an exactly such one - Rock Pi 4B, but I believed, there are more SoCs having this level of support. thanks edk2 ports start to appear.

_________________
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).


Top
 Profile  
 
 Post subject: Re: Strange GOP handle
PostPosted: Sat Jan 20, 2024 7:11 am 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 1071
I've personally only tested U-Boot in a QEMU virtual machine on RISC-V. It was using VGA as the display hardware. I'll have to fire up an ARM virtual machine with U-Boot to test it. Normally I test ARM with EDK2 as it superior in almost every way (IMO).

_________________
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 23 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group