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>
35 #include <Library/IoLib.h>
40 UINT16
volatile *ui16
;
41 UINT32
volatile *ui32
;
42 UINT64
volatile *ui64
;
49 IN EFI_HANDLE ImageHandle
,
50 IN EFI_SYSTEM_TABLE
*SystemTable
56 CpuIo driver entry point.
60 ImageHandle - The firmware allocated handle for the EFI image.
61 SystemTable - A pointer to the EFI System Table.
65 EFI_SUCCESS - The driver was initialized.
66 EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of resources.
73 CpuMemoryServiceRead (
74 IN EFI_CPU_IO_PROTOCOL
*This
,
75 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
84 Perform the memory mapped I/O read service
88 This - Pointer to an instance of the CPU I/O Protocol
89 Width - Width of the memory mapped I/O operation
90 Address - Base address of the memory mapped I/O operation
91 Count - Count of the number of accesses to perform
92 Buffer - Pointer to the destination buffer to store the results
96 EFI_SUCCESS - The data was read.
97 EFI_INVALID_PARAMETER - Width is invalid.
98 EFI_INVALID_PARAMETER - Buffer is NULL.
99 EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
100 EFI_UNSUPPORTED - The address range specified by Address, Width,
101 and Count is not valid.
108 CpuMemoryServiceWrite (
109 IN EFI_CPU_IO_PROTOCOL
*This
,
110 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
119 Perform the memory mapped I/O write service
123 This - Pointer to an instance of the CPU I/O Protocol
124 Width - Width of the memory mapped I/O operation
125 Address - Base address of the memory mapped I/O operation
126 Count - Count of the number of accesses to perform
127 Buffer - Pointer to the source buffer from which to write data
131 EFI_SUCCESS - The data was written.
132 EFI_INVALID_PARAMETER - Width is invalid.
133 EFI_INVALID_PARAMETER - Buffer is NULL.
134 EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
135 EFI_UNSUPPORTED - The address range specified by Address, Width,
136 and Count is not valid.
144 IN EFI_CPU_IO_PROTOCOL
*This
,
145 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
146 IN UINT64 UserAddress
,
154 Perform the port I/O read service
158 This - Pointer to an instance of the CPU I/O Protocol
159 Width - Width of the port I/O operation
160 Address - Base address of the port I/O operation
161 Count - Count of the number of accesses to perform
162 Buffer - Pointer to the destination buffer to store the results
166 EFI_SUCCESS - The data was read.
167 EFI_INVALID_PARAMETER - Width is invalid.
168 EFI_INVALID_PARAMETER - Buffer is NULL.
169 EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
170 EFI_UNSUPPORTED - The address range specified by Address, Width,
171 and Count is not valid.
179 IN EFI_CPU_IO_PROTOCOL
*This
,
180 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
181 IN UINT64 UserAddress
,
189 Perform the port I/O write service
193 This - Pointer to an instance of the CPU I/O Protocol
194 Width - Width of the port I/O operation
195 Address - Base address of the port I/O operation
196 Count - Count of the number of accesses to perform
197 Buffer - Pointer to the source buffer from which to write data
201 EFI_SUCCESS - The data was written.
202 EFI_INVALID_PARAMETER - Width is invalid.
203 EFI_INVALID_PARAMETER - Buffer is NULL.
204 EFI_UNSUPPORTED - The Buffer is not aligned for the given Width.
205 EFI_UNSUPPORTED - The address range specified by Address, Width,
206 and Count is not valid.
212 CpuIoCheckParameter (
213 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
223 Check the validation of parameters for CPU I/O interface functions.
227 Width - Width of the Memory Access
228 Address - Address of the Memory access
229 Count - Count of the number of accesses to perform
230 Buffer - Pointer to the buffer to read from memory
231 Buffer - Memory buffer for the I/O operation
232 Limit - Maximum address supported
236 EFI_INVALID_PARAMETER - Buffer is NULL
237 EFI_UNSUPPORTED - The address range specified by Width, Address and Count is invalid
238 EFI_UNSUPPORTED - The memory buffer is not aligned
239 EFI_SUCCESS - Parameters are OK