From c63a1988847aafa3ee2a38fb166b00777269aaa0 Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Wed, 24 Apr 2024 21:23:57 +0300 Subject: [PATCH] drivers/qemu/bochs: Use arch-independent data port The QEMU Bochs display driver uses 0x1CF as its VBE DISPI data port, but this is only present on x86. Instead, use the port at 0x1D0 [1] which is available on both x86 and non-x86 architectures. The data port is also calculated inline based on the VBE DISPI index port while reading and writing, update those expressions as well. [1] https://web.archive.org/web/20240404032816/https://www.qemu.org/docs/master/specs/standard-vga.html#io-ports-used Change-Id: I899beb742d42c26f3e57023f05ff459094fce5f1 Signed-off-by: Alper Nebi Yasak Reviewed-on: https://review.coreboot.org/c/coreboot/+/82061 Reviewed-by: David Hendricks Tested-by: build bot (Jenkins) --- src/drivers/emulation/qemu/bochs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/drivers/emulation/qemu/bochs.c b/src/drivers/emulation/qemu/bochs.c index 2e0526fa8f..70d17cb716 100644 --- a/src/drivers/emulation/qemu/bochs.c +++ b/src/drivers/emulation/qemu/bochs.c @@ -14,7 +14,7 @@ /* VGA init. We use the Bochs VESA VBE extensions */ #define VBE_DISPI_IOPORT_INDEX 0x01CE -#define VBE_DISPI_IOPORT_DATA 0x01CF +#define VBE_DISPI_IOPORT_DATA 0x01D0 #define VBE_DISPI_INDEX_ID 0x0 #define VBE_DISPI_INDEX_XRES 0x1 @@ -46,7 +46,7 @@ static void bochs_write(struct resource *res, int index, int val) { if (res->flags & IORESOURCE_IO) { outw(index, res->base); - outw(val, res->base + 1); + outw(val, res->base + 2); } else { write16(res2mmio(res, 0x500 + index * 2, 0), val); } @@ -56,7 +56,7 @@ static int bochs_read(struct resource *res, int index) { if (res->flags & IORESOURCE_IO) { outw(index, res->base); - return inw(res->base + 1); + return inw(res->base + 2); } else { return read16(res2mmio(res, 0x500 + index * 2, 0)); }