2 ISA I/O Protocol is used to perform ISA device Io/Mem operations.
4 Copyright (c) 2006 - 2009, Intel Corporation
5 All rights reserved. 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 _EFI_ISA_IO_H_
16 #define _EFI_ISA_IO_H_
19 #include <Protocol/IsaAcpi.h>
22 // Global GUID for the ISA I/O Protocol
24 #define EFI_ISA_IO_PROTOCOL_GUID \
25 { 0x7ee2bd44, 0x3da0, 0x11d4, { 0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }
27 typedef struct _EFI_ISA_IO_PROTOCOL EFI_ISA_IO_PROTOCOL
;
30 // Width of ISA Io/Mem operation
36 EfiIsaIoWidthReserved
,
37 EfiIsaIoWidthFifoUint8
,
38 EfiIsaIoWidthFifoUint16
,
39 EfiIsaIoWidthFifoUint32
,
40 EfiIsaIoWidthFifoReserved
,
41 EfiIsaIoWidthFillUint8
,
42 EfiIsaIoWidthFillUint16
,
43 EfiIsaIoWidthFillUint32
,
44 EfiIsaIoWidthFillReserved
,
46 } EFI_ISA_IO_PROTOCOL_WIDTH
;
49 // Attributes for common buffer allocations
51 #define EFI_ISA_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x080 ///< Map a memory range so write are combined
52 #define EFI_ISA_IO_ATTRIBUTE_MEMORY_CACHED 0x800 ///< Map a memory range so all r/w accesses are cached
53 #define EFI_ISA_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 ///< Disable a memory range
56 // Channel attribute for DMA operations
58 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_COMPATIBLE 0x001
59 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_A 0x002
60 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_B 0x004
61 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_C 0x008
62 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_8 0x010
63 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_16 0x020
64 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SINGLE_MODE 0x040
65 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_DEMAND_MODE 0x080
66 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_AUTO_INITIALIZE 0x100
69 EfiIsaIoOperationBusMasterRead
,
70 EfiIsaIoOperationBusMasterWrite
,
71 EfiIsaIoOperationBusMasterCommonBuffer
,
72 EfiIsaIoOperationSlaveRead
,
73 EfiIsaIoOperationSlaveWrite
,
74 EfiIsaIoOperationMaximum
75 } EFI_ISA_IO_PROTOCOL_OPERATION
;
78 Performs an ISA Io/Memory Read/Write Cycle
80 @param This A pointer to the EFI_ISA_IO_PROTOCOL instance.
81 @param Width Signifies the width of the Io/Memory operation.
82 @param Offset The offset in ISA Io/Memory space to start the Io/Memory operation.
83 @param Count The number of Io/Memory operations to perform.
84 @param Buffer [OUT] The destination buffer to store the results.
85 [IN] The source buffer to write data to the device.
87 @retval EFI_SUCCESS The data was read from / written to the device sucessfully.
88 @retval EFI_UNSUPPORTED The Offset is not valid for this device.
89 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
90 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
95 (EFIAPI
*EFI_ISA_IO_PROTOCOL_IO_MEM
) (
96 IN EFI_ISA_IO_PROTOCOL
*This
,
97 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
104 EFI_ISA_IO_PROTOCOL_IO_MEM Read
;
105 EFI_ISA_IO_PROTOCOL_IO_MEM Write
;
106 } EFI_ISA_IO_PROTOCOL_ACCESS
;
109 Performs an ISA I/O Copy Memory
111 @param This A pointer to the EFI_ISA_IO_PROTOCOL instance.
112 @param Width Signifies the width of the memory copy operation.
113 @param DestOffset The offset of the destination
114 @param SrcOffset The offset of the source
115 @param Count The number of memory copy operations to perform
117 @retval EFI_SUCCESS The data was copied sucessfully.
118 @retval EFI_UNSUPPORTED The DestOffset or SrcOffset is not valid for this device.
119 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
120 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
125 (EFIAPI
*EFI_ISA_IO_PROTOCOL_COPY_MEM
) (
126 IN EFI_ISA_IO_PROTOCOL
*This
,
127 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
128 IN UINT32 DestOffset
,
134 Maps a memory region for DMA
136 @param This A pointer to the EFI_ISA_IO_PROTOCOL instance.
137 @param Operation Indicates the type of DMA (slave or bus master), and if
138 the DMA operation is going to read or write to system memory.
139 @param ChannelNumber The slave channel number to use for this DMA operation.
140 If Operation and ChannelAttributes shows that this device
141 performs bus mastering DMA, then this field is ignored.
142 The legal range for this field is 0..7.
143 @param ChannelAttributes The attributes of the DMA channel to use for this DMA operation
144 @param HostAddress The system memory address to map to the device.
145 @param NumberOfBytes On input the number of bytes to map. On output the number
146 of bytes that were mapped.
147 @param DeviceAddress The resulting map address for the bus master device to use
148 to access the hosts HostAddress.
149 @param Mapping A resulting value to pass to EFI_ISA_IO.Unmap().
152 @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.
153 @retval EFI_INVALID_PARAMETER The Operation or HostAddress is undefined.
154 @retval EFI_UNSUPPORTED The HostAddress can not be mapped as a common buffer.
155 @retval EFI_DEVICE_ERROR The system hardware could not map the requested address.
156 @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
161 (EFIAPI
*EFI_ISA_IO_PROTOCOL_MAP
) (
162 IN EFI_ISA_IO_PROTOCOL
*This
,
163 IN EFI_ISA_IO_PROTOCOL_OPERATION Operation
,
164 IN UINT8 ChannelNumber OPTIONAL
,
165 IN UINT32 ChannelAttributes
,
166 IN VOID
*HostAddress
,
167 IN OUT UINTN
*NumberOfBytes
,
168 OUT EFI_PHYSICAL_ADDRESS
*DeviceAddress
,
173 Unmaps a memory region for DMA
175 @param This A pointer to the EFI_ISA_IO_PROTOCOL instance.
176 @param Mapping The mapping value returned from EFI_ISA_IO.Map().
178 @retval EFI_SUCCESS The range was unmapped.
179 @retval EFI_DEVICE_ERROR The data was not committed to the target system memory.
184 (EFIAPI
*EFI_ISA_IO_PROTOCOL_UNMAP
) (
185 IN EFI_ISA_IO_PROTOCOL
*This
,
190 Allocates a common buffer for DMA
192 @param This A pointer to the EFI_ISA_IO_PROTOCOL instance.
193 @param Type The type allocation to perform.
194 @param MemoryType The type of memory to allocate.
195 @param Pages The number of pages to allocate.
196 @param HostAddress A pointer to store the base address of the allocated range.
197 @param Attributes The requested bit mask of attributes for the allocated range.
199 @retval EFI_SUCCESS The requested memory pages were allocated.
200 @retval EFI_INVALID_PARAMETER Type is invalid or MemoryType is invalid or HostAddress is NULL
201 @retval EFI_UNSUPPORTED Attributes is unsupported or the memory range specified
202 by HostAddress, Pages, and Type is not available for common buffer use.
203 @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.
208 (EFIAPI
*EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER
) (
209 IN EFI_ISA_IO_PROTOCOL
*This
,
210 IN EFI_ALLOCATE_TYPE Type
,
211 IN EFI_MEMORY_TYPE MemoryType
,
213 OUT VOID
**HostAddress
,
218 Frees a common buffer
220 @param This A pointer to the EFI_ISA_IO_PROTOCOL instance.
221 @param Pages The number of pages to free.
222 @param HostAddress The base address of the allocated range.
225 @retval EFI_SUCCESS The requested memory pages were freed.
226 @retval EFI_INVALID_PARAMETER The memory was not allocated with EFI_ISA_IO.AllocateBufer().
231 (EFIAPI
*EFI_ISA_IO_PROTOCOL_FREE_BUFFER
) (
232 IN EFI_ISA_IO_PROTOCOL
*This
,
240 @param This A pointer to the EFI_ISA_IO_PROTOCOL instance.
242 @retval EFI_SUCCESS The buffers were flushed.
243 @retval EFI_DEVICE_ERROR The buffers were not flushed due to a hardware error.
248 (EFIAPI
*EFI_ISA_IO_PROTOCOL_FLUSH
) (
249 IN EFI_ISA_IO_PROTOCOL
*This
253 // Interface structure for the ISA I/O Protocol
255 struct _EFI_ISA_IO_PROTOCOL
{
256 EFI_ISA_IO_PROTOCOL_ACCESS Mem
;
257 EFI_ISA_IO_PROTOCOL_ACCESS Io
;
258 EFI_ISA_IO_PROTOCOL_COPY_MEM CopyMem
;
259 EFI_ISA_IO_PROTOCOL_MAP Map
;
260 EFI_ISA_IO_PROTOCOL_UNMAP Unmap
;
261 EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer
;
262 EFI_ISA_IO_PROTOCOL_FREE_BUFFER FreeBuffer
;
263 EFI_ISA_IO_PROTOCOL_FLUSH Flush
;
264 EFI_ISA_ACPI_RESOURCE_LIST
*ResourceList
;
269 extern EFI_GUID gEfiIsaIoProtocolGuid
;