1 /** @file
2   This PPI provides a set of memory and I/O-based services.
3   The perspective of the services is that of the processor, not the bus or system.
4 
5 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7 
8   @par Revision Reference:
9   This PPI is introduced in PI Version 1.0.
10 
11 **/
12 
13 #ifndef __PEI_CPUIO_PPI_H__
14 #define __PEI_CPUIO_PPI_H__
15 
16 #define EFI_PEI_CPU_IO_PPI_INSTALLED_GUID \
17   { 0xe6af1f7b, 0xfc3f, 0x46da, {0xa8, 0x28, 0xa3, 0xb4, 0x57, 0xa4, 0x42, 0x82 } }
18 
19 typedef struct _EFI_PEI_CPU_IO_PPI  EFI_PEI_CPU_IO_PPI;
20 
21 ///
22 /// EFI_PEI_CPU_IO_PPI_WIDTH.
23 ///
24 typedef enum {
25   EfiPeiCpuIoWidthUint8,
26   EfiPeiCpuIoWidthUint16,
27   EfiPeiCpuIoWidthUint32,
28   EfiPeiCpuIoWidthUint64,
29   EfiPeiCpuIoWidthFifoUint8,
30   EfiPeiCpuIoWidthFifoUint16,
31   EfiPeiCpuIoWidthFifoUint32,
32   EfiPeiCpuIoWidthFifoUint64,
33   EfiPeiCpuIoWidthFillUint8,
34   EfiPeiCpuIoWidthFillUint16,
35   EfiPeiCpuIoWidthFillUint32,
36   EfiPeiCpuIoWidthFillUint64,
37   EfiPeiCpuIoWidthMaximum
38 } EFI_PEI_CPU_IO_PPI_WIDTH;
39 
40 /**
41   Memory-based access services and I/O-based access services.
42 
43   @param[in]      PeiServices  An indirect pointer to the PEI Services Table
44                                published by the PEI Foundation.
45   @param[in]      This         The pointer to local data for the interface.
46   @param[in]      Width        The width of the access. Enumerated in bytes.
47   @param[in]      Address      The physical address of the access.
48   @param[in]      Count        The number of accesses to perform.
49   @param[in, out] Buffer       A pointer to the buffer of data.
50 
51   @retval EFI_SUCCESS            The function completed successfully.
52   @retval EFI_NOT_YET_AVAILABLE  The service has not been installed.
53 
54 **/
55 typedef
56 EFI_STATUS
57 (EFIAPI *EFI_PEI_CPU_IO_PPI_IO_MEM)(
58   IN     CONST EFI_PEI_SERVICES    **PeiServices,
59   IN     CONST EFI_PEI_CPU_IO_PPI  *This,
60   IN     EFI_PEI_CPU_IO_PPI_WIDTH  Width,
61   IN     UINT64                    Address,
62   IN     UINTN                     Count,
63   IN OUT VOID                      *Buffer
64   );
65 
66 ///
67 /// EFI_PEI_CPU_IO_PPI_ACCESS
68 ///
69 typedef struct {
70   ///
71   /// This service provides the various modalities of memory and I/O read.
72   ///
73   EFI_PEI_CPU_IO_PPI_IO_MEM  Read;
74   ///
75   /// This service provides the various modalities of memory and I/O write.
76   ///
77   EFI_PEI_CPU_IO_PPI_IO_MEM  Write;
78 } EFI_PEI_CPU_IO_PPI_ACCESS;
79 
80 /**
81   8-bit I/O read operations.
82 
83   @param[in] PeiServices  An indirect pointer to the PEI Services Table published
84                           by the PEI Foundation.
85   @param[in] This         The pointer to local data for the interface.
86   @param[in] Address      The physical address of the access.
87 
88   @return  An 8-bit value returned from the I/O space.
89 
90 **/
91 typedef
92 UINT8
93 (EFIAPI *EFI_PEI_CPU_IO_PPI_IO_READ8)(
94   IN  CONST EFI_PEI_SERVICES    **PeiServices,
95   IN  CONST EFI_PEI_CPU_IO_PPI  *This,
96   IN  UINT64                    Address
97   );
98 
99 /**
100   16-bit I/O read operations.
101 
102   @param[in] PeiServices  An indirect pointer to the PEI Services Table published
103                           by the PEI Foundation.
104   @param[in] This         The pointer to local data for the interface.
105   @param[in] Address      The physical address of the access.
106 
107   @return  A 16-bit value returned from the I/O space.
108 
109 **/
110 typedef
111 UINT16
112 (EFIAPI *EFI_PEI_CPU_IO_PPI_IO_READ16)(
113   IN  CONST EFI_PEI_SERVICES    **PeiServices,
114   IN  CONST EFI_PEI_CPU_IO_PPI  *This,
115   IN  UINT64                    Address
116   );
117 
118 /**
119   32-bit I/O read operations.
120 
121   @param[in] PeiServices  An indirect pointer to the PEI Services Table published
122                           by the PEI Foundation.
123   @param[in] This         The pointer to local data for the interface.
124   @param[in] Address      The physical address of the access.
125 
126   @return  A 32-bit value returned from the I/O space.
127 
128 **/
129 typedef
130 UINT32
131 (EFIAPI *EFI_PEI_CPU_IO_PPI_IO_READ32)(
132   IN  CONST EFI_PEI_SERVICES    **PeiServices,
133   IN  CONST EFI_PEI_CPU_IO_PPI  *This,
134   IN  UINT64                    Address
135   );
136 
137 /**
138   64-bit I/O read operations.
139 
140   @param[in] PeiServices  An indirect pointer to the PEI Services Table published
141                           by the PEI Foundation.
142   @param[in] This         The pointer to local data for the interface.
143   @param[in] Address      The physical address of the access.
144 
145   @return  A 64-bit value returned from the I/O space.
146 
147 **/
148 typedef
149 UINT64
150 (EFIAPI *EFI_PEI_CPU_IO_PPI_IO_READ64)(
151   IN  CONST EFI_PEI_SERVICES    **PeiServices,
152   IN  CONST EFI_PEI_CPU_IO_PPI  *This,
153   IN  UINT64                    Address
154   );
155 
156 /**
157   8-bit I/O write operations.
158 
159   @param[in] PeiServices  An indirect pointer to the PEI Services Table published
160                           by the PEI Foundation.
161   @param[in] This         The pointer to local data for the interface.
162   @param[in] Address      The physical address of the access.
163   @param[in] Data         The data to write.
164 
165 **/
166 typedef
167 VOID
168 (EFIAPI *EFI_PEI_CPU_IO_PPI_IO_WRITE8)(
169   IN  CONST EFI_PEI_SERVICES    **PeiServices,
170   IN  CONST EFI_PEI_CPU_IO_PPI  *This,
171   IN  UINT64                    Address,
172   IN  UINT8                     Data
173   );
174 
175 /**
176   16-bit I/O write operations.
177 
178   @param[in] PeiServices  An indirect pointer to the PEI Services Table published
179                           by the PEI Foundation.
180   @param[in] This         The pointer to local data for the interface.
181   @param[in] Address      The physical address of the access.
182   @param[in] Data         The data to write.
183 
184 **/
185 typedef
186 VOID
187 (EFIAPI *EFI_PEI_CPU_IO_PPI_IO_WRITE16)(
188   IN  CONST EFI_PEI_SERVICES    **PeiServices,
189   IN  CONST EFI_PEI_CPU_IO_PPI  *This,
190   IN  UINT64                    Address,
191   IN  UINT16                    Data
192   );
193 
194 /**
195   32-bit I/O write operations.
196 
197   @param[in] PeiServices  An indirect pointer to the PEI Services Table published
198                           by the PEI Foundation.
199   @param[in] This         The pointer to local data for the interface.
200   @param[in] Address      The physical address of the access.
201   @param[in] Data         The data to write.
202 
203 **/
204 typedef
205 VOID
206 (EFIAPI *EFI_PEI_CPU_IO_PPI_IO_WRITE32)(
207   IN  CONST EFI_PEI_SERVICES    **PeiServices,
208   IN  CONST EFI_PEI_CPU_IO_PPI  *This,
209   IN  UINT64                    Address,
210   IN  UINT32                    Data
211   );
212 
213 /**
214   64-bit I/O write operations.
215 
216   @param[in] PeiServices  An indirect pointer to the PEI Services Table published
217                           by the PEI Foundation.
218   @param[in] This         The pointer to local data for the interface.
219   @param[in] Address      The physical address of the access.
220   @param[in] Data         The data to write.
221 
222 **/
223 typedef
224 VOID
225 (EFIAPI *EFI_PEI_CPU_IO_PPI_IO_WRITE64)(
226   IN  CONST EFI_PEI_SERVICES    **PeiServices,
227   IN  CONST EFI_PEI_CPU_IO_PPI  *This,
228   IN  UINT64                    Address,
229   IN  UINT64                    Data
230   );
231 
232 /**
233   8-bit memory read operations.
234 
235   @param[in] PeiServices  An indirect pointer to the PEI Services Table published
236                           by the PEI Foundation.
237   @param[in] This         The pointer to local data for the interface.
238   @param[in] Address      The physical address of the access.
239 
240   @return  An 8-bit value returned from the memory space.
241 
242 **/
243 typedef
244 UINT8
245 (EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_READ8)(
246   IN  CONST EFI_PEI_SERVICES    **PeiServices,
247   IN  CONST EFI_PEI_CPU_IO_PPI  *This,
248   IN  UINT64                    Address
249   );
250 
251 /**
252   16-bit memory read operations.
253 
254   @param[in] PeiServices  An indirect pointer to the PEI Services Table published
255                           by the PEI Foundation.
256   @param[in] This         The pointer to local data for the interface.
257   @param[in] Address      The physical address of the access.
258 
259   @return  A 16-bit value returned from the memory space.
260 
261 **/
262 typedef
263 UINT16
264 (EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_READ16)(
265   IN  CONST EFI_PEI_SERVICES    **PeiServices,
266   IN  CONST EFI_PEI_CPU_IO_PPI  *This,
267   IN  UINT64                    Address
268   );
269 
270 /**
271   32-bit memory read operations.
272 
273   @param[in] PeiServices  An indirect pointer to the PEI Services Table published
274                           by the PEI Foundation.
275   @param[in] This         The pointer to local data for the interface.
276   @param[in] Address      The physical address of the access.
277 
278   @return  A 32-bit value returned from the memory space.
279 
280 **/
281 typedef
282 UINT32
283 (EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_READ32)(
284   IN  CONST EFI_PEI_SERVICES    **PeiServices,
285   IN  CONST EFI_PEI_CPU_IO_PPI  *This,
286   IN  UINT64                    Address
287   );
288 
289 /**
290   64-bit memory read operations.
291 
292   @param[in] PeiServices  An indirect pointer to the PEI Services Table published
293                           by the PEI Foundation.
294   @param[in] This         The pointer to local data for the interface.
295   @param[in] Address      The physical address of the access.
296 
297   @return  A 64-bit value returned from the memory space.
298 
299 **/
300 typedef
301 UINT64
302 (EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_READ64)(
303   IN  CONST EFI_PEI_SERVICES    **PeiServices,
304   IN  CONST EFI_PEI_CPU_IO_PPI  *This,
305   IN  UINT64                    Address
306   );
307 
308 /**
309   8-bit memory write operations.
310 
311   @param[in] PeiServices  An indirect pointer to the PEI Services Table published
312                           by the PEI Foundation.
313   @param[in] This         The pointer to local data for the interface.
314   @param[in] Address      The physical address of the access.
315   @param[in] Data         The data to write.
316 
317 **/
318 typedef
319 VOID
320 (EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_WRITE8)(
321   IN  CONST EFI_PEI_SERVICES    **PeiServices,
322   IN  CONST EFI_PEI_CPU_IO_PPI  *This,
323   IN  UINT64                    Address,
324   IN  UINT8                     Data
325   );
326 
327 /**
328   16-bit memory write operations.
329 
330   @param[in] PeiServices  An indirect pointer to the PEI Services Table published
331                           by the PEI Foundation.
332   @param[in] This         The pointer to local data for the interface.
333   @param[in] Address      The physical address of the access.
334   @param[in] Data         The data to write.
335 
336 **/
337 typedef
338 VOID
339 (EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_WRITE16)(
340   IN  CONST EFI_PEI_SERVICES    **PeiServices,
341   IN  CONST EFI_PEI_CPU_IO_PPI  *This,
342   IN  UINT64                    Address,
343   IN  UINT16                    Data
344   );
345 
346 /**
347   32-bit memory write operations.
348 
349   @param[in] PeiServices  An indirect pointer to the PEI Services Table published
350                           by the PEI Foundation.
351   @param[in] This         The pointer to local data for the interface.
352   @param[in] Address      The physical address of the access.
353   @param[in] Data         The data to write.
354 
355 **/
356 typedef
357 VOID
358 (EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_WRITE32)(
359   IN  CONST EFI_PEI_SERVICES    **PeiServices,
360   IN  CONST EFI_PEI_CPU_IO_PPI  *This,
361   IN  UINT64                    Address,
362   IN  UINT32                    Data
363   );
364 
365 /**
366   64-bit memory write operations.
367 
368   @param[in] PeiServices  An indirect pointer to the PEI Services Table published
369                           by the PEI Foundation.
370   @param[in] This         The pointer to local data for the interface.
371   @param[in] Address      The physical address of the access.
372   @param[in] Data         The data to write.
373 
374 **/
375 typedef
376 VOID
377 (EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_WRITE64)(
378   IN  CONST EFI_PEI_SERVICES    **PeiServices,
379   IN  CONST EFI_PEI_CPU_IO_PPI  *This,
380   IN  UINT64                    Address,
381   IN  UINT64                    Data
382   );
383 
384 ///
385 /// EFI_PEI_CPU_IO_PPI provides a set of memory and I/O-based services.
386 /// The perspective of the services is that of the processor, not that of the
387 /// bus or system.
388 ///
389 struct _EFI_PEI_CPU_IO_PPI {
390   ///
391   /// Collection of memory-access services.
392   ///
393   EFI_PEI_CPU_IO_PPI_ACCESS       Mem;
394   ///
395   /// Collection of I/O-access services.
396   ///
397   EFI_PEI_CPU_IO_PPI_ACCESS       Io;
398 
399   EFI_PEI_CPU_IO_PPI_IO_READ8     IoRead8;
400   EFI_PEI_CPU_IO_PPI_IO_READ16    IoRead16;
401   EFI_PEI_CPU_IO_PPI_IO_READ32    IoRead32;
402   EFI_PEI_CPU_IO_PPI_IO_READ64    IoRead64;
403 
404   EFI_PEI_CPU_IO_PPI_IO_WRITE8    IoWrite8;
405   EFI_PEI_CPU_IO_PPI_IO_WRITE16   IoWrite16;
406   EFI_PEI_CPU_IO_PPI_IO_WRITE32   IoWrite32;
407   EFI_PEI_CPU_IO_PPI_IO_WRITE64   IoWrite64;
408 
409   EFI_PEI_CPU_IO_PPI_MEM_READ8    MemRead8;
410   EFI_PEI_CPU_IO_PPI_MEM_READ16   MemRead16;
411   EFI_PEI_CPU_IO_PPI_MEM_READ32   MemRead32;
412   EFI_PEI_CPU_IO_PPI_MEM_READ64   MemRead64;
413 
414   EFI_PEI_CPU_IO_PPI_MEM_WRITE8   MemWrite8;
415   EFI_PEI_CPU_IO_PPI_MEM_WRITE16  MemWrite16;
416   EFI_PEI_CPU_IO_PPI_MEM_WRITE32  MemWrite32;
417   EFI_PEI_CPU_IO_PPI_MEM_WRITE64  MemWrite64;
418 };
419 
420 extern EFI_GUID gEfiPeiCpuIoPpiInstalledGuid;
421 
422 #endif
423