[PATCH 6/6] video: bochs: Setup framebuffer endian
    Jiaxun Yang 
    jiaxun.yang at flygoat.com
       
    Fri May 17 00:16:46 CEST 2024
    
    
  
So the current situation on endian of bochs framebufer
is a little bit complex. QEMU defaulted to little endian
for both endian hardware except on powerpc, but provided
an endian swich register allows OS to switch endian.
Since we can't guarantee the endian switch register is
functional, my approach is to default to little endian
framebuffer for ISAs except powerpc and perform endian
switch to match this assumption.
Signed-off-by: Jiaxun Yang <jiaxun.yang at flygoat.com>
---
 drivers/video/bochs.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/drivers/video/bochs.c b/drivers/video/bochs.c
index 00e673a4db08..c315c5477b14 100644
--- a/drivers/video/bochs.c
+++ b/drivers/video/bochs.c
@@ -65,6 +65,14 @@ static int bochs_init_fb(struct udevice *dev)
 	uc_priv->ysize = ysize;
 	uc_priv->bpix = VIDEO_BPP32;
 
+#if defined(__powerpc__) && defined(__BIG_ENDIAN)
+	uc_priv->format = VIDEO_XRGB8888_BE;
+	writel(0xbebebebe, mmio + 0x604);
+#else
+	uc_priv->format = VIDEO_XRGB8888;
+	writel(0x1e1e1e1e, mmio + 0x604);
+#endif
+
 	/* setup video mode */
 	bochs_write(mmio, INDEX_ENABLE,  0);
 	bochs_write(mmio, INDEX_BANK,  0);
-- 
2.34.1
    
    
More information about the U-Boot
mailing list