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
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.
16 *.h file for the driver
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
31 #include <Protocol/CpuIo.h>
33 #include <Library/BaseLib.h>
34 #include <Library/DebugLib.h>
36 #define VOLATILE volatile
41 UINT16 VOLATILE
*ui16
;
42 UINT32 VOLATILE
*ui32
;
43 UINT64 VOLATILE
*ui64
;
50 IN EFI_HANDLE ImageHandle
,
51 IN EFI_SYSTEM_TABLE
*SystemTable
57 CpuIo driver entry point.
61 ImageHandle - The firmware allocated handle for the EFI image.
62 SystemTable - A pointer to the EFI System Table.
66 EFI_SUCCESS - The driver was initialized.
67 EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of resources.
74 CpuMemoryServiceRead (
75 IN EFI_CPU_IO_PROTOCOL
*This
,
76 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
85 Perform the memory mapped I/O read service
89 This - Pointer to an instance of the CPU I/O Protocol
90 Width - Width of the memory mapped I/O operation
91 Address - Base address of the memory mapped I/O operation
92 Count - Count of the number of accesses to perform
93 Buffer - Pointer to the destination buffer to store the results
97 EFI_SUCCESS - The data was read.
98 EFI_INVALID_PARAMETER - Width is invalid.
99 EFI_INVALID_PARAMETER - Buffer is NULL.
100 EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
101 EFI_UNSUPPORTED - The address range specified by Address, Width,
102 and Count is not valid.
109 CpuMemoryServiceWrite (
110 IN EFI_CPU_IO_PROTOCOL
*This
,
111 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
120 Perform the memory mapped I/O write service
124 This - Pointer to an instance of the CPU I/O Protocol
125 Width - Width of the memory mapped I/O operation
126 Address - Base address of the memory mapped I/O operation
127 Count - Count of the number of accesses to perform
128 Buffer - Pointer to the source buffer from which to write data
132 EFI_SUCCESS - The data was written.
133 EFI_INVALID_PARAMETER - Width is invalid.
134 EFI_INVALID_PARAMETER - Buffer is NULL.
135 EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
136 EFI_UNSUPPORTED - The address range specified by Address, Width,
137 and Count is not valid.
145 IN EFI_CPU_IO_PROTOCOL
*This
,
146 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
147 IN UINT64 UserAddress
,
155 Perform the port I/O read service
159 This - Pointer to an instance of the CPU I/O Protocol
160 Width - Width of the port I/O operation
161 Address - Base address of the port I/O operation
162 Count - Count of the number of accesses to perform
163 Buffer - Pointer to the destination buffer to store the results
167 EFI_SUCCESS - The data was read.
168 EFI_INVALID_PARAMETER - Width is invalid.
169 EFI_INVALID_PARAMETER - Buffer is NULL.
170 EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
171 EFI_UNSUPPORTED - The address range specified by Address, Width,
172 and Count is not valid.
180 IN EFI_CPU_IO_PROTOCOL
*This
,
181 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
182 IN UINT64 UserAddress
,
190 Perform the port I/O write service
194 This - Pointer to an instance of the CPU I/O Protocol
195 Width - Width of the port I/O operation
196 Address - Base address of the port I/O operation
197 Count - Count of the number of accesses to perform
198 Buffer - Pointer to the source buffer from which to write data
202 EFI_SUCCESS - The data was written.
203 EFI_INVALID_PARAMETER - Width is invalid.
204 EFI_INVALID_PARAMETER - Buffer is NULL.
205 EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
206 EFI_UNSUPPORTED - The address range specified by Address, Width,
207 and Count is not valid.
213 CpuIoCheckParameter (
214 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
224 Check the validation of parameters for CPU I/O interface functions.
228 Width - Width of the Memory Access
229 Address - Address of the Memory access
230 Count - Count of the number of accesses to perform
231 Buffer - Pointer to the buffer to read from memory
232 Buffer - Memory buffer for the I/O operation
233 Limit - Maximum address supported
237 EFI_INVALID_PARAMETER - Buffer is NULL
238 EFI_UNSUPPORTED - The address range specified by Width, Address and Count is invalid
239 EFI_UNSUPPORTED - The memory buffer is not aligned
240 EFI_SUCCESS - Parameters are OK