]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Pei/CpuIo/CpuIo.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Core / Pei / CpuIo / CpuIo.c
CommitLineData
8d415937 1/** @file\r
2 The default version of EFI_PEI_CPU_IO_PPI support published by PeiServices in\r
3 PeiCore initialization phase.\r
d1102dba 4\r
8d415937 5 EFI_PEI_CPU_IO_PPI is installed by some platform or chipset-specific PEIM that\r
6 abstracts the processor-visible I/O operations. When PeiCore is started, the\r
7 default version of EFI_PEI_CPU_IO_PPI will be assigned to PeiServices table.\r
d1102dba
LG
8\r
9Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
9d510e61 10SPDX-License-Identifier: BSD-2-Clause-Patent\r
8d415937 11\r
12**/\r
13\r
14#include "PeiMain.h"\r
15\r
16///\r
17/// This default instance of EFI_PEI_CPU_IO_PPI install assigned to EFI_PEI_SERVICE.CpuIo\r
18/// when PeiCore's initialization.\r
19///\r
20EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi = {\r
21 {\r
22 PeiDefaultMemRead,\r
23 PeiDefaultMemWrite\r
24 },\r
25 {\r
26 PeiDefaultIoRead,\r
27 PeiDefaultIoWrite\r
28 },\r
29 PeiDefaultIoRead8,\r
30 PeiDefaultIoRead16,\r
31 PeiDefaultIoRead32,\r
32 PeiDefaultIoRead64,\r
33 PeiDefaultIoWrite8,\r
34 PeiDefaultIoWrite16,\r
35 PeiDefaultIoWrite32,\r
36 PeiDefaultIoWrite64,\r
37 PeiDefaultMemRead8,\r
38 PeiDefaultMemRead16,\r
39 PeiDefaultMemRead32,\r
40 PeiDefaultMemRead64,\r
41 PeiDefaultMemWrite8,\r
42 PeiDefaultMemWrite16,\r
43 PeiDefaultMemWrite32,\r
44 PeiDefaultMemWrite64\r
45};\r
46\r
47/**\r
48 Memory-based read services.\r
d1102dba
LG
49\r
50 This function is to perform the Memory Access Read service based on installed\r
51 instance of the EFI_PEI_CPU_IO_PPI.\r
52 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
53 return EFI_NOT_YET_AVAILABLE.\r
54\r
8d415937 55 @param PeiServices An indirect pointer to the PEI Services Table\r
56 published by the PEI Foundation.\r
57 @param This Pointer to local data for the interface.\r
58 @param Width The width of the access. Enumerated in bytes.\r
59 @param Address The physical address of the access.\r
60 @param Count The number of accesses to perform.\r
61 @param Buffer A pointer to the buffer of data.\r
62\r
63 @retval EFI_SUCCESS The function completed successfully.\r
d1102dba 64 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
8d415937 65**/\r
66EFI_STATUS\r
67EFIAPI\r
68PeiDefaultMemRead (\r
69 IN CONST EFI_PEI_SERVICES **PeiServices,\r
70 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
71 IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r
72 IN UINT64 Address,\r
73 IN UINTN Count,\r
74 IN OUT VOID *Buffer\r
75 )\r
76{\r
77 return EFI_NOT_AVAILABLE_YET;\r
78}\r
d1102dba 79\r
8d415937 80/**\r
81 Memory-based write services.\r
d1102dba
LG
82\r
83 This function is to perform the Memory Access Write service based on installed\r
84 instance of the EFI_PEI_CPU_IO_PPI.\r
85 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
86 return EFI_NOT_YET_AVAILABLE.\r
87\r
8d415937 88 @param PeiServices An indirect pointer to the PEI Services Table\r
89 published by the PEI Foundation.\r
90 @param This Pointer to local data for the interface.\r
91 @param Width The width of the access. Enumerated in bytes.\r
92 @param Address The physical address of the access.\r
93 @param Count The number of accesses to perform.\r
94 @param Buffer A pointer to the buffer of data.\r
95\r
96 @retval EFI_SUCCESS The function completed successfully.\r
d1102dba 97 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
8d415937 98**/\r
99EFI_STATUS\r
100EFIAPI\r
101PeiDefaultMemWrite (\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 IN OUT VOID *Buffer\r
108 )\r
109{\r
110 return EFI_NOT_AVAILABLE_YET;\r
111}\r
112\r
113/**\r
114 IO-based read services.\r
d1102dba 115\r
8d415937 116 This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.\r
d1102dba
LG
117 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
118 return EFI_NOT_YET_AVAILABLE.\r
119\r
8d415937 120 @param PeiServices An indirect pointer to the PEI Services Table\r
121 published by the PEI Foundation.\r
122 @param This Pointer to local data for the interface.\r
123 @param Width The width of the access. Enumerated in bytes.\r
124 @param Address The physical address of the access.\r
125 @param Count The number of accesses to perform.\r
126 @param Buffer A pointer to the buffer of data.\r
127\r
128 @retval EFI_SUCCESS The function completed successfully.\r
129 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
130**/\r
131EFI_STATUS\r
132EFIAPI\r
133PeiDefaultIoRead (\r
134 IN CONST EFI_PEI_SERVICES **PeiServices,\r
135 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
136 IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r
137 IN UINT64 Address,\r
138 IN UINTN Count,\r
139 IN OUT VOID *Buffer\r
140 )\r
141{\r
142 return EFI_NOT_AVAILABLE_YET;\r
143}\r
144\r
145/**\r
146 IO-based write services.\r
d1102dba 147\r
8d415937 148 This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.\r
d1102dba
LG
149 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
150 return EFI_NOT_YET_AVAILABLE.\r
151\r
8d415937 152 @param PeiServices An indirect pointer to the PEI Services Table\r
153 published by the PEI Foundation.\r
154 @param This Pointer to local data for the interface.\r
155 @param Width The width of the access. Enumerated in bytes.\r
156 @param Address The physical address of the access.\r
157 @param Count The number of accesses to perform.\r
158 @param Buffer A pointer to the buffer of data.\r
159\r
160 @retval EFI_SUCCESS The function completed successfully.\r
161 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
162**/\r
163EFI_STATUS\r
164EFIAPI\r
165PeiDefaultIoWrite (\r
166 IN CONST EFI_PEI_SERVICES **PeiServices,\r
167 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
168 IN EFI_PEI_CPU_IO_PPI_WIDTH Width,\r
169 IN UINT64 Address,\r
170 IN UINTN Count,\r
171 IN OUT VOID *Buffer\r
172 )\r
173{\r
174 return EFI_NOT_AVAILABLE_YET;\r
175}\r
176\r
177/**\r
178 8-bit I/O read operations.\r
d1102dba
LG
179\r
180 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
8d415937 181 return 0.\r
d1102dba 182\r
8d415937 183 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
184 @param This Pointer to local data for the interface.\r
185 @param Address The physical address of the access.\r
186\r
187 @return An 8-bit value returned from the I/O space.\r
188**/\r
189UINT8\r
190EFIAPI\r
191PeiDefaultIoRead8 (\r
192 IN CONST EFI_PEI_SERVICES **PeiServices,\r
193 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
194 IN UINT64 Address\r
195 )\r
196{\r
197 return 0;\r
198}\r
199\r
200/**\r
201 Reads an 16-bit I/O port.\r
d1102dba
LG
202\r
203 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
8d415937 204 return 0.\r
d1102dba 205\r
8d415937 206 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
207 @param This Pointer to local data for the interface.\r
208 @param Address The physical address of the access.\r
209\r
210 @return A 16-bit value returned from the I/O space.\r
211**/\r
212UINT16\r
213EFIAPI\r
214PeiDefaultIoRead16 (\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 return 0;\r
221}\r
222\r
223/**\r
224 Reads an 32-bit I/O port.\r
d1102dba
LG
225\r
226 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
8d415937 227 return 0.\r
d1102dba 228\r
8d415937 229 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
230 @param This Pointer to local data for the interface.\r
231 @param Address The physical address of the access.\r
232\r
233 @return A 32-bit value returned from the I/O space.\r
234**/\r
235UINT32\r
236EFIAPI\r
237PeiDefaultIoRead32 (\r
238 IN CONST EFI_PEI_SERVICES **PeiServices,\r
239 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
240 IN UINT64 Address\r
241 )\r
242{\r
243 return 0;\r
244}\r
245\r
246/**\r
247 Reads an 64-bit I/O port.\r
d1102dba
LG
248\r
249 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
8d415937 250 return 0.\r
d1102dba 251\r
8d415937 252 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
253 @param This Pointer to local data for the interface.\r
254 @param Address The physical address of the access.\r
255\r
256 @return A 64-bit value returned from the I/O space.\r
257**/\r
258UINT64\r
259EFIAPI\r
260PeiDefaultIoRead64 (\r
261 IN CONST EFI_PEI_SERVICES **PeiServices,\r
262 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
263 IN UINT64 Address\r
264 )\r
265{\r
266 return 0;\r
267}\r
268\r
269/**\r
270 8-bit I/O write operations.\r
271 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then do\r
272 nothing.\r
d1102dba 273\r
8d415937 274 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
275 @param This Pointer to local data for the interface.\r
276 @param Address The physical address of the access.\r
277 @param Data The data to write.\r
278**/\r
279VOID\r
280EFIAPI\r
281PeiDefaultIoWrite8 (\r
282 IN CONST EFI_PEI_SERVICES **PeiServices,\r
283 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
284 IN UINT64 Address,\r
285 IN UINT8 Data\r
286 )\r
287{\r
d1102dba 288}\r
8d415937 289\r
290/**\r
291 16-bit I/O write operations.\r
292 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then do\r
293 nothing.\r
d1102dba 294\r
8d415937 295 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
296 @param This Pointer to local data for the interface.\r
297 @param Address The physical address of the access.\r
298 @param Data The data to write.\r
299**/\r
300VOID\r
301EFIAPI\r
302PeiDefaultIoWrite16 (\r
303 IN CONST EFI_PEI_SERVICES **PeiServices,\r
304 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
305 IN UINT64 Address,\r
306 IN UINT16 Data\r
307 )\r
308{\r
309}\r
310\r
311/**\r
312 32-bit I/O write operations.\r
313 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then do\r
314 nothing.\r
d1102dba 315\r
8d415937 316 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
317 @param This Pointer to local data for the interface.\r
318 @param Address The physical address of the access.\r
319 @param Data The data to write.\r
320**/\r
321VOID\r
322EFIAPI\r
323PeiDefaultIoWrite32 (\r
324 IN CONST EFI_PEI_SERVICES **PeiServices,\r
325 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
326 IN UINT64 Address,\r
327 IN UINT32 Data\r
328 )\r
329{\r
330}\r
331\r
332/**\r
333 64-bit I/O write operations.\r
334 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then do\r
335 nothing.\r
d1102dba 336\r
8d415937 337 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
338 @param This Pointer to local data for the interface.\r
339 @param Address The physical address of the access.\r
340 @param Data The data to write.\r
341**/\r
342VOID\r
343EFIAPI\r
344PeiDefaultIoWrite64 (\r
345 IN CONST EFI_PEI_SERVICES **PeiServices,\r
346 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
347 IN UINT64 Address,\r
348 IN UINT64 Data\r
349 )\r
350{\r
351}\r
352\r
353/**\r
354 8-bit memory read operations.\r
355\r
d1102dba 356 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
8d415937 357 return 0.\r
d1102dba 358\r
8d415937 359 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
360 @param This Pointer to local data for the interface.\r
361 @param Address The physical address of the access.\r
362\r
363 @return An 8-bit value returned from the memory space.\r
364\r
365**/\r
366UINT8\r
367EFIAPI\r
368PeiDefaultMemRead8 (\r
369 IN CONST EFI_PEI_SERVICES **PeiServices,\r
370 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
371 IN UINT64 Address\r
372 )\r
373{\r
374 return 0;\r
d1102dba 375}\r
8d415937 376\r
377/**\r
378 16-bit memory read operations.\r
379\r
d1102dba 380 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
8d415937 381 return 0.\r
d1102dba 382\r
8d415937 383 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
384 @param This Pointer to local data for the interface.\r
385 @param Address The physical address of the access.\r
386\r
387 @return An 16-bit value returned from the memory space.\r
388\r
389**/\r
390UINT16\r
391EFIAPI\r
392PeiDefaultMemRead16 (\r
393 IN CONST EFI_PEI_SERVICES **PeiServices,\r
394 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
395 IN UINT64 Address\r
396 )\r
397{\r
398 return 0;\r
d1102dba 399}\r
8d415937 400\r
401/**\r
402 32-bit memory read operations.\r
403\r
d1102dba 404 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
8d415937 405 return 0.\r
d1102dba 406\r
8d415937 407 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
408 @param This Pointer to local data for the interface.\r
409 @param Address The physical address of the access.\r
410\r
411 @return An 32-bit value returned from the memory space.\r
412\r
413**/\r
414UINT32\r
415EFIAPI\r
416PeiDefaultMemRead32 (\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 )\r
421{\r
422 return 0;\r
d1102dba 423}\r
8d415937 424\r
425/**\r
426 64-bit memory read operations.\r
427\r
d1102dba 428 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then\r
8d415937 429 return 0.\r
d1102dba 430\r
8d415937 431 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
432 @param This Pointer to local data for the interface.\r
433 @param Address The physical address of the access.\r
434\r
435 @return An 64-bit value returned from the memory space.\r
436\r
437**/\r
438UINT64\r
439EFIAPI\r
440PeiDefaultMemRead64 (\r
441 IN CONST EFI_PEI_SERVICES **PeiServices,\r
442 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
443 IN UINT64 Address\r
444 )\r
445{\r
446 return 0;\r
d1102dba 447}\r
8d415937 448\r
449/**\r
450 8-bit memory write operations.\r
451 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then do\r
452 nothing.\r
d1102dba 453\r
8d415937 454 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
455 @param This Pointer to local data for the interface.\r
456 @param Address The physical address of the access.\r
457 @param Data The data to write.\r
458\r
459**/\r
460VOID\r
461EFIAPI\r
462PeiDefaultMemWrite8 (\r
463 IN CONST EFI_PEI_SERVICES **PeiServices,\r
464 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
465 IN UINT64 Address,\r
466 IN UINT8 Data\r
467 )\r
468{\r
d1102dba 469}\r
8d415937 470\r
471/**\r
472 16-bit memory write operations.\r
473 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then do\r
474 nothing.\r
d1102dba 475\r
8d415937 476 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
477 @param This Pointer to local data for the interface.\r
478 @param Address The physical address of the access.\r
479 @param Data The data to write.\r
480\r
481**/\r
482VOID\r
483EFIAPI\r
484PeiDefaultMemWrite16 (\r
485 IN CONST EFI_PEI_SERVICES **PeiServices,\r
486 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
487 IN UINT64 Address,\r
488 IN UINT16 Data\r
489 )\r
490{\r
d1102dba 491}\r
8d415937 492\r
493/**\r
494 32-bit memory write operations.\r
495 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then do\r
496 nothing.\r
497\r
498 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
499 @param This Pointer to local data for the interface.\r
500 @param Address The physical address of the access.\r
501 @param Data The data to write.\r
502\r
503**/\r
504VOID\r
505EFIAPI\r
506PeiDefaultMemWrite32 (\r
507 IN CONST EFI_PEI_SERVICES **PeiServices,\r
508 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
509 IN UINT64 Address,\r
510 IN UINT32 Data\r
511 )\r
512{\r
d1102dba 513}\r
8d415937 514\r
515/**\r
516 64-bit memory write operations.\r
517 If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then do\r
518 nothing.\r
d1102dba 519\r
8d415937 520 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
521 @param This Pointer to local data for the interface.\r
522 @param Address The physical address of the access.\r
523 @param Data The data to write.\r
524\r
525**/\r
526VOID\r
527EFIAPI\r
528PeiDefaultMemWrite64 (\r
529 IN CONST EFI_PEI_SERVICES **PeiServices,\r
530 IN CONST EFI_PEI_CPU_IO_PPI *This,\r
531 IN UINT64 Address,\r
532 IN UINT64 Data\r
533 )\r
534{\r
d1102dba 535}\r