From nobody Sun May 19 12:13:34 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+75485+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+75485+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1621840380; cv=none; d=zohomail.com; s=zohoarc; b=BFRq4Ca+z2764hVe0WbOnxmuu4JgrhhiG3q1Z2yFrn5RUB00seIlQKkSwo6bdQI62Bdy7NCHacYW6Bejw2wSWbD0YdcbUK/cTD8gD26DwWtmieXgVcyZGqzZwHrt4ANrKwnjSRSQFuLJRwQO9YizBtpuVvUmA0cvsqZmn4W8eXU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621840380; 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=oWpRyZVzplBvus/vnSHKL+iIQ+CF+dBuDwbMO6zvlHo=; b=hOnMIlMapEun/n56D4XIp1ihIT9OlTXFAA1kQ53nHEuxhrBMOi02MOSGCB7dl7IEs36m2Nhd9qajAgMJbN7MSE28U+OJfC8MBvXGea7szF45fBqd8AiHattFlJjskOPd03FTBOf15+F1eoFlEYtSf7qLzA5XsxvVARp0KqHhf+A= 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+75485+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 1621840380807866.7726466419415; Mon, 24 May 2021 00:13:00 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id qoEEYY1788612xyjOS4XxGk5; Mon, 24 May 2021 00:13:00 -0700 X-Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.19984.1621840379860146758 for ; Mon, 24 May 2021 00:12:59 -0700 IronPort-SDR: k9Ow2+juLb2AWSialBhuNQ7WVZ7LnsjmCEhXkYyOSmGkE0KYC1ZSmJI6WkOdrNHgj0UIMWAZ+T JLrznsOyoZ8w== X-IronPort-AV: E=McAfee;i="6200,9189,9993"; a="265769818" X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="265769818" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2021 00:12:59 -0700 IronPort-SDR: 2kD6/s4NBt5rx4lid72NUHNr60UYLn2sN7kqaYmBNcVfiQw3Q+vvuOKO61++B2Ju42GsRYnG2b AX2PfNkp7kyw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="413477675" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga002.jf.intel.com with ESMTP; 24 May 2021 00:12:51 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao Subject: [edk2-devel] [PATCH 1/9] MdePkg: Add Universal Payload general defination header file Date: Mon, 24 May 2021 15:12:26 +0800 Message-Id: <20210524071234.1056-2-zhiguang.liu@intel.com> In-Reply-To: <20210524071234.1056-1-zhiguang.liu@intel.com> References: <20210524071234.1056-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: Ed6xjxBxjmDNghdXjL2R1FtYx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621840380; bh=nRsA6sHfRD/2LmeA0uRDwpPmx9oPDLbWw2ukQtTkXq0=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=WI34EBSuzUGhnfuxYcQpmiz/8nTxPhT6yQhuJO8c3ns1hDU12bFLDNe/vma8TcYhunx QGjbQRoMMpPd4gi8diIkXENq1Geugw41/kziHuudyp5aV9vzCtW4EYtOHleTOPgVnQFp5 Rs1s7Z+bSjQ1oBmEoySsjmV3vigSBsQ7VJc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add Universal Payload general defination header file according to Universal Payload=E2=80=99s documentation Cc: Michael D Kinney Cc: Liming Gao Signed-off-by: Zhiguang Liu --- MdePkg/Include/UniversalPayload/UniversalPayload.h | 33 ++++++++++++++++++= +++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/MdePkg/Include/UniversalPayload/UniversalPayload.h b/MdePkg/In= clude/UniversalPayload/UniversalPayload.h new file mode 100644 index 0000000000..627b9e880e --- /dev/null +++ b/MdePkg/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 (#75485): https://edk2.groups.io/g/devel/message/75485 Mute This Topic: https://groups.io/mt/83045504/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 Sun May 19 12:13:34 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+75486+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+75486+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1621840381; cv=none; d=zohomail.com; s=zohoarc; b=Oa8KeDPwswG9LH+GSauShHavxGOEgLBuV5J8X24geDO4lCm3ZH8xSaWBv06IJYEUdzMWB4oVA+aMPyp3ohEXw9wHIuPzACl9NjtQk6GCxFELr0WcxqArIXTXohqO3XcS1u5+fbeknqqLb/KJJckQm7pD0nXWlcGO9d0JyQG/R8E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621840381; 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=YWviyetbPhx6GLsUwGCAo0uAsJ6RF24SFFZj7GgF+v8=; b=fFFQVK0FM9TFab24FmESISDvRjPJzGCv3grBw/zllwGN3rKRCD4nIQX7ZKldF2XjvfUc/ihyGY3fY72SlMzFdt/Lh/wtQkkREDirrQGRJ+gaE7it36cMzhyZUZOk5tFdNsdE7sxkGisMZmYToVa5ShmQl1NQ0kUy2JHsoVtZ04Y= 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+75486+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 1621840381207548.6067756107954; Mon, 24 May 2021 00:13:01 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id GFQRYY1788612xViZNOW0asE; Mon, 24 May 2021 00:13:00 -0700 X-Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web11.19984.1621840379860146758 for ; Mon, 24 May 2021 00:13:00 -0700 IronPort-SDR: C2NIgiXpkyRaKYkTM9qa2r6/1AvcJD373yopU0GqDzYL0eJzs/Ks6n9IFb0y5A9NxViZFjJr6E kq6dnoIDkIeQ== X-IronPort-AV: E=McAfee;i="6200,9189,9993"; a="265769820" X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="265769820" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2021 00:12:59 -0700 IronPort-SDR: WR+8Mj+x5hojbQisBWBjPKLlf2DIbhsbI+cuhS3RdDxRRGv5EnEYOJKrSo8mK+lzimgY/84Yn0 z058nM13Ir2g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="413477705" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga002.jf.intel.com with ESMTP; 24 May 2021 00:12:56 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao Subject: [edk2-devel] [PATCH 2/9] MdePkg: Add new structure for the PCI Root Bridge Info Hob Date: Mon, 24 May 2021 15:12:27 +0800 Message-Id: <20210524071234.1056-3-zhiguang.liu@intel.com> In-Reply-To: <20210524071234.1056-1-zhiguang.liu@intel.com> References: <20210524071234.1056-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: FHr7zlFlpUG7rGIzTGkATgiox1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621840380; bh=OecqGMSc97e27rrJa+U1GR/9i7eUIXenmiRdlw03p7o=; h=Cc:Date:From:Reply-To:Subject:To; b=Ha3WiNfRKrMCIhPC4dZc7vmMCdJUQgGAK4ocvOrkdPK+331DN7DPI+7F6IFq/596jch V3dYl8UHSLoFYRzIjr4wOTYpHtKxgOaypZwznp49fZIF5+gxk0JHU/0MYDc+pS3zMhQ4Q 30l0XgIGbJcJsgfA3KfSe/KwcY8SsKtxYbE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Cc: Michael D Kinney Cc: Liming Gao Signed-off-by: Zhiguang Liu --- MdePkg/Include/UniversalPayload/PciRootBridges.h | 89 ++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ MdePkg/MdePkg.dec | 6 ++++++ 2 files changed, 95 insertions(+) diff --git a/MdePkg/Include/UniversalPayload/PciRootBridges.h b/MdePkg/Incl= ude/UniversalPayload/PciRootBridges.h new file mode 100644 index 0000000000..72e8331ede --- /dev/null +++ b/MdePkg/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/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index b49f88d8e1..3cf509728b 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -818,6 +818,12 @@ # gTianoCustomDecompressGuid =3D { 0xA31280AD, 0x481E, 0x41B6, { 0x95,= 0xE8, 0x12, 0x7F, 0x4C, 0x98, 0x47, 0x79 }} =20 + # + # GUID defined in UniversalPayload + # + ## Include/UniversalPayload/PciRootBridges.h + gPldPciRootBridgeInfoGuid =3D { 0xec4ebacb, 0x2638, 0x416e, { 0xbe, 0x80= , 0xe5, 0xfa, 0x4b, 0x51, 0x19, 0x01 }} + [Guids.IA32, Guids.X64] ## Include/Guid/Cper.h gEfiIa32X64ErrorTypeCacheCheckGuid =3D { 0xA55701F5, 0xE3EF, 0x43de, { 0= xAC, 0x72, 0x24, 0x9B, 0x57, 0x3F, 0xAD, 0x2C }} --=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 (#75486): https://edk2.groups.io/g/devel/message/75486 Mute This Topic: https://groups.io/mt/83045506/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 Sun May 19 12:13:34 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+75487+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+75487+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1621840386; cv=none; d=zohomail.com; s=zohoarc; b=EijZbEarS9P5IYmr58jHD5BevkewsMihiRf8fmiZEc0j3/sIO58c0uTZJxtDshHmNxDOQLXKHso6KTwxdAHXIBSD/6WbDew2w4eed1N2GKJVNX0J/mZUSz4uM/ZgoEM5FOZ/7tzBHEj5XKxEmvzkqkaAWIJLHfBjVOed62IQRro= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621840386; 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=c1lgKouRqsN983defZ8Oes8zqvucsz29Ay5qeTo+9w4=; b=dQ47KdioFWqmC7SAQprwAiocevc/cfaeTAxp/dcrda/tUzX3G2hZ5q8ZviwvXl706XEIOc30vHjUei7aPB2Wj+T5pT4yJT9hE61z4ze09edYW53iYYo0Y6Cyn4QvmYGpyInK9cJn+XLjpBc6oJFQd9n88ag1RTawNntZzoF28D0= 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+75487+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 1621840386403245.25130666261862; Mon, 24 May 2021 00:13:06 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id MlKfYY1788612x4gNe6IyeUW; Mon, 24 May 2021 00:13:06 -0700 X-Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web11.19984.1621840379860146758 for ; Mon, 24 May 2021 00:13:00 -0700 IronPort-SDR: 3S6mrnu/CK2/QWQ1cffNeilty3UekADhA0s85qOs6zAJ/DLRGOv46tOOTIwCu75RgEy42lE3xU Y0sNNoAhabtw== X-IronPort-AV: E=McAfee;i="6200,9189,9993"; a="265769824" X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="265769824" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2021 00:13:00 -0700 IronPort-SDR: TBbMQHIJDiKBSaPTOBtcDQS47wKDIiDvJ0ssALi8oEzl483hK++cumfZEpFFwZda9stO0Qakps DYHrpEIuyfEQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="413477712" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga002.jf.intel.com with ESMTP; 24 May 2021 00:12:58 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [PATCH 3/9] UefiPayloadPkg: UefiPayload retrieve PCI root bridge from Guid Hob Date: Mon, 24 May 2021 15:12:28 +0800 Message-Id: <20210524071234.1056-4-zhiguang.liu@intel.com> In-Reply-To: <20210524071234.1056-1-zhiguang.liu@intel.com> References: <20210524071234.1056-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: YLD0TRyGN4QFx2bZiHONgjHyx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621840386; bh=dSxo4dvhqL18ltg9V7jucrpBcEgSJABSTeZeDFhE8zY=; h=Cc:Date:From:Reply-To:Subject:To; b=aiJpGfMA3imYLKLbfdLzN8+d710lseB2AqWGtOwUfvrqtSDy8q+sX+79eaPvfcSlagb zavArOxbf3wMN/yX/ss6EaQVOEAXLRY2zI/LxPIUSFm5K694U5h4tNvI5ukT2GMegxpRg y7k/8nKJMu9HKgnY6lNV/BtllOBc7EUeHXw= 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 (#75487): https://edk2.groups.io/g/devel/message/75487 Mute This Topic: https://groups.io/mt/83045507/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 Sun May 19 12:13:34 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+75488+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+75488+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1621840388; cv=none; d=zohomail.com; s=zohoarc; b=II9bofPgNghxAaekbvHB4UvkwaClPHwXDo7qBPh8g9mbu8t2DMdNiPCkBRWIXwk3KAr0C2k2GTqEBkwtZy0N6umr6kLRAUCykEOQnIoAaYfnaZsguaQRbKU+atp5skgOKa+ClFBCgoV89ZvaOe6Xs5nO0m/Vgvj6CW+jdGlgrbo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621840388; 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=p+8/3VW6lqKcdeLmcMkth8acZ44hu4S9CxloNl9l6iA=; b=QD9Hbw9/b7IpducbFtAh9oMbG6ZvzEyOsaFNk5pitS+/1cDAfUIttB+GLO62Gh2TFSnC03PvpmS9VTIScwlMRwr6n8VNDTVHT+nAm5OOdy9CMF4U7wT8sZ/QmN4VFlxRGiwOROXCNoJCe69LG0SaQiA5FSWsosbvtnkstRBoUp8= 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+75488+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 1621840388484973.1225913026168; Mon, 24 May 2021 00:13:08 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Hv3zYY1788612xtpuZ3rVrqA; Mon, 24 May 2021 00:13:08 -0700 X-Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web11.19984.1621840379860146758 for ; Mon, 24 May 2021 00:13:02 -0700 IronPort-SDR: PdNTN8iKiYOgl3deg5H5QM0pKJ1tLPhfbzW6eRwRagCvEAtGDyLwqP7ThGDnieCLbLi15XL3TY 9DF+uduAJfig== X-IronPort-AV: E=McAfee;i="6200,9189,9993"; a="265769837" X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="265769837" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2021 00:13:01 -0700 IronPort-SDR: xJcbvZU6GFLVGqqXdd0ovEMu6i2r53AVq8+7vtrh8FajMv9iiphPkzlcIRGU9+qpjT/pYhL06F H8y92E5+PVHA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="413477725" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga002.jf.intel.com with ESMTP; 24 May 2021 00:13:00 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao Subject: [edk2-devel] [PATCH 4/9] MdePkg: Add new structure for the Universal Payload SMBios Table Info Hob Date: Mon, 24 May 2021 15:12:29 +0800 Message-Id: <20210524071234.1056-5-zhiguang.liu@intel.com> In-Reply-To: <20210524071234.1056-1-zhiguang.liu@intel.com> References: <20210524071234.1056-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: WmSqvQtlMCe8LqFPbaUktzTYx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621840388; bh=TWzfeXkppBfUZCAYQXrtaMJNMqVtT+3psFTRgISTGWs=; h=Cc:Date:From:Reply-To:Subject:To; b=dDwo6pI9oWXJ0RMudWHw/s56pOYcfs5E8Te9VEli+sAUXXpNlKIxjWGCb9tYCloM9yK YDjLfGEB3R8JfLT2LEBbROnc1EUdyha5jfRULcppf4QzYONjtpVbLcsJ99Q1PSBUbJDO+ PXwgmJMDMnqq1557fhGNB7JXZDThS7Y1M1E= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Cc: Michael D Kinney Cc: Liming Gao Signed-off-by: Zhiguang Liu --- MdePkg/Include/UniversalPayload/SmbiosTable.h | 28 +++++++++++++++++++++++= +++++ MdePkg/MdePkg.dec | 6 ++++++ 2 files changed, 34 insertions(+) diff --git a/MdePkg/Include/UniversalPayload/SmbiosTable.h b/MdePkg/Include= /UniversalPayload/SmbiosTable.h new file mode 100644 index 0000000000..3aaa926396 --- /dev/null +++ b/MdePkg/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/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 3cf509728b..7a62829059 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -824,6 +824,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 } } + [Guids.IA32, Guids.X64] ## Include/Guid/Cper.h gEfiIa32X64ErrorTypeCacheCheckGuid =3D { 0xA55701F5, 0xE3EF, 0x43de, { 0= xAC, 0x72, 0x24, 0x9B, 0x57, 0x3F, 0xAD, 0x2C }} --=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 (#75488): https://edk2.groups.io/g/devel/message/75488 Mute This Topic: https://groups.io/mt/83045508/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 Sun May 19 12:13:34 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+75489+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+75489+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1621840391; cv=none; d=zohomail.com; s=zohoarc; b=cUYaXTxB3q4M3KMRXY69ZivQib/81pxEwT3l7IU86nyo6+RlS8cg/AOmvH/MwL+Ket+Vqos4R6wiN83rngK3MupyautKqbDL9tzyT/WI+4mn7o9hzx3/20tymLSxfvxjfX3gCREE2I4LtQ4gRM4gVyvezq4xjrCK9/cZ5MkMZQE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621840391; 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=m0haPDl31p8vgOrP6twKi7Imdzf9lPikXzCCrcBPPAc=; b=ZPhDDsPRTqq/lJSN5TNBwvF88Sf87nayKnFTWmdDndX1X9DSY9fF6TO5iw08y7PYMzrziegO+F1J4zvhs92ina3bgponD2Q/jxs9cPTT09mXxA7garoPKZpgRtnvi+M1e6eMd6ruJx75kwRxGYSnQEDt2eU/XyxORd+3aduyxD8= 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+75489+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 1621840391018584.8893142993214; Mon, 24 May 2021 00:13:11 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ivZdYY1788612xVPCfJE7b6P; Mon, 24 May 2021 00:13:10 -0700 X-Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web11.19984.1621840379860146758 for ; Mon, 24 May 2021 00:13:05 -0700 IronPort-SDR: Rxzjo6iu/RWc9L/VX8fjiOXv7NV13lc7um6bDF1A9oEM/dNrj4WXniCjvR/NgZ3pd/Z+NxvsVR +MVuFI7G7ynA== X-IronPort-AV: E=McAfee;i="6200,9189,9993"; a="265769847" X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="265769847" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2021 00:13:04 -0700 IronPort-SDR: fMBYvk0CKsqBqfNij6EE8uo5p/ERf+VNLl4eaIyOnRBycjfGxpo+sjiS47kmCv18xRNMarYs30 chOVp62cbujw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="413477746" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga002.jf.intel.com with ESMTP; 24 May 2021 00:13:02 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Jian J Wang , Hao A Wu , Dandan Bi , Star Zeng , Zhichao Gao , Patrick Rudolph Subject: [edk2-devel] [PATCH 5/9] MdeModulePkg/Universal/SmbiosDxe: Scan for existing tables Date: Mon, 24 May 2021 15:12:30 +0800 Message-Id: <20210524071234.1056-6-zhiguang.liu@intel.com> In-Reply-To: <20210524071234.1056-1-zhiguang.liu@intel.com> References: <20210524071234.1056-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: FiAKZhFi0oZzsypC588EvtOPx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621840390; bh=fxls0hOuXUvWvlw4H33PZVWxp4Ds202iO/EKBbQhnII=; h=Cc:Date:From:Reply-To:Subject:To; b=oZUEO0y5rOunZ5Mce9gPhzuLnGs4jN96OIkaADG1ZZvuB+4N7DFk3TWp60tlRcveVrF XwzIMFWZuGTNhrd3g9az4Hl6RBjhjeTx7mXaD8leRRghOIOHJXmiiveHkjqT+/FDFvhFt TUvQBOZrtZ1sYtulj5Hmsewmh96ohTMAoEM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" V1: The default EfiSmbiosProtocol operates on an empty SMBIOS table. The SMBIOS tables are provided by the bootloader on UefiPayloadPkg. Scan for existing tables in SmbiosDxe and load them if they seem valid. This fixes the settings menu not showing any hardware information, instead only "0 MB RAM" was displayed. Tests showed that the OS can still see the SMBIOS tables. V2: SmbiosDxe will get the SMBIOS from a guid Hob. Aslo will keep the SmbiosHandle if it is available. Cc: Jian J Wang Cc: Hao A Wu Cc: Dandan Bi Cc: Star Zeng Cc: Zhichao Gao Signed-off-by: Patrick Rudolph Signed-off-by: Zhiguang Liu --- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c | 299 +++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++-- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.h | 4 +++- MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf | 5 ++++- 3 files changed, 304 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c b/MdeModulePkg/Un= iversal/SmbiosDxe/SmbiosDxe.c index 3cdb0b1ed7..d2aa15d43f 100644 --- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c +++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c @@ -2,7 +2,7 @@ This code produces the Smbios protocol. It also responsible for construc= ting SMBIOS table into system table. =20 -Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -1408,6 +1408,300 @@ SmbiosTableConstruction ( } } =20 +/** + Validates a SMBIOS 2.0 table entry point. + + @param SmbiosTable The SMBIOS_TABLE_ENTRY_POINT to validate. + + @retval TRUE SMBIOS table entry point is valid. + @retval FALSE SMBIOS table entry point is malformed. + +**/ +STATIC +BOOLEAN +IsValidSmbios20Table ( + IN SMBIOS_TABLE_ENTRY_POINT *SmbiosTable + ) +{ + UINT8 Checksum; + + if (CompareMem (SmbiosTable->AnchorString, "_SM_", 4) !=3D 0) { + return FALSE; + } + + // + // 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 be 2. + // + if (SmbiosTable->MajorVersion !=3D 2) { + return FALSE; + } + + // + // The whole struct check sum should be zero + // + Checksum =3D CalculateSum8 ( + (UINT8 *) SmbiosTable, + SmbiosTable->EntryPointLength + ); + if (Checksum !=3D 0) { + return FALSE; + } + + // + // The Intermediate Entry Point Structure check sum should be zero. + // + Checksum =3D CalculateSum8 ( + (UINT8 *) SmbiosTable + OFFSET_OF (SMBIOS_TABLE_ENTRY_POINT= , IntermediateAnchorString), + SmbiosTable->EntryPointLength - OFFSET_OF (SMBIOS_TABLE_ENT= RY_POINT, IntermediateAnchorString) + ); + return (BOOLEAN) (Checksum =3D=3D 0); +} + +/** + Validates a SMBIOS 3.0 table entry point. + + @param SmbiosTable The SMBIOS_TABLE_3_0_ENTRY_POINT to validate. + + @retval TRUE SMBIOS table entry point is valid. + @retval FALSE SMBIOS table entry point is malformed. + +**/ +STATIC +BOOLEAN +IsValidSmbios30Table ( + IN SMBIOS_TABLE_3_0_ENTRY_POINT *SmbiosTable + ) +{ + UINT8 Checksum; + + if (CompareMem (SmbiosTable->AnchorString, "_SM3_", 5) !=3D 0) { + return FALSE; + } + if (SmbiosTable->EntryPointLength < sizeof (SMBIOS_TABLE_3_0_ENTRY_POINT= )) { + return FALSE; + } + if (SmbiosTable->MajorVersion < 3) { + return FALSE; + } + + // + // The whole struct check sum should be zero + // + Checksum =3D CalculateSum8 ( + (UINT8 *) SmbiosTable, + SmbiosTable->EntryPointLength + ); + if (Checksum !=3D 0) { + return FALSE; + } + return TRUE; +} + +/** + Parse an existing SMBIOS table and insert it using SmbiosAdd. + + @param ImageHandle The EFI_HANDLE to this driver. + @param Smbios The SMBIOS table to parse. + @param Length The length of the SMBIOS table. + + @retval EFI_SUCCESS SMBIOS table was parsed and installed. + @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system= resources. + @retval EFI_INVALID_PARAMETER Smbios is not a correct smbios table + +**/ +STATIC +EFI_STATUS +ParseAndAddExistingSmbiosTable ( + IN EFI_HANDLE ImageHandle, + IN SMBIOS_STRUCTURE_POINTER Smbios, + IN UINTN Length + ) +{ + EFI_STATUS Status; + CHAR8 *String; + EFI_SMBIOS_HANDLE SmbiosHandle; + SMBIOS_STRUCTURE_POINTER SmbiosEnd; + + SmbiosEnd.Raw =3D Smbios.Raw + Length; + + if (Smbios.Raw >=3D SmbiosEnd.Raw || Smbios.Raw =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + do { + // + // Make sure not to access memory beyond SmbiosEnd + // + if (Smbios.Raw + sizeof (SMBIOS_STRUCTURE) > SmbiosEnd.Raw || + Smbios.Raw + sizeof (SMBIOS_STRUCTURE) < Smbios.Raw) { + return EFI_INVALID_PARAMETER; + } + // + // Check for end marker + // + if (Smbios.Hdr->Type =3D=3D SMBIOS_TYPE_END_OF_TABLE) { + break; + } + // + // Make sure not to access memory beyond SmbiosEnd + // Each structure shall be terminated by a double-null (0000h). + // + if (Smbios.Raw + Smbios.Hdr->Length + 2 * sizeof (UINT8) > SmbiosEnd.R= aw || + Smbios.Raw + Smbios.Hdr->Length + 2 * sizeof (UINT8) < Smbios.Raw) { + return EFI_INVALID_PARAMETER; + } + // + // Install the table + // + SmbiosHandle =3D Smbios.Hdr->Handle; + Status =3D SmbiosAdd ( + &mPrivateData.Smbios, + ImageHandle, + &SmbiosHandle, + Smbios.Hdr + ); + + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return Status; + } + // + // Go to the next SMBIOS structure. Each SMBIOS structure may include = 2 parts: + // 1. Formatted section; 2. Unformatted string section. So, 2 steps ar= e needed + // to skip one SMBIOS structure. + // + + // + // Step 1: Skip over formatted section. + // + String =3D (CHAR8 *) (Smbios.Raw + Smbios.Hdr->Length); + + // + // Step 2: Skip over unformatted string section. + // + do { + // + // Each string is terminated with a NULL(00h) BYTE and the sets of s= trings + // is terminated with an additional NULL(00h) BYTE. + // + for ( ; *String !=3D 0; String++) { + if ((UINTN) String >=3D (UINTN) SmbiosEnd.Raw - sizeof (UINT8)) { + return EFI_INVALID_PARAMETER; + } + } + + if (*(UINT8 *) ++String =3D=3D 0) { + // + // Pointer to the next SMBIOS structure. + // + Smbios.Raw =3D (UINT8 *) ++String; + break; + } + } while (TRUE); + } while (Smbios.Raw < SmbiosEnd.Raw); + + return EFI_SUCCESS; +} + + +/** + Retrieve SMBIOS from Hob. + @param ImageHandle Module's image handle + + @retval EFI_SUCCESS Smbios from Hob is installed. + @return EFI_NOT_FOUND Not found Smbios from Hob. + @retval Other No Smbios from Hob is installed. + +**/ +EFI_STATUS +EFIAPI +RetrieveSmbiosFromHob ( + IN EFI_HANDLE ImageHandle + ) +{ + EFI_STATUS Status; + SMBIOS_TABLE_ENTRY_POINT *SmbiosTable; + SMBIOS_TABLE_3_0_ENTRY_POINT *Smbios30Table; + SMBIOS_STRUCTURE_POINTER Smbios; + EFI_HOB_GUID_TYPE *GuidHob; + PLD_SMBIOS_TABLE *SmBiosTableAdress; + PLD_GENERIC_HEADER *GenericHeader; + + Status =3D EFI_NOT_FOUND; + // + // Scan for existing SMBIOS tables from gPldSmbios3TableGuid Guid Hob + // + GuidHob =3D GetFirstGuidHob (&gPldSmbios3TableGuid); + 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_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)) { + Smbios30Table =3D (SMBIOS_TABLE_3_0_ENTRY_POINT *) (UINTN) SmBio= sTableAdress->SmBiosEntryPoint; + if (IsValidSmbios30Table (Smbios30Table)) { + Smbios.Raw =3D (UINT8 *) (UINTN) Smbios30Table->TableAddress; + Status =3D ParseAndAddExistingSmbiosTable (ImageHandle, Smbios= , Smbios30Table->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; + } + } + } + } else { + Status =3D EFI_UNSUPPORTED; + } + } + } + + // + // Scan for existing SMBIOS tables from gPldSmbiosTableGuid Guid Hob, + // if gPldSmbios3TableGuid Hob doesn't exist or parsing gPldSmbios3Table= Guid failed + // + GuidHob =3D GetFirstGuidHob (&gPldSmbiosTableGuid); + =20 + if (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_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)) { + SmbiosTable =3D (SMBIOS_TABLE_ENTRY_POINT *) (UINTN) SmBiosTable= Adress->SmBiosEntryPoint; + if (IsValidSmbios20Table (SmbiosTable)) { + Smbios.Raw =3D (UINT8 *) (UINTN) SmbiosTable->TableAddress; + Status =3D ParseAndAddExistingSmbiosTable (ImageHandle, Smbios= , SmbiosTable->TableLength); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "RetrieveSmbiosFromHob: Failed to parse= preinstalled tables from gPldSmbiosTableGuid Guid Hob\n")); + Status =3D EFI_UNSUPPORTED; + } + return EFI_SUCCESS; + } + } + } else { + Status =3D EFI_UNSUPPORTED; + } + } + } + return Status; +} + /** =20 Driver to produce Smbios protocol and pre-allocate 1 page for the final = SMBIOS table. @@ -1451,5 +1745,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..3286575098 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 + gPldSmbiosTableGuid =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 (#75489): https://edk2.groups.io/g/devel/message/75489 Mute This Topic: https://groups.io/mt/83045509/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 Sun May 19 12:13:34 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+75490+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+75490+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1621840388; cv=none; d=zohomail.com; s=zohoarc; b=KEQboGjyHEqkprfFvMgiAd9pPU5yuqrDbezOEJALBZUt8h7ZblcIpNt0+6bf2RDshZGhrsJ+z9402991eYwEBEG1hCc4hz+mH5nFAugSYn/tXKPYJkjJi96zRJLV1sHGslYBhETCNTp5IwhtyDpyxy6MW/CRvM9xgJic4+dUtd4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621840388; 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=GPdgCgamjmiuCFTFGUNzLRnjTSRwFcWg+l9h62nTUmM=; b=iPLnl4WE2Oz4sEs5PvkJU1Zb5R8hIG+GF29pypj+BmYQxf+CkChYKYBhVVHKCxqnwz8Th0xKkBXz+iy1iRzq1FIR0j5/SIn7Pl2sWhMHQ2/CxsJBJN3H2sMpCfOnnpdMiLSkDkN/4yVYzA11CS53xmdJ5dofB0bMrw26LiKnQYI= 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+75490+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 1621840388047959.9018565391589; Mon, 24 May 2021 00:13:08 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id AcjLYY1788612xxD06HNnWKk; Mon, 24 May 2021 00:13:07 -0700 X-Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web11.19984.1621840379860146758 for ; Mon, 24 May 2021 00:13:07 -0700 IronPort-SDR: RbEMhrnpPBs8fWJzbqV8rWMkfT/2N8jES/fBNr4r2qX4KxrYrT1hyTe4Q6mAGtoTg2eBGb+aWr 7WeuNS7kK8eg== X-IronPort-AV: E=McAfee;i="6200,9189,9993"; a="265769851" X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208,223";a="265769851" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2021 00:13:06 -0700 IronPort-SDR: LyslTecZyUoDHSTizQax/A+x1ik0go2WjUN/mSMfBSCQjMzI2rbq+K5X0O0J0V2LV/BqdulmGF EIX2VrlwxBQg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208,223";a="413477770" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga002.jf.intel.com with ESMTP; 24 May 2021 00:13:05 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You Subject: [edk2-devel] [PATCH 6/9] UefiPayloadPkg: Creat gPldSmbiosTableGuid Hob Date: Mon, 24 May 2021 15:12:31 +0800 Message-Id: <20210524071234.1056-7-zhiguang.liu@intel.com> In-Reply-To: <20210524071234.1056-1-zhiguang.liu@intel.com> References: <20210524071234.1056-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: 8e0NXJ4kMydy1D7FNB92Gz7dx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621840387; bh=EMZb9y0J8LsY33jYVHTrTK/TY46zZnxc38fAtBj2sVM=; h=Cc:Date:From:Reply-To:Subject:To; b=QEVk8G0RaQ5isiA7VUCztDN/1SqifNYHAbofg3bfyB2SluLM7SWh4d11yO1t2efCJHK 8jRBT1SBMy00l/0KA7KNmvEmP951WRwsLDIKkr45EXNO+Wieh9zuCJxHpLfOT5Km1jwna MxP9KmkRdhi1BJtmY/Vk+94UiLyOdYm+fA8= 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 Signed-off-by: Zhiguang Liu Reviewed-by: Guo Dong --- 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 (#75490): https://edk2.groups.io/g/devel/message/75490 Mute This Topic: https://groups.io/mt/83045510/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 Sun May 19 12:13:34 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+75491+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+75491+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1621840392; cv=none; d=zohomail.com; s=zohoarc; b=Ft4uaLWsxjUPNlBRPg/LQ7bvAhMELgxbH2QM9ASgmxq7zuFR8tP6FXo8th4DfbkjGnqqyd2iJroKDQ4F/r+N67cwn72w6qo75hHHKNRyh+ax6UGn7bXvyuTd6gUyUPfJKBoqowItPf1YGOydKlmDCVuEmpyjUOD62eITQ6i6Srk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621840392; 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=r71ewVlOFbKAzLyKHKH0IoRDQYQK3dLF0Cz8TyLqnpM=; b=V6P96ba90517DwdBQhnW6DgW5HJuBoD+SRO20TjsBAc5chFMfGBVOCXzjoL6mhIEKwF6U4JMdEox6Dy+e03PFny1rJrtYRp5XWoFosp+EL1I5CXF+0YnLF+54ysteOEG2MiYDx5O8Aikz9SlXUFwDlYCzuk1pzlYoA4Y76aiWdA= 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+75491+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 1621840392109144.73748411191536; Mon, 24 May 2021 00:13:12 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id pBpXYY1788612xGXLcnC8M9a; Mon, 24 May 2021 00:13:11 -0700 X-Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web11.19984.1621840379860146758 for ; Mon, 24 May 2021 00:13:11 -0700 IronPort-SDR: Rd4f2qFITIs5DTXwutshakyL+kgqo3HtSwlKHw4C6vV7PguoH/9EpvBgb3Dp5rLmNl7apM+8TP ZTUeY8WDHBgA== X-IronPort-AV: E=McAfee;i="6200,9189,9993"; a="265769872" X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="265769872" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2021 00:13:09 -0700 IronPort-SDR: ykujTlyIfAzqGhERCoatURbu99JX/rqw0jR8gkNLTUjASqj3QzeZvl+aqWmlz1bVq/X99mhcos J85QIFFJN1iQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="413477791" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga002.jf.intel.com with ESMTP; 24 May 2021 00:13:08 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao Subject: [edk2-devel] [PATCH 7/9] MdePkg: Add new structure for the Universal Payload ACPI Table Info Hob Date: Mon, 24 May 2021 15:12:32 +0800 Message-Id: <20210524071234.1056-8-zhiguang.liu@intel.com> In-Reply-To: <20210524071234.1056-1-zhiguang.liu@intel.com> References: <20210524071234.1056-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: 95O6AvPvXXElJV4QHPb1hRL2x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621840391; bh=NvHkx8Yn4YvofEcBt2j55kgVVr5m167ptM4+8KUQLaA=; h=Cc:Date:From:Reply-To:Subject:To; b=V8CpW9KqEN/H/L00tnfiNklhVZWe4kU1otGPgIgNTa6WFfRAdr/vehooeYSzTkTJUvt BywJg/rTcGvL7WwboNl6cbnr7RS8bWLNinw49Zwc/eA3r99KfbmdnuNAnSmQlcHJjGXu1 cKKwgqVLpRMcCgEohlWkkAV8JDrd1yXgqcQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Cc: Michael D Kinney Cc: Liming Gao Signed-off-by: Zhiguang Liu --- MdePkg/Include/UniversalPayload/AcpiTable.h | 28 +++++++++++++++++++++++++= +++ MdePkg/MdePkg.dec | 3 +++ 2 files changed, 31 insertions(+) diff --git a/MdePkg/Include/UniversalPayload/AcpiTable.h b/MdePkg/Include/U= niversalPayload/AcpiTable.h new file mode 100644 index 0000000000..a85c555d9c --- /dev/null +++ b/MdePkg/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/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 7a62829059..42a7fa2155 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -830,6 +830,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 } } + [Guids.IA32, Guids.X64] ## Include/Guid/Cper.h gEfiIa32X64ErrorTypeCacheCheckGuid =3D { 0xA55701F5, 0xE3EF, 0x43de, { 0= xAC, 0x72, 0x24, 0x9B, 0x57, 0x3F, 0xAD, 0x2C }} --=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 (#75491): https://edk2.groups.io/g/devel/message/75491 Mute This Topic: https://groups.io/mt/83045511/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 Sun May 19 12:13:34 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+75492+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+75492+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1621840399; cv=none; d=zohomail.com; s=zohoarc; b=Rqi4Kwv7UWQ+aqrwaUjMhTMSco67tTmCYqfY3DgB7cx0Jmv/kZudDVuc0uj8LDv7oYSFyMvWxjhEyOKceONDYkxxAZnYJTKuZQlybsr1kpSeP7nlZ03gaY4Z8rCAT4949QE0TPdx5fJ8aAzsDCaWzRQB/Sy8m/PNTpJyeUquBbs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621840399; 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=4++PHGiytLl9rDJUV88XjiiTorxk6FDBGHb0YTcYwhc=; b=GgcsfCrZnwOaxexGZADykaqmBhMG0A5SuBrNgXfnkJHbrWl0oToQ79tULc5xkYB9hIx8g8337SBjwRdiK+nKk+jRQROAzZ1r9YDoG1Qc/QOSLRb9fPxF4CVL8tKPZv6dEuAuh+vbgQm+KdmSw65tPBT3hDFUwdn+DOF0oJrycF8= 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+75492+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 1621840399112360.5379012738247; Mon, 24 May 2021 00:13:19 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id CH6jYY1788612xuR5LcEehxw; Mon, 24 May 2021 00:13:18 -0700 X-Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web09.19750.1621840398051670996 for ; Mon, 24 May 2021 00:13:18 -0700 IronPort-SDR: gHLDxnb/7y30NKxJ1+SV8J/skQG7lmV9u6KcYAj8i2e2UcOvRXlQoG19eRH8L8Ulyq2Q5nzNcG cWMp8ve84Y5w== X-IronPort-AV: E=McAfee;i="6200,9189,9993"; a="265769897" X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="265769897" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2021 00:13:13 -0700 IronPort-SDR: smsCtyetZZ7APJXZ6r4U395ITeWFNmtrog1jZYrJ/FpXcIWXQ+Th7ZvLeVAHLJMuVHZkUweeHt 6UwWsmBphJZg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208";a="413477827" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga002.jf.intel.com with ESMTP; 24 May 2021 00:13:10 -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 8/9] MdeModulePkg/ACPI: Install ACPI table from HOB. Date: Mon, 24 May 2021 15:12:33 +0800 Message-Id: <20210524071234.1056-9-zhiguang.liu@intel.com> In-Reply-To: <20210524071234.1056-1-zhiguang.liu@intel.com> References: <20210524071234.1056-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: aN5Rkh6ElEX9MslF73dvaR3fx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621840398; bh=jpuKWLtNgoOWHPs8ZFbi7UcxFNzNBCdUrxki6pNqnMs=; h=Cc:Date:From:Reply-To:Subject:To; b=p6FfHc/zaWNhK1S5UX8ZGBVt815NUEho+ZxrYIpEPYQ2iKT3lG92/uZ2W0lgirXkUP1 YR7SqHBk7/brRlv3x8BxseXCM/SSKiGVMv6j1Phpi9h1xISENHc6qNtqctqOhUXKPeSD3 WuEskXeAany9wkAHlv5TIrfrTCjA8DOH640= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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. Cc: Jian J Wang Cc: Hao A Wu Cc: Dandan Bi Cc: Liming Gao Cc: Ray Ni Signed-off-by: Zhiguang Liu --- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h | 4 +++- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf | 4 +++- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 144 +++++++= +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 142 insertions(+), 10 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h b/MdeModu= lePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h index 9d7cf7ccfc..7fd393aab3 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.h @@ -1,7 +1,7 @@ /** @file ACPI Table Protocol Driver =20 - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -24,6 +24,8 @@ #include #include #include +#include +#include =20 // // Statements that include other files diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf b/Md= eModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf index d341df439e..df80c4db35 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 + gPldAcpiTableGuid =20 [FeaturePcd] gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol ## CONSUMES diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b= /MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c index 5a2afdff27..24962843a1 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 ) { @@ -552,13 +557,16 @@ AddTableToList ( // could be updated by OS present agent. For example, BufferPtrAddress= in // 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; + } 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 +1697,124 @@ 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; + PLD_GENERIC_HEADER *GenericHeader; + + TableKey =3D 0; + Version =3D PcdGet32 (PcdAcpiExposedTableVersions); + + // + // 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 (GenericHeader->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); + } + 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); + + 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); + } + 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); + } + } + + 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); + } + } + } + } + } + Status =3D PublishTables (AcpiTableInstance, Version); + ASSERT_EFI_ERROR (Status); + return Status; +} =20 /** Constructor for the ACPI table protocol. Initializes instance @@ -1918,6 +2044,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 (#75492): https://edk2.groups.io/g/devel/message/75492 Mute This Topic: https://groups.io/mt/83045526/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 Sun May 19 12:13:34 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+75493+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+75493+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1621840404; cv=none; d=zohomail.com; s=zohoarc; b=DuwC9IbmC/+FmJFpBDiqBWMHlwfcujLwwza8Ehn4XEP2y31AfUeSk+J4+v2MDbHycy46ddihSd2BhDd52CadNsgQ8GpVwjOlAVRUzBh4Xi1MaeWeuF9KUe79eeQ+1wRCKn87xtlBb2/pqSLbQnqZKqvVqwV4lizTu4KRZLrCFNU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621840404; 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=iER2i5R0DFLOZ61Fov1ValuWa2oSwBqlTa9CEqBRtH4=; b=V1zrZ2KS9JFRLfxfzFsG0Wq7GsvHAJdlLMSSBKWSYjJncrPfBGGdUfoUhknCK9JArMMZ8Yz7HaNib4vcn1njSGjXrbVB7kQE7yyMHeQokOy/wMPRT6pw5s4djGGvPPi+nDl4hvc5IuROflGUO9JWgrrrf7JiLW46GzWMC0cwflo= 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+75493+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 1621840404660740.4583217588205; Mon, 24 May 2021 00:13:24 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id QRaOYY1788612xlVu6VszlZi; Mon, 24 May 2021 00:13:24 -0700 X-Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web09.19750.1621840398051670996 for ; Mon, 24 May 2021 00:13:18 -0700 IronPort-SDR: iFdCCw6oeMYfgVK9geKlwHk2ReWbD4iHERJ16Yc59YJWdEwO6voHjVNgMAYZdks/2XE6ZcytiO K9xS6TqU/ZaQ== X-IronPort-AV: E=McAfee;i="6200,9189,9993"; a="265769902" X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208,223";a="265769902" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2021 00:13:16 -0700 IronPort-SDR: 1yT+kpdhHNvibgnHYcrMMVxPwpiUsFLgq8tt0Ev7NOvdsiXEM4sNE8/p/QjFln4RbHopn9trpC 1BndJFfWbo0w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,319,1613462400"; d="scan'208,223";a="413477842" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.144]) by orsmga002.jf.intel.com with ESMTP; 24 May 2021 00:13:14 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Maurice Ma , Guo Dong , Benjamin You , Ray Ni Subject: [edk2-devel] [PATCH 9/9] UefiPayloadPkg: Creat gPldAcpiTableGuid Hob Date: Mon, 24 May 2021 15:12:34 +0800 Message-Id: <20210524071234.1056-10-zhiguang.liu@intel.com> In-Reply-To: <20210524071234.1056-1-zhiguang.liu@intel.com> References: <20210524071234.1056-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: uTkxzD4OCxudreWkgQ2HbPDmx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621840404; bh=wPLiiwsZ5NYq4EW5fOZonGmQ0Yl+W+fJJ/02x8HNgwI=; h=Cc:Date:From:Reply-To:Subject:To; b=alZ9ZwJgeVwfsczTfQYPaxKT2Zk+W7zouzYXWqAM6naNHnGD8HYIsS4pnr5J/P148ck VRl112ZNPOKbZSytvLL/V7dc8nn+HZPwZ+h1fqSV5FFgKe+ET9i6grEc+FrgSz3StXqvA 3KacI1yNZIw326y33Iwu2Kjo2YsUGIFfNrE= 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 + 6 files changed, 14 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 --=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 (#75493): https://edk2.groups.io/g/devel/message/75493 Mute This Topic: https://groups.io/mt/83045527/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-