2 The header file for EFI_ISA_IO protocol implementation.
4 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _INTERNAL_ISA_IO_H_
16 #define _INTERNAL_ISA_IO_H_
18 #include "InternalIsaBus.h"
21 // Bits definition of PcdIsaBusSupportedFeatures
23 #define PCD_ISA_BUS_SUPPORT_DMA BIT0
24 #define PCD_ISA_BUS_ONLY_SUPPORT_SLAVE_DMA BIT1
25 #define PCD_ISA_BUS_SUPPORT_ISA_MEMORY BIT2
28 // ISA I/O Support Function Prototypes
32 Verifies access to an ISA device
34 @param[in] IsaIoDevice The ISA device to be verified.
35 @param[in] Type The Access type. The input must be either IsaAccessTypeMem or IsaAccessTypeIo.
36 @param[in] Width The width of the memory operation.
37 @param[in] Count The number of memory operations to perform.
38 @param[in] Offset The offset in ISA memory space to start the memory operation.
40 @retval EFI_SUCCESS Verify success.
41 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
42 @retval EFI_UNSUPPORTED The device ont support the access type.
46 IN ISA_IO_DEVICE
*IsaIoDevice
,
47 IN ISA_ACCESS_TYPE Type
,
48 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
54 Performs an ISA I/O Read Cycle
56 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
57 @param[in] Width Specifies the width of the I/O operation.
58 @param[in] Offset The offset in ISA I/O space to start the I/O operation.
59 @param[in] Count The number of I/O operations to perform.
60 @param[out] Buffer The destination buffer to store the results
62 @retval EFI_SUCCESS The data was read from the device sucessfully.
63 @retval EFI_UNSUPPORTED The Offset is not valid for this device.
64 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
65 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
70 IN EFI_ISA_IO_PROTOCOL
*This
,
71 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
78 Performs an ISA I/O Write Cycle
80 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
81 @param[in] Width Specifies the width of the I/O operation.
82 @param[in] Offset The offset in ISA I/O space to start the I/O operation.
83 @param[in] Count The number of I/O operations to perform.
84 @param[in] Buffer The source buffer to write data from
86 @retval EFI_SUCCESS The data was writen to the device sucessfully.
87 @retval EFI_UNSUPPORTED The Offset is not valid for this device.
88 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
89 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
94 IN EFI_ISA_IO_PROTOCOL
*This
,
95 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
102 Maps a memory region for DMA
104 @param This A pointer to the EFI_ISA_IO_PROTOCOL instance.
105 @param Operation Indicates the type of DMA (slave or bus master), and if
106 the DMA operation is going to read or write to system memory.
107 @param ChannelNumber The slave channel number to use for this DMA operation.
108 If Operation and ChannelAttributes shows that this device
109 performs bus mastering DMA, then this field is ignored.
110 The legal range for this field is 0..7.
111 @param ChannelAttributes The attributes of the DMA channel to use for this DMA operation
112 @param HostAddress The system memory address to map to the device.
113 @param NumberOfBytes On input the number of bytes to map. On output the number
114 of bytes that were mapped.
115 @param DeviceAddress The resulting map address for the bus master device to use
116 to access the hosts HostAddress.
117 @param Mapping A resulting value to pass to EFI_ISA_IO.Unmap().
119 @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
120 @retval EFI_INVALID_PARAMETER The Operation or HostAddress is undefined.
121 @retval EFI_UNSUPPORTED The HostAddress can not be mapped as a common buffer.
122 @retval EFI_DEVICE_ERROR The system hardware could not map the requested address.
123 @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
128 IN EFI_ISA_IO_PROTOCOL
*This
,
129 IN EFI_ISA_IO_PROTOCOL_OPERATION Operation
,
130 IN UINT8 ChannelNumber OPTIONAL
,
131 IN UINT32 ChannelAttributes
,
132 IN VOID
*HostAddress
,
133 IN OUT UINTN
*NumberOfBytes
,
134 OUT EFI_PHYSICAL_ADDRESS
*DeviceAddress
,
139 Unmaps a memory region for DMA
141 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
142 @param[in] Mapping The mapping value returned from EFI_ISA_IO.Map().
144 @retval EFI_SUCCESS The range was unmapped.
145 @retval EFI_DEVICE_ERROR The data was not committed to the target system memory.
150 IN EFI_ISA_IO_PROTOCOL
*This
,
155 Flushes any posted write data to the system memory.
157 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
159 @retval EFI_SUCCESS The buffers were flushed.
160 @retval EFI_DEVICE_ERROR The buffers were not flushed due to a hardware error.
165 IN EFI_ISA_IO_PROTOCOL
*This
169 Writes I/O operation base address and count number to a 8 bit I/O Port.
171 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
172 @param[in] AddrOffset The address' offset.
173 @param[in] PageOffset The page's offest.
174 @param[in] CountOffset The count's offset.
175 @param[in] BaseAddress The base address.
176 @param[in] Count The number of I/O operations to perform.
178 @retval EFI_SUCCESS Success.
179 @retval EFI_INVALID_PARAMETER Parameter is invalid.
180 @retval EFI_UNSUPPORTED The address range specified by these Offsets and Count is not valid.
181 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
185 IN EFI_ISA_IO_PROTOCOL
*This
,
186 IN UINT32 AddrOffset
,
187 IN UINT32 PageOffset
,
188 IN UINT32 CountOffset
,
189 IN UINT32 BaseAddress
,
194 Writes an 8-bit I/O Port
196 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
197 @param[in] Offset The offset in ISA IO space to start the IO operation.
198 @param[in] Value The data to write port.
200 @retval EFI_SUCCESS Success.
201 @retval EFI_INVALID_PARAMETER Parameter is invalid.
202 @retval EFI_UNSUPPORTED The address range specified by Offset is not valid.
203 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
207 IN EFI_ISA_IO_PROTOCOL
*This
,
213 Performs an ISA Memory Read Cycle
215 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
216 @param[in] Width Specifies the width of the memory operation.
217 @param[in] Offset The offset in ISA memory space to start the memory operation.
218 @param[in] Count The number of memory operations to perform.
219 @param[out] Buffer The destination buffer to store the results
221 @retval EFI_SUCCESS The data was read from the device successfully.
222 @retval EFI_UNSUPPORTED The Offset is not valid for this device.
223 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
224 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
229 IN EFI_ISA_IO_PROTOCOL
*This
,
230 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
238 Performs an ISA Memory Write Cycle
240 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
241 @param[in] Width Specifies the width of the memory operation.
242 @param[in] Offset The offset in ISA memory space to start the memory operation.
243 @param[in] Count The number of memory operations to perform.
244 @param[in] Buffer The source buffer to write data from
246 @retval EFI_SUCCESS The data was written to the device sucessfully.
247 @retval EFI_UNSUPPORTED The Offset is not valid for this device.
248 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
249 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
254 IN EFI_ISA_IO_PROTOCOL
*This
,
255 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
262 Copy one region of ISA memory space to another region of ISA memory space on the ISA controller.
264 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
265 @param[in] Width Specifies the width of the memory copy operation.
266 @param[in] DestOffset The offset of the destination
267 @param[in] SrcOffset The offset of the source
268 @param[in] Count The number of memory copy operations to perform
270 @retval EFI_SUCCESS The data was copied sucessfully.
271 @retval EFI_UNSUPPORTED The DestOffset or SrcOffset is not valid for this device.
272 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
273 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
278 IN EFI_ISA_IO_PROTOCOL
*This
,
279 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
280 IN UINT32 DestOffset
,
286 Allocates pages that are suitable for an EfiIsaIoOperationBusMasterCommonBuffer mapping.
288 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
289 @param[in] Type The type allocation to perform.
290 @param[in] MemoryType The type of memory to allocate.
291 @param[in] Pages The number of pages to allocate.
292 @param[out] HostAddress A pointer to store the base address of the allocated range.
293 @param[in] Attributes The requested bit mask of attributes for the allocated range.
295 @retval EFI_SUCCESS The requested memory pages were allocated.
296 @retval EFI_INVALID_PARAMETER Type is invalid or MemoryType is invalid or HostAddress is NULL
297 @retval EFI_UNSUPPORTED Attributes is unsupported or the memory range specified
298 by HostAddress, Pages, and Type is not available for common buffer use.
299 @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
303 IsaIoAllocateBuffer (
304 IN EFI_ISA_IO_PROTOCOL
*This
,
305 IN EFI_ALLOCATE_TYPE Type
,
306 IN EFI_MEMORY_TYPE MemoryType
,
308 OUT VOID
**HostAddress
,
313 Frees memory that was allocated with EFI_ISA_IO.AllocateBuffer().
315 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
316 @param[in] Pages The number of pages to free.
317 @param[in] HostAddress The base address of the allocated range.
319 @retval EFI_SUCCESS The requested memory pages were freed.
320 @retval EFI_INVALID_PARAMETER The memory was not allocated with EFI_ISA_IO.AllocateBufer().
325 IN EFI_ISA_IO_PROTOCOL
*This
,