]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/RegisterFilterLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[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 /**
61 Filter IO Write operation before wirte IO port.
62 It is used to filter IO operation.
63
64 It will return the flag to decide whether require read write IO port.
65 It can be used for emulation environment.
66
67 @param[in] Width Signifies the width of the I/O operation.
68 @param[in] Address The base address of the I/O operation.
69 @param[in] Buffer The source buffer from which to BeforeWrite data.
70
71 @retval TRUE Need to excute the IO write.
72 @retval FALSE Skip the IO write.
73
74 **/
75 BOOLEAN
76 EFIAPI
77 FilterBeforeIoWrite (
78 IN FILTER_IO_WIDTH Width,
79 IN UINTN Address,
80 IN VOID *Buffer
81 );
82
83 /**
84 Trace IO Write operation after wirte IO port.
85 It is used to trace IO operation.
86
87 @param[in] Width Signifies the width of the I/O operation.
88 @param[in] Address The base address of the I/O operation.
89 @param[in] Buffer The source buffer from which to BeforeWrite data.
90
91 **/
92 VOID
93 EFIAPI
94 FilterAfterIoWrite (
95 IN FILTER_IO_WIDTH Width,
96 IN UINTN Address,
97 IN VOID *Buffer
98 );
99
100 /**
101 Filter memory IO before Read operation.
102
103 It will return the flag to decide whether require read real MMIO.
104 It can be used for emulation environment.
105
106 @param[in] Width Signifies the width of the memory I/O operation.
107 @param[in] Address The base address of the memory I/O operation.
108 @param[in] Buffer The destination buffer to store the results.
109
110 @retval TRUE Need to excute the MMIO read.
111 @retval FALSE Skip the MMIO read.
112
113 **/
114 BOOLEAN
115 EFIAPI
116 FilterBeforeMmIoRead (
117 IN FILTER_IO_WIDTH Width,
118 IN UINTN Address,
119 IN OUT VOID *Buffer
120 );
121
122 /**
123 Tracer memory IO after read operation
124
125 @param[in] Width Signifies the width of the memory I/O operation.
126 @param[in] Address The base address of the memory I/O operation.
127 @param[in] Buffer The destination buffer to store the results.
128
129 **/
130 VOID
131 EFIAPI
132 FilterAfterMmIoRead (
133 IN FILTER_IO_WIDTH Width,
134 IN UINTN Address,
135 IN VOID *Buffer
136 );
137
138 /**
139 Filter memory IO before write operation
140
141 It will return the flag to decide whether require wirte real MMIO.
142 It can be used for emulation environment.
143
144 @param[in] Width Signifies the width of the memory I/O operation.
145 @param[in] Address The base address of the memory I/O operation.
146 @param[in] Buffer The source buffer from which to BeforeWrite data.
147
148 @retval TRUE Need to excute the MMIO write.
149 @retval FALSE Skip the MMIO write.
150
151 **/
152 BOOLEAN
153 EFIAPI
154 FilterBeforeMmIoWrite (
155 IN FILTER_IO_WIDTH Width,
156 IN UINTN Address,
157 IN VOID *Buffer
158 );
159
160 /**
161 Tracer memory IO after write operation
162
163 @param[in] Width Signifies the width of the memory I/O operation.
164 @param[in] Address The base address of the memory I/O operation.
165 @param[in] Buffer The source buffer from which to BeforeWrite data.
166
167 **/
168 VOID
169 EFIAPI
170 FilterAfterMmIoWrite (
171 IN FILTER_IO_WIDTH Width,
172 IN UINTN Address,
173 IN VOID *Buffer
174 );
175
176 /**
177 Filter MSR before read operation.
178
179 It will return the flag to decide whether require read real MSR.
180 It can be used for emulation environment.
181
182 @param Index The 8-bit Machine Specific Register index to BeforeWrite.
183 @param Value The 64-bit value to BeforeRead from the Machine Specific Register.
184
185 @retval TRUE Need to excute the MSR read.
186 @retval FALSE Skip the MSR read.
187
188 **/
189 BOOLEAN
190 EFIAPI
191 FilterBeforeMsrRead (
192 IN UINT32 Index,
193 IN OUT UINT64 *Value
194 );
195
196 /**
197 Trace MSR after read operation
198
199 @param Index The 8-bit Machine Specific Register index to BeforeWrite.
200 @param Value The 64-bit value to BeforeRead from the Machine Specific Register.
201
202 **/
203 VOID
204 EFIAPI
205 FilterAfterMsrRead (
206 IN UINT32 Index,
207 IN UINT64 *Value
208 );
209
210 /**
211 Filter MSR before write operation
212
213 It will return the flag to decide whether require write real MSR.
214 It can be used for emulation environment.
215
216 @param Index The 8-bit Machine Specific Register index to BeforeWrite.
217 @param Value The 64-bit value to BeforeWrite to the Machine Specific Register.
218
219 @retval TRUE Need to excute the MSR write.
220 @retval FALSE Skip the MSR write.
221
222 **/
223 BOOLEAN
224 EFIAPI
225 FilterBeforeMsrWrite (
226 IN UINT32 Index,
227 IN UINT64 *Value
228 );
229
230 /**
231 Trace MSR after write operation
232
233 @param Index The 8-bit Machine Specific Register index to BeforeWrite.
234 @param Value The 64-bit value to BeforeWrite to the Machine Specific Register.
235
236 **/
237 VOID
238 EFIAPI
239 FilterAfterMsrWrite (
240 IN UINT32 Index,
241 IN UINT64 *Value
242 );
243
244 #endif // REGISTER_FILTER_LIB_H_