1 | /** @file
|
---|
2 | Flattened Device Tree parser definitions.
|
---|
3 |
|
---|
4 | Copyright (c) 2021, ARM Limited. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 | **/
|
---|
7 |
|
---|
8 | #ifndef FDT_HW_INFO_PARSER_H_
|
---|
9 | #define FDT_HW_INFO_PARSER_H_
|
---|
10 |
|
---|
11 | #include <FdtHwInfoParserInclude.h>
|
---|
12 |
|
---|
13 | #include <ConfigurationManagerObject.h>
|
---|
14 | #include <Library/HwInfoParserLib.h>
|
---|
15 |
|
---|
16 | #include "FdtUtility.h"
|
---|
17 |
|
---|
18 | /** A structure describing the instance of the FdtHwInfoParser.
|
---|
19 | */
|
---|
20 | typedef struct FdtHwInfoParser {
|
---|
21 | /// Pointer to the HwDataSource i.e. the
|
---|
22 | /// Flattened Device Tree (Fdt).
|
---|
23 | VOID *Fdt;
|
---|
24 |
|
---|
25 | /// Pointer to the caller's context.
|
---|
26 | VOID *Context;
|
---|
27 |
|
---|
28 | /// Function pointer called by the
|
---|
29 | /// parser when adding information.
|
---|
30 | HW_INFO_ADD_OBJECT HwInfoAdd;
|
---|
31 | } FDT_HW_INFO_PARSER;
|
---|
32 |
|
---|
33 | /** A pointer type for FDT_HW_INFO_PARSER.
|
---|
34 | */
|
---|
35 | typedef FDT_HW_INFO_PARSER *FDT_HW_INFO_PARSER_HANDLE;
|
---|
36 |
|
---|
37 | /** Function pointer to a parser function.
|
---|
38 |
|
---|
39 | A parser parses a Device Tree to populate a specific CmObj type. None,
|
---|
40 | one or many CmObj can be created by the parser.
|
---|
41 | The created CmObj are then handed to the parser's caller through the
|
---|
42 | HW_INFO_ADD_OBJECT interface.
|
---|
43 | This can also be a dispatcher. I.e. a function that not parsing a
|
---|
44 | Device Tree but calling other parsers.
|
---|
45 |
|
---|
46 | @param [in] ParserHandle Handle to the parser instance.
|
---|
47 | @param [in] FdtBranch When searching for DT node name, restrict
|
---|
48 | the search to this Device Tree branch.
|
---|
49 |
|
---|
50 | @retval EFI_SUCCESS The function completed successfully.
|
---|
51 | @retval EFI_ABORTED An error occurred.
|
---|
52 | @retval EFI_INVALID_PARAMETER Invalid parameter.
|
---|
53 | @retval EFI_NOT_FOUND Not found.
|
---|
54 | @retval EFI_UNSUPPORTED Unsupported.
|
---|
55 | **/
|
---|
56 | typedef
|
---|
57 | EFI_STATUS
|
---|
58 | (EFIAPI *FDT_HW_INFO_PARSER_FUNC)(
|
---|
59 | IN CONST FDT_HW_INFO_PARSER_HANDLE ParserHandle,
|
---|
60 | IN INT32 FdtBranch
|
---|
61 | );
|
---|
62 |
|
---|
63 | /** Main dispatcher: sequentially call the parsers/dispatchers
|
---|
64 | of the HwInfoParserTable.
|
---|
65 |
|
---|
66 | A parser parses a Device Tree to populate a specific CmObj type. None,
|
---|
67 | one or many CmObj can be created by the parser.
|
---|
68 | The created CmObj are then handed to the parser's caller through the
|
---|
69 | HW_INFO_ADD_OBJECT interface.
|
---|
70 | This can also be a dispatcher. I.e. a function that not parsing a
|
---|
71 | Device Tree but calling other parsers.
|
---|
72 |
|
---|
73 | @param [in] FdtParserHandle A handle to the parser instance.
|
---|
74 | @param [in] FdtBranch When searching for DT node name, restrict
|
---|
75 | the search to this Device Tree branch.
|
---|
76 |
|
---|
77 | @retval EFI_SUCCESS The function completed successfully.
|
---|
78 | @retval EFI_ABORTED An error occurred.
|
---|
79 | @retval EFI_INVALID_PARAMETER Invalid parameter.
|
---|
80 | @retval EFI_NOT_FOUND Not found.
|
---|
81 | @retval EFI_UNSUPPORTED Unsupported.
|
---|
82 | **/
|
---|
83 | EFI_STATUS
|
---|
84 | EFIAPI
|
---|
85 | ArchFdtHwInfoMainDispatcher (
|
---|
86 | IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle,
|
---|
87 | IN INT32 FdtBranch
|
---|
88 | );
|
---|
89 |
|
---|
90 | #endif // FDT_HW_INFO_PARSER_H_
|
---|