summaryrefslogtreecommitdiffstats
path: root/MdePkg/Test/Mock/Include/GoogleTest/Library/MockFdtLib.h
blob: 9e9ddc21ddc26d627bd1b2b77cbfed1d41083c6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/** @file
  Google Test mocks for FdtLib

  Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
  Copyright (c) 2023, Intel Corporation. All rights reserved.
  SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef MOCK_FDT_LIB_H_
#define MOCK_FDT_LIB_H_

#include <Library/GoogleTestLib.h>
#include <Library/FunctionMockLib.h>
extern "C" {
  #include <Base.h>
  #include <Library/FdtLib.h>
}

struct MockFdtLib {
  MOCK_INTERFACE_DECLARATION (MockFdtLib);

  MOCK_FUNCTION_DECLARATION (
    UINT16,
    Fdt16ToCpu,
    (IN UINT16 Value)
    );
  MOCK_FUNCTION_DECLARATION (
    UINT16,
    CpuToFdt16,
    (IN UINT16 Value)
    );
  MOCK_FUNCTION_DECLARATION (
    UINT32,
    Fdt32ToCpu,
    (IN UINT32 Value)
    );
  MOCK_FUNCTION_DECLARATION (
    UINT32,
    CpuToFdt32,
    (IN UINT32 Value)
    );
  MOCK_FUNCTION_DECLARATION (
    UINT64,
    Fdt64ToCpu,
    (IN UINT64 Value)
    );
  MOCK_FUNCTION_DECLARATION (
    UINT64,
    CpuToFdt64,
    (IN UINT64 Value)
    );
  MOCK_FUNCTION_DECLARATION (
    INT32,
    FdtCheckHeader,
    (IN CONST VOID  *Fdt)
    );
  MOCK_FUNCTION_DECLARATION (
    INT32,
    FdtCreateEmptyTree,
    (IN VOID    *Buffer,
     IN UINT32  BufferSize)
    );
  MOCK_FUNCTION_DECLARATION (
    INT32,
    FdtNextNode,
    (IN CONST VOID  *Fdt,
     IN INT32       Offset,
     IN INT32       *Depth)
    );
  MOCK_FUNCTION_DECLARATION (
    INT32,
    FdtFirstSubnode,
    (IN CONST VOID  *Fdt,
     IN INT32       Offset)
    );
  MOCK_FUNCTION_DECLARATION (
    INT32,
    FdtNextSubnode,
    (IN CONST VOID  *Fdt,
     IN INT32       Offset)
    );
  MOCK_FUNCTION_DECLARATION (
    INT32,
    FdtSubnodeOffsetNameLen,
    (IN CONST VOID   *Fdt,
     IN INT32        ParentOffset,
     IN CONST CHAR8  *Name,
     IN INT32        NameLength)
    );
  MOCK_FUNCTION_DECLARATION (
    INT32,
    FdtNodeOffsetByPropertyValue,
    (IN CONST VOID   *Fdt,
     IN INT32        StartOffset,
     IN CONST CHAR8  *PropertyName,
     IN CONST VOID   *PropertyValue,
     IN INT32        PropertyLength)
    );
  MOCK_FUNCTION_DECLARATION (
    CONST FDT_PROPERTY *,
    FdtGetProperty,
    (IN CONST VOID   *Fdt,
     IN INT32        NodeOffset,
     IN CONST CHAR8  *Name,
     IN INT32        *Length)
    );
  MOCK_FUNCTION_DECLARATION (
    INT32,
    FdtFirstPropertyOffset,
    (IN CONST VOID  *Fdt,
     IN INT32       NodeOffset)
    );
  MOCK_FUNCTION_DECLARATION (
    INT32,
    FdtNextPropertyOffset,
    (IN CONST VOID  *Fdt,
     IN INT32       NodeOffset)
    );
  MOCK_FUNCTION_DECLARATION (
    CONST FDT_PROPERTY *,
    FdtGetPropertyByOffset,
    (IN CONST VOID  *Fdt,
     IN INT32       Offset,
     IN INT32       *Length)
    );
  MOCK_FUNCTION_DECLARATION (
    CONST CHAR8 *,
    FdtGetString,
    (IN CONST VOID  *Fdt,
     IN INT32       StrOffset,
     IN INT32       *Length        OPTIONAL)
    );
  MOCK_FUNCTION_DECLARATION (
    INT32,
    FdtAddSubnode,
    (IN VOID         *Fdt,
     IN INT32        ParentOffset,
     IN CONST CHAR8  *Name)
    );
  MOCK_FUNCTION_DECLARATION (
    INT32,
    FdtSetProperty,
    (IN VOID         *Fdt,
     IN INT32        NodeOffset,
     IN CONST CHAR8  *Name,
     IN CONST VOID   *Value,
     IN UINT32       Length)
    );
  MOCK_FUNCTION_DECLARATION (
    CONST CHAR8 *,
    FdtGetName,
    (IN VOID    *Fdt,
     IN INT32   NodeOffset,
     IN INT32   *Length)
    );
  MOCK_FUNCTION_DECLARATION (
    INT32,
    FdtNodeDepth,
    (IN CONST VOID  *Fdt,
     IN INT32       NodeOffset)
    );
};

#endif