From nobody Mon Jun 12 13:18:46 2023 X-Original-To: virtualization@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Qfss21Tz7z4cBl7 for ; Mon, 12 Jun 2023 13:26:14 +0000 (UTC) (envelope-from corvink@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qfss10y23z43Wn; Mon, 12 Jun 2023 13:26:13 +0000 (UTC) (envelope-from corvink@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686576373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xjTKO4LYDcsrVo6j4c2xRcv7WgfSI3eQvKmJtm7qeao=; b=ovX6loSGtKga5/BUJbdhy4RZ94L9yKy/s5rorqtsrh3/t3DXcz+FvHMvmVjOklETXS0u2F 8VRB15lqVOlIf/wX1mW4jd+eX4Vuy8F/KQIezqlhv7m4r6ino2BD5DnqWfCw92s4HoSDr2 FT0MSR/bpI3vqnBfO5sfBBBvcM4+ztouNdSrRVebDy23vjcHBCXDgF7D+c2qtpMhnJ4vd9 OQLbe1IRDcO+UFr5MvtUNQ3MU2ty9hBLmYFOW0Ha+xBK1NqagNXywxbFy4LjAFDd4zSCfc GLLw/YB1wosgmqnfq51pBx87JOnyIMRvMTUVuKOmgZkh4JoTzqmqnagIcV/UHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686576373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xjTKO4LYDcsrVo6j4c2xRcv7WgfSI3eQvKmJtm7qeao=; b=SFUPhtqBYXKsPYuFmh4+b8GCI9RquYZIBt2dSUmhoZw7kZIEWBg0nlRswuoSAVFkPhQfn9 cmyRMuCqKCEJs5XM2kGgVCjJP7xQJPDwtynAjnVJ1OVkJ8YNOmbvFbLQUdobEFjWh+Sj4T NvbcxjUTvwcmE2S5bEil8I+SV1qc0M25rP/2nebpDVGQmY1WH1sW0gpRWV/M8YSi4sF9v+ Cofg3cTi7a8c9OiFGcfjjJ9CAYfRbcVMU3y0QTkAJPMyeEb4Re0/jwD7Su6uWsXIVuLNFC lV1uZkFFaI2pfN9FTAiy9HHSZD4LAAk8yIFeRX5hbePQ+BYRGwe46rsu7r4vlw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686576373; a=rsa-sha256; cv=none; b=omQfbFEYz8y80wJyLOe3Gy8oEU2KuZfaD2UkD3Ksg0kYKlhIIFSXPHBbiYORwUHkfX1KdV z880L+BKyNnHeDqpb9GWHYEB3WO5itztfBFnFWwHRK/An/GNmjUKgZMUn1aaytGhFhzfCo GKgkt61opptl8ejIoeCm5YVcBeBLpfaz+KIWZ/U6hmE7bnpZsw7LUcxGFunDgBTkKDc5Ow uYzhOgMUdobC+iTpzcx1l/Xa/41m7DY/SDSMOmCSwfkSiwSQk7OYR6Y9MeZNWEvgF5SUd3 ysgh6rdEtCqpKTA+sJ8LVf7XQxtuPQur/vXa2/PyPHh4kuTbQYFkdaQHG10WCA== Received: from corvink-nb.beckhoff.com (unknown [195.226.174.194]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: corvink) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Qfss04L9CzPBG; Mon, 12 Jun 2023 13:26:12 +0000 (UTC) (envelope-from corvink@FreeBSD.org) From: =?UTF-8?q?Corvin=20K=C3=B6hne?= To: virtualization@freebsd.org Cc: =?UTF-8?q?Corvin=20K=C3=B6hne?= Subject: [PATCH 2/5] OvmfPkg: move BootScript into AcpiPlatformLib Date: Mon, 12 Jun 2023 15:18:46 +0200 Message-ID: <20230612132558.349152-3-corvink@FreeBSD.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612132558.349152-1-corvink@FreeBSD.org> References: <20230612132558.349152-1-corvink@FreeBSD.org> List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ThisMailContainsUnwantedMimeParts: N This is required to move InstallQemuFwCfgTables into AcpiPlatformLib. Signed-off-by: Corvin Köhne --- OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf | 2 -- .../AcpiPlatformLib/DxeAcpiPlatformLib.inf | 2 ++ OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h | 27 ------------------- OvmfPkg/Include/Library/AcpiPlatformLib.h | 27 +++++++++++++++++++ .../AcpiPlatformLib}/BootScript.c | 3 +-- 5 files changed, 30 insertions(+), 31 deletions(-) rename OvmfPkg/{AcpiPlatformDxe => Library/AcpiPlatformLib}/BootScript.c (96%) diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf index b22aad95e081..6001b9626970 100644 --- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -23,7 +23,6 @@ [Defines] [Sources] AcpiPlatform.c AcpiPlatform.h - BootScript.c CloudHvAcpi.c EntryPoint.c QemuFwCfgAcpi.c @@ -40,7 +39,6 @@ [LibraryClasses] MemoryAllocationLib OrderedCollectionLib QemuFwCfgLib - QemuFwCfgS3Lib UefiDriverEntryPoint HobLib TpmMeasurementLib diff --git a/OvmfPkg/Library/AcpiPlatformLib/DxeAcpiPlatformLib.inf b/OvmfPkg/Library/AcpiPlatformLib/DxeAcpiPlatformLib.inf index 4be501bb2c58..b6e55b618cbb 100644 --- a/OvmfPkg/Library/AcpiPlatformLib/DxeAcpiPlatformLib.inf +++ b/OvmfPkg/Library/AcpiPlatformLib/DxeAcpiPlatformLib.inf @@ -15,6 +15,7 @@ [Defines] LIBRARY_CLASS = AcpiPlatformLib [Sources] + BootScript.c DxeAcpiPlatformLib.c PciDecoding.c @@ -27,6 +28,7 @@ [LibraryClasses] BaseLib DebugLib PcdLib + QemuFwCfgS3Lib UefiBootServicesTableLib [Pcd] diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h index 1328f6d1cba6..c9f2755014a1 100644 --- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h @@ -11,8 +11,6 @@ #include // EFI_ACPI_TABLE_PROTOCOL -typedef struct S3_CONTEXT S3_CONTEXT; - EFI_STATUS EFIAPI InstallCloudHvTablesTdx ( @@ -37,29 +35,4 @@ InstallAcpiTables ( IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable ); -EFI_STATUS -AllocateS3Context ( - OUT S3_CONTEXT **S3Context, - IN UINTN WritePointerCount - ); - -VOID -ReleaseS3Context ( - IN S3_CONTEXT *S3Context - ); - -EFI_STATUS -SaveCondensedWritePointerToS3Context ( - IN OUT S3_CONTEXT *S3Context, - IN UINT16 PointerItem, - IN UINT8 PointerSize, - IN UINT32 PointerOffset, - IN UINT64 PointerValue - ); - -EFI_STATUS -TransferS3ContextToBootScript ( - IN S3_CONTEXT *S3Context - ); - #endif diff --git a/OvmfPkg/Include/Library/AcpiPlatformLib.h b/OvmfPkg/Include/Library/AcpiPlatformLib.h index a1198da296a5..a79d698a8750 100644 --- a/OvmfPkg/Include/Library/AcpiPlatformLib.h +++ b/OvmfPkg/Include/Library/AcpiPlatformLib.h @@ -12,6 +12,8 @@ typedef struct { UINT64 PciAttributes; } ORIGINAL_ATTRIBUTES; +typedef struct S3_CONTEXT S3_CONTEXT; + /** Searches and returns the address of the ACPI Root System Description Pointer (RSDP) in system memory. @@ -65,3 +67,28 @@ RestorePciDecoding ( IN ORIGINAL_ATTRIBUTES *OriginalAttributes, IN UINTN Count ); + +EFI_STATUS +AllocateS3Context ( + OUT S3_CONTEXT **S3Context, + IN UINTN WritePointerCount + ); + +VOID +ReleaseS3Context ( + IN S3_CONTEXT *S3Context + ); + +EFI_STATUS +SaveCondensedWritePointerToS3Context ( + IN OUT S3_CONTEXT *S3Context, + IN UINT16 PointerItem, + IN UINT8 PointerSize, + IN UINT32 PointerOffset, + IN UINT64 PointerValue + ); + +EFI_STATUS +TransferS3ContextToBootScript ( + IN S3_CONTEXT *S3Context + ); diff --git a/OvmfPkg/AcpiPlatformDxe/BootScript.c b/OvmfPkg/Library/AcpiPlatformLib/BootScript.c similarity index 96% rename from OvmfPkg/AcpiPlatformDxe/BootScript.c rename to OvmfPkg/Library/AcpiPlatformLib/BootScript.c index ff1491de0d2d..1b1658d703b0 100644 --- a/OvmfPkg/AcpiPlatformDxe/BootScript.c +++ b/OvmfPkg/Library/AcpiPlatformLib/BootScript.c @@ -7,13 +7,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ +#include #include // CpuDeadLoop() #include // DEBUG() #include // AllocatePool() #include // QemuFwCfgS3ScriptSkipBytes() -#include "AcpiPlatform.h" - // // Condensed structure for capturing the fw_cfg operations -- select, skip, // write -- inherent in executing a QEMU_LOADER_WRITE_POINTER command. -- 2.41.0