[edk2-devel] [PATCH 1/1] OvmfPkg/QemuVideoDxe: fix bochs mode init

Ard Biesheuvel ardb at kernel.org
Tue Sep 6 14:36:23 UTC 2022


On Tue, 6 Sept 2022 at 16:27, Gerd Hoffmann <kraxel at redhat.com> wrote:
>
> Add VgaInb() helper function to read vga registers.  With that in place
> fix the unblanking.  We need to put the ATT_ADDRESS_REGISTER flip flip

Is a flip flip a special kind of 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 at 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..bfa92ae96022 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 flop flop + unblank */

And what is a flop flop?


> +  VgaInb (Private, INPUT_STATUS_1_REGISTER);
>    VgaOutb (Private, ATT_ADDRESS_REGISTER, 0x20);
>
>    BochsWrite (Private, VBE_DISPI_INDEX_ENABLE, 0);
> --
> 2.37.3
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#93229): https://edk2.groups.io/g/devel/message/93229
Mute This Topic: https://groups.io/mt/93501857/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list