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