[PATCH] efi: video: fix mode info in payload mode

Ben Wolsieffer ben.wolsieffer at hefring.com
Tue Nov 4 16:28:52 CET 2025


On Tue, Nov 04, 2025 at 10:34:51AM +0100, Heinrich Schuchardt wrote:
> On 10/27/25 21:56, Ben Wolsieffer wrote:
> > Currently, the EFI framebuffer is non-functional in payload mode. It
> > always reports: "No video mode configured in EFI!"
> 
> Hello Ben,
> 
> thanks for reporting the issue that you experience.
> 
> How can it be reproduced?

Hello Heinrich,

Thanks for taking a look at my patch!

To reproduce the bug, build efi-x86_payload64_defconfig, then run U-Boot
as an EFI payload in QEMU or another emulator. Observe that there is no
vidconsole output and "No video mode configured in EFI!" appears on the
serial console.

> 
> > 
> > This is caused by a copy-paste error that replaced
> > "struct efi_entry_gopmode" with "struct efi_gop_mode".
> > 
> > Fix the type and add a cast to avoid a warning because the "info" field
> > is declared as an anonymous struct rather than
> > "struct efi_gop_mode_info" (see the comment in efi.h).
> > 
> > Fixes: 88753816cf54 ("efi: video: Move payload code into a function")
> > Signed-off-by: Ben Wolsieffer <ben.wolsieffer at hefring.com>
> > ---
> >   drivers/video/efi.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/video/efi.c b/drivers/video/efi.c
> > index 78d123fad4be..60df4334f1ed 100644
> > --- a/drivers/video/efi.c
> > +++ b/drivers/video/efi.c
> > @@ -104,7 +104,7 @@ static int get_mode_info(struct vesa_mode_info *vesa, u64 *fbp,
> >   static int get_mode_from_entry(struct vesa_mode_info *vesa, u64 *fbp,
> >   			       struct efi_gop_mode_info **infop)
> >   {
> > -	struct efi_gop_mode *mode;
> > +	struct efi_entry_gopmode *mode;
> >   	int size;
> >   	int ret;
> > @@ -117,7 +117,7 @@ static int get_mode_from_entry(struct vesa_mode_info *vesa, u64 *fbp,
> >   	*fbp = mode->fb_base;
> >   	vesa->x_resolution = mode->info->width;
> >   	vesa->y_resolution = mode->info->height;
> > -	*infop = mode->info;
> > +	*infop = (struct efi_gop_mode_info *)mode->info;
> 
> The definition of struct efi_entry_gopmode should be corrected instead of
> adding this conversion.

Ok, and thanks for your patch that does this.

> 
> The logic in save_vesa_mode() which calls get_mode_from_entry() is
> completely broken:
> 
> The element info is an array. Without considering which mode is set up you
> will not know which entry of the array should be used. To get information
> about the current mode, use QueryMode(), please.

In payload mode, the EFI video driver is initialized after
ExitBootServices(). Therefore, QueryMode() cannot be used there.
Instead, struct efi_entry_gopmode is used to pass information from the
EFI stub (before ExitBootServices()) to U-Boot proper. Therefore,
handling multiple modes and selecting the current one needs to be done
in the stub and only one mode will ever be passed in struct
efi_entry_gopmode. I believe 'info' is only declared as an flexible
array to allow easy access to the struct efi_gop_mode_info placed
immediately after it by add_entry_addr().

I believe the logic in get_mode_from_entry() is correct (with my patch).
On the other hand, get_mode_info() (used in EFI app mode) and the EFI
stub possibly need to use QueryMode() rather than relying on the current
mode being populated in struct efi_gop returned by LocateProtocol().
EDK2 populates the current mode there, but I can't find anything in the
EFI spec defining this, so U-Boot probably shouldn't rely on it. I
consider this a separate issue from the bug my patch fixes though.

> 
> Best regards
> 
> Heinrich
> 
> >   	return 0;
> >   }
> 


More information about the U-Boot mailing list