public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "PierreGondois" <pierre.gondois@arm.com>
To: devel@edk2.groups.io, Sami Mujawar <sami.mujawar@arm.com>,
	Alexei Fedorov <Alexei.Fedorov@arm.com>
Cc: Akanksha Jain <akanksha.jain2@arm.com>,
	Alexandru Elisei <alexandru.elisei@arm.com>
Subject: [PATCH v1 01/14] DynamicTablesPkg: Definition for HwInfoParser interface
Date: Wed, 23 Jun 2021 13:38:15 +0100	[thread overview]
Message-ID: <20210623123828.23693-2-Pierre.Gondois@arm.com> (raw)
In-Reply-To: <20210623123828.23693-1-Pierre.Gondois@arm.com>

From: Pierre Gondois <Pierre.Gondois@arm.com>

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 <Pierre.Gondois@arm.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 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/DynamicTablesPkg.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
 
+  ##  @libraryclass  Defines a set of APIs to a hardware information parser.
+  HwInfoParserLib|Include/Library/HwInfoParserLib.h
+
   ##  @libraryclass  Defines a set of methods for fixing up a SSDT Serial Port.
   SsdtSerialPortFixupLib|Include/Library/SsdtSerialPortFixupLib.h
 
diff --git a/DynamicTablesPkg/Include/Library/HwInfoParserLib.h b/DynamicTablesPkg/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.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef HW_INFO_PARSER_LIB_H_
+#define HW_INFO_PARSER_LIB_H_
+
+#include <ConfigurationManagerObject.h>
+
+/** 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 HwDataSource
+  to initialise the internal state of the parser or to index the data. This
+  internal state shall be linked to the ParserHandle using an implementation
+  defined mechanism.
+
+  @param [in]   HwDataSource    Pointer to the blob containing the hardware
+                                information. It can be a pointer to a Device
+                                Tree, an XML file, etc. or any other data
+                                structure defined by the HwInfoParser.
+  @param [in]   Context         A pointer to the caller's context.
+  @param [in]   HwInfoAdd       Function pointer called by the parser when
+                                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_
-- 
2.17.1


  reply	other threads:[~2021-06-23 12:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23 12:38 [PATCH v1 00/14] Implement a FdtHwInfoParserLib PierreGondois
2021-06-23 12:38 ` PierreGondois [this message]
2021-06-23 12:38 ` [PATCH v1 02/14] DynamicTablesPkg: FdtHwInfoParser: CM Object descriptor helper PierreGondois
2021-11-05 14:27   ` Sami Mujawar
2021-06-23 12:38 ` [PATCH v1 03/14] DynamicTablesPkg: FdtHwInfoParser: Add FDT utility functions PierreGondois
2021-11-05 14:27   ` Sami Mujawar
2021-06-23 12:38 ` [PATCH v1 04/14] DynamicTablesPkg: FdtHwInfoParser: Add Boot Arch parser PierreGondois
2021-06-23 12:38 ` [PATCH v1 05/14] DynamicTablesPkg: FdtHwInfoParser: Generic Timer Parser PierreGondois
2021-06-23 12:38 ` [PATCH v1 06/14] DynamicTablesPkg: FdtHwInfoParser: Add Serial port parser PierreGondois
2021-11-05 14:27   ` Sami Mujawar
2021-11-18 10:11     ` PierreGondois
2021-06-23 12:38 ` [PATCH v1 07/14] DynamicTablesPkg: FdtHwInfoParser: Add GICC parser PierreGondois
2021-11-05 14:28   ` Sami Mujawar
2021-06-23 12:38 ` [PATCH v1 08/14] DynamicTablesPkg: FdtHwInfoParser: Add GICD parser PierreGondois
2021-06-23 12:38 ` [PATCH v1 09/14] DynamicTablesPkg: FdtHwInfoParser: Add MSI Frame parser PierreGondois
2021-06-23 12:38 ` [PATCH v1 10/14] DynamicTablesPkg: FdtHwInfoParser: Add ITS parser PierreGondois
2021-06-23 12:38 ` [PATCH v1 11/14] DynamicTablesPkg: FdtHwInfoParser: Add GICR parser PierreGondois
2021-06-23 12:38 ` [PATCH v1 12/14] DynamicTablesPkg: FdtHwInfoParser: Add GIC dispatcher PierreGondois
2021-06-23 12:38 ` [PATCH v1 13/14] DynamicTablesPkg: FdtHwInfoParser: Add PCI config parser PierreGondois
2021-06-23 12:38 ` [PATCH v1 14/14] DynamicTablesPkg: Add FdtHwInfoParser library PierreGondois

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210623123828.23693-2-Pierre.Gondois@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox