1 /*++
2 
3 Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution.  The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8 
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 
12 Module Name:
13 
14   CpuIo.h
15 
16 Abstract:
17 
18   CPU IO PPI defined in Tiano
19   CPU IO PPI abstracts CPU IO access
20 
21 
22 --*/
23 
24 #ifndef _PEI_CPUIO_PPI_H_
25 #define _PEI_CPUIO_PPI_H_
26 
27 #define PEI_CPU_IO_PPI_GUID \
28   { \
29     0xe6af1f7b, 0xfc3f, 0x46da, {0xa8, 0x28, 0xa3, 0xb4, 0x57, 0xa4, 0x42, 0x82} \
30   }
31 
32 EFI_FORWARD_DECLARATION (PEI_CPU_IO_PPI);
33 
34 //
35 // *******************************************************
36 // PEI_CPU_IO_PPI_WIDTH
37 // *******************************************************
38 //
39 typedef enum {
40   PeiCpuIoWidthUint8,
41   PeiCpuIoWidthUint16,
42   PeiCpuIoWidthUint32,
43   PeiCpuIoWidthUint64,
44   PeiCpuIoWidthFifoUint8,
45   PeiCpuIoWidthFifoUint16,
46   PeiCpuIoWidthFifoUint32,
47   PeiCpuIoWidthFifoUint64,
48   PeiCpuIoWidthFillUint8,
49   PeiCpuIoWidthFillUint16,
50   PeiCpuIoWidthFillUint32,
51   PeiCpuIoWidthFillUint64,
52   PeiCpuIoWidthMaximum
53 } PEI_CPU_IO_PPI_WIDTH;
54 
55 //
56 // *******************************************************
57 // PEI_CPU_IO_PPI_IO_MEM
58 // *******************************************************
59 //
60 typedef
61 EFI_STATUS
62 (EFIAPI *PEI_CPU_IO_PPI_IO_MEM) (
63   IN  EFI_PEI_SERVICES                  **PeiServices,
64   IN PEI_CPU_IO_PPI                     * This,
65   IN  PEI_CPU_IO_PPI_WIDTH              Width,
66   IN  UINT64                            Address,
67   IN  UINTN                             Count,
68   IN  OUT VOID                          *Buffer
69   );
70 
71 //
72 // *******************************************************
73 // PEI_CPU_IO_PPI_ACCESS
74 // *******************************************************
75 //
76 typedef struct {
77   PEI_CPU_IO_PPI_IO_MEM Read;
78   PEI_CPU_IO_PPI_IO_MEM Write;
79 } PEI_CPU_IO_PPI_ACCESS;
80 
81 //
82 // *******************************************************
83 // Base IO Class Functions
84 // *******************************************************
85 //
86 typedef
87 UINT8
88 (EFIAPI *PEI_CPU_IO_PPI_IO_READ8) (
89   IN  EFI_PEI_SERVICES        **PeiServices,
90   IN PEI_CPU_IO_PPI           * This,
91   IN  UINT64                  Address
92   );
93 
94 typedef
95 UINT16
96 (EFIAPI *PEI_CPU_IO_PPI_IO_READ16) (
97   IN  EFI_PEI_SERVICES        **PeiServices,
98   IN PEI_CPU_IO_PPI           * This,
99   IN  UINT64                  Address
100   );
101 
102 typedef
103 UINT32
104 (EFIAPI *PEI_CPU_IO_PPI_IO_READ32) (
105   IN  EFI_PEI_SERVICES        **PeiServices,
106   IN PEI_CPU_IO_PPI           * This,
107   IN  UINT64                  Address
108   );
109 
110 typedef
111 UINT64
112 (EFIAPI *PEI_CPU_IO_PPI_IO_READ64) (
113   IN  EFI_PEI_SERVICES        **PeiServices,
114   IN PEI_CPU_IO_PPI           * This,
115   IN  UINT64                  Address
116   );
117 
118 typedef
119 VOID
120 (EFIAPI *PEI_CPU_IO_PPI_IO_WRITE8) (
121   IN  EFI_PEI_SERVICES        **PeiServices,
122   IN PEI_CPU_IO_PPI           * This,
123   IN  UINT64                  Address,
124   IN  UINT8                   Data
125   );
126 
127 typedef
128 VOID
129 (EFIAPI *PEI_CPU_IO_PPI_IO_WRITE16) (
130   IN  EFI_PEI_SERVICES        **PeiServices,
131   IN PEI_CPU_IO_PPI           * This,
132   IN  UINT64                  Address,
133   IN  UINT16                  Data
134   );
135 
136 typedef
137 VOID
138 (EFIAPI *PEI_CPU_IO_PPI_IO_WRITE32) (
139   IN  EFI_PEI_SERVICES        **PeiServices,
140   IN PEI_CPU_IO_PPI           * This,
141   IN  UINT64                  Address,
142   IN  UINT32                  Data
143   );
144 
145 typedef
146 VOID
147 (EFIAPI *PEI_CPU_IO_PPI_IO_WRITE64) (
148   IN  EFI_PEI_SERVICES        **PeiServices,
149   IN PEI_CPU_IO_PPI           * This,
150   IN  UINT64                  Address,
151   IN  UINT64                  Data
152   );
153 
154 typedef
155 UINT8
156 (EFIAPI *PEI_CPU_IO_PPI_MEM_READ8) (
157   IN  EFI_PEI_SERVICES        **PeiServices,
158   IN PEI_CPU_IO_PPI           * This,
159   IN  UINT64                  Address
160   );
161 
162 typedef
163 UINT16
164 (EFIAPI *PEI_CPU_IO_PPI_MEM_READ16) (
165   IN  EFI_PEI_SERVICES        **PeiServices,
166   IN PEI_CPU_IO_PPI           * This,
167   IN  UINT64                  Address
168   );
169 
170 typedef
171 UINT32
172 (EFIAPI *PEI_CPU_IO_PPI_MEM_READ32) (
173   IN  EFI_PEI_SERVICES        **PeiServices,
174   IN PEI_CPU_IO_PPI           * This,
175   IN  UINT64                  Address
176   );
177 
178 typedef
179 UINT64
180 (EFIAPI *PEI_CPU_IO_PPI_MEM_READ64) (
181   IN  EFI_PEI_SERVICES        **PeiServices,
182   IN PEI_CPU_IO_PPI           * This,
183   IN  UINT64                  Address
184   );
185 
186 typedef
187 VOID
188 (EFIAPI *PEI_CPU_IO_PPI_MEM_WRITE8) (
189   IN  EFI_PEI_SERVICES        **PeiServices,
190   IN PEI_CPU_IO_PPI           * This,
191   IN  UINT64                  Address,
192   IN  UINT8                   Data
193   );
194 
195 typedef
196 VOID
197 (EFIAPI *PEI_CPU_IO_PPI_MEM_WRITE16) (
198   IN  EFI_PEI_SERVICES        **PeiServices,
199   IN PEI_CPU_IO_PPI           * This,
200   IN  UINT64                  Address,
201   IN  UINT16                  Data
202   );
203 
204 typedef
205 VOID
206 (EFIAPI *PEI_CPU_IO_PPI_MEM_WRITE32) (
207   IN  EFI_PEI_SERVICES        **PeiServices,
208   IN PEI_CPU_IO_PPI           * This,
209   IN  UINT64                  Address,
210   IN  UINT32                  Data
211   );
212 
213 typedef
214 VOID
215 (EFIAPI *PEI_CPU_IO_PPI_MEM_WRITE64) (
216   IN  EFI_PEI_SERVICES        **PeiServices,
217   IN PEI_CPU_IO_PPI           * This,
218   IN  UINT64                  Address,
219   IN  UINT64                  Data
220   );
221 
222 //
223 // *******************************************************
224 // PEI_CPU_IO_PPI
225 // *******************************************************
226 //
227 struct _PEI_CPU_IO_PPI {
228   PEI_CPU_IO_PPI_ACCESS       Mem;
229   PEI_CPU_IO_PPI_ACCESS       Io;
230   PEI_CPU_IO_PPI_IO_READ8     IoRead8;
231   PEI_CPU_IO_PPI_IO_READ16    IoRead16;
232   PEI_CPU_IO_PPI_IO_READ32    IoRead32;
233   PEI_CPU_IO_PPI_IO_READ64    IoRead64;
234   PEI_CPU_IO_PPI_IO_WRITE8    IoWrite8;
235   PEI_CPU_IO_PPI_IO_WRITE16   IoWrite16;
236   PEI_CPU_IO_PPI_IO_WRITE32   IoWrite32;
237   PEI_CPU_IO_PPI_IO_WRITE64   IoWrite64;
238   PEI_CPU_IO_PPI_MEM_READ8    MemRead8;
239   PEI_CPU_IO_PPI_MEM_READ16   MemRead16;
240   PEI_CPU_IO_PPI_MEM_READ32   MemRead32;
241   PEI_CPU_IO_PPI_MEM_READ64   MemRead64;
242   PEI_CPU_IO_PPI_MEM_WRITE8   MemWrite8;
243   PEI_CPU_IO_PPI_MEM_WRITE16  MemWrite16;
244   PEI_CPU_IO_PPI_MEM_WRITE32  MemWrite32;
245   PEI_CPU_IO_PPI_MEM_WRITE64  MemWrite64;
246 };
247 
248 extern EFI_GUID gPeiCpuIoPpiInServiceTableGuid;
249 
250 #endif
251