3 Copyright (c) 2004 - 2006, 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.
18 EFI_ISA_IO_PROTOCOL or EFI_LIGHT_ISA_IO_PROTOCOL
19 based on macro SIZE_REDUCTION_ISA_COMBINED.
29 // Common definitions for Light ISA I/O Protocol and ISA I/O Protocol
32 #include EFI_PROTOCOL_DEFINITION(IsaAcpi)
38 EfiIsaIoWidthReserved
,
39 EfiIsaIoWidthFifoUint8
,
40 EfiIsaIoWidthFifoUint16
,
41 EfiIsaIoWidthFifoUint32
,
42 EfiIsaIoWidthFifoReserved
,
43 EfiIsaIoWidthFillUint8
,
44 EfiIsaIoWidthFillUint16
,
45 EfiIsaIoWidthFillUint32
,
46 EfiIsaIoWidthFillReserved
,
48 } EFI_ISA_IO_PROTOCOL_WIDTH
;
51 // Attributes for common buffer allocations
53 #define EFI_ISA_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x080 // Map a memory range so write are combined
54 #define EFI_ISA_IO_ATTRIBUTE_MEMORY_CACHED 0x800 // Map a memory range so all r/w accesses are cached
55 #define EFI_ISA_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 // Disable a memory range
58 // Channel attribute for DMA operations
60 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_COMPATIBLE 0x001
61 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_A 0x002
62 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_B 0x004
63 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_C 0x008
64 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_8 0x010
65 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_16 0x020
66 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SINGLE_MODE 0x040
67 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_DEMAND_MODE 0x080
68 #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_AUTO_INITIALIZE 0x100
71 EfiIsaIoOperationBusMasterRead
,
72 EfiIsaIoOperationBusMasterWrite
,
73 EfiIsaIoOperationBusMasterCommonBuffer
,
74 EfiIsaIoOperationSlaveRead
,
75 EfiIsaIoOperationSlaveWrite
,
76 EfiIsaIoOperationMaximum
77 } EFI_ISA_IO_PROTOCOL_OPERATION
;
79 #ifndef SIZE_REDUCTION_ISA_COMBINED
82 // Specific for ISA I/O Protocol
85 #define EFI_INTERFACE_DEFINITION_FOR_ISA_IO EFI_ISA_IO_PROTOCOL
86 #define EFI_ISA_IO_PROTOCOL_VERSION &gEfiIsaIoProtocolGuid
87 #define EFI_ISA_IO_OPERATION_TOKEN EfiIsaIoOperationBusMasterWrite
91 // Global ID for the ISA I/O Protocol
94 #define EFI_ISA_IO_PROTOCOL_GUID \
95 { 0x7ee2bd44, 0x3da0, 0x11d4, 0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
97 EFI_FORWARD_DECLARATION (EFI_ISA_IO_PROTOCOL
);
101 (EFIAPI
*EFI_ISA_IO_PROTOCOL_IO_MEM
) (
102 IN EFI_ISA_IO_PROTOCOL
*This
,
103 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
110 EFI_ISA_IO_PROTOCOL_IO_MEM Read
;
111 EFI_ISA_IO_PROTOCOL_IO_MEM Write
;
112 } EFI_ISA_IO_PROTOCOL_ACCESS
;
116 (EFIAPI
*EFI_ISA_IO_PROTOCOL_COPY_MEM
) (
117 IN EFI_ISA_IO_PROTOCOL
*This
,
118 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
119 IN UINT32 DestOffset
,
126 (EFIAPI
*EFI_ISA_IO_PROTOCOL_MAP
) (
127 IN EFI_ISA_IO_PROTOCOL
*This
,
128 IN EFI_ISA_IO_PROTOCOL_OPERATION Operation
,
129 IN UINT8 ChannelNumber OPTIONAL
,
130 IN UINT32 ChannelAttributes
,
131 IN VOID
*HostAddress
,
132 IN OUT UINTN
*NumberOfBytes
,
133 OUT EFI_PHYSICAL_ADDRESS
*DeviceAddress
,
139 (EFIAPI
*EFI_ISA_IO_PROTOCOL_UNMAP
) (
140 IN EFI_ISA_IO_PROTOCOL
*This
,
146 (EFIAPI
*EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER
) (
147 IN EFI_ISA_IO_PROTOCOL
*This
,
148 IN EFI_ALLOCATE_TYPE Type
,
149 IN EFI_MEMORY_TYPE MemoryType
,
151 OUT VOID
**HostAddress
,
157 (EFIAPI
*EFI_ISA_IO_PROTOCOL_FREE_BUFFER
) (
158 IN EFI_ISA_IO_PROTOCOL
*This
,
165 (EFIAPI
*EFI_ISA_IO_PROTOCOL_FLUSH
) (
166 IN EFI_ISA_IO_PROTOCOL
*This
170 // Interface structure for the ISA I/O Protocol
172 typedef struct _EFI_ISA_IO_PROTOCOL
{
173 EFI_ISA_IO_PROTOCOL_ACCESS Mem
;
174 EFI_ISA_IO_PROTOCOL_ACCESS Io
;
175 EFI_ISA_IO_PROTOCOL_COPY_MEM CopyMem
;
176 EFI_ISA_IO_PROTOCOL_MAP Map
;
177 EFI_ISA_IO_PROTOCOL_UNMAP Unmap
;
178 EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer
;
179 EFI_ISA_IO_PROTOCOL_FREE_BUFFER FreeBuffer
;
180 EFI_ISA_IO_PROTOCOL_FLUSH Flush
;
181 EFI_ISA_ACPI_RESOURCE_LIST
*ResourceList
;
184 } EFI_ISA_IO_PROTOCOL
;
186 extern EFI_GUID gEfiIsaIoProtocolGuid
;
191 // Specific for Light ISA I/O Protocol
194 #define EFI_INTERFACE_DEFINITION_FOR_ISA_IO EFI_LIGHT_ISA_IO_PROTOCOL
195 #define EFI_ISA_IO_PROTOCOL_VERSION &gEfiLightIsaIoProtocolGuid
196 #define EFI_ISA_IO_OPERATION_TOKEN EfiIsaIoOperationSlaveWrite
198 #define ADD_SERIAL_NAME(x, y)
201 // Global ID for the Light ISA I/O Protocol
204 #define EFI_LIGHT_ISA_IO_PROTOCOL_GUID \
205 { 0x7cc7ed80, 0x9a68, 0x4781, 0x80, 0xe4, 0xda, 0x16, 0x99, 0x10, 0x5a, 0xfe }
207 EFI_FORWARD_DECLARATION (EFI_LIGHT_ISA_IO_PROTOCOL
);
212 (EFIAPI
*EFI_LIGHT_ISA_IO_PROTOCOL_IO_MEM
) (
213 IN EFI_LIGHT_ISA_IO_PROTOCOL
*This
,
214 IN EFI_ISA_IO_PROTOCOL_WIDTH Width
,
223 Performs an ISA I/O Read/Write Cycle
224 EFI_LIGHT_ISA_IO_PROTOCOL doesn't verfiy access for I/O operation.
228 This - A pointer to the EFI_ISA_IO_PROTOCOL or EFI_LIGHT_ISA_IO_PROTOCOL instance.
229 Width - Signifies the width of the I/O operation.
230 Offset - The offset in ISA I/O space to start the I/O operation.
231 Count - The number of I/O operations to perform.
232 Buffer - The source/destination buffer
236 EFI_SUCCESS - The data was read from or written to the device sucessfully.
237 EFI_UNSUPPORTED - The Offset is not valid for this device.
238 EFI_INVALID_PARAMETER - Width or Count, or both, were invalid.
239 EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of resources.
245 EFI_LIGHT_ISA_IO_PROTOCOL_IO_MEM Read
;
246 EFI_LIGHT_ISA_IO_PROTOCOL_IO_MEM Write
;
247 } EFI_LIGHT_ISA_IO_PROTOCOL_ACCESS
;
252 (EFIAPI
*EFI_LIGHT_ISA_IO_PROTOCOL_MAP
) (
253 IN EFI_LIGHT_ISA_IO_PROTOCOL
*This
,
254 IN EFI_ISA_IO_PROTOCOL_OPERATION Operation
,
255 IN UINT8 ChannelNumber OPTIONAL
,
256 IN UINT32 ChannelAttributes
,
257 IN VOID
*HostAddress
,
258 IN OUT UINTN
*NumberOfBytes
,
259 OUT EFI_PHYSICAL_ADDRESS
*DeviceAddress
,
266 Maps a memory region for DMA, EFI_LIGHT_ISA_IO_PROTOCOL only supports
267 Slave read/write operation to save code size.
271 This - A pointer to the EFI_LIGHT_ISA_IO_PROTOCOL instance.
272 Operation - Indicates the type of DMA (slave or bus master), and if
273 the DMA operation is going to read or write to system memory.
274 ChannelNumber - The slave channel number to use for this DMA operation.
275 If Operation and ChannelAttributes shows that this device
276 performs bus mastering DMA, then this field is ignored.
277 The legal range for this field is 0..7.
278 ChannelAttributes - The attributes of the DMA channel to use for this DMA operation
279 HostAddress - The system memory address to map to the device.
280 NumberOfBytes - On input the number of bytes to map. On output the number
281 of bytes that were mapped.
282 DeviceAddress - The resulting map address for the bus master device to use
283 to access the hosts HostAddress.
284 Mapping - A resulting value to pass to EFI_ISA_IO.Unmap().
288 EFI_SUCCESS - The range was mapped for the returned NumberOfBytes.
289 EFI_INVALID_PARAMETER - The Operation or HostAddress is undefined.
290 EFI_UNSUPPORTED - The HostAddress can not be mapped as a common buffer.
291 EFI_DEVICE_ERROR - The system hardware could not map the requested address.
292 EFI_OUT_OF_RESOURCES - The memory pages could not be allocated.
299 (EFIAPI
*EFI_LIGHT_ISA_IO_PROTOCOL_UNMAP
) (
300 IN EFI_LIGHT_ISA_IO_PROTOCOL
*This
,
307 Unmaps a memory region for DMA
311 This - A pointer to the EFI_ISA_IO_PROTOCOL or EFI_LIGHT_ISA_IO_PROTOCOL instance.
312 Mapping - The mapping value returned from EFI_ISA_IO.Map().
316 EFI_SUCCESS - The range was unmapped.
317 EFI_DEVICE_ERROR - The data was not committed to the target system memory.
324 (EFIAPI
*EFI_LIGHT_ISA_IO_PROTOCOL_FLUSH
) (
325 IN EFI_LIGHT_ISA_IO_PROTOCOL
*This
335 This - A pointer to the EFI_ISA_IO_PROTOCOL or EFI_LIGHT_ISA_IO_PROTOCOL instance.
339 EFI_SUCCESS - The buffers were flushed.
340 EFI_DEVICE_ERROR - The buffers were not flushed due to a hardware error.
346 // Interface structure for the Light ISA I/O Protocol
348 typedef struct _EFI_LIGHT_ISA_IO_PROTOCOL
{
349 EFI_LIGHT_ISA_IO_PROTOCOL_ACCESS Io
;
350 EFI_LIGHT_ISA_IO_PROTOCOL_MAP Map
;
351 EFI_LIGHT_ISA_IO_PROTOCOL_UNMAP Unmap
;
352 EFI_LIGHT_ISA_IO_PROTOCOL_FLUSH Flush
;
353 EFI_ISA_ACPI_RESOURCE_LIST
*ResourceList
;
356 } EFI_LIGHT_ISA_IO_PROTOCOL
;
358 extern EFI_GUID gEfiLightIsaIoProtocolGuid
;