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