2 The header file for EFI_ISA_IO protocol implementation.
4 Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #include "IsaDriver.h"
15 // Bits definition of PcdIsaBusSupportedFeatures
17 #define PCD_ISA_BUS_SUPPORT_DMA BIT0
18 #define PCD_ISA_BUS_ONLY_SUPPORT_SLAVE_DMA BIT1
19 #define PCD_ISA_BUS_SUPPORT_ISA_MEMORY BIT2
22 // ISA I/O Support Function Prototypes
26 Verifies access to an ISA device
28 @param[in] IsaIoDevice The ISA device to be verified.
29 @param[in] Type The Access type. The input must be either IsaAccessTypeMem or IsaAccessTypeIo.
30 @param[in] Width The width of the memory operation.
31 @param[in] Count The number of memory operations to perform.
32 @param[in] Offset The offset in ISA memory space to start the memory operation.
34 @retval EFI_SUCCESS Verify success.
35 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
36 @retval EFI_UNSUPPORTED The device ont support the access type.
40 IN ISA_IO_DEVICE
*IsaIoDevice
,
41 IN ISA_ACCESS_TYPE Type
,
42 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
48 Performs an ISA I/O Read Cycle
50 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
51 @param[in] Width Specifies the width of the I/O operation.
52 @param[in] Offset The offset in ISA I/O space to start the I/O operation.
53 @param[in] Count The number of I/O operations to perform.
54 @param[out] Buffer The destination buffer to store the results
56 @retval EFI_SUCCESS The data was read from the device sucessfully.
57 @retval EFI_UNSUPPORTED The Offset is not valid for this device.
58 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
59 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
64 IN EFI_ISA_IO_PROTOCOL
*This
,
65 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
72 Performs an ISA I/O Write Cycle
74 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
75 @param[in] Width Specifies the width of the I/O operation.
76 @param[in] Offset The offset in ISA I/O space to start the I/O operation.
77 @param[in] Count The number of I/O operations to perform.
78 @param[in] Buffer The source buffer to write data from
80 @retval EFI_SUCCESS The data was writen to the device sucessfully.
81 @retval EFI_UNSUPPORTED The Offset is not valid for this device.
82 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
83 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
88 IN EFI_ISA_IO_PROTOCOL
*This
,
89 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
96 Maps a memory region for DMA
98 @param This A pointer to the EFI_ISA_IO_PROTOCOL instance.
99 @param Operation Indicates the type of DMA (slave or bus master), and if
100 the DMA operation is going to read or write to system memory.
101 @param ChannelNumber The slave channel number to use for this DMA operation.
102 If Operation and ChannelAttributes shows that this device
103 performs bus mastering DMA, then this field is ignored.
104 The legal range for this field is 0..7.
105 @param ChannelAttributes The attributes of the DMA channel to use for this DMA operation
106 @param HostAddress The system memory address to map to the device.
107 @param NumberOfBytes On input the number of bytes to map. On output the number
108 of bytes that were mapped.
109 @param DeviceAddress The resulting map address for the bus master device to use
110 to access the hosts HostAddress.
111 @param Mapping A resulting value to pass to EFI_ISA_IO.Unmap().
113 @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
114 @retval EFI_INVALID_PARAMETER The Operation or HostAddress is undefined.
115 @retval EFI_UNSUPPORTED The HostAddress can not be mapped as a common buffer.
116 @retval EFI_DEVICE_ERROR The system hardware could not map the requested address.
117 @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
122 IN EFI_ISA_IO_PROTOCOL
*This
,
123 IN EFI_ISA_IO_PROTOCOL_OPERATION Operation
,
124 IN UINT8 ChannelNumber OPTIONAL
,
125 IN UINT32 ChannelAttributes
,
126 IN VOID
*HostAddress
,
127 IN OUT UINTN
*NumberOfBytes
,
128 OUT EFI_PHYSICAL_ADDRESS
*DeviceAddress
,
133 Unmaps a memory region for DMA
135 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
136 @param[in] Mapping The mapping value returned from EFI_ISA_IO.Map().
138 @retval EFI_SUCCESS The range was unmapped.
139 @retval EFI_DEVICE_ERROR The data was not committed to the target system memory.
144 IN EFI_ISA_IO_PROTOCOL
*This
,
149 Flushes any posted write data to the system memory.
151 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
153 @retval EFI_SUCCESS The buffers were flushed.
154 @retval EFI_DEVICE_ERROR The buffers were not flushed due to a hardware error.
159 IN EFI_ISA_IO_PROTOCOL
*This
163 Writes I/O operation base address and count number to a 8 bit I/O Port.
165 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
166 @param[in] AddrOffset The address' offset.
167 @param[in] PageOffset The page's offest.
168 @param[in] CountOffset The count's offset.
169 @param[in] BaseAddress The base address.
170 @param[in] Count The number of I/O operations to perform.
172 @retval EFI_SUCCESS Success.
173 @retval EFI_INVALID_PARAMETER Parameter is invalid.
174 @retval EFI_UNSUPPORTED The address range specified by these Offsets and Count is not valid.
175 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
179 IN EFI_ISA_IO_PROTOCOL
*This
,
180 IN UINT32 AddrOffset
,
181 IN UINT32 PageOffset
,
182 IN UINT32 CountOffset
,
183 IN UINT32 BaseAddress
,
188 Writes an 8-bit I/O Port
190 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
191 @param[in] Offset The offset in ISA IO space to start the IO operation.
192 @param[in] Value The data to write port.
194 @retval EFI_SUCCESS Success.
195 @retval EFI_INVALID_PARAMETER Parameter is invalid.
196 @retval EFI_UNSUPPORTED The address range specified by Offset is not valid.
197 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
201 IN EFI_ISA_IO_PROTOCOL
*This
,
207 Performs an ISA Memory Read Cycle
209 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
210 @param[in] Width Specifies the width of the memory operation.
211 @param[in] Offset The offset in ISA memory space to start the memory operation.
212 @param[in] Count The number of memory operations to perform.
213 @param[out] Buffer The destination buffer to store the results
215 @retval EFI_SUCCESS The data was read from the device successfully.
216 @retval EFI_UNSUPPORTED The Offset is not valid for this device.
217 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
218 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
223 IN EFI_ISA_IO_PROTOCOL
*This
,
224 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
232 Performs an ISA Memory Write Cycle
234 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
235 @param[in] Width Specifies the width of the memory operation.
236 @param[in] Offset The offset in ISA memory space to start the memory operation.
237 @param[in] Count The number of memory operations to perform.
238 @param[in] Buffer The source buffer to write data from
240 @retval EFI_SUCCESS The data was written to the device sucessfully.
241 @retval EFI_UNSUPPORTED The Offset is not valid for this device.
242 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
243 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
248 IN EFI_ISA_IO_PROTOCOL
*This
,
249 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
256 Copy one region of ISA memory space to another region of ISA memory space on the ISA controller.
258 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
259 @param[in] Width Specifies the width of the memory copy operation.
260 @param[in] DestOffset The offset of the destination
261 @param[in] SrcOffset The offset of the source
262 @param[in] Count The number of memory copy operations to perform
264 @retval EFI_SUCCESS The data was copied sucessfully.
265 @retval EFI_UNSUPPORTED The DestOffset or SrcOffset is not valid for this device.
266 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
267 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
272 IN EFI_ISA_IO_PROTOCOL
*This
,
273 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
274 IN UINT32 DestOffset
,
280 Allocates pages that are suitable for an EfiIsaIoOperationBusMasterCommonBuffer mapping.
282 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
283 @param[in] Type The type allocation to perform.
284 @param[in] MemoryType The type of memory to allocate.
285 @param[in] Pages The number of pages to allocate.
286 @param[out] HostAddress A pointer to store the base address of the allocated range.
287 @param[in] Attributes The requested bit mask of attributes for the allocated range.
289 @retval EFI_SUCCESS The requested memory pages were allocated.
290 @retval EFI_INVALID_PARAMETER Type is invalid or MemoryType is invalid or HostAddress is NULL
291 @retval EFI_UNSUPPORTED Attributes is unsupported or the memory range specified
292 by HostAddress, Pages, and Type is not available for common buffer use.
293 @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
297 IsaIoAllocateBuffer (
298 IN EFI_ISA_IO_PROTOCOL
*This
,
299 IN EFI_ALLOCATE_TYPE Type
,
300 IN EFI_MEMORY_TYPE MemoryType
,
302 OUT VOID
**HostAddress
,
307 Frees memory that was allocated with EFI_ISA_IO.AllocateBuffer().
309 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.
310 @param[in] Pages The number of pages to free.
311 @param[in] HostAddress The base address of the allocated range.
313 @retval EFI_SUCCESS The requested memory pages were freed.
314 @retval EFI_INVALID_PARAMETER The memory was not allocated with EFI_ISA_IO.AllocateBufer().
319 IN EFI_ISA_IO_PROTOCOL
*This
,