From nobody Mon Apr 29 02:55:51 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1528457990849695.4336003731314; Fri, 8 Jun 2018 04:39:50 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D93B0211211FE; Fri, 8 Jun 2018 04:39:49 -0700 (PDT) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AF1832110D531 for ; Fri, 8 Jun 2018 04:39:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 205FF400E9BA for ; Fri, 8 Jun 2018 11:39:47 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-155.ams2.redhat.com [10.36.117.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id A995E2026990; Fri, 8 Jun 2018 11:39:46 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B56EF40DF7; Fri, 8 Jun 2018 13:39:45 +0200 (CEST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=kraxel@redhat.com; receiver=edk2-devel@lists.01.org From: Gerd Hoffmann To: edk2-devel@lists.01.org Date: Fri, 8 Jun 2018 13:39:39 +0200 Message-Id: <20180608113942.17009-2-kraxel@redhat.com> In-Reply-To: <20180608113942.17009-1-kraxel@redhat.com> References: <20180608113942.17009-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 08 Jun 2018 11:39:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 08 Jun 2018 11:39:47 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Subject: [edk2] [PATCH 1/4] OvmfPkg: add QEMU_RAMFB_GUID X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add GUID header file for the QemuRamfbDxe driver. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Gerd Hoffmann --- OvmfPkg/Include/Guid/QemuRamfb.h | 25 +++++++++++++++++++++++++ OvmfPkg/OvmfPkg.dec | 1 + 2 files changed, 26 insertions(+) create mode 100644 OvmfPkg/Include/Guid/QemuRamfb.h diff --git a/OvmfPkg/Include/Guid/QemuRamfb.h b/OvmfPkg/Include/Guid/QemuRa= mfb.h new file mode 100644 index 0000000000..878224599d --- /dev/null +++ b/OvmfPkg/Include/Guid/QemuRamfb.h @@ -0,0 +1,25 @@ +/** @file + Recommended GUID to be used in the Vendor Hardware device path nodes that + identify qemu ramfb devices. + + Copyright (C) 2018, Red Hat, Inc. + + This program and the accompanying materials are licensed and made availa= ble + under the terms and conditions of the BSD License that accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WI= THOUT + WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __QEMU_RAMFB_H__ +#define __QEMU_RAMFB_H__ + +#define QEMU_RAMFB_GUID \ +{0x837dca9e, 0xe874, 0x4d82, {0xb2, 0x9a, 0x23, 0xfe, 0x0e, 0x23, 0xd1, 0x= e2}} + +extern EFI_GUID gQemuRamfbGuid; + +#endif diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index dc5597db41..a16c22a289 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -75,6 +75,7 @@ gEfiXenInfoGuid =3D {0xd3b46f3b, 0xd441, 0x1244, {0x= 9a, 0x12, 0x0, 0x12, 0x27, 0x3f, 0xc1, 0x4d}} gOvmfPlatformConfigGuid =3D {0x7235c51c, 0x0c80, 0x4cab, {0x= 87, 0xac, 0x3b, 0x08, 0x4a, 0x63, 0x04, 0xb1}} gVirtioMmioTransportGuid =3D {0x837dca9e, 0xe874, 0x4d82, {0x= b2, 0x9a, 0x23, 0xfe, 0x0e, 0x23, 0xd1, 0xe2}} + gQemuRamfbGuid =3D {0x837dca9e, 0xe874, 0x4d82, {0x= b2, 0x9a, 0x23, 0xfe, 0x0e, 0x23, 0xd1, 0xe2}} gXenBusRootDeviceGuid =3D {0xa732241f, 0x383d, 0x4d9c, {0x= 8a, 0xe1, 0x8e, 0x09, 0x83, 0x75, 0x89, 0xd7}} gRootBridgesConnectedEventGroupGuid =3D {0x24a2d66f, 0xeedd, 0x4086, {0x= 90, 0x42, 0xf2, 0x6e, 0x47, 0x97, 0xee, 0x69}} =20 --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Apr 29 02:55:51 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1528457995074100.13801309849623; Fri, 8 Jun 2018 04:39:55 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 49AE52112A280; Fri, 8 Jun 2018 04:39:50 -0700 (PDT) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AF0E22110C800 for ; Fri, 8 Jun 2018 04:39:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7827F40252ED for ; Fri, 8 Jun 2018 11:39:47 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-155.ams2.redhat.com [10.36.117.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id A95F62166BC7; Fri, 8 Jun 2018 11:39:46 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B7B40422B8; Fri, 8 Jun 2018 13:39:45 +0200 (CEST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=kraxel@redhat.com; receiver=edk2-devel@lists.01.org From: Gerd Hoffmann To: edk2-devel@lists.01.org Date: Fri, 8 Jun 2018 13:39:40 +0200 Message-Id: <20180608113942.17009-3-kraxel@redhat.com> In-Reply-To: <20180608113942.17009-1-kraxel@redhat.com> References: <20180608113942.17009-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 08 Jun 2018 11:39:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 08 Jun 2018 11:39:47 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Subject: [edk2] [PATCH 2/4] OvmfPkg: add QemuRamfbDxe X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add a driver for the qemu ramfb display device. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Gerd Hoffmann --- OvmfPkg/QemuRamfbDxe/QemuRamfb.c | 308 ++++++++++++++++++++++++++++++= ++++ OvmfPkg/OvmfPkgIa32.dsc | 1 + OvmfPkg/OvmfPkgIa32.fdf | 1 + OvmfPkg/OvmfPkgIa32X64.dsc | 1 + OvmfPkg/OvmfPkgIa32X64.fdf | 1 + OvmfPkg/OvmfPkgX64.dsc | 1 + OvmfPkg/OvmfPkgX64.fdf | 1 + OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf | 34 ++++ 8 files changed, 348 insertions(+) create mode 100644 OvmfPkg/QemuRamfbDxe/QemuRamfb.c create mode 100644 OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf diff --git a/OvmfPkg/QemuRamfbDxe/QemuRamfb.c b/OvmfPkg/QemuRamfbDxe/QemuRa= mfb.c new file mode 100644 index 0000000000..f04a314c24 --- /dev/null +++ b/OvmfPkg/QemuRamfbDxe/QemuRamfb.c @@ -0,0 +1,308 @@ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define RAMFB_FORMAT 0x34325258 /* DRM_FORMAT_XRGB8888 */ +#define RAMFB_BPP 4 + +EFI_GUID gQemuRamfbGuid =3D QEMU_RAMFB_GUID; + +typedef struct RAMFB_CONFIG { + UINT64 Address; + UINT32 FourCC; + UINT32 Flags; + UINT32 Width; + UINT32 Height; + UINT32 Stride; +} RAMFB_CONFIG; + +EFI_HANDLE RamfbHandle; +EFI_HANDLE GopHandle; +FRAME_BUFFER_CONFIGURE *QemuRamfbFrameBufferBltConfigure; +UINTN QemuRamfbFrameBufferBltConfigureSize; + +EFI_GRAPHICS_OUTPUT_MODE_INFORMATION QemuRamfbModeInfo[] =3D { + { + .HorizontalResolution =3D 640, + .VerticalResolution =3D 480, + },{ + .HorizontalResolution =3D 800, + .VerticalResolution =3D 600, + },{ + .HorizontalResolution =3D 1024, + .VerticalResolution =3D 768, + } +}; +#define QemuRamfbModeCount (sizeof(QemuRamfbModeInfo)/sizeof(QemuRamfbMode= Info[0])) + +EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE QemuRamfbMode =3D { + .MaxMode =3D QemuRamfbModeCount, + .Mode =3D 0, + .Info =3D QemuRamfbModeInfo, + .SizeOfInfo =3D sizeof(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION), +}; + +EFI_STATUS +EFIAPI +QemuRamfbGraphicsOutputQueryMode ( + IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, + IN UINT32 ModeNumber, + OUT UINTN *SizeOfInfo, + OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info + ) +{ + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *ModeInfo; + + if (Info =3D=3D NULL || SizeOfInfo =3D=3D NULL || ModeNumber > QemuRamfb= Mode.MaxMode) { + return EFI_INVALID_PARAMETER; + } + ModeInfo =3D &QemuRamfbModeInfo[ModeNumber]; + + *Info =3D AllocateCopyPool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION= ), + ModeInfo); + if (*Info =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + *SizeOfInfo =3D sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION); + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +QemuRamfbGraphicsOutputSetMode ( + IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, + IN UINT32 ModeNumber + ) +{ + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *ModeInfo; + RAMFB_CONFIG Config; + EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black; + RETURN_STATUS Ret; + FIRMWARE_CONFIG_ITEM Item; + UINTN Size; + + if (ModeNumber > QemuRamfbMode.MaxMode) { + return EFI_UNSUPPORTED; + } + ModeInfo =3D &QemuRamfbModeInfo[ModeNumber]; + + DEBUG ((EFI_D_INFO, "Ramfb: SetMode %d (%dx%d)\n", ModeNumber, + ModeInfo->HorizontalResolution, + ModeInfo->VerticalResolution)); + + QemuRamfbMode.Mode =3D ModeNumber; + QemuRamfbMode.Info =3D ModeInfo; + + Config.Address =3D SwapBytes64( QemuRamfbMode.FrameBufferBase ); + Config.FourCC =3D SwapBytes32( RAMFB_FORMAT ); + Config.Flags =3D SwapBytes32( 0 ); + Config.Width =3D SwapBytes32( ModeInfo->HorizontalResolution ); + Config.Height =3D SwapBytes32( ModeInfo->VerticalResolution ); + Config.Stride =3D SwapBytes32( ModeInfo->HorizontalResolution * RAMFB_B= PP ); + + QemuFwCfgFindFile("etc/ramfb", &Item, &Size); + QemuFwCfgSelectItem(Item); + QemuFwCfgWriteBytes(sizeof(Config), &Config); + + Ret =3D FrameBufferBltConfigure ( + (VOID*)(UINTN)QemuRamfbMode.FrameBufferBase, + ModeInfo, + QemuRamfbFrameBufferBltConfigure, + &QemuRamfbFrameBufferBltConfigureSize); + + if (Ret =3D=3D RETURN_BUFFER_TOO_SMALL) { + if (QemuRamfbFrameBufferBltConfigure !=3D NULL) { + FreePool(QemuRamfbFrameBufferBltConfigure); + } + QemuRamfbFrameBufferBltConfigure =3D + AllocatePool(QemuRamfbFrameBufferBltConfigureSize); + + Ret =3D FrameBufferBltConfigure ( + (VOID*)(UINTN)QemuRamfbMode.FrameBufferBase, + ModeInfo, + QemuRamfbFrameBufferBltConfigure, + &QemuRamfbFrameBufferBltConfigureSize); + } + + /* clear screen */ + ZeroMem (&Black, sizeof (Black)); + Ret =3D FrameBufferBlt ( + QemuRamfbFrameBufferBltConfigure, + &Black, + EfiBltVideoFill, + 0, 0, + 0, 0, + ModeInfo->HorizontalResolution, + ModeInfo->VerticalResolution, + 0 + ); + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +QemuRamfbGraphicsOutputBlt ( + IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL + IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation, + IN UINTN SourceX, + IN UINTN SourceY, + IN UINTN DestinationX, + IN UINTN DestinationY, + IN UINTN Width, + IN UINTN Height, + IN UINTN Delta + ) +{ + return FrameBufferBlt ( + QemuRamfbFrameBufferBltConfigure, + BltBuffer, + BltOperation, + SourceX, + SourceY, + DestinationX, + DestinationY, + Width, + Height, + Delta); +} + +EFI_GRAPHICS_OUTPUT_PROTOCOL QemuRamfbGraphicsOutput =3D { + .QueryMode =3D QemuRamfbGraphicsOutputQueryMode, + .SetMode =3D QemuRamfbGraphicsOutputSetMode, + .Blt =3D QemuRamfbGraphicsOutputBlt, + .Mode =3D &QemuRamfbMode, +}; + +EFI_STATUS +EFIAPI +InitializeQemuRamfb ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_DEVICE_PATH_PROTOCOL *RamfbDevicePath; + EFI_DEVICE_PATH_PROTOCOL *GopDevicePath; + VOID *DevicePath; + VENDOR_DEVICE_PATH VendorDeviceNode; + ACPI_ADR_DEVICE_PATH AcpiDeviceNode; + EFI_STATUS Status; + RETURN_STATUS Ret; + FIRMWARE_CONFIG_ITEM Item; + EFI_PHYSICAL_ADDRESS FbBase; + UINTN Size, FbSize, MaxFbSize, Pages, Index; + + DEBUG ((EFI_D_INFO, "InitializeQemuRamfb\n")); + + if (!QemuFwCfgIsAvailable()) { + DEBUG ((EFI_D_INFO, "Ramfb: no FwCfg\n")); + return EFI_NOT_FOUND; + } + + Ret =3D QemuFwCfgFindFile("etc/ramfb", &Item, &Size); + if (Ret !=3D RETURN_SUCCESS) { + DEBUG ((EFI_D_INFO, "Ramfb: no etc/ramfb in FwCfg\n")); + return EFI_NOT_FOUND; + } + + MaxFbSize =3D 0; + for (Index =3D 0; Index < QemuRamfbModeCount; Index++) { + QemuRamfbModeInfo[Index].PixelsPerScanLine =3D + QemuRamfbModeInfo[Index].HorizontalResolution; + QemuRamfbModeInfo[Index].PixelFormat =3D + PixelBlueGreenRedReserved8BitPerColor, + FbSize =3D RAMFB_BPP * + QemuRamfbModeInfo[Index].HorizontalResolution * + QemuRamfbModeInfo[Index].VerticalResolution; + if (MaxFbSize < FbSize) + MaxFbSize =3D FbSize; + DEBUG ((EFI_D_INFO, "Ramfb: Mode %d: %dx%d, %d kB\n", Index, + QemuRamfbModeInfo[Index].HorizontalResolution, + QemuRamfbModeInfo[Index].VerticalResolution, + FbSize / 1024)); + } + + Pages =3D EFI_SIZE_TO_PAGES(MaxFbSize); + MaxFbSize =3D EFI_PAGES_TO_SIZE(Pages); + FbBase =3D (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateRuntimePages(Pages); + if (!FbBase) { + DEBUG ((EFI_D_INFO, "Ramfb: memory allocation failed\n")); + return EFI_OUT_OF_RESOURCES; + } + DEBUG ((EFI_D_INFO, "Ramfb: Framebuffer at 0x%lx, %d kB, %d pages\n", + FbBase, MaxFbSize / 1024, Pages)); + QemuRamfbMode.FrameBufferSize =3D MaxFbSize; + QemuRamfbMode.FrameBufferBase =3D FbBase; + + /* 800 x 600 */ + QemuRamfbGraphicsOutputSetMode (&QemuRamfbGraphicsOutput, 1); + + /* ramfb vendor devpath */ + ZeroMem (&VendorDeviceNode, sizeof (VENDOR_DEVICE_PATH)); + VendorDeviceNode.Header.Type =3D HARDWARE_DEVICE_PATH; + VendorDeviceNode.Header.SubType =3D HW_VENDOR_DP; + VendorDeviceNode.Guid =3D gQemuRamfbGuid; + SetDevicePathNodeLength (&VendorDeviceNode.Header, sizeof (VENDOR_DEVICE= _PATH)); + + RamfbDevicePath =3D AppendDevicePathNode ( + NULL, + (EFI_DEVICE_PATH_PROTOCOL *) &VendorDeviceNode); + + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &RamfbHandle, + &gEfiDevicePathProtocolGuid, RamfbDevicePath, + NULL); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_INFO, "Ramfb: install Ramfb Vendor DevicePath failed\n")= ); + FreePool((VOID*)(UINTN)QemuRamfbMode.FrameBufferBase); + return Status; + } + + /* gop devpath + protocol */ + ZeroMem (&AcpiDeviceNode, sizeof (ACPI_ADR_DEVICE_PATH)); + AcpiDeviceNode.Header.Type =3D ACPI_DEVICE_PATH; + AcpiDeviceNode.Header.SubType =3D ACPI_ADR_DP; + AcpiDeviceNode.ADR =3D ACPI_DISPLAY_ADR (1, 0, 0, 1, 0, + ACPI_ADR_DISPLAY_TYPE_EXTERNAL_DI= GITAL, + 0, 0); + SetDevicePathNodeLength (&AcpiDeviceNode.Header, sizeof (ACPI_ADR_DEVICE= _PATH)); + + GopDevicePath =3D AppendDevicePathNode ( + RamfbDevicePath, + (EFI_DEVICE_PATH_PROTOCOL *) &AcpiDeviceNode); + + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &GopHandle, + &gEfiDevicePathProtocolGuid, GopDevicePath, + &gEfiGraphicsOutputProtocolGuid, &QemuRamfbGraphicsOutput, + NULL); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_INFO, "Ramfb: install GOP DevicePath failed\n")); + FreePool((VOID*)(UINTN)QemuRamfbMode.FrameBufferBase); + return Status; + } + + gBS->OpenProtocol ( + RamfbHandle, + &gEfiDevicePathProtocolGuid, + &DevicePath, + gImageHandle, + GopHandle, + EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER); + + return EFI_SUCCESS; +} diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index a2c995b910..7ddda89999 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -745,6 +745,7 @@ MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf =20 OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf + OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf OvmfPkg/VirtioGpuDxe/VirtioGpu.inf =20 # diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf index b199713925..52b8b1fea1 100644 --- a/OvmfPkg/OvmfPkgIa32.fdf +++ b/OvmfPkg/OvmfPkgIa32.fdf @@ -351,6 +351,7 @@ INF RuleOverride=3DCSM OvmfPkg/Csm/Csm16/Csm16.inf !endif =20 INF OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf +INF OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf INF OvmfPkg/VirtioGpuDxe/VirtioGpu.inf INF OvmfPkg/PlatformDxe/Platform.inf INF OvmfPkg/IoMmuDxe/IoMmuDxe.inf diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index bc7db229d2..3481cdc36b 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -754,6 +754,7 @@ MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf =20 OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf + OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf OvmfPkg/VirtioGpuDxe/VirtioGpu.inf =20 # diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf index 4ebf64b2b9..70845d6972 100644 --- a/OvmfPkg/OvmfPkgIa32X64.fdf +++ b/OvmfPkg/OvmfPkgIa32X64.fdf @@ -357,6 +357,7 @@ INF RuleOverride=3DCSM OvmfPkg/Csm/Csm16/Csm16.inf !endif =20 INF OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf +INF OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf INF OvmfPkg/VirtioGpuDxe/VirtioGpu.inf INF OvmfPkg/PlatformDxe/Platform.inf INF OvmfPkg/AmdSevDxe/AmdSevDxe.inf diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 0767b34d18..8b0895b0ff 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -752,6 +752,7 @@ MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf =20 OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf + OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf OvmfPkg/VirtioGpuDxe/VirtioGpu.inf =20 # diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf index 9ca96f9282..1eb46ac9a2 100644 --- a/OvmfPkg/OvmfPkgX64.fdf +++ b/OvmfPkg/OvmfPkgX64.fdf @@ -357,6 +357,7 @@ INF RuleOverride=3DCSM OvmfPkg/Csm/Csm16/Csm16.inf !endif =20 INF OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf +INF OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf INF OvmfPkg/VirtioGpuDxe/VirtioGpu.inf INF OvmfPkg/PlatformDxe/Platform.inf INF OvmfPkg/AmdSevDxe/AmdSevDxe.inf diff --git a/OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf b/OvmfPkg/QemuRamfbDxe/Q= emuRamfbDxe.inf new file mode 100644 index 0000000000..75a7d86832 --- /dev/null +++ b/OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf @@ -0,0 +1,34 @@ +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D QemuRamfbDxe + FILE_GUID =3D dce1b094-7dc6-45d0-9fdd-d7fc3cc3e4ef + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + + ENTRY_POINT =3D InitializeQemuRamfb + +[Sources.common] + QemuRamfb.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + OvmfPkg/OvmfPkg.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + DevicePathLib + FrameBufferBltLib + MemoryAllocationLib + UefiBootManagerLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + QemuFwCfgLib + +[Protocols] + gEfiGraphicsOutputProtocolGuid # PROTOCOL BY_START + +[Depex] + TRUE --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Apr 29 02:55:51 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1528457992334517.1112662123571; Fri, 8 Jun 2018 04:39:52 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1C87021123B70; Fri, 8 Jun 2018 04:39:50 -0700 (PDT) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AF02A2110BD77 for ; Fri, 8 Jun 2018 04:39:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AC9D740BC068 for ; Fri, 8 Jun 2018 11:39:47 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-155.ams2.redhat.com [10.36.117.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id 529682026990; Fri, 8 Jun 2018 11:39:47 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BA239423E6; Fri, 8 Jun 2018 13:39:45 +0200 (CEST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=kraxel@redhat.com; receiver=edk2-devel@lists.01.org From: Gerd Hoffmann To: edk2-devel@lists.01.org Date: Fri, 8 Jun 2018 13:39:41 +0200 Message-Id: <20180608113942.17009-4-kraxel@redhat.com> In-Reply-To: <20180608113942.17009-1-kraxel@redhat.com> References: <20180608113942.17009-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 08 Jun 2018 11:39:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 08 Jun 2018 11:39:47 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Subject: [edk2] [PATCH 3/4] OvmfPkg: add QemuRamfb to platform console X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add QemuRamfbDxe device path to the list of platform console devices, so ConSplitter will pick up the device even though it isn't a PCI GPU. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Gerd Hoffmann --- .../Library/PlatformBootManagerLib/PlatformData.c | 44 ++++++++++++++++++= ++++ 1 file changed, 44 insertions(+) diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c b/OvmfPk= g/Library/PlatformBootManagerLib/PlatformData.c index a50cd7bcaf..6202516971 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformData.c @@ -14,6 +14,7 @@ **/ =20 #include "BdsPlatform.h" +#include =20 // // Debug Agent UART Device Path structure @@ -37,6 +38,17 @@ typedef struct { } USB_KEYBOARD_DEVICE_PATH; #pragma pack () =20 +// +// QemuRamfb Device Path structure +// +#pragma pack(1) +typedef struct { + VENDOR_DEVICE_PATH Vendor; + ACPI_ADR_DEVICE_PATH AcpiAdr; + EFI_DEVICE_PATH_PROTOCOL End; +} VENDOR_RAMFB_DEVICE_PATH; +#pragma pack() + ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode =3D gPnpPs2Keyboard; ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode =3D gPnp16550ComPort; UART_DEVICE_PATH gUartDeviceNode =3D gUart; @@ -100,6 +112,34 @@ STATIC USB_KEYBOARD_DEVICE_PATH gUsbKeyboardDevicePath= =3D { gEndEntire }; =20 +STATIC VENDOR_RAMFB_DEVICE_PATH gQemuRamfbDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8) (sizeof (VENDOR_DEVICE_PATH)), + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + QEMU_RAMFB_GUID, + }, + { + { + ACPI_DEVICE_PATH, + ACPI_ADR_DP, + { + (UINT8) (sizeof (ACPI_ADR_DEVICE_PATH)), + (UINT8) ((sizeof (ACPI_ADR_DEVICE_PATH)) >> 8) + } + }, + ACPI_DISPLAY_ADR (1, 0, 0, 1, 0, + ACPI_ADR_DISPLAY_TYPE_EXTERNAL_DIGITAL, + 0, 0) + }, + gEndEntire +}; + // // Predefined platform default console device path // @@ -113,6 +153,10 @@ PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[] = =3D { CONSOLE_IN }, { + (EFI_DEVICE_PATH_PROTOCOL *)&gQemuRamfbDevicePath, + CONSOLE_OUT + }, + { NULL, 0 } --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Apr 29 02:55:51 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1528458000946230.33153722083898; Fri, 8 Jun 2018 04:40:00 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9D60A21135FF3; Fri, 8 Jun 2018 04:39:51 -0700 (PDT) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 78E932112546F for ; Fri, 8 Jun 2018 04:39:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C3F30401EF04 for ; Fri, 8 Jun 2018 11:39:49 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-155.ams2.redhat.com [10.36.117.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id A96607D4FF; Fri, 8 Jun 2018 11:39:46 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BC62093CFF; Fri, 8 Jun 2018 13:39:45 +0200 (CEST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=kraxel@redhat.com; receiver=edk2-devel@lists.01.org From: Gerd Hoffmann To: edk2-devel@lists.01.org Date: Fri, 8 Jun 2018 13:39:42 +0200 Message-Id: <20180608113942.17009-5-kraxel@redhat.com> In-Reply-To: <20180608113942.17009-1-kraxel@redhat.com> References: <20180608113942.17009-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 08 Jun 2018 11:39:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 08 Jun 2018 11:39:49 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kraxel@redhat.com' RCPT:'' Subject: [edk2] [PATCH 4/4] ArmVirtPkg: add QemuRamfbDxe X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Build wireup for ArmVirt. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Gerd Hoffmann Reviewed-by: Laszlo Ersek --- ArmVirtPkg/ArmVirtQemu.dsc | 2 ++ ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 1 + ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 ++ 3 files changed, 5 insertions(+) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index d74feb709c..744d127a10 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -57,6 +57,7 @@ BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/Platfor= mBootManagerLib.inf CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Customize= dDisplayLib.inf + FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltL= ib.inf QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProdu= cerLib.inf @@ -391,6 +392,7 @@ # # Video support # + OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf OvmfPkg/VirtioGpuDxe/VirtioGpu.inf OvmfPkg/PlatformDxe/Platform.inf =20 diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuF= vMain.fdf.inc index 89f95b2d99..63a202c788 100644 --- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc +++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc @@ -175,6 +175,7 @@ READ_LOCK_STATUS =3D TRUE # # Video support # + INF OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf INF OvmfPkg/VirtioGpuDxe/VirtioGpu.inf INF OvmfPkg/PlatformDxe/Platform.inf =20 diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKerne= l.dsc index 1e823aeab7..e59f53b728 100644 --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc @@ -57,6 +57,7 @@ BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/Platfor= mBootManagerLib.inf CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Customize= dDisplayLib.inf + FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltL= ib.inf QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProdu= cerLib.inf @@ -380,6 +381,7 @@ # # Video support # + OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf OvmfPkg/VirtioGpuDxe/VirtioGpu.inf OvmfPkg/PlatformDxe/Platform.inf =20 --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel