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>
39 UINT16
volatile *ui16
;
40 UINT32
volatile *ui32
;
41 UINT64
volatile *ui64
;
48 IN EFI_HANDLE ImageHandle
,
49 IN EFI_SYSTEM_TABLE
*SystemTable
55 CpuIo driver entry point.
59 ImageHandle - The firmware allocated handle for the EFI image.
60 SystemTable - A pointer to the EFI System Table.
64 EFI_SUCCESS - The driver was initialized.
65 EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of resources.
72 CpuMemoryServiceRead (
73 IN EFI_CPU_IO_PROTOCOL
*This
,
74 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
83 Perform the memory mapped I/O read service
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
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.
107 CpuMemoryServiceWrite (
108 IN EFI_CPU_IO_PROTOCOL
*This
,
109 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
118 Perform the memory mapped I/O write service
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
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.
143 IN EFI_CPU_IO_PROTOCOL
*This
,
144 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
145 IN UINT64 UserAddress
,
153 Perform the port I/O read service
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
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.
178 IN EFI_CPU_IO_PROTOCOL
*This
,
179 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
180 IN UINT64 UserAddress
,
188 Perform the port I/O write service
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
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.
211 CpuIoCheckParameter (
212 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
,
222 Check the validation of parameters for CPU I/O interface functions.
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
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