]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Bus/Isa/IsaIoDxe/IsaIo.h
FmpDevicePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Isa / IsaIoDxe / IsaIo.h
CommitLineData
558be455
RN
1/** @file\r
2 The header file for EFI_ISA_IO protocol implementation.\r
0a6f4824
LG
3\r
4Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
558be455
RN
5This program and the accompanying materials\r
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
14\r
15#ifndef _ISA_IO_H_\r
16#define _ISA_IO_H_\r
17\r
18#include "IsaDriver.h"\r
19\r
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
27//\r
28// ISA I/O Support Function Prototypes\r
29//\r
30\r
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
0a6f4824
LG
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
558be455
RN
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
44EFI_STATUS\r
45IsaIoVerifyAccess (\r
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
51 );\r
0a6f4824 52\r
558be455
RN
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
0a6f4824
LG
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
558be455
RN
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
67EFI_STATUS\r
68EFIAPI\r
69IsaIoIoRead (\r
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
75 );\r
76\r
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
0a6f4824
LG
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
558be455
RN
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
91EFI_STATUS\r
92EFIAPI\r
93IsaIoIoWrite (\r
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
99 );\r
100\r
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
0a6f4824
LG
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
558be455 111 @param ChannelAttributes The attributes of the DMA channel to use for this DMA operation\r
0a6f4824
LG
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
558be455 114 of bytes that were mapped.\r
0a6f4824
LG
115 @param DeviceAddress The resulting map address for the bus master device to use\r
116 to access the hosts HostAddress.\r
558be455
RN
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
125EFI_STATUS\r
126EFIAPI\r
127IsaIoMap (\r
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
136 );\r
137\r
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
147EFI_STATUS\r
148EFIAPI\r
149IsaIoUnmap (\r
150 IN EFI_ISA_IO_PROTOCOL *This,\r
151 IN VOID *Mapping\r
152 );\r
153\r
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
162EFI_STATUS\r
163EFIAPI\r
164IsaIoFlush (\r
165 IN EFI_ISA_IO_PROTOCOL *This\r
166 );\r
167\r
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
0a6f4824
LG
176 @param[in] Count The number of I/O operations to perform.\r
177\r
558be455
RN
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
183EFI_STATUS\r
184WriteDmaPort (\r
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
191 );\r
192\r
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
0a6f4824 197 @param[in] Offset The offset in ISA IO space to start the IO operation.\r
558be455
RN
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
205EFI_STATUS\r
206WritePort (\r
207 IN EFI_ISA_IO_PROTOCOL *This,\r
208 IN UINT32 Offset,\r
209 IN UINT8 Value\r
0a6f4824 210 );\r
558be455
RN
211\r
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
0a6f4824
LG
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
558be455 219 @param[out] Buffer The destination buffer to store the results\r
0a6f4824 220\r
558be455
RN
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
226EFI_STATUS\r
227EFIAPI\r
228IsaIoMemRead (\r
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
234 );\r
235\r
236\r
237/**\r
238 Performs an ISA Memory Write Cycle\r
239\r
0a6f4824 240 @param[in] This A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
558be455 241 @param[in] Width Specifies the width of the memory operation.\r
0a6f4824
LG
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
558be455
RN
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
251EFI_STATUS\r
252EFIAPI\r
253IsaIoMemWrite (\r
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
259 );\r
260\r
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
0a6f4824 266 @param[in] DestOffset The offset of the destination\r
558be455
RN
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
275EFI_STATUS\r
276EFIAPI\r
277IsaIoCopyMem (\r
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
283 );\r
284\r
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
0a6f4824 297 @retval EFI_UNSUPPORTED Attributes is unsupported or the memory range specified\r
558be455
RN
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
301EFI_STATUS\r
302EFIAPI\r
303IsaIoAllocateBuffer (\r
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
310 );\r
311\r
312/**\r
0a6f4824 313 Frees memory that was allocated with EFI_ISA_IO.AllocateBuffer().\r
558be455
RN
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
322EFI_STATUS\r
323EFIAPI\r
324IsaIoFreeBuffer (\r
325 IN EFI_ISA_IO_PROTOCOL *This,\r
326 IN UINTN Pages,\r
327 IN VOID *HostAddress\r
328 );\r
329\r
330#endif\r
331\r