From nobody Mon Feb 9 09:33:53 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+75709+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+75709+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1622062514; cv=none; d=zohomail.com; s=zohoarc; b=j5/7rezsu/jwrg4nekQYkb80h+xdQ9tM0s7dze+/egKBqmXSg+QoaPY71Xq4RvSnIhQ/6x3S1tiJ3Jiuu909gQYkpdCRMEb+llxUsEhSilic0jOT2mzngtSrGmVJ+r/dh/S/8KN2XCzGNPfEbAyvQqf/OqEBJJBMpGNyfU9NfyE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622062514; 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=bEmgkV9tNyEKAmCwT0I0c0THpcgNlz1lPqy5vPJF8XU=; b=dMT96jQBy6ekUBC45QdQ/DAN+Uy83fjeXOEqjLYxpy8+E16A1JotaNrkytwA66a8l2npcTvTjgz/bjOQ1ap25GjFuY+aE64AfdpK/EDOqb9+lk3Ru4XWEg3YMRu61ojI2HJq4CGVe/xAPOesMQsqhhlvml6O4uC4J0TqOUXislo= 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+75709+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 162206251437686.37681839448965; Wed, 26 May 2021 13:55:14 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id PlUdYY1788612x3kYk8il102; Wed, 26 May 2021 13:55:14 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.3299.1622062513433635244 for ; Wed, 26 May 2021 13:55:13 -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-340-Lxl3MDfRP7acAV6TM4SOKg-1; Wed, 26 May 2021 16:55:08 -0400 X-MC-Unique: Lxl3MDfRP7acAV6TM4SOKg-1 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D9A3880ED9B; Wed, 26 May 2021 20:55:07 +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 C4C285D767; Wed, 26 May 2021 20:55:06 +0000 (UTC) From: "Laszlo Ersek" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jordan Justen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [edk2-devel] [PATCH 38/43] OvmfPkg/SmbiosPlatformDxe: locate SMBIOS protocol in InstallAllStructures() Date: Wed, 26 May 2021 22:14:41 +0200 Message-Id: <20210526201446.12554-39-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.15 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: Rxxu8kPGJnVi675qRqytc93cx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622062514; bh=bEmgkV9tNyEKAmCwT0I0c0THpcgNlz1lPqy5vPJF8XU=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=nRzXzbBcynRhs548RE5zsDge06PSZo/Es9AjpXDLOCLKCJvxjAjCbm9BEbhk+GJor2j RBCg+sA5sJ4TvRzDCNjNue2Z9t9pNF8aHPI78kE9rFaarzHFZI232gdlGti14BPx8OEIs S8y5zd7BBhTIjYTVJDQFNC0BTnT7G5wgpV4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Locate the SMBIOS protocol internally to the InstallAllStructures() function. This has no performance impact (InstallAllStructures() is only called once), but moving the code from the entry point function makes the latter smaller. And that will be useful when we split the entry point function to two versions. Cc: Ard Biesheuvel Cc: Jordan Justen 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.c | 30 +++++++++----------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/Smbios= PlatformDxe/SmbiosPlatformDxe.c index 6d73173aa512..757bec879e4a 100644 --- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -92,27 +92,38 @@ SmbiosTableLength ( } =20 =20 /** Install all structures from the given SMBIOS structures block =20 - @param Smbios SMBIOS protocol @param TableAddress SMBIOS tables starting address =20 **/ EFI_STATUS InstallAllStructures ( - IN EFI_SMBIOS_PROTOCOL *Smbios, IN UINT8 *TableAddress ) { + EFI_SMBIOS_PROTOCOL *Smbios; EFI_STATUS Status; SMBIOS_STRUCTURE_POINTER SmbiosTable; EFI_SMBIOS_HANDLE SmbiosHandle; BOOLEAN NeedSmbiosType0; =20 + // + // Find the SMBIOS protocol + // + Status =3D gBS->LocateProtocol ( + &gEfiSmbiosProtocolGuid, + NULL, + (VOID**)&Smbios + ); + if (EFI_ERROR (Status)) { + return Status; + } + SmbiosTable.Raw =3D TableAddress; if (SmbiosTable.Raw =3D=3D NULL) { return EFI_INVALID_PARAMETER; } =20 NeedSmbiosType0 =3D TRUE; @@ -173,41 +184,28 @@ EFIAPI SmbiosTablePublishEntry ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; - EFI_SMBIOS_PROTOCOL *Smbios; SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure; UINT8 *SmbiosTables; =20 - // - // Find the SMBIOS protocol - // - Status =3D gBS->LocateProtocol ( - &gEfiSmbiosProtocolGuid, - NULL, - (VOID**)&Smbios - ); - if (EFI_ERROR (Status)) { - return Status; - } - 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 (); } =20 if (SmbiosTables !=3D NULL) { - Status =3D InstallAllStructures (Smbios, SmbiosTables); + Status =3D InstallAllStructures (SmbiosTables); =20 // // Free SmbiosTables if allocated by Qemu (i.e., NOT by Xen): // if (EntryPointStructure =3D=3D NULL) { FreePool (SmbiosTables); --=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 (#75709): https://edk2.groups.io/g/devel/message/75709 Mute This Topic: https://groups.io/mt/83111142/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-