]> git.proxmox.com Git - mirror_edk2.git/blob - DuetPkg/CpuIoDxe/CpuIo.h
Remove use of 'VOLATILE'. Use 'volatile' instead.
[mirror_edk2.git] / DuetPkg / CpuIoDxe / CpuIo.h
1 /*++
2
3 Copyright (c) 2004, Intel Corporation
4 All rights reserved. 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 CpuIo.h
14
15 Abstract:
16 *.h file for the driver
17
18 Note: the EFIAPI on the CpuIo functions is used to glue MASM (assembler) code
19 into C code. By making the MASM functions EFIAPI it ensures that a standard
20 C calling convention is assumed by the compiler, reguardless of the compiler
21 flags.
22
23
24 --*/
25
26 #ifndef _CPU_IO_H
27 #define _CPU_IO_H
28
29 #include <PiDxe.h>
30
31 #include <Protocol/CpuIo.h>
32
33 #include <Library/BaseLib.h>
34 #include <Library/DebugLib.h>
35
36 typedef union {
37 UINT8 volatile *buf;
38 UINT8 volatile *ui8;
39 UINT16 volatile *ui16;
40 UINT32 volatile *ui32;
41 UINT64 volatile *ui64;
42 UINTN volatile ui;
43 } PTR;
44
45 EFI_STATUS
46 EFIAPI
47 CpuIoInitialize (
48 IN EFI_HANDLE ImageHandle,
49 IN EFI_SYSTEM_TABLE *SystemTable
50 )
51 /*++
52
53 Routine Description:
54
55 CpuIo driver entry point.
56
57 Arguments:
58
59 ImageHandle - The firmware allocated handle for the EFI image.
60 SystemTable - A pointer to the EFI System Table.
61
62 Returns:
63
64 EFI_SUCCESS - The driver was initialized.
65 EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of resources.
66
67 --*/
68 ;
69
70 EFI_STATUS
71 EFIAPI
72 CpuMemoryServiceRead (
73 IN EFI_CPU_IO_PROTOCOL *This,
74 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
75 IN UINT64 Address,
76 IN UINTN Count,
77 OUT VOID *Buffer
78 )
79 /*++
80
81 Routine Description:
82
83 Perform the memory mapped I/O read service
84
85 Arguments:
86
87 This - Pointer to an instance of the CPU I/O Protocol
88 Width - Width of the memory mapped I/O operation
89 Address - Base address of the memory mapped I/O operation
90 Count - Count of the number of accesses to perform
91 Buffer - Pointer to the destination buffer to store the results
92
93 Returns:
94
95 EFI_SUCCESS - The data was read.
96 EFI_INVALID_PARAMETER - Width is invalid.
97 EFI_INVALID_PARAMETER - Buffer is NULL.
98 EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
99 EFI_UNSUPPORTED - The address range specified by Address, Width,
100 and Count is not valid.
101
102 --*/
103 ;
104
105 EFI_STATUS
106 EFIAPI
107 CpuMemoryServiceWrite (
108 IN EFI_CPU_IO_PROTOCOL *This,
109 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
110 IN UINT64 Address,
111 IN UINTN Count,
112 IN VOID *Buffer
113 )
114 /*++
115
116 Routine Description:
117
118 Perform the memory mapped I/O write service
119
120 Arguments:
121
122 This - Pointer to an instance of the CPU I/O Protocol
123 Width - Width of the memory mapped I/O operation
124 Address - Base address of the memory mapped I/O operation
125 Count - Count of the number of accesses to perform
126 Buffer - Pointer to the source buffer from which to write data
127
128 Returns:
129
130 EFI_SUCCESS - The data was written.
131 EFI_INVALID_PARAMETER - Width is invalid.
132 EFI_INVALID_PARAMETER - Buffer is NULL.
133 EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
134 EFI_UNSUPPORTED - The address range specified by Address, Width,
135 and Count is not valid.
136
137 --*/
138 ;
139
140 EFI_STATUS
141 EFIAPI
142 CpuIoServiceRead (
143 IN EFI_CPU_IO_PROTOCOL *This,
144 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
145 IN UINT64 UserAddress,
146 IN UINTN Count,
147 OUT VOID *UserBuffer
148 )
149 /*++
150
151 Routine Description:
152
153 Perform the port I/O read service
154
155 Arguments:
156
157 This - Pointer to an instance of the CPU I/O Protocol
158 Width - Width of the port I/O operation
159 Address - Base address of the port I/O operation
160 Count - Count of the number of accesses to perform
161 Buffer - Pointer to the destination buffer to store the results
162
163 Returns:
164
165 EFI_SUCCESS - The data was read.
166 EFI_INVALID_PARAMETER - Width is invalid.
167 EFI_INVALID_PARAMETER - Buffer is NULL.
168 EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
169 EFI_UNSUPPORTED - The address range specified by Address, Width,
170 and Count is not valid.
171
172 --*/
173 ;
174
175 EFI_STATUS
176 EFIAPI
177 CpuIoServiceWrite (
178 IN EFI_CPU_IO_PROTOCOL *This,
179 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
180 IN UINT64 UserAddress,
181 IN UINTN Count,
182 IN VOID *UserBuffer
183 )
184 /*++
185
186 Routine Description:
187
188 Perform the port I/O write service
189
190 Arguments:
191
192 This - Pointer to an instance of the CPU I/O Protocol
193 Width - Width of the port I/O operation
194 Address - Base address of the port I/O operation
195 Count - Count of the number of accesses to perform
196 Buffer - Pointer to the source buffer from which to write data
197
198 Returns:
199
200 EFI_SUCCESS - The data was written.
201 EFI_INVALID_PARAMETER - Width is invalid.
202 EFI_INVALID_PARAMETER - Buffer is NULL.
203 EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
204 EFI_UNSUPPORTED - The address range specified by Address, Width,
205 and Count is not valid.
206
207 --*/
208 ;
209
210 EFI_STATUS
211 CpuIoCheckParameter (
212 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
213 IN UINT64 Address,
214 IN UINTN Count,
215 IN VOID *Buffer,
216 IN UINT64 Limit
217 )
218 /*++
219
220 Routine Description:
221
222 Check the validation of parameters for CPU I/O interface functions.
223
224 Arguments:
225
226 Width - Width of the Memory Access
227 Address - Address of the Memory access
228 Count - Count of the number of accesses to perform
229 Buffer - Pointer to the buffer to read from memory
230 Buffer - Memory buffer for the I/O operation
231 Limit - Maximum address supported
232
233 Returns:
234
235 EFI_INVALID_PARAMETER - Buffer is NULL
236 EFI_UNSUPPORTED - The address range specified by Width, Address and Count is invalid
237 EFI_UNSUPPORTED - The memory buffer is not aligned
238 EFI_SUCCESS - Parameters are OK
239
240 --*/
241 ;
242
243 #endif