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