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