From nobody Sat Apr 20 12:37:07 2024 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+91993+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+91993+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1659235882; cv=none; d=zohomail.com; s=zohoarc; b=RzHMUB1SF7Bn09+PcjoqcMwjyrRmssPZacARDz+cEglU9bUncBw+oZwe+ULKoyVPnQw5o/LmIInwz5++HG6gkG/3teqQK67qst0ibRaPs6BWqhvQM3rQ46okAJ0H4D6mcyuvLD2jyWfbAAi7YX4UBOz9diIfbddIigAmOmqPvjI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659235882; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=nqcNhhj8mA6KWSps/SlokLMu4MNmwRdSJzxDU155Wig=; b=CFffBBfcjoNBsNxRbhHlT8xvfZ71nM4D5bQu7IAMzELs3IklzeVwT/2JW6xVcpSnEeBqh8UNP8M3gD4F9Ags8e+voxae+oiO3Dlqpxu3QxHe49XtNu96dpDh5Isn1VdvTz36FTY91irtrXd51SA9eI7FAr8yMNFR1aZJI+Lr3SU= 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+91993+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1659235882106110.20027940081502; Sat, 30 Jul 2022 19:51:22 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id zUq1YY1788612xhbQu8gxCum; Sat, 30 Jul 2022 19:51:20 -0700 X-Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) by mx.groups.io with SMTP id smtpd.web08.625.1659161876704010576 for ; Fri, 29 Jul 2022 23:17:56 -0700 X-Received: by mail-ot1-f42.google.com with SMTP id k25-20020a056830169900b0061c6f68f451so4665334otr.9 for ; Fri, 29 Jul 2022 23:17:56 -0700 (PDT) X-Gm-Message-State: xD1XPoPVgSydbwtRGzNH52BYx1787277AA= X-Google-Smtp-Source: AGRyM1u03o7T9h8jzukc1SNklptpTIsj6eyZp6wxjnYJy8Rnm9wXO7BOmSMzIyqc1kBfRDyP0EcnKQ== X-Received: by 2002:a9d:6f01:0:b0:61c:b224:e7c9 with SMTP id n1-20020a9d6f01000000b0061cb224e7c9mr2748044otq.245.1659161875856; Fri, 29 Jul 2022 23:17:55 -0700 (PDT) X-Received: from archPC.hsd1.tx.comcast.net ([76.31.233.245]) by smtp.gmail.com with ESMTPSA id j8-20020a9d7d88000000b0061c3753c30dsm1592914otn.17.2022.07.29.23.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jul 2022 23:17:55 -0700 (PDT) From: "Ammar Ratnani" To: devel@edk2.groups.io Cc: Ammar Ratnani Subject: [edk2-devel] [PATCH] OvmfPkg/SmbiosPlatformDxe: Always add BIOS Information structure Date: Sat, 30 Jul 2022 02:17:36 -0400 Message-Id: <9fd37a04bed1f8e0f7cfd0882d54ff17ff198af5.1659161548.git.ammrat13@gmail.com> MIME-Version: 1.0 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,ammrat13@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1659235880; bh=PuYHgl34RgSMv8waAZLibhY3qdwWFNLL2HXuWAH/rtg=; h=Cc:Date:From:Reply-To:Subject:To; b=kY6AIfS+9ZjRUy0Bwq2Etmr7zVQu8lECMJihOordZ4bL8OmxNQBKkD37zZokBU+mUAH 9TWxSGnxFO0BOo9JGAwr/eqcZncgaXfP0IqcSMUEQWQoqouFdpehmLCXKO1aUV/BgKZOW Wd8ExxAbl0usKHO4Cs4LklQR8B6rV/rHtls= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1659235883880100003 Content-Type: text/plain; charset="utf-8" If OVMF is not running on Cloud Hypervisor nor QEMU, previously no SMBIOS structures would be registered with the EFI_SMBIOS_PROTOCOL. This patch instead registers the default BIOS Information (Type 0) structure, defined as mOvmfDefaultType0 in SmbiosPlatformDxe.c. This change appeases (at least) the Windows Deployment Services client, which requires some SMBIOS data to be present. Signed-off-by: Ammar Ratnani --- OvmfPkg/SmbiosPlatformDxe/EntryPoint.c | 11 ++++ OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 59 +++++++++++-------- 2 files changed, 44 insertions(+), 26 deletions(-) diff --git a/OvmfPkg/SmbiosPlatformDxe/EntryPoint.c b/OvmfPkg/SmbiosPlatfor= mDxe/EntryPoint.c index e55d135504..4f82cf5da8 100644 --- a/OvmfPkg/SmbiosPlatformDxe/EntryPoint.c +++ b/OvmfPkg/SmbiosPlatformDxe/EntryPoint.c @@ -48,5 +48,16 @@ SmbiosTablePublishEntry ( } } =20 + // + // If Status still reads EFI_NOT_FOUND, either there are no drivers + // implementing EFI_SMBIOS_PROTOCOL, or none of the above codepaths ran.= In + // the second case, call InstallAllStructures with NULL so that the defa= ult + // Type 0 (BIOS Information) structure is installed. In the first case, + // calling InstallAllStructures is harmless because it'll fail immediate= ly. + // + if (Status =3D=3D EFI_NOT_FOUND) { + Status =3D InstallAllStructures (NULL); + } + return Status; } diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/Smbios= PlatformDxe/SmbiosPlatformDxe.c index 94249d3ff1..e575a5f141 100644 --- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -93,12 +93,17 @@ SmbiosTableLength ( /** Install all structures from the given SMBIOS structures block =20 + Notice that the SMBIOS table address is optional. If it's not provided, = this + function will function as if the first structure encountered is an + End-of-Table (Type 127). Importantly, in that case it will still install + mOvmfDefaultType0. + @param TableAddress SMBIOS tables starting address =20 **/ EFI_STATUS InstallAllStructures ( - IN UINT8 *TableAddress + IN UINT8 *TableAddress OPTIONAL ) { EFI_SMBIOS_PROTOCOL *Smbios; @@ -119,34 +124,36 @@ InstallAllStructures ( return Status; } =20 - SmbiosTable.Raw =3D TableAddress; - if (SmbiosTable.Raw =3D=3D NULL) { - return EFI_INVALID_PARAMETER; - } - NeedSmbiosType0 =3D TRUE; =20 - while (SmbiosTable.Hdr->Type !=3D 127) { - // - // Log the SMBIOS data for this structure - // - SmbiosHandle =3D SmbiosTable.Hdr->Handle; - Status =3D Smbios->Add ( - Smbios, - NULL, - &SmbiosHandle, - (EFI_SMBIOS_TABLE_HEADER *)SmbiosTable.Raw - ); - ASSERT_EFI_ERROR (Status); - - if (SmbiosTable.Hdr->Type =3D=3D 0) { - NeedSmbiosType0 =3D FALSE; + // + // If the TableAddress is NULL, that's not an error. Just don't try to l= oop + // over it. + // + SmbiosTable.Raw =3D TableAddress; + if (SmbiosTable.Raw !=3D NULL) { + while (SmbiosTable.Hdr->Type !=3D 127) { + // + // Log the SMBIOS data for this structure + // + SmbiosHandle =3D SmbiosTable.Hdr->Handle; + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)SmbiosTable.Raw + ); + ASSERT_EFI_ERROR (Status); + + if (SmbiosTable.Hdr->Type =3D=3D 0) { + NeedSmbiosType0 =3D FALSE; + } + + // + // Get the next structure address + // + SmbiosTable.Raw =3D (UINT8 *)(SmbiosTable.Raw + SmbiosTableLength (S= mbiosTable)); } - - // - // Get the next structure address - // - SmbiosTable.Raw =3D (UINT8 *)(SmbiosTable.Raw + SmbiosTableLength (Smb= iosTable)); } =20 if (NeedSmbiosType0) { --=20 2.37.1 -=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 (#91993): https://edk2.groups.io/g/devel/message/91993 Mute This Topic: https://groups.io/mt/92721482/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-