From nobody Thu May 16 10:18:47 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+76031+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+76031+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622782635; cv=none; d=zohomail.com; s=zohoarc; b=gB6mg2wT5G+aMfTik4Vkxt8YP2bR4398d/xpicWwwzclIMg+NXiDuOF4Vd/e/VUSwrKML5givWRfvbebQJL/4JtDQ999hvTUeyBCG369qzfV+OYgZcnh7kwWa+mmYk4pgLC7M2vhjuA6V1vgi0rAHFdiu9tlQg/nM0U0cgCJbVM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622782635; 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=ollZH606MaWj2ATQmqkelWjmKMbyKN/ClJgkbfxZUHI=; b=iwXxqZy8ZC6/jg+INE+TrxUKwVbpHnghdHIxlY7NQEzLfF65C+L+RDleRuZA6SjQmN/n1CytuOuj82RUUQP1pAMDkkK+NBVGWGkWJZjorBSIvayyKVwZc2G7kvXlfl0Hw1sbaKSMIsM5SiFk0I7VS5CE0pdQmeu1EluVbvTs3YU= 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+76031+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 162278263510172.29269035211269; Thu, 3 Jun 2021 21:57:15 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id YievYY1788612xQbpaUQRt6v; Thu, 03 Jun 2021 21:57:14 -0700 X-Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web08.4284.1622782621066069793 for ; Thu, 03 Jun 2021 21:57:01 -0700 IronPort-SDR: BYJPAKxNFDktTKC45FGldrbK2EEFO7zwcNJc+IKkglnoQiw+0Cl1LdQFs2UmYmDi9C6M+8TQcm nG2Kbo9WEUgQ== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="268087097" X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208";a="268087097" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 21:56:55 -0700 IronPort-SDR: sml+9ca3RUE1/bS5FA6SQOIIfL+LiKa/HHUZCOHbzNCadx616URyXVGXne0VpjuHC/8cWqemzE Erd8DuJmdZRw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208";a="480502747" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 03 Jun 2021 21:56:54 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Jian J Wang , Hao A Wu Subject: [edk2-devel] [Patch V2 1/9] MdeModulePkg: Add Universal Payload general defination header file Date: Fri, 4 Jun 2021 12:56:36 +0800 Message-Id: <20210604045644.1721-2-zhiguang.liu@intel.com> In-Reply-To: <20210604045644.1721-1-zhiguang.liu@intel.com> References: <20210604045644.1721-1-zhiguang.liu@intel.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,zhiguang.liu@intel.com X-Gm-Message-State: siVhZsEH7rcFY9b5jNOtKL08x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622782634; bh=qpNW1MCjD3fjDgQORrWtd2YyiPkiywXkbaFbJpH4OKE=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=FI/Z0wGx4vt7eUEYyvkXGaWrXgVIFwQw0cXQdeBMpFHtxNg8B59ecA0jgiANQNGYuY0 0Y4pottUNtZDQ6qjn4F0AgPbDrrSotDBf116TKq0ebQxVvuQ3kVBRULR9SexVV9OHeu9F K6c8j4Bz4bBe385mg/K+2U499g6K3DdYdNU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" V1: Add Universal Payload general defination header file according to Universal Payload=E2=80=99s documentation V2: Add a macro funtion to check the Revision Cc: Michael D Kinney Cc: Liming Gao Cc: Jian J Wang Cc: Hao A Wu Signed-off-by: Zhiguang Liu --- MdeModulePkg/Include/UniversalPayload/UniversalPayload.h | 43 ++++++++++++= +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/MdeModulePkg/Include/UniversalPayload/UniversalPayload.h b/Mde= ModulePkg/Include/UniversalPayload/UniversalPayload.h new file mode 100644 index 0000000000..a026f709bf --- /dev/null +++ b/MdeModulePkg/Include/UniversalPayload/UniversalPayload.h @@ -0,0 +1,43 @@ +/** @file + Universal Payload general definations. + +Copyright (c) 2021, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __UNIVERSAL_PAYLOAD_H__ +#define __UNIVERSAL_PAYLOAD_H__ + +#include + +#pragma pack(1) + +typedef struct { + UINT8 Revision; + UINT8 Reserved; + UINT16 Length; +} PLD_GENERIC_HEADER; + +#pragma pack() + +/** + Returns the size of a structure of known type, up through and including = a specified field. + + @param TYPE The name of the data structure that contains the field= specified by Field. + @param Field The name of the field in the data structure. + + @return size, in bytes. + +**/ +#define PLD_SIZEOF_THROUGH_FIELD(TYPE, Field) (OFFSET_OF(TYPE, Field) + si= zeof (((TYPE *) 0)->Field)) + +#define IS_PLD_HEADER_HAS_REVISION(GuidHob, ExpectedRevision) \ + ( \ + (GuidHob !=3D NULL) && \ + (sizeof (PLD_GENERIC_HEADER) <=3D GET_GUID_HOB_DATA_SIZE (GuidHob)) &&= \ + (((PLD_GENERIC_HEADER *) GET_GUID_HOB_DATA (GuidHob))->Length <=3D GET= _GUID_HOB_DATA_SIZE (GuidHob)) && \ + (((PLD_GENERIC_HEADER *) GET_GUID_HOB_DATA (GuidHob))->Revision =3D=3D= ExpectedRevision) \ + ) + +#endif // __UNIVERSAL_PAYLOAD_H__ --=20 2.30.0.windows.2 -=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 (#76031): https://edk2.groups.io/g/devel/message/76031 Mute This Topic: https://groups.io/mt/83301962/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- From nobody Thu May 16 10:18:47 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+76034+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+76034+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622782633; cv=none; d=zohomail.com; s=zohoarc; b=oLHdP1v6F53IIqpCESe/KYmD6CfFnOOh1oLuFX9ailOzR9SRkeVp1h3znGnpMYJjtYC/woC8Y725ZL7hsp9Ou5O35ZXHk6qNEDuak5abovIjbbHwbIKifti+lHlzhN4w7hdWWEp5xtEq4u86le16IdOOWCdBrFOAClcchxVlTu0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622782633; h=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=jfwowWJ8JxtfuLyk40WRqrMWTK72hvUL4GcQsx/XD4o=; b=lK9d4jiGmk0TEBf5f8e9UyWk5eHtIRKI32B0ZAmlIf49CJDCe3DCK6cLGDqBkS105rtIATMGGS56Ss7JpAcRyOGYMhDTKaIkXY+xOpHuI9yWEsDOIZ/L4xjeezmn5jl0zpPRFgprM0u2+kpbAJ/vq6WRcgajKCsT7FcZCQ7UpHA= 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+76034+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 1622782633769141.91393530036805; Thu, 3 Jun 2021 21:57:13 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ip5uYY1788612x5oCwEJq4fB; Thu, 03 Jun 2021 21:57:13 -0700 X-Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web08.4284.1622782621066069793 for ; Thu, 03 Jun 2021 21:57:02 -0700 IronPort-SDR: StQwQnpW8X+DDZPU2ARR/KbuPfLU8Tfg9GZMPMpwX0hrbUpWiQX+EHvA7msx8Ghk+Kp58I8FuX GZ8LPqcrR95g== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="268087110" X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208";a="268087110" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 21:56:59 -0700 IronPort-SDR: GrzxJGBEYtsSL9sSjYyzr0WgRuIigR792NlYVCLK4VFazPpUCB/ea/KLoD2cI2ropwnZo69LXG bsdkqAm9Oz5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208";a="480502756" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 03 Jun 2021 21:56:55 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Jian J Wang , Hao A Wu Subject: [edk2-devel] [Patch V2 2/9] MdeModulePkg: Add new structure for the PCI Root Bridge Info Hob Date: Fri, 4 Jun 2021 12:56:37 +0800 Message-Id: <20210604045644.1721-3-zhiguang.liu@intel.com> In-Reply-To: <20210604045644.1721-1-zhiguang.liu@intel.com> References: <20210604045644.1721-1-zhiguang.liu@intel.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,zhiguang.liu@intel.com X-Gm-Message-State: 6fg7kEpcMau1BWuIyPx9H2mxx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622782633; bh=C6PShMtAz8mcoZGf/BZCKxNDG5B4v+MdCWNxJecnePk=; h=Cc:Date:From:Reply-To:Subject:To; b=SSW69jc78EWQi8QCP3d4nW7D/MIMyMpUVef09RdwzIBCHlSz1hu6p7TcWoDkTHOzN3F pqRjA+qREl45TJZNdBWjXHaZNeZQ/KZ34bZyc0sz0AUeoFEKlpp0yFEaTRAca9LFGINLX 1WfXFHHxXNWroryeqEU4u7Cmj7+ki3h6UGY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Cc: Michael D Kinney Cc: Liming Gao Cc: Jian J Wang Cc: Hao A Wu Signed-off-by: Zhiguang Liu --- MdeModulePkg/Include/UniversalPayload/PciRootBridges.h | 89 ++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ MdeModulePkg/MdeModulePkg.dec | 6 ++++++ 2 files changed, 95 insertions(+) diff --git a/MdeModulePkg/Include/UniversalPayload/PciRootBridges.h b/MdeMo= dulePkg/Include/UniversalPayload/PciRootBridges.h new file mode 100644 index 0000000000..72e8331ede --- /dev/null +++ b/MdeModulePkg/Include/UniversalPayload/PciRootBridges.h @@ -0,0 +1,89 @@ +/** @file + This file defines the structure for the PCI Root Bridges. + + Copyright (c) 2021, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PLD_PCI_ROOT_BRIDGES_H__ +#define __PLD_PCI_ROOT_BRIDGES_H__ + +#include + +#pragma pack(1) + +// +// (Base > Limit) indicates an aperture is not available. +// +typedef struct { + // + // Base and Limit are the device address instead of host address when + // Translation is not zero + // + UINT64 Base; + UINT64 Limit; + // + // According to UEFI 2.7, Device Address =3D Host Address + Translation, + // so Translation =3D Device Address - Host Address. + // On platforms where Translation is not zero, the subtraction is probab= ly to + // be performed with UINT64 wrap-around semantics, for we may translate = an + // above-4G host address into a below-4G device address for legacy PCIe = device + // compatibility. + // + // NOTE: The alignment of Translation is required to be larger than any = BAR + // alignment in the same root bridge, so that the same alignment can be + // applied to both device address and host address, which simplifies the + // situation and makes the current resource allocation code in generic P= CI + // host bridge driver still work. + // + UINT64 Translation; +} PLD_PCI_ROOT_BRIDGE_APERTURE; + +/// +/// Payload PCI Root Bridge Information HOB +/// +typedef struct { + UINT32 Segment; ///< Segment number. + UINT64 Supports; ///< Supported attri= butes. + ///< Refer to EFI_PC= I_ATTRIBUTE_xxx used by GetAttributes() + ///< and SetAttribut= es() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + UINT64 Attributes; ///< Initial attribu= tes. + ///< Refer to EFI_PC= I_ATTRIBUTE_xxx used by GetAttributes() + ///< and SetAttribut= es() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. + BOOLEAN DmaAbove4G; ///< DMA above 4GB m= emory. + ///< Set to TRUE whe= n root bridge supports DMA above 4GB memory. + BOOLEAN NoExtendedConfigSpace; ///< When FALSE, the= root bridge supports + ///< Extended (4096-= byte) Configuration Space. + ///< When TRUE, the = root bridge supports + ///< 256-byte Config= uration Space only. + UINT64 AllocationAttributes; ///< Allocation attr= ibutes. + ///< Refer to EFI_PC= I_HOST_BRIDGE_COMBINE_MEM_PMEM and + ///< EFI_PCI_HOST_BR= IDGE_MEM64_DECODE used by GetAllocAttributes() + ///< in EFI_PCI_HOST= _BRIDGE_RESOURCE_ALLOCATION_PROTOCOL. + PLD_PCI_ROOT_BRIDGE_APERTURE Bus; ///< Bus aperture wh= ich can be used by the root bridge. + PLD_PCI_ROOT_BRIDGE_APERTURE Io; ///< IO aperture whi= ch can be used by the root bridge. + PLD_PCI_ROOT_BRIDGE_APERTURE Mem; ///< MMIO aperture b= elow 4GB which can be used by the root bridge. + PLD_PCI_ROOT_BRIDGE_APERTURE MemAbove4G; ///< MMIO aperture a= bove 4GB which can be used by the root bridge. + PLD_PCI_ROOT_BRIDGE_APERTURE PMem; ///< Prefetchable MM= IO aperture below 4GB which can be used by the root bridge. + PLD_PCI_ROOT_BRIDGE_APERTURE PMemAbove4G; ///< Prefetchable MM= IO aperture above 4GB which can be used by the root bridge. + UINT32 HID; ///< PnP hardware ID= of the root bridge. This value must match the corresponding + ///< _HID in the ACP= I name space. + UINT32 UID; ///< Unique ID that = is required by ACPI if two devices have the same _HID. + ///< This value must= also match the corresponding _UID/_HID pair in the ACPI name space. +} PLD_PCI_ROOT_BRIDGE; + +typedef struct { + PLD_GENERIC_HEADER PldHeader; + BOOLEAN ResourceAssigned; + UINT8 Count; + PLD_PCI_ROOT_BRIDGE RootBridge[0]; +} PLD_PCI_ROOT_BRIDGES; + +#pragma pack() + +#define PLD_PCI_ROOT_BRIDGES_REVISION 1 + +extern GUID gPldPciRootBridgeInfoGuid; + +#endif // __PLD_PCI_ROOT_BRIDGES_H__ diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 8d38383915..671d0f33c8 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -404,6 +404,12 @@ ## Include/Guid/MigratedFvInfo.h gEdkiiMigratedFvInfoGuid =3D { 0xc1ab12f7, 0x74aa, 0x408d, { 0xa2, 0xf4,= 0xc6, 0xce, 0xfd, 0x17, 0x98, 0x71 } } =20 + # + # GUID defined in UniversalPayload + # + ## Include/UniversalPayload/PciRootBridges.h + gPldPciRootBridgeInfoGuid =3D { 0xec4ebacb, 0x2638, 0x416e, { 0xbe, 0x80= , 0xe5, 0xfa, 0x4b, 0x51, 0x19, 0x01 }} + [Ppis] ## Include/Ppi/AtaController.h gPeiAtaControllerPpiGuid =3D { 0xa45e60d1, 0xc719, 0x44aa, { 0xb0,= 0x7a, 0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d }} --=20 2.30.0.windows.2 -=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 (#76034): https://edk2.groups.io/g/devel/message/76034 Mute This Topic: https://groups.io/mt/83301965/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- From nobody Thu May 16 10:18:47 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+76033+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+76033+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622782637; cv=none; d=zohomail.com; s=zohoarc; b=fjhNT9uW9qln/98A1e3TTNc9MtdOQb4EiaDFy6M3qfTKBHQ/otTDTKswmcwt0vw2/3+82d9Cs3KOGSZXg5jxrQw4q1AZhGuUgJ8HqRr8IlTwBR82stlmyKMCQRq+UjPYYWd6/glK0rvEMoHwYJfcvpUz92L+nVnqY7REUkbtN68= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622782637; h=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=ElrBNQPx2Zf8P0zZJBtuVMgtrnA8dqw/Xrwwv6unW7Y=; b=FtV/QeixdyVDejGxx8hX88/s4Ysc4vn6ZpJxQPLgH9ibkvvL4fhawnceVdircEV2/4uxLQiSeMiWgSpd1MS1PLbfl1QXuALuS1yFgoGBAIH0/vHY5UB5GP3IbrDgyo9fX6GBeVn/zH4l2F1abwLlraretjzCrnxS7/+MiqF5IUQ= 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+76033+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 1622782637232526.0209095264356; Thu, 3 Jun 2021 21:57:17 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id HXOtYY1788612xPZV3rzKA2O; Thu, 03 Jun 2021 21:57:16 -0700 X-Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web09.4396.1622782621682193304 for ; Thu, 03 Jun 2021 21:57:02 -0700 IronPort-SDR: giA1DVOY+mDbhXB4fT0rdPBT6VITVXTEo4Zcn7IK0vzsWi6OzeG0iS28v9I7ACoG50lR1a6fIH 1Tg7FCKQGdGg== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="268087111" X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208";a="268087111" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 21:57:00 -0700 IronPort-SDR: 2X1JAhRYAWFV+jz2QAXQ+V+zbZdh3C8/vCqKml6b0nrhehPD7W1MPAMvXgWgyyHQQ2itX0TpXr dWaN3TX0rypA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208";a="480502766" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 03 Jun 2021 21:56:59 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [Patch V2 3/9] UefiPayloadPkg: UefiPayload retrieve PCI root bridge from Guid Hob Date: Fri, 4 Jun 2021 12:56:38 +0800 Message-Id: <20210604045644.1721-4-zhiguang.liu@intel.com> In-Reply-To: <20210604045644.1721-1-zhiguang.liu@intel.com> References: <20210604045644.1721-1-zhiguang.liu@intel.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,zhiguang.liu@intel.com X-Gm-Message-State: exL9wCn1XQFtrldJ6IXkByDtx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622782636; bh=neq+LlRBs/afkNjeUy+5PmlfM6k672oyYFfurkvwjc4=; h=Cc:Date:From:Reply-To:Subject:To; b=pIHCxYGXdzvzsIUUiUSPI7k9arwRwViYlT7XbLaK/8S2pM8s7QESR1JIEu9y5siun08 JgphhzEeV3jm5vjZZrya+NjzGgsI+EZm/lVUI06DoxOhDEx7YM9zt+xQ3JEoF7SdVwmTd 33c80gLU7P33qP29vQ7Jj+Oz4CB0xYrI8YY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" UefiPayload parse gPldPciRootBridgeInfoGuid Guid Hob to retrieve PCI root b= ridges information. gPldPciRootBridgeInfoGuid Guid Hob should be created by Bootlo= ader. Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Signed-off-by: Zhiguang Liu --- UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridge.h | 40 ++++++= ++++++++++++++++++++++++++++++++-- UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 42 ++++++= +++++++++++++++++++++++++++++++++--- UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 8 ++++++= +- UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c | 73 ++++++= ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- UefiPayloadPkg/UefiPayloadPkg.dsc | 2 +- 5 files changed, 157 insertions(+), 8 deletions(-) diff --git a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridge.h b/Uefi= PayloadPkg/Library/PciHostBridgeLib/PciHostBridge.h index c2961b3bee..b22703e79e 100644 --- a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridge.h +++ b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridge.h @@ -2,7 +2,7 @@ Header file of PciHostBridgeLib. =20 Copyright (C) 2016, Red Hat, Inc. - Copyright (c) 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -11,14 +11,38 @@ #ifndef _PCI_HOST_BRIDGE_H #define _PCI_HOST_BRIDGE_H =20 +#include + typedef struct { ACPI_HID_DEVICE_PATH AcpiDevicePath; EFI_DEVICE_PATH_PROTOCOL EndDevicePath; } CB_PCI_ROOT_BRIDGE_DEVICE_PATH; =20 +/** + Scan for all root bridges in platform. + + @param[out] NumberOfRootBridges Number of root bridges detected + + @retval Pointer to the allocated PCI_ROOT_BRIDGE structure array. +**/ PCI_ROOT_BRIDGE * ScanForRootBridges ( - UINTN *NumberOfRootBridges + OUT UINTN *NumberOfRootBridges +); + +/** + Scan for all root bridges from PldPciRootBridgeInfoHob + + @param[in] PciRootBridgeInfo Pointer of PLD PCI Root Bridge Info Hob + @param[out] NumberOfRootBridges Number of root bridges detected + + @retval Pointer to the allocated PCI_ROOT_BRIDGE structure array. + +**/ +PCI_ROOT_BRIDGE * +RetrieveRootBridgeInfoFromHob ( + IN PLD_PCI_ROOT_BRIDGES *PciRootBridgeInfo, + OUT UINTN *NumberOfRootBridges ); =20 /** @@ -77,4 +101,16 @@ InitRootBridge ( OUT PCI_ROOT_BRIDGE *RootBus ); =20 +/** + Initialize DevicePath for a PCI_ROOT_BRIDGE. + @param[in] HID HID for device path + @param[in] UID UID for device path + + @retval A pointer to the new created device patch. +**/ +EFI_DEVICE_PATH_PROTOCOL * +CreateRootBridgeDevicePath ( + IN UINT32 HID, + IN UINT32 UID +); #endif diff --git a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/U= efiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c index 512c3127cc..0b4ba66e0e 100644 --- a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c +++ b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c @@ -2,7 +2,7 @@ Library instance of PciHostBridgeLib library class for coreboot. =20 Copyright (C) 2016, Red Hat, Inc. - Copyright (c) 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -19,6 +19,7 @@ #include #include #include +#include =20 #include "PciHostBridge.h" =20 @@ -48,7 +49,6 @@ CB_PCI_ROOT_BRIDGE_DEVICE_PATH mRootBridgeDevicePathTempl= ate =3D { } }; =20 - /** Initialize a PCI_ROOT_BRIDGE structure. =20 @@ -145,6 +145,27 @@ InitRootBridge ( return EFI_SUCCESS; } =20 +/** + Initialize DevicePath for a PCI_ROOT_BRIDGE. + @param[in] HID HID for device path + @param[in] UID UID for device path + + @retval A pointer to the new created device patch. +**/ +EFI_DEVICE_PATH_PROTOCOL * +CreateRootBridgeDevicePath ( + IN UINT32 HID, + IN UINT32 UID +) +{ + CB_PCI_ROOT_BRIDGE_DEVICE_PATH *DevicePath; + DevicePath =3D AllocateCopyPool (sizeof (mRootBridgeDevicePathTemplate), + &mRootBridgeDevicePathTemplate); + ASSERT (DevicePath !=3D NULL); + DevicePath->AcpiDevicePath.HID =3D HID; + DevicePath->AcpiDevicePath.UID =3D UID; + return (EFI_DEVICE_PATH_PROTOCOL *)DevicePath; +} =20 /** Return all the root bridge instances in an array. @@ -161,10 +182,25 @@ PciHostBridgeGetRootBridges ( UINTN *Count ) { + PLD_PCI_ROOT_BRIDGES *PciRootBridgeInfo; + EFI_HOB_GUID_TYPE *GuidHob; + // + // Find PLD PCI Root Bridge Info hob + // + GuidHob =3D GetFirstGuidHob (&gPldPciRootBridgeInfoGuid); + if (IS_PLD_HEADER_HAS_REVISION(GuidHob, PLD_PCI_ROOT_BRIDGES_REVISION)) { + // + // PLD_PCI_ROOT_BRIDGES structure is used when Revision equals to PLD_= PCI_ROOT_BRIDGES_REVISION + // + PciRootBridgeInfo =3D (PLD_PCI_ROOT_BRIDGES *) GET_GUID_HOB_DATA (Guid= Hob); + if ((PciRootBridgeInfo->PldHeader.Length >=3D sizeof (PLD_PCI_ROOT_BRI= DGES)) &&=20 + PciRootBridgeInfo->Count <=3D (GET_GUID_HOB_DATA_SIZE (GuidHob) = - sizeof(PLD_PCI_ROOT_BRIDGES)) / sizeof(PLD_PCI_ROOT_BRIDGE)) { + return RetrieveRootBridgeInfoFromHob (PciRootBridgeInfo, Count); + } + } return ScanForRootBridges (Count); } =20 - /** Free the root bridge instances array returned from PciHostBridgeGetRootBridges(). diff --git a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf b= /UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf index 7896df2416..1c6a47828a 100644 --- a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf +++ b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf @@ -2,7 +2,7 @@ # Library instance of PciHostBridgeLib library class for coreboot. # # Copyright (C) 2016, Red Hat, Inc. -# Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -39,3 +39,9 @@ DevicePathLib MemoryAllocationLib PciLib + +[Guids] + gPldPciRootBridgeInfoGuid + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration diff --git a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c= b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c index fffbf04cad..d6d59b6659 100644 --- a/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c +++ b/UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c @@ -1,7 +1,7 @@ /** @file Scan the entire PCI bus for root bridges to support coreboot UEFI payloa= d. =20 - Copyright (c) 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2016 - 2021, Intel Corporation. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -582,3 +582,74 @@ ScanForRootBridges ( =20 return RootBridges; } + +/** + Scan for all root bridges from PldPciRootBridgeInfoHob + + @param[in] PciRootBridgeInfo Pointer of PLD PCI Root Bridge Info Hob + @param[out] NumberOfRootBridges Number of root bridges detected + + @retval Pointer to the allocated PCI_ROOT_BRIDGE structure array. + +**/ +PCI_ROOT_BRIDGE * +RetrieveRootBridgeInfoFromHob ( + IN PLD_PCI_ROOT_BRIDGES *PciRootBridgeInfo, + OUT UINTN *NumberOfRootBridges +) +{ + PCI_ROOT_BRIDGE *PciRootBridges; + UINTN Size; + UINT8 Index; + + ASSERT (PciRootBridgeInfo !=3D NULL); + ASSERT (NumberOfRootBridges !=3D NULL); + if (PciRootBridgeInfo =3D=3D NULL) { + return NULL; + } + if (PciRootBridgeInfo->Count =3D=3D 0) { + return NULL; + } + Size =3D PciRootBridgeInfo->Count * sizeof (PCI_ROOT_BRIDGE); + PciRootBridges =3D (PCI_ROOT_BRIDGE *) AllocatePool (Size); + ASSERT (PciRootBridges !=3D NULL); + if (PciRootBridges =3D=3D NULL) { + return NULL; + } + ZeroMem (PciRootBridges, PciRootBridgeInfo->Count * sizeof (PCI_ROOT_BRI= DGE)); + + // + // Create all root bridges with PciRootBridgeInfoHob + // + for (Index =3D 0; Index < PciRootBridgeInfo->Count; Index++) { + PciRootBridges[Index].Segment =3D PciRootBridgeInfo->Roo= tBridge[Index].Segment; + PciRootBridges[Index].Supports =3D PciRootBridgeInfo->Roo= tBridge[Index].Supports; + PciRootBridges[Index].Attributes =3D PciRootBridgeInfo->Roo= tBridge[Index].Attributes; + PciRootBridges[Index].DmaAbove4G =3D PciRootBridgeInfo->Roo= tBridge[Index].DmaAbove4G; + PciRootBridges[Index].NoExtendedConfigSpace =3D PciRootBridgeInfo->Roo= tBridge[Index].NoExtendedConfigSpace; + PciRootBridges[Index].ResourceAssigned =3D PciRootBridgeInfo->Res= ourceAssigned; + PciRootBridges[Index].AllocationAttributes =3D PciRootBridgeInfo->Roo= tBridge[Index].AllocationAttributes; + PciRootBridges[Index].DevicePath =3D CreateRootBridgeDevice= Path(PciRootBridgeInfo->RootBridge[Index].HID, PciRootBridgeInfo->RootBridg= e[Index].UID); + CopyMem(&PciRootBridges[Index].Bus, &PciRootBridgeInfo->RootBr= idge[Index].Bus, sizeof(PLD_PCI_ROOT_BRIDGE_APERTURE)); + CopyMem(&PciRootBridges[Index].Io, &PciRootBridgeInfo->RootBr= idge[Index].Io, sizeof(PLD_PCI_ROOT_BRIDGE_APERTURE)); + CopyMem(&PciRootBridges[Index].Mem, &PciRootBridgeInfo->RootBr= idge[Index].Mem, sizeof(PLD_PCI_ROOT_BRIDGE_APERTURE)); + CopyMem(&PciRootBridges[Index].MemAbove4G, &PciRootBridgeInfo->RootBr= idge[Index].MemAbove4G, sizeof(PLD_PCI_ROOT_BRIDGE_APERTURE)); + CopyMem(&PciRootBridges[Index].PMem, &PciRootBridgeInfo->RootBr= idge[Index].PMem, sizeof(PLD_PCI_ROOT_BRIDGE_APERTURE)); + CopyMem(&PciRootBridges[Index].PMemAbove4G, &PciRootBridgeInfo->RootBr= idge[Index].PMemAbove4G, sizeof(PLD_PCI_ROOT_BRIDGE_APERTURE)); + } + + *NumberOfRootBridges =3D PciRootBridgeInfo->Count; + + // + // Now, this library only supports RootBridge that ResourceAssigned is T= rue + // + if (PciRootBridgeInfo->ResourceAssigned) { + PcdSetBoolS (PcdPciDisableBusEnumeration, TRUE); + } else { + DEBUG ((DEBUG_ERROR, "There is root bridge whose ResourceAssigned is F= ALSE\n")); + PcdSetBoolS (PcdPciDisableBusEnumeration, FALSE); + return NULL; + } + + return PciRootBridges; +} diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index 37ad5a0ae7..e9211adf86 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -323,7 +323,6 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialFifoControl|$(SERIAL_FIFO_CONTRO= L) gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize|$(SERIAL_EXTE= NDED_TX_FIFO_SIZE) =20 - gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|$(UART_DEFAULT_BAUD_RATE) gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits|$(UART_DEFAULT_DATA_BITS) gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity|$(UART_DEFAULT_PARITY) @@ -363,6 +362,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|100 gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0 gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseSize|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE =20 ##########################################################################= ###### # --=20 2.30.0.windows.2 -=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 (#76033): https://edk2.groups.io/g/devel/message/76033 Mute This Topic: https://groups.io/mt/83301964/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- From nobody Thu May 16 10:18:47 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+76035+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+76035+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622782635; cv=none; d=zohomail.com; s=zohoarc; b=ni7s1rl3N2l2sy4pipqO4dr7HZQmRJzOmwYIIG5vE7fL7X4o6bpcsg0zSkwvSIMDukPcIEVebyRtcGwrwtXhLr8jNRxtXgNjo9abWJIx4GfMRMDYEfDnlgQ1CMmLZeZSoXIs0LsgsqDgHL/izk/9XPQrj5NNcIKzE+s4k1wLXEw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622782635; h=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=7LUdHijKY1vP09rsckTYUfDf65o4hTDTYPvS9Q7jYxE=; b=PyN3lzgrhIy7ncQrBw7tMYo7ZxEMWuqyigU2NcXi/eY9cmpi7WiuiELkWtkgtf8E+JKTQnolAU4Rj5eD4FPOfaIuIioa3X+KGxGNsX1XDAHe/XNt7WyEGIzykY5T3RkmMq5E9GM12dAP/EzrCmjAEqRtTmFp1K9Ugyz21rWU2nI= 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+76035+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 162278263520169.26502422427552; Thu, 3 Jun 2021 21:57:15 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id hEb6YY1788612xHORF3PtW6F; Thu, 03 Jun 2021 21:57:14 -0700 X-Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.4363.1622782622364813064 for ; Thu, 03 Jun 2021 21:57:02 -0700 IronPort-SDR: Ui6nfi/sTTq6cHBWt0AFVz5KKHHGn32v91CkeoJAOSzAgqacksF/LKXXOa3+7STaRssP0dQNkA MeI5qtWaGg6Q== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="268087113" X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208";a="268087113" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 21:57:02 -0700 IronPort-SDR: l62qQUYXcdpEFT3NV+ZXUaVhhSXhYvBiTU5Ir5e4qufk1C2xIlJ7C8nt4VP7v2+2MDqJS7+G/I NmqNv694G7tw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208";a="480502785" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 03 Jun 2021 21:57:00 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Jian J Wang , Hao A Wu Subject: [edk2-devel] [Patch V2 4/9] MdeModulePkg: Add new structure for the Universal Payload SMBios Table Info Hob Date: Fri, 4 Jun 2021 12:56:39 +0800 Message-Id: <20210604045644.1721-5-zhiguang.liu@intel.com> In-Reply-To: <20210604045644.1721-1-zhiguang.liu@intel.com> References: <20210604045644.1721-1-zhiguang.liu@intel.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,zhiguang.liu@intel.com X-Gm-Message-State: d9w1NJTbFySbHUSduOdPOl2Mx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622782634; bh=IY9a+I04Hij28RU8POznUF/4ABhvOp99bVIusM8K32s=; h=Cc:Date:From:Reply-To:Subject:To; b=QBYq3isIKTW37fj35cCZJPmifkKuaA+X4ZNPe4Iqr5bRZDFo+qv6mCnxZ2ThK6otUTG hEseUh/Ur/QeoDzIlCtEPDktFFutBb4u44/b9GxK+JTWoUiXEuYLSriKtZivgcb9ZGVzt sE6JCQPd6hRHMkRpU0fpcUHoV/WiMk+ruls= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Cc: Michael D Kinney Cc: Liming Gao Cc: Jian J Wang Cc: Hao A Wu Signed-off-by: Zhiguang Liu --- MdeModulePkg/Include/UniversalPayload/SmbiosTable.h | 28 +++++++++++++++++= +++++++++++ MdeModulePkg/MdeModulePkg.dec | 6 ++++++ 2 files changed, 34 insertions(+) diff --git a/MdeModulePkg/Include/UniversalPayload/SmbiosTable.h b/MdeModul= ePkg/Include/UniversalPayload/SmbiosTable.h new file mode 100644 index 0000000000..3aaa926396 --- /dev/null +++ b/MdeModulePkg/Include/UniversalPayload/SmbiosTable.h @@ -0,0 +1,28 @@ +/** @file + Define the structure for the Payload SmBios. + +Copyright (c) 2021, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PLD_SMBIOS_TABL_H_ +#define _PLD_SMBIOS_TABL_H_ + +#include +#include + +#pragma pack (1) + +typedef struct { + PLD_GENERIC_HEADER PldHeader; + EFI_PHYSICAL_ADDRESS SmBiosEntryPoint; +} PLD_SMBIOS_TABLE; + +#pragma pack() + +#define PLD_SMBIOS_TABLE_REVISION 1 + +extern GUID gPldSmbios3TableGuid; +extern GUID gPldSmbiosTableGuid; +#endif //_PLD_SMBIOS_TABL_H_ diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 671d0f33c8..45324d2e20 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -410,6 +410,12 @@ ## Include/UniversalPayload/PciRootBridges.h gPldPciRootBridgeInfoGuid =3D { 0xec4ebacb, 0x2638, 0x416e, { 0xbe, 0x80= , 0xe5, 0xfa, 0x4b, 0x51, 0x19, 0x01 }} =20 + ## Include/UniversalPayload/SmbiosTable.h + gPldSmbios3TableGuid =3D { 0x92b7896c, 0x3362, 0x46ce, { 0x99, 0xb3, 0x4= f, 0x5e, 0x3c, 0x34, 0xeb, 0x42 } } + + ## Include/UniversalPayload/SmbiosTable.h + gPldSmbiosTableGuid =3D { 0x590a0d26, 0x06e5, 0x4d20, { 0x8a, 0x82, 0x59= , 0xea, 0x1b, 0x34, 0x98, 0x2d } } + [Ppis] ## Include/Ppi/AtaController.h gPeiAtaControllerPpiGuid =3D { 0xa45e60d1, 0xc719, 0x44aa, { 0xb0,= 0x7a, 0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d }} --=20 2.30.0.windows.2 -=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 (#76035): https://edk2.groups.io/g/devel/message/76035 Mute This Topic: https://groups.io/mt/83301966/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- From nobody Thu May 16 10:18:47 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+76036+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+76036+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622782634; cv=none; d=zohomail.com; s=zohoarc; b=Ovwats8zjVXNN4//G5PyQqFohk256Fo4vMSG6PwzlWcz/m1iBaIZOsbalIgvnqh6Rv+CJjuY/XPLRIB3PCOC+CCrMVG91BNhs6Qu4ywjFkfga6l3BhMf2EHRQeIOIKycLfU4h3IS34nRT8bMwcHdfEO04E9acgOsDaAdaODccAI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622782634; h=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=QL6CypAJoNM6BQu7dNc/UtHYa/tpBtb1iC2ZrCanVeI=; b=miwQDZj6I73naiPlE810crOTii20GLpO6p4Uij6LJsMsfqpX/NhrDl0OBfWCZJC9NeqAI9V3pBMkj60VFcqVIARVMApm/rvOvUOn5i+pdGFG0io9AB657uqB0CncVsXWfHJVu3jmYUEfr3JVbHv23bzeJCe3J7i1/AmAOs6ZYZY= 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+76036+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 1622782634353125.6414734613104; Thu, 3 Jun 2021 21:57:14 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id tIPjYY1788612xJFJiIkeaMi; Thu, 03 Jun 2021 21:57:14 -0700 X-Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web11.4363.1622782622364813064 for ; Thu, 03 Jun 2021 21:57:06 -0700 IronPort-SDR: zaqzEvlbg1Lcp3nTLSBCmbWZtEO3stF9Oe0XWPAK0zYZK/gj4nSAIMOhXstF0/oxbsUo1ejz/q nLMWuLuKHKfA== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="268087127" X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208";a="268087127" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 21:57:04 -0700 IronPort-SDR: P/xih7zZGWIIEb/IJVJP7mjBuwWZYJ80s1NFZZ30Vs/U2Pm8k+6Z5B1JwY/9kU4TRXlb+hhWhU qNbXShv5QFnQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208";a="480502804" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 03 Jun 2021 21:57:02 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Dandan Bi , Star Zeng , Zhichao Gao , Patrick Rudolph Subject: [edk2-devel] [Patch V2 5/9] MdeModulePkg/Universal/SmbiosDxe: Scan for existing tables Date: Fri, 4 Jun 2021 12:56:40 +0800 Message-Id: <20210604045644.1721-6-zhiguang.liu@intel.com> In-Reply-To: <20210604045644.1721-1-zhiguang.liu@intel.com> References: <20210604045644.1721-1-zhiguang.liu@intel.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,zhiguang.liu@intel.com X-Gm-Message-State: QmGuemaN6VPQhzsOXd2fjAtSx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622782634; bh=CaiAUpyDSnr6Zu9nnWsNE4avx7AN3bAG6VnPPpcj4so=; h=Cc:Date:From:Reply-To:Subject:To; b=HCMfIiTzlYuQMdZO7AigqlyJO/VpbJow7xgvn4nALJo/ZLPJnUtFc0A3FtjPW125RGC 01oGmhyxwJ22F5HFu+iYODVnwv1HfaROJlaxxy+D2R9CTfl7O8KGeURriA/dA38k2qGEn Ml7dvnZQAE2CUMe+hdJaUfZj+dRlQtzeFAs= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" V1: The default EfiSmbiosProtocol operates on an empty SMBIOS table. The SMBIOS tables are provided by the bootloader on UefiPayloadPkg. Scan for existing tables in SmbiosDxe and load them if they seem valid. This fixes the settings menu not showing any hardware information, instead only "0 MB RAM" was displayed. Tests showed that the OS can still see the SMBIOS tables. V2: SmbiosDxe will get the SMBIOS from a guid Hob. Aslo will keep the SmbiosHandle if it is available. Cc: Jian J Wang Cc: Hao A Wu Cc: Dandan Bi Cc: Star Zeng Cc: Zhichao Gao Signed-off-by: Patrick Rudolph Signed-off-by: Zhiguang Liu --- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c | 284 +++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++++++++++++++++++++++++++++++++++-- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.h | 4 +++- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf | 5 ++++- 3 files changed, 289 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c b/MdeModulePkg/Un= iversal/SmbiosDxe/SmbiosDxe.c index 3cdb0b1ed7..ca7c411a76 100644 --- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c +++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c @@ -2,7 +2,7 @@ This code produces the Smbios protocol. It also responsible for construc= ting SMBIOS table into system table. =20 -Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -1408,6 +1408,285 @@ SmbiosTableConstruction ( } } =20 +/** + Validates a SMBIOS 2.0 table entry point. + + @param SmbiosTable The SMBIOS_TABLE_ENTRY_POINT to validate. + + @retval TRUE SMBIOS table entry point is valid. + @retval FALSE SMBIOS table entry point is malformed. + +**/ +STATIC +BOOLEAN +IsValidSmbios20Table ( + IN SMBIOS_TABLE_ENTRY_POINT *SmbiosTable + ) +{ + UINT8 Checksum; + + if (CompareMem (SmbiosTable->AnchorString, "_SM_", 4) !=3D 0) { + return FALSE; + } + + if (CompareMem (SmbiosTable->IntermediateAnchorString, "_DMI_", 5) !=3D = 0) { + return FALSE; + } + + // + // The actual value of the EntryPointLength should be 1Fh. + // However, it was incorrectly stated in version 2.1 of smbios specifica= tion. + // Therefore, 0x1F and 0x1E are both accepted. + // + if (SmbiosTable->EntryPointLength !=3D 0x1E && SmbiosTable->EntryPointLe= ngth !=3D sizeof (SMBIOS_TABLE_ENTRY_POINT)) { + return FALSE; + } + + // + // MajorVersion should not be less than 2. + // + if (SmbiosTable->MajorVersion < 2) { + return FALSE; + } + + // + // The whole struct check sum should be zero + // + Checksum =3D CalculateSum8 ( + (UINT8 *) SmbiosTable, + SmbiosTable->EntryPointLength + ); + if (Checksum !=3D 0) { + return FALSE; + } + + // + // The Intermediate Entry Point Structure check sum should be zero. + // + Checksum =3D CalculateSum8 ( + (UINT8 *) SmbiosTable + OFFSET_OF (SMBIOS_TABLE_ENTRY_POINT= , IntermediateAnchorString), + SmbiosTable->EntryPointLength - OFFSET_OF (SMBIOS_TABLE_ENT= RY_POINT, IntermediateAnchorString) + ); + return (BOOLEAN) (Checksum =3D=3D 0); +} + +/** + Validates a SMBIOS 3.0 table entry point. + + @param SmbiosTable The SMBIOS_TABLE_3_0_ENTRY_POINT to validate. + + @retval TRUE SMBIOS table entry point is valid. + @retval FALSE SMBIOS table entry point is malformed. + +**/ +STATIC +BOOLEAN +IsValidSmbios30Table ( + IN SMBIOS_TABLE_3_0_ENTRY_POINT *SmbiosTable + ) +{ + UINT8 Checksum; + + if (CompareMem (SmbiosTable->AnchorString, "_SM3_", 5) !=3D 0) { + return FALSE; + } + if (SmbiosTable->EntryPointLength < sizeof (SMBIOS_TABLE_3_0_ENTRY_POINT= )) { + return FALSE; + } + if (SmbiosTable->MajorVersion < 3) { + return FALSE; + } + + // + // The whole struct check sum should be zero + // + Checksum =3D CalculateSum8 ( + (UINT8 *) SmbiosTable, + SmbiosTable->EntryPointLength + ); + if (Checksum !=3D 0) { + return FALSE; + } + return TRUE; +} + +/** + Parse an existing SMBIOS table and insert it using SmbiosAdd. + + @param ImageHandle The EFI_HANDLE to this driver. + @param Smbios The SMBIOS table to parse. + @param Length The length of the SMBIOS table. + + @retval EFI_SUCCESS SMBIOS table was parsed and installed. + @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system= resources. + @retval EFI_INVALID_PARAMETER Smbios is not a correct smbios table + +**/ +STATIC +EFI_STATUS +ParseAndAddExistingSmbiosTable ( + IN EFI_HANDLE ImageHandle, + IN SMBIOS_STRUCTURE_POINTER Smbios, + IN UINTN Length + ) +{ + EFI_STATUS Status; + CHAR8 *String; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_STRUCTURE_POINTER SmbiosEnd; + + SmbiosEnd.Raw =3D Smbios.Raw + Length; + + if (Smbios.Raw >=3D SmbiosEnd.Raw || Smbios.Raw =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + do { + // + // Make sure not to access memory beyond SmbiosEnd + // + if (Smbios.Raw + sizeof (SMBIOS_STRUCTURE) > SmbiosEnd.Raw || + Smbios.Raw + sizeof (SMBIOS_STRUCTURE) < Smbios.Raw) { + return EFI_INVALID_PARAMETER; + } + // + // Check for end marker + // + if (Smbios.Hdr->Type =3D=3D SMBIOS_TYPE_END_OF_TABLE) { + break; + } + // + // Make sure not to access memory beyond SmbiosEnd + // Each structure shall be terminated by a double-null (0000h). + // + if (Smbios.Raw + Smbios.Hdr->Length + 2 * sizeof (UINT8) > SmbiosEnd.R= aw || + Smbios.Raw + Smbios.Hdr->Length + 2 * sizeof (UINT8) < Smbios.Raw) { + return EFI_INVALID_PARAMETER; + } + // + // Install the table + // + SmbiosHandle =3D Smbios.Hdr->Handle; + Status =3D SmbiosAdd ( + &mPrivateData.Smbios, + ImageHandle, + &SmbiosHandle, + Smbios.Hdr + ); + + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return Status; + } + // + // Go to the next SMBIOS structure. Each SMBIOS structure may include = 2 parts: + // 1. Formatted section; 2. Unformatted string section. So, 2 steps ar= e needed + // to skip one SMBIOS structure. + // + + // + // Step 1: Skip over formatted section. + // + String =3D (CHAR8 *) (Smbios.Raw + Smbios.Hdr->Length); + + // + // Step 2: Skip over unformatted string section. + // + do { + // + // Each string is terminated with a NULL(00h) BYTE and the sets of s= trings + // is terminated with an additional NULL(00h) BYTE. + // + for ( ; *String !=3D 0; String++) { + if ((UINTN) String >=3D (UINTN) SmbiosEnd.Raw - sizeof (UINT8)) { + return EFI_INVALID_PARAMETER; + } + } + + if (*(UINT8 *) ++String =3D=3D 0) { + // + // Pointer to the next SMBIOS structure. + // + Smbios.Raw =3D (UINT8 *) ++String; + break; + } + } while (TRUE); + } while (Smbios.Raw < SmbiosEnd.Raw); + + return EFI_SUCCESS; +} + + +/** + Retrieve SMBIOS from Hob. + @param ImageHandle Module's image handle + + @retval EFI_SUCCESS Smbios from Hob is installed. + @return EFI_NOT_FOUND Not found Smbios from Hob. + @retval Other No Smbios from Hob is installed. + +**/ +EFI_STATUS +RetrieveSmbiosFromHob ( + IN EFI_HANDLE ImageHandle + ) +{ + EFI_STATUS Status; + SMBIOS_TABLE_ENTRY_POINT *SmbiosTable; + SMBIOS_TABLE_3_0_ENTRY_POINT *Smbios30Table; + SMBIOS_STRUCTURE_POINTER Smbios; + EFI_HOB_GUID_TYPE *GuidHob; + PLD_SMBIOS_TABLE *SmBiosTableAdress; + + + Status =3D EFI_NOT_FOUND; + // + // Scan for existing SMBIOS tables from gPldSmbios3TableGuid Guid Hob + // + GuidHob =3D GetFirstGuidHob (&gPldSmbios3TableGuid); + if (IS_PLD_HEADER_HAS_REVISION(GuidHob, PLD_SMBIOS_TABLE_REVISION)) { + // + // PLD_SMBIOS_TABLE structure is used when Revision equals to PLD_SMBI= OS_TABLE_REVISION + // + SmBiosTableAdress =3D (PLD_SMBIOS_TABLE *) GET_GUID_HOB_DATA (GuidHob); + if (SmBiosTableAdress->PldHeader.Length >=3D PLD_SIZEOF_THROUGH_FIELD = (PLD_SMBIOS_TABLE, SmBiosEntryPoint)) { + Smbios30Table =3D (SMBIOS_TABLE_3_0_ENTRY_POINT *) (UINTN) SmBiosTab= leAdress->SmBiosEntryPoint; + if (IsValidSmbios30Table (Smbios30Table)) { + Smbios.Raw =3D (UINT8 *) (UINTN) Smbios30Table->TableAddress; + Status =3D ParseAndAddExistingSmbiosTable (ImageHandle, Smbios, Sm= bios30Table->TableMaximumSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "RetrieveSmbiosFromHob: Failed to parse pre= installed tables from gPldSmbios3TableGuid Guid Hob\n")); + Status =3D EFI_UNSUPPORTED; + } else { + return EFI_SUCCESS; + } + } + } + } + + // + // Scan for existing SMBIOS tables from gPldSmbiosTableGuid Guid Hob, + // if gPldSmbios3TableGuid Hob doesn't exist or parsing gPldSmbios3Table= Guid failed + // + GuidHob =3D GetFirstGuidHob (&gPldSmbiosTableGuid); + =20 + if (IS_PLD_HEADER_HAS_REVISION(GuidHob, PLD_SMBIOS_TABLE_REVISION)) { + SmBiosTableAdress =3D (PLD_SMBIOS_TABLE *) GET_GUID_HOB_DATA (GuidHob); + if (SmBiosTableAdress->PldHeader.Length >=3D PLD_SIZEOF_THROUGH_FIELD = (PLD_SMBIOS_TABLE, SmBiosEntryPoint)) { + SmbiosTable =3D (SMBIOS_TABLE_ENTRY_POINT *) (UINTN) SmBiosTableAdre= ss->SmBiosEntryPoint; + if (IsValidSmbios20Table (SmbiosTable)) { + Smbios.Raw =3D (UINT8 *) (UINTN) SmbiosTable->TableAddress; + Status =3D ParseAndAddExistingSmbiosTable (ImageHandle, Smbios, Sm= biosTable->TableLength); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "RetrieveSmbiosFromHob: Failed to parse pre= installed tables from gPldSmbiosTableGuid Guid Hob\n")); + Status =3D EFI_UNSUPPORTED; + } + } + } + } + return Status; +} + /** =20 Driver to produce Smbios protocol and pre-allocate 1 page for the final = SMBIOS table. @@ -1451,5 +1730,6 @@ SmbiosDriverEntryPoint ( &mPrivateData.Smbios ); =20 - return Status; + RetrieveSmbiosFromHob (ImageHandle); + return EFI_SUCCESS; } diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.h b/MdeModulePkg/Un= iversal/SmbiosDxe/SmbiosDxe.h index f97c85ae40..a260cf695e 100644 --- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.h +++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.h @@ -1,7 +1,7 @@ /** @file This code supports the implementation of the Smbios protocol =20 -Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -24,6 +24,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include +#include =20 #define SMBIOS_INSTANCE_SIGNATURE SIGNATURE_32 ('S', 'B', 'i', 's') typedef struct { diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf b/MdeModulePkg/= Universal/SmbiosDxe/SmbiosDxe.inf index f6c036e1dc..63f468936d 100644 --- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf +++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf @@ -1,7 +1,7 @@ ## @file # This driver initializes and installs the SMBIOS protocol, constructs SMB= IOS table into system configuration table. # -# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -41,6 +41,7 @@ UefiDriverEntryPoint DebugLib PcdLib + HobLib =20 [Protocols] gEfiSmbiosProtocolGuid ## PRODUCES @@ -48,6 +49,8 @@ [Guids] gEfiSmbiosTableGuid ## SOMETIMES_PRODUCES = ## SystemTable gEfiSmbios3TableGuid ## SOMETIMES_PRODUCES = ## SystemTable + gPldSmbios3TableGuid ## CONSUMES = ## HOB + gPldSmbiosTableGuid ## SOMETIMES_CONSUMES = ## HOB =20 [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosVersion ## CONSUMES --=20 2.30.0.windows.2 -=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 (#76036): https://edk2.groups.io/g/devel/message/76036 Mute This Topic: https://groups.io/mt/83301967/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- From nobody Thu May 16 10:18:47 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+76037+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+76037+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622782634; cv=none; d=zohomail.com; s=zohoarc; b=IutrGVe3EXC30+R0rqUjpAUN+pC+lsEsyMRIzjbCOkw0qjwYQ3olJZS5zp3zUmISN+Vie6PQgKO7LI063Li8R9xXtTYywrVLceymo4YbyEq+sUKWKj+QkUV71m5bCOxBtkoLdQCIWOtnHP7nUlTYuY4Nn5NNiv1g3WXq9yegKII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622782634; h=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=ExV1LTa9yxMeM6lhGUp4UiDWdOhVozmdCx1H1w+aox4=; b=Fs+/4RaoaQoXARGGdTb4r4/OpzsLH5mQ2VEHPydrNmtyMOEHwSkV7tAHJ5UxUNCNild5GUocmAnTbGB7ar7R0IbpLJHKY3sUXb+U45N9dA2jufjJmIpq4AFbDOsUSkSP6K+JddeleCWLvvNRN4SM+eZBQIgogQ/hbdG8nLjI8uA= 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+76037+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 1622782634785305.8642534367584; Thu, 3 Jun 2021 21:57:14 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id iX5qYY1788612x188WgxRnVi; Thu, 03 Jun 2021 21:57:14 -0700 X-Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web11.4363.1622782622364813064 for ; Thu, 03 Jun 2021 21:57:06 -0700 IronPort-SDR: SXJ24QDjohfT7DX0DQczOvLbLzgW15dBlHoIzpswgGyiR+bPK0jhtdDKHhRr5P2fS41qfdC+fK 4Qi2xIldOLTg== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="268087130" X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208,223";a="268087130" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 21:57:06 -0700 IronPort-SDR: NDpThhiYBR79mkAbtZ48sHU0Do6LQQbiFin13F/vLQsovewihd90z3II3r6ojLtRZcJGz+bC2n VnawTk91nEnQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208,223";a="480502813" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 03 Jun 2021 21:57:05 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [Patch V2 6/9] UefiPayloadPkg: Creat gPldSmbiosTableGuid Hob Date: Fri, 4 Jun 2021 12:56:41 +0800 Message-Id: <20210604045644.1721-7-zhiguang.liu@intel.com> In-Reply-To: <20210604045644.1721-1-zhiguang.liu@intel.com> References: <20210604045644.1721-1-zhiguang.liu@intel.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,zhiguang.liu@intel.com X-Gm-Message-State: UgLeIx2jqIkN2n1cphdUnKVCx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622782634; bh=WCD7w6s/iFL83sUpX4YvCKB8NBIFmw0WmmZ3VamUvpI=; h=Cc:Date:From:Reply-To:Subject:To; b=MJUID0gJn02zStsacRBQm35EqiJKDSaAEQCpfreRmkROBdRvwIfQLrKZtFCFxInDHMK /f8DrTMHpmDcYadeAZKrWR/aLJdGYa1iN6CRy3W7Sx2CAC2UTdPRVIfR0GkQr5DcrICa+ 0LrbFFVVAPZbFyY7SdtxdGkD7rYJTIaHrCM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From SysTableInfo Hob, get Smbios table address, and creat gPldSmbiosTableG= uid Hob to store it. Remove diretly adding smbios table to ConfigurationTable. Dxe module SmbiosDxe will parse it and install smbios table from it. Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Reviewed-by: Guo Dong Signed-off-by: Zhiguang Liu --- UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c | 11 +---------- UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf | 3 +-- UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c | 12 +++++++++++- UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h | 3 ++- UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf | 3 ++- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c b/UefiPayloadPkg/Bl= SupportDxe/BlSupportDxe.c index a746d0581e..56b85b8e6d 100644 --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c @@ -2,7 +2,7 @@ This driver will report some MMIO/IO resources to dxe core, extract smbi= os and acpi tables from bootloader. =20 - Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -129,15 +129,6 @@ BlDxeEntryPoint ( ASSERT_EFI_ERROR (Status); } =20 - // - // Install Smbios Table - // - if (SystemTableInfo->SmbiosTableBase !=3D 0 && SystemTableInfo->SmbiosTa= bleSize !=3D 0) { - DEBUG ((DEBUG_ERROR, "Install Smbios Table at 0x%lx, length 0x%x\n", S= ystemTableInfo->SmbiosTableBase, SystemTableInfo->SmbiosTableSize)); - Status =3D gBS->InstallConfigurationTable (&gEfiSmbiosTableGuid, (VOID= *)(UINTN)SystemTableInfo->SmbiosTableBase); - ASSERT_EFI_ERROR (Status); - } - // // Find the frame buffer information and update PCDs // diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf b/UefiPayloadPkg/= BlSupportDxe/BlSupportDxe.inf index cebc811355..30f41f8c39 100644 --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf @@ -3,7 +3,7 @@ # # Report some MMIO/IO resources to dxe core, extract smbios and acpi tables # -# Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -43,7 +43,6 @@ =20 [Guids] gEfiAcpiTableGuid - gEfiSmbiosTableGuid gUefiSystemTableInfoGuid gUefiAcpiBoardInfoGuid gEfiGraphicsInfoHobGuid diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPaylo= adPkg/UefiPayloadEntry/UefiPayloadEntry.c index 805f5448d9..7b71d37f94 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c @@ -1,6 +1,6 @@ /** @file =20 - Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -234,6 +234,7 @@ BuildHobFromBl ( EFI_PEI_GRAPHICS_INFO_HOB *NewGfxInfo; EFI_PEI_GRAPHICS_DEVICE_INFO_HOB GfxDeviceInfo; EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *NewGfxDeviceInfo; + PLD_SMBIOS_TABLE *SmBiosTableHob; =20 // // Parse memory info and build memory HOBs @@ -276,6 +277,15 @@ BuildHobFromBl ( DEBUG ((DEBUG_INFO, "Detected Acpi Table at 0x%lx, length 0x%x\n", Sys= TableInfo.AcpiTableBase, SysTableInfo.AcpiTableSize)); DEBUG ((DEBUG_INFO, "Detected Smbios Table at 0x%lx, length 0x%x\n", S= ysTableInfo.SmbiosTableBase, SysTableInfo.SmbiosTableSize)); } + // + // Creat SmBios table Hob + // + SmBiosTableHob =3D BuildGuidHob (&gPldSmbiosTableGuid, sizeof (PLD_SMBIO= S_TABLE)); + ASSERT (SmBiosTableHob !=3D NULL); + SmBiosTableHob->PldHeader.Revision =3D PLD_SMBIOS_TABLE_REVISION; + SmBiosTableHob->PldHeader.Length =3D sizeof (PLD_SMBIOS_TABLE); + SmBiosTableHob->SmBiosEntryPoint =3D SysTableInfo.SmbiosTableBase; + DEBUG ((DEBUG_INFO, "Create smbios table gPldSmbiosTableGuid guid hob\n"= )); =20 // // Create guid hob for acpi board information diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPaylo= adPkg/UefiPayloadEntry/UefiPayloadEntry.h index 2c84d6ed53..e7d0d15118 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2020, Intel Corporation. All rights reserved.
+* Copyright (c) 2021, Intel Corporation. All rights reserved.
* * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -31,6 +31,7 @@ #include #include #include +#include =20 =20 #define LEGACY_8259_MASK_REGISTER_MASTER 0x21 diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPay= loadPkg/UefiPayloadEntry/UefiPayloadEntry.inf index cc59f1903b..444f39acf3 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf @@ -1,7 +1,7 @@ ## @file # This is the first module for UEFI payload. # -# Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
# Copyright (c) 2017, AMD Incorporated. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -64,6 +64,7 @@ gEfiGraphicsInfoHobGuid gEfiGraphicsDeviceInfoHobGuid gUefiAcpiBoardInfoGuid + gPldSmbiosTableGuid =20 [FeaturePcd.IA32] gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUMES --=20 2.30.0.windows.2 -=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 (#76037): https://edk2.groups.io/g/devel/message/76037 Mute This Topic: https://groups.io/mt/83301968/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- From nobody Thu May 16 10:18:47 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+76038+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+76038+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622782635; cv=none; d=zohomail.com; s=zohoarc; b=Bp4PYtn3qJCBO0VynfZfuxZMB44v7BxxeIrX6ftgBgpzIMQIW8YOq7EU5EgNYWjYMB088llMVhjwgWSs2yhFtlqrFVIr8b4GYH8TU9iAm+XooL1DeptR3O47eB2uduOXl6BAoJB012Ywf2FjbnTUgFqNcrjS3Itt38+37SBC/QM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622782635; h=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=4n5Cr9UfYMwntBRmwjOMrczz7kLDi/G7RgvTEbNsh7I=; b=ipwnAHNFusO9OoNY7vvvFa4suQ5MUc5vpXI8gK1O4OPxCdi4fM8TyuTJBzIqwBqhA/MRzpCywiTVyHDD4D0L9ZdaqJhYZaCBSpRGDIFhxvqw0DtIT0ov03ythtefuORWumLm9Qa/LRi/GDSmPslX4BxVLWIjzt4IsIrZw01d/qU= 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+76038+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 1622782635637556.5828844851904; Thu, 3 Jun 2021 21:57:15 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ysypYY1788612x7fDDpKUXOA; Thu, 03 Jun 2021 21:57:15 -0700 X-Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web11.4363.1622782622364813064 for ; Thu, 03 Jun 2021 21:57:08 -0700 IronPort-SDR: jxXZN+oppwW0dtKXr7Qt1sP+tkZYCdx8S44iy9UXlnJ1hcsBKWWUBtLyOSV5riXWT33NxBpzNB 03iUTd+K569w== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="268087136" X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208";a="268087136" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 21:57:08 -0700 IronPort-SDR: 0HTa92GLueaisOmKqW0olfqq/rdV8Q2r3ywCmzss/x/fiw2ZPnFmduC6JxPL1psQ7xA4Cn5Zf0 jisltp9XmTSQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208";a="480502825" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 03 Jun 2021 21:57:06 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Jian J Wang , Hao A Wu Subject: [edk2-devel] [Patch V2 7/9] MdeModulePkg: Add new structure for the Universal Payload ACPI Table Info Hob Date: Fri, 4 Jun 2021 12:56:42 +0800 Message-Id: <20210604045644.1721-8-zhiguang.liu@intel.com> In-Reply-To: <20210604045644.1721-1-zhiguang.liu@intel.com> References: <20210604045644.1721-1-zhiguang.liu@intel.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,zhiguang.liu@intel.com X-Gm-Message-State: DDFB2ezdd187iPFwsFIJDgOCx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622782635; bh=ar8qLQ8K6RrrC8ydrEABBkJMxTbUusGbUuKTaBbmk9s=; h=Cc:Date:From:Reply-To:Subject:To; b=etvLW8YIpQBVbgq6FvJWW0WL7URRrH1bObGWYtEuzoFaulTvQ93fbFK075Qu47zF3Fp f+1fJv/cK1I47TGta+bADWZ2bPne4YcFC0NQSPc07+1UUiPVsxqlt7r0bQynMWFq7PBnr b+o25iwPvSLCj9aaNwjizoSWotrUA/JKjog= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Cc: Michael D Kinney Cc: Liming Gao Cc: Jian J Wang Cc: Hao A Wu Signed-off-by: Zhiguang Liu --- MdeModulePkg/Include/UniversalPayload/AcpiTable.h | 28 +++++++++++++++++++= +++++++++ MdeModulePkg/MdeModulePkg.dec | 3 +++ 2 files changed, 31 insertions(+) diff --git a/MdeModulePkg/Include/UniversalPayload/AcpiTable.h b/MdeModuleP= kg/Include/UniversalPayload/AcpiTable.h new file mode 100644 index 0000000000..a85c555d9c --- /dev/null +++ b/MdeModulePkg/Include/UniversalPayload/AcpiTable.h @@ -0,0 +1,28 @@ +/** @file + Define the structure for the Payload APCI table. + +Copyright (c) 2021, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _PLD_ACPI_TABLE_H_ +#define _PLD_ACPI_TABLE_H_ + +#include +#include + +#pragma pack(1) + +typedef struct { + PLD_GENERIC_HEADER PldHeader; + EFI_PHYSICAL_ADDRESS Rsdp; +} PLD_ACPI_TABLE; + +#pragma pack() + +#define PLD_ACPI_TABLE_REVISION 1 + +extern GUID gPldAcpiTableGuid; + +#endif //_PLD_ACPI_TABLE_H_ diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 45324d2e20..4da472d7b9 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -416,6 +416,9 @@ ## Include/UniversalPayload/SmbiosTable.h gPldSmbiosTableGuid =3D { 0x590a0d26, 0x06e5, 0x4d20, { 0x8a, 0x82, 0x59= , 0xea, 0x1b, 0x34, 0x98, 0x2d } } =20 + ## Include/UniversalPayload/AcpiTable.h + gPldAcpiTableGuid =3D { 0x9f9a9506, 0x5597, 0x4515, { 0xba, 0xb6, 0x8b, = 0xcd, 0xe7, 0x84, 0xba, 0x87 } } + [Ppis] ## Include/Ppi/AtaController.h gPeiAtaControllerPpiGuid =3D { 0xa45e60d1, 0xc719, 0x44aa, { 0xb0,= 0x7a, 0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d }} --=20 2.30.0.windows.2 -=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 (#76038): https://edk2.groups.io/g/devel/message/76038 Mute This Topic: https://groups.io/mt/83301969/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- From nobody Thu May 16 10:18:47 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+76039+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+76039+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622782636; cv=none; d=zohomail.com; s=zohoarc; b=BKeYmmp+oQ32e3gsM7ONu3FLV6YjeKJLdayxO9Xbw3bLuU/4ca+tsucQsYO5P1NP2zXmHVPGw53YIZuTfUmJo65S+8LedXLXQBnCbzQBZe9zwY1Brsb/h2ZexixaWpAU0ybI8iE8JPDWOCIzs3QqvMTcTwk2eK1gqo/YeGR/SAA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622782636; h=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=jQI87UizRE1SBEAqFkqRFFqd2e919M3zz7MBKy9QR7c=; b=fr7lTEWOymjPQdqjXzIQ/PMm/SPopmZ3xWbgwo2Zuf6L2LUm5Zm2HjK+ls+YF9tzVRjLhJKwu7a1JqcoxVCaWzs6QKRZQhPFr+g9lbY1AqBT5MW1tWUN11mlDqSTw7nzz1bD+fSmI9CMBfbTQW2tXxhmYSX76v0s3/iXoCCKhuY= 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+76039+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 1622782636935747.4468594682696; Thu, 3 Jun 2021 21:57:16 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id vt7UYY1788612x2bDZHx3srG; Thu, 03 Jun 2021 21:57:16 -0700 X-Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web11.4363.1622782622364813064 for ; Thu, 03 Jun 2021 21:57:10 -0700 IronPort-SDR: D371Uqc6wVgP5sPh40wjiHGlSn1gkeQxhd+3CsPKPlr4F8oJca1cVxsmuiylznmtFmtj0pKCOP 8ghsKWFVguJg== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="268087137" X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208";a="268087137" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 21:57:09 -0700 IronPort-SDR: FlKtJxOiivOWheXoYxj3H6K7ZJqr0+4GfIwLEDXkNBgqBYmtt/WP5+2vhPJxOUTcwHAYMDB0Xr KYyBphMX8QHw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208";a="480502839" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 03 Jun 2021 21:57:08 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Dandan Bi , Liming Gao , Ray Ni Subject: [edk2-devel] [Patch V2 8/9] MdeModulePkg/ACPI: Install ACPI table from HOB. Date: Fri, 4 Jun 2021 12:56:43 +0800 Message-Id: <20210604045644.1721-9-zhiguang.liu@intel.com> In-Reply-To: <20210604045644.1721-1-zhiguang.liu@intel.com> References: <20210604045644.1721-1-zhiguang.liu@intel.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,zhiguang.liu@intel.com X-Gm-Message-State: 4al31JjUrhT2l8BRRoiS9ATFx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622782636; bh=CtxHTw6yc39LaMFKQv/SJz9L86CrdfL5Rwp5laWj3KQ=; h=Cc:Date:From:Reply-To:Subject:To; b=KqD7ZZ+zjwqdtCApMlRqxAJ9ZNMxj+ZWRzcLQwlsXQTGYQkkfFnXWpqDvLnlKEkmWdK AIDlvCed/BNTOBdUeO9H5giYy6SIjhJIPAOJ9jc91bflGHluVcxkfEGaCBS82FQmd8DT9 rOTF6GUpH3/k/bSr5nSiiN6NmAMV8LDKv2c= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" V1: If HOB contains APCI table information, entry point of AcpiTableDxe.inf should parse the APCI table from HOB, and install these tables. We assume the whole ACPI table (starting with EFI_ACPI_2_0_ROOT_SYSTEM_DESC= RIPTION_POINTER) is contained by a single gEfiAcpiTableGuid HOB. V2: If error happens when installing ACPI table, stop installing and removing a= ll the tables that are already added. Cc: Jian J Wang Cc: Hao A Wu Cc: Dandan Bi Cc: Liming Gao Cc: Ray Ni Signed-off-by: Zhiguang Liu --- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c | 92 +++++++= ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------= ---------- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h | 34 +++++++= +++++++++++++++++++++++++++ MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h | 4 +++- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf | 8 +++++--- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 162 +++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--= ----- 5 files changed, 262 insertions(+), 38 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c b/MdeModule= Pkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c index 14ced68e64..0b6b618ca2 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c @@ -191,8 +191,7 @@ SdtNotifyAcpiList ( /** Returns a requested ACPI table. =20 - The GetAcpiTable() function returns a pointer to a buffer containing the= ACPI table associated - with the Index that was input. The following structures are not consider= ed elements in the list of + The following structures are not considered elements in the list of ACPI tables: - Root System Description Pointer (RSD_PTR) - Root System Description Table (RSDT) @@ -201,46 +200,36 @@ SdtNotifyAcpiList ( member. For tables installed via the EFI_ACPI_TABLE_PROTOCOL.InstallAcpi= Table() interface, the function returns the value of EFI_ACPI_STD_PROTOCOL.AcpiVersion. =20 - @param[in] Index The zero-based index of the table to retrieve. - @param[out] Table Pointer for returning the table buffer. - @param[out] Version On return, updated with the ACPI versions to w= hich this table belongs. Type - EFI_ACPI_TABLE_VERSION is defined in "Related = Definitions" in the - EFI_ACPI_SDT_PROTOCOL. - @param[out] TableKey On return, points to the table key for the spe= cified ACPI system definition table. - This is identical to the table key used in the= EFI_ACPI_TABLE_PROTOCOL. - The TableKey can be passed to EFI_ACPI_TABLE_P= ROTOCOL.UninstallAcpiTable() - to uninstall the table. - @retval EFI_SUCCESS The function completed successfully. - @retval EFI_NOT_FOUND The requested index is too large and a table w= as not found. + @param[in] AcpiTableInstance ACPI table Instance. + @param[in] Index The zero-based index of the table to re= trieve. + @param[out] Table Pointer for returning the table buffer. + @param[out] Version On return, updated with the ACPI versio= ns to which this table belongs. Type + EFI_ACPI_TABLE_VERSION is defined in "R= elated Definitions" in the + EFI_ACPI_SDT_PROTOCOL. + @param[out] TableKey On return, points to the table key for = the specified ACPI system definition table. + This is identical to the table key used= in the EFI_ACPI_TABLE_PROTOCOL. + The TableKey can be passed to EFI_ACPI_= TABLE_PROTOCOL.UninstallAcpiTable() + to uninstall the table. + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NOT_FOUND The requested index is too large and a = table was not found. **/ EFI_STATUS -EFIAPI -GetAcpiTable2 ( +SdtInternalGetAcpiTable ( + IN VOID *AcpiTableInstance, IN UINTN Index, OUT EFI_ACPI_SDT_HEADER **Table, OUT EFI_ACPI_TABLE_VERSION *Version, OUT UINTN *TableKey ) { - EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance; UINTN TableIndex; LIST_ENTRY *CurrentLink; LIST_ENTRY *StartLink; EFI_ACPI_TABLE_LIST *CurrentTable; - - ASSERT (Table !=3D NULL); - ASSERT (Version !=3D NULL); - ASSERT (TableKey !=3D NULL); - - // - // Get the instance of the ACPI Table - // - AcpiTableInstance =3D SdtGetAcpiTableInstance (); - // // Find the table // - StartLink =3D &AcpiTableInstance->TableList; + StartLink =3D &((EFI_ACPI_TABLE_INSTANCE *) AcpiTableInstance)->TableL= ist; CurrentLink =3D StartLink->ForwardLink; TableIndex =3D 0; =20 @@ -270,6 +259,55 @@ GetAcpiTable2 ( return EFI_SUCCESS; } =20 +/** + Returns a requested ACPI table. + + The GetAcpiTable() function returns a pointer to a buffer containing the= ACPI table associated + with the Index that was input. The following structures are not consider= ed elements in the list of + ACPI tables: + - Root System Description Pointer (RSD_PTR) + - Root System Description Table (RSDT) + - Extended System Description Table (XSDT) + Version is updated with a bit map containing all the versions of ACPI of= which the table is a + member. For tables installed via the EFI_ACPI_TABLE_PROTOCOL.InstallAcpi= Table() interface, + the function returns the value of EFI_ACPI_STD_PROTOCOL.AcpiVersion. + + @param[in] Index The zero-based index of the table to retrieve. + @param[out] Table Pointer for returning the table buffer. + @param[out] Version On return, updated with the ACPI versions to w= hich this table belongs. Type + EFI_ACPI_TABLE_VERSION is defined in "Related = Definitions" in the + EFI_ACPI_SDT_PROTOCOL. + @param[out] TableKey On return, points to the table key for the spe= cified ACPI system definition table. + This is identical to the table key used in the= EFI_ACPI_TABLE_PROTOCOL. + The TableKey can be passed to EFI_ACPI_TABLE_P= ROTOCOL.UninstallAcpiTable() + to uninstall the table. + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NOT_FOUND The requested index is too large and a table w= as not found. +**/ +EFI_STATUS +EFIAPI +GetAcpiTable2 ( + IN UINTN Index, + OUT EFI_ACPI_SDT_HEADER **Table, + OUT EFI_ACPI_TABLE_VERSION *Version, + OUT UINTN *TableKey + ) +{ + EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance; + + ASSERT (Table !=3D NULL); + ASSERT (Version !=3D NULL); + ASSERT (TableKey !=3D NULL); + + // + // Get the instance of the ACPI Table + // + AcpiTableInstance =3D SdtGetAcpiTableInstance (); + + return SdtInternalGetAcpiTable (AcpiTableInstance, Index, Table, Version= , TableKey); +} + + /** Register a callback when an ACPI table is installed. =20 diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h b/MdeModule= Pkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h index 1b26729e71..8852bb938d 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h @@ -576,4 +576,38 @@ AmlIsRootPath ( IN UINT8 *Buffer ); =20 +/** + Returns a requested ACPI table. + + The following structures are not considered elements in the list of + ACPI tables: + - Root System Description Pointer (RSD_PTR) + - Root System Description Table (RSDT) + - Extended System Description Table (XSDT) + Version is updated with a bit map containing all the versions of ACPI of= which the table is a + member. For tables installed via the EFI_ACPI_TABLE_PROTOCOL.InstallAcpi= Table() interface, + the function returns the value of EFI_ACPI_STD_PROTOCOL.AcpiVersion. + + @param[in] AcpiTableInstance ACPI table Instance. + @param[in] Index The zero-based index of the table to re= trieve. + @param[out] Table Pointer for returning the table buffer. + @param[out] Version On return, updated with the ACPI versio= ns to which this table belongs. Type + EFI_ACPI_TABLE_VERSION is defined in "R= elated Definitions" in the + EFI_ACPI_SDT_PROTOCOL. + @param[out] TableKey On return, points to the table key for = the specified ACPI system definition table. + This is identical to the table key used= in the EFI_ACPI_TABLE_PROTOCOL. + The TableKey can be passed to EFI_ACPI_= TABLE_PROTOCOL.UninstallAcpiTable() + to uninstall the table. + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NOT_FOUND The requested index is too large and a = table was not found. +**/ +EFI_STATUS +SdtInternalGetAcpiTable ( + IN VOID *AcpiTableInstance, + IN UINTN Index, + OUT EFI_ACPI_SDT_HEADER **Table, + OUT EFI_ACPI_TABLE_VERSION *Version, + OUT UINTN *TableKey + ); + #endif diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h b/MdeModu= lePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h index 9d7cf7ccfc..7fd393aab3 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h @@ -1,7 +1,7 @@ /** @file ACPI Table Protocol Driver =20 - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -24,6 +24,8 @@ #include #include #include +#include +#include =20 // // Statements that include other files diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf b/Md= eModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf index d341df439e..9e34f8ea41 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf @@ -4,7 +4,7 @@ # This driver initializes ACPI tables (Rsdp, Rsdt and Xsdt) and produces = UEFI/PI # services to install/uninstall/manage ACPI tables. # -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
# Copyright (c) 2016, Linaro Ltd. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -51,10 +51,12 @@ DebugLib BaseLib PcdLib + HobLib =20 [Guids] - gEfiAcpi10TableGuid ## PRODUCES ## SystemTable - gEfiAcpiTableGuid ## PRODUCES ## SystemTable + gEfiAcpi10TableGuid ## PRODUCES ## S= ystemTable + gEfiAcpiTableGuid ## PRODUCES ## S= ystemTable + gPldAcpiTableGuid ## SOMETIMES_CONSUMES ## H= OB =20 [FeaturePcd] gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol ## CONSUMES diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b= /MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c index 5a2afdff27..4dd3ddd722 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c @@ -1,7 +1,7 @@ /** @file ACPI Table Protocol Implementation =20 - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
Copyright (c) 2016, Linaro Ltd. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -30,6 +30,7 @@ STATIC EFI_ALLOCATE_TYPE mAcpiTableAllocType; @param Table Table to add. @param Checksum Does the table require checksumming. @param Version The version of the list to add the tab= le to. + @param IsFromHob True, if add Apci Table from Hob List. @param Handle Pointer for returning the handle. =20 @return EFI_SUCCESS The function completed successfully. @@ -44,6 +45,7 @@ AddTableToList ( IN VOID *Table, IN BOOLEAN Checksum, IN EFI_ACPI_TABLE_VERSION Version, + IN BOOLEAN IsFromHob, OUT UINTN *Handle ); =20 @@ -238,6 +240,7 @@ InstallAcpiTable ( AcpiTableBufferConst, TRUE, Version, + FALSE, TableKey ); if (!EFI_ERROR (Status)) { @@ -472,6 +475,7 @@ FreeTableMemory ( @param Table Table to add. @param Checksum Does the table require checksumming. @param Version The version of the list to add the tab= le to. + @param IsFromHob True, if add Apci Table from Hob List. @param Handle Pointer for returning the handle. =20 @return EFI_SUCCESS The function completed successfully. @@ -487,6 +491,7 @@ AddTableToList ( IN VOID *Table, IN BOOLEAN Checksum, IN EFI_ACPI_TABLE_VERSION Version, + IN BOOLEAN IsFromHob, OUT UINTN *Handle ) { @@ -553,12 +558,17 @@ AddTableToList ( // SMM communication ACPI table. // ASSERT ((EFI_PAGE_SIZE % 64) =3D=3D 0); - Status =3D gBS->AllocatePages ( - AllocateMaxAddress, - EfiACPIMemoryNVS, - EFI_SIZE_TO_PAGES (CurrentTableList->TableSize), - &AllocPhysAddress - ); + if (IsFromHob){ + AllocPhysAddress =3D (UINTN)Table; + Status =3D EFI_SUCCESS; + } else { + Status =3D gBS->AllocatePages ( + AllocateMaxAddress, + EfiACPIMemoryNVS, + EFI_SIZE_TO_PAGES (CurrentTableList->TableSize), + &AllocPhysAddress + ); + } } else if (mAcpiTableAllocType =3D=3D AllocateAnyPages) { // // If there is no allocation limit, there is also no need to use page @@ -1689,6 +1699,142 @@ ChecksumCommonTables ( return EFI_SUCCESS; } =20 +/** + This function will find gPldAcpiTableGuid Guid Hob, and install Acpi tab= le from it. + + @param AcpiTableInstance Protocol instance private data. + + @return EFI_SUCCESS The function completed successfully. + @return EFI_NOT_FOUND The function doesn't find the gEfiAcpiTableGu= id Guid Hob. + @return EFI_ABORTED The function could not complete successfully. + +**/ +EFI_STATUS +InstallAcpiTableFromHob ( + EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance + ) +{ + EFI_HOB_GUID_TYPE *GuidHob; + EFI_ACPI_TABLE_VERSION Version; + EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp; + EFI_ACPI_DESCRIPTION_HEADER *Rsdt; + EFI_ACPI_DESCRIPTION_HEADER *ChildTable; + UINT64 ChildTableAddress; + UINTN Count; + UINTN Index; + UINTN TableKey; + EFI_STATUS Status; + UINTN EntrySize; + PLD_ACPI_TABLE *AcpiTableAdress; + VOID *TableToInstall; + EFI_ACPI_SDT_HEADER *Table; + + TableKey =3D 0; + Version =3D PcdGet32 (PcdAcpiExposedTableVersions); + Status =3D EFI_SUCCESS; + // + // HOB only contains the ACPI table in 2.0+ format. + // + GuidHob =3D GetFirstGuidHob (&gPldAcpiTableGuid); + if (IS_PLD_HEADER_HAS_REVISION(GuidHob, PLD_ACPI_TABLE_REVISION)) { + // + // PLD_ACPI_TABLE structure is used when Revision equals to PLD_ACPI_T= ABLE_REVISION + // + AcpiTableAdress =3D (PLD_ACPI_TABLE *) GET_GUID_HOB_DATA (GuidHob); + if (AcpiTableAdress->PldHeader.Length < PLD_SIZEOF_THROUGH_FIELD (PLD_= ACPI_TABLE, Rsdp)) { + // + // Retrun if can't find the ACPI Info Hob with enough length + // + return EFI_NOT_FOUND; + } + Rsdp =3D (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *) (UINTN) (Acp= iTableAdress->Rsdp); + + // + // An ACPI-compatible OS must use the XSDT if present. + // It shouldn't happen that XsdtAddress points beyond 4G range in 32-b= it environment. + // + ASSERT ((UINTN) Rsdp->XsdtAddress =3D=3D Rsdp->XsdtAddress); + + EntrySize =3D sizeof (UINT64); + Rsdt =3D (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->XsdtAddress; + if (Rsdt =3D=3D NULL) { + // + // XsdtAddress is zero, then we use Rsdt which has 32 bit entry + // + Rsdt =3D (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->RsdtAddress; + EntrySize =3D sizeof (UINT32); + } + + if (Rsdt->Length <=3D sizeof (EFI_ACPI_DESCRIPTION_HEADER)) { + return EFI_ABORTED; + } + + Count =3D (Rsdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / Entr= ySize; + + for (Index =3D 0; Index < Count; Index++){ + ChildTableAddress =3D 0; + CopyMem (&ChildTableAddress, (UINT8 *) (Rsdt + 1) + EntrySize * Inde= x, EntrySize); + // + // If the address is of UINT64 while this module runs at 32 bits, + // make sure the upper bits are all-zeros. + // + ASSERT (ChildTableAddress =3D=3D (UINTN) ChildTableAddress); + if (ChildTableAddress !=3D (UINTN) ChildTableAddress) { + Status =3D EFI_ABORTED; + break; + } + + ChildTable =3D (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) ChildTableAdd= ress; + Status =3D AddTableToList (AcpiTableInstance, ChildTable, TRUE, Vers= ion, TRUE, &TableKey); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "InstallAcpiTableFromHob: Fail to add ACPI ta= ble at 0x%p\n", ChildTable)); + ASSERT_EFI_ERROR (Status); + break; + } + if (ChildTable->Signature =3D=3D EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION= _TABLE_SIGNATURE){ + // + // Add the FACS and DSDT tables if it is not NULL. + // + if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *) ChildTable)->Fi= rmwareCtrl !=3D 0) { + TableToInstall =3D (VOID *) (UINTN) ((EFI_ACPI_3_0_FIXED_ACPI_DE= SCRIPTION_TABLE *) ChildTable)->FirmwareCtrl; + Status =3D AddTableToList (AcpiTableInstance, TableToInstall, TR= UE, Version, TRUE, &TableKey); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "InstallAcpiTableFromHob: Fail to add ACP= I table FACS\n")); + ASSERT_EFI_ERROR (Status); + break; + } + } + + if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *) ChildTable)->Ds= dt !=3D 0) { + TableToInstall =3D (VOID *) (UINTN) ((EFI_ACPI_3_0_FIXED_ACPI_DE= SCRIPTION_TABLE *) ChildTable)->Dsdt; + Status =3D AddTableToList (AcpiTableInstance, TableToInstall, TR= UE, Version, TRUE, &TableKey); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "InstallAcpiTableFromHob: Fail to add ACP= I table DSDT\n")); + ASSERT_EFI_ERROR (Status); + break; + } + } + } + } + } else { + return EFI_NOT_FOUND; + } + + if (EFI_ERROR (Status)) { + // + // Error happens when trying to add ACPI table to the list. + // Remove all of them from list because at this time, no other tables = except from HOB are in the list + // + while (SdtInternalGetAcpiTable (AcpiTableInstance, 0, &Table, &Version= , &TableKey) =3D=3D EFI_SUCCESS) { + RemoveTableFromList (AcpiTableInstance, Version, TableKey); + } + } else { + Status =3D PublishTables (AcpiTableInstance, Version); + } + + ASSERT_EFI_ERROR (Status); + return Status; +} =20 /** Constructor for the ACPI table protocol. Initializes instance @@ -1918,6 +2064,8 @@ AcpiTableAcpiTableConstructor ( =20 ChecksumCommonTables (AcpiTableInstance); =20 + InstallAcpiTableFromHob (AcpiTableInstance); + // // Completed successfully // --=20 2.30.0.windows.2 -=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 (#76039): https://edk2.groups.io/g/devel/message/76039 Mute This Topic: https://groups.io/mt/83301970/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- From nobody Thu May 16 10:18:47 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+76040+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+76040+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622782637; cv=none; d=zohomail.com; s=zohoarc; b=HOM9uTasWx+0AfBNyZ5nQfEYIUW4drq8u4YBn9YTar2YLkPkk3IxVc3FmbXn0yvPVNYGIxDTTH5/wefQioPj/mvBB7I5ED52Z4DsmxyypSLNIMWtstttW44IhsclLOjMZzQYcPexDDfoSZKklPbyHZ0qmNojuBNSVa9+h6fVFPA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622782637; h=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=f1IFfQ5kKWvOMN/fG5Ycf/u62iJ3IRCPWjURxmV1/cs=; b=nEiU7Gu2RR7/2iqSo7Of1NKqPzgnCseegZeT0bbW9OlN+D6A96E0HvvmOGupodooZlHxynP+Csx+YFQ5gBms13RnviV9KewQF1RJp3wrUw5ppidm/ZkGKWUaIEZVrnJ/1fPxy0UA5JRuGr7HURo0LB+Feu3/tWhi2P8oZgarN4g= 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+76040+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 1622782637758220.13534388432856; Thu, 3 Jun 2021 21:57:17 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Yi28YY1788612xy2K8DbD1Us; Thu, 03 Jun 2021 21:57:17 -0700 X-Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web11.4363.1622782622364813064 for ; Thu, 03 Jun 2021 21:57:11 -0700 IronPort-SDR: 7Mt3d3H3qQSfVgY8qQd5a+AqvPwixVZow7Ervq/LAMojkJtuZhrCSBKhxNgj2VBj23Y1vAD2K+ r/30JLzXvwow== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="268087139" X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208,223";a="268087139" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2021 21:57:11 -0700 IronPort-SDR: Lcj28yE8d1IS6brJPzsSzx2SV9I3W5wOGbSFA+BNBqXUZooOX6sgeF/ilmRMmFODeK2CM1q34Q q4VmajkeXOTg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,247,1616482800"; d="scan'208,223";a="480502852" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga001.jf.intel.com with ESMTP; 03 Jun 2021 21:57:10 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You , Ray Ni Subject: [edk2-devel] [Patch V2 9/9] UefiPayloadPkg: Creat gPldAcpiTableGuid Hob Date: Fri, 4 Jun 2021 12:56:44 +0800 Message-Id: <20210604045644.1721-10-zhiguang.liu@intel.com> In-Reply-To: <20210604045644.1721-1-zhiguang.liu@intel.com> References: <20210604045644.1721-1-zhiguang.liu@intel.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,zhiguang.liu@intel.com X-Gm-Message-State: nAyGiwpUTVUlXFYnNzkprcuQx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622782637; bh=4Q03S6yRxB0NeoxeDP0liP7SSaOg/8VTTJUr/XMFyZ4=; h=Cc:Date:From:Reply-To:Subject:To; b=gKCS0MQfxMxf5yko/3rkgYvEl0LTg7iUvZjtmqzibvftvO75T0+cYgKXVcJseqmJ7uG NMvPmvC4dXMFQb21YnmiDjwXTKVV8n4pDhaKI14WNLRsZzstf/iHWk5lg93RtKj4tt5V8 Pz3oUZT5u1okFaJ7kiGlAwh614AdP0J+2Gk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From SysTableInfo Hob, get ACPI table address, and creat gPldAcpiTableGuid = Hob to store it. Remove diretly adding ACPI table to ConfigurationTable. Dxe ACPI driver will parse it and install ACPI table from Guid Hob. Cc: Maurice Ma Cc: Guo Dong Cc: Benjamin You Cc: Ray Ni Signed-off-by: Zhiguang Liu --- UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c | 17 ----------------- UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h | 5 +---- UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf | 1 - UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c | 11 +++++++++++ UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h | 2 +- UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf | 1 + UefiPayloadPkg/UefiPayloadPkg.fdf | 4 ++++ 7 files changed, 18 insertions(+), 23 deletions(-) diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c b/UefiPayloadPkg/Bl= SupportDxe/BlSupportDxe.c index 56b85b8e6d..ffd3427fb3 100644 --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c @@ -99,7 +99,6 @@ BlDxeEntryPoint ( { EFI_STATUS Status; EFI_HOB_GUID_TYPE *GuidHob; - SYSTEM_TABLE_INFO *SystemTableInfo; EFI_PEI_GRAPHICS_INFO_HOB *GfxInfo; ACPI_BOARD_INFO *AcpiBoardInfo; =20 @@ -113,22 +112,6 @@ BlDxeEntryPoint ( Status =3D ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0= xFED00000, SIZE_1KB, 0, ImageHandle); // HPET ASSERT_EFI_ERROR (Status); =20 - // - // Find the system table information guid hob - // - GuidHob =3D GetFirstGuidHob (&gUefiSystemTableInfoGuid); - ASSERT (GuidHob !=3D NULL); - SystemTableInfo =3D (SYSTEM_TABLE_INFO *)GET_GUID_HOB_DATA (GuidHob); - - // - // Install Acpi Table - // - if (SystemTableInfo->AcpiTableBase !=3D 0 && SystemTableInfo->AcpiTableS= ize !=3D 0) { - DEBUG ((DEBUG_ERROR, "Install Acpi Table at 0x%lx, length 0x%x\n", Sys= temTableInfo->AcpiTableBase, SystemTableInfo->AcpiTableSize)); - Status =3D gBS->InstallConfigurationTable (&gEfiAcpiTableGuid, (VOID *= )(UINTN)SystemTableInfo->AcpiTableBase); - ASSERT_EFI_ERROR (Status); - } - // // Find the frame buffer information and update PCDs // diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h b/UefiPayloadPkg/Bl= SupportDxe/BlSupportDxe.h index 512105fafd..3332a30eae 100644 --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h @@ -1,7 +1,7 @@ /** @file The header file of bootloader support DXE. =20 -Copyright (c) 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -19,12 +19,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include =20 -#include #include #include #include #include =20 -#include - #endif diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf b/UefiPayloadPkg/= BlSupportDxe/BlSupportDxe.inf index 30f41f8c39..1ccb250991 100644 --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf @@ -42,7 +42,6 @@ HobLib =20 [Guids] - gEfiAcpiTableGuid gUefiSystemTableInfoGuid gUefiAcpiBoardInfoGuid gEfiGraphicsInfoHobGuid diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c b/UefiPaylo= adPkg/UefiPayloadEntry/UefiPayloadEntry.c index 7b71d37f94..14b7a732da 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c @@ -235,6 +235,7 @@ BuildHobFromBl ( EFI_PEI_GRAPHICS_DEVICE_INFO_HOB GfxDeviceInfo; EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *NewGfxDeviceInfo; PLD_SMBIOS_TABLE *SmBiosTableHob; + PLD_ACPI_TABLE *AcpiTableHob; =20 // // Parse memory info and build memory HOBs @@ -287,6 +288,16 @@ BuildHobFromBl ( SmBiosTableHob->SmBiosEntryPoint =3D SysTableInfo.SmbiosTableBase; DEBUG ((DEBUG_INFO, "Create smbios table gPldSmbiosTableGuid guid hob\n"= )); =20 + //=20 + // Creat ACPI table Hob + // + AcpiTableHob =3D BuildGuidHob (&gPldAcpiTableGuid, sizeof (PLD_ACPI_TABL= E)); + ASSERT (AcpiTableHob !=3D NULL); + AcpiTableHob->PldHeader.Revision =3D PLD_ACPI_TABLE_REVISION; + AcpiTableHob->PldHeader.Length =3D sizeof (PLD_ACPI_TABLE); + AcpiTableHob->Rsdp =3D SysTableInfo.AcpiTableBase; + DEBUG ((DEBUG_INFO, "Create smbios table gPldAcpiTableGuid guid hob\n")); + // // Create guid hob for acpi board information // diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h b/UefiPaylo= adPkg/UefiPayloadEntry/UefiPayloadEntry.h index e7d0d15118..a4c9da128e 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h @@ -32,7 +32,7 @@ #include #include #include - +#include =20 #define LEGACY_8259_MASK_REGISTER_MASTER 0x21 #define LEGACY_8259_MASK_REGISTER_SLAVE 0xA1 diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf b/UefiPay= loadPkg/UefiPayloadEntry/UefiPayloadEntry.inf index 444f39acf3..01388b8831 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf @@ -65,6 +65,7 @@ gEfiGraphicsDeviceInfoHobGuid gUefiAcpiBoardInfoGuid gPldSmbiosTableGuid + gPldAcpiTableGuid =20 [FeaturePcd.IA32] gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONSUMES diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf b/UefiPayloadPkg/UefiPayload= Pkg.fdf index 8fc509024b..ed7fbcaddb 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.fdf +++ b/UefiPayloadPkg/UefiPayloadPkg.fdf @@ -175,6 +175,10 @@ INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf =20 +# +# ACPI Support +# +INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf =20 # # Shell --=20 2.30.0.windows.2 -=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 (#76040): https://edk2.groups.io/g/devel/message/76040 Mute This Topic: https://groups.io/mt/83301971/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-