]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/InternalIsaIo.h
Use REPORT_STATUS_CODExxx() macros directly.
[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
ee686203 4Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
180a5a35 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 Writes I/O operation base address and count number to a 8 bit I/O Port.\r
170\r
171 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
172 @param[in] AddrOffset The address' offset.\r
173 @param[in] PageOffset The page's offest.\r
174 @param[in] CountOffset The count's offset.\r
175 @param[in] BaseAddress The base address.\r
176 @param[in] Count The number of I/O operations to perform. \r
177 \r
178 @retval EFI_SUCCESS Success.\r
179 @retval EFI_INVALID_PARAMETER Parameter is invalid.\r
180 @retval EFI_UNSUPPORTED The address range specified by these Offsets and Count is not valid.\r
181 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
182**/\r
c3902377 183EFI_STATUS\r
184WriteDmaPort (\r
6fcb2d91 185 IN EFI_ISA_IO_PROTOCOL *This,\r
186 IN UINT32 AddrOffset,\r
187 IN UINT32 PageOffset,\r
188 IN UINT32 CountOffset,\r
189 IN UINT32 BaseAddress,\r
190 IN UINT16 Count\r
c3902377 191 );\r
192\r
0a2dfa19 193/**\r
194 Writes an 8-bit I/O Port\r
195\r
196 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
197 @param[in] Offset The offset in ISA IO space to start the IO operation. \r
198 @param[in] Value The data to write port.\r
199\r
200 @retval EFI_SUCCESS Success.\r
201 @retval EFI_INVALID_PARAMETER Parameter is invalid.\r
202 @retval EFI_UNSUPPORTED The address range specified by Offset is not valid.\r
203 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
204**/\r
c3902377 205EFI_STATUS\r
206WritePort (\r
6fcb2d91 207 IN EFI_ISA_IO_PROTOCOL *This,\r
208 IN UINT32 Offset,\r
209 IN UINT8 Value\r
c3902377 210 ); \r
211\r
0a2dfa19 212/**\r
213 Performs an ISA Memory Read Cycle\r
214\r
215 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
216 @param[in] Width Specifies the width of the memory operation.\r
217 @param[in] Offset The offset in ISA memory space to start the memory operation. \r
218 @param[in] Count The number of memory operations to perform. \r
219 @param[out] Buffer The destination buffer to store the results\r
220 \r
221 @retval EFI_SUCCESS The data was read from the device successfully.\r
222 @retval EFI_UNSUPPORTED The Offset is not valid for this device.\r
223 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.\r
224 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
225**/\r
c3902377 226EFI_STATUS\r
227EFIAPI\r
228IsaIoMemRead (\r
6fcb2d91 229 IN EFI_ISA_IO_PROTOCOL *This,\r
230 IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
231 IN UINT32 Offset,\r
232 IN UINTN Count,\r
233 OUT VOID *Buffer\r
c3902377 234 );\r
235\r
236\r
0a2dfa19 237/**\r
238 Performs an ISA Memory Write Cycle\r
239\r
240 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance. \r
241 @param[in] Width Specifies the width of the memory operation.\r
242 @param[in] Offset The offset in ISA memory space to start the memory operation. \r
243 @param[in] Count The number of memory operations to perform. \r
244 @param[in] Buffer The source buffer to write data from\r
245\r
246 @retval EFI_SUCCESS The data was written to the device sucessfully.\r
247 @retval EFI_UNSUPPORTED The Offset is not valid for this device.\r
248 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.\r
249 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
250**/\r
c3902377 251EFI_STATUS\r
252EFIAPI\r
253IsaIoMemWrite (\r
6fcb2d91 254 IN EFI_ISA_IO_PROTOCOL *This,\r
255 IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
256 IN UINT32 Offset,\r
257 IN UINTN Count,\r
258 IN VOID *Buffer\r
c3902377 259 );\r
260\r
0a2dfa19 261/**\r
262 Copy one region of ISA memory space to another region of ISA memory space on the ISA controller.\r
263\r
264 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
265 @param[in] Width Specifies the width of the memory copy operation.\r
266 @param[in] DestOffset The offset of the destination \r
267 @param[in] SrcOffset The offset of the source\r
268 @param[in] Count The number of memory copy operations to perform\r
269\r
270 @retval EFI_SUCCESS The data was copied sucessfully.\r
271 @retval EFI_UNSUPPORTED The DestOffset or SrcOffset is not valid for this device.\r
272 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.\r
273 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
274**/\r
c3902377 275EFI_STATUS\r
276EFIAPI\r
277IsaIoCopyMem (\r
6fcb2d91 278 IN EFI_ISA_IO_PROTOCOL *This,\r
279 IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
280 IN UINT32 DestOffset,\r
281 IN UINT32 SrcOffset,\r
282 IN UINTN Count\r
c3902377 283 );\r
284\r
0a2dfa19 285/**\r
286 Allocates pages that are suitable for an EfiIsaIoOperationBusMasterCommonBuffer mapping.\r
287\r
288 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
289 @param[in] Type The type allocation to perform.\r
290 @param[in] MemoryType The type of memory to allocate.\r
291 @param[in] Pages The number of pages to allocate.\r
292 @param[out] HostAddress A pointer to store the base address of the allocated range.\r
293 @param[in] Attributes The requested bit mask of attributes for the allocated range.\r
294\r
295 @retval EFI_SUCCESS The requested memory pages were allocated.\r
296 @retval EFI_INVALID_PARAMETER Type is invalid or MemoryType is invalid or HostAddress is NULL\r
297 @retval EFI_UNSUPPORTED Attributes is unsupported or the memory range specified \r
298 by HostAddress, Pages, and Type is not available for common buffer use.\r
299 @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.\r
300**/\r
c3902377 301EFI_STATUS\r
302EFIAPI\r
303IsaIoAllocateBuffer (\r
6fcb2d91 304 IN EFI_ISA_IO_PROTOCOL *This,\r
305 IN EFI_ALLOCATE_TYPE Type,\r
306 IN EFI_MEMORY_TYPE MemoryType,\r
307 IN UINTN Pages,\r
308 OUT VOID **HostAddress,\r
309 IN UINT64 Attributes\r
c3902377 310 );\r
311\r
0a2dfa19 312/**\r
313 Frees memory that was allocated with EFI_ISA_IO.AllocateBuffer(). \r
314\r
315 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
316 @param[in] Pages The number of pages to free.\r
317 @param[in] HostAddress The base address of the allocated range.\r
318\r
319 @retval EFI_SUCCESS The requested memory pages were freed.\r
320 @retval EFI_INVALID_PARAMETER The memory was not allocated with EFI_ISA_IO.AllocateBufer().\r
321**/\r
c3902377 322EFI_STATUS\r
323EFIAPI\r
324IsaIoFreeBuffer (\r
6fcb2d91 325 IN EFI_ISA_IO_PROTOCOL *This,\r
326 IN UINTN Pages,\r
327 IN VOID *HostAddress\r
c3902377 328 );\r
329\r
330#endif\r
6fcb2d91 331\r