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