From nobody Sat Nov 2 14:40:00 2024 Delivered-To: importer@patchew.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; Authentication-Results: mx.zoho.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; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 14876915071963.7569350931374856; Tue, 21 Feb 2017 07:38:27 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B425E8221D; Tue, 21 Feb 2017 07:38:20 -0800 (PST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 E13E482218 for ; Tue, 21 Feb 2017 07:38:18 -0800 (PST) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7E18C4DD55; Tue, 21 Feb 2017 15:38:19 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-47.phx2.redhat.com [10.3.116.47]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LFcGVB015879; Tue, 21 Feb 2017 10:38:18 -0500 X-Original-To: edk2-devel@ml01.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Tue, 21 Feb 2017 16:38:07 +0100 Message-Id: <20170221153812.1420-2-lersek@redhat.com> In-Reply-To: <20170221153812.1420-1-lersek@redhat.com> References: <20170221153812.1420-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 21 Feb 2017 15:38:19 +0000 (UTC) Subject: [edk2] [PATCH 1/6] OvmfPkg/AcpiPlatformDxe: drop double right shift in ADD/WRITE POINTER cmds X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen 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" The Count parameter of RShiftU64() must be strictly smaller than 64. ProcessCmdAddPointer() and ProcessCmdWritePointer() currently ensure this by "cleverly" breaking the last bit of a potentially 8-byte right shift out to a separate operation. Instead, exclude the Count=3D=3D64 case explicitly (in which case the preexistent outer RShiftU64() would return 0), and keep only the inner RShiftU64(), with the direct Count however. This is not a functional change, just style improvement. Cc: Jordan Justen Suggested-by: Jordan Justen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen --- OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/AcpiPlatform= Dxe/QemuFwCfgAcpi.c index eadd690bef4e..6a0ecd1ad962 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c +++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c @@ -277,8 +277,8 @@ ProcessCmdAddPointer ( ASSERT ((UINTN)Blob2->Base <=3D MAX_ADDRESS - Blob2->Size); =20 PointerValue +=3D (UINT64)(UINTN)Blob2->Base; - if (RShiftU64 ( - RShiftU64 (PointerValue, AddPointer->PointerSize * 8 - 1), 1) !=3D= 0) { + if (AddPointer->PointerSize < 8 && + RShiftU64 (PointerValue, AddPointer->PointerSize * 8) !=3D 0) { DEBUG ((EFI_D_ERROR, "%a: relocated pointer value unrepresentable in " "\"%a\"\n", __FUNCTION__, AddPointer->PointerFile)); return EFI_PROTOCOL_ERROR; @@ -438,8 +438,8 @@ ProcessCmdWritePointer ( ASSERT ((UINTN)PointeeBlob->Base <=3D MAX_ADDRESS - PointeeBlob->Size); =20 PointerValue +=3D (UINT64)(UINTN)PointeeBlob->Base; - if (RShiftU64 ( - RShiftU64 (PointerValue, WritePointer->PointerSize * 8 - 1), 1) != =3D 0) { + if (WritePointer->PointerSize < 8 && + RShiftU64 (PointerValue, WritePointer->PointerSize * 8) !=3D 0) { DEBUG ((DEBUG_ERROR, "%a: pointer value unrepresentable in \"%a\"\n", __FUNCTION__, WritePointer->PointerFile)); return EFI_PROTOCOL_ERROR; --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Nov 2 14:40:00 2024 Delivered-To: importer@patchew.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; Authentication-Results: mx.zoho.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; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1487691508236225.76731000472068; Tue, 21 Feb 2017 07:38:28 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id EEB248221C; Tue, 21 Feb 2017 07:38:22 -0800 (PST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 451428221C for ; Tue, 21 Feb 2017 07:38:20 -0800 (PST) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D3BAA3D953; Tue, 21 Feb 2017 15:38:20 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-47.phx2.redhat.com [10.3.116.47]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LFcGVC015879; Tue, 21 Feb 2017 10:38:19 -0500 X-Original-To: edk2-devel@ml01.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Tue, 21 Feb 2017 16:38:08 +0100 Message-Id: <20170221153812.1420-3-lersek@redhat.com> In-Reply-To: <20170221153812.1420-1-lersek@redhat.com> References: <20170221153812.1420-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 21 Feb 2017 15:38:20 +0000 (UTC) Subject: [edk2] [PATCH 2/6] OvmfPkg/AcpiPlatformDxe: update PointerValue comments in "BootScript.c" X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen 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" Commit df73df138d9d ("OvmfPkg/AcpiPlatformDxe: replay QEMU_LOADER_WRITE_POINTER commands at S3", 2017-02-09) added "BootScript.c" with such comments on the PointerValue field of CONDENSED_WRITE_POINTER, and on the corresponding PointerValue parameter of SaveCondensedWritePointerToS3Context(), that did not consider the then-latest update of the QEMU_LOADER_WRITE_POINTER structure. (Namely, the introduction of the PointeeOffset field.) The code is fine as-is -- ProcessCmdWritePointer() already calls SaveCondensedWritePointerToS3Context() correctly, and "BootScript.c" itself is indifferent to the exact values --, but the comments in "BootScript.c" should match reality too. Update them. Cc: Jordan Justen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen --- OvmfPkg/AcpiPlatformDxe/BootScript.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/OvmfPkg/AcpiPlatformDxe/BootScript.c b/OvmfPkg/AcpiPlatformDxe= /BootScript.c index b7a7f270f223..1ad468e2f834 100644 --- a/OvmfPkg/AcpiPlatformDxe/BootScript.c +++ b/OvmfPkg/AcpiPlatformDxe/BootScript.c @@ -29,6 +29,7 @@ typedef struct { UINT8 PointerSize; // copied as-is from QEMU_LOADER_WRITE_POINTER UINT32 PointerOffset; // copied as-is from QEMU_LOADER_WRITE_POINTER UINT64 PointerValue; // resolved from QEMU_LOADER_WRITE_POINTER.Pointee= File + // and QEMU_LOADER_WRITE_POINTER.PointeeOffset } CONDENSED_WRITE_POINTER; =20 =20 @@ -159,7 +160,8 @@ ReleaseS3Context ( =20 @param[in] PointerValue The base address of the allocated / downloaded fw_cfg blob that is identified by - QEMU_LOADER_WRITE_POINTER.PointeeFile. + QEMU_LOADER_WRITE_POINTER.PointeeFile, plus + QEMU_LOADER_WRITE_POINTER.PointeeOffset. =20 @retval EFI_SUCCESS The information derived from QEMU_LOADER_WRITE_POINTER has been success= fully @@ -271,9 +273,9 @@ TransferS3ContextToBootScript ( // (2) call QEMU with the FW_CFG_DMA_ACCESS object, // (3) wait for the select+skip to finish, // (4) restore a SCRATCH_BUFFER object in reserved memory that writes - // PointerValue (base address of the allocated / downloaded PointeeF= ile), - // of size PointerSize, into the fw_cfg file selected in (1), at the - // offset sought to in (1), + // PointerValue (base address of the allocated / downloaded PointeeF= ile, + // plus PointeeOffset), of size PointerSize, into the fw_cfg file + // selected in (1), at the offset sought to in (1), // (5) call QEMU with the FW_CFG_DMA_ACCESS object, // (6) wait for the write to finish. // @@ -346,8 +348,8 @@ TransferS3ContextToBootScript ( // // (4) restore a SCRATCH_BUFFER object in reserved memory that writes // PointerValue (base address of the allocated / downloaded - // PointeeFile), of size PointerSize, into the fw_cfg file selecte= d in - // (1), at the offset sought to in (1), + // PointeeFile, plus PointeeOffset), of size PointerSize, into the + // fw_cfg file selected in (1), at the offset sought to in (1), // Access->Control =3D SwapBytes32 (FW_CFG_DMA_CTL_WRITE); Access->Length =3D SwapBytes32 (Condensed->PointerSize); --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Nov 2 14:40:00 2024 Delivered-To: importer@patchew.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; Authentication-Results: mx.zoho.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; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1487691509361803.7368185084283; Tue, 21 Feb 2017 07:38:29 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2C4B282222; Tue, 21 Feb 2017 07:38:26 -0800 (PST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 E869E82218 for ; Tue, 21 Feb 2017 07:38:24 -0800 (PST) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8461B81255; Tue, 21 Feb 2017 15:38:25 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-47.phx2.redhat.com [10.3.116.47]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LFcGVD015879; Tue, 21 Feb 2017 10:38:24 -0500 X-Original-To: edk2-devel@ml01.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Tue, 21 Feb 2017 16:38:09 +0100 Message-Id: <20170221153812.1420-4-lersek@redhat.com> In-Reply-To: <20170221153812.1420-1-lersek@redhat.com> References: <20170221153812.1420-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 21 Feb 2017 15:38:25 +0000 (UTC) Subject: [edk2] [PATCH 3/6] OvmfPkg/QemuFwCfgLib: move types/macros from lib class to IndustryStandard X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen 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" Cc: Jordan Justen Suggested-by: Jordan Justen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen --- OvmfPkg/Include/IndustryStandard/QemuFwCfg.h | 96 ++++++++++++++++++++ OvmfPkg/Include/Library/QemuFwCfgLib.h | 70 +------------- 2 files changed, 97 insertions(+), 69 deletions(-) diff --git a/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h b/OvmfPkg/Include= /IndustryStandard/QemuFwCfg.h new file mode 100644 index 000000000000..c7e9b5c382a5 --- /dev/null +++ b/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h @@ -0,0 +1,96 @@ +/** @file + Macro and type definitions corresponding to the QEMU fw_cfg interface. + + Refer to "docs/specs/fw_cfg.txt" in the QEMU source directory. + + Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.
+ Copyright (C) 2013 - 2017, Red Hat, Inc. + + This program and the accompanying materials are licensed and made availa= ble + under the terms and conditions of the BSD License which 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 __FW_CFG_H__ +#define __FW_CFG_H__ + +#include + +// +// The size, in bytes, of names of firmware configuration files, including= at +// least one terminating NUL byte. +// +#define QEMU_FW_CFG_FNAME_SIZE 56 + +// +// If the following bit is set in the UINT32 fw_cfg revision / feature bit= map +// -- read from key 0x0001 with the basic IO Port or MMIO method --, then = the +// DMA interface is available. +// +#define FW_CFG_F_DMA BIT1 + +// +// Macros for the FW_CFG_DMA_ACCESS.Control bitmap (in native encoding). +// +#define FW_CFG_DMA_CTL_ERROR BIT0 +#define FW_CFG_DMA_CTL_READ BIT1 +#define FW_CFG_DMA_CTL_SKIP BIT2 +#define FW_CFG_DMA_CTL_SELECT BIT3 +#define FW_CFG_DMA_CTL_WRITE BIT4 + +// +// Numerically defined keys. +// +typedef enum { + QemuFwCfgItemSignature =3D 0x0000, + QemuFwCfgItemInterfaceVersion =3D 0x0001, + QemuFwCfgItemSystemUuid =3D 0x0002, + QemuFwCfgItemRamSize =3D 0x0003, + QemuFwCfgItemGraphicsEnabled =3D 0x0004, + QemuFwCfgItemSmpCpuCount =3D 0x0005, + QemuFwCfgItemMachineId =3D 0x0006, + QemuFwCfgItemKernelAddress =3D 0x0007, + QemuFwCfgItemKernelSize =3D 0x0008, + QemuFwCfgItemKernelCommandLine =3D 0x0009, + QemuFwCfgItemInitrdAddress =3D 0x000a, + QemuFwCfgItemInitrdSize =3D 0x000b, + QemuFwCfgItemBootDevice =3D 0x000c, + QemuFwCfgItemNumaData =3D 0x000d, + QemuFwCfgItemBootMenu =3D 0x000e, + QemuFwCfgItemMaximumCpuCount =3D 0x000f, + QemuFwCfgItemKernelEntry =3D 0x0010, + QemuFwCfgItemKernelData =3D 0x0011, + QemuFwCfgItemInitrdData =3D 0x0012, + QemuFwCfgItemCommandLineAddress =3D 0x0013, + QemuFwCfgItemCommandLineSize =3D 0x0014, + QemuFwCfgItemCommandLineData =3D 0x0015, + QemuFwCfgItemKernelSetupAddress =3D 0x0016, + QemuFwCfgItemKernelSetupSize =3D 0x0017, + QemuFwCfgItemKernelSetupData =3D 0x0018, + QemuFwCfgItemFileDir =3D 0x0019, + + QemuFwCfgItemX86AcpiTables =3D 0x8000, + QemuFwCfgItemX86SmbiosTables =3D 0x8001, + QemuFwCfgItemX86Irq0Override =3D 0x8002, + QemuFwCfgItemX86E820Table =3D 0x8003, + QemuFwCfgItemX86HpetData =3D 0x8004, + +} FIRMWARE_CONFIG_ITEM; + +// +// Communication structure for the DMA access method. All fields are encod= ed in +// big endian. +// +#pragma pack (1) +typedef struct { + UINT32 Control; + UINT32 Length; + UINT64 Address; +} FW_CFG_DMA_ACCESS; +#pragma pack () + +#endif diff --git a/OvmfPkg/Include/Library/QemuFwCfgLib.h b/OvmfPkg/Include/Libra= ry/QemuFwCfgLib.h index 41c3817470a2..2a1261327b01 100644 --- a/OvmfPkg/Include/Library/QemuFwCfgLib.h +++ b/OvmfPkg/Include/Library/QemuFwCfgLib.h @@ -17,75 +17,7 @@ #ifndef __FW_CFG_LIB__ #define __FW_CFG_LIB__ =20 -// -// The size, in bytes, of names of firmware configuration files, including= at -// least one terminating NUL byte. -// -#define QEMU_FW_CFG_FNAME_SIZE 56 - -// -// If the following bit is set in the UINT32 fw_cfg revision / feature bit= map -// -- read from key 0x0001 with the basic IO Port or MMIO method --, then = the -// DMA interface is available. -// -#define FW_CFG_F_DMA BIT1 - -// -// Macros for the FW_CFG_DMA_ACCESS.Control bitmap (in native encoding). -// -#define FW_CFG_DMA_CTL_ERROR BIT0 -#define FW_CFG_DMA_CTL_READ BIT1 -#define FW_CFG_DMA_CTL_SKIP BIT2 -#define FW_CFG_DMA_CTL_SELECT BIT3 -#define FW_CFG_DMA_CTL_WRITE BIT4 - -typedef enum { - QemuFwCfgItemSignature =3D 0x0000, - QemuFwCfgItemInterfaceVersion =3D 0x0001, - QemuFwCfgItemSystemUuid =3D 0x0002, - QemuFwCfgItemRamSize =3D 0x0003, - QemuFwCfgItemGraphicsEnabled =3D 0x0004, - QemuFwCfgItemSmpCpuCount =3D 0x0005, - QemuFwCfgItemMachineId =3D 0x0006, - QemuFwCfgItemKernelAddress =3D 0x0007, - QemuFwCfgItemKernelSize =3D 0x0008, - QemuFwCfgItemKernelCommandLine =3D 0x0009, - QemuFwCfgItemInitrdAddress =3D 0x000a, - QemuFwCfgItemInitrdSize =3D 0x000b, - QemuFwCfgItemBootDevice =3D 0x000c, - QemuFwCfgItemNumaData =3D 0x000d, - QemuFwCfgItemBootMenu =3D 0x000e, - QemuFwCfgItemMaximumCpuCount =3D 0x000f, - QemuFwCfgItemKernelEntry =3D 0x0010, - QemuFwCfgItemKernelData =3D 0x0011, - QemuFwCfgItemInitrdData =3D 0x0012, - QemuFwCfgItemCommandLineAddress =3D 0x0013, - QemuFwCfgItemCommandLineSize =3D 0x0014, - QemuFwCfgItemCommandLineData =3D 0x0015, - QemuFwCfgItemKernelSetupAddress =3D 0x0016, - QemuFwCfgItemKernelSetupSize =3D 0x0017, - QemuFwCfgItemKernelSetupData =3D 0x0018, - QemuFwCfgItemFileDir =3D 0x0019, - - QemuFwCfgItemX86AcpiTables =3D 0x8000, - QemuFwCfgItemX86SmbiosTables =3D 0x8001, - QemuFwCfgItemX86Irq0Override =3D 0x8002, - QemuFwCfgItemX86E820Table =3D 0x8003, - QemuFwCfgItemX86HpetData =3D 0x8004, - -} FIRMWARE_CONFIG_ITEM; - -// -// Communication structure for the DMA access method. All fields are encod= ed in -// big endian. -// -#pragma pack (1) -typedef struct { - UINT32 Control; - UINT32 Length; - UINT64 Address; -} FW_CFG_DMA_ACCESS; -#pragma pack () +#include =20 /** Returns a boolean indicating if the firmware configuration interface --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Nov 2 14:40:00 2024 Delivered-To: importer@patchew.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; Authentication-Results: mx.zoho.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; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1487691511317403.63741138815567; Tue, 21 Feb 2017 07:38:31 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6583E82226; Tue, 21 Feb 2017 07:38:27 -0800 (PST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 C7DF382225 for ; Tue, 21 Feb 2017 07:38:26 -0800 (PST) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 63CE0C057FA9; Tue, 21 Feb 2017 15:38:27 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-47.phx2.redhat.com [10.3.116.47]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LFcGVE015879; Tue, 21 Feb 2017 10:38:25 -0500 X-Original-To: edk2-devel@ml01.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Tue, 21 Feb 2017 16:38:10 +0100 Message-Id: <20170221153812.1420-5-lersek@redhat.com> In-Reply-To: <20170221153812.1420-1-lersek@redhat.com> References: <20170221153812.1420-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 21 Feb 2017 15:38:27 +0000 (UTC) Subject: [edk2] [PATCH 4/6] OvmfPkg/QemuFwCfg: introduce FW_CFG_IO_SELECTOR, adapt the package X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen 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" Introduce the FW_CFG_IO_SELECTOR macro for IO Port 0x510 (the Selector Register), and update all references in OvmfPkg. Cc: Jordan Justen Suggested-by: Jordan Justen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen --- OvmfPkg/Include/IndustryStandard/QemuFwCfg.h | 6 ++++++ OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 2 +- OvmfPkg/SmmControl2Dxe/SmiFeatures.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h b/OvmfPkg/Include= /IndustryStandard/QemuFwCfg.h index c7e9b5c382a5..776bfe88ae2b 100644 --- a/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h +++ b/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h @@ -43,6 +43,12 @@ #define FW_CFG_DMA_CTL_WRITE BIT4 =20 // +// The fw_cfg registers can be found at these IO Ports, on the IO-mapped +// platforms (Ia32 and X64). +// +#define FW_CFG_IO_SELECTOR 0x510 + +// // Numerically defined keys. // typedef enum { diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/= QemuFwCfgLib/QemuFwCfgLib.c index 7744873217fe..1387ea85f3f0 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c @@ -42,7 +42,7 @@ QemuFwCfgSelectItem ( ) { DEBUG ((EFI_D_INFO, "Select Item: 0x%x\n", (UINT16)(UINTN) QemuFwCfgItem= )); - IoWrite16 (0x510, (UINT16)(UINTN) QemuFwCfgItem); + IoWrite16 (FW_CFG_IO_SELECTOR, (UINT16)(UINTN) QemuFwCfgItem); } =20 =20 diff --git a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c b/OvmfPkg/SmmControl2Dxe/= SmiFeatures.c index e070969065c0..352ffa017373 100644 --- a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c +++ b/OvmfPkg/SmmControl2Dxe/SmiFeatures.c @@ -281,7 +281,7 @@ SaveSmiFeatures ( S3SaveState, // This EFI_BOOT_SCRIPT_IO_WRITE_OPCODE, // OpCode EfiBootScriptWidthUint16, // Width - (UINT64)0x510, // Address + (UINT64)FW_CFG_IO_SELECTOR, // Address (UINTN)1, // Count &FeaturesOkItemAsUint16 // Buffer ); --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Nov 2 14:40:00 2024 Delivered-To: importer@patchew.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; Authentication-Results: mx.zoho.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; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1487691512679417.0456252918199; Tue, 21 Feb 2017 07:38:32 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9BBDD82229; Tue, 21 Feb 2017 07:38:28 -0800 (PST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 06E4182218 for ; Tue, 21 Feb 2017 07:38:28 -0800 (PST) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 99AAF3B755; Tue, 21 Feb 2017 15:38:28 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-47.phx2.redhat.com [10.3.116.47]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LFcGVF015879; Tue, 21 Feb 2017 10:38:27 -0500 X-Original-To: edk2-devel@ml01.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Tue, 21 Feb 2017 16:38:11 +0100 Message-Id: <20170221153812.1420-6-lersek@redhat.com> In-Reply-To: <20170221153812.1420-1-lersek@redhat.com> References: <20170221153812.1420-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 21 Feb 2017 15:38:28 +0000 (UTC) Subject: [edk2] [PATCH 5/6] OvmfPkg/QemuFwCfg: introduce FW_CFG_IO_DATA, adapt the package X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen 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" Introduce the FW_CFG_IO_DATA macro for IO Port 0x511 (the Data Register), and update all references in OvmfPkg. Cc: Jordan Justen Suggested-by: Jordan Justen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen --- OvmfPkg/Include/IndustryStandard/QemuFwCfg.h | 1 + OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 6 +++--- OvmfPkg/SmmControl2Dxe/SmiFeatures.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h b/OvmfPkg/Include= /IndustryStandard/QemuFwCfg.h index 776bfe88ae2b..5da6b456febe 100644 --- a/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h +++ b/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h @@ -47,6 +47,7 @@ // platforms (Ia32 and X64). // #define FW_CFG_IO_SELECTOR 0x510 +#define FW_CFG_IO_DATA 0x511 =20 // // Numerically defined keys. diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/= QemuFwCfgLib/QemuFwCfgLib.c index 1387ea85f3f0..d79d0a444ca7 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c @@ -135,7 +135,7 @@ InternalQemuFwCfgReadBytes ( InternalQemuFwCfgDmaBytes ((UINT32)Size, Buffer, FW_CFG_DMA_CTL_READ); return; } - IoReadFifo8 (0x511, Size, Buffer); + IoReadFifo8 (FW_CFG_IO_DATA, Size, Buffer); } =20 =20 @@ -187,7 +187,7 @@ QemuFwCfgWriteBytes ( InternalQemuFwCfgDmaBytes ((UINT32)Size, Buffer, FW_CFG_DMA_CTL_WRIT= E); return; } - IoWriteFifo8 (0x511, Size, Buffer); + IoWriteFifo8 (FW_CFG_IO_DATA, Size, Buffer); } } =20 @@ -230,7 +230,7 @@ QemuFwCfgSkipBytes ( // while (Size > 0) { ChunkSize =3D MIN (Size, sizeof SkipBuffer); - IoReadFifo8 (0x511, ChunkSize, SkipBuffer); + IoReadFifo8 (FW_CFG_IO_DATA, ChunkSize, SkipBuffer); Size -=3D ChunkSize; } } diff --git a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c b/OvmfPkg/SmmControl2Dxe/= SmiFeatures.c index 352ffa017373..73c29848b334 100644 --- a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c +++ b/OvmfPkg/SmmControl2Dxe/SmiFeatures.c @@ -303,7 +303,7 @@ SaveSmiFeatures ( S3SaveState, // This EFI_BOOT_SCRIPT_IO_POLL_OPCODE, // OpCode EfiBootScriptWidthUint8, // Width - (UINT64)(UINTN)0x511, // Address + (UINT64)(UINTN)FW_CFG_IO_DATA, // Address &FeaturesOkData, // Data &FeaturesOkMask, // DataMask MAX_UINT64 // Delay --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Nov 2 14:40:00 2024 Delivered-To: importer@patchew.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; Authentication-Results: mx.zoho.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; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1487691516394453.22437545142714; Tue, 21 Feb 2017 07:38:36 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D9D778222C; Tue, 21 Feb 2017 07:38:30 -0800 (PST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 4A7CE8222C for ; Tue, 21 Feb 2017 07:38:29 -0800 (PST) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D214380F97; Tue, 21 Feb 2017 15:38:29 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-47.phx2.redhat.com [10.3.116.47]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LFcGVG015879; Tue, 21 Feb 2017 10:38:29 -0500 X-Original-To: edk2-devel@ml01.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Tue, 21 Feb 2017 16:38:12 +0100 Message-Id: <20170221153812.1420-7-lersek@redhat.com> In-Reply-To: <20170221153812.1420-1-lersek@redhat.com> References: <20170221153812.1420-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 21 Feb 2017 15:38:29 +0000 (UTC) Subject: [edk2] [PATCH 6/6] OvmfPkg/QemuFwCfg: introduce FW_CFG_IO_DMA_ADDRESS, adapt the package X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen 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" Introduce the FW_CFG_IO_DMA_ADDRESS macro for IO Ports 0x514 and 0x518 (most significant and least significant halves of the DMA Address Register, respectively), and update all references in OvmfPkg. Cc: Jordan Justen Suggested-by: Jordan Justen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen --- OvmfPkg/Include/IndustryStandard/QemuFwCfg.h | 1 + OvmfPkg/AcpiPlatformDxe/BootScript.c | 4 ++-- OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 4 ++-- OvmfPkg/SmmControl2Dxe/SmiFeatures.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h b/OvmfPkg/Include= /IndustryStandard/QemuFwCfg.h index 5da6b456febe..8c32f83e8e16 100644 --- a/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h +++ b/OvmfPkg/Include/IndustryStandard/QemuFwCfg.h @@ -48,6 +48,7 @@ // #define FW_CFG_IO_SELECTOR 0x510 #define FW_CFG_IO_DATA 0x511 +#define FW_CFG_IO_DMA_ADDRESS 0x514 =20 // // Numerically defined keys. diff --git a/OvmfPkg/AcpiPlatformDxe/BootScript.c b/OvmfPkg/AcpiPlatformDxe= /BootScript.c index 1ad468e2f834..bff42ad8b9b0 100644 --- a/OvmfPkg/AcpiPlatformDxe/BootScript.c +++ b/OvmfPkg/AcpiPlatformDxe/BootScript.c @@ -317,7 +317,7 @@ TransferS3ContextToBootScript ( S3SaveState, // This EFI_BOOT_SCRIPT_IO_WRITE_OPCODE, // OpCode EfiBootScriptWidthUint32, // Width - (UINT64)0x514, // Address + (UINT64)FW_CFG_IO_DMA_ADDRESS, // Address (UINTN)2, // Count &BigEndianAddressOfAccess // Buffer ); @@ -376,7 +376,7 @@ TransferS3ContextToBootScript ( S3SaveState, // This EFI_BOOT_SCRIPT_IO_WRITE_OPCODE, // OpCode EfiBootScriptWidthUint32, // Width - (UINT64)0x514, // Address + (UINT64)FW_CFG_IO_DMA_ADDRESS, // Address (UINTN)2, // Count &BigEndianAddressOfAccess // Buffer ); diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/= QemuFwCfgLib/QemuFwCfgLib.c index d79d0a444ca7..3dd55ba5042e 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c @@ -94,8 +94,8 @@ InternalQemuFwCfgDmaBytes ( // AccessHigh =3D (UINT32)RShiftU64 ((UINTN)&Access, 32); AccessLow =3D (UINT32)(UINTN)&Access; - IoWrite32 (0x514, SwapBytes32 (AccessHigh)); - IoWrite32 (0x518, SwapBytes32 (AccessLow)); + IoWrite32 (FW_CFG_IO_DMA_ADDRESS, SwapBytes32 (AccessHigh)); + IoWrite32 (FW_CFG_IO_DMA_ADDRESS + 4, SwapBytes32 (AccessLow)); =20 // // Don't look at Access.Control before starting the transfer. diff --git a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c b/OvmfPkg/SmmControl2Dxe/= SmiFeatures.c index 73c29848b334..bd257f15d955 100644 --- a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c +++ b/OvmfPkg/SmmControl2Dxe/SmiFeatures.c @@ -240,7 +240,7 @@ SaveSmiFeatures ( S3SaveState, // This EFI_BOOT_SCRIPT_IO_WRITE_OPCODE, // OpCode EfiBootScriptWidthUint32, // Width - (UINT64)0x514, // Address + (UINT64)FW_CFG_IO_DMA_ADDRESS, // Address (UINTN)2, // Count &AccessAddress // Buffer ); --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel