]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/CpuIoPei/CpuIoPei.h
UefiCpuPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / UefiCpuPkg / CpuIoPei / CpuIoPei.h
CommitLineData
430fbbe0 1/** @file\r
2 Internal include file for the CPU I/O PPI.\r
3\r
7367cc6c 4Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
0acd8697 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
430fbbe0 6\r
7**/\r
8\r
9#ifndef _CPU_IO2_PEI_H_\r
10#define _CPU_IO2_PEI_H_\r
11\r
12#include <PiDxe.h>\r
13\r
14#include <Ppi/CpuIo.h>\r
15\r
16#include <Library/BaseLib.h>\r
17#include <Library/DebugLib.h>\r
18#include <Library/IoLib.h>\r
19#include <Library/PeiServicesLib.h>\r
20\r
21#define MAX_IO_PORT_ADDRESS 0xFFFF\r
22\r
23/**\r
24 Reads memory-mapped registers.\r
25\r
26 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
27 published by the PEI Foundation.\r
28 @param[in] This Pointer to local data for the interface.\r
29 @param[in] Width The width of the access. Enumerated in bytes.\r
30 @param[in] Address The physical address of the access.\r
31 @param[in] Count The number of accesses to perform.\r
32 @param[out] Buffer A pointer to the buffer of data.\r
33\r
34 @retval EFI_SUCCESS The function completed successfully.\r
35 @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system.\r
36 @retval EFI_INVALID_PARAMETER Buffer is NULL.\r
7367cc6c 37 @retval EFI_UNSUPPORTED The address range specified by Address, Width,\r
430fbbe0 38 and Count is not valid for this EFI system.\r
39\r
40**/\r
41EFI_STATUS\r
42EFIAPI\r
43CpuMemoryServiceRead (\r
44 IN CONST EFI_PEI_SERVICES **PeiServices,\r
45 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
46 IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r
47 IN UINT64 Address,\r
48 IN UINTN Count,\r
49 OUT VOID *Buffer\r
50 );\r
51\r
52/**\r
53 Writes memory-mapped registers.\r
54\r
55 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
56 published by the PEI Foundation.\r
57 @param[in] This Pointer to local data for the interface.\r
58 @param[in] Width The width of the access. Enumerated in bytes.\r
59 @param[in] Address The physical address of the access.\r
60 @param[in] Count The number of accesses to perform.\r
61 @param[in] Buffer A pointer to the buffer of data.\r
62\r
63 @retval EFI_SUCCESS The function completed successfully.\r
64 @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system.\r
65 @retval EFI_INVALID_PARAMETER Buffer is NULL.\r
7367cc6c 66 @retval EFI_UNSUPPORTED The address range specified by Address, Width,\r
430fbbe0 67 and Count is not valid for this EFI system.\r
68\r
69**/\r
70EFI_STATUS\r
71EFIAPI\r
72CpuMemoryServiceWrite (\r
73 IN CONST EFI_PEI_SERVICES **PeiServices,\r
74 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
75 IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r
76 IN UINT64 Address,\r
77 IN UINTN Count,\r
78 IN VOID *Buffer\r
79 );\r
80\r
81/**\r
82 Reads I/O registers.\r
83\r
84 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
85 published by the PEI Foundation.\r
86 @param[in] This Pointer to local data for the interface.\r
87 @param[in] Width The width of the access. Enumerated in bytes.\r
88 @param[in] Address The physical address of the access.\r
89 @param[in] Count The number of accesses to perform.\r
90 @param[out] Buffer A pointer to the buffer of data.\r
91\r
92 @retval EFI_SUCCESS The function completed successfully.\r
93 @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system.\r
94 @retval EFI_INVALID_PARAMETER Buffer is NULL.\r
7367cc6c 95 @retval EFI_UNSUPPORTED The address range specified by Address, Width,\r
430fbbe0 96 and Count is not valid for this EFI system.\r
97\r
98**/\r
99EFI_STATUS\r
100EFIAPI\r
101CpuIoServiceRead (\r
102 IN CONST EFI_PEI_SERVICES **PeiServices,\r
103 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
104 IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r
105 IN UINT64 Address,\r
106 IN UINTN Count,\r
107 OUT VOID *Buffer\r
108 );\r
109\r
110/**\r
111 Write I/O registers.\r
112\r
113 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
114 published by the PEI Foundation.\r
115 @param[in] This Pointer to local data for the interface.\r
116 @param[in] Width The width of the access. Enumerated in bytes.\r
117 @param[in] Address The physical address of the access.\r
118 @param[in] Count The number of accesses to perform.\r
119 @param[in] Buffer A pointer to the buffer of data.\r
120\r
121 @retval EFI_SUCCESS The function completed successfully.\r
122 @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system.\r
123 @retval EFI_INVALID_PARAMETER Buffer is NULL.\r
7367cc6c 124 @retval EFI_UNSUPPORTED The address range specified by Address, Width,\r
430fbbe0 125 and Count is not valid for this EFI system.\r
126\r
127**/\r
128EFI_STATUS\r
129EFIAPI\r
130CpuIoServiceWrite (\r
131 IN CONST EFI_PEI_SERVICES **PeiServices,\r
132 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
133 IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r
134 IN UINT64 Address,\r
135 IN UINTN Count,\r
136 IN VOID *Buffer\r
137 );\r
138\r
139/**\r
140 8-bit I/O read operations.\r
141\r
7367cc6c 142 @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
430fbbe0 143 by the PEI Foundation.\r
144 @param[in] This Pointer to local data for the interface.\r
145 @param[in] Address The physical address of the access.\r
146\r
147 @return An 8-bit value returned from the I/O space.\r
148**/\r
149UINT8\r
150EFIAPI\r
151CpuIoRead8 (\r
152 IN CONST EFI_PEI_SERVICES **PeiServices,\r
153 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
154 IN UINT64 Address\r
155 );\r
156\r
157/**\r
158 16-bit I/O read operations.\r
159\r
7367cc6c 160 @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
430fbbe0 161 by the PEI Foundation.\r
162 @param[in] This Pointer to local data for the interface.\r
163 @param[in] Address The physical address of the access.\r
164\r
165 @return A 16-bit value returned from the I/O space.\r
166\r
167**/\r
168UINT16\r
169EFIAPI\r
170CpuIoRead16 (\r
171 IN CONST EFI_PEI_SERVICES **PeiServices,\r
172 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
173 IN UINT64 Address\r
174 );\r
175\r
176/**\r
177 32-bit I/O read operations.\r
178\r
7367cc6c 179 @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
430fbbe0 180 by the PEI Foundation.\r
181 @param[in] This Pointer to local data for the interface.\r
182 @param[in] Address The physical address of the access.\r
183\r
184 @return A 32-bit value returned from the I/O space.\r
185\r
186**/\r
187UINT32\r
188EFIAPI\r
189CpuIoRead32 (\r
190 IN CONST EFI_PEI_SERVICES **PeiServices,\r
191 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
192 IN UINT64 Address\r
193 );\r
194\r
195/**\r
196 64-bit I/O read operations.\r
197\r
7367cc6c 198 @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
430fbbe0 199 by the PEI Foundation.\r
200 @param[in] This Pointer to local data for the interface.\r
201 @param[in] Address The physical address of the access.\r
202\r
203 @return A 64-bit value returned from the I/O space.\r
204\r
205**/\r
206UINT64\r
207EFIAPI\r
208CpuIoRead64 (\r
209 IN CONST EFI_PEI_SERVICES **PeiServices,\r
210 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
211 IN UINT64 Address\r
212 );\r
213\r
214/**\r
215 8-bit I/O write operations.\r
216\r
7367cc6c 217 @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
430fbbe0 218 by the PEI Foundation.\r
219 @param[in] This Pointer to local data for the interface.\r
220 @param[in] Address The physical address of the access.\r
221 @param[in] Data The data to write.\r
222\r
223**/\r
224VOID\r
225EFIAPI\r
226CpuIoWrite8 (\r
227 IN CONST EFI_PEI_SERVICES **PeiServices,\r
228 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
229 IN UINT64 Address,\r
230 IN UINT8 Data\r
231 );\r
232\r
233/**\r
234 16-bit I/O write operations.\r
235\r
7367cc6c 236 @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
430fbbe0 237 by the PEI Foundation.\r
238 @param[in] This Pointer to local data for the interface.\r
239 @param[in] Address The physical address of the access.\r
240 @param[in] Data The data to write.\r
241\r
242**/\r
243VOID\r
244EFIAPI\r
245CpuIoWrite16 (\r
246 IN CONST EFI_PEI_SERVICES **PeiServices,\r
247 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
248 IN UINT64 Address,\r
249 IN UINT16 Data\r
250 );\r
251\r
252/**\r
253 32-bit I/O write operations.\r
254\r
7367cc6c 255 @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
430fbbe0 256 by the PEI Foundation.\r
257 @param[in] This Pointer to local data for the interface.\r
258 @param[in] Address The physical address of the access.\r
259 @param[in] Data The data to write.\r
260\r
261**/\r
262VOID\r
263EFIAPI\r
264CpuIoWrite32 (\r
265 IN CONST EFI_PEI_SERVICES **PeiServices,\r
266 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
267 IN UINT64 Address,\r
268 IN UINT32 Data\r
269 );\r
270\r
271/**\r
272 64-bit I/O write operations.\r
273\r
7367cc6c 274 @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
430fbbe0 275 by the PEI Foundation.\r
276 @param[in] This Pointer to local data for the interface.\r
277 @param[in] Address The physical address of the access.\r
278 @param[in] Data The data to write.\r
279\r
280**/\r
281VOID\r
282EFIAPI\r
283CpuIoWrite64 (\r
284 IN CONST EFI_PEI_SERVICES **PeiServices,\r
285 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
286 IN UINT64 Address,\r
287 IN UINT64 Data\r
288 );\r
289\r
290/**\r
291 8-bit memory read operations.\r
292\r
7367cc6c 293 @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
430fbbe0 294 by the PEI Foundation.\r
295 @param[in] This Pointer to local data for the interface.\r
296 @param[in] Address The physical address of the access.\r
297\r
298 @return An 8-bit value returned from the memory space.\r
299\r
300**/\r
301UINT8\r
302EFIAPI\r
303CpuMemRead8 (\r
304 IN CONST EFI_PEI_SERVICES **PeiServices,\r
305 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
306 IN UINT64 Address\r
307 );\r
308\r
309/**\r
310 16-bit memory read operations.\r
311\r
7367cc6c 312 @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
430fbbe0 313 by the PEI Foundation.\r
314 @param[in] This Pointer to local data for the interface.\r
315 @param[in] Address The physical address of the access.\r
316\r
317 @return A 16-bit value returned from the memory space.\r
318\r
319**/\r
320UINT16\r
321EFIAPI\r
322CpuMemRead16 (\r
323 IN CONST EFI_PEI_SERVICES **PeiServices,\r
324 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
325 IN UINT64 Address\r
326 );\r
327\r
328/**\r
329 32-bit memory read operations.\r
330\r
7367cc6c 331 @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
430fbbe0 332 by the PEI Foundation.\r
333 @param[in] This Pointer to local data for the interface.\r
334 @param[in] Address The physical address of the access.\r
335\r
336 @return A 32-bit value returned from the memory space.\r
337\r
338**/\r
339UINT32\r
340EFIAPI\r
341CpuMemRead32 (\r
342 IN CONST EFI_PEI_SERVICES **PeiServices,\r
343 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
344 IN UINT64 Address\r
345 );\r
346\r
347/**\r
348 64-bit memory read operations.\r
349\r
7367cc6c 350 @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
430fbbe0 351 by the PEI Foundation.\r
352 @param[in] This Pointer to local data for the interface.\r
353 @param[in] Address The physical address of the access.\r
354\r
355 @return A 64-bit value returned from the memory space.\r
356\r
357**/\r
358UINT64\r
359EFIAPI\r
360CpuMemRead64 (\r
361 IN CONST EFI_PEI_SERVICES **PeiServices,\r
362 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
363 IN UINT64 Address\r
364 );\r
365\r
366/**\r
367 8-bit memory write operations.\r
368\r
7367cc6c 369 @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
430fbbe0 370 by the PEI Foundation.\r
371 @param[in] This Pointer to local data for the interface.\r
372 @param[in] Address The physical address of the access.\r
373 @param[in] Data The data to write.\r
374\r
375**/\r
376VOID\r
377EFIAPI\r
378CpuMemWrite8 (\r
379 IN CONST EFI_PEI_SERVICES **PeiServices,\r
380 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
381 IN UINT64 Address,\r
382 IN UINT8 Data\r
383 );\r
384\r
385/**\r
386 16-bit memory write operations.\r
387\r
7367cc6c 388 @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
430fbbe0 389 by the PEI Foundation.\r
390 @param[in] This Pointer to local data for the interface.\r
391 @param[in] Address The physical address of the access.\r
392 @param[in] Data The data to write.\r
393\r
394**/\r
395VOID\r
396EFIAPI\r
397CpuMemWrite16 (\r
398 IN CONST EFI_PEI_SERVICES **PeiServices,\r
399 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
400 IN UINT64 Address,\r
401 IN UINT16 Data\r
402 );\r
403\r
404/**\r
405 32-bit memory write operations.\r
406\r
7367cc6c 407 @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
430fbbe0 408 by the PEI Foundation.\r
409 @param[in] This Pointer to local data for the interface.\r
410 @param[in] Address The physical address of the access.\r
411 @param[in] Data The data to write.\r
412\r
413**/\r
414VOID\r
415EFIAPI\r
416CpuMemWrite32 (\r
417 IN CONST EFI_PEI_SERVICES **PeiServices,\r
418 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
419 IN UINT64 Address,\r
420 IN UINT32 Data\r
421 );\r
422\r
423/**\r
424 64-bit memory write operations.\r
425\r
7367cc6c 426 @param[in] PeiServices An indirect pointer to the PEI Services Table published\r
430fbbe0 427 by the PEI Foundation.\r
428 @param[in] This Pointer to local data for the interface.\r
429 @param[in] Address The physical address of the access.\r
430 @param[in] Data The data to write.\r
431\r
432**/\r
433VOID\r
434EFIAPI\r
435CpuMemWrite64 (\r
436 IN CONST EFI_PEI_SERVICES **PeiServices,\r
437 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
438 IN UINT64 Address,\r
439 IN UINT64 Data\r
440 );\r
7367cc6c 441\r
430fbbe0 442#endif\r