]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/RegisterFilterLib.h
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Include / Library / RegisterFilterLib.h
1 /** @file
2 Public include file for the Port IO/MMIO/MSR RegisterFilterLib.
3
4 Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef REGISTER_FILTER_LIB_H_
11 #define REGISTER_FILTER_LIB_H_
12
13 typedef enum {
14 FilterWidth8,
15 FilterWidth16,
16 FilterWidth32,
17 FilterWidth64
18 } FILTER_IO_WIDTH;
19
20 /**
21 Filter IO read operation before read IO port.
22 It is used to filter IO read operation.
23
24 It will return the flag to decide whether require read real IO port.
25 It can be used for emulation environment.
26
27 @param[in] Width Signifies the width of the I/O operation.
28 @param[in] Address The base address of the I/O operation.
29 @param[in] Buffer The destination buffer to store the results.
30
31 @retval TRUE Need to excute the IO read.
32 @retval FALSE Skip the IO read.
33
34 **/
35 BOOLEAN
36 EFIAPI
37 FilterBeforeIoRead (
38 IN FILTER_IO_WIDTH Width,
39 IN UINTN Address,
40 IN OUT VOID *Buffer
41 );
42
43 /**
44 Trace IO read operation after read IO port.
45 It is used to trace IO operation.
46
47 @param[in] Width Signifies the width of the I/O operation.
48 @param[in] Address The base address of the I/O operation.
49 @param[in] Buffer The destination buffer to store the results.
50
51 **/
52 VOID
53 EFIAPI
54 FilterAfterIoRead (
55 IN FILTER_IO_WIDTH Width,
56 IN UINTN Address,
57 IN VOID *Buffer
58 );
59 /**
60 Filter IO Write operation before wirte IO port.
61 It is used to filter IO operation.
62
63 It will return the flag to decide whether require read write IO port.
64 It can be used for emulation environment.
65
66 @param[in] Width Signifies the width of the I/O operation.
67 @param[in] Address The base address of the I/O operation.
68 @param[in] Buffer The source buffer from which to BeforeWrite data.
69
70 @retval TRUE Need to excute the IO write.
71 @retval FALSE Skip the IO write.
72
73 **/
74 BOOLEAN
75 EFIAPI
76 FilterBeforeIoWrite (
77 IN FILTER_IO_WIDTH Width,
78 IN UINTN Address,
79 IN VOID *Buffer
80 );
81
82 /**
83 Trace IO Write operation after wirte IO port.
84 It is used to trace IO operation.
85
86 @param[in] Width Signifies the width of the I/O operation.
87 @param[in] Address The base address of the I/O operation.
88 @param[in] Buffer The source buffer from which to BeforeWrite data.
89
90 **/
91 VOID
92 EFIAPI
93 FilterAfterIoWrite (
94 IN FILTER_IO_WIDTH Width,
95 IN UINTN Address,
96 IN VOID *Buffer
97 );
98
99 /**
100 Filter memory IO before Read operation.
101
102 It will return the flag to decide whether require read real MMIO.
103 It can be used for emulation environment.
104
105 @param[in] Width Signifies the width of the memory I/O operation.
106 @param[in] Address The base address of the memory I/O operation.
107 @param[in] Buffer The destination buffer to store the results.
108
109 @retval TRUE Need to excute the MMIO read.
110 @retval FALSE Skip the MMIO read.
111
112 **/
113 BOOLEAN
114 EFIAPI
115 FilterBeforeMmIoRead (
116 IN FILTER_IO_WIDTH Width,
117 IN UINTN Address,
118 IN OUT VOID *Buffer
119 );
120
121 /**
122 Tracer memory IO after read operation
123
124 @param[in] Width Signifies the width of the memory I/O operation.
125 @param[in] Address The base address of the memory I/O operation.
126 @param[in] Buffer The destination buffer to store the results.
127
128 **/
129 VOID
130 EFIAPI
131 FilterAfterMmIoRead (
132 IN FILTER_IO_WIDTH Width,
133 IN UINTN Address,
134 IN VOID *Buffer
135 );
136
137 /**
138 Filter memory IO before write operation
139
140 It will return the flag to decide whether require wirte real MMIO.
141 It can be used for emulation environment.
142
143 @param[in] Width Signifies the width of the memory I/O operation.
144 @param[in] Address The base address of the memory I/O operation.
145 @param[in] Buffer The source buffer from which to BeforeWrite data.
146
147 @retval TRUE Need to excute the MMIO write.
148 @retval FALSE Skip the MMIO write.
149
150 **/
151 BOOLEAN
152 EFIAPI
153 FilterBeforeMmIoWrite (
154 IN FILTER_IO_WIDTH Width,
155 IN UINTN Address,
156 IN VOID *Buffer
157 );
158
159 /**
160 Tracer memory IO after write operation
161
162 @param[in] Width Signifies the width of the memory I/O operation.
163 @param[in] Address The base address of the memory I/O operation.
164 @param[in] Buffer The source buffer from which to BeforeWrite data.
165
166 **/
167 VOID
168 EFIAPI
169 FilterAfterMmIoWrite (
170 IN FILTER_IO_WIDTH Width,
171 IN UINTN Address,
172 IN VOID *Buffer
173 );
174
175 /**
176 Filter MSR before read operation.
177
178 It will return the flag to decide whether require read real MSR.
179 It can be used for emulation environment.
180
181 @param Index The 8-bit Machine Specific Register index to BeforeWrite.
182 @param Value The 64-bit value to BeforeRead from the Machine Specific Register.
183
184 @retval TRUE Need to excute the MSR read.
185 @retval FALSE Skip the MSR read.
186
187 **/
188 BOOLEAN
189 EFIAPI
190 FilterBeforeMsrRead (
191 IN UINT32 Index,
192 IN OUT UINT64 *Value
193 );
194
195 /**
196 Trace MSR after read operation
197
198 @param Index The 8-bit Machine Specific Register index to BeforeWrite.
199 @param Value The 64-bit value to BeforeRead from the Machine Specific Register.
200
201 **/
202 VOID
203 EFIAPI
204 FilterAfterMsrRead (
205 IN UINT32 Index,
206 IN UINT64 *Value
207 );
208
209 /**
210 Filter MSR before write operation
211
212 It will return the flag to decide whether require write real MSR.
213 It can be used for emulation environment.
214
215 @param Index The 8-bit Machine Specific Register index to BeforeWrite.
216 @param Value The 64-bit value to BeforeWrite to the Machine Specific Register.
217
218 @retval TRUE Need to excute the MSR write.
219 @retval FALSE Skip the MSR write.
220
221 **/
222 BOOLEAN
223 EFIAPI
224 FilterBeforeMsrWrite (
225 IN UINT32 Index,
226 IN UINT64 *Value
227 );
228
229 /**
230 Trace MSR after write operation
231
232 @param Index The 8-bit Machine Specific Register index to BeforeWrite.
233 @param Value The 64-bit value to BeforeWrite to the Machine Specific Register.
234
235 **/
236 VOID
237 EFIAPI
238 FilterAfterMsrWrite (
239 IN UINT32 Index,
240 IN UINT64 *Value
241 );
242
243 #endif // REGISTER_FILTER_LIB_H_