BE_inw currently doesn't handle 16-bit reads on VGA ports and falls back
to LOG_inpw, which doesn't do anything on non x86 architectures that
don't support I/O ports. Implement this 16-bit read as two 8-bit reads
(similar to how BE_outw implements 16-bit writes).

The Aspeed AST2600's VBIOS has these 16-bit read instructions in it, so
this is needed to emulate that.

Signed-off-by: Anirudh Srinivasan <[email protected]>
---
 drivers/bios_emulator/besys.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/bios_emulator/besys.c b/drivers/bios_emulator/besys.c
index e02c9fc636c..76a05e74f55 100644
--- a/drivers/bios_emulator/besys.c
+++ b/drivers/bios_emulator/besys.c
@@ -612,7 +612,9 @@ u16 X86API BE_inw(X86EMU_pioAddr port)
        u16 val = 0;
 
 #if !defined(CONFIG_X86EMU_RAW_IO)
-       if (IS_PCI_PORT(port))
+       if (IS_VGA_PORT(port))
+               val = BE_inb(port) | ((u16)BE_inb(port + 1) << 8);
+       else if (IS_PCI_PORT(port))
                val = PCI_inp(port, REG_READ_WORD);
        else if (port < 0x100) {
                DB(printf("WARN: Maybe INVALID inw.%04X -> %04X\n", (u16) port, 
val);)

-- 
2.43.0

Reply via email to