]>
Commit | Line | Data |
---|---|---|
0a2dfa19 | 1 | /** @file\r |
c3902377 | 2 | The header file for EFI_ISA_IO protocol implementation.\r |
3 | \r | |
6fcb2d91 | 4 | Copyright (c) 2006 - 2009, Intel Corporation.<BR>\r |
f8cd287b | 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 | |
13 | **/\r | |
c3902377 | 14 | \r |
6fcb2d91 | 15 | #ifndef _INTERNAL_ISA_IO_H_\r |
16 | #define _INTERNAL_ISA_IO_H_\r | |
c3902377 | 17 | \r |
c3902377 | 18 | #include "InternalIsaBus.h"\r |
19 | \r | |
20 | //\r | |
21 | // ISA I/O Support Function Prototypes\r | |
22 | //\r | |
23 | \r | |
0a2dfa19 | 24 | /**\r |
25 | Verifies access to an ISA device\r | |
26 | \r | |
27 | @param[in] IsaIoDevice The ISA device to be verified.\r | |
28 | @param[in] Type The Access type. The input must be either IsaAccessTypeMem or IsaAccessTypeIo.\r | |
29 | @param[in] Width The width of the memory operation.\r | |
30 | @param[in] Count The number of memory operations to perform. \r | |
31 | @param[in] Offset The offset in ISA memory space to start the memory operation. \r | |
32 | \r | |
33 | @retval EFI_SUCCESS Verify success.\r | |
34 | @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r | |
35 | @retval EFI_UNSUPPORTED The device ont support the access type.\r | |
36 | **/\r | |
c3902377 | 37 | EFI_STATUS\r |
38 | IsaIoVerifyAccess (\r | |
6fcb2d91 | 39 | IN ISA_IO_DEVICE *IsaIoDevice,\r |
40 | IN ISA_ACCESS_TYPE Type,\r | |
41 | IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r | |
42 | IN UINTN Count,\r | |
43 | IN UINT32 Offset\r | |
c3902377 | 44 | );\r |
45 | \r | |
0a2dfa19 | 46 | /**\r |
47 | Performs an ISA I/O Read Cycle\r | |
48 | \r | |
49 | @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
50 | @param[in] Width Specifies the width of the I/O operation.\r | |
51 | @param[in] Offset The offset in ISA I/O space to start the I/O operation. \r | |
52 | @param[in] Count The number of I/O operations to perform. \r | |
53 | @param[out] Buffer The destination buffer to store the results\r | |
54 | \r | |
55 | @retval EFI_SUCCESS The data was read from the device sucessfully.\r | |
56 | @retval EFI_UNSUPPORTED The Offset is not valid for this device.\r | |
57 | @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.\r | |
58 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
59 | **/\r | |
c3902377 | 60 | EFI_STATUS\r |
61 | EFIAPI\r | |
62 | IsaIoIoRead (\r | |
6fcb2d91 | 63 | IN EFI_ISA_IO_PROTOCOL *This,\r |
64 | IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r | |
65 | IN UINT32 Offset,\r | |
66 | IN UINTN Count,\r | |
67 | OUT VOID *Buffer\r | |
c3902377 | 68 | );\r |
69 | \r | |
0a2dfa19 | 70 | /**\r |
71 | Performs an ISA I/O Write Cycle\r | |
72 | \r | |
73 | @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
74 | @param[in] Width Specifies the width of the I/O operation.\r | |
75 | @param[in] Offset The offset in ISA I/O space to start the I/O operation. \r | |
76 | @param[in] Count The number of I/O operations to perform. \r | |
77 | @param[in] Buffer The source buffer to write data from\r | |
78 | \r | |
79 | @retval EFI_SUCCESS The data was writen to the device sucessfully.\r | |
80 | @retval EFI_UNSUPPORTED The Offset is not valid for this device.\r | |
81 | @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.\r | |
82 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
83 | **/\r | |
c3902377 | 84 | EFI_STATUS\r |
85 | EFIAPI\r | |
86 | IsaIoIoWrite (\r | |
6fcb2d91 | 87 | IN EFI_ISA_IO_PROTOCOL *This,\r |
88 | IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r | |
89 | IN UINT32 Offset,\r | |
90 | IN UINTN Count,\r | |
91 | IN VOID *Buffer\r | |
c3902377 | 92 | );\r |
93 | \r | |
0a2dfa19 | 94 | /**\r |
95 | Maps a memory region for DMA\r | |
96 | \r | |
97 | @param This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
98 | @param Operation Indicates the type of DMA (slave or bus master), and if \r | |
99 | the DMA operation is going to read or write to system memory. \r | |
100 | @param ChannelNumber The slave channel number to use for this DMA operation. \r | |
101 | If Operation and ChannelAttributes shows that this device \r | |
102 | performs bus mastering DMA, then this field is ignored. \r | |
103 | The legal range for this field is 0..7. \r | |
104 | @param ChannelAttributes The attributes of the DMA channel to use for this DMA operation\r | |
105 | @param HostAddress The system memory address to map to the device. \r | |
106 | @param NumberOfBytes On input the number of bytes to map. On output the number \r | |
107 | of bytes that were mapped.\r | |
108 | @param DeviceAddress The resulting map address for the bus master device to use \r | |
109 | to access the hosts HostAddress. \r | |
110 | @param Mapping A resulting value to pass to EFI_ISA_IO.Unmap().\r | |
111 | \r | |
112 | @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.\r | |
113 | @retval EFI_INVALID_PARAMETER The Operation or HostAddress is undefined.\r | |
114 | @retval EFI_UNSUPPORTED The HostAddress can not be mapped as a common buffer.\r | |
115 | @retval EFI_DEVICE_ERROR The system hardware could not map the requested address.\r | |
116 | @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.\r | |
117 | **/\r | |
c3902377 | 118 | EFI_STATUS\r |
119 | EFIAPI\r | |
120 | IsaIoMap (\r | |
6fcb2d91 | 121 | IN EFI_ISA_IO_PROTOCOL *This,\r |
122 | IN EFI_ISA_IO_PROTOCOL_OPERATION Operation,\r | |
123 | IN UINT8 ChannelNumber OPTIONAL,\r | |
124 | IN UINT32 ChannelAttributes,\r | |
125 | IN VOID *HostAddress,\r | |
126 | IN OUT UINTN *NumberOfBytes,\r | |
127 | OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r | |
128 | OUT VOID **Mapping\r | |
c3902377 | 129 | );\r |
130 | \r | |
0a2dfa19 | 131 | /**\r |
132 | Unmaps a memory region for DMA\r | |
133 | \r | |
134 | @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
135 | @param[in] Mapping The mapping value returned from EFI_ISA_IO.Map().\r | |
136 | \r | |
137 | @retval EFI_SUCCESS The range was unmapped.\r | |
138 | @retval EFI_DEVICE_ERROR The data was not committed to the target system memory.\r | |
139 | **/\r | |
c3902377 | 140 | EFI_STATUS\r |
141 | EFIAPI\r | |
142 | IsaIoUnmap (\r | |
6fcb2d91 | 143 | IN EFI_ISA_IO_PROTOCOL *This,\r |
144 | IN VOID *Mapping\r | |
c3902377 | 145 | );\r |
146 | \r | |
0a2dfa19 | 147 | /**\r |
148 | Flushes any posted write data to the system memory.\r | |
149 | \r | |
150 | @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
151 | \r | |
152 | @retval EFI_SUCCESS The buffers were flushed.\r | |
153 | @retval EFI_DEVICE_ERROR The buffers were not flushed due to a hardware error.\r | |
154 | **/\r | |
c3902377 | 155 | EFI_STATUS\r |
156 | EFIAPI\r | |
157 | IsaIoFlush (\r | |
6fcb2d91 | 158 | IN EFI_ISA_IO_PROTOCOL *This\r |
c3902377 | 159 | );\r |
160 | \r | |
0a2dfa19 | 161 | /**\r |
162 | report a error Status code\r | |
163 | \r | |
164 | @param Code The error status code.\r | |
165 | \r | |
166 | @return EFI_SUCCESS Success to report status code.\r | |
167 | **/\r | |
c3902377 | 168 | EFI_STATUS\r |
169 | ReportErrorStatusCode (\r | |
0a2dfa19 | 170 | EFI_STATUS_CODE_VALUE Code\r |
c3902377 | 171 | );\r |
172 | \r | |
0a2dfa19 | 173 | /**\r |
174 | Writes I/O operation base address and count number to a 8 bit I/O Port.\r | |
175 | \r | |
176 | @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
177 | @param[in] AddrOffset The address' offset.\r | |
178 | @param[in] PageOffset The page's offest.\r | |
179 | @param[in] CountOffset The count's offset.\r | |
180 | @param[in] BaseAddress The base address.\r | |
181 | @param[in] Count The number of I/O operations to perform. \r | |
182 | \r | |
183 | @retval EFI_SUCCESS Success.\r | |
184 | @retval EFI_INVALID_PARAMETER Parameter is invalid.\r | |
185 | @retval EFI_UNSUPPORTED The address range specified by these Offsets and Count is not valid.\r | |
186 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
187 | **/\r | |
c3902377 | 188 | EFI_STATUS\r |
189 | WriteDmaPort (\r | |
6fcb2d91 | 190 | IN EFI_ISA_IO_PROTOCOL *This,\r |
191 | IN UINT32 AddrOffset,\r | |
192 | IN UINT32 PageOffset,\r | |
193 | IN UINT32 CountOffset,\r | |
194 | IN UINT32 BaseAddress,\r | |
195 | IN UINT16 Count\r | |
c3902377 | 196 | );\r |
197 | \r | |
0a2dfa19 | 198 | /**\r |
199 | Writes an 8-bit I/O Port\r | |
200 | \r | |
201 | @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
202 | @param[in] Offset The offset in ISA IO space to start the IO operation. \r | |
203 | @param[in] Value The data to write port.\r | |
204 | \r | |
205 | @retval EFI_SUCCESS Success.\r | |
206 | @retval EFI_INVALID_PARAMETER Parameter is invalid.\r | |
207 | @retval EFI_UNSUPPORTED The address range specified by Offset is not valid.\r | |
208 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
209 | **/\r | |
c3902377 | 210 | EFI_STATUS\r |
211 | WritePort (\r | |
6fcb2d91 | 212 | IN EFI_ISA_IO_PROTOCOL *This,\r |
213 | IN UINT32 Offset,\r | |
214 | IN UINT8 Value\r | |
c3902377 | 215 | ); \r |
216 | \r | |
0a2dfa19 | 217 | /**\r |
218 | Performs an ISA Memory Read Cycle\r | |
219 | \r | |
220 | @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
221 | @param[in] Width Specifies the width of the memory operation.\r | |
222 | @param[in] Offset The offset in ISA memory space to start the memory operation. \r | |
223 | @param[in] Count The number of memory operations to perform. \r | |
224 | @param[out] Buffer The destination buffer to store the results\r | |
225 | \r | |
226 | @retval EFI_SUCCESS The data was read from the device successfully.\r | |
227 | @retval EFI_UNSUPPORTED The Offset is not valid for this device.\r | |
228 | @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.\r | |
229 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
230 | **/\r | |
c3902377 | 231 | EFI_STATUS\r |
232 | EFIAPI\r | |
233 | IsaIoMemRead (\r | |
6fcb2d91 | 234 | IN EFI_ISA_IO_PROTOCOL *This,\r |
235 | IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r | |
236 | IN UINT32 Offset,\r | |
237 | IN UINTN Count,\r | |
238 | OUT VOID *Buffer\r | |
c3902377 | 239 | );\r |
240 | \r | |
241 | \r | |
0a2dfa19 | 242 | /**\r |
243 | Performs an ISA Memory Write Cycle\r | |
244 | \r | |
245 | @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance. \r | |
246 | @param[in] Width Specifies the width of the memory operation.\r | |
247 | @param[in] Offset The offset in ISA memory space to start the memory operation. \r | |
248 | @param[in] Count The number of memory operations to perform. \r | |
249 | @param[in] Buffer The source buffer to write data from\r | |
250 | \r | |
251 | @retval EFI_SUCCESS The data was written to the device sucessfully.\r | |
252 | @retval EFI_UNSUPPORTED The Offset is not valid for this device.\r | |
253 | @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.\r | |
254 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
255 | **/\r | |
c3902377 | 256 | EFI_STATUS\r |
257 | EFIAPI\r | |
258 | IsaIoMemWrite (\r | |
6fcb2d91 | 259 | IN EFI_ISA_IO_PROTOCOL *This,\r |
260 | IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r | |
261 | IN UINT32 Offset,\r | |
262 | IN UINTN Count,\r | |
263 | IN VOID *Buffer\r | |
c3902377 | 264 | );\r |
265 | \r | |
0a2dfa19 | 266 | /**\r |
267 | Copy one region of ISA memory space to another region of ISA memory space on the ISA controller.\r | |
268 | \r | |
269 | @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
270 | @param[in] Width Specifies the width of the memory copy operation.\r | |
271 | @param[in] DestOffset The offset of the destination \r | |
272 | @param[in] SrcOffset The offset of the source\r | |
273 | @param[in] Count The number of memory copy operations to perform\r | |
274 | \r | |
275 | @retval EFI_SUCCESS The data was copied sucessfully.\r | |
276 | @retval EFI_UNSUPPORTED The DestOffset or SrcOffset is not valid for this device.\r | |
277 | @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.\r | |
278 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
279 | **/\r | |
c3902377 | 280 | EFI_STATUS\r |
281 | EFIAPI\r | |
282 | IsaIoCopyMem (\r | |
6fcb2d91 | 283 | IN EFI_ISA_IO_PROTOCOL *This,\r |
284 | IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r | |
285 | IN UINT32 DestOffset,\r | |
286 | IN UINT32 SrcOffset,\r | |
287 | IN UINTN Count\r | |
c3902377 | 288 | );\r |
289 | \r | |
0a2dfa19 | 290 | /**\r |
291 | Allocates pages that are suitable for an EfiIsaIoOperationBusMasterCommonBuffer mapping.\r | |
292 | \r | |
293 | @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
294 | @param[in] Type The type allocation to perform.\r | |
295 | @param[in] MemoryType The type of memory to allocate.\r | |
296 | @param[in] Pages The number of pages to allocate.\r | |
297 | @param[out] HostAddress A pointer to store the base address of the allocated range.\r | |
298 | @param[in] Attributes The requested bit mask of attributes for the allocated range.\r | |
299 | \r | |
300 | @retval EFI_SUCCESS The requested memory pages were allocated.\r | |
301 | @retval EFI_INVALID_PARAMETER Type is invalid or MemoryType is invalid or HostAddress is NULL\r | |
302 | @retval EFI_UNSUPPORTED Attributes is unsupported or the memory range specified \r | |
303 | by HostAddress, Pages, and Type is not available for common buffer use.\r | |
304 | @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.\r | |
305 | **/\r | |
c3902377 | 306 | EFI_STATUS\r |
307 | EFIAPI\r | |
308 | IsaIoAllocateBuffer (\r | |
6fcb2d91 | 309 | IN EFI_ISA_IO_PROTOCOL *This,\r |
310 | IN EFI_ALLOCATE_TYPE Type,\r | |
311 | IN EFI_MEMORY_TYPE MemoryType,\r | |
312 | IN UINTN Pages,\r | |
313 | OUT VOID **HostAddress,\r | |
314 | IN UINT64 Attributes\r | |
c3902377 | 315 | );\r |
316 | \r | |
0a2dfa19 | 317 | /**\r |
318 | Frees memory that was allocated with EFI_ISA_IO.AllocateBuffer(). \r | |
319 | \r | |
320 | @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r | |
321 | @param[in] Pages The number of pages to free.\r | |
322 | @param[in] HostAddress The base address of the allocated range.\r | |
323 | \r | |
324 | @retval EFI_SUCCESS The requested memory pages were freed.\r | |
325 | @retval EFI_INVALID_PARAMETER The memory was not allocated with EFI_ISA_IO.AllocateBufer().\r | |
326 | **/\r | |
c3902377 | 327 | EFI_STATUS\r |
328 | EFIAPI\r | |
329 | IsaIoFreeBuffer (\r | |
6fcb2d91 | 330 | IN EFI_ISA_IO_PROTOCOL *This,\r |
331 | IN UINTN Pages,\r | |
332 | IN VOID *HostAddress\r | |
c3902377 | 333 | );\r |
334 | \r | |
335 | #endif\r | |
6fcb2d91 | 336 | \r |