]>
Commit | Line | Data |
---|---|---|
8ca67c46 | 1 | /** @file\r |
f4671790 | 2 | ISA I/O Protocol is used to perform ISA device Io/Mem operations.\r |
c3902377 | 3 | \r |
f4671790 | 4 | Copyright (c) 2006 - 2009, Intel Corporation \r |
c3902377 | 5 | All rights reserved. This program and the accompanying materials \r |
6 | are licensed and made available under the terms and conditions of the BSD License \r | |
7 | which accompanies this distribution. The full text of the license may be found at \r | |
8 | http://opensource.org/licenses/bsd-license.php \r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
12 | \r | |
3db51098 | 13 | **/\r |
c3902377 | 14 | \r |
8ca67c46 | 15 | #ifndef _EFI_ISA_IO_H_\r |
16 | #define _EFI_ISA_IO_H_\r | |
c3902377 | 17 | \r |
18 | \r | |
19 | #include <Protocol/IsaAcpi.h>\r | |
20 | \r | |
21 | //\r | |
f4671790 | 22 | // Global GUID for the ISA I/O Protocol\r |
c3902377 | 23 | //\r |
c3902377 | 24 | #define EFI_ISA_IO_PROTOCOL_GUID \\r |
25 | { 0x7ee2bd44, 0x3da0, 0x11d4, { 0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }\r | |
26 | \r | |
27 | typedef struct _EFI_ISA_IO_PROTOCOL EFI_ISA_IO_PROTOCOL;\r | |
28 | \r | |
29 | //\r | |
f4671790 | 30 | // Width of ISA Io/Mem operation\r |
c3902377 | 31 | //\r |
c3902377 | 32 | typedef enum {\r |
33 | EfiIsaIoWidthUint8,\r | |
34 | EfiIsaIoWidthUint16,\r | |
35 | EfiIsaIoWidthUint32,\r | |
36 | EfiIsaIoWidthReserved,\r | |
37 | EfiIsaIoWidthFifoUint8,\r | |
38 | EfiIsaIoWidthFifoUint16,\r | |
39 | EfiIsaIoWidthFifoUint32,\r | |
40 | EfiIsaIoWidthFifoReserved,\r | |
41 | EfiIsaIoWidthFillUint8,\r | |
42 | EfiIsaIoWidthFillUint16,\r | |
43 | EfiIsaIoWidthFillUint32,\r | |
44 | EfiIsaIoWidthFillReserved,\r | |
45 | EfiIsaIoWidthMaximum\r | |
46 | } EFI_ISA_IO_PROTOCOL_WIDTH;\r | |
47 | \r | |
48 | //\r | |
49 | // Attributes for common buffer allocations\r | |
50 | //\r | |
f4671790 LG |
51 | #define EFI_ISA_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x080 ///< Map a memory range so write are combined\r |
52 | #define EFI_ISA_IO_ATTRIBUTE_MEMORY_CACHED 0x800 ///< Map a memory range so all r/w accesses are cached\r | |
53 | #define EFI_ISA_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 ///< Disable a memory range \r | |
c3902377 | 54 | \r |
55 | //\r | |
56 | // Channel attribute for DMA operations\r | |
57 | //\r | |
58 | #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_COMPATIBLE 0x001\r | |
59 | #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_A 0x002\r | |
60 | #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_B 0x004\r | |
61 | #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_C 0x008\r | |
62 | #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_8 0x010\r | |
63 | #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_16 0x020\r | |
64 | #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SINGLE_MODE 0x040\r | |
65 | #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_DEMAND_MODE 0x080\r | |
66 | #define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_AUTO_INITIALIZE 0x100\r | |
67 | \r | |
68 | typedef enum {\r | |
69 | EfiIsaIoOperationBusMasterRead,\r | |
70 | EfiIsaIoOperationBusMasterWrite,\r | |
71 | EfiIsaIoOperationBusMasterCommonBuffer,\r | |
72 | EfiIsaIoOperationSlaveRead,\r | |
73 | EfiIsaIoOperationSlaveWrite,\r | |
74 | EfiIsaIoOperationMaximum\r | |
75 | } EFI_ISA_IO_PROTOCOL_OPERATION;\r | |
76 | \r | |
f4671790 LG |
77 | /**\r |
78 | Performs an ISA Io/Memory Read/Write Cycle\r | |
79 | \r | |
80 | @param This A pointer to the EFI_ISA_IO_PROTOCOL instance. \r | |
81 | @param Width Signifies the width of the Io/Memory operation.\r | |
82 | @param Offset The offset in ISA Io/Memory space to start the Io/Memory operation. \r | |
83 | @param Count The number of Io/Memory operations to perform.\r | |
84 | @param Buffer [OUT] The destination buffer to store the results.\r | |
85 | [IN] The source buffer to write data to the device.\r | |
86 | \r | |
87 | @retval EFI_SUCCESS The data was read from / written to the device sucessfully.\r | |
88 | @retval EFI_UNSUPPORTED The Offset is not valid for this device.\r | |
89 | @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.\r | |
90 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
91 | \r | |
92 | **/\r | |
c3902377 | 93 | typedef\r |
94 | EFI_STATUS\r | |
95 | (EFIAPI *EFI_ISA_IO_PROTOCOL_IO_MEM) (\r | |
96 | IN EFI_ISA_IO_PROTOCOL *This,\r | |
97 | IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r | |
98 | IN UINT32 Offset,\r | |
99 | IN UINTN Count,\r | |
100 | IN OUT VOID *Buffer\r | |
101 | );\r | |
102 | \r | |
103 | typedef struct {\r | |
104 | EFI_ISA_IO_PROTOCOL_IO_MEM Read;\r | |
105 | EFI_ISA_IO_PROTOCOL_IO_MEM Write;\r | |
106 | } EFI_ISA_IO_PROTOCOL_ACCESS;\r | |
107 | \r | |
f4671790 LG |
108 | /**\r |
109 | Performs an ISA I/O Copy Memory \r | |
110 | \r | |
111 | @param This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
112 | @param Width Signifies the width of the memory copy operation.\r | |
113 | @param DestOffset The offset of the destination \r | |
114 | @param SrcOffset The offset of the source\r | |
115 | @param Count The number of memory copy operations to perform\r | |
116 | \r | |
117 | @retval EFI_SUCCESS The data was copied sucessfully.\r | |
118 | @retval EFI_UNSUPPORTED The DestOffset or SrcOffset is not valid for this device.\r | |
119 | @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.\r | |
120 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
121 | \r | |
122 | **/\r | |
c3902377 | 123 | typedef\r |
124 | EFI_STATUS\r | |
125 | (EFIAPI *EFI_ISA_IO_PROTOCOL_COPY_MEM) (\r | |
126 | IN EFI_ISA_IO_PROTOCOL *This,\r | |
127 | IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r | |
128 | IN UINT32 DestOffset,\r | |
129 | IN UINT32 SrcOffset,\r | |
130 | IN UINTN Count\r | |
131 | );\r | |
132 | \r | |
f4671790 LG |
133 | /**\r |
134 | Maps a memory region for DMA\r | |
135 | \r | |
136 | @param This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
137 | @param Operation Indicates the type of DMA (slave or bus master), and if \r | |
138 | the DMA operation is going to read or write to system memory. \r | |
139 | @param ChannelNumber The slave channel number to use for this DMA operation. \r | |
140 | If Operation and ChannelAttributes shows that this device \r | |
141 | performs bus mastering DMA, then this field is ignored. \r | |
142 | The legal range for this field is 0..7. \r | |
143 | @param ChannelAttributes The attributes of the DMA channel to use for this DMA operation\r | |
144 | @param HostAddress The system memory address to map to the device. \r | |
145 | @param NumberOfBytes On input the number of bytes to map. On output the number \r | |
146 | of bytes that were mapped.\r | |
147 | @param DeviceAddress The resulting map address for the bus master device to use \r | |
148 | to access the hosts HostAddress. \r | |
149 | @param Mapping A resulting value to pass to EFI_ISA_IO.Unmap().\r | |
150 | \r | |
151 | \r | |
152 | @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.\r | |
153 | @retval EFI_INVALID_PARAMETER The Operation or HostAddress is undefined.\r | |
154 | @retval EFI_UNSUPPORTED The HostAddress can not be mapped as a common buffer.\r | |
155 | @retval EFI_DEVICE_ERROR The system hardware could not map the requested address.\r | |
156 | @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.\r | |
157 | \r | |
158 | **/\r | |
c3902377 | 159 | typedef\r |
160 | EFI_STATUS\r | |
161 | (EFIAPI *EFI_ISA_IO_PROTOCOL_MAP) (\r | |
162 | IN EFI_ISA_IO_PROTOCOL *This,\r | |
163 | IN EFI_ISA_IO_PROTOCOL_OPERATION Operation,\r | |
164 | IN UINT8 ChannelNumber OPTIONAL,\r | |
165 | IN UINT32 ChannelAttributes,\r | |
166 | IN VOID *HostAddress,\r | |
167 | IN OUT UINTN *NumberOfBytes,\r | |
168 | OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r | |
169 | OUT VOID **Mapping\r | |
170 | );\r | |
171 | \r | |
f4671790 LG |
172 | /**\r |
173 | Unmaps a memory region for DMA\r | |
174 | \r | |
175 | @param This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
176 | @param Mapping The mapping value returned from EFI_ISA_IO.Map().\r | |
177 | \r | |
178 | @retval EFI_SUCCESS The range was unmapped.\r | |
179 | @retval EFI_DEVICE_ERROR The data was not committed to the target system memory.\r | |
180 | \r | |
181 | **/\r | |
c3902377 | 182 | typedef\r |
183 | EFI_STATUS\r | |
184 | (EFIAPI *EFI_ISA_IO_PROTOCOL_UNMAP) (\r | |
185 | IN EFI_ISA_IO_PROTOCOL *This,\r | |
186 | IN VOID *Mapping\r | |
187 | );\r | |
188 | \r | |
f4671790 LG |
189 | /**\r |
190 | Allocates a common buffer for DMA\r | |
191 | \r | |
192 | @param This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
193 | @param Type The type allocation to perform.\r | |
194 | @param MemoryType The type of memory to allocate.\r | |
195 | @param Pages The number of pages to allocate.\r | |
196 | @param HostAddress A pointer to store the base address of the allocated range.\r | |
197 | @param Attributes The requested bit mask of attributes for the allocated range.\r | |
198 | \r | |
199 | @retval EFI_SUCCESS The requested memory pages were allocated.\r | |
200 | @retval EFI_INVALID_PARAMETER Type is invalid or MemoryType is invalid or HostAddress is NULL\r | |
201 | @retval EFI_UNSUPPORTED Attributes is unsupported or the memory range specified \r | |
202 | by HostAddress, Pages, and Type is not available for common buffer use.\r | |
203 | @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.\r | |
204 | \r | |
205 | **/\r | |
c3902377 | 206 | typedef\r |
207 | EFI_STATUS\r | |
208 | (EFIAPI *EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER) (\r | |
209 | IN EFI_ISA_IO_PROTOCOL *This,\r | |
210 | IN EFI_ALLOCATE_TYPE Type,\r | |
211 | IN EFI_MEMORY_TYPE MemoryType,\r | |
212 | IN UINTN Pages,\r | |
213 | OUT VOID **HostAddress,\r | |
214 | IN UINT64 Attributes\r | |
215 | );\r | |
216 | \r | |
f4671790 LG |
217 | /**\r |
218 | Frees a common buffer \r | |
219 | \r | |
220 | @param This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
221 | @param Pages The number of pages to free.\r | |
222 | @param HostAddress The base address of the allocated range.\r | |
223 | \r | |
224 | \r | |
225 | @retval EFI_SUCCESS The requested memory pages were freed.\r | |
226 | @retval EFI_INVALID_PARAMETER The memory was not allocated with EFI_ISA_IO.AllocateBufer().\r | |
227 | \r | |
228 | **/\r | |
c3902377 | 229 | typedef\r |
230 | EFI_STATUS\r | |
231 | (EFIAPI *EFI_ISA_IO_PROTOCOL_FREE_BUFFER) (\r | |
232 | IN EFI_ISA_IO_PROTOCOL *This,\r | |
233 | IN UINTN Pages,\r | |
234 | IN VOID *HostAddress\r | |
235 | );\r | |
236 | \r | |
f4671790 LG |
237 | /**\r |
238 | Flushes a DMA buffer\r | |
239 | \r | |
240 | @param This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
241 | \r | |
242 | @retval EFI_SUCCESS The buffers were flushed.\r | |
243 | @retval EFI_DEVICE_ERROR The buffers were not flushed due to a hardware error.\r | |
244 | \r | |
245 | **/\r | |
c3902377 | 246 | typedef\r |
247 | EFI_STATUS\r | |
248 | (EFIAPI *EFI_ISA_IO_PROTOCOL_FLUSH) (\r | |
249 | IN EFI_ISA_IO_PROTOCOL *This\r | |
250 | );\r | |
251 | \r | |
252 | //\r | |
253 | // Interface structure for the ISA I/O Protocol\r | |
254 | //\r | |
255 | struct _EFI_ISA_IO_PROTOCOL {\r | |
256 | EFI_ISA_IO_PROTOCOL_ACCESS Mem;\r | |
257 | EFI_ISA_IO_PROTOCOL_ACCESS Io;\r | |
258 | EFI_ISA_IO_PROTOCOL_COPY_MEM CopyMem;\r | |
259 | EFI_ISA_IO_PROTOCOL_MAP Map;\r | |
260 | EFI_ISA_IO_PROTOCOL_UNMAP Unmap;\r | |
261 | EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;\r | |
262 | EFI_ISA_IO_PROTOCOL_FREE_BUFFER FreeBuffer;\r | |
263 | EFI_ISA_IO_PROTOCOL_FLUSH Flush;\r | |
264 | EFI_ISA_ACPI_RESOURCE_LIST *ResourceList;\r | |
265 | UINT32 RomSize;\r | |
266 | VOID *RomImage;\r | |
267 | };\r | |
268 | \r | |
269 | extern EFI_GUID gEfiIsaIoProtocolGuid;\r | |
270 | \r | |
271 | #endif\r |