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