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