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