]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Protocol/IsaIo/IsaIo.h
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Protocol / IsaIo / IsaIo.h
1 /*++
2
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
8
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.
11
12 Module Name:
13
14 IsaIo.h
15
16 Abstract:
17
18 EFI_ISA_IO_PROTOCOL or EFI_LIGHT_ISA_IO_PROTOCOL
19 based on macro SIZE_REDUCTION_ISA_COMBINED.
20
21 Revision History
22
23 --*/
24
25 #ifndef _EFI_ISA_IO_H
26 #define _EFI_ISA_IO_H
27
28 //
29 // Common definitions for Light ISA I/O Protocol and ISA I/O Protocol
30 //
31
32 #include EFI_PROTOCOL_DEFINITION(IsaAcpi)
33
34 typedef enum {
35 EfiIsaIoWidthUint8,
36 EfiIsaIoWidthUint16,
37 EfiIsaIoWidthUint32,
38 EfiIsaIoWidthReserved,
39 EfiIsaIoWidthFifoUint8,
40 EfiIsaIoWidthFifoUint16,
41 EfiIsaIoWidthFifoUint32,
42 EfiIsaIoWidthFifoReserved,
43 EfiIsaIoWidthFillUint8,
44 EfiIsaIoWidthFillUint16,
45 EfiIsaIoWidthFillUint32,
46 EfiIsaIoWidthFillReserved,
47 EfiIsaIoWidthMaximum
48 } EFI_ISA_IO_PROTOCOL_WIDTH;
49
50 //
51 // Attributes for common buffer allocations
52 //
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
56
57 //
58 // Channel attribute for DMA operations
59 //
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
69
70 typedef enum {
71 EfiIsaIoOperationBusMasterRead,
72 EfiIsaIoOperationBusMasterWrite,
73 EfiIsaIoOperationBusMasterCommonBuffer,
74 EfiIsaIoOperationSlaveRead,
75 EfiIsaIoOperationSlaveWrite,
76 EfiIsaIoOperationMaximum
77 } EFI_ISA_IO_PROTOCOL_OPERATION;
78
79 #ifndef SIZE_REDUCTION_ISA_COMBINED
80
81 //
82 // Specific for ISA I/O Protocol
83 //
84
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
88
89
90 //
91 // Global ID for the ISA I/O Protocol
92 //
93
94 #define EFI_ISA_IO_PROTOCOL_GUID \
95 { 0x7ee2bd44, 0x3da0, 0x11d4, 0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
96
97 EFI_FORWARD_DECLARATION (EFI_ISA_IO_PROTOCOL);
98
99 typedef
100 EFI_STATUS
101 (EFIAPI *EFI_ISA_IO_PROTOCOL_IO_MEM) (
102 IN EFI_ISA_IO_PROTOCOL *This,
103 IN EFI_ISA_IO_PROTOCOL_WIDTH Width,
104 IN UINT32 Offset,
105 IN UINTN Count,
106 IN OUT VOID *Buffer
107 );
108
109 typedef struct {
110 EFI_ISA_IO_PROTOCOL_IO_MEM Read;
111 EFI_ISA_IO_PROTOCOL_IO_MEM Write;
112 } EFI_ISA_IO_PROTOCOL_ACCESS;
113
114 typedef
115 EFI_STATUS
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,
120 IN UINT32 SrcOffset,
121 IN UINTN Count
122 );
123
124 typedef
125 EFI_STATUS
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,
134 OUT VOID **Mapping
135 );
136
137 typedef
138 EFI_STATUS
139 (EFIAPI *EFI_ISA_IO_PROTOCOL_UNMAP) (
140 IN EFI_ISA_IO_PROTOCOL *This,
141 IN VOID *Mapping
142 );
143
144 typedef
145 EFI_STATUS
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,
150 IN UINTN Pages,
151 OUT VOID **HostAddress,
152 IN UINT64 Attributes
153 );
154
155 typedef
156 EFI_STATUS
157 (EFIAPI *EFI_ISA_IO_PROTOCOL_FREE_BUFFER) (
158 IN EFI_ISA_IO_PROTOCOL *This,
159 IN UINTN Pages,
160 IN VOID *HostAddress
161 );
162
163 typedef
164 EFI_STATUS
165 (EFIAPI *EFI_ISA_IO_PROTOCOL_FLUSH) (
166 IN EFI_ISA_IO_PROTOCOL *This
167 );
168
169 //
170 // Interface structure for the ISA I/O Protocol
171 //
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;
182 UINT32 RomSize;
183 VOID *RomImage;
184 } EFI_ISA_IO_PROTOCOL;
185
186 extern EFI_GUID gEfiIsaIoProtocolGuid;
187
188 #else
189
190 //
191 // Specific for Light ISA I/O Protocol
192 //
193
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
197
198 #define ADD_SERIAL_NAME(x, y)
199
200 //
201 // Global ID for the Light ISA I/O Protocol
202 //
203
204 #define EFI_LIGHT_ISA_IO_PROTOCOL_GUID \
205 { 0x7cc7ed80, 0x9a68, 0x4781, 0x80, 0xe4, 0xda, 0x16, 0x99, 0x10, 0x5a, 0xfe }
206
207 EFI_FORWARD_DECLARATION (EFI_LIGHT_ISA_IO_PROTOCOL);
208
209
210 typedef
211 EFI_STATUS
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,
215 IN UINT32 Offset,
216 IN UINTN Count,
217 IN OUT VOID *Buffer
218 )
219 /*++
220
221 Routine Description:
222
223 Performs an ISA I/O Read/Write Cycle
224 EFI_LIGHT_ISA_IO_PROTOCOL doesn't verfiy access for I/O operation.
225
226 Arguments:
227
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
233
234 Returns:
235
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.
240
241 --*/
242 ;
243
244 typedef struct {
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;
248
249
250 typedef
251 EFI_STATUS
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,
260 OUT VOID **Mapping
261 )
262 /*++
263
264 Routine Description:
265
266 Maps a memory region for DMA, EFI_LIGHT_ISA_IO_PROTOCOL only supports
267 Slave read/write operation to save code size.
268
269 Arguments:
270
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().
285
286 Returns:
287
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.
293
294 --*/
295 ;
296
297 typedef
298 EFI_STATUS
299 (EFIAPI *EFI_LIGHT_ISA_IO_PROTOCOL_UNMAP) (
300 IN EFI_LIGHT_ISA_IO_PROTOCOL *This,
301 IN VOID *Mapping
302 )
303 /*++
304
305 Routine Description:
306
307 Unmaps a memory region for DMA
308
309 Arguments:
310
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().
313
314 Returns:
315
316 EFI_SUCCESS - The range was unmapped.
317 EFI_DEVICE_ERROR - The data was not committed to the target system memory.
318
319 --*/
320 ;
321
322 typedef
323 EFI_STATUS
324 (EFIAPI *EFI_LIGHT_ISA_IO_PROTOCOL_FLUSH) (
325 IN EFI_LIGHT_ISA_IO_PROTOCOL *This
326 )
327 /*++
328
329 Routine Description:
330
331 Flushes a DMA buffer
332
333 Arguments:
334
335 This - A pointer to the EFI_ISA_IO_PROTOCOL or EFI_LIGHT_ISA_IO_PROTOCOL instance.
336
337 Returns:
338
339 EFI_SUCCESS - The buffers were flushed.
340 EFI_DEVICE_ERROR - The buffers were not flushed due to a hardware error.
341
342 --*/
343 ;
344
345 //
346 // Interface structure for the Light ISA I/O Protocol
347 //
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;
354 UINT32 RomSize;
355 VOID *RomImage;
356 } EFI_LIGHT_ISA_IO_PROTOCOL;
357
358 extern EFI_GUID gEfiLightIsaIoProtocolGuid;
359
360 #endif
361
362 #endif