From nobody Thu May 16 04:07:33 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+76055+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+76055+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622799758; cv=none; d=zohomail.com; s=zohoarc; b=aUgxt8bXr6yG4GhmD5Rb05j/q3PN6NGeTeI3PQ0v29uyPXngk5m43BRzemdDd+d9rjklVrLCFkZE3qDmmcMNJ8rEMNe1A2cA796kEtBO/EGG/6pYLSGy0cKIjK25BxEKyKooAz6+rnDkO1psC4bY3bKjxSjGID6xMp+/6c7x1Zk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622799758; 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=XCkGoNl6ltYhhQTTuZtJRGCLuMAPFCT+hB+8P374hTM=; b=RPCjsxdcWOzxFSih0wKVRSHrnk/1HWOUzEkW/wza0l4+8N9UFtw9N3YpwZKIX1Dy3X/ZLMTp6wo7tsrMDmIw6pp7Xn6/F7lNeY5OxrqV9JVevbvJVlnlNiRiAGyv7o/50KF7Rq1rjuOmGketAt166+Ok9RGhnKqqJldL20tXgsM= 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+76055+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 1622799758855167.37110672638676; Fri, 4 Jun 2021 02:42:38 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id GZ8IYY1788612xvNEgHJialA; Fri, 04 Jun 2021 02:42:38 -0700 X-Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.6094.1622799752437525639 for ; Fri, 04 Jun 2021 02:42:33 -0700 IronPort-SDR: 8w73jpf5bba6uNX0qXH48D9+xzOwAM6nTARGzaQmvTMl1i2k5H81SI3Y+GkC4WsNRLmh2UImPg OCWwamfXB2vQ== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="202401887" X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="202401887" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2021 02:42:32 -0700 IronPort-SDR: XXgjqG+zy29YHf+975PW6U93+n3SWWIKl5SF56DM6mgITQ/6wjbtjyhMqzSN633fFGcOUpic+m 43xe5mLdOaiQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="448203543" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by fmsmga008.fm.intel.com with ESMTP; 04 Jun 2021 02:42:30 -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 V3 1/9] MdeModulePkg: Add Universal Payload general defination header file Date: Fri, 4 Jun 2021 17:42:19 +0800 Message-Id: <20210604094227.1890-2-zhiguang.liu@intel.com> In-Reply-To: <20210604094227.1890-1-zhiguang.liu@intel.com> References: <20210604094227.1890-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: LTq9HaggbyVUqKkxcfRvchqMx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622799758; bh=7T6M0U/1/DdFNbV7oBf/gkKddjr0heoS+10ld0U/mBA=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=dbx/GXi6WJhYujFpLq8rByQK5v1PsE2YKZrhQzZUoy7R1KjtdKJDFJd+3LnOVXqe0AM neUHhK33aekJEsMKnnqpB6DB1+d/YM2Rn+gccI4i8IauddxgY4u99tCCLVC5UCpS2Eur2 ZfhqOL5JdaHOa19Xe2wTnYFqt5bNkFZucw4= 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 Reviewed-by: Hao A Wu --- MdeModulePkg/Include/UniversalPayload/UniversalPayload.h | 33 ++++++++++++= +++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/MdeModulePkg/Include/UniversalPayload/UniversalPayload.h b/Mde= ModulePkg/Include/UniversalPayload/UniversalPayload.h new file mode 100644 index 0000000000..627b9e880e --- /dev/null +++ b/MdeModulePkg/Include/UniversalPayload/UniversalPayload.h @@ -0,0 +1,33 @@ +/** @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__ + +#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)) + +#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 (#76055): https://edk2.groups.io/g/devel/message/76055 Mute This Topic: https://groups.io/mt/83304942/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 04:07:33 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+76057+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+76057+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622799759; cv=none; d=zohomail.com; s=zohoarc; b=OnMr2dTUs/VcFtexxF5xH4EVc/96JONYs+5s9HCjCRxoc1AM/3aA2zqs8kjgnUUpspOGKr8JPAqOlTrHWUb8GJA6384UfLi5eXWfVqQhOUM/vK87SeZSgD1tlFR95ax3nvAOlEi6P9oDbdalTUSEJZuE0SbWQRFi0LrImdINTgo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622799759; 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=9+dsf7et3/sawUD9tAX7MBYcXCQNBrcaS0mfVhCh6cg=; b=DhgxA+tL/ebpeuWA4PbA/Oghyi7p9+rYQQdoS0momTdvqpUCuaM4L4bv7VX+MQo7BXhFZlTVvkI240jgPMIKONAn1zvoQMFKEYAY8bS1nak0VMas1eU9Xo9cjqDSY77KPnWVMpmtmj520jYHe1AdlvgW8MJvURs3o9ufVi+FhYw= 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+76057+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 1622799759884983.8678514095697; Fri, 4 Jun 2021 02:42:39 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id AFrHYY1788612xENeBPoppQh; Fri, 04 Jun 2021 02:42:39 -0700 X-Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web09.6160.1622799753888231527 for ; Fri, 04 Jun 2021 02:42:34 -0700 IronPort-SDR: F7VgrM3OqrYHVGEnrb0tCPVQvejU1zR68PorbLH+NkkLIsu4yJaYQruQAn+yhA8adZ9dOchB8X kQ3Rz+adUiRQ== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="202401892" X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="202401892" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2021 02:42:33 -0700 IronPort-SDR: mSJvtKojkzvL2zVf/ZteDq5FUTVOIlbP5nWnvcDW9wmNkfqjWuInK445Yt62vHlTA8n+EvYN6F Wcq98J5F6KTg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="448203551" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by fmsmga008.fm.intel.com with ESMTP; 04 Jun 2021 02:42:32 -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 V3 2/9] MdeModulePkg: Add new structure for the PCI Root Bridge Info Hob Date: Fri, 4 Jun 2021 17:42:20 +0800 Message-Id: <20210604094227.1890-3-zhiguang.liu@intel.com> In-Reply-To: <20210604094227.1890-1-zhiguang.liu@intel.com> References: <20210604094227.1890-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: qo1fa3dFMKSE1LqmAcLGb7trx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622799759; bh=upEkqCMccaWQNwzGOYje2Xu5e1KqaY5qyhAb1nKDlXY=; h=Cc:Date:From:Reply-To:Subject:To; b=OPYbI3YhcAJ/ekNmXaV+7vkU5htAaR337zYZSUubknFGkQGJ397T5vvf/kIqYn+0Q0y j8mMlokQM15GNKO1F8ppMWlyy8DQN6aUbI5IfFOkJYKtYGTkZdmu/HJ9fRVhSNpaW17U4 ux1UJQT447GBgc73U/RCn8s47DvrMLxLCgE= 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 Reviewed-by: Hao A Wu --- 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 (#76057): https://edk2.groups.io/g/devel/message/76057 Mute This Topic: https://groups.io/mt/83304944/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 04:07:33 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+76058+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+76058+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622799761; cv=none; d=zohomail.com; s=zohoarc; b=Lb2yc00ua8xG8uDUu9SnJfj9r/HcJTU8Y99nXcyVSsK+6SIl891QSRkOCww8VsDsTtlguZ1vEfe41FYnw6SqMu/8fJilEVzNaLwMya+gVhN3KMxO2syqlOkp+/5RHhxW1csEMG0BLzw3pINd+uo81qopsz/gdcitJYjJH3VPUdc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622799761; 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=jjJ1iZIS09pPiP3ekzfUW4YEwJCeb/3A/Wfq/lODhqI=; b=FAKGwkrGPhQQkKG7ZYlcVYqDXGqyXAfNpHa5hqOXKcNvnQpesL6wU1BczxUKDm0AicFKehuXE0H6s07RFVtYKXYFeWw7zjs6tlRzkR7AOdV0GpZRaJFkA0ODAVZDAlu/2Kw0SSwzMCdZZQs4mszyT2Tn6hLhggnC1yZXoqz/Q2U= 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+76058+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 162279976139791.84054800905551; Fri, 4 Jun 2021 02:42:41 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id NOW1YY1788612xHr2ZORYaAC; Fri, 04 Jun 2021 02:42:41 -0700 X-Received: from mga04.intel.com (mga04.intel.com []) by mx.groups.io with SMTP id smtpd.web09.6160.1622799753888231527 for ; Fri, 04 Jun 2021 02:42:35 -0700 IronPort-SDR: 7yZig66Ny3BbRXZ2mbTTsvK8j1lMenbw675AsFW1syaggzN5CqgNYzSipkPW3N/kK7DySieptU l2Hwx81awY4A== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="202401903" X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="202401903" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2021 02:42:35 -0700 IronPort-SDR: pqm8n6wzElIqGIJGPWWiKV9rqYbupl0E0dhcLWrX/Tc5SwgxsW+XEPcJDb4c/n/li7LD9vzMhC 94i6rH27ca8Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="448203563" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by fmsmga008.fm.intel.com with ESMTP; 04 Jun 2021 02:42:33 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [Patch V3 3/9] UefiPayloadPkg: UefiPayload retrieve PCI root bridge from Guid Hob Date: Fri, 4 Jun 2021 17:42:21 +0800 Message-Id: <20210604094227.1890-4-zhiguang.liu@intel.com> In-Reply-To: <20210604094227.1890-1-zhiguang.liu@intel.com> References: <20210604094227.1890-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: pvPNgKfmGhgyUnlai8UuaAMZx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622799761; bh=6Xfd1vgl++s3mVt0s3QgOe2tQ5HFjUodTADpizbyn6Y=; h=Cc:Date:From:Reply-To:Subject:To; b=eBTJNqyW3Wn+BxIoH5ouIWuV7IY8NWXovq7SesGnNL0h8nFqnCJPT93xuwqMb5Ui/JD cbPLF/S+0a1DGks+1o6HADfhH5IEFM12WMCtXhvkahSmiT6OIr8Vm216xtv25+rROT7WQ 2NLH9xAgMVarKCa3wi/leaKHRv1hB+R727o= 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 | 47 ++++++= ++++++++++++++++++++++++++++++++++++++--- UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 8 ++++++= +- UefiPayloadPkg/Library/PciHostBridgeLib/PciHostBridgeSupport.c | 73 ++++++= ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- UefiPayloadPkg/UefiPayloadPkg.dsc | 2 +- 5 files changed, 162 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..6aa43e8c7e 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,30 @@ PciHostBridgeGetRootBridges ( UINTN *Count ) { + PLD_PCI_ROOT_BRIDGES *PciRootBridgeInfo; + EFI_HOB_GUID_TYPE *GuidHob; + PLD_GENERIC_HEADER *GenericHeader; + // + // Find PLD PCI Root Bridge Info hob + // + GuidHob =3D GetFirstGuidHob (&gPldPciRootBridgeInfoGuid); + if (GuidHob !=3D NULL) { + GenericHeader =3D (PLD_GENERIC_HEADER *) GET_GUID_HOB_DATA (GuidHob); + if ((sizeof(PLD_GENERIC_HEADER) <=3D GET_GUID_HOB_DATA_SIZE (GuidHob))= && (GenericHeader->Length <=3D GET_GUID_HOB_DATA_SIZE (GuidHob))) { + if ((GenericHeader->Revision =3D=3D PLD_PCI_ROOT_BRIDGES_REVISION) &= & (GenericHeader->Length >=3D sizeof (PLD_PCI_ROOT_BRIDGES))) { + // + // 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 (= GuidHob); + if (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 (#76058): https://edk2.groups.io/g/devel/message/76058 Mute This Topic: https://groups.io/mt/83304945/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 04:07:33 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+76059+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+76059+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622799763; cv=none; d=zohomail.com; s=zohoarc; b=bsQ7qzt6qpy3U2alZGhEZX/hU3WbfQMOhkFk0njsPuozSarMt9xdb/mj5TBXjBKR9dgzkqF9C7wON9ZC/iW5Qywp7dbYQ3170dgJfV1RYfI67xA81VzUjWtFK+/AmoAgIJXzWEwnbFCQ0GARy+pbDPYuMWUUCvsmfK8Tc51gi1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622799763; 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=/BAxOgBaVIV4rxTh7xYwUJtSfczSvaWVOdY9wkF3Kug=; b=cgXYDUhin0a5c8vhFL2lIaKpLmMpA3dR5Oh42/CMiP0XgB7BFGlNgmzviSHFO7t4MYq4vNGa7ylHsnIQhSbmY3/W5/nt5ZNDs0FXt/11UEArjlAwnuXw+wqEeZREuV2ohYoaEJoWvjewQIHphXZlJ9I3Ogccmx7jwU9Jji5Nru0= 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+76059+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 1622799763956442.2059323417801; Fri, 4 Jun 2021 02:42:43 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id fWkyYY1788612xdhR9pvZF1K; Fri, 04 Jun 2021 02:42:43 -0700 X-Received: from mga04.intel.com (mga04.intel.com []) by mx.groups.io with SMTP id smtpd.web09.6160.1622799753888231527 for ; Fri, 04 Jun 2021 02:42:38 -0700 IronPort-SDR: EGA0WlQqpgNhV8PcYztqtJEtYLaO0DpSlNFrZOoW8cXM6BDqn/IcOD06jr3KbKYQSwVM7Xja6j s3m7iRYqkPDA== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="202401923" X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="202401923" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2021 02:42:37 -0700 IronPort-SDR: RTCT5Z93FNeHDE/tMelkKzSn/n97TRWv2IqVO90NIrz7QGuku1v2eFNJcxAy0pM9HA3cdf6+23 dNc4ixJxAKXA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="448203578" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by fmsmga008.fm.intel.com with ESMTP; 04 Jun 2021 02:42:35 -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 V3 4/9] MdeModulePkg: Add new structure for the Universal Payload SMBios Table Info Hob Date: Fri, 4 Jun 2021 17:42:22 +0800 Message-Id: <20210604094227.1890-5-zhiguang.liu@intel.com> In-Reply-To: <20210604094227.1890-1-zhiguang.liu@intel.com> References: <20210604094227.1890-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: JxEXSCCf0FZWJlqstMFYnozcx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622799763; bh=BSXIPyVKCiNaRVpuLphdR0jFGXeD3aJxGdpgdDyBcQI=; h=Cc:Date:From:Reply-To:Subject:To; b=lh0BKuErfTZynOmSlCSJaIeD9Yp6gzf11X5npmaI9o/7KgL87KzqJeC39vsGA64frkZ Ma8P/10SfQ3dcqw5GwYJKGHUKOaE5MZCuZmW16JLmXZcmrctQ72k1LDhrGizXmAtYvx4S a+yQbdKPOk8U9vMYxqHcYLvCBhtgZ49NDsM= 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 Reviewed-by: Hao A Wu --- 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 (#76059): https://edk2.groups.io/g/devel/message/76059 Mute This Topic: https://groups.io/mt/83304946/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 04:07:33 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+76060+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+76060+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622799767; cv=none; d=zohomail.com; s=zohoarc; b=kFUbkFhGpH8Sq0rnYJCu6Cvwe0auV4LF0tCjK/44fAkEg1K/VeObqPGGXGdCqNErrAJEkT9kmskjsnnEufQA1P0uTkDLdfj7p3puM5nZ1+ERl51kjfYYmI8DqN+/Xz/87oXCv+IjD+111gRD+FkDqAKUhR4lFCKbUHNby9GzRtw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622799767; 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=mqL2jlLSUP0N1VKyZ16N2w95taRhIENE0ESbCC12QGw=; b=DrsJQGWvk7Ap3G7PMddlQV4Ih2Jietnn1lICB5djQR+x2KH0ZTNgde3QOUAni8KaQhjCWxleR7ANJHKzXva4hckxv/yhMYtOeRliX0eD3brKvtFVBqVFs8HyKabjQ0INRnXaeG7fo7uCH09KOjBveFQduUkHf/sh6BcZ8HMJUl4= 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+76060+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 1622799767061625.0976823140714; Fri, 4 Jun 2021 02:42:47 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 7rVPYY1788612xH4TTYMMNQn; Fri, 04 Jun 2021 02:42:46 -0700 X-Received: from mga04.intel.com (mga04.intel.com []) by mx.groups.io with SMTP id smtpd.web09.6160.1622799753888231527 for ; Fri, 04 Jun 2021 02:42:39 -0700 IronPort-SDR: h7bxnpxQqQc5F0MmwFBj/BCEztS+/FHmrHuljCfCSSQs8PMRH/FjsIlgSNDnuESeYA5ttVyuTV PoO7Si06jmmg== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="202401934" X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="202401934" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2021 02:42:39 -0700 IronPort-SDR: Ty8RV9U6OYFdakgzr99FhP83rqj3JgnOiQTurz17G31cINcOnT5ZI0a5Wf32SKErMQoAknn5JV hsOBAw284bzw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="448203592" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by fmsmga008.fm.intel.com with ESMTP; 04 Jun 2021 02:42:37 -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 V3 5/9] MdeModulePkg/Universal/SmbiosDxe: Scan for existing tables Date: Fri, 4 Jun 2021 17:42:23 +0800 Message-Id: <20210604094227.1890-6-zhiguang.liu@intel.com> In-Reply-To: <20210604094227.1890-1-zhiguang.liu@intel.com> References: <20210604094227.1890-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: GaPF9VAkP5mnqLwVMkWL2puLx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622799766; bh=bRH6bYeVAegbwOx7cTTTQwmTTffQYXD6AecODKBnCRM=; h=Cc:Date:From:Reply-To:Subject:To; b=orlVt3dY3CP7If/jVA4lCivOHmQvfoJQwQVZUDAvHeap/wcIvrri/jt9LzvTXHzmrOC D0FzO3J3JCreo9RjTx1ELirTqrPuygPAL8DKTkKG26tHYT5ps+Wo5F8fE6pnsGK99Qcx3 jRVI7JTIXWV908rkOow6g8YiUegtp8qb0lI= 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 Reviewed-by: Hao A Wu --- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c | 320 +++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.h | 4 +++- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf | 5 ++++- 3 files changed, 325 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c b/MdeModulePkg/Un= iversal/SmbiosDxe/SmbiosDxe.c index 3cdb0b1ed7..3579c4d890 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 **/ @@ -148,6 +148,31 @@ SMBIOS_TABLE_3_0_ENTRY_POINT Smbios30EntryPointStructu= reData =3D { // 0 }; + +/** + Validates a SMBIOS table entry point. + + @param TableEntry The SmBios table entry to validate. + @param TableAddress On exit, point to the smbios table addres. + @param TableMaximumSize On exit, point to the maximum size of the table. + + @retval TRUE SMBIOS table entry point is valid. + @retval FALSE SMBIOS table entry point is malformed. + +**/ +typedef +BOOLEAN +(* IS_SMBIOS_TABLE_VALID) ( + IN VOID *TableEntry, + OUT VOID **TableAddress, + OUT UINTN *TableMaximumSize + ); +typedef struct { + EFI_GUID *Guid; + IS_SMBIOS_TABLE_VALID IsValid; +} IS_SMBIOS_TABLE_VALID_ENTRY; + + /** =20 Get the full size of SMBIOS structure including optional strings that fo= llow the formatted structure. @@ -1408,6 +1433,296 @@ SmbiosTableConstruction ( } } =20 +/** + Validates a SMBIOS 2.0 table entry point. + + @param TableEntry The SmBios table entry to validate. + @param TableAddress On exit, point to the smbios table addres. + @param TableMaximumSize On exit, point to the maximum size of the table. + + @retval TRUE SMBIOS table entry point is valid. + @retval FALSE SMBIOS table entry point is malformed. + +**/ +STATIC +BOOLEAN +IsValidSmbios20Table ( + IN VOID *TableEntry, + OUT VOID **TableAddress, + OUT UINTN *TableMaximumSize + ) +{ + UINT8 Checksum; + SMBIOS_TABLE_ENTRY_POINT *SmbiosTable; + SmbiosTable =3D (SMBIOS_TABLE_ENTRY_POINT *) TableEntry; + + 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) + ); + if (Checksum !=3D 0) { + return FALSE; + } + + *TableAddress =3D (VOID *) (UINTN) SmbiosTable->TableAddress; + *TableMaximumSize =3D SmbiosTable->TableLength; + return TRUE; +} + +/** + Validates a SMBIOS 3.0 table entry point. + + @param TableEntry The SmBios table entry to validate. + @param TableAddress On exit, point to the smbios table addres. + @param TableMaximumSize On exit, point to the maximum size of the table. + + @retval TRUE SMBIOS table entry point is valid. + @retval FALSE SMBIOS table entry point is malformed. + +**/ +STATIC +BOOLEAN +IsValidSmbios30Table ( + IN VOID *TableEntry, + OUT VOID **TableAddress, + OUT UINTN *TableMaximumSize + ) +{ + UINT8 Checksum; + SMBIOS_TABLE_3_0_ENTRY_POINT *SmbiosTable; + SmbiosTable =3D (SMBIOS_TABLE_3_0_ENTRY_POINT *) TableEntry; + + 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; + } + + *TableAddress =3D (VOID *) (UINTN) SmbiosTable->TableAddress; + *TableMaximumSize =3D SmbiosTable->TableMaximumSize; + 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; +} + + +IS_SMBIOS_TABLE_VALID_ENTRY mIsSmbiosTableValid[] =3D { + {&gPldSmbios3TableGuid, IsValidSmbios30Table }, + {&gPldSmbiosTableGuid, IsValidSmbios20Table } +}; + +/** + 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; + UINTN Index; + SMBIOS_STRUCTURE_POINTER Smbios; + EFI_HOB_GUID_TYPE *GuidHob; + PLD_SMBIOS_TABLE *SmBiosTableAdress; + PLD_GENERIC_HEADER *GenericHeader; + VOID *TableAddress; + UINTN TableMaximumSize; + + Status =3D EFI_NOT_FOUND; + + for (Index =3D 0; Index < ARRAY_SIZE (mIsSmbiosTableValid); Index++) { + GuidHob =3D GetFirstGuidHob (mIsSmbiosTableValid[Index].Guid); + if (GuidHob =3D=3D NULL) { + continue; + } + GenericHeader =3D (PLD_GENERIC_HEADER *) GET_GUID_HOB_DATA (GuidHob); + if ((sizeof (PLD_GENERIC_HEADER) <=3D GET_GUID_HOB_DATA_SIZE (GuidHob)= ) && (GenericHeader->Length <=3D GET_GUID_HOB_DATA_SIZE (GuidHob))) { + if (GenericHeader->Revision =3D=3D PLD_SMBIOS_TABLE_REVISION) { + // + // PLD_SMBIOS_TABLE structure is used when Revision equals to PLD_= SMBIOS_TABLE_REVISION + // + SmBiosTableAdress =3D (PLD_SMBIOS_TABLE *) GET_GUID_HOB_DATA (Guid= Hob); + if (GenericHeader->Length >=3D PLD_SIZEOF_THROUGH_FIELD (PLD_SMBIO= S_TABLE, SmBiosEntryPoint)) { + if (mIsSmbiosTableValid[Index].IsValid ((VOID *) (UINTN )SmBiosT= ableAdress->SmBiosEntryPoint, &TableAddress, &TableMaximumSize)) { + Smbios.Raw =3D TableAddress; + Status =3D ParseAndAddExistingSmbiosTable (ImageHandle, Smbios= , TableMaximumSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "RetrieveSmbiosFromHob: Failed to parse= preinstalled tables from gPldSmbios3TableGuid Guid Hob\n")); + Status =3D EFI_UNSUPPORTED; + } else { + return EFI_SUCCESS; + } + } + } + } + } + } + return Status; +} + /** =20 Driver to produce Smbios protocol and pre-allocate 1 page for the final = SMBIOS table. @@ -1451,5 +1766,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 (#76060): https://edk2.groups.io/g/devel/message/76060 Mute This Topic: https://groups.io/mt/83304947/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 04:07:33 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+76061+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+76061+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622799766; cv=none; d=zohomail.com; s=zohoarc; b=c2ZMdK2mB3YBdX3isWtllT9fgvY9l4+XXqovR5kr+q9rfV9gESXmaQSZ9Eby3Mi/tFGgO6BpoDgF3/DxGy1X+OGt6eMTSJYcyYe4xlsWsL5y62N3ZlG52cZwPAy1QzomFSeKQmRn0DaCVzF+BWwZ722PXWLm8fukVYgwkvQjPHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622799766; 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=0yOnJPfPZkgU81U3m0ttw3F5dzM0XvIzxOMIWiFOWnE=; b=kW6uPHaVFRsygSU1+Z4WixBmEwAupHm149jgPDBU+afZ0kHWSpnKi79NqLyjuTxm6vqQVzd7PnZn1mSVGsOL66ubC8w+EIMIyLEKGBeoaiJC5nW/AHW6V9sUMjB9JINMWgmLbRoblxzFuD/ZTh/Q1TJRMxY6POq5wZJxrp4ehyU= 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+76061+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 1622799766981668.7513871995644; Fri, 4 Jun 2021 02:42:46 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id sGtWYY1788612xjfhfpFDEzr; Fri, 04 Jun 2021 02:42:46 -0700 X-Received: from mga04.intel.com (mga04.intel.com []) by mx.groups.io with SMTP id smtpd.web09.6160.1622799753888231527 for ; Fri, 04 Jun 2021 02:42:41 -0700 IronPort-SDR: FhMzoGO9gFIimprKXuToW5yp2XO98JpnoXysej1U0is/dwHmoBv5BJlqlIdS5ICUAFb6q2PG+v lw2WV6+jZI0w== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="202401945" X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208,223";a="202401945" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2021 02:42:40 -0700 IronPort-SDR: 00ZvwiFgnZSIWYEtyC67jFLJ3CvUJQz0pQK9ITxzYxxYz3mX/HqIvOTvRLvxuEgENypuzleLA9 mDF+SMeGlmQQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208,223";a="448203598" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by fmsmga008.fm.intel.com with ESMTP; 04 Jun 2021 02:42:39 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [Patch V3 6/9] UefiPayloadPkg: Creat gPldSmbiosTableGuid Hob Date: Fri, 4 Jun 2021 17:42:24 +0800 Message-Id: <20210604094227.1890-7-zhiguang.liu@intel.com> In-Reply-To: <20210604094227.1890-1-zhiguang.liu@intel.com> References: <20210604094227.1890-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: CBWf37uulCRvJcfJIw0YZ4Fzx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622799766; bh=nB4BoszeKEJzuYsOeKIvSImkFe3m3eFHO0Ynwe++YMk=; h=Cc:Date:From:Reply-To:Subject:To; b=A7bhV2GQPt/d7Is7MvNLZeYSgkGZAE4MbXtKHk3YgGbX+baBjw76zvR2Qm9XT0Jgp1U oqwT0IiRikpeQ77mQIP0uLIDrCijZXznEPVNYoLkY4iFkXdnsBn9HLikjMOZFs5iNSJBH /TNXHasjBzQtJsNoYFxQPNIHVKKrKcSPK+4= 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 (#76061): https://edk2.groups.io/g/devel/message/76061 Mute This Topic: https://groups.io/mt/83304948/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 04:07:33 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+76062+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+76062+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622799768; cv=none; d=zohomail.com; s=zohoarc; b=jDAygxc6ZvOusG5dffqjfyRxHeK7vUGtYTNnonrS9FIh+sIotCrCQv+0G8Tw3Aj18l+xiBtNpCqQD+axF2mSxT/nCkx1GHR8TEdARnCPsLnEPNDSGyboToQmX858l3I34bqfeBruERHoSKLft6r8qe8plclHwQZgqCP3Zl2Fc6o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622799768; 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=0aPfySm5QqMpG/qPPRAha9f8xbRPJa6qWOX9MaP4UWQ=; b=NcXjIzJ3aPLT4jLNt/KkCAd/4Yc3/M9iDUdgIOredVLytYIEeJ/e9De0WyjNlVsetUFJ+x11oM1HpJWXBHReBkBkyIAy5UoSBLhnedTR/kDtlLWRrCXIWR8qaim8F2h6sHflkiK5Sdy0r8KkmwWWXCsftkow08kbgz7eAFewOKY= 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+76062+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 1622799768378111.89588249247367; Fri, 4 Jun 2021 02:42:48 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id GhUGYY1788612xt55gXvAShg; Fri, 04 Jun 2021 02:42:48 -0700 X-Received: from mga04.intel.com (mga04.intel.com []) by mx.groups.io with SMTP id smtpd.web09.6160.1622799753888231527 for ; Fri, 04 Jun 2021 02:42:42 -0700 IronPort-SDR: 8OjmeXcGbh4d6VWApm+CVuSMWz2lD6mczgqQBA3UqSzGCwGe+ORUlQTWM6QfPczitsyj3nNMJQ YxDrQRl3wYgw== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="202401961" X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="202401961" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2021 02:42:42 -0700 IronPort-SDR: SdxnO7DT6IoAn4h92g+/cnfkMkL1HZPyvl3MuX53dYwd1beafCPaeUGooxM2w6BRcPv4o2dFh6 yanY+36fkLkA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="448203608" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by fmsmga008.fm.intel.com with ESMTP; 04 Jun 2021 02:42:40 -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 V3 7/9] MdeModulePkg: Add new structure for the Universal Payload ACPI Table Info Hob Date: Fri, 4 Jun 2021 17:42:25 +0800 Message-Id: <20210604094227.1890-8-zhiguang.liu@intel.com> In-Reply-To: <20210604094227.1890-1-zhiguang.liu@intel.com> References: <20210604094227.1890-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: 1X7rCTwqgT0xjoIi19KSLvOMx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622799768; bh=S2QITL9iVrv7yWg2qqC7rQAMVXL337zV1Wrz9jTABSA=; h=Cc:Date:From:Reply-To:Subject:To; b=hrcAPMuFpXABjMOBrI7R3ND1pi7VBPhzHw9wrAZqxablDqi81Kupwj3urFJDwo+sltE yI0c4bR6LwS7ls9BKBHCXBKfE90t89YGkIWDnpHeKawLEld4fyyXGOuxcACOZps8u/gdL ptakcmnGx6GCyd5b88MS7rfaol0rV+01dxc= 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 Reviewed-by: Hao A Wu --- 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 (#76062): https://edk2.groups.io/g/devel/message/76062 Mute This Topic: https://groups.io/mt/83304949/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 04:07:33 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+76063+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+76063+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622799770; cv=none; d=zohomail.com; s=zohoarc; b=NlZbtFa9nUMtMzM5nvjMP0wxoM28rCtWyP55m9CcYTEZcAVA3LS1RAaKWWflFtAMKcj+5SBkfSUyYGlJKkEsMFAHTLxzy4hiyNvmw7z9ytrwE/5F0DnknKaDQMWg0zpMjpjBWy9dsC1JTBkdv9Bk+L3R7UpYyrqsoKITm/JIEbE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622799770; 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=J5mZMEo0o3gd2sfvpOOmOFWCjz5uV2Byyi7qEN8kb00=; b=Xby4GNdNgzeA4U2lsa74qUrvz+18o2jugz0dvJ26joIb4cqa4Q6CDdFLJXiIadTbZVri9gkQCwB2yWIfWzBFSp8tAY/4XXQaCV4aTkYrMWGaqJXcNSmNLkbCIDIf82E5QJO8e9eFhyq/6whfdUcuTz+PYeK3zP0RMADL9/Q3Em8= 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+76063+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 1622799770323385.2831175206495; Fri, 4 Jun 2021 02:42:50 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id bUuNYY1788612x0QYA56NF0b; Fri, 04 Jun 2021 02:42:49 -0700 X-Received: from mga04.intel.com (mga04.intel.com []) by mx.groups.io with SMTP id smtpd.web09.6160.1622799753888231527 for ; Fri, 04 Jun 2021 02:42:44 -0700 IronPort-SDR: F+jyrfXJRm9Siv30qeV7zZXuRnfE6M3aPPpXLI9R3Md6r3bUCnQxonBIHHQivBV//alN4HdVEA QrNKXjf1vKJg== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="202401977" X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="202401977" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2021 02:42:44 -0700 IronPort-SDR: wY5J2wtNUzRjojawc55vfGWefCBBkBOaFWp2j1Ph2bUT1QvGEN+Elub9oAyg0z4uo6NNWz676E sNePzKV+n5uw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208";a="448203618" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by fmsmga008.fm.intel.com with ESMTP; 04 Jun 2021 02:42:42 -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 V3 8/9] MdeModulePkg/ACPI: Install ACPI table from HOB. Date: Fri, 4 Jun 2021 17:42:26 +0800 Message-Id: <20210604094227.1890-9-zhiguang.liu@intel.com> In-Reply-To: <20210604094227.1890-1-zhiguang.liu@intel.com> References: <20210604094227.1890-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: qMM34NV84ikUN8h1iKj8x0Ntx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622799769; bh=QWpJgzsqM8QQu4kA/PbEflh/pgWeFoGNiB0fkTybbQA=; h=Cc:Date:From:Reply-To:Subject:To; b=ookos/oWrsu8LLnbhaUnUmOIaU0FNqPzkwaxYIOw3J+3Pbe1SlPvMitBoN/vgoCr63A Jr+DzkoBc66hx2TSnDaNJI/7VGG5Zl6AwA6INq8zKUumziQks39pbPfq225MIfoSdr2Jh WxhEy0u03UbLLTSuQJDYBSNmMl4ELGTE/Gg= 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 Reviewed-by: Hao A Wu --- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c | 92 +++++++= ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------= ---------- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h | 38 +++++++= ++++++++++++++++++++++++++++++- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf | 8 +++++--- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 171 +++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++------- 4 files changed, 271 insertions(+), 38 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c b/MdeModule= Pkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c index 14ced68e64..d98573d613 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.c @@ -1,7 +1,7 @@ /** @file ACPI Sdt Protocol Driver =20 - Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -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,42 +200,32 @@ 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 ( +SdtGetAcpiTable ( + IN EFI_ACPI_TABLE_INSTANCE *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 // @@ -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 SdtGetAcpiTable (AcpiTableInstance, Index, Table, Version, TableK= ey); +} + + /** Register a callback when an ACPI table is installed. =20 diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h b/MdeModu= lePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h index 9d7cf7ccfc..0af2d11a1a 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 @@ -228,6 +230,40 @@ SdtAcpiTableAcpiSdtConstructor ( IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance ); =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 +SdtGetAcpiTable ( + IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance, + IN UINTN Index, + OUT EFI_ACPI_SDT_HEADER **Table, + OUT EFI_ACPI_TABLE_VERSION *Version, + OUT UINTN *TableKey + ); + // // export PrivateData symbol, because we need that in AcpiSdtProtol implem= entation // 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..cd79a1082c 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,151 @@ 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; + PLD_GENERIC_HEADER *GenericHeader; + + 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 (GuidHob =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + GenericHeader =3D (PLD_GENERIC_HEADER *) GET_GUID_HOB_DATA (GuidHob); + if ((sizeof (PLD_GENERIC_HEADER) > GET_GUID_HOB_DATA_SIZE (GuidHob)) || = (GenericHeader->Length > GET_GUID_HOB_DATA_SIZE (GuidHob))) { + return EFI_NOT_FOUND; + } + if (GenericHeader->Revision =3D=3D 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 (SdtGetAcpiTable (AcpiTableInstance, 0, &Table, &Version, &Table= Key) =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 +2073,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 (#76063): https://edk2.groups.io/g/devel/message/76063 Mute This Topic: https://groups.io/mt/83304950/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 04:07:33 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+76064+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+76064+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1622799768; cv=none; d=zohomail.com; s=zohoarc; b=LkP+0iAtcrX7WLRHcQR0mL/LA8IqMbWVgRNB1N4yqkduqwct7lCyvx0h93MWaxFHgPLimMWfCeCo016LDsyKxD1AJrvM5QGYZXctS6Vz8hMxWDvWCExxRuMY414xdnWfZP69JjMqJIIx3yZvLYi+4YjHQh/ll+/oXEZfrSCzkQo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622799768; 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=tHLkwIdsWs+8OdTG9ozGh3Tu5vXNGyC49qROj2D84MQ=; b=X++qPWp+HIwOOvopqcmY/xVEc6VcWpsFvPgtspT4Ok1MLLhTJsQUwvdqQ0wzzZQpm/hNjUTRUXAl9sXISKWvB0ido5CgIe+qxi190UJWDjFld6el30+yl9Tb3Pr8fLUALqnzAQvUiZRXSMzABhfJrTl036CBup7esYCwKRWtuuw= 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+76064+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 1622799768035821.0274173459725; Fri, 4 Jun 2021 02:42:48 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id P9c6YY1788612x1Gz8bjmiir; Fri, 04 Jun 2021 02:42:47 -0700 X-Received: from mga04.intel.com (mga04.intel.com []) by mx.groups.io with SMTP id smtpd.web09.6160.1622799753888231527 for ; Fri, 04 Jun 2021 02:42:47 -0700 IronPort-SDR: vBsVs/oF0O5o0XR8TelJO8MCylLx3DyHA3WUBfry71iYNWNZHMgfi8NCsso4+GkM9u45PrNMRN za54KihM6E/w== X-IronPort-AV: E=McAfee;i="6200,9189,10004"; a="202401986" X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208,223";a="202401986" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2021 02:42:46 -0700 IronPort-SDR: oKPe9xBYpqepO7dFRM4yNgcCBrLJnwZymCowGa+6OmPrTE6iNruuOoVXjZ9Lw6EVZa+9fZxvFb cjEs9JZOoIfg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,248,1616482800"; d="scan'208,223";a="448203627" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by fmsmga008.fm.intel.com with ESMTP; 04 Jun 2021 02:42:44 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You , Ray Ni Subject: [edk2-devel] [Patch V3 9/9] UefiPayloadPkg: Creat gPldAcpiTableGuid Hob Date: Fri, 4 Jun 2021 17:42:27 +0800 Message-Id: <20210604094227.1890-10-zhiguang.liu@intel.com> In-Reply-To: <20210604094227.1890-1-zhiguang.liu@intel.com> References: <20210604094227.1890-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: i6tu4q7HQrNiBgNhFIduAfp2x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1622799767; bh=m5jngfMJAQ3J8FoJAUGAh+GW3UI99RTJvciRY9TJHNk=; h=Cc:Date:From:Reply-To:Subject:To; b=X1W3Vz4fHgWFbj+9kqbvKOlL5ZyfJ8lY4lnYOvU0unlINo2Bsn6IUfCbOu/GB4PbCVN p3EggouEqE+9lz4dCJHulVmJ2wYUU4eCmsO80bRbHhsKB5cQws/hSWbs3a3Vaw1q/xCpj HWGYcdw0C/OGjvR1fp5uBukIbF15/whCEDo= 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 (#76064): https://edk2.groups.io/g/devel/message/76064 Mute This Topic: https://groups.io/mt/83304951/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-