]>
Commit | Line | Data |
---|---|---|
de22b698 | 1 | /** @file\r |
50a64e5b | 2 | Provide services to access I/O Ports and MMIO registers.\r |
de22b698 | 3 | \r |
9095d37b | 4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
19c6d9fe LD |
5 | Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>\r |
6 | \r | |
9344f092 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
de22b698 | 8 | \r |
9 | **/\r | |
10 | \r | |
11 | #ifndef __IO_LIB_H__\r | |
12 | #define __IO_LIB_H__\r | |
13 | \r | |
5ac79a78 | 14 | /**\r |
15 | Macro that converts PCI Segment and I/O Port to an address that can be\r | |
16 | passed to the I/O Library functions.\r | |
9095d37b LG |
17 | \r |
18 | Computes an address that is compatible with the I/O Library functions.\r | |
19 | The unused upper bits of Segment, and Port are stripped prior to the\r | |
5ac79a78 | 20 | generation of the address.\r |
9095d37b | 21 | \r |
5ac79a78 | 22 | @param Segment PCI Segment number. Range 0..65535.\r |
23 | @param Port I/O Port number. Range 0..65535.\r | |
9095d37b | 24 | \r |
5ac79a78 | 25 | @return An address that the I/o Library functions need.\r |
26 | \r | |
27 | **/\r | |
28 | \r | |
de22b698 | 29 | #define IO_LIB_ADDRESS(Segment,Port) \\r |
30 | ( ((Port) & 0xffff) | (((Segment) & 0xffff) << 16) )\r | |
31 | \r | |
32 | /**\r | |
33 | Reads an 8-bit I/O port.\r | |
34 | \r | |
35 | Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.\r | |
36 | This function must guarantee that all I/O read and write operations are\r | |
37 | serialized.\r | |
38 | \r | |
39 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
40 | \r | |
41 | @param Port The I/O port to read.\r | |
42 | \r | |
43 | @return The value read.\r | |
44 | \r | |
45 | **/\r | |
46 | UINT8\r | |
47 | EFIAPI\r | |
48 | IoRead8 (\r | |
49 | IN UINTN Port\r | |
50 | );\r | |
51 | \r | |
52 | /**\r | |
53 | Writes an 8-bit I/O port.\r | |
54 | \r | |
55 | Writes the 8-bit I/O port specified by Port with the value specified by Value\r | |
56 | and returns Value. This function must guarantee that all I/O read and write\r | |
57 | operations are serialized.\r | |
58 | \r | |
59 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
60 | \r | |
61 | @param Port The I/O port to write.\r | |
62 | @param Value The value to write to the I/O port.\r | |
63 | \r | |
64 | @return The value written the I/O port.\r | |
65 | \r | |
66 | **/\r | |
67 | UINT8\r | |
68 | EFIAPI\r | |
69 | IoWrite8 (\r | |
70 | IN UINTN Port,\r | |
71 | IN UINT8 Value\r | |
72 | );\r | |
73 | \r | |
19c6d9fe LD |
74 | /**\r |
75 | Reads an 8-bit I/O port fifo into a block of memory.\r | |
76 | \r | |
77 | Reads the 8-bit I/O fifo port specified by Port.\r | |
78 | The port is read Count times, and the read data is\r | |
79 | stored in the provided Buffer.\r | |
80 | \r | |
81 | This function must guarantee that all I/O read and write operations are\r | |
82 | serialized.\r | |
83 | \r | |
84 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
85 | \r | |
86 | @param Port The I/O port to read.\r | |
87 | @param Count The number of times to read I/O port.\r | |
88 | @param Buffer The buffer to store the read data into.\r | |
89 | \r | |
90 | **/\r | |
91 | VOID\r | |
92 | EFIAPI\r | |
93 | IoReadFifo8 (\r | |
94 | IN UINTN Port,\r | |
95 | IN UINTN Count,\r | |
96 | OUT VOID *Buffer\r | |
97 | );\r | |
98 | \r | |
99 | /**\r | |
100 | Writes a block of memory into an 8-bit I/O port fifo.\r | |
101 | \r | |
102 | Writes the 8-bit I/O fifo port specified by Port.\r | |
103 | The port is written Count times, and the write data is\r | |
104 | retrieved from the provided Buffer.\r | |
105 | \r | |
106 | This function must guarantee that all I/O write and write operations are\r | |
107 | serialized.\r | |
108 | \r | |
109 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
110 | \r | |
111 | @param Port The I/O port to write.\r | |
112 | @param Count The number of times to write I/O port.\r | |
113 | @param Buffer The buffer to retrieve the write data from.\r | |
114 | \r | |
115 | **/\r | |
116 | VOID\r | |
117 | EFIAPI\r | |
118 | IoWriteFifo8 (\r | |
119 | IN UINTN Port,\r | |
120 | IN UINTN Count,\r | |
121 | IN VOID *Buffer\r | |
122 | );\r | |
123 | \r | |
de22b698 | 124 | /**\r |
62991af2 | 125 | Reads an 8-bit I/O port, performs a bitwise OR, and writes the\r |
de22b698 | 126 | result back to the 8-bit I/O port.\r |
127 | \r | |
62991af2 | 128 | Reads the 8-bit I/O port specified by Port, performs a bitwise OR\r |
de22b698 | 129 | between the read result and the value specified by OrData, and writes the\r |
130 | result to the 8-bit I/O port specified by Port. The value written to the I/O\r | |
131 | port is returned. This function must guarantee that all I/O read and write\r | |
132 | operations are serialized.\r | |
133 | \r | |
134 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
135 | \r | |
136 | @param Port The I/O port to write.\r | |
137 | @param OrData The value to OR with the read value from the I/O port.\r | |
138 | \r | |
139 | @return The value written back to the I/O port.\r | |
140 | \r | |
141 | **/\r | |
142 | UINT8\r | |
143 | EFIAPI\r | |
144 | IoOr8 (\r | |
145 | IN UINTN Port,\r | |
146 | IN UINT8 OrData\r | |
147 | );\r | |
148 | \r | |
149 | /**\r | |
150 | Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back\r | |
151 | to the 8-bit I/O port.\r | |
152 | \r | |
153 | Reads the 8-bit I/O port specified by Port, performs a bitwise AND between\r | |
154 | the read result and the value specified by AndData, and writes the result to\r | |
155 | the 8-bit I/O port specified by Port. The value written to the I/O port is\r | |
156 | returned. This function must guarantee that all I/O read and write operations\r | |
157 | are serialized.\r | |
158 | \r | |
159 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
160 | \r | |
161 | @param Port The I/O port to write.\r | |
162 | @param AndData The value to AND with the read value from the I/O port.\r | |
163 | \r | |
164 | @return The value written back to the I/O port.\r | |
165 | \r | |
166 | **/\r | |
167 | UINT8\r | |
168 | EFIAPI\r | |
169 | IoAnd8 (\r | |
170 | IN UINTN Port,\r | |
171 | IN UINT8 AndData\r | |
172 | );\r | |
173 | \r | |
174 | /**\r | |
9095d37b | 175 | Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise\r |
62991af2 | 176 | OR, and writes the result back to the 8-bit I/O port.\r |
de22b698 | 177 | \r |
178 | Reads the 8-bit I/O port specified by Port, performs a bitwise AND between\r | |
179 | the read result and the value specified by AndData, performs a bitwise OR\r | |
180 | between the result of the AND operation and the value specified by OrData,\r | |
181 | and writes the result to the 8-bit I/O port specified by Port. The value\r | |
182 | written to the I/O port is returned. This function must guarantee that all\r | |
183 | I/O read and write operations are serialized.\r | |
184 | \r | |
185 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
186 | \r | |
187 | @param Port The I/O port to write.\r | |
188 | @param AndData The value to AND with the read value from the I/O port.\r | |
189 | @param OrData The value to OR with the result of the AND operation.\r | |
190 | \r | |
191 | @return The value written back to the I/O port.\r | |
192 | \r | |
193 | **/\r | |
194 | UINT8\r | |
195 | EFIAPI\r | |
196 | IoAndThenOr8 (\r | |
197 | IN UINTN Port,\r | |
198 | IN UINT8 AndData,\r | |
199 | IN UINT8 OrData\r | |
200 | );\r | |
201 | \r | |
202 | /**\r | |
203 | Reads a bit field of an I/O register.\r | |
204 | \r | |
205 | Reads the bit field in an 8-bit I/O register. The bit field is specified by\r | |
206 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
207 | \r | |
208 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
209 | If StartBit is greater than 7, then ASSERT().\r | |
210 | If EndBit is greater than 7, then ASSERT().\r | |
211 | If EndBit is less than StartBit, then ASSERT().\r | |
212 | \r | |
213 | @param Port The I/O port to read.\r | |
214 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
215 | Range 0..7.\r | |
216 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
217 | Range 0..7.\r | |
218 | \r | |
219 | @return The value read.\r | |
220 | \r | |
221 | **/\r | |
222 | UINT8\r | |
223 | EFIAPI\r | |
224 | IoBitFieldRead8 (\r | |
225 | IN UINTN Port,\r | |
226 | IN UINTN StartBit,\r | |
227 | IN UINTN EndBit\r | |
228 | );\r | |
229 | \r | |
230 | /**\r | |
231 | Writes a bit field to an I/O register.\r | |
232 | \r | |
233 | Writes Value to the bit field of the I/O register. The bit field is specified\r | |
234 | by the StartBit and the EndBit. All other bits in the destination I/O\r | |
9095d37b | 235 | register are preserved. The value written to the I/O port is returned.\r |
de22b698 | 236 | \r |
237 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
238 | If StartBit is greater than 7, then ASSERT().\r | |
239 | If EndBit is greater than 7, then ASSERT().\r | |
240 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 241 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 242 | \r |
243 | @param Port The I/O port to write.\r | |
244 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
245 | Range 0..7.\r | |
246 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
247 | Range 0..7.\r | |
248 | @param Value New value of the bit field.\r | |
249 | \r | |
250 | @return The value written back to the I/O port.\r | |
251 | \r | |
252 | **/\r | |
253 | UINT8\r | |
254 | EFIAPI\r | |
255 | IoBitFieldWrite8 (\r | |
256 | IN UINTN Port,\r | |
257 | IN UINTN StartBit,\r | |
258 | IN UINTN EndBit,\r | |
259 | IN UINT8 Value\r | |
260 | );\r | |
261 | \r | |
262 | /**\r | |
263 | Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the\r | |
264 | result back to the bit field in the 8-bit port.\r | |
265 | \r | |
62991af2 | 266 | Reads the 8-bit I/O port specified by Port, performs a bitwise OR\r |
de22b698 | 267 | between the read result and the value specified by OrData, and writes the\r |
268 | result to the 8-bit I/O port specified by Port. The value written to the I/O\r | |
269 | port is returned. This function must guarantee that all I/O read and write\r | |
270 | operations are serialized. Extra left bits in OrData are stripped.\r | |
271 | \r | |
272 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
273 | If StartBit is greater than 7, then ASSERT().\r | |
274 | If EndBit is greater than 7, then ASSERT().\r | |
275 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 276 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 277 | \r |
278 | @param Port The I/O port to write.\r | |
279 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
280 | Range 0..7.\r | |
281 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
282 | Range 0..7.\r | |
283 | @param OrData The value to OR with the read value from the I/O port.\r | |
284 | \r | |
285 | @return The value written back to the I/O port.\r | |
286 | \r | |
287 | **/\r | |
288 | UINT8\r | |
289 | EFIAPI\r | |
290 | IoBitFieldOr8 (\r | |
291 | IN UINTN Port,\r | |
292 | IN UINTN StartBit,\r | |
293 | IN UINTN EndBit,\r | |
294 | IN UINT8 OrData\r | |
295 | );\r | |
296 | \r | |
297 | /**\r | |
298 | Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the\r | |
299 | result back to the bit field in the 8-bit port.\r | |
300 | \r | |
301 | Reads the 8-bit I/O port specified by Port, performs a bitwise AND between\r | |
302 | the read result and the value specified by AndData, and writes the result to\r | |
303 | the 8-bit I/O port specified by Port. The value written to the I/O port is\r | |
304 | returned. This function must guarantee that all I/O read and write operations\r | |
305 | are serialized. Extra left bits in AndData are stripped.\r | |
306 | \r | |
307 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
308 | If StartBit is greater than 7, then ASSERT().\r | |
309 | If EndBit is greater than 7, then ASSERT().\r | |
310 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 311 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 312 | \r |
313 | @param Port The I/O port to write.\r | |
314 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
315 | Range 0..7.\r | |
316 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
317 | Range 0..7.\r | |
318 | @param AndData The value to AND with the read value from the I/O port.\r | |
319 | \r | |
320 | @return The value written back to the I/O port.\r | |
321 | \r | |
322 | **/\r | |
323 | UINT8\r | |
324 | EFIAPI\r | |
325 | IoBitFieldAnd8 (\r | |
326 | IN UINTN Port,\r | |
327 | IN UINTN StartBit,\r | |
328 | IN UINTN EndBit,\r | |
329 | IN UINT8 AndData\r | |
330 | );\r | |
331 | \r | |
332 | /**\r | |
333 | Reads a bit field in an 8-bit port, performs a bitwise AND followed by a\r | |
62991af2 | 334 | bitwise OR, and writes the result back to the bit field in the\r |
de22b698 | 335 | 8-bit port.\r |
336 | \r | |
337 | Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed\r | |
62991af2 | 338 | by a bitwise OR between the read result and the value specified by\r |
de22b698 | 339 | AndData, and writes the result to the 8-bit I/O port specified by Port. The\r |
340 | value written to the I/O port is returned. This function must guarantee that\r | |
341 | all I/O read and write operations are serialized. Extra left bits in both\r | |
342 | AndData and OrData are stripped.\r | |
343 | \r | |
344 | If 8-bit I/O port operations are not supported, then ASSERT().\r | |
345 | If StartBit is greater than 7, then ASSERT().\r | |
346 | If EndBit is greater than 7, then ASSERT().\r | |
347 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
348 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
349 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
de22b698 | 350 | \r |
351 | @param Port The I/O port to write.\r | |
352 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
353 | Range 0..7.\r | |
354 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
355 | Range 0..7.\r | |
356 | @param AndData The value to AND with the read value from the I/O port.\r | |
357 | @param OrData The value to OR with the result of the AND operation.\r | |
358 | \r | |
359 | @return The value written back to the I/O port.\r | |
360 | \r | |
361 | **/\r | |
362 | UINT8\r | |
363 | EFIAPI\r | |
364 | IoBitFieldAndThenOr8 (\r | |
365 | IN UINTN Port,\r | |
366 | IN UINTN StartBit,\r | |
367 | IN UINTN EndBit,\r | |
368 | IN UINT8 AndData,\r | |
369 | IN UINT8 OrData\r | |
370 | );\r | |
371 | \r | |
372 | /**\r | |
373 | Reads a 16-bit I/O port.\r | |
374 | \r | |
375 | Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.\r | |
376 | This function must guarantee that all I/O read and write operations are\r | |
377 | serialized.\r | |
378 | \r | |
379 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 380 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 381 | \r |
382 | @param Port The I/O port to read.\r | |
383 | \r | |
384 | @return The value read.\r | |
385 | \r | |
386 | **/\r | |
387 | UINT16\r | |
388 | EFIAPI\r | |
389 | IoRead16 (\r | |
390 | IN UINTN Port\r | |
391 | );\r | |
392 | \r | |
393 | /**\r | |
394 | Writes a 16-bit I/O port.\r | |
395 | \r | |
396 | Writes the 16-bit I/O port specified by Port with the value specified by Value\r | |
397 | and returns Value. This function must guarantee that all I/O read and write\r | |
398 | operations are serialized.\r | |
399 | \r | |
400 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 401 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
9095d37b | 402 | \r |
de22b698 | 403 | @param Port The I/O port to write.\r |
404 | @param Value The value to write to the I/O port.\r | |
405 | \r | |
406 | @return The value written the I/O port.\r | |
407 | \r | |
408 | **/\r | |
409 | UINT16\r | |
410 | EFIAPI\r | |
411 | IoWrite16 (\r | |
412 | IN UINTN Port,\r | |
413 | IN UINT16 Value\r | |
414 | );\r | |
415 | \r | |
19c6d9fe LD |
416 | /**\r |
417 | Reads a 16-bit I/O port fifo into a block of memory.\r | |
418 | \r | |
419 | Reads the 16-bit I/O fifo port specified by Port.\r | |
420 | The port is read Count times, and the read data is\r | |
421 | stored in the provided Buffer.\r | |
422 | \r | |
423 | This function must guarantee that all I/O read and write operations are\r | |
424 | serialized.\r | |
425 | \r | |
426 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
427 | \r | |
428 | @param Port The I/O port to read.\r | |
429 | @param Count The number of times to read I/O port.\r | |
430 | @param Buffer The buffer to store the read data into.\r | |
431 | \r | |
432 | **/\r | |
433 | VOID\r | |
434 | EFIAPI\r | |
435 | IoReadFifo16 (\r | |
436 | IN UINTN Port,\r | |
437 | IN UINTN Count,\r | |
438 | OUT VOID *Buffer\r | |
439 | );\r | |
440 | \r | |
441 | /**\r | |
442 | Writes a block of memory into a 16-bit I/O port fifo.\r | |
443 | \r | |
444 | Writes the 16-bit I/O fifo port specified by Port.\r | |
445 | The port is written Count times, and the write data is\r | |
446 | retrieved from the provided Buffer.\r | |
447 | \r | |
448 | This function must guarantee that all I/O write and write operations are\r | |
449 | serialized.\r | |
450 | \r | |
451 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
452 | \r | |
453 | @param Port The I/O port to write.\r | |
454 | @param Count The number of times to write I/O port.\r | |
455 | @param Buffer The buffer to retrieve the write data from.\r | |
456 | \r | |
457 | **/\r | |
458 | VOID\r | |
459 | EFIAPI\r | |
460 | IoWriteFifo16 (\r | |
461 | IN UINTN Port,\r | |
462 | IN UINTN Count,\r | |
463 | IN VOID *Buffer\r | |
464 | );\r | |
465 | \r | |
de22b698 | 466 | /**\r |
62991af2 | 467 | Reads a 16-bit I/O port, performs a bitwise OR, and writes the\r |
de22b698 | 468 | result back to the 16-bit I/O port.\r |
469 | \r | |
62991af2 | 470 | Reads the 16-bit I/O port specified by Port, performs a bitwise OR\r |
de22b698 | 471 | between the read result and the value specified by OrData, and writes the\r |
472 | result to the 16-bit I/O port specified by Port. The value written to the I/O\r | |
473 | port is returned. This function must guarantee that all I/O read and write\r | |
474 | operations are serialized.\r | |
475 | \r | |
476 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 477 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 478 | \r |
479 | @param Port The I/O port to write.\r | |
480 | @param OrData The value to OR with the read value from the I/O port.\r | |
481 | \r | |
482 | @return The value written back to the I/O port.\r | |
483 | \r | |
484 | **/\r | |
485 | UINT16\r | |
486 | EFIAPI\r | |
487 | IoOr16 (\r | |
488 | IN UINTN Port,\r | |
489 | IN UINT16 OrData\r | |
490 | );\r | |
491 | \r | |
492 | /**\r | |
493 | Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back\r | |
494 | to the 16-bit I/O port.\r | |
495 | \r | |
496 | Reads the 16-bit I/O port specified by Port, performs a bitwise AND between\r | |
497 | the read result and the value specified by AndData, and writes the result to\r | |
498 | the 16-bit I/O port specified by Port. The value written to the I/O port is\r | |
499 | returned. This function must guarantee that all I/O read and write operations\r | |
500 | are serialized.\r | |
501 | \r | |
502 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 503 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
9095d37b | 504 | \r |
de22b698 | 505 | @param Port The I/O port to write.\r |
506 | @param AndData The value to AND with the read value from the I/O port.\r | |
507 | \r | |
508 | @return The value written back to the I/O port.\r | |
509 | \r | |
510 | **/\r | |
511 | UINT16\r | |
512 | EFIAPI\r | |
513 | IoAnd16 (\r | |
514 | IN UINTN Port,\r | |
515 | IN UINT16 AndData\r | |
516 | );\r | |
517 | \r | |
518 | /**\r | |
9095d37b | 519 | Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise\r |
62991af2 | 520 | OR, and writes the result back to the 16-bit I/O port.\r |
de22b698 | 521 | \r |
522 | Reads the 16-bit I/O port specified by Port, performs a bitwise AND between\r | |
523 | the read result and the value specified by AndData, performs a bitwise OR\r | |
524 | between the result of the AND operation and the value specified by OrData,\r | |
525 | and writes the result to the 16-bit I/O port specified by Port. The value\r | |
526 | written to the I/O port is returned. This function must guarantee that all\r | |
527 | I/O read and write operations are serialized.\r | |
528 | \r | |
529 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 530 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
9095d37b | 531 | \r |
de22b698 | 532 | @param Port The I/O port to write.\r |
533 | @param AndData The value to AND with the read value from the I/O port.\r | |
534 | @param OrData The value to OR with the result of the AND operation.\r | |
535 | \r | |
536 | @return The value written back to the I/O port.\r | |
537 | \r | |
538 | **/\r | |
539 | UINT16\r | |
540 | EFIAPI\r | |
541 | IoAndThenOr16 (\r | |
542 | IN UINTN Port,\r | |
543 | IN UINT16 AndData,\r | |
544 | IN UINT16 OrData\r | |
545 | );\r | |
546 | \r | |
547 | /**\r | |
548 | Reads a bit field of an I/O register.\r | |
549 | \r | |
550 | Reads the bit field in a 16-bit I/O register. The bit field is specified by\r | |
551 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
552 | \r | |
553 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 554 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 555 | If StartBit is greater than 15, then ASSERT().\r |
556 | If EndBit is greater than 15, then ASSERT().\r | |
557 | If EndBit is less than StartBit, then ASSERT().\r | |
558 | \r | |
559 | @param Port The I/O port to read.\r | |
560 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
561 | Range 0..15.\r | |
562 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
563 | Range 0..15.\r | |
564 | \r | |
565 | @return The value read.\r | |
566 | \r | |
567 | **/\r | |
568 | UINT16\r | |
569 | EFIAPI\r | |
570 | IoBitFieldRead16 (\r | |
571 | IN UINTN Port,\r | |
572 | IN UINTN StartBit,\r | |
573 | IN UINTN EndBit\r | |
574 | );\r | |
575 | \r | |
576 | /**\r | |
577 | Writes a bit field to an I/O register.\r | |
578 | \r | |
579 | Writes Value to the bit field of the I/O register. The bit field is specified\r | |
580 | by the StartBit and the EndBit. All other bits in the destination I/O\r | |
581 | register are preserved. The value written to the I/O port is returned. Extra\r | |
582 | left bits in Value are stripped.\r | |
583 | \r | |
584 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 585 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 586 | If StartBit is greater than 15, then ASSERT().\r |
587 | If EndBit is greater than 15, then ASSERT().\r | |
588 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 589 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 590 | \r |
591 | @param Port The I/O port to write.\r | |
592 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
593 | Range 0..15.\r | |
594 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
595 | Range 0..15.\r | |
596 | @param Value New value of the bit field.\r | |
597 | \r | |
598 | @return The value written back to the I/O port.\r | |
599 | \r | |
600 | **/\r | |
601 | UINT16\r | |
602 | EFIAPI\r | |
603 | IoBitFieldWrite16 (\r | |
604 | IN UINTN Port,\r | |
605 | IN UINTN StartBit,\r | |
606 | IN UINTN EndBit,\r | |
607 | IN UINT16 Value\r | |
608 | );\r | |
609 | \r | |
610 | /**\r | |
611 | Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the\r | |
612 | result back to the bit field in the 16-bit port.\r | |
613 | \r | |
62991af2 | 614 | Reads the 16-bit I/O port specified by Port, performs a bitwise OR\r |
de22b698 | 615 | between the read result and the value specified by OrData, and writes the\r |
616 | result to the 16-bit I/O port specified by Port. The value written to the I/O\r | |
617 | port is returned. This function must guarantee that all I/O read and write\r | |
618 | operations are serialized. Extra left bits in OrData are stripped.\r | |
619 | \r | |
620 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 621 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 622 | If StartBit is greater than 15, then ASSERT().\r |
623 | If EndBit is greater than 15, then ASSERT().\r | |
624 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 625 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 626 | \r |
627 | @param Port The I/O port to write.\r | |
628 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
629 | Range 0..15.\r | |
630 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
631 | Range 0..15.\r | |
632 | @param OrData The value to OR with the read value from the I/O port.\r | |
633 | \r | |
634 | @return The value written back to the I/O port.\r | |
635 | \r | |
636 | **/\r | |
637 | UINT16\r | |
638 | EFIAPI\r | |
639 | IoBitFieldOr16 (\r | |
640 | IN UINTN Port,\r | |
641 | IN UINTN StartBit,\r | |
642 | IN UINTN EndBit,\r | |
643 | IN UINT16 OrData\r | |
644 | );\r | |
645 | \r | |
646 | /**\r | |
647 | Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the\r | |
648 | result back to the bit field in the 16-bit port.\r | |
649 | \r | |
650 | Reads the 16-bit I/O port specified by Port, performs a bitwise AND between\r | |
651 | the read result and the value specified by AndData, and writes the result to\r | |
652 | the 16-bit I/O port specified by Port. The value written to the I/O port is\r | |
653 | returned. This function must guarantee that all I/O read and write operations\r | |
654 | are serialized. Extra left bits in AndData are stripped.\r | |
655 | \r | |
656 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 657 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 658 | If StartBit is greater than 15, then ASSERT().\r |
659 | If EndBit is greater than 15, then ASSERT().\r | |
660 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 661 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 662 | \r |
663 | @param Port The I/O port to write.\r | |
664 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
665 | Range 0..15.\r | |
666 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
667 | Range 0..15.\r | |
668 | @param AndData The value to AND with the read value from the I/O port.\r | |
669 | \r | |
670 | @return The value written back to the I/O port.\r | |
671 | \r | |
672 | **/\r | |
673 | UINT16\r | |
674 | EFIAPI\r | |
675 | IoBitFieldAnd16 (\r | |
676 | IN UINTN Port,\r | |
677 | IN UINTN StartBit,\r | |
678 | IN UINTN EndBit,\r | |
679 | IN UINT16 AndData\r | |
680 | );\r | |
681 | \r | |
682 | /**\r | |
683 | Reads a bit field in a 16-bit port, performs a bitwise AND followed by a\r | |
62991af2 | 684 | bitwise OR, and writes the result back to the bit field in the\r |
de22b698 | 685 | 16-bit port.\r |
686 | \r | |
687 | Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed\r | |
62991af2 | 688 | by a bitwise OR between the read result and the value specified by\r |
de22b698 | 689 | AndData, and writes the result to the 16-bit I/O port specified by Port. The\r |
690 | value written to the I/O port is returned. This function must guarantee that\r | |
691 | all I/O read and write operations are serialized. Extra left bits in both\r | |
692 | AndData and OrData are stripped.\r | |
693 | \r | |
694 | If 16-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 695 | If Port is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 696 | If StartBit is greater than 15, then ASSERT().\r |
697 | If EndBit is greater than 15, then ASSERT().\r | |
698 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
699 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
700 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
de22b698 | 701 | \r |
702 | @param Port The I/O port to write.\r | |
703 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
704 | Range 0..15.\r | |
705 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
706 | Range 0..15.\r | |
707 | @param AndData The value to AND with the read value from the I/O port.\r | |
708 | @param OrData The value to OR with the result of the AND operation.\r | |
709 | \r | |
710 | @return The value written back to the I/O port.\r | |
711 | \r | |
712 | **/\r | |
713 | UINT16\r | |
714 | EFIAPI\r | |
715 | IoBitFieldAndThenOr16 (\r | |
716 | IN UINTN Port,\r | |
717 | IN UINTN StartBit,\r | |
718 | IN UINTN EndBit,\r | |
719 | IN UINT16 AndData,\r | |
720 | IN UINT16 OrData\r | |
721 | );\r | |
722 | \r | |
723 | /**\r | |
724 | Reads a 32-bit I/O port.\r | |
725 | \r | |
726 | Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.\r | |
727 | This function must guarantee that all I/O read and write operations are\r | |
728 | serialized.\r | |
729 | \r | |
730 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 731 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
9095d37b | 732 | \r |
de22b698 | 733 | @param Port The I/O port to read.\r |
734 | \r | |
735 | @return The value read.\r | |
736 | \r | |
737 | **/\r | |
738 | UINT32\r | |
739 | EFIAPI\r | |
740 | IoRead32 (\r | |
741 | IN UINTN Port\r | |
742 | );\r | |
743 | \r | |
744 | /**\r | |
745 | Writes a 32-bit I/O port.\r | |
746 | \r | |
747 | Writes the 32-bit I/O port specified by Port with the value specified by Value\r | |
748 | and returns Value. This function must guarantee that all I/O read and write\r | |
749 | operations are serialized.\r | |
750 | \r | |
751 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 752 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
9095d37b | 753 | \r |
de22b698 | 754 | @param Port The I/O port to write.\r |
755 | @param Value The value to write to the I/O port.\r | |
756 | \r | |
757 | @return The value written the I/O port.\r | |
758 | \r | |
759 | **/\r | |
760 | UINT32\r | |
761 | EFIAPI\r | |
762 | IoWrite32 (\r | |
763 | IN UINTN Port,\r | |
764 | IN UINT32 Value\r | |
765 | );\r | |
766 | \r | |
19c6d9fe LD |
767 | /**\r |
768 | Reads a 32-bit I/O port fifo into a block of memory.\r | |
769 | \r | |
770 | Reads the 32-bit I/O fifo port specified by Port.\r | |
771 | The port is read Count times, and the read data is\r | |
772 | stored in the provided Buffer.\r | |
773 | \r | |
774 | This function must guarantee that all I/O read and write operations are\r | |
775 | serialized.\r | |
776 | \r | |
777 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
778 | \r | |
779 | @param Port The I/O port to read.\r | |
780 | @param Count The number of times to read I/O port.\r | |
781 | @param Buffer The buffer to store the read data into.\r | |
782 | \r | |
783 | **/\r | |
784 | VOID\r | |
785 | EFIAPI\r | |
786 | IoReadFifo32 (\r | |
787 | IN UINTN Port,\r | |
788 | IN UINTN Count,\r | |
789 | OUT VOID *Buffer\r | |
790 | );\r | |
791 | \r | |
792 | /**\r | |
793 | Writes a block of memory into a 32-bit I/O port fifo.\r | |
794 | \r | |
795 | Writes the 32-bit I/O fifo port specified by Port.\r | |
796 | The port is written Count times, and the write data is\r | |
797 | retrieved from the provided Buffer.\r | |
798 | \r | |
799 | This function must guarantee that all I/O write and write operations are\r | |
800 | serialized.\r | |
801 | \r | |
802 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
803 | \r | |
804 | @param Port The I/O port to write.\r | |
805 | @param Count The number of times to write I/O port.\r | |
806 | @param Buffer The buffer to retrieve the write data from.\r | |
807 | \r | |
808 | **/\r | |
809 | VOID\r | |
810 | EFIAPI\r | |
811 | IoWriteFifo32 (\r | |
812 | IN UINTN Port,\r | |
813 | IN UINTN Count,\r | |
814 | IN VOID *Buffer\r | |
815 | );\r | |
816 | \r | |
de22b698 | 817 | /**\r |
62991af2 | 818 | Reads a 32-bit I/O port, performs a bitwise OR, and writes the\r |
de22b698 | 819 | result back to the 32-bit I/O port.\r |
820 | \r | |
62991af2 | 821 | Reads the 32-bit I/O port specified by Port, performs a bitwise OR\r |
de22b698 | 822 | between the read result and the value specified by OrData, and writes the\r |
823 | result to the 32-bit I/O port specified by Port. The value written to the I/O\r | |
824 | port is returned. This function must guarantee that all I/O read and write\r | |
825 | operations are serialized.\r | |
826 | \r | |
827 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 828 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 829 | \r |
830 | @param Port The I/O port to write.\r | |
831 | @param OrData The value to OR with the read value from the I/O port.\r | |
832 | \r | |
833 | @return The value written back to the I/O port.\r | |
834 | \r | |
835 | **/\r | |
836 | UINT32\r | |
837 | EFIAPI\r | |
838 | IoOr32 (\r | |
839 | IN UINTN Port,\r | |
840 | IN UINT32 OrData\r | |
841 | );\r | |
842 | \r | |
843 | /**\r | |
844 | Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back\r | |
845 | to the 32-bit I/O port.\r | |
846 | \r | |
847 | Reads the 32-bit I/O port specified by Port, performs a bitwise AND between\r | |
848 | the read result and the value specified by AndData, and writes the result to\r | |
849 | the 32-bit I/O port specified by Port. The value written to the I/O port is\r | |
850 | returned. This function must guarantee that all I/O read and write operations\r | |
851 | are serialized.\r | |
852 | \r | |
853 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 854 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 855 | \r |
856 | @param Port The I/O port to write.\r | |
857 | @param AndData The value to AND with the read value from the I/O port.\r | |
858 | \r | |
859 | @return The value written back to the I/O port.\r | |
860 | \r | |
861 | **/\r | |
862 | UINT32\r | |
863 | EFIAPI\r | |
864 | IoAnd32 (\r | |
865 | IN UINTN Port,\r | |
866 | IN UINT32 AndData\r | |
867 | );\r | |
868 | \r | |
869 | /**\r | |
9095d37b | 870 | Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise\r |
62991af2 | 871 | OR, and writes the result back to the 32-bit I/O port.\r |
de22b698 | 872 | \r |
873 | Reads the 32-bit I/O port specified by Port, performs a bitwise AND between\r | |
874 | the read result and the value specified by AndData, performs a bitwise OR\r | |
875 | between the result of the AND operation and the value specified by OrData,\r | |
876 | and writes the result to the 32-bit I/O port specified by Port. The value\r | |
877 | written to the I/O port is returned. This function must guarantee that all\r | |
878 | I/O read and write operations are serialized.\r | |
879 | \r | |
880 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 881 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 882 | \r |
883 | @param Port The I/O port to write.\r | |
884 | @param AndData The value to AND with the read value from the I/O port.\r | |
885 | @param OrData The value to OR with the result of the AND operation.\r | |
886 | \r | |
887 | @return The value written back to the I/O port.\r | |
888 | \r | |
889 | **/\r | |
890 | UINT32\r | |
891 | EFIAPI\r | |
892 | IoAndThenOr32 (\r | |
893 | IN UINTN Port,\r | |
894 | IN UINT32 AndData,\r | |
895 | IN UINT32 OrData\r | |
896 | );\r | |
897 | \r | |
898 | /**\r | |
899 | Reads a bit field of an I/O register.\r | |
900 | \r | |
901 | Reads the bit field in a 32-bit I/O register. The bit field is specified by\r | |
902 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
903 | \r | |
904 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 905 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 906 | If StartBit is greater than 31, then ASSERT().\r |
907 | If EndBit is greater than 31, then ASSERT().\r | |
908 | If EndBit is less than StartBit, then ASSERT().\r | |
909 | \r | |
910 | @param Port The I/O port to read.\r | |
911 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
912 | Range 0..31.\r | |
913 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
914 | Range 0..31.\r | |
915 | \r | |
916 | @return The value read.\r | |
917 | \r | |
918 | **/\r | |
919 | UINT32\r | |
920 | EFIAPI\r | |
921 | IoBitFieldRead32 (\r | |
922 | IN UINTN Port,\r | |
923 | IN UINTN StartBit,\r | |
924 | IN UINTN EndBit\r | |
925 | );\r | |
926 | \r | |
927 | /**\r | |
928 | Writes a bit field to an I/O register.\r | |
929 | \r | |
930 | Writes Value to the bit field of the I/O register. The bit field is specified\r | |
931 | by the StartBit and the EndBit. All other bits in the destination I/O\r | |
932 | register are preserved. The value written to the I/O port is returned. Extra\r | |
933 | left bits in Value are stripped.\r | |
934 | \r | |
935 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 936 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 937 | If StartBit is greater than 31, then ASSERT().\r |
938 | If EndBit is greater than 31, then ASSERT().\r | |
939 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 940 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 941 | \r |
942 | @param Port The I/O port to write.\r | |
943 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
944 | Range 0..31.\r | |
945 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
946 | Range 0..31.\r | |
947 | @param Value New value of the bit field.\r | |
948 | \r | |
949 | @return The value written back to the I/O port.\r | |
950 | \r | |
951 | **/\r | |
952 | UINT32\r | |
953 | EFIAPI\r | |
954 | IoBitFieldWrite32 (\r | |
955 | IN UINTN Port,\r | |
956 | IN UINTN StartBit,\r | |
957 | IN UINTN EndBit,\r | |
958 | IN UINT32 Value\r | |
959 | );\r | |
960 | \r | |
961 | /**\r | |
962 | Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the\r | |
963 | result back to the bit field in the 32-bit port.\r | |
964 | \r | |
62991af2 | 965 | Reads the 32-bit I/O port specified by Port, performs a bitwise OR\r |
de22b698 | 966 | between the read result and the value specified by OrData, and writes the\r |
967 | result to the 32-bit I/O port specified by Port. The value written to the I/O\r | |
968 | port is returned. This function must guarantee that all I/O read and write\r | |
969 | operations are serialized. Extra left bits in OrData are stripped.\r | |
970 | \r | |
971 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 972 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 973 | If StartBit is greater than 31, then ASSERT().\r |
974 | If EndBit is greater than 31, then ASSERT().\r | |
975 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 976 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 977 | \r |
978 | @param Port The I/O port to write.\r | |
979 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
980 | Range 0..31.\r | |
981 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
982 | Range 0..31.\r | |
983 | @param OrData The value to OR with the read value from the I/O port.\r | |
984 | \r | |
985 | @return The value written back to the I/O port.\r | |
986 | \r | |
987 | **/\r | |
988 | UINT32\r | |
989 | EFIAPI\r | |
990 | IoBitFieldOr32 (\r | |
991 | IN UINTN Port,\r | |
992 | IN UINTN StartBit,\r | |
993 | IN UINTN EndBit,\r | |
994 | IN UINT32 OrData\r | |
995 | );\r | |
996 | \r | |
997 | /**\r | |
998 | Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the\r | |
999 | result back to the bit field in the 32-bit port.\r | |
1000 | \r | |
1001 | Reads the 32-bit I/O port specified by Port, performs a bitwise AND between\r | |
1002 | the read result and the value specified by AndData, and writes the result to\r | |
1003 | the 32-bit I/O port specified by Port. The value written to the I/O port is\r | |
1004 | returned. This function must guarantee that all I/O read and write operations\r | |
1005 | are serialized. Extra left bits in AndData are stripped.\r | |
1006 | \r | |
1007 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 1008 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 1009 | If StartBit is greater than 31, then ASSERT().\r |
1010 | If EndBit is greater than 31, then ASSERT().\r | |
1011 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1012 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 1013 | \r |
1014 | @param Port The I/O port to write.\r | |
1015 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1016 | Range 0..31.\r | |
1017 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1018 | Range 0..31.\r | |
1019 | @param AndData The value to AND with the read value from the I/O port.\r | |
1020 | \r | |
1021 | @return The value written back to the I/O port.\r | |
1022 | \r | |
1023 | **/\r | |
1024 | UINT32\r | |
1025 | EFIAPI\r | |
1026 | IoBitFieldAnd32 (\r | |
1027 | IN UINTN Port,\r | |
1028 | IN UINTN StartBit,\r | |
1029 | IN UINTN EndBit,\r | |
1030 | IN UINT32 AndData\r | |
1031 | );\r | |
1032 | \r | |
1033 | /**\r | |
1034 | Reads a bit field in a 32-bit port, performs a bitwise AND followed by a\r | |
62991af2 | 1035 | bitwise OR, and writes the result back to the bit field in the\r |
de22b698 | 1036 | 32-bit port.\r |
1037 | \r | |
1038 | Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed\r | |
62991af2 | 1039 | by a bitwise OR between the read result and the value specified by\r |
de22b698 | 1040 | AndData, and writes the result to the 32-bit I/O port specified by Port. The\r |
1041 | value written to the I/O port is returned. This function must guarantee that\r | |
1042 | all I/O read and write operations are serialized. Extra left bits in both\r | |
1043 | AndData and OrData are stripped.\r | |
1044 | \r | |
1045 | If 32-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 1046 | If Port is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 1047 | If StartBit is greater than 31, then ASSERT().\r |
1048 | If EndBit is greater than 31, then ASSERT().\r | |
1049 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
1050 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
1051 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
de22b698 | 1052 | \r |
1053 | @param Port The I/O port to write.\r | |
1054 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1055 | Range 0..31.\r | |
1056 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1057 | Range 0..31.\r | |
1058 | @param AndData The value to AND with the read value from the I/O port.\r | |
1059 | @param OrData The value to OR with the result of the AND operation.\r | |
1060 | \r | |
1061 | @return The value written back to the I/O port.\r | |
1062 | \r | |
1063 | **/\r | |
1064 | UINT32\r | |
1065 | EFIAPI\r | |
1066 | IoBitFieldAndThenOr32 (\r | |
1067 | IN UINTN Port,\r | |
1068 | IN UINTN StartBit,\r | |
1069 | IN UINTN EndBit,\r | |
1070 | IN UINT32 AndData,\r | |
1071 | IN UINT32 OrData\r | |
1072 | );\r | |
1073 | \r | |
1074 | /**\r | |
1075 | Reads a 64-bit I/O port.\r | |
1076 | \r | |
1077 | Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.\r | |
1078 | This function must guarantee that all I/O read and write operations are\r | |
1079 | serialized.\r | |
1080 | \r | |
1081 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 1082 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 1083 | \r |
1084 | @param Port The I/O port to read.\r | |
1085 | \r | |
1086 | @return The value read.\r | |
1087 | \r | |
1088 | **/\r | |
1089 | UINT64\r | |
1090 | EFIAPI\r | |
1091 | IoRead64 (\r | |
1092 | IN UINTN Port\r | |
1093 | );\r | |
1094 | \r | |
1095 | /**\r | |
1096 | Writes a 64-bit I/O port.\r | |
1097 | \r | |
1098 | Writes the 64-bit I/O port specified by Port with the value specified by Value\r | |
1099 | and returns Value. This function must guarantee that all I/O read and write\r | |
1100 | operations are serialized.\r | |
1101 | \r | |
1102 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 1103 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 1104 | \r |
1105 | @param Port The I/O port to write.\r | |
1106 | @param Value The value to write to the I/O port.\r | |
1107 | \r | |
1108 | @return The value written the I/O port.\r | |
1109 | \r | |
1110 | **/\r | |
1111 | UINT64\r | |
1112 | EFIAPI\r | |
1113 | IoWrite64 (\r | |
1114 | IN UINTN Port,\r | |
1115 | IN UINT64 Value\r | |
1116 | );\r | |
1117 | \r | |
1118 | /**\r | |
62991af2 | 1119 | Reads a 64-bit I/O port, performs a bitwise OR, and writes the\r |
de22b698 | 1120 | result back to the 64-bit I/O port.\r |
1121 | \r | |
62991af2 | 1122 | Reads the 64-bit I/O port specified by Port, performs a bitwise OR\r |
de22b698 | 1123 | between the read result and the value specified by OrData, and writes the\r |
1124 | result to the 64-bit I/O port specified by Port. The value written to the I/O\r | |
1125 | port is returned. This function must guarantee that all I/O read and write\r | |
1126 | operations are serialized.\r | |
1127 | \r | |
1128 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 1129 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 1130 | \r |
1131 | @param Port The I/O port to write.\r | |
1132 | @param OrData The value to OR with the read value from the I/O port.\r | |
1133 | \r | |
1134 | @return The value written back to the I/O port.\r | |
1135 | \r | |
1136 | **/\r | |
1137 | UINT64\r | |
1138 | EFIAPI\r | |
1139 | IoOr64 (\r | |
1140 | IN UINTN Port,\r | |
1141 | IN UINT64 OrData\r | |
1142 | );\r | |
1143 | \r | |
1144 | /**\r | |
1145 | Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back\r | |
1146 | to the 64-bit I/O port.\r | |
1147 | \r | |
1148 | Reads the 64-bit I/O port specified by Port, performs a bitwise AND between\r | |
1149 | the read result and the value specified by AndData, and writes the result to\r | |
1150 | the 64-bit I/O port specified by Port. The value written to the I/O port is\r | |
1151 | returned. This function must guarantee that all I/O read and write operations\r | |
1152 | are serialized.\r | |
1153 | \r | |
1154 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 1155 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 1156 | \r |
1157 | @param Port The I/O port to write.\r | |
1158 | @param AndData The value to AND with the read value from the I/O port.\r | |
1159 | \r | |
1160 | @return The value written back to the I/O port.\r | |
1161 | \r | |
1162 | **/\r | |
1163 | UINT64\r | |
1164 | EFIAPI\r | |
1165 | IoAnd64 (\r | |
1166 | IN UINTN Port,\r | |
1167 | IN UINT64 AndData\r | |
1168 | );\r | |
1169 | \r | |
1170 | /**\r | |
9095d37b | 1171 | Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise\r |
62991af2 | 1172 | OR, and writes the result back to the 64-bit I/O port.\r |
de22b698 | 1173 | \r |
1174 | Reads the 64-bit I/O port specified by Port, performs a bitwise AND between\r | |
1175 | the read result and the value specified by AndData, performs a bitwise OR\r | |
1176 | between the result of the AND operation and the value specified by OrData,\r | |
1177 | and writes the result to the 64-bit I/O port specified by Port. The value\r | |
1178 | written to the I/O port is returned. This function must guarantee that all\r | |
1179 | I/O read and write operations are serialized.\r | |
1180 | \r | |
1181 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 1182 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 1183 | \r |
1184 | @param Port The I/O port to write.\r | |
1185 | @param AndData The value to AND with the read value from the I/O port.\r | |
1186 | @param OrData The value to OR with the result of the AND operation.\r | |
1187 | \r | |
1188 | @return The value written back to the I/O port.\r | |
1189 | \r | |
1190 | **/\r | |
1191 | UINT64\r | |
1192 | EFIAPI\r | |
1193 | IoAndThenOr64 (\r | |
1194 | IN UINTN Port,\r | |
1195 | IN UINT64 AndData,\r | |
1196 | IN UINT64 OrData\r | |
1197 | );\r | |
1198 | \r | |
1199 | /**\r | |
1200 | Reads a bit field of an I/O register.\r | |
1201 | \r | |
1202 | Reads the bit field in a 64-bit I/O register. The bit field is specified by\r | |
1203 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
1204 | \r | |
1205 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 1206 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 1207 | If StartBit is greater than 63, then ASSERT().\r |
1208 | If EndBit is greater than 63, then ASSERT().\r | |
1209 | If EndBit is less than StartBit, then ASSERT().\r | |
1210 | \r | |
1211 | @param Port The I/O port to read.\r | |
1212 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1213 | Range 0..63.\r | |
1214 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1215 | Range 0..63.\r | |
1216 | \r | |
1217 | @return The value read.\r | |
1218 | \r | |
1219 | **/\r | |
1220 | UINT64\r | |
1221 | EFIAPI\r | |
1222 | IoBitFieldRead64 (\r | |
1223 | IN UINTN Port,\r | |
1224 | IN UINTN StartBit,\r | |
1225 | IN UINTN EndBit\r | |
1226 | );\r | |
1227 | \r | |
1228 | /**\r | |
1229 | Writes a bit field to an I/O register.\r | |
1230 | \r | |
1231 | Writes Value to the bit field of the I/O register. The bit field is specified\r | |
1232 | by the StartBit and the EndBit. All other bits in the destination I/O\r | |
1233 | register are preserved. The value written to the I/O port is returned. Extra\r | |
1234 | left bits in Value are stripped.\r | |
1235 | \r | |
1236 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 1237 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 1238 | If StartBit is greater than 63, then ASSERT().\r |
1239 | If EndBit is greater than 63, then ASSERT().\r | |
1240 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1241 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 1242 | \r |
1243 | @param Port The I/O port to write.\r | |
1244 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1245 | Range 0..63.\r | |
1246 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1247 | Range 0..63.\r | |
1248 | @param Value New value of the bit field.\r | |
1249 | \r | |
1250 | @return The value written back to the I/O port.\r | |
1251 | \r | |
1252 | **/\r | |
1253 | UINT64\r | |
1254 | EFIAPI\r | |
1255 | IoBitFieldWrite64 (\r | |
1256 | IN UINTN Port,\r | |
1257 | IN UINTN StartBit,\r | |
1258 | IN UINTN EndBit,\r | |
1259 | IN UINT64 Value\r | |
1260 | );\r | |
1261 | \r | |
1262 | /**\r | |
1263 | Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the\r | |
1264 | result back to the bit field in the 64-bit port.\r | |
1265 | \r | |
62991af2 | 1266 | Reads the 64-bit I/O port specified by Port, performs a bitwise OR\r |
de22b698 | 1267 | between the read result and the value specified by OrData, and writes the\r |
1268 | result to the 64-bit I/O port specified by Port. The value written to the I/O\r | |
1269 | port is returned. This function must guarantee that all I/O read and write\r | |
1270 | operations are serialized. Extra left bits in OrData are stripped.\r | |
1271 | \r | |
1272 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 1273 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 1274 | If StartBit is greater than 63, then ASSERT().\r |
1275 | If EndBit is greater than 63, then ASSERT().\r | |
1276 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1277 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 1278 | \r |
1279 | @param Port The I/O port to write.\r | |
1280 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1281 | Range 0..63.\r | |
1282 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1283 | Range 0..63.\r | |
1284 | @param OrData The value to OR with the read value from the I/O port.\r | |
1285 | \r | |
1286 | @return The value written back to the I/O port.\r | |
1287 | \r | |
1288 | **/\r | |
1289 | UINT64\r | |
1290 | EFIAPI\r | |
1291 | IoBitFieldOr64 (\r | |
1292 | IN UINTN Port,\r | |
1293 | IN UINTN StartBit,\r | |
1294 | IN UINTN EndBit,\r | |
1295 | IN UINT64 OrData\r | |
1296 | );\r | |
1297 | \r | |
1298 | /**\r | |
1299 | Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the\r | |
1300 | result back to the bit field in the 64-bit port.\r | |
1301 | \r | |
1302 | Reads the 64-bit I/O port specified by Port, performs a bitwise AND between\r | |
1303 | the read result and the value specified by AndData, and writes the result to\r | |
1304 | the 64-bit I/O port specified by Port. The value written to the I/O port is\r | |
1305 | returned. This function must guarantee that all I/O read and write operations\r | |
1306 | are serialized. Extra left bits in AndData are stripped.\r | |
1307 | \r | |
1308 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 1309 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 1310 | If StartBit is greater than 63, then ASSERT().\r |
1311 | If EndBit is greater than 63, then ASSERT().\r | |
1312 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1313 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 1314 | \r |
1315 | @param Port The I/O port to write.\r | |
1316 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1317 | Range 0..63.\r | |
1318 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1319 | Range 0..63.\r | |
1320 | @param AndData The value to AND with the read value from the I/O port.\r | |
1321 | \r | |
1322 | @return The value written back to the I/O port.\r | |
1323 | \r | |
1324 | **/\r | |
1325 | UINT64\r | |
1326 | EFIAPI\r | |
1327 | IoBitFieldAnd64 (\r | |
1328 | IN UINTN Port,\r | |
1329 | IN UINTN StartBit,\r | |
1330 | IN UINTN EndBit,\r | |
1331 | IN UINT64 AndData\r | |
1332 | );\r | |
1333 | \r | |
1334 | /**\r | |
1335 | Reads a bit field in a 64-bit port, performs a bitwise AND followed by a\r | |
62991af2 | 1336 | bitwise OR, and writes the result back to the bit field in the\r |
de22b698 | 1337 | 64-bit port.\r |
1338 | \r | |
1339 | Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed\r | |
62991af2 | 1340 | by a bitwise OR between the read result and the value specified by\r |
de22b698 | 1341 | AndData, and writes the result to the 64-bit I/O port specified by Port. The\r |
1342 | value written to the I/O port is returned. This function must guarantee that\r | |
1343 | all I/O read and write operations are serialized. Extra left bits in both\r | |
1344 | AndData and OrData are stripped.\r | |
1345 | \r | |
1346 | If 64-bit I/O port operations are not supported, then ASSERT().\r | |
5ac79a78 | 1347 | If Port is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 1348 | If StartBit is greater than 63, then ASSERT().\r |
1349 | If EndBit is greater than 63, then ASSERT().\r | |
1350 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
1351 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
1352 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
de22b698 | 1353 | \r |
1354 | @param Port The I/O port to write.\r | |
1355 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1356 | Range 0..63.\r | |
1357 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1358 | Range 0..63.\r | |
1359 | @param AndData The value to AND with the read value from the I/O port.\r | |
1360 | @param OrData The value to OR with the result of the AND operation.\r | |
1361 | \r | |
1362 | @return The value written back to the I/O port.\r | |
1363 | \r | |
1364 | **/\r | |
1365 | UINT64\r | |
1366 | EFIAPI\r | |
1367 | IoBitFieldAndThenOr64 (\r | |
1368 | IN UINTN Port,\r | |
1369 | IN UINTN StartBit,\r | |
1370 | IN UINTN EndBit,\r | |
1371 | IN UINT64 AndData,\r | |
1372 | IN UINT64 OrData\r | |
1373 | );\r | |
1374 | \r | |
1375 | /**\r | |
1376 | Reads an 8-bit MMIO register.\r | |
1377 | \r | |
1378 | Reads the 8-bit MMIO register specified by Address. The 8-bit read value is\r | |
1379 | returned. This function must guarantee that all MMIO read and write\r | |
1380 | operations are serialized.\r | |
1381 | \r | |
1382 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1383 | \r | |
1384 | @param Address The MMIO register to read.\r | |
1385 | \r | |
1386 | @return The value read.\r | |
1387 | \r | |
1388 | **/\r | |
1389 | UINT8\r | |
1390 | EFIAPI\r | |
1391 | MmioRead8 (\r | |
1392 | IN UINTN Address\r | |
1393 | );\r | |
1394 | \r | |
1395 | /**\r | |
1396 | Writes an 8-bit MMIO register.\r | |
1397 | \r | |
1398 | Writes the 8-bit MMIO register specified by Address with the value specified\r | |
1399 | by Value and returns Value. This function must guarantee that all MMIO read\r | |
1400 | and write operations are serialized.\r | |
1401 | \r | |
1402 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1403 | \r | |
1404 | @param Address The MMIO register to write.\r | |
1405 | @param Value The value to write to the MMIO register.\r | |
9095d37b | 1406 | \r |
2281e7a9 | 1407 | @return Value.\r |
de22b698 | 1408 | \r |
1409 | **/\r | |
1410 | UINT8\r | |
1411 | EFIAPI\r | |
1412 | MmioWrite8 (\r | |
1413 | IN UINTN Address,\r | |
1414 | IN UINT8 Value\r | |
1415 | );\r | |
1416 | \r | |
1417 | /**\r | |
62991af2 | 1418 | Reads an 8-bit MMIO register, performs a bitwise OR, and writes the\r |
de22b698 | 1419 | result back to the 8-bit MMIO register.\r |
1420 | \r | |
9095d37b | 1421 | Reads the 8-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 1422 | OR between the read result and the value specified by OrData, and\r |
de22b698 | 1423 | writes the result to the 8-bit MMIO register specified by Address. The value\r |
1424 | written to the MMIO register is returned. This function must guarantee that\r | |
1425 | all MMIO read and write operations are serialized.\r | |
1426 | \r | |
1427 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1428 | \r | |
1429 | @param Address The MMIO register to write.\r | |
1430 | @param OrData The value to OR with the read value from the MMIO register.\r | |
1431 | \r | |
1432 | @return The value written back to the MMIO register.\r | |
1433 | \r | |
1434 | **/\r | |
1435 | UINT8\r | |
1436 | EFIAPI\r | |
1437 | MmioOr8 (\r | |
1438 | IN UINTN Address,\r | |
1439 | IN UINT8 OrData\r | |
1440 | );\r | |
1441 | \r | |
1442 | /**\r | |
1443 | Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result\r | |
1444 | back to the 8-bit MMIO register.\r | |
1445 | \r | |
1446 | Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r | |
1447 | between the read result and the value specified by AndData, and writes the\r | |
1448 | result to the 8-bit MMIO register specified by Address. The value written to\r | |
1449 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
1450 | read and write operations are serialized.\r | |
1451 | \r | |
1452 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1453 | \r | |
1454 | @param Address The MMIO register to write.\r | |
1455 | @param AndData The value to AND with the read value from the MMIO register.\r | |
1456 | \r | |
1457 | @return The value written back to the MMIO register.\r | |
1458 | \r | |
1459 | **/\r | |
1460 | UINT8\r | |
1461 | EFIAPI\r | |
1462 | MmioAnd8 (\r | |
1463 | IN UINTN Address,\r | |
1464 | IN UINT8 AndData\r | |
1465 | );\r | |
1466 | \r | |
1467 | /**\r | |
9095d37b | 1468 | Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise\r |
62991af2 | 1469 | OR, and writes the result back to the 8-bit MMIO register.\r |
de22b698 | 1470 | \r |
1471 | Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r | |
1472 | between the read result and the value specified by AndData, performs a\r | |
1473 | bitwise OR between the result of the AND operation and the value specified by\r | |
1474 | OrData, and writes the result to the 8-bit MMIO register specified by\r | |
1475 | Address. The value written to the MMIO register is returned. This function\r | |
1476 | must guarantee that all MMIO read and write operations are serialized.\r | |
1477 | \r | |
1478 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1479 | \r | |
1480 | \r | |
1481 | @param Address The MMIO register to write.\r | |
1482 | @param AndData The value to AND with the read value from the MMIO register.\r | |
1483 | @param OrData The value to OR with the result of the AND operation.\r | |
1484 | \r | |
1485 | @return The value written back to the MMIO register.\r | |
1486 | \r | |
1487 | **/\r | |
1488 | UINT8\r | |
1489 | EFIAPI\r | |
1490 | MmioAndThenOr8 (\r | |
1491 | IN UINTN Address,\r | |
1492 | IN UINT8 AndData,\r | |
1493 | IN UINT8 OrData\r | |
1494 | );\r | |
1495 | \r | |
1496 | /**\r | |
1497 | Reads a bit field of a MMIO register.\r | |
1498 | \r | |
1499 | Reads the bit field in an 8-bit MMIO register. The bit field is specified by\r | |
1500 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
1501 | \r | |
1502 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1503 | If StartBit is greater than 7, then ASSERT().\r | |
1504 | If EndBit is greater than 7, then ASSERT().\r | |
1505 | If EndBit is less than StartBit, then ASSERT().\r | |
1506 | \r | |
1507 | @param Address MMIO register to read.\r | |
1508 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1509 | Range 0..7.\r | |
1510 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1511 | Range 0..7.\r | |
1512 | \r | |
1513 | @return The value read.\r | |
1514 | \r | |
1515 | **/\r | |
1516 | UINT8\r | |
1517 | EFIAPI\r | |
1518 | MmioBitFieldRead8 (\r | |
1519 | IN UINTN Address,\r | |
1520 | IN UINTN StartBit,\r | |
1521 | IN UINTN EndBit\r | |
1522 | );\r | |
1523 | \r | |
1524 | /**\r | |
1525 | Writes a bit field to a MMIO register.\r | |
1526 | \r | |
1527 | Writes Value to the bit field of the MMIO register. The bit field is\r | |
1528 | specified by the StartBit and the EndBit. All other bits in the destination\r | |
1529 | MMIO register are preserved. The new value of the 8-bit register is returned.\r | |
1530 | \r | |
1531 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1532 | If StartBit is greater than 7, then ASSERT().\r | |
1533 | If EndBit is greater than 7, then ASSERT().\r | |
1534 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1535 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 1536 | \r |
1537 | @param Address MMIO register to write.\r | |
1538 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1539 | Range 0..7.\r | |
1540 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1541 | Range 0..7.\r | |
1542 | @param Value New value of the bit field.\r | |
1543 | \r | |
1544 | @return The value written back to the MMIO register.\r | |
1545 | \r | |
1546 | **/\r | |
1547 | UINT8\r | |
1548 | EFIAPI\r | |
1549 | MmioBitFieldWrite8 (\r | |
1550 | IN UINTN Address,\r | |
1551 | IN UINTN StartBit,\r | |
1552 | IN UINTN EndBit,\r | |
1553 | IN UINT8 Value\r | |
1554 | );\r | |
1555 | \r | |
1556 | /**\r | |
1557 | Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and\r | |
1558 | writes the result back to the bit field in the 8-bit MMIO register.\r | |
1559 | \r | |
9095d37b | 1560 | Reads the 8-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 1561 | OR between the read result and the value specified by OrData, and\r |
de22b698 | 1562 | writes the result to the 8-bit MMIO register specified by Address. The value\r |
1563 | written to the MMIO register is returned. This function must guarantee that\r | |
1564 | all MMIO read and write operations are serialized. Extra left bits in OrData\r | |
1565 | are stripped.\r | |
1566 | \r | |
1567 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1568 | If StartBit is greater than 7, then ASSERT().\r | |
1569 | If EndBit is greater than 7, then ASSERT().\r | |
1570 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1571 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 1572 | \r |
1573 | @param Address MMIO register to write.\r | |
1574 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1575 | Range 0..7.\r | |
1576 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1577 | Range 0..7.\r | |
1578 | @param OrData The value to OR with read value from the MMIO register.\r | |
1579 | \r | |
1580 | @return The value written back to the MMIO register.\r | |
1581 | \r | |
1582 | **/\r | |
1583 | UINT8\r | |
1584 | EFIAPI\r | |
1585 | MmioBitFieldOr8 (\r | |
1586 | IN UINTN Address,\r | |
1587 | IN UINTN StartBit,\r | |
1588 | IN UINTN EndBit,\r | |
1589 | IN UINT8 OrData\r | |
1590 | );\r | |
1591 | \r | |
1592 | /**\r | |
1593 | Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and\r | |
1594 | writes the result back to the bit field in the 8-bit MMIO register.\r | |
1595 | \r | |
1596 | Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r | |
1597 | between the read result and the value specified by AndData, and writes the\r | |
1598 | result to the 8-bit MMIO register specified by Address. The value written to\r | |
1599 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
1600 | read and write operations are serialized. Extra left bits in AndData are\r | |
1601 | stripped.\r | |
1602 | \r | |
1603 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1604 | If StartBit is greater than 7, then ASSERT().\r | |
1605 | If EndBit is greater than 7, then ASSERT().\r | |
1606 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1607 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 1608 | \r |
1609 | @param Address MMIO register to write.\r | |
1610 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1611 | Range 0..7.\r | |
1612 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1613 | Range 0..7.\r | |
1614 | @param AndData The value to AND with read value from the MMIO register.\r | |
1615 | \r | |
1616 | @return The value written back to the MMIO register.\r | |
1617 | \r | |
1618 | **/\r | |
1619 | UINT8\r | |
1620 | EFIAPI\r | |
1621 | MmioBitFieldAnd8 (\r | |
1622 | IN UINTN Address,\r | |
1623 | IN UINTN StartBit,\r | |
1624 | IN UINTN EndBit,\r | |
1625 | IN UINT8 AndData\r | |
1626 | );\r | |
1627 | \r | |
1628 | /**\r | |
1629 | Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed\r | |
62991af2 | 1630 | by a bitwise OR, and writes the result back to the bit field in the\r |
de22b698 | 1631 | 8-bit MMIO register.\r |
1632 | \r | |
1633 | Reads the 8-bit MMIO register specified by Address, performs a bitwise AND\r | |
62991af2 | 1634 | followed by a bitwise OR between the read result and the value\r |
de22b698 | 1635 | specified by AndData, and writes the result to the 8-bit MMIO register\r |
1636 | specified by Address. The value written to the MMIO register is returned.\r | |
1637 | This function must guarantee that all MMIO read and write operations are\r | |
1638 | serialized. Extra left bits in both AndData and OrData are stripped.\r | |
1639 | \r | |
1640 | If 8-bit MMIO register operations are not supported, then ASSERT().\r | |
1641 | If StartBit is greater than 7, then ASSERT().\r | |
1642 | If EndBit is greater than 7, then ASSERT().\r | |
1643 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
1644 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
1645 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
de22b698 | 1646 | \r |
1647 | @param Address MMIO register to write.\r | |
1648 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1649 | Range 0..7.\r | |
1650 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1651 | Range 0..7.\r | |
1652 | @param AndData The value to AND with read value from the MMIO register.\r | |
1653 | @param OrData The value to OR with the result of the AND operation.\r | |
1654 | \r | |
1655 | @return The value written back to the MMIO register.\r | |
1656 | \r | |
1657 | **/\r | |
1658 | UINT8\r | |
1659 | EFIAPI\r | |
1660 | MmioBitFieldAndThenOr8 (\r | |
1661 | IN UINTN Address,\r | |
1662 | IN UINTN StartBit,\r | |
1663 | IN UINTN EndBit,\r | |
1664 | IN UINT8 AndData,\r | |
1665 | IN UINT8 OrData\r | |
1666 | );\r | |
1667 | \r | |
1668 | /**\r | |
1669 | Reads a 16-bit MMIO register.\r | |
1670 | \r | |
1671 | Reads the 16-bit MMIO register specified by Address. The 16-bit read value is\r | |
1672 | returned. This function must guarantee that all MMIO read and write\r | |
1673 | operations are serialized.\r | |
1674 | \r | |
1675 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 1676 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 1677 | \r |
1678 | @param Address The MMIO register to read.\r | |
1679 | \r | |
1680 | @return The value read.\r | |
1681 | \r | |
1682 | **/\r | |
1683 | UINT16\r | |
1684 | EFIAPI\r | |
1685 | MmioRead16 (\r | |
1686 | IN UINTN Address\r | |
1687 | );\r | |
1688 | \r | |
1689 | /**\r | |
1690 | Writes a 16-bit MMIO register.\r | |
1691 | \r | |
1692 | Writes the 16-bit MMIO register specified by Address with the value specified\r | |
1693 | by Value and returns Value. This function must guarantee that all MMIO read\r | |
1694 | and write operations are serialized.\r | |
1695 | \r | |
1696 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 1697 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 1698 | \r |
1699 | @param Address The MMIO register to write.\r | |
1700 | @param Value The value to write to the MMIO register.\r | |
9095d37b | 1701 | \r |
2281e7a9 | 1702 | @return Value.\r |
de22b698 | 1703 | \r |
1704 | **/\r | |
1705 | UINT16\r | |
1706 | EFIAPI\r | |
1707 | MmioWrite16 (\r | |
1708 | IN UINTN Address,\r | |
1709 | IN UINT16 Value\r | |
1710 | );\r | |
1711 | \r | |
1712 | /**\r | |
62991af2 | 1713 | Reads a 16-bit MMIO register, performs a bitwise OR, and writes the\r |
de22b698 | 1714 | result back to the 16-bit MMIO register.\r |
1715 | \r | |
9095d37b | 1716 | Reads the 16-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 1717 | OR between the read result and the value specified by OrData, and\r |
de22b698 | 1718 | writes the result to the 16-bit MMIO register specified by Address. The value\r |
1719 | written to the MMIO register is returned. This function must guarantee that\r | |
1720 | all MMIO read and write operations are serialized.\r | |
1721 | \r | |
1722 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 1723 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 1724 | \r |
1725 | @param Address The MMIO register to write.\r | |
1726 | @param OrData The value to OR with the read value from the MMIO register.\r | |
1727 | \r | |
1728 | @return The value written back to the MMIO register.\r | |
1729 | \r | |
1730 | **/\r | |
1731 | UINT16\r | |
1732 | EFIAPI\r | |
1733 | MmioOr16 (\r | |
1734 | IN UINTN Address,\r | |
1735 | IN UINT16 OrData\r | |
1736 | );\r | |
1737 | \r | |
1738 | /**\r | |
1739 | Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result\r | |
1740 | back to the 16-bit MMIO register.\r | |
1741 | \r | |
1742 | Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r | |
1743 | between the read result and the value specified by AndData, and writes the\r | |
1744 | result to the 16-bit MMIO register specified by Address. The value written to\r | |
1745 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
1746 | read and write operations are serialized.\r | |
1747 | \r | |
1748 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 1749 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 1750 | \r |
1751 | @param Address The MMIO register to write.\r | |
1752 | @param AndData The value to AND with the read value from the MMIO register.\r | |
1753 | \r | |
1754 | @return The value written back to the MMIO register.\r | |
1755 | \r | |
1756 | **/\r | |
1757 | UINT16\r | |
1758 | EFIAPI\r | |
1759 | MmioAnd16 (\r | |
1760 | IN UINTN Address,\r | |
1761 | IN UINT16 AndData\r | |
1762 | );\r | |
1763 | \r | |
1764 | /**\r | |
9095d37b | 1765 | Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise\r |
62991af2 | 1766 | OR, and writes the result back to the 16-bit MMIO register.\r |
de22b698 | 1767 | \r |
1768 | Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r | |
1769 | between the read result and the value specified by AndData, performs a\r | |
1770 | bitwise OR between the result of the AND operation and the value specified by\r | |
1771 | OrData, and writes the result to the 16-bit MMIO register specified by\r | |
1772 | Address. The value written to the MMIO register is returned. This function\r | |
1773 | must guarantee that all MMIO read and write operations are serialized.\r | |
1774 | \r | |
1775 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 1776 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 1777 | \r |
1778 | @param Address The MMIO register to write.\r | |
1779 | @param AndData The value to AND with the read value from the MMIO register.\r | |
1780 | @param OrData The value to OR with the result of the AND operation.\r | |
1781 | \r | |
1782 | @return The value written back to the MMIO register.\r | |
1783 | \r | |
1784 | **/\r | |
1785 | UINT16\r | |
1786 | EFIAPI\r | |
1787 | MmioAndThenOr16 (\r | |
1788 | IN UINTN Address,\r | |
1789 | IN UINT16 AndData,\r | |
1790 | IN UINT16 OrData\r | |
1791 | );\r | |
1792 | \r | |
1793 | /**\r | |
1794 | Reads a bit field of a MMIO register.\r | |
1795 | \r | |
1796 | Reads the bit field in a 16-bit MMIO register. The bit field is specified by\r | |
1797 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
1798 | \r | |
1799 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 1800 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 1801 | If StartBit is greater than 15, then ASSERT().\r |
1802 | If EndBit is greater than 15, then ASSERT().\r | |
1803 | If EndBit is less than StartBit, then ASSERT().\r | |
1804 | \r | |
1805 | @param Address MMIO register to read.\r | |
1806 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1807 | Range 0..15.\r | |
1808 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1809 | Range 0..15.\r | |
1810 | \r | |
1811 | @return The value read.\r | |
1812 | \r | |
1813 | **/\r | |
1814 | UINT16\r | |
1815 | EFIAPI\r | |
1816 | MmioBitFieldRead16 (\r | |
1817 | IN UINTN Address,\r | |
1818 | IN UINTN StartBit,\r | |
1819 | IN UINTN EndBit\r | |
1820 | );\r | |
1821 | \r | |
1822 | /**\r | |
1823 | Writes a bit field to a MMIO register.\r | |
1824 | \r | |
1825 | Writes Value to the bit field of the MMIO register. The bit field is\r | |
1826 | specified by the StartBit and the EndBit. All other bits in the destination\r | |
1827 | MMIO register are preserved. The new value of the 16-bit register is returned.\r | |
1828 | \r | |
1829 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 1830 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 1831 | If StartBit is greater than 15, then ASSERT().\r |
1832 | If EndBit is greater than 15, then ASSERT().\r | |
1833 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1834 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 1835 | \r |
1836 | @param Address MMIO register to write.\r | |
1837 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1838 | Range 0..15.\r | |
1839 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1840 | Range 0..15.\r | |
1841 | @param Value New value of the bit field.\r | |
1842 | \r | |
1843 | @return The value written back to the MMIO register.\r | |
1844 | \r | |
1845 | **/\r | |
1846 | UINT16\r | |
1847 | EFIAPI\r | |
1848 | MmioBitFieldWrite16 (\r | |
1849 | IN UINTN Address,\r | |
1850 | IN UINTN StartBit,\r | |
1851 | IN UINTN EndBit,\r | |
1852 | IN UINT16 Value\r | |
1853 | );\r | |
1854 | \r | |
1855 | /**\r | |
1856 | Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and\r | |
1857 | writes the result back to the bit field in the 16-bit MMIO register.\r | |
1858 | \r | |
9095d37b | 1859 | Reads the 16-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 1860 | OR between the read result and the value specified by OrData, and\r |
de22b698 | 1861 | writes the result to the 16-bit MMIO register specified by Address. The value\r |
1862 | written to the MMIO register is returned. This function must guarantee that\r | |
1863 | all MMIO read and write operations are serialized. Extra left bits in OrData\r | |
1864 | are stripped.\r | |
1865 | \r | |
1866 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 1867 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 1868 | If StartBit is greater than 15, then ASSERT().\r |
1869 | If EndBit is greater than 15, then ASSERT().\r | |
1870 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1871 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 1872 | \r |
1873 | @param Address MMIO register to write.\r | |
1874 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1875 | Range 0..15.\r | |
1876 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1877 | Range 0..15.\r | |
1878 | @param OrData The value to OR with read value from the MMIO register.\r | |
1879 | \r | |
1880 | @return The value written back to the MMIO register.\r | |
1881 | \r | |
1882 | **/\r | |
1883 | UINT16\r | |
1884 | EFIAPI\r | |
1885 | MmioBitFieldOr16 (\r | |
1886 | IN UINTN Address,\r | |
1887 | IN UINTN StartBit,\r | |
1888 | IN UINTN EndBit,\r | |
1889 | IN UINT16 OrData\r | |
1890 | );\r | |
1891 | \r | |
1892 | /**\r | |
1893 | Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and\r | |
1894 | writes the result back to the bit field in the 16-bit MMIO register.\r | |
1895 | \r | |
1896 | Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r | |
1897 | between the read result and the value specified by AndData, and writes the\r | |
1898 | result to the 16-bit MMIO register specified by Address. The value written to\r | |
1899 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
1900 | read and write operations are serialized. Extra left bits in AndData are\r | |
1901 | stripped.\r | |
1902 | \r | |
1903 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 1904 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 1905 | If StartBit is greater than 15, then ASSERT().\r |
1906 | If EndBit is greater than 15, then ASSERT().\r | |
1907 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 1908 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 1909 | \r |
1910 | @param Address MMIO register to write.\r | |
1911 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1912 | Range 0..15.\r | |
1913 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1914 | Range 0..15.\r | |
1915 | @param AndData The value to AND with read value from the MMIO register.\r | |
1916 | \r | |
1917 | @return The value written back to the MMIO register.\r | |
1918 | \r | |
1919 | **/\r | |
1920 | UINT16\r | |
1921 | EFIAPI\r | |
1922 | MmioBitFieldAnd16 (\r | |
1923 | IN UINTN Address,\r | |
1924 | IN UINTN StartBit,\r | |
1925 | IN UINTN EndBit,\r | |
1926 | IN UINT16 AndData\r | |
1927 | );\r | |
1928 | \r | |
1929 | /**\r | |
1930 | Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed\r | |
62991af2 | 1931 | by a bitwise OR, and writes the result back to the bit field in the\r |
de22b698 | 1932 | 16-bit MMIO register.\r |
1933 | \r | |
1934 | Reads the 16-bit MMIO register specified by Address, performs a bitwise AND\r | |
62991af2 | 1935 | followed by a bitwise OR between the read result and the value\r |
de22b698 | 1936 | specified by AndData, and writes the result to the 16-bit MMIO register\r |
1937 | specified by Address. The value written to the MMIO register is returned.\r | |
1938 | This function must guarantee that all MMIO read and write operations are\r | |
1939 | serialized. Extra left bits in both AndData and OrData are stripped.\r | |
1940 | \r | |
1941 | If 16-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 1942 | If Address is not aligned on a 16-bit boundary, then ASSERT().\r |
de22b698 | 1943 | If StartBit is greater than 15, then ASSERT().\r |
1944 | If EndBit is greater than 15, then ASSERT().\r | |
1945 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
1946 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
1947 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
de22b698 | 1948 | \r |
1949 | @param Address MMIO register to write.\r | |
1950 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
1951 | Range 0..15.\r | |
1952 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
1953 | Range 0..15.\r | |
1954 | @param AndData The value to AND with read value from the MMIO register.\r | |
1955 | @param OrData The value to OR with the result of the AND operation.\r | |
1956 | \r | |
1957 | @return The value written back to the MMIO register.\r | |
1958 | \r | |
1959 | **/\r | |
1960 | UINT16\r | |
1961 | EFIAPI\r | |
1962 | MmioBitFieldAndThenOr16 (\r | |
1963 | IN UINTN Address,\r | |
1964 | IN UINTN StartBit,\r | |
1965 | IN UINTN EndBit,\r | |
1966 | IN UINT16 AndData,\r | |
1967 | IN UINT16 OrData\r | |
1968 | );\r | |
1969 | \r | |
1970 | /**\r | |
1971 | Reads a 32-bit MMIO register.\r | |
1972 | \r | |
1973 | Reads the 32-bit MMIO register specified by Address. The 32-bit read value is\r | |
1974 | returned. This function must guarantee that all MMIO read and write\r | |
1975 | operations are serialized.\r | |
1976 | \r | |
1977 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 1978 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 1979 | \r |
1980 | @param Address The MMIO register to read.\r | |
1981 | \r | |
1982 | @return The value read.\r | |
1983 | \r | |
1984 | **/\r | |
1985 | UINT32\r | |
1986 | EFIAPI\r | |
1987 | MmioRead32 (\r | |
1988 | IN UINTN Address\r | |
1989 | );\r | |
1990 | \r | |
1991 | /**\r | |
1992 | Writes a 32-bit MMIO register.\r | |
1993 | \r | |
1994 | Writes the 32-bit MMIO register specified by Address with the value specified\r | |
1995 | by Value and returns Value. This function must guarantee that all MMIO read\r | |
1996 | and write operations are serialized.\r | |
1997 | \r | |
1998 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 1999 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 2000 | \r |
2001 | @param Address The MMIO register to write.\r | |
2002 | @param Value The value to write to the MMIO register.\r | |
9095d37b | 2003 | \r |
2281e7a9 | 2004 | @return Value.\r |
de22b698 | 2005 | \r |
2006 | **/\r | |
2007 | UINT32\r | |
2008 | EFIAPI\r | |
2009 | MmioWrite32 (\r | |
2010 | IN UINTN Address,\r | |
2011 | IN UINT32 Value\r | |
2012 | );\r | |
2013 | \r | |
2014 | /**\r | |
62991af2 | 2015 | Reads a 32-bit MMIO register, performs a bitwise OR, and writes the\r |
de22b698 | 2016 | result back to the 32-bit MMIO register.\r |
2017 | \r | |
9095d37b | 2018 | Reads the 32-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 2019 | OR between the read result and the value specified by OrData, and\r |
de22b698 | 2020 | writes the result to the 32-bit MMIO register specified by Address. The value\r |
2021 | written to the MMIO register is returned. This function must guarantee that\r | |
2022 | all MMIO read and write operations are serialized.\r | |
2023 | \r | |
2024 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2025 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 2026 | \r |
2027 | @param Address The MMIO register to write.\r | |
2028 | @param OrData The value to OR with the read value from the MMIO register.\r | |
2029 | \r | |
2030 | @return The value written back to the MMIO register.\r | |
2031 | \r | |
2032 | **/\r | |
2033 | UINT32\r | |
2034 | EFIAPI\r | |
2035 | MmioOr32 (\r | |
2036 | IN UINTN Address,\r | |
2037 | IN UINT32 OrData\r | |
2038 | );\r | |
2039 | \r | |
2040 | /**\r | |
2041 | Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result\r | |
2042 | back to the 32-bit MMIO register.\r | |
2043 | \r | |
2044 | Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r | |
2045 | between the read result and the value specified by AndData, and writes the\r | |
2046 | result to the 32-bit MMIO register specified by Address. The value written to\r | |
2047 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
2048 | read and write operations are serialized.\r | |
2049 | \r | |
2050 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2051 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 2052 | \r |
2053 | @param Address The MMIO register to write.\r | |
2054 | @param AndData The value to AND with the read value from the MMIO register.\r | |
2055 | \r | |
2056 | @return The value written back to the MMIO register.\r | |
2057 | \r | |
2058 | **/\r | |
2059 | UINT32\r | |
2060 | EFIAPI\r | |
2061 | MmioAnd32 (\r | |
2062 | IN UINTN Address,\r | |
2063 | IN UINT32 AndData\r | |
2064 | );\r | |
2065 | \r | |
2066 | /**\r | |
9095d37b | 2067 | Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise\r |
62991af2 | 2068 | OR, and writes the result back to the 32-bit MMIO register.\r |
de22b698 | 2069 | \r |
2070 | Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r | |
2071 | between the read result and the value specified by AndData, performs a\r | |
2072 | bitwise OR between the result of the AND operation and the value specified by\r | |
2073 | OrData, and writes the result to the 32-bit MMIO register specified by\r | |
2074 | Address. The value written to the MMIO register is returned. This function\r | |
2075 | must guarantee that all MMIO read and write operations are serialized.\r | |
2076 | \r | |
2077 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2078 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 2079 | \r |
2080 | @param Address The MMIO register to write.\r | |
2081 | @param AndData The value to AND with the read value from the MMIO register.\r | |
2082 | @param OrData The value to OR with the result of the AND operation.\r | |
2083 | \r | |
2084 | @return The value written back to the MMIO register.\r | |
2085 | \r | |
2086 | **/\r | |
2087 | UINT32\r | |
2088 | EFIAPI\r | |
2089 | MmioAndThenOr32 (\r | |
2090 | IN UINTN Address,\r | |
2091 | IN UINT32 AndData,\r | |
2092 | IN UINT32 OrData\r | |
2093 | );\r | |
2094 | \r | |
2095 | /**\r | |
2096 | Reads a bit field of a MMIO register.\r | |
2097 | \r | |
2098 | Reads the bit field in a 32-bit MMIO register. The bit field is specified by\r | |
2099 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
2100 | \r | |
2101 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2102 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 2103 | If StartBit is greater than 31, then ASSERT().\r |
2104 | If EndBit is greater than 31, then ASSERT().\r | |
2105 | If EndBit is less than StartBit, then ASSERT().\r | |
2106 | \r | |
2107 | @param Address MMIO register to read.\r | |
2108 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2109 | Range 0..31.\r | |
2110 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2111 | Range 0..31.\r | |
2112 | \r | |
2113 | @return The value read.\r | |
2114 | \r | |
2115 | **/\r | |
2116 | UINT32\r | |
2117 | EFIAPI\r | |
2118 | MmioBitFieldRead32 (\r | |
2119 | IN UINTN Address,\r | |
2120 | IN UINTN StartBit,\r | |
2121 | IN UINTN EndBit\r | |
2122 | );\r | |
2123 | \r | |
2124 | /**\r | |
2125 | Writes a bit field to a MMIO register.\r | |
2126 | \r | |
2127 | Writes Value to the bit field of the MMIO register. The bit field is\r | |
2128 | specified by the StartBit and the EndBit. All other bits in the destination\r | |
2129 | MMIO register are preserved. The new value of the 32-bit register is returned.\r | |
2130 | \r | |
2131 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2132 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 2133 | If StartBit is greater than 31, then ASSERT().\r |
2134 | If EndBit is greater than 31, then ASSERT().\r | |
2135 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 2136 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 2137 | \r |
2138 | @param Address MMIO register to write.\r | |
2139 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2140 | Range 0..31.\r | |
2141 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2142 | Range 0..31.\r | |
2143 | @param Value New value of the bit field.\r | |
2144 | \r | |
2145 | @return The value written back to the MMIO register.\r | |
2146 | \r | |
2147 | **/\r | |
2148 | UINT32\r | |
2149 | EFIAPI\r | |
2150 | MmioBitFieldWrite32 (\r | |
2151 | IN UINTN Address,\r | |
2152 | IN UINTN StartBit,\r | |
2153 | IN UINTN EndBit,\r | |
2154 | IN UINT32 Value\r | |
2155 | );\r | |
2156 | \r | |
2157 | /**\r | |
2158 | Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and\r | |
2159 | writes the result back to the bit field in the 32-bit MMIO register.\r | |
2160 | \r | |
9095d37b | 2161 | Reads the 32-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 2162 | OR between the read result and the value specified by OrData, and\r |
de22b698 | 2163 | writes the result to the 32-bit MMIO register specified by Address. The value\r |
2164 | written to the MMIO register is returned. This function must guarantee that\r | |
2165 | all MMIO read and write operations are serialized. Extra left bits in OrData\r | |
2166 | are stripped.\r | |
2167 | \r | |
2168 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2169 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 2170 | If StartBit is greater than 31, then ASSERT().\r |
2171 | If EndBit is greater than 31, then ASSERT().\r | |
2172 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 2173 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 2174 | \r |
2175 | @param Address MMIO register to write.\r | |
2176 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2177 | Range 0..31.\r | |
2178 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2179 | Range 0..31.\r | |
2180 | @param OrData The value to OR with read value from the MMIO register.\r | |
2181 | \r | |
2182 | @return The value written back to the MMIO register.\r | |
2183 | \r | |
2184 | **/\r | |
2185 | UINT32\r | |
2186 | EFIAPI\r | |
2187 | MmioBitFieldOr32 (\r | |
2188 | IN UINTN Address,\r | |
2189 | IN UINTN StartBit,\r | |
2190 | IN UINTN EndBit,\r | |
2191 | IN UINT32 OrData\r | |
2192 | );\r | |
2193 | \r | |
2194 | /**\r | |
2195 | Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and\r | |
2196 | writes the result back to the bit field in the 32-bit MMIO register.\r | |
2197 | \r | |
2198 | Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r | |
2199 | between the read result and the value specified by AndData, and writes the\r | |
2200 | result to the 32-bit MMIO register specified by Address. The value written to\r | |
2201 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
2202 | read and write operations are serialized. Extra left bits in AndData are\r | |
2203 | stripped.\r | |
2204 | \r | |
2205 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2206 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 2207 | If StartBit is greater than 31, then ASSERT().\r |
2208 | If EndBit is greater than 31, then ASSERT().\r | |
2209 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 2210 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 2211 | \r |
2212 | @param Address MMIO register to write.\r | |
2213 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2214 | Range 0..31.\r | |
2215 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2216 | Range 0..31.\r | |
2217 | @param AndData The value to AND with read value from the MMIO register.\r | |
2218 | \r | |
2219 | @return The value written back to the MMIO register.\r | |
2220 | \r | |
2221 | **/\r | |
2222 | UINT32\r | |
2223 | EFIAPI\r | |
2224 | MmioBitFieldAnd32 (\r | |
2225 | IN UINTN Address,\r | |
2226 | IN UINTN StartBit,\r | |
2227 | IN UINTN EndBit,\r | |
2228 | IN UINT32 AndData\r | |
2229 | );\r | |
2230 | \r | |
2231 | /**\r | |
2232 | Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed\r | |
62991af2 | 2233 | by a bitwise OR, and writes the result back to the bit field in the\r |
de22b698 | 2234 | 32-bit MMIO register.\r |
2235 | \r | |
2236 | Reads the 32-bit MMIO register specified by Address, performs a bitwise AND\r | |
62991af2 | 2237 | followed by a bitwise OR between the read result and the value\r |
de22b698 | 2238 | specified by AndData, and writes the result to the 32-bit MMIO register\r |
2239 | specified by Address. The value written to the MMIO register is returned.\r | |
2240 | This function must guarantee that all MMIO read and write operations are\r | |
2241 | serialized. Extra left bits in both AndData and OrData are stripped.\r | |
2242 | \r | |
2243 | If 32-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2244 | If Address is not aligned on a 32-bit boundary, then ASSERT().\r |
de22b698 | 2245 | If StartBit is greater than 31, then ASSERT().\r |
2246 | If EndBit is greater than 31, then ASSERT().\r | |
2247 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
2248 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
2249 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
de22b698 | 2250 | \r |
2251 | @param Address MMIO register to write.\r | |
2252 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2253 | Range 0..31.\r | |
2254 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2255 | Range 0..31.\r | |
2256 | @param AndData The value to AND with read value from the MMIO register.\r | |
2257 | @param OrData The value to OR with the result of the AND operation.\r | |
2258 | \r | |
2259 | @return The value written back to the MMIO register.\r | |
2260 | \r | |
2261 | **/\r | |
2262 | UINT32\r | |
2263 | EFIAPI\r | |
2264 | MmioBitFieldAndThenOr32 (\r | |
2265 | IN UINTN Address,\r | |
2266 | IN UINTN StartBit,\r | |
2267 | IN UINTN EndBit,\r | |
2268 | IN UINT32 AndData,\r | |
2269 | IN UINT32 OrData\r | |
2270 | );\r | |
2271 | \r | |
2272 | /**\r | |
2273 | Reads a 64-bit MMIO register.\r | |
2274 | \r | |
2275 | Reads the 64-bit MMIO register specified by Address. The 64-bit read value is\r | |
2276 | returned. This function must guarantee that all MMIO read and write\r | |
2277 | operations are serialized.\r | |
2278 | \r | |
2279 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2280 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 2281 | \r |
2282 | @param Address The MMIO register to read.\r | |
2283 | \r | |
2284 | @return The value read.\r | |
2285 | \r | |
2286 | **/\r | |
2287 | UINT64\r | |
2288 | EFIAPI\r | |
2289 | MmioRead64 (\r | |
2290 | IN UINTN Address\r | |
2291 | );\r | |
2292 | \r | |
2293 | /**\r | |
2294 | Writes a 64-bit MMIO register.\r | |
2295 | \r | |
2296 | Writes the 64-bit MMIO register specified by Address with the value specified\r | |
2297 | by Value and returns Value. This function must guarantee that all MMIO read\r | |
2298 | and write operations are serialized.\r | |
2299 | \r | |
2300 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2301 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 2302 | \r |
2303 | @param Address The MMIO register to write.\r | |
2304 | @param Value The value to write to the MMIO register.\r | |
2305 | \r | |
2306 | **/\r | |
2307 | UINT64\r | |
2308 | EFIAPI\r | |
2309 | MmioWrite64 (\r | |
2310 | IN UINTN Address,\r | |
2311 | IN UINT64 Value\r | |
2312 | );\r | |
2313 | \r | |
2314 | /**\r | |
62991af2 | 2315 | Reads a 64-bit MMIO register, performs a bitwise OR, and writes the\r |
de22b698 | 2316 | result back to the 64-bit MMIO register.\r |
2317 | \r | |
9095d37b | 2318 | Reads the 64-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 2319 | OR between the read result and the value specified by OrData, and\r |
de22b698 | 2320 | writes the result to the 64-bit MMIO register specified by Address. The value\r |
2321 | written to the MMIO register is returned. This function must guarantee that\r | |
2322 | all MMIO read and write operations are serialized.\r | |
2323 | \r | |
2324 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2325 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 2326 | \r |
2327 | @param Address The MMIO register to write.\r | |
2328 | @param OrData The value to OR with the read value from the MMIO register.\r | |
2329 | \r | |
2330 | @return The value written back to the MMIO register.\r | |
2331 | \r | |
2332 | **/\r | |
2333 | UINT64\r | |
2334 | EFIAPI\r | |
2335 | MmioOr64 (\r | |
2336 | IN UINTN Address,\r | |
2337 | IN UINT64 OrData\r | |
2338 | );\r | |
2339 | \r | |
2340 | /**\r | |
2341 | Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result\r | |
2342 | back to the 64-bit MMIO register.\r | |
2343 | \r | |
2344 | Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r | |
2345 | between the read result and the value specified by AndData, and writes the\r | |
2346 | result to the 64-bit MMIO register specified by Address. The value written to\r | |
2347 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
2348 | read and write operations are serialized.\r | |
2349 | \r | |
2350 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2351 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 2352 | \r |
2353 | @param Address The MMIO register to write.\r | |
2354 | @param AndData The value to AND with the read value from the MMIO register.\r | |
2355 | \r | |
2356 | @return The value written back to the MMIO register.\r | |
2357 | \r | |
2358 | **/\r | |
2359 | UINT64\r | |
2360 | EFIAPI\r | |
2361 | MmioAnd64 (\r | |
2362 | IN UINTN Address,\r | |
2363 | IN UINT64 AndData\r | |
2364 | );\r | |
2365 | \r | |
2366 | /**\r | |
9095d37b | 2367 | Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise\r |
62991af2 | 2368 | OR, and writes the result back to the 64-bit MMIO register.\r |
de22b698 | 2369 | \r |
2370 | Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r | |
2371 | between the read result and the value specified by AndData, performs a\r | |
2372 | bitwise OR between the result of the AND operation and the value specified by\r | |
2373 | OrData, and writes the result to the 64-bit MMIO register specified by\r | |
2374 | Address. The value written to the MMIO register is returned. This function\r | |
2375 | must guarantee that all MMIO read and write operations are serialized.\r | |
2376 | \r | |
2377 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2378 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 2379 | \r |
2380 | @param Address The MMIO register to write.\r | |
2381 | @param AndData The value to AND with the read value from the MMIO register.\r | |
2382 | @param OrData The value to OR with the result of the AND operation.\r | |
2383 | \r | |
2384 | @return The value written back to the MMIO register.\r | |
2385 | \r | |
2386 | **/\r | |
2387 | UINT64\r | |
2388 | EFIAPI\r | |
2389 | MmioAndThenOr64 (\r | |
2390 | IN UINTN Address,\r | |
2391 | IN UINT64 AndData,\r | |
2392 | IN UINT64 OrData\r | |
2393 | );\r | |
2394 | \r | |
2395 | /**\r | |
2396 | Reads a bit field of a MMIO register.\r | |
2397 | \r | |
2398 | Reads the bit field in a 64-bit MMIO register. The bit field is specified by\r | |
2399 | the StartBit and the EndBit. The value of the bit field is returned.\r | |
2400 | \r | |
2401 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2402 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 2403 | If StartBit is greater than 63, then ASSERT().\r |
2404 | If EndBit is greater than 63, then ASSERT().\r | |
2405 | If EndBit is less than StartBit, then ASSERT().\r | |
2406 | \r | |
2407 | @param Address MMIO register to read.\r | |
2408 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2409 | Range 0..63.\r | |
2410 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2411 | Range 0..63.\r | |
2412 | \r | |
2413 | @return The value read.\r | |
2414 | \r | |
2415 | **/\r | |
2416 | UINT64\r | |
2417 | EFIAPI\r | |
2418 | MmioBitFieldRead64 (\r | |
2419 | IN UINTN Address,\r | |
2420 | IN UINTN StartBit,\r | |
2421 | IN UINTN EndBit\r | |
2422 | );\r | |
2423 | \r | |
2424 | /**\r | |
2425 | Writes a bit field to a MMIO register.\r | |
2426 | \r | |
2427 | Writes Value to the bit field of the MMIO register. The bit field is\r | |
2428 | specified by the StartBit and the EndBit. All other bits in the destination\r | |
2429 | MMIO register are preserved. The new value of the 64-bit register is returned.\r | |
2430 | \r | |
2431 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2432 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 2433 | If StartBit is greater than 63, then ASSERT().\r |
2434 | If EndBit is greater than 63, then ASSERT().\r | |
2435 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 2436 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 2437 | \r |
2438 | @param Address MMIO register to write.\r | |
2439 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2440 | Range 0..63.\r | |
2441 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2442 | Range 0..63.\r | |
2443 | @param Value New value of the bit field.\r | |
2444 | \r | |
2445 | @return The value written back to the MMIO register.\r | |
2446 | \r | |
2447 | **/\r | |
2448 | UINT64\r | |
2449 | EFIAPI\r | |
2450 | MmioBitFieldWrite64 (\r | |
2451 | IN UINTN Address,\r | |
2452 | IN UINTN StartBit,\r | |
2453 | IN UINTN EndBit,\r | |
2454 | IN UINT64 Value\r | |
2455 | );\r | |
2456 | \r | |
2457 | /**\r | |
2458 | Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and\r | |
2459 | writes the result back to the bit field in the 64-bit MMIO register.\r | |
2460 | \r | |
9095d37b | 2461 | Reads the 64-bit MMIO register specified by Address, performs a bitwise\r |
62991af2 | 2462 | OR between the read result and the value specified by OrData, and\r |
de22b698 | 2463 | writes the result to the 64-bit MMIO register specified by Address. The value\r |
2464 | written to the MMIO register is returned. This function must guarantee that\r | |
2465 | all MMIO read and write operations are serialized. Extra left bits in OrData\r | |
2466 | are stripped.\r | |
2467 | \r | |
2468 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2469 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 2470 | If StartBit is greater than 63, then ASSERT().\r |
2471 | If EndBit is greater than 63, then ASSERT().\r | |
2472 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 2473 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 2474 | \r |
2475 | @param Address MMIO register to write.\r | |
2476 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2477 | Range 0..63.\r | |
2478 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2479 | Range 0..63.\r | |
2480 | @param OrData The value to OR with read value from the MMIO register.\r | |
2481 | \r | |
2482 | @return The value written back to the MMIO register.\r | |
2483 | \r | |
2484 | **/\r | |
2485 | UINT64\r | |
2486 | EFIAPI\r | |
2487 | MmioBitFieldOr64 (\r | |
2488 | IN UINTN Address,\r | |
2489 | IN UINTN StartBit,\r | |
2490 | IN UINTN EndBit,\r | |
2491 | IN UINT64 OrData\r | |
2492 | );\r | |
2493 | \r | |
2494 | /**\r | |
2495 | Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and\r | |
2496 | writes the result back to the bit field in the 64-bit MMIO register.\r | |
2497 | \r | |
2498 | Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r | |
2499 | between the read result and the value specified by AndData, and writes the\r | |
2500 | result to the 64-bit MMIO register specified by Address. The value written to\r | |
2501 | the MMIO register is returned. This function must guarantee that all MMIO\r | |
2502 | read and write operations are serialized. Extra left bits in AndData are\r | |
2503 | stripped.\r | |
2504 | \r | |
2505 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2506 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 2507 | If StartBit is greater than 63, then ASSERT().\r |
2508 | If EndBit is greater than 63, then ASSERT().\r | |
2509 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 2510 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
de22b698 | 2511 | \r |
2512 | @param Address MMIO register to write.\r | |
2513 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2514 | Range 0..63.\r | |
2515 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2516 | Range 0..63.\r | |
2517 | @param AndData The value to AND with read value from the MMIO register.\r | |
2518 | \r | |
2519 | @return The value written back to the MMIO register.\r | |
2520 | \r | |
2521 | **/\r | |
2522 | UINT64\r | |
2523 | EFIAPI\r | |
2524 | MmioBitFieldAnd64 (\r | |
2525 | IN UINTN Address,\r | |
2526 | IN UINTN StartBit,\r | |
2527 | IN UINTN EndBit,\r | |
2528 | IN UINT64 AndData\r | |
2529 | );\r | |
2530 | \r | |
2531 | /**\r | |
2532 | Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed\r | |
62991af2 | 2533 | by a bitwise OR, and writes the result back to the bit field in the\r |
de22b698 | 2534 | 64-bit MMIO register.\r |
2535 | \r | |
2536 | Reads the 64-bit MMIO register specified by Address, performs a bitwise AND\r | |
62991af2 | 2537 | followed by a bitwise OR between the read result and the value\r |
de22b698 | 2538 | specified by AndData, and writes the result to the 64-bit MMIO register\r |
2539 | specified by Address. The value written to the MMIO register is returned.\r | |
2540 | This function must guarantee that all MMIO read and write operations are\r | |
2541 | serialized. Extra left bits in both AndData and OrData are stripped.\r | |
2542 | \r | |
2543 | If 64-bit MMIO register operations are not supported, then ASSERT().\r | |
5ac79a78 | 2544 | If Address is not aligned on a 64-bit boundary, then ASSERT().\r |
de22b698 | 2545 | If StartBit is greater than 63, then ASSERT().\r |
2546 | If EndBit is greater than 63, then ASSERT().\r | |
2547 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
2548 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
2549 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
de22b698 | 2550 | \r |
2551 | @param Address MMIO register to write.\r | |
2552 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2553 | Range 0..63.\r | |
2554 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2555 | Range 0..63.\r | |
2556 | @param AndData The value to AND with read value from the MMIO register.\r | |
2557 | @param OrData The value to OR with the result of the AND operation.\r | |
2558 | \r | |
2559 | @return The value written back to the MMIO register.\r | |
2560 | \r | |
2561 | **/\r | |
2562 | UINT64\r | |
2563 | EFIAPI\r | |
2564 | MmioBitFieldAndThenOr64 (\r | |
2565 | IN UINTN Address,\r | |
2566 | IN UINTN StartBit,\r | |
2567 | IN UINTN EndBit,\r | |
2568 | IN UINT64 AndData,\r | |
2569 | IN UINT64 OrData\r | |
2570 | );\r | |
2571 | \r | |
2572 | /**\r | |
2573 | Copy data from MMIO region to system memory by using 8-bit access.\r | |
2574 | \r | |
9095d37b LG |
2575 | Copy data from MMIO region specified by starting address StartAddress\r |
2576 | to system memory specified by Buffer by using 8-bit access. The total\r | |
de22b698 | 2577 | number of byte to be copied is specified by Length. Buffer is returned.\r |
9095d37b LG |
2578 | \r |
2579 | If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r | |
de22b698 | 2580 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r |
2581 | \r | |
2582 | \r | |
2583 | @param StartAddress Starting address for the MMIO region to be copied from.\r | |
5ac79a78 | 2584 | @param Length The size, in bytes, of Buffer.\r |
de22b698 | 2585 | @param Buffer Pointer to a system memory buffer receiving the data read.\r |
2586 | \r | |
2587 | @return Buffer\r | |
2588 | \r | |
2589 | **/\r | |
2590 | UINT8 *\r | |
2591 | EFIAPI\r | |
2592 | MmioReadBuffer8 (\r | |
2593 | IN UINTN StartAddress,\r | |
2594 | IN UINTN Length,\r | |
2595 | OUT UINT8 *Buffer\r | |
2596 | );\r | |
2597 | \r | |
2598 | /**\r | |
2599 | Copy data from MMIO region to system memory by using 16-bit access.\r | |
2600 | \r | |
9095d37b LG |
2601 | Copy data from MMIO region specified by starting address StartAddress\r |
2602 | to system memory specified by Buffer by using 16-bit access. The total\r | |
de22b698 | 2603 | number of byte to be copied is specified by Length. Buffer is returned.\r |
9095d37b | 2604 | \r |
de22b698 | 2605 | If StartAddress is not aligned on a 16-bit boundary, then ASSERT().\r |
2606 | \r | |
9095d37b | 2607 | If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r |
de22b698 | 2608 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r |
2609 | \r | |
2610 | If Length is not aligned on a 16-bit boundary, then ASSERT().\r | |
2611 | If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
2612 | \r | |
2613 | @param StartAddress Starting address for the MMIO region to be copied from.\r | |
5ac79a78 | 2614 | @param Length The size, in bytes, of Buffer.\r |
de22b698 | 2615 | @param Buffer Pointer to a system memory buffer receiving the data read.\r |
2616 | \r | |
2617 | @return Buffer\r | |
2618 | \r | |
2619 | **/\r | |
2620 | UINT16 *\r | |
2621 | EFIAPI\r | |
2622 | MmioReadBuffer16 (\r | |
2623 | IN UINTN StartAddress,\r | |
2624 | IN UINTN Length,\r | |
2625 | OUT UINT16 *Buffer\r | |
2626 | );\r | |
2627 | \r | |
2628 | /**\r | |
2629 | Copy data from MMIO region to system memory by using 32-bit access.\r | |
2630 | \r | |
9095d37b LG |
2631 | Copy data from MMIO region specified by starting address StartAddress\r |
2632 | to system memory specified by Buffer by using 32-bit access. The total\r | |
de22b698 | 2633 | number of byte to be copied is specified by Length. Buffer is returned.\r |
9095d37b | 2634 | \r |
de22b698 | 2635 | If StartAddress is not aligned on a 32-bit boundary, then ASSERT().\r |
2636 | \r | |
9095d37b | 2637 | If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r |
de22b698 | 2638 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r |
2639 | \r | |
2640 | If Length is not aligned on a 32-bit boundary, then ASSERT().\r | |
2641 | If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r | |
2642 | \r | |
2643 | @param StartAddress Starting address for the MMIO region to be copied from.\r | |
5ac79a78 | 2644 | @param Length The size, in bytes, of Buffer.\r |
de22b698 | 2645 | @param Buffer Pointer to a system memory buffer receiving the data read.\r |
2646 | \r | |
2647 | @return Buffer\r | |
2648 | \r | |
2649 | **/\r | |
2650 | UINT32 *\r | |
2651 | EFIAPI\r | |
2652 | MmioReadBuffer32 (\r | |
2653 | IN UINTN StartAddress,\r | |
2654 | IN UINTN Length,\r | |
2655 | OUT UINT32 *Buffer\r | |
2656 | );\r | |
2657 | \r | |
2658 | /**\r | |
2659 | Copy data from MMIO region to system memory by using 64-bit access.\r | |
2660 | \r | |
9095d37b LG |
2661 | Copy data from MMIO region specified by starting address StartAddress\r |
2662 | to system memory specified by Buffer by using 64-bit access. The total\r | |
de22b698 | 2663 | number of byte to be copied is specified by Length. Buffer is returned.\r |
9095d37b | 2664 | \r |
de22b698 | 2665 | If StartAddress is not aligned on a 64-bit boundary, then ASSERT().\r |
2666 | \r | |
9095d37b | 2667 | If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r |
de22b698 | 2668 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r |
2669 | \r | |
2670 | If Length is not aligned on a 64-bit boundary, then ASSERT().\r | |
2671 | If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r | |
2672 | \r | |
2673 | @param StartAddress Starting address for the MMIO region to be copied from.\r | |
5ac79a78 | 2674 | @param Length The size, in bytes, of Buffer.\r |
de22b698 | 2675 | @param Buffer Pointer to a system memory buffer receiving the data read.\r |
2676 | \r | |
2677 | @return Buffer\r | |
2678 | \r | |
2679 | **/\r | |
2680 | UINT64 *\r | |
2681 | EFIAPI\r | |
2682 | MmioReadBuffer64 (\r | |
2683 | IN UINTN StartAddress,\r | |
2684 | IN UINTN Length,\r | |
2685 | OUT UINT64 *Buffer\r | |
2686 | );\r | |
2687 | \r | |
2688 | /**\r | |
2689 | Copy data from system memory to MMIO region by using 8-bit access.\r | |
2690 | \r | |
9095d37b LG |
2691 | Copy data from system memory specified by Buffer to MMIO region specified\r |
2692 | by starting address StartAddress by using 8-bit access. The total number\r | |
de22b698 | 2693 | of byte to be copied is specified by Length. Buffer is returned.\r |
9095d37b LG |
2694 | \r |
2695 | If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r | |
de22b698 | 2696 | If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().\r |
2697 | \r | |
2698 | \r | |
2699 | @param StartAddress Starting address for the MMIO region to be copied to.\r | |
5ac79a78 | 2700 | @param Length The size, in bytes, of Buffer.\r |
de22b698 | 2701 | @param Buffer Pointer to a system memory buffer containing the data to write.\r |
2702 | \r | |
3222ffc0 | 2703 | @return Buffer\r |
de22b698 | 2704 | \r |
2705 | **/\r | |
2706 | UINT8 *\r | |
2707 | EFIAPI\r | |
2708 | MmioWriteBuffer8 (\r | |
2709 | IN UINTN StartAddress,\r | |
2710 | IN UINTN Length,\r | |
2711 | IN CONST UINT8 *Buffer\r | |
2712 | );\r | |
2713 | \r | |
2714 | /**\r | |
2715 | Copy data from system memory to MMIO region by using 16-bit access.\r | |
2716 | \r | |
9095d37b LG |
2717 | Copy data from system memory specified by Buffer to MMIO region specified\r |
2718 | by starting address StartAddress by using 16-bit access. The total number\r | |
3222ffc0 | 2719 | of byte to be copied is specified by Length. Buffer is returned.\r |
9095d37b | 2720 | \r |
de22b698 | 2721 | If StartAddress is not aligned on a 16-bit boundary, then ASSERT().\r |
2722 | \r | |
9095d37b | 2723 | If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r |
de22b698 | 2724 | If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().\r |
2725 | \r | |
2726 | If Length is not aligned on a 16-bit boundary, then ASSERT().\r | |
2727 | \r | |
2728 | If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
2729 | \r | |
2730 | @param StartAddress Starting address for the MMIO region to be copied to.\r | |
5ac79a78 | 2731 | @param Length The size, in bytes, of Buffer.\r |
de22b698 | 2732 | @param Buffer Pointer to a system memory buffer containing the data to write.\r |
2733 | \r | |
3222ffc0 | 2734 | @return Buffer\r |
de22b698 | 2735 | \r |
2736 | **/\r | |
2737 | UINT16 *\r | |
2738 | EFIAPI\r | |
2739 | MmioWriteBuffer16 (\r | |
2740 | IN UINTN StartAddress,\r | |
2741 | IN UINTN Length,\r | |
2742 | IN CONST UINT16 *Buffer\r | |
2743 | );\r | |
2744 | \r | |
2745 | /**\r | |
2746 | Copy data from system memory to MMIO region by using 32-bit access.\r | |
2747 | \r | |
9095d37b LG |
2748 | Copy data from system memory specified by Buffer to MMIO region specified\r |
2749 | by starting address StartAddress by using 32-bit access. The total number\r | |
3222ffc0 | 2750 | of byte to be copied is specified by Length. Buffer is returned.\r |
9095d37b | 2751 | \r |
de22b698 | 2752 | If StartAddress is not aligned on a 32-bit boundary, then ASSERT().\r |
2753 | \r | |
9095d37b | 2754 | If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r |
de22b698 | 2755 | If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().\r |
2756 | \r | |
2757 | If Length is not aligned on a 32-bit boundary, then ASSERT().\r | |
2758 | \r | |
2759 | If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r | |
2760 | \r | |
2761 | @param StartAddress Starting address for the MMIO region to be copied to.\r | |
5ac79a78 | 2762 | @param Length The size, in bytes, of Buffer.\r |
de22b698 | 2763 | @param Buffer Pointer to a system memory buffer containing the data to write.\r |
2764 | \r | |
3222ffc0 | 2765 | @return Buffer\r |
de22b698 | 2766 | \r |
2767 | **/\r | |
2768 | UINT32 *\r | |
2769 | EFIAPI\r | |
2770 | MmioWriteBuffer32 (\r | |
2771 | IN UINTN StartAddress,\r | |
2772 | IN UINTN Length,\r | |
2773 | IN CONST UINT32 *Buffer\r | |
2774 | );\r | |
2775 | \r | |
2776 | /**\r | |
2777 | Copy data from system memory to MMIO region by using 64-bit access.\r | |
2778 | \r | |
9095d37b LG |
2779 | Copy data from system memory specified by Buffer to MMIO region specified\r |
2780 | by starting address StartAddress by using 64-bit access. The total number\r | |
3222ffc0 | 2781 | of byte to be copied is specified by Length. Buffer is returned.\r |
9095d37b | 2782 | \r |
de22b698 | 2783 | If StartAddress is not aligned on a 64-bit boundary, then ASSERT().\r |
2784 | \r | |
9095d37b | 2785 | If Length is greater than (MAX_ADDRESS - StartAddress + 1), then ASSERT().\r |
de22b698 | 2786 | If Length is greater than (MAX_ADDRESS -Buffer + 1), then ASSERT().\r |
2787 | \r | |
2788 | If Length is not aligned on a 64-bit boundary, then ASSERT().\r | |
2789 | \r | |
2790 | If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r | |
2791 | \r | |
2792 | @param StartAddress Starting address for the MMIO region to be copied to.\r | |
5ac79a78 | 2793 | @param Length The size, in bytes, of Buffer.\r |
de22b698 | 2794 | @param Buffer Pointer to a system memory buffer containing the data to write.\r |
2795 | \r | |
3222ffc0 | 2796 | @return Buffer\r |
de22b698 | 2797 | \r |
2798 | **/\r | |
2799 | UINT64 *\r | |
2800 | EFIAPI\r | |
2801 | MmioWriteBuffer64 (\r | |
2802 | IN UINTN StartAddress,\r | |
2803 | IN UINTN Length,\r | |
2804 | IN CONST UINT64 *Buffer\r | |
2805 | );\r | |
2806 | \r | |
2807 | \r | |
2808 | #endif\r | |
2809 | \r |