]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Protocol/IsaIo/IsaIo.h
Removed extra typedefs on structures to fix error generated by gcc.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Protocol / IsaIo / IsaIo.h
CommitLineData
3eb9473e 1/*++\r
2\r
3Copyright (c) 2004 - 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 IsaIo.h\r
15 \r
16Abstract:\r
17\r
18 EFI_ISA_IO_PROTOCOL or EFI_LIGHT_ISA_IO_PROTOCOL \r
19 based on macro SIZE_REDUCTION_ISA_COMBINED.\r
20\r
21Revision History\r
22\r
23--*/\r
24\r
25#ifndef _EFI_ISA_IO_H\r
26#define _EFI_ISA_IO_H\r
27\r
28//\r
29// Common definitions for Light ISA I/O Protocol and ISA I/O Protocol\r
30//\r
31\r
32#include EFI_PROTOCOL_DEFINITION(IsaAcpi)\r
33\r
34typedef enum {\r
35 EfiIsaIoWidthUint8,\r
36 EfiIsaIoWidthUint16,\r
37 EfiIsaIoWidthUint32,\r
38 EfiIsaIoWidthReserved,\r
39 EfiIsaIoWidthFifoUint8,\r
40 EfiIsaIoWidthFifoUint16,\r
41 EfiIsaIoWidthFifoUint32,\r
42 EfiIsaIoWidthFifoReserved,\r
43 EfiIsaIoWidthFillUint8,\r
44 EfiIsaIoWidthFillUint16,\r
45 EfiIsaIoWidthFillUint32,\r
46 EfiIsaIoWidthFillReserved,\r
47 EfiIsaIoWidthMaximum\r
48} EFI_ISA_IO_PROTOCOL_WIDTH;\r
49\r
50//\r
51// Attributes for common buffer allocations\r
52//\r
53#define EFI_ISA_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x080 // Map a memory range so write are combined\r
54#define EFI_ISA_IO_ATTRIBUTE_MEMORY_CACHED 0x800 // Map a memory range so all r/w accesses are cached\r
55#define EFI_ISA_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 // Disable a memory range \r
56\r
57//\r
58// Channel attribute for DMA operations\r
59//\r
60#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_COMPATIBLE 0x001\r
61#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_A 0x002\r
62#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_B 0x004\r
63#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_C 0x008\r
64#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_8 0x010\r
65#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_16 0x020\r
66#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SINGLE_MODE 0x040\r
67#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_DEMAND_MODE 0x080\r
68#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_AUTO_INITIALIZE 0x100\r
69\r
70typedef enum {\r
71 EfiIsaIoOperationBusMasterRead,\r
72 EfiIsaIoOperationBusMasterWrite,\r
73 EfiIsaIoOperationBusMasterCommonBuffer,\r
74 EfiIsaIoOperationSlaveRead,\r
75 EfiIsaIoOperationSlaveWrite,\r
76 EfiIsaIoOperationMaximum\r
77} EFI_ISA_IO_PROTOCOL_OPERATION;\r
78\r
79#ifndef SIZE_REDUCTION_ISA_COMBINED\r
80\r
81//\r
82// Specific for ISA I/O Protocol\r
83//\r
84\r
85#define EFI_INTERFACE_DEFINITION_FOR_ISA_IO EFI_ISA_IO_PROTOCOL\r
86#define EFI_ISA_IO_PROTOCOL_VERSION &gEfiIsaIoProtocolGuid\r
87#define EFI_ISA_IO_OPERATION_TOKEN EfiIsaIoOperationBusMasterWrite\r
88\r
89\r
90//\r
91// Global ID for the ISA I/O Protocol\r
92//\r
93\r
94#define EFI_ISA_IO_PROTOCOL_GUID \\r
95 { 0x7ee2bd44, 0x3da0, 0x11d4, 0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }\r
96\r
97EFI_FORWARD_DECLARATION (EFI_ISA_IO_PROTOCOL);\r
98\r
99typedef\r
100EFI_STATUS\r
101(EFIAPI *EFI_ISA_IO_PROTOCOL_IO_MEM) (\r
102 IN EFI_ISA_IO_PROTOCOL *This,\r
103 IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
104 IN UINT32 Offset,\r
105 IN UINTN Count,\r
106 IN OUT VOID *Buffer\r
107 );\r
108\r
109typedef struct {\r
110 EFI_ISA_IO_PROTOCOL_IO_MEM Read;\r
111 EFI_ISA_IO_PROTOCOL_IO_MEM Write;\r
112} EFI_ISA_IO_PROTOCOL_ACCESS;\r
113\r
114typedef\r
115EFI_STATUS\r
116(EFIAPI *EFI_ISA_IO_PROTOCOL_COPY_MEM) (\r
117 IN EFI_ISA_IO_PROTOCOL *This,\r
118 IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
119 IN UINT32 DestOffset,\r
120 IN UINT32 SrcOffset,\r
121 IN UINTN Count\r
122 );\r
123\r
124typedef\r
125EFI_STATUS\r
126(EFIAPI *EFI_ISA_IO_PROTOCOL_MAP) (\r
127 IN EFI_ISA_IO_PROTOCOL *This,\r
128 IN EFI_ISA_IO_PROTOCOL_OPERATION Operation,\r
129 IN UINT8 ChannelNumber OPTIONAL,\r
130 IN UINT32 ChannelAttributes,\r
131 IN VOID *HostAddress,\r
132 IN OUT UINTN *NumberOfBytes,\r
133 OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r
134 OUT VOID **Mapping\r
135 );\r
136\r
137typedef\r
138EFI_STATUS\r
139(EFIAPI *EFI_ISA_IO_PROTOCOL_UNMAP) (\r
140 IN EFI_ISA_IO_PROTOCOL *This,\r
141 IN VOID *Mapping\r
142 );\r
143\r
144typedef\r
145EFI_STATUS\r
146(EFIAPI *EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER) (\r
147 IN EFI_ISA_IO_PROTOCOL *This,\r
148 IN EFI_ALLOCATE_TYPE Type,\r
149 IN EFI_MEMORY_TYPE MemoryType,\r
150 IN UINTN Pages,\r
151 OUT VOID **HostAddress,\r
152 IN UINT64 Attributes\r
153 );\r
154\r
155typedef\r
156EFI_STATUS\r
157(EFIAPI *EFI_ISA_IO_PROTOCOL_FREE_BUFFER) (\r
158 IN EFI_ISA_IO_PROTOCOL *This,\r
159 IN UINTN Pages,\r
160 IN VOID *HostAddress\r
161 );\r
162\r
163typedef\r
164EFI_STATUS\r
165(EFIAPI *EFI_ISA_IO_PROTOCOL_FLUSH) (\r
166 IN EFI_ISA_IO_PROTOCOL *This\r
167 );\r
168\r
169//\r
170// Interface structure for the ISA I/O Protocol\r
171//\r
9c092841 172struct _EFI_ISA_IO_PROTOCOL {\r
3eb9473e 173 EFI_ISA_IO_PROTOCOL_ACCESS Mem;\r
174 EFI_ISA_IO_PROTOCOL_ACCESS Io;\r
175 EFI_ISA_IO_PROTOCOL_COPY_MEM CopyMem;\r
176 EFI_ISA_IO_PROTOCOL_MAP Map;\r
177 EFI_ISA_IO_PROTOCOL_UNMAP Unmap;\r
178 EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;\r
179 EFI_ISA_IO_PROTOCOL_FREE_BUFFER FreeBuffer;\r
180 EFI_ISA_IO_PROTOCOL_FLUSH Flush;\r
181 EFI_ISA_ACPI_RESOURCE_LIST *ResourceList;\r
182 UINT32 RomSize;\r
183 VOID *RomImage;\r
9c092841 184};\r
3eb9473e 185\r
186extern EFI_GUID gEfiIsaIoProtocolGuid;\r
187\r
188#else\r
189\r
190//\r
191// Specific for Light ISA I/O Protocol\r
192//\r
193\r
194#define EFI_INTERFACE_DEFINITION_FOR_ISA_IO EFI_LIGHT_ISA_IO_PROTOCOL\r
195#define EFI_ISA_IO_PROTOCOL_VERSION &gEfiLightIsaIoProtocolGuid\r
196#define EFI_ISA_IO_OPERATION_TOKEN EfiIsaIoOperationSlaveWrite \r
197\r
198#define ADD_SERIAL_NAME(x, y)\r
199\r
200//\r
201// Global ID for the Light ISA I/O Protocol\r
202//\r
203\r
204#define EFI_LIGHT_ISA_IO_PROTOCOL_GUID \\r
205 { 0x7cc7ed80, 0x9a68, 0x4781, 0x80, 0xe4, 0xda, 0x16, 0x99, 0x10, 0x5a, 0xfe }\r
206\r
207EFI_FORWARD_DECLARATION (EFI_LIGHT_ISA_IO_PROTOCOL);\r
208\r
209\r
210typedef\r
211EFI_STATUS\r
212(EFIAPI *EFI_LIGHT_ISA_IO_PROTOCOL_IO_MEM) (\r
213 IN EFI_LIGHT_ISA_IO_PROTOCOL *This,\r
214 IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
215 IN UINT32 Offset,\r
216 IN UINTN Count,\r
217 IN OUT VOID *Buffer\r
218 )\r
219/*++\r
220\r
221Routine Description:\r
222\r
223 Performs an ISA I/O Read/Write Cycle\r
224 EFI_LIGHT_ISA_IO_PROTOCOL doesn't verfiy access for I/O operation.\r
225\r
226Arguments:\r
227\r
228 This - A pointer to the EFI_ISA_IO_PROTOCOL or EFI_LIGHT_ISA_IO_PROTOCOL instance.\r
229 Width - Signifies the width of the I/O operation.\r
230 Offset - The offset in ISA I/O space to start the I/O operation. \r
231 Count - The number of I/O operations to perform. \r
232 Buffer - The source/destination buffer\r
233\r
234Returns:\r
235\r
236 EFI_SUCCESS - The data was read from or written to the device sucessfully.\r
237 EFI_UNSUPPORTED - The Offset is not valid for this device.\r
238 EFI_INVALID_PARAMETER - Width or Count, or both, were invalid.\r
239 EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of resources.\r
240\r
241--*/ \r
242;\r
243\r
244typedef struct {\r
245 EFI_LIGHT_ISA_IO_PROTOCOL_IO_MEM Read;\r
246 EFI_LIGHT_ISA_IO_PROTOCOL_IO_MEM Write;\r
247} EFI_LIGHT_ISA_IO_PROTOCOL_ACCESS;\r
248\r
249\r
250typedef\r
251EFI_STATUS\r
252(EFIAPI *EFI_LIGHT_ISA_IO_PROTOCOL_MAP) (\r
253 IN EFI_LIGHT_ISA_IO_PROTOCOL *This,\r
254 IN EFI_ISA_IO_PROTOCOL_OPERATION Operation,\r
255 IN UINT8 ChannelNumber OPTIONAL,\r
256 IN UINT32 ChannelAttributes,\r
257 IN VOID *HostAddress,\r
258 IN OUT UINTN *NumberOfBytes,\r
259 OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r
260 OUT VOID **Mapping\r
261 )\r
262/*++\r
263\r
264Routine Description:\r
265\r
266 Maps a memory region for DMA, EFI_LIGHT_ISA_IO_PROTOCOL only supports \r
267 Slave read/write operation to save code size.\r
268\r
269Arguments:\r
270\r
271 This - A pointer to the EFI_LIGHT_ISA_IO_PROTOCOL instance.\r
272 Operation - Indicates the type of DMA (slave or bus master), and if \r
273 the DMA operation is going to read or write to system memory. \r
274 ChannelNumber - The slave channel number to use for this DMA operation. \r
275 If Operation and ChannelAttributes shows that this device \r
276 performs bus mastering DMA, then this field is ignored. \r
277 The legal range for this field is 0..7. \r
278 ChannelAttributes - The attributes of the DMA channel to use for this DMA operation\r
279 HostAddress - The system memory address to map to the device. \r
280 NumberOfBytes - On input the number of bytes to map. On output the number \r
281 of bytes that were mapped.\r
282 DeviceAddress - The resulting map address for the bus master device to use \r
283 to access the hosts HostAddress. \r
284 Mapping - A resulting value to pass to EFI_ISA_IO.Unmap().\r
285\r
286Returns:\r
287\r
288 EFI_SUCCESS - The range was mapped for the returned NumberOfBytes.\r
289 EFI_INVALID_PARAMETER - The Operation or HostAddress is undefined.\r
290 EFI_UNSUPPORTED - The HostAddress can not be mapped as a common buffer.\r
291 EFI_DEVICE_ERROR - The system hardware could not map the requested address.\r
292 EFI_OUT_OF_RESOURCES - The memory pages could not be allocated.\r
293\r
294--*/\r
295;\r
296\r
297typedef\r
298EFI_STATUS\r
299(EFIAPI *EFI_LIGHT_ISA_IO_PROTOCOL_UNMAP) (\r
300 IN EFI_LIGHT_ISA_IO_PROTOCOL *This,\r
301 IN VOID *Mapping\r
302 )\r
303/*++\r
304\r
305Routine Description:\r
306\r
307 Unmaps a memory region for DMA\r
308\r
309Arguments:\r
310\r
311 This - A pointer to the EFI_ISA_IO_PROTOCOL or EFI_LIGHT_ISA_IO_PROTOCOL instance.\r
312 Mapping - The mapping value returned from EFI_ISA_IO.Map().\r
313\r
314Returns:\r
315\r
316 EFI_SUCCESS - The range was unmapped.\r
317 EFI_DEVICE_ERROR - The data was not committed to the target system memory.\r
318\r
319--*/ \r
320; \r
321\r
322typedef\r
323EFI_STATUS\r
324(EFIAPI *EFI_LIGHT_ISA_IO_PROTOCOL_FLUSH) (\r
325 IN EFI_LIGHT_ISA_IO_PROTOCOL *This\r
326 )\r
327/*++\r
328\r
329Routine Description:\r
330\r
331 Flushes a DMA buffer\r
332\r
333Arguments:\r
334\r
335 This - A pointer to the EFI_ISA_IO_PROTOCOL or EFI_LIGHT_ISA_IO_PROTOCOL instance.\r
336\r
337Returns:\r
338\r
339 EFI_SUCCESS - The buffers were flushed.\r
340 EFI_DEVICE_ERROR - The buffers were not flushed due to a hardware error.\r
341\r
342--*/ \r
343;\r
344\r
345//\r
346// Interface structure for the Light ISA I/O Protocol\r
347//\r
9c092841 348struct _EFI_LIGHT_ISA_IO_PROTOCOL {\r
3eb9473e 349 EFI_LIGHT_ISA_IO_PROTOCOL_ACCESS Io;\r
350 EFI_LIGHT_ISA_IO_PROTOCOL_MAP Map;\r
351 EFI_LIGHT_ISA_IO_PROTOCOL_UNMAP Unmap;\r
352 EFI_LIGHT_ISA_IO_PROTOCOL_FLUSH Flush;\r
353 EFI_ISA_ACPI_RESOURCE_LIST *ResourceList;\r
354 UINT32 RomSize;\r
355 VOID *RomImage;\r
9c092841 356};\r
3eb9473e 357\r
358extern EFI_GUID gEfiLightIsaIoProtocolGuid;\r
359\r
360#endif\r
361\r
362#endif\r