TianoCore EDK2 master
Loading...
Searching...
No Matches
FdtHwInfoParser.c
Go to the documentation of this file.
1
8#include "FdtHwInfoParser.h"
9
30EFIAPI
32 IN VOID *HwDataSource,
33 IN VOID *Context,
35 OUT HW_INFO_PARSER_HANDLE *ParserHandle
36 )
37{
38 FDT_HW_INFO_PARSER *FdtParserHandle;
39
40 if ((ParserHandle == NULL) ||
41 (HwInfoAdd == NULL) ||
42 (HwDataSource == NULL) ||
43 (fdt_check_header (HwDataSource) < 0))
44 {
45 ASSERT (0);
46 return EFI_INVALID_PARAMETER;
47 }
48
49 FdtParserHandle = AllocateZeroPool (sizeof (FDT_HW_INFO_PARSER));
50 if (FdtParserHandle == NULL) {
51 *ParserHandle = NULL;
52 return EFI_OUT_OF_RESOURCES;
53 }
54
55 // The HwDataSource is a pointer to the FDT data.
56 FdtParserHandle->Fdt = HwDataSource;
57 FdtParserHandle->Context = Context;
58 FdtParserHandle->HwInfoAdd = HwInfoAdd;
59
60 *ParserHandle = (HW_INFO_PARSER_HANDLE)FdtParserHandle;
61 return EFI_SUCCESS;
62}
63
73EFIAPI
75 IN HW_INFO_PARSER_HANDLE ParserHandle
76 )
77{
78 EFI_STATUS Status;
79
80 if (ParserHandle == NULL) {
81 ASSERT (0);
82 return EFI_INVALID_PARAMETER;
83 }
84
85 // Call all the parsers from the root node (-1).
87 (FDT_HW_INFO_PARSER_HANDLE)ParserHandle,
88 -1
89 );
90 ASSERT_EFI_ERROR (Status);
91 return Status;
92}
93
103EFIAPI
105 IN HW_INFO_PARSER_HANDLE ParserHandle
106 )
107{
108 if (ParserHandle == NULL) {
109 ASSERT (0);
110 return EFI_INVALID_PARAMETER;
111 }
112
113 FreePool (ParserHandle);
114
115 return EFI_SUCCESS;
116}
EFI_STATUS EFIAPI ArchFdtHwInfoMainDispatcher(IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle, IN INT32 FdtBranch)
STATIC EFI_STATUS EFIAPI HwInfoAdd(IN HW_INFO_PARSER_HANDLE ParserHandle, IN VOID *Context, IN CONST CM_OBJ_DESCRIPTOR *CmObjDesc, OUT CM_OBJECT_TOKEN *Token OPTIONAL)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STATUS EFIAPI HwInfoParse(IN HW_INFO_PARSER_HANDLE ParserHandle)
EFI_STATUS EFIAPI HwInfoParserShutdown(IN HW_INFO_PARSER_HANDLE ParserHandle)
EFI_STATUS EFIAPI HwInfoParserInit(IN VOID *HwDataSource, IN VOID *Context, IN HW_INFO_ADD_OBJECT HwInfoAdd, OUT HW_INFO_PARSER_HANDLE *ParserHandle)
VOID * HW_INFO_PARSER_HANDLE
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)
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
VOID * Context
Pointer to the caller's context.
HW_INFO_ADD_OBJECT HwInfoAdd