On 2026-10-18T04:23:45, Anirudh Srinivasan <[email protected]> wrote: > bios_emulator: extend VGA I/O ports to include ports 0x3B4-0x3DA > > The IS_VGA_PORT macro currently doesn't cover the 0x3B4, 0x3B5 and 0x3BA > I/O ports. Reads/writes to this currently fall through to LOG_inpb/outb > which are unimplemented on non x86 architectures (which don't support > I/O ports). > > Add these ports to the IS_VGA_PORT macro, and implement reads/writes to > these ports. 0x3B4 and 0x3B5 are mirrors of 0x3D4 and 0x3D5 that are > used in monochrome mode (bit 0 of 0x3C2 is not set), and 0x3BA is a > mirror of 0x3DA in monochrome mode. > > A vga_port_active() helper is added to check the current mode so that > the monochrome ports share the same logic and env state as the colour > ports. Reads to 0x3BA/0x3DA also use this helper, so the 0x3C0 address > flip-flop is reset and the 0x3DA status bits are toggled only when the > accessed port is decoded in the current mode. This also means 0x3DA no > longer decodes in monochrome mode, which matches real hardware. > > The extended range also covers the non-VGA ports 0x3B6-0x3B9 and > 0x3BB-0x3BF (LPT1 on legacy PCs): reads return 0xff and writes are > dropped instead of reaching the real inb/outb path, which is harmless > from the VBIOS's perspective. > > While these changes are needed for the Aspeed AST2600 VBIOS to run, > these VGA ports are part of the general VGA spec and might be useful for > other VBIOSes. > > Signed-off-by: Anirudh Srinivasan <[email protected]> > > drivers/bios_emulator/besys.c | 50 > +++++++++++++++++++++++++++++++++++-------- > 1 file changed, 41 insertions(+), 9 deletions(-)
Reviewed-by: Simon Glass <[email protected]>
