From nobody Tue Feb 10 05:27:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+75713+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75713+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622062770; cv=none; d=zohomail.com; s=zohoarc; b=USxMnHS/X5O/XRtXbMXP7rZ2W616YZLJ6sIfAJ2RR2zIKvuo9zUeDw7uTTdpyBnnOBRJHJoOWatA29qZn6+3U2Qm8mdn4hd3ktYfTkzqi4Yr0OE9kkiFcb8ffGTjE6mrYhRo+yx8HWCmvLAXpbwrBcfKJom7pka7kBoMTeHKHZI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622062770; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Hi2DZOZF5wXDS3zuNHqniIFfYxIiS3poeGngZOzMTsk=; b=NqDQPFyAIvFs/BHnrD4jDIHMzt+9YcAYXqyRaq4lAIRC601os9wEjcQO4cVp6n1omHLuVLKq5ivnIiDJmGunUEhTaggiWuLhUtVkZsfCVbuSLdR5olBHJYXeewhaV43nkk69R3LWvIhKESPJm15yekiD3YNoRa3FxVqIpivfG60= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75713+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1622062770357845.9687612114543; Wed, 26 May 2021 13:59:30 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id KxlGYY1788612xnfqZdaJdHO; Wed, 26 May 2021 13:59:29 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web12.3368.1622062764302370797 for ; Wed, 26 May 2021 13:59:24 -0700 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-209-GLB6MP8UM_uF1VdJeydEww-1; Wed, 26 May 2021 16:59:19 -0400 X-MC-Unique: GLB6MP8UM_uF1VdJeydEww-1 X-Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 88D7D10082E1; Wed, 26 May 2021 20:59:18 +0000 (UTC) X-Received: from lacos-laptop-7.usersys.redhat.com (ovpn-114-61.ams2.redhat.com [10.36.114.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF23F5D9CC; Wed, 26 May 2021 20:59:16 +0000 (UTC) From: "Laszlo Ersek" To: devel@edk2.groups.io Cc: Anthony Perard , Ard Biesheuvel , Jordan Justen , Julien Grall , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [edk2-devel] [PATCH 42/43] OvmfPkg/SmbiosPlatformDxe: split Xen entry point from QEMU entry point Date: Wed, 26 May 2021 22:14:45 +0200 Message-Id: <20210526201446.12554-43-lersek@redhat.com> In-Reply-To: <20210526201446.12554-1-lersek@redhat.com> References: <20210526201446.12554-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com X-Gm-Message-State: OLVqClyWibIqqrbKpA1G5yxUx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622062769; bh=Hi2DZOZF5wXDS3zuNHqniIFfYxIiS3poeGngZOzMTsk=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=wRUrHNF1ONV6N4+GduOoN8AO1WS0qpyx7PCg8r15r62ZSe28QnwBZHe/PcGxxgiGGqP ZzUAF06s64iNTRqYTCADu8V1iKT3eMiBJFxIe5RcZa2T+DtJG7ibdsjV534pnq/4pDNaG X8jYHJaWZNIoW33R5XpasMWaLAKVvBsJElk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Remove the SmbiosTablePublishEntry() function from "SmbiosPlatformDxe.c". "SmbiosPlatformDxe.c" becomes hypervisor-agnostic. Add SmbiosTablePublishEntry() back, simplified for QEMU, to the existent file "Qemu.c". The GetQemuSmbiosTables() function no longer needs to be declared in "SmbiosPlatformDxe.h"; "SmbiosPlatformDxe.h" becomes hypervisor-agnostic. Add SmbiosTablePublishEntry() back, renamed and simplified for Xen, to the new, arch-independent file "Xen.c". (The existent Xen-specific C files are arch-dependent.) Update both INF files; remove the dependencies that are now superfluous in each. Cc: Anthony Perard Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Julien Grall Cc: Philippe Mathieu-Daud=C3=A9 Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2122 Signed-off-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daude --- OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 14 ------ OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf | 12 ++--- OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 11 ----- OvmfPkg/SmbiosPlatformDxe/Qemu.c | 33 +++++++++++++ OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 49 ------------------= -- OvmfPkg/SmbiosPlatformDxe/Xen.c | 49 ++++++++++++++++++= ++ 6 files changed, 86 insertions(+), 82 deletions(-) diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/Smbi= osPlatformDxe/SmbiosPlatformDxe.inf index 140fa16ac135..eaee73110d27 100644 --- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -24,19 +24,12 @@ [Defines] # =20 [Sources] Qemu.c SmbiosPlatformDxe.c SmbiosPlatformDxe.h - XenSmbiosPlatformDxe.h - -[Sources.IA32, Sources.X64] - X86Xen.c - -[Sources.ARM, Sources.AARCH64] - ArmXen.c =20 [Packages] MdePkg/MdePkg.dec OvmfPkg/OvmfPkg.dec =20 [LibraryClasses] @@ -44,22 +37,15 @@ [LibraryClasses] MemoryAllocationLib PcdLib QemuFwCfgLib UefiBootServicesTableLib UefiDriverEntryPoint =20 -[LibraryClasses.IA32, LibraryClasses.X64] - BaseLib - HobLib - [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated =20 [Protocols] gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED =20 -[Guids.IA32, Guids.X64] - gEfiXenInfoGuid - [Depex] gEfiSmbiosProtocolGuid =20 diff --git a/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf b/OvmfPkg/S= mbiosPlatformDxe/XenSmbiosPlatformDxe.inf index 5a093c69afd9..7f4588e33d1e 100644 --- a/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf +++ b/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf @@ -13,51 +13,47 @@ [Defines] INF_VERSION =3D 0x00010005 BASE_NAME =3D XenSmbiosPlatformDxe FILE_GUID =3D c41f0579-5598-40f1-95db-3983c8ebbe2a MODULE_TYPE =3D DXE_DRIVER VERSION_STRING =3D 1.0 =20 - ENTRY_POINT =3D SmbiosTablePublishEntry + ENTRY_POINT =3D XenSmbiosTablePublishEntry =20 # # The following information is for reference only and not required by the = build tools. # # VALID_ARCHITECTURES =3D IA32 X64 EBC ARM AARCH64 # =20 [Sources] - Qemu.c SmbiosPlatformDxe.c SmbiosPlatformDxe.h + Xen.c XenSmbiosPlatformDxe.h =20 [Sources.IA32, Sources.X64] X86Xen.c =20 [Sources.ARM, Sources.AARCH64] ArmXen.c =20 [Packages] MdePkg/MdePkg.dec + +[Packages.IA32, Packages.X64] OvmfPkg/OvmfPkg.dec =20 [LibraryClasses] DebugLib - MemoryAllocationLib - PcdLib - QemuFwCfgLib UefiBootServicesTableLib UefiDriverEntryPoint =20 [LibraryClasses.IA32, LibraryClasses.X64] BaseLib HobLib =20 -[Pcd] - gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated - [Protocols] gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED =20 [Guids.IA32, Guids.X64] gEfiXenInfoGuid =20 diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/OvmfPkg/Smbios= PlatformDxe/SmbiosPlatformDxe.h index 0ae2556fe800..213a7f39e91d 100644 --- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -19,18 +19,7 @@ **/ EFI_STATUS InstallAllStructures ( IN UINT8 *TableAddress ); =20 -/** - Locates and extracts the QEMU SMBIOS table data if present in fw_cfg - - @return Address of extracted QEMU SMBIOS data - -**/ -UINT8 * -GetQemuSmbiosTables ( - VOID - ); - #endif diff --git a/OvmfPkg/SmbiosPlatformDxe/Qemu.c b/OvmfPkg/SmbiosPlatformDxe/Q= emu.c index fcfc3e33c28c..a668c6ac2123 100644 --- a/OvmfPkg/SmbiosPlatformDxe/Qemu.c +++ b/OvmfPkg/SmbiosPlatformDxe/Qemu.c @@ -45,6 +45,39 @@ GetQemuSmbiosTables ( =20 QemuFwCfgSelectItem (Tables); QemuFwCfgReadBytes (TablesSize, QemuTables); =20 return QemuTables; } + +/** + Installs SMBIOS information for OVMF + + @param ImageHandle Module's image handle + @param SystemTable Pointer of EFI_SYSTEM_TABLE + + @retval EFI_SUCCESS Smbios data successfully installed + @retval Other Smbios data was not installed + +**/ +EFI_STATUS +EFIAPI +SmbiosTablePublishEntry ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + UINT8 *SmbiosTables; + + Status =3D EFI_NOT_FOUND; + // + // Add QEMU SMBIOS data if found + // + SmbiosTables =3D GetQemuSmbiosTables (); + if (SmbiosTables !=3D NULL) { + Status =3D InstallAllStructures (SmbiosTables); + FreePool (SmbiosTables); + } + + return Status; +} diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/Smbios= PlatformDxe/SmbiosPlatformDxe.c index f280a1852ddd..7bcf83762e9b 100644 --- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -7,18 +7,16 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 #include // SMBIOS_TABLE_TYPE0 #include // ASSERT_EFI_ERROR() -#include // FreePool() #include // gBS #include // EFI_SMBIOS_PROTOCOL =20 #include "SmbiosPlatformDxe.h" -#include "XenSmbiosPlatformDxe.h" =20 #define TYPE0_STRINGS \ "EFI Development Kit II / OVMF\0" /* Vendor */ \ "0.0.0\0" /* BiosVersion */ \ "02/06/2015\0" /* BiosReleaseDate */ // @@ -165,53 +163,6 @@ InstallAllStructures ( ); ASSERT_EFI_ERROR (Status); } =20 return EFI_SUCCESS; } - - -/** - Installs SMBIOS information for OVMF - - @param ImageHandle Module's image handle - @param SystemTable Pointer of EFI_SYSTEM_TABLE - - @retval EFI_SUCCESS Smbios data successfully installed - @retval Other Smbios data was not installed - -**/ -EFI_STATUS -EFIAPI -SmbiosTablePublishEntry ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure; - UINT8 *SmbiosTables; - - Status =3D EFI_NOT_FOUND; - // - // Add Xen or QEMU SMBIOS data if found - // - EntryPointStructure =3D GetXenSmbiosTables (); - if (EntryPointStructure !=3D NULL) { - SmbiosTables =3D (UINT8*)(UINTN)EntryPointStructure->TableAddress; - } else { - SmbiosTables =3D GetQemuSmbiosTables (); - } - - if (SmbiosTables !=3D NULL) { - Status =3D InstallAllStructures (SmbiosTables); - - // - // Free SmbiosTables if allocated by Qemu (i.e., NOT by Xen): - // - if (EntryPointStructure =3D=3D NULL) { - FreePool (SmbiosTables); - } - } - - return Status; -} diff --git a/OvmfPkg/SmbiosPlatformDxe/Xen.c b/OvmfPkg/SmbiosPlatformDxe/Xe= n.c new file mode 100644 index 000000000000..75d9550913d1 --- /dev/null +++ b/OvmfPkg/SmbiosPlatformDxe/Xen.c @@ -0,0 +1,49 @@ +/** @file + This driver installs SMBIOS information for OVMF on Xen + + Copyright (C) 2021, Red Hat, Inc. + Copyright (c) 2011, Bei Guan + Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "SmbiosPlatformDxe.h" +#include "XenSmbiosPlatformDxe.h" + +/** + Installs SMBIOS information for OVMF on Xen + + @param ImageHandle Module's image handle + @param SystemTable Pointer of EFI_SYSTEM_TABLE + + @retval EFI_SUCCESS Smbios data successfully installed + @retval Other Smbios data was not installed + +**/ +EFI_STATUS +EFIAPI +XenSmbiosTablePublishEntry ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure; + UINT8 *SmbiosTables; + + Status =3D EFI_NOT_FOUND; + // + // Add Xen SMBIOS data if found + // + EntryPointStructure =3D GetXenSmbiosTables (); + if (EntryPointStructure !=3D NULL) { + SmbiosTables =3D (UINT8*)(UINTN)EntryPointStructure->TableAddress; + if (SmbiosTables !=3D NULL) { + Status =3D InstallAllStructures (SmbiosTables); + } + } + + return Status; +} --=20 2.19.1.3.g30247aa5d201 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#75713): https://edk2.groups.io/g/devel/message/75713 Mute This Topic: https://groups.io/mt/83111228/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-