From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.14273.1637687356359252930 for ; Tue, 23 Nov 2021 09:09:16 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: pierre.gondois@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 097D11063; Tue, 23 Nov 2021 09:09:16 -0800 (PST) Received: from e126645.nice.arm.com (unknown [10.34.129.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 18C7A3F5A1; Tue, 23 Nov 2021 09:09:14 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Alexei Fedorov Subject: [PATCH v3 01/15] DynamicTablesPkg: Definition for HwInfoParser interface Date: Tue, 23 Nov 2021 18:08:24 +0100 Message-Id: <20211123170838.143805-2-Pierre.Gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211123170838.143805-1-Pierre.Gondois@arm.com> References: <20211123170838.143805-1-Pierre.Gondois@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Pierre Gondois Hardware information parser is an optional module defined by the Dynamic Tables Framework. It can either parse an XML, a Device Tree or a Json file containing the platform hardware information to populate the platform information repository. The Configuration Manager can then utilise this information to generate ACPI tables for the platform. Therefore, define an interface for the HwInfoParser library class. Signed-off-by: Pierre Gondois Co-authored-by: Sami Mujawar --- DynamicTablesPkg/DynamicTablesPkg.dec | 3 + .../Include/Library/HwInfoParserLib.h | 99 +++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 DynamicTablesPkg/Include/Library/HwInfoParserLib.h diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec b/DynamicTablesPkg/Dyn= amicTablesPkg.dec index 9996bdf6f520..80a61dd2dbac 100644 --- a/DynamicTablesPkg/DynamicTablesPkg.dec +++ b/DynamicTablesPkg/DynamicTablesPkg.dec @@ -24,6 +24,9 @@ [LibraryClasses] ## @libraryclass Defines a set of APIs for Dynamic AML generation. AmlLib|Include/Library/AmlLib/AmlLib.h =20 + ## @libraryclass Defines a set of APIs to a hardware information par= ser. + HwInfoParserLib|Include/Library/HwInfoParserLib.h + ## @libraryclass Defines a set of methods for fixing up a SSDT Seria= l Port. SsdtSerialPortFixupLib|Include/Library/SsdtSerialPortFixupLib.h =20 diff --git a/DynamicTablesPkg/Include/Library/HwInfoParserLib.h b/Dynamic= TablesPkg/Include/Library/HwInfoParserLib.h new file mode 100644 index 000000000000..472fbefcc6b5 --- /dev/null +++ b/DynamicTablesPkg/Include/Library/HwInfoParserLib.h @@ -0,0 +1,99 @@ +/** @file + Hardware information parser library. + + Copyright (c) 2021, ARM Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef HW_INFO_PARSER_LIB_H_ +#define HW_INFO_PARSER_LIB_H_ + +#include + +/** A handle to the HwInfoParser instance. +*/ +typedef VOID * HW_INFO_PARSER_HANDLE; + +/** Function pointer called by the parser to add information. + + Callback function that the parser can use to add new + CmObj. This function must copy the CmObj data and not rely on + the parser preserving the CmObj memory. + This function is responsible of the Token allocation. + + @param [in] ParserHandle A handle to the parser instance. + @param [in] Context A pointer to the caller's context provided= in + HwInfoParserInit (). + @param [in] CmObjDesc CM_OBJ_DESCRIPTOR containing the CmObj(s) = to add. + @param [out] Token If provided and success, contain the token + generated for the CmObj. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. +**/ +typedef +EFI_STATUS +(EFIAPI * HW_INFO_ADD_OBJECT) ( + IN HW_INFO_PARSER_HANDLE ParserHandle, + IN VOID * Context, + IN CONST CM_OBJ_DESCRIPTOR * CmObjDesc, + OUT CM_OBJECT_TOKEN * Token OPTIONAL + ); + +/** Initialise the HwInfoParser. + + The HwInfoParser shall use the information provided by the HwDataSourc= e + to initialise the internal state of the parser or to index the data. T= his + internal state shall be linked to the ParserHandle using an implementa= tion + defined mechanism. + + @param [in] HwDataSource Pointer to the blob containing the hardw= are + information. It can be a pointer to a De= vice + Tree, an XML file, etc. or any other dat= a + structure defined by the HwInfoParser. + @param [in] Context A pointer to the caller's context. + @param [in] HwInfoAdd Function pointer called by the parser wh= en + adding information. + @param [out] ParserHandle A handle to the parser instance. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. +**/ +EFI_STATUS +EFIAPI +HwInfoParserInit ( + IN VOID * HwDataSource, + IN VOID * Context, + IN HW_INFO_ADD_OBJECT HwInfoAdd, + OUT HW_INFO_PARSER_HANDLE * ParserHandle + ); + +/** Parse the data provided by the HwDataSource. + + @param [in] ParserHandle A handle to the parser instance. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES An allocation has failed. +**/ +EFI_STATUS +EFIAPI +HwInfoParse ( + IN HW_INFO_PARSER_HANDLE ParserHandle + ); + +/** Cleanup any internal state and resources that were allocated + by the the HwInfoParser. + + @param [in] ParserHandle A handle to the parser instance. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. +**/ +EFI_STATUS +EFIAPI +HwInfoParserShutdown ( + IN HW_INFO_PARSER_HANDLE ParserHandle + ); + +#endif // HW_INFO_PARSER_LIB_H_ --=20 2.25.1