From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Jordan Justen <jordan.l.justen@intel.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Pawel Polawski <ppolawsk@redhat.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>,
Oliver Steffen <osteffen@redhat.com>
Subject: [PATCH v2 1/1] OvmfPkg/QemuVideoDxe: fix bochs mode init
Date: Wed, 7 Sep 2022 07:16:58 +0200 [thread overview]
Message-ID: <20220907051658.2884354-1-kraxel@redhat.com> (raw)
Add VgaInb() helper function to read vga registers. With that in place
fix the unblanking. We need to put the ATT_ADDRESS_REGISTER flip flop
into a known state, which is done by reading the
INPUT_STATUS_1_REGISTER. Reading the INPUT_STATUS_1_REGISTER only works
when the device is in color mode, so make sure that bit (0x01) is set in
MISC_OUTPUT_REGISTER.
Currently the mode setting works more by luck because
ATT_ADDRESS_REGISTER flip flip happens to be in the state we need.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
OvmfPkg/QemuVideoDxe/Driver.c | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/OvmfPkg/QemuVideoDxe/Driver.c b/OvmfPkg/QemuVideoDxe/Driver.c
index b91909a14e59..a15e54d38fd2 100644
--- a/OvmfPkg/QemuVideoDxe/Driver.c
+++ b/OvmfPkg/QemuVideoDxe/Driver.c
@@ -984,6 +984,31 @@ VgaOutb (
}
}
+UINT8
+VgaInb (
+ QEMU_VIDEO_PRIVATE_DATA *Private,
+ UINTN Reg
+ )
+{
+ EFI_STATUS Status;
+ UINT8 Data = 0;
+
+ if (Private->Variant == QEMU_VIDEO_BOCHS_MMIO) {
+ Status = Private->PciIo->Mem.Read (
+ Private->PciIo,
+ EfiPciIoWidthUint8,
+ PCI_BAR_IDX2,
+ 0x400 - 0x3c0 + Reg,
+ 1,
+ &Data
+ );
+ ASSERT_EFI_ERROR (Status);
+ } else {
+ Data = inb (Private, Reg);
+ }
+ return Data;
+}
+
VOID
InitializeBochsGraphicsMode (
QEMU_VIDEO_PRIVATE_DATA *Private,
@@ -998,7 +1023,11 @@ InitializeBochsGraphicsMode (
ModeData->ColorDepth
));
- /* unblank */
+ /* set color mode */
+ VgaOutb (Private, MISC_OUTPUT_REGISTER, 0x01);
+
+ /* reset flip flop + unblank */
+ VgaInb (Private, INPUT_STATUS_1_REGISTER);
VgaOutb (Private, ATT_ADDRESS_REGISTER, 0x20);
BochsWrite (Private, VBE_DISPI_INDEX_ENABLE, 0);
--
2.37.3
next reply other threads:[~2022-09-07 5:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-07 5:16 Gerd Hoffmann [this message]
2022-09-07 7:54 ` [PATCH v2 1/1] OvmfPkg/QemuVideoDxe: fix bochs mode init Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220907051658.2884354-1-kraxel@redhat.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox