[SeaBIOS] [PATCH] vgabios: Fix generating modes list for static_functionality

Steven Price posted 1 patch 1 month, 1 week ago
vgasrc/stdvgamodes.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[SeaBIOS] [PATCH] vgabios: Fix generating modes list for static_functionality
Posted by Steven Price 1 month, 1 week ago
Accessing the data in the vga_modes array requires using GET_GLOBAL(),
and the bits set in the bit array should correspond to the modes, not
the indexes in vga_modes.

With this change the modes calculated matches the expected value of
0xfe0ff.

Fixes: 12900b1a2431 ("vgabios: Fill in available legacy modes in video_func_static at runtime")
Signed-off-by: Steven Price <steven@ecrips.co.uk>
---
I suspect this is also the cause of a bug reported against QEMU:
https://gitlab.com/qemu-project/qemu/-/issues/629
---
 vgasrc/stdvgamodes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vgasrc/stdvgamodes.c b/vgasrc/stdvgamodes.c
index b1d0ef674db4..d72d36b4a27d 100644
--- a/vgasrc/stdvgamodes.c
+++ b/vgasrc/stdvgamodes.c
@@ -419,9 +419,9 @@ stdvga_build_video_param(void)
     // Fill available legacy modes in video_func_static table
     u32 modes = 0;
     for (i = 0; i < ARRAY_SIZE(vga_modes); i++) {
-        u16 mode = vga_modes[i].mode;
+        u16 mode = GET_GLOBAL(vga_modes[i].mode);
         if (mode <= 0x13)
-            modes |= 1<<i;
+            modes |= 1<<mode;
     }
     SET_VGA(static_functionality.modes, modes);
 }
-- 
2.39.5

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH] vgabios: Fix generating modes list for static_functionality
Posted by Kevin O'Connor 3 weeks, 5 days ago
On Sat, Oct 12, 2024 at 11:34:34AM +0000, Steven Price wrote:
> Accessing the data in the vga_modes array requires using GET_GLOBAL(),
> and the bits set in the bit array should correspond to the modes, not
> the indexes in vga_modes.
> 
> With this change the modes calculated matches the expected value of
> 0xfe0ff.
> 
> Fixes: 12900b1a2431 ("vgabios: Fill in available legacy modes in video_func_static at runtime")

Thanks.  I committed this change.

-Kevin
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org