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