]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c
2 High-level Io/Mmio functions.
4 All assertions for bit field operations are handled bit field functions in the
7 Copyright (c) 2006, Intel Corporation<BR>
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 The following IoLib instances share the same version of this file:
25 // Include common header file for this module.
27 #include "BaseIoLibIntrinsicInternal.h"
30 Reads an 8-bit I/O port, performs a bitwise inclusive OR, and writes the
31 result back to the 8-bit I/O port.
33 Reads the 8-bit I/O port specified by Port, performs a bitwise inclusive OR
34 between the read result and the value specified by OrData, and writes the
35 result to the 8-bit I/O port specified by Port. The value written to the I/O
36 port is returned. This function must guarantee that all I/O read and write
37 operations are serialized.
39 If 8-bit I/O port operations are not supported, then ASSERT().
41 @param Port The I/O port to write.
42 @param OrData The value to OR with the read value from the I/O port.
44 @return The value written back to the I/O port.
54 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) | OrData
));
58 Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
59 to the 8-bit I/O port.
61 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
62 the read result and the value specified by AndData, and writes the result to
63 the 8-bit I/O port specified by Port. The value written to the I/O port is
64 returned. This function must guarantee that all I/O read and write operations
67 If 8-bit I/O port operations are not supported, then ASSERT().
69 @param Port The I/O port to write.
70 @param AndData The value to AND with the read value from the I/O port.
72 @return The value written back to the I/O port.
82 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) & AndData
));
86 Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
87 inclusive OR, and writes the result back to the 8-bit I/O port.
89 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
90 the read result and the value specified by AndData, performs a bitwise OR
91 between the result of the AND operation and the value specified by OrData,
92 and writes the result to the 8-bit I/O port specified by Port. The value
93 written to the I/O port is returned. This function must guarantee that all
94 I/O read and write operations are serialized.
96 If 8-bit I/O port operations are not supported, then ASSERT().
98 @param Port The I/O port to write.
99 @param AndData The value to AND with the read value from the I/O port.
100 @param OrData The value to OR with the result of the AND operation.
102 @return The value written back to the I/O port.
113 return IoWrite8 (Port
, (UINT8
) ((IoRead8 (Port
) & AndData
) | OrData
));
117 Reads a bit field of an I/O register.
119 Reads the bit field in an 8-bit I/O register. The bit field is specified by
120 the StartBit and the EndBit. The value of the bit field is returned.
122 If 8-bit I/O port operations are not supported, then ASSERT().
123 If StartBit is greater than 7, then ASSERT().
124 If EndBit is greater than 7, then ASSERT().
125 If EndBit is less than StartBit, then ASSERT().
127 @param Port The I/O port to read.
128 @param StartBit The ordinal of the least significant bit in the bit field.
130 @param EndBit The ordinal of the most significant bit in the bit field.
133 @return The value read from I/O port specified by StartBit and
145 return BitFieldRead8 (IoRead8 (Port
), StartBit
, EndBit
);
149 Writes a bit field to an I/O register.
151 Writes Value to the bit field of the I/O register. The bit field is specified
152 by the StartBit and the EndBit. All other bits in the destination I/O
153 register are preserved. The value written to the I/O port is returned. Extra
154 left bits in Value are stripped.
156 If 8-bit I/O port operations are not supported, then ASSERT().
157 If StartBit is greater than 7, then ASSERT().
158 If EndBit is greater than 7, then ASSERT().
159 If EndBit is less than StartBit, then ASSERT().
161 @param Port The I/O port to write.
162 @param StartBit The ordinal of the least significant bit in the bit field.
164 @param EndBit The ordinal of the most significant bit in the bit field.
166 @param Value New value of the bit field.
168 @return The value written back to the I/O port.
182 BitFieldWrite8 (IoRead8 (Port
), StartBit
, EndBit
, Value
)
187 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
188 result back to the bit field in the 8-bit port.
190 Reads the 8-bit I/O port specified by Port, performs a bitwise inclusive OR
191 between the read result and the value specified by OrData, and writes the
192 result to the 8-bit I/O port specified by Port. The value written to the I/O
193 port is returned. This function must guarantee that all I/O read and write
194 operations are serialized. Extra left bits in OrData are stripped.
196 If 8-bit I/O port operations are not supported, then ASSERT().
197 If StartBit is greater than 7, then ASSERT().
198 If EndBit is greater than 7, then ASSERT().
199 If EndBit is less than StartBit, then ASSERT().
201 @param Port The I/O port to write.
202 @param StartBit The ordinal of the least significant bit in the bit field.
204 @param EndBit The ordinal of the most significant bit in the bit field.
206 @param OrData The value to OR with the read value from the I/O port.
208 @return The value written back to the I/O port.
222 BitFieldOr8 (IoRead8 (Port
), StartBit
, EndBit
, OrData
)
227 Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
228 result back to the bit field in the 8-bit port.
230 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
231 the read result and the value specified by AndData, and writes the result to
232 the 8-bit I/O port specified by Port. The value written to the I/O port is
233 returned. This function must guarantee that all I/O read and write operations
234 are serialized. Extra left bits in AndData are stripped.
236 If 8-bit I/O port operations are not supported, then ASSERT().
237 If StartBit is greater than 7, then ASSERT().
238 If EndBit is greater than 7, then ASSERT().
239 If EndBit is less than StartBit, then ASSERT().
241 @param Port The I/O port to write.
242 @param StartBit The ordinal of the least significant bit in the bit field.
244 @param EndBit The ordinal of the most significant bit in the bit field.
246 @param AndData The value to AND with the read value from the I/O port.
248 @return The value written back to the I/O port.
262 BitFieldAnd8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
)
267 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
268 bitwise inclusive OR, and writes the result back to the bit field in the
271 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
272 by a bitwise inclusive OR between the read result and the value specified by
273 AndData, and writes the result to the 8-bit I/O port specified by Port. The
274 value written to the I/O port is returned. This function must guarantee that
275 all I/O read and write operations are serialized. Extra left bits in both
276 AndData and OrData are stripped.
278 If 8-bit I/O port operations are not supported, then ASSERT().
279 If StartBit is greater than 7, then ASSERT().
280 If EndBit is greater than 7, then ASSERT().
281 If EndBit is less than StartBit, then ASSERT().
283 @param Port The I/O port to write.
284 @param StartBit The ordinal of the least significant bit in the bit field.
286 @param EndBit The ordinal of the most significant bit in the bit field.
288 @param AndData The value to AND with the read value from the I/O port.
289 @param OrData The value to OR with the result of the AND operation.
291 @return The value written back to the I/O port.
296 IoBitFieldAndThenOr8 (
306 BitFieldAndThenOr8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
, OrData
)
311 Reads a 16-bit I/O port, performs a bitwise inclusive OR, and writes the
312 result back to the 16-bit I/O port.
314 Reads the 16-bit I/O port specified by Port, performs a bitwise inclusive OR
315 between the read result and the value specified by OrData, and writes the
316 result to the 16-bit I/O port specified by Port. The value written to the I/O
317 port is returned. This function must guarantee that all I/O read and write
318 operations are serialized.
320 If 16-bit I/O port operations are not supported, then ASSERT().
322 @param Port The I/O port to write.
323 @param OrData The value to OR with the read value from the I/O port.
325 @return The value written back to the I/O port.
335 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) | OrData
));
339 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
340 to the 16-bit I/O port.
342 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
343 the read result and the value specified by AndData, and writes the result to
344 the 16-bit I/O port specified by Port. The value written to the I/O port is
345 returned. This function must guarantee that all I/O read and write operations
348 If 16-bit I/O port operations are not supported, then ASSERT().
350 @param Port The I/O port to write.
351 @param AndData The value to AND with the read value from the I/O port.
353 @return The value written back to the I/O port.
363 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) & AndData
));
367 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
368 inclusive OR, and writes the result back to the 16-bit I/O port.
370 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
371 the read result and the value specified by AndData, performs a bitwise OR
372 between the result of the AND operation and the value specified by OrData,
373 and writes the result to the 16-bit I/O port specified by Port. The value
374 written to the I/O port is returned. This function must guarantee that all
375 I/O read and write operations are serialized.
377 If 16-bit I/O port operations are not supported, then ASSERT().
379 @param Port The I/O port to write.
380 @param AndData The value to AND with the read value from the I/O port.
381 @param OrData The value to OR with the result of the AND operation.
383 @return The value written back to the I/O port.
394 return IoWrite16 (Port
, (UINT16
) ((IoRead16 (Port
) & AndData
) | OrData
));
398 Reads a bit field of an I/O register.
400 Reads the bit field in a 16-bit I/O register. The bit field is specified by
401 the StartBit and the EndBit. The value of the bit field is returned.
403 If 16-bit I/O port operations are not supported, then ASSERT().
404 If StartBit is greater than 15, then ASSERT().
405 If EndBit is greater than 15, then ASSERT().
406 If EndBit is less than StartBit, then ASSERT().
408 @param Port The I/O port to read.
409 @param StartBit The ordinal of the least significant bit in the bit field.
411 @param EndBit The ordinal of the most significant bit in the bit field.
414 @return The value read from I/O port specified by StartBit and
426 return BitFieldRead16 (IoRead16 (Port
), StartBit
, EndBit
);
430 Writes a bit field to an I/O register.
432 Writes Value to the bit field of the I/O register. The bit field is specified
433 by the StartBit and the EndBit. All other bits in the destination I/O
434 register are preserved. The value written to the I/O port is returned. Extra
435 left bits in Value are stripped.
437 If 16-bit I/O port operations are not supported, then ASSERT().
438 If StartBit is greater than 15, then ASSERT().
439 If EndBit is greater than 15, then ASSERT().
440 If EndBit is less than StartBit, then ASSERT().
442 @param Port The I/O port to write.
443 @param StartBit The ordinal of the least significant bit in the bit field.
445 @param EndBit The ordinal of the most significant bit in the bit field.
447 @param Value New value of the bit field.
449 @return The value written back to the I/O port.
463 BitFieldWrite16 (IoRead16 (Port
), StartBit
, EndBit
, Value
)
468 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
469 result back to the bit field in the 16-bit port.
471 Reads the 16-bit I/O port specified by Port, performs a bitwise inclusive OR
472 between the read result and the value specified by OrData, and writes the
473 result to the 16-bit I/O port specified by Port. The value written to the I/O
474 port is returned. This function must guarantee that all I/O read and write
475 operations are serialized. Extra left bits in OrData are stripped.
477 If 16-bit I/O port operations are not supported, then ASSERT().
478 If StartBit is greater than 15, then ASSERT().
479 If EndBit is greater than 15, then ASSERT().
480 If EndBit is less than StartBit, then ASSERT().
482 @param Port The I/O port to write.
483 @param StartBit The ordinal of the least significant bit in the bit field.
485 @param EndBit The ordinal of the most significant bit in the bit field.
487 @param OrData The value to OR with the read value from the I/O port.
489 @return The value written back to the I/O port.
503 BitFieldOr16 (IoRead16 (Port
), StartBit
, EndBit
, OrData
)
508 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
509 result back to the bit field in the 16-bit port.
511 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
512 the read result and the value specified by AndData, and writes the result to
513 the 16-bit I/O port specified by Port. The value written to the I/O port is
514 returned. This function must guarantee that all I/O read and write operations
515 are serialized. Extra left bits in AndData are stripped.
517 If 16-bit I/O port operations are not supported, then ASSERT().
518 If StartBit is greater than 15, then ASSERT().
519 If EndBit is greater than 15, then ASSERT().
520 If EndBit is less than StartBit, then ASSERT().
522 @param Port The I/O port to write.
523 @param StartBit The ordinal of the least significant bit in the bit field.
525 @param EndBit The ordinal of the most significant bit in the bit field.
527 @param AndData The value to AND with the read value from the I/O port.
529 @return The value written back to the I/O port.
543 BitFieldAnd16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
)
548 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
549 bitwise inclusive OR, and writes the result back to the bit field in the
552 Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
553 by a bitwise inclusive OR between the read result and the value specified by
554 AndData, and writes the result to the 16-bit I/O port specified by Port. The
555 value written to the I/O port is returned. This function must guarantee that
556 all I/O read and write operations are serialized. Extra left bits in both
557 AndData and OrData are stripped.
559 If 16-bit I/O port operations are not supported, then ASSERT().
560 If StartBit is greater than 15, then ASSERT().
561 If EndBit is greater than 15, then ASSERT().
562 If EndBit is less than StartBit, then ASSERT().
564 @param Port The I/O port to write.
565 @param StartBit The ordinal of the least significant bit in the bit field.
567 @param EndBit The ordinal of the most significant bit in the bit field.
569 @param AndData The value to AND with the read value from the I/O port.
570 @param OrData The value to OR with the result of the AND operation.
572 @return The value written back to the I/O port.
577 IoBitFieldAndThenOr16 (
587 BitFieldAndThenOr16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
, OrData
)
592 Reads a 32-bit I/O port, performs a bitwise inclusive OR, and writes the
593 result back to the 32-bit I/O port.
595 Reads the 32-bit I/O port specified by Port, performs a bitwise inclusive OR
596 between the read result and the value specified by OrData, and writes the
597 result to the 32-bit I/O port specified by Port. The value written to the I/O
598 port is returned. This function must guarantee that all I/O read and write
599 operations are serialized.
601 If 32-bit I/O port operations are not supported, then ASSERT().
603 @param Port The I/O port to write.
604 @param OrData The value to OR with the read value from the I/O port.
606 @return The value written back to the I/O port.
616 return IoWrite32 (Port
, IoRead32 (Port
) | OrData
);
620 Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
621 to the 32-bit I/O port.
623 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
624 the read result and the value specified by AndData, and writes the result to
625 the 32-bit I/O port specified by Port. The value written to the I/O port is
626 returned. This function must guarantee that all I/O read and write operations
629 If 32-bit I/O port operations are not supported, then ASSERT().
631 @param Port The I/O port to write.
632 @param AndData The value to AND with the read value from the I/O port.
634 @return The value written back to the I/O port.
644 return IoWrite32 (Port
, IoRead32 (Port
) & AndData
);
648 Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
649 inclusive OR, and writes the result back to the 32-bit I/O port.
651 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
652 the read result and the value specified by AndData, performs a bitwise OR
653 between the result of the AND operation and the value specified by OrData,
654 and writes the result to the 32-bit I/O port specified by Port. The value
655 written to the I/O port is returned. This function must guarantee that all
656 I/O read and write operations are serialized.
658 If 32-bit I/O port operations are not supported, then ASSERT().
660 @param Port The I/O port to write.
661 @param AndData The value to AND with the read value from the I/O port.
662 @param OrData The value to OR with the result of the AND operation.
664 @return The value written back to the I/O port.
675 return IoWrite32 (Port
, (IoRead32 (Port
) & AndData
) | OrData
);
679 Reads a bit field of an I/O register.
681 Reads the bit field in a 32-bit I/O register. The bit field is specified by
682 the StartBit and the EndBit. The value of the bit field is returned.
684 If 32-bit I/O port operations are not supported, then ASSERT().
685 If StartBit is greater than 31, then ASSERT().
686 If EndBit is greater than 31, then ASSERT().
687 If EndBit is less than StartBit, then ASSERT().
689 @param Port The I/O port to read.
690 @param StartBit The ordinal of the least significant bit in the bit field.
692 @param EndBit The ordinal of the most significant bit in the bit field.
695 @return The value read from I/O port specified by StartBit and
707 return BitFieldRead32 (IoRead32 (Port
), StartBit
, EndBit
);
711 Writes a bit field to an I/O register.
713 Writes Value to the bit field of the I/O register. The bit field is specified
714 by the StartBit and the EndBit. All other bits in the destination I/O
715 register are preserved. The value written to the I/O port is returned. Extra
716 left bits in Value are stripped.
718 If 32-bit I/O port operations are not supported, then ASSERT().
719 If StartBit is greater than 31, then ASSERT().
720 If EndBit is greater than 31, then ASSERT().
721 If EndBit is less than StartBit, then ASSERT().
723 @param Port The I/O port to write.
724 @param StartBit The ordinal of the least significant bit in the bit field.
726 @param EndBit The ordinal of the most significant bit in the bit field.
728 @param Value New value of the bit field.
730 @return The value written back to the I/O port.
744 BitFieldWrite32 (IoRead32 (Port
), StartBit
, EndBit
, Value
)
749 Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the
750 result back to the bit field in the 32-bit port.
752 Reads the 32-bit I/O port specified by Port, performs a bitwise inclusive OR
753 between the read result and the value specified by OrData, and writes the
754 result to the 32-bit I/O port specified by Port. The value written to the I/O
755 port is returned. This function must guarantee that all I/O read and write
756 operations are serialized. Extra left bits in OrData are stripped.
758 If 32-bit I/O port operations are not supported, then ASSERT().
759 If StartBit is greater than 31, then ASSERT().
760 If EndBit is greater than 31, then ASSERT().
761 If EndBit is less than StartBit, then ASSERT().
763 @param Port The I/O port to write.
764 @param StartBit The ordinal of the least significant bit in the bit field.
766 @param EndBit The ordinal of the most significant bit in the bit field.
768 @param OrData The value to OR with the read value from the I/O port.
770 @return The value written back to the I/O port.
784 BitFieldOr32 (IoRead32 (Port
), StartBit
, EndBit
, OrData
)
789 Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
790 result back to the bit field in the 32-bit port.
792 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
793 the read result and the value specified by AndData, and writes the result to
794 the 32-bit I/O port specified by Port. The value written to the I/O port is
795 returned. This function must guarantee that all I/O read and write operations
796 are serialized. Extra left bits in AndData are stripped.
798 If 32-bit I/O port operations are not supported, then ASSERT().
799 If StartBit is greater than 31, then ASSERT().
800 If EndBit is greater than 31, then ASSERT().
801 If EndBit is less than StartBit, then ASSERT().
803 @param Port The I/O port to write.
804 @param StartBit The ordinal of the least significant bit in the bit field.
806 @param EndBit The ordinal of the most significant bit in the bit field.
808 @param AndData The value to AND with the read value from the I/O port.
810 @return The value written back to the I/O port.
824 BitFieldAnd32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
)
829 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
830 bitwise inclusive OR, and writes the result back to the bit field in the
833 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
834 by a bitwise inclusive OR between the read result and the value specified by
835 AndData, and writes the result to the 32-bit I/O port specified by Port. The
836 value written to the I/O port is returned. This function must guarantee that
837 all I/O read and write operations are serialized. Extra left bits in both
838 AndData and OrData are stripped.
840 If 32-bit I/O port operations are not supported, then ASSERT().
841 If StartBit is greater than 31, then ASSERT().
842 If EndBit is greater than 31, then ASSERT().
843 If EndBit is less than StartBit, then ASSERT().
845 @param Port The I/O port to write.
846 @param StartBit The ordinal of the least significant bit in the bit field.
848 @param EndBit The ordinal of the most significant bit in the bit field.
850 @param AndData The value to AND with the read value from the I/O port.
851 @param OrData The value to OR with the result of the AND operation.
853 @return The value written back to the I/O port.
858 IoBitFieldAndThenOr32 (
868 BitFieldAndThenOr32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
, OrData
)
873 Reads a 64-bit I/O port, performs a bitwise inclusive OR, and writes the
874 result back to the 64-bit I/O port.
876 Reads the 64-bit I/O port specified by Port, performs a bitwise inclusive OR
877 between the read result and the value specified by OrData, and writes the
878 result to the 64-bit I/O port specified by Port. The value written to the I/O
879 port is returned. This function must guarantee that all I/O read and write
880 operations are serialized.
882 If 64-bit I/O port operations are not supported, then ASSERT().
884 @param Port The I/O port to write.
885 @param OrData The value to OR with the read value from the I/O port.
887 @return The value written back to the I/O port.
897 return IoWrite64 (Port
, IoRead64 (Port
) | OrData
);
901 Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
902 to the 64-bit I/O port.
904 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
905 the read result and the value specified by AndData, and writes the result to
906 the 64-bit I/O port specified by Port. The value written to the I/O port is
907 returned. This function must guarantee that all I/O read and write operations
910 If 64-bit I/O port operations are not supported, then ASSERT().
912 @param Port The I/O port to write.
913 @param AndData The value to AND with the read value from the I/O port.
915 @return The value written back to the I/O port.
925 return IoWrite64 (Port
, IoRead64 (Port
) & AndData
);
929 Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
930 inclusive OR, and writes the result back to the 64-bit I/O port.
932 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
933 the read result and the value specified by AndData, performs a bitwise OR
934 between the result of the AND operation and the value specified by OrData,
935 and writes the result to the 64-bit I/O port specified by Port. The value
936 written to the I/O port is returned. This function must guarantee that all
937 I/O read and write operations are serialized.
939 If 64-bit I/O port operations are not supported, then ASSERT().
941 @param Port The I/O port to write.
942 @param AndData The value to AND with the read value from the I/O port.
943 @param OrData The value to OR with the result of the AND operation.
945 @return The value written back to the I/O port.
956 return IoWrite64 (Port
, (IoRead64 (Port
) & AndData
) | OrData
);
960 Reads a bit field of an I/O register.
962 Reads the bit field in a 64-bit I/O register. The bit field is specified by
963 the StartBit and the EndBit. The value of the bit field is returned.
965 If 64-bit I/O port operations are not supported, then ASSERT().
966 If StartBit is greater than 63, then ASSERT().
967 If EndBit is greater than 63, then ASSERT().
968 If EndBit is less than StartBit, then ASSERT().
970 @param Port The I/O port to read.
971 @param StartBit The ordinal of the least significant bit in the bit field.
973 @param EndBit The ordinal of the most significant bit in the bit field.
976 @return The value read from I/O port specified by StartBit and
988 return BitFieldRead64 (IoRead64 (Port
), StartBit
, EndBit
);
992 Writes a bit field to an I/O register.
994 Writes Value to the bit field of the I/O register. The bit field is specified
995 by the StartBit and the EndBit. All other bits in the destination I/O
996 register are preserved. The value written to the I/O port is returned. Extra
997 left bits in Value are stripped.
999 If 64-bit I/O port operations are not supported, then ASSERT().
1000 If StartBit is greater than 63, then ASSERT().
1001 If EndBit is greater than 63, then ASSERT().
1002 If EndBit is less than StartBit, then ASSERT().
1004 @param Port The I/O port to write.
1005 @param StartBit The ordinal of the least significant bit in the bit field.
1007 @param EndBit The ordinal of the most significant bit in the bit field.
1009 @param Value New value of the bit field.
1011 @return The value written back to the I/O port.
1025 BitFieldWrite64 (IoRead64 (Port
), StartBit
, EndBit
, Value
)
1030 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1031 result back to the bit field in the 64-bit port.
1033 Reads the 64-bit I/O port specified by Port, performs a bitwise inclusive OR
1034 between the read result and the value specified by OrData, and writes the
1035 result to the 64-bit I/O port specified by Port. The value written to the I/O
1036 port is returned. This function must guarantee that all I/O read and write
1037 operations are serialized. Extra left bits in OrData are stripped.
1039 If 64-bit I/O port operations are not supported, then ASSERT().
1040 If StartBit is greater than 63, then ASSERT().
1041 If EndBit is greater than 63, then ASSERT().
1042 If EndBit is less than StartBit, then ASSERT().
1044 @param Port The I/O port to write.
1045 @param StartBit The ordinal of the least significant bit in the bit field.
1047 @param EndBit The ordinal of the most significant bit in the bit field.
1049 @param OrData The value to OR with the read value from the I/O port.
1051 @return The value written back to the I/O port.
1065 BitFieldOr64 (IoRead64 (Port
), StartBit
, EndBit
, OrData
)
1070 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1071 result back to the bit field in the 64-bit port.
1073 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1074 the read result and the value specified by AndData, and writes the result to
1075 the 64-bit I/O port specified by Port. The value written to the I/O port is
1076 returned. This function must guarantee that all I/O read and write operations
1077 are serialized. Extra left bits in AndData are stripped.
1079 If 64-bit I/O port operations are not supported, then ASSERT().
1080 If StartBit is greater than 63, then ASSERT().
1081 If EndBit is greater than 63, then ASSERT().
1082 If EndBit is less than StartBit, then ASSERT().
1084 @param Port The I/O port to write.
1085 @param StartBit The ordinal of the least significant bit in the bit field.
1087 @param EndBit The ordinal of the most significant bit in the bit field.
1089 @param AndData The value to AND with the read value from the I/O port.
1091 @return The value written back to the I/O port.
1105 BitFieldAnd64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
)
1110 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
1111 bitwise inclusive OR, and writes the result back to the bit field in the
1114 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
1115 by a bitwise inclusive OR between the read result and the value specified by
1116 AndData, and writes the result to the 64-bit I/O port specified by Port. The
1117 value written to the I/O port is returned. This function must guarantee that
1118 all I/O read and write operations are serialized. Extra left bits in both
1119 AndData and OrData are stripped.
1121 If 64-bit I/O port operations are not supported, then ASSERT().
1122 If StartBit is greater than 63, then ASSERT().
1123 If EndBit is greater than 63, then ASSERT().
1124 If EndBit is less than StartBit, then ASSERT().
1126 @param Port The I/O port to write.
1127 @param StartBit The ordinal of the least significant bit in the bit field.
1129 @param EndBit The ordinal of the most significant bit in the bit field.
1131 @param AndData The value to AND with the read value from the I/O port.
1132 @param OrData The value to OR with the result of the AND operation.
1134 @return The value written back to the I/O port.
1139 IoBitFieldAndThenOr64 (
1149 BitFieldAndThenOr64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
, OrData
)
1154 Reads an 8-bit MMIO register, performs a bitwise inclusive OR, and writes the
1155 result back to the 8-bit MMIO register.
1157 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1158 inclusive OR between the read result and the value specified by OrData, and
1159 writes the result to the 8-bit MMIO register specified by Address. The value
1160 written to the MMIO register is returned. This function must guarantee that
1161 all MMIO read and write operations are serialized.
1163 If 8-bit MMIO register operations are not supported, then ASSERT().
1165 @param Address The MMIO register to write.
1166 @param OrData The value to OR with the read value from the MMIO register.
1168 @return The value written back to the MMIO register.
1178 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) | OrData
));
1182 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1183 back to the 8-bit MMIO register.
1185 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1186 between the read result and the value specified by AndData, and writes the
1187 result to the 8-bit MMIO register specified by Address. The value written to
1188 the MMIO register is returned. This function must guarantee that all MMIO
1189 read and write operations are serialized.
1191 If 8-bit MMIO register operations are not supported, then ASSERT().
1193 @param Address The MMIO register to write.
1194 @param AndData The value to AND with the read value from the MMIO register.
1196 @return The value written back to the MMIO register.
1206 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) & AndData
));
1210 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1211 inclusive OR, and writes the result back to the 8-bit MMIO register.
1213 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1214 between the read result and the value specified by AndData, performs a
1215 bitwise OR between the result of the AND operation and the value specified by
1216 OrData, and writes the result to the 8-bit MMIO register specified by
1217 Address. The value written to the MMIO register is returned. This function
1218 must guarantee that all MMIO read and write operations are serialized.
1220 If 8-bit MMIO register operations are not supported, then ASSERT().
1223 @param Address The MMIO register to write.
1224 @param AndData The value to AND with the read value from the MMIO register.
1225 @param OrData The value to OR with the result of the AND operation.
1227 @return The value written back to the MMIO register.
1238 return MmioWrite8 (Address
, (UINT8
) ((MmioRead8 (Address
) & AndData
) | OrData
));
1242 Reads a bit field of a MMIO register.
1244 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1245 the StartBit and the EndBit. The value of the bit field is returned.
1247 If 8-bit MMIO register operations are not supported, then ASSERT().
1248 If StartBit is greater than 7, then ASSERT().
1249 If EndBit is greater than 7, then ASSERT().
1250 If EndBit is less than StartBit, then ASSERT().
1252 @param Address MMIO register to read.
1253 @param StartBit The ordinal of the least significant bit in the bit field.
1255 @param EndBit The ordinal of the most significant bit in the bit field.
1258 @return The value read from I/O port specified by StartBit and
1270 return BitFieldRead8 (MmioRead8 (Address
), StartBit
, EndBit
);
1274 Writes a bit field to a MMIO register.
1276 Writes Value to the bit field of the MMIO register. The bit field is
1277 specified by the StartBit and the EndBit. All other bits in the destination
1278 MMIO register are preserved. The new value of the 8-bit register is returned.
1280 If 8-bit MMIO register operations are not supported, then ASSERT().
1281 If StartBit is greater than 7, then ASSERT().
1282 If EndBit is greater than 7, then ASSERT().
1283 If EndBit is less than StartBit, then ASSERT().
1285 @param Address MMIO register to write.
1286 @param StartBit The ordinal of the least significant bit in the bit field.
1288 @param EndBit The ordinal of the most significant bit in the bit field.
1290 @param Value New value of the bit field.
1292 @return The value written back to the MMIO register.
1297 MmioBitFieldWrite8 (
1306 BitFieldWrite8 (MmioRead8 (Address
), StartBit
, EndBit
, Value
)
1311 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1312 writes the result back to the bit field in the 8-bit MMIO register.
1314 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1315 inclusive OR between the read result and the value specified by OrData, and
1316 writes the result to the 8-bit MMIO register specified by Address. The value
1317 written to the MMIO register is returned. This function must guarantee that
1318 all MMIO read and write operations are serialized. Extra left bits in OrData
1321 If 8-bit MMIO register operations are not supported, then ASSERT().
1322 If StartBit is greater than 7, then ASSERT().
1323 If EndBit is greater than 7, then ASSERT().
1324 If EndBit is less than StartBit, then ASSERT().
1326 @param Address MMIO register to write.
1327 @param StartBit The ordinal of the least significant bit in the bit field.
1329 @param EndBit The ordinal of the most significant bit in the bit field.
1331 @param OrData The value to OR with read value from the MMIO register.
1333 @return The value written back to the MMIO register.
1347 BitFieldOr8 (MmioRead8 (Address
), StartBit
, EndBit
, OrData
)
1352 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1353 writes the result back to the bit field in the 8-bit MMIO register.
1355 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1356 between the read result and the value specified by AndData, and writes the
1357 result to the 8-bit MMIO register specified by Address. The value written to
1358 the MMIO register is returned. This function must guarantee that all MMIO
1359 read and write operations are serialized. Extra left bits in AndData are
1362 If 8-bit MMIO register operations are not supported, then ASSERT().
1363 If StartBit is greater than 7, then ASSERT().
1364 If EndBit is greater than 7, then ASSERT().
1365 If EndBit is less than StartBit, then ASSERT().
1367 @param Address MMIO register to write.
1368 @param StartBit The ordinal of the least significant bit in the bit field.
1370 @param EndBit The ordinal of the most significant bit in the bit field.
1372 @param AndData The value to AND with read value from the MMIO register.
1374 @return The value written back to the MMIO register.
1388 BitFieldAnd8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
)
1393 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1394 by a bitwise inclusive OR, and writes the result back to the bit field in the
1395 8-bit MMIO register.
1397 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1398 followed by a bitwise inclusive OR between the read result and the value
1399 specified by AndData, and writes the result to the 8-bit MMIO register
1400 specified by Address. The value written to the MMIO register is returned.
1401 This function must guarantee that all MMIO read and write operations are
1402 serialized. Extra left bits in both AndData and OrData are stripped.
1404 If 8-bit MMIO register operations are not supported, then ASSERT().
1405 If StartBit is greater than 7, then ASSERT().
1406 If EndBit is greater than 7, then ASSERT().
1407 If EndBit is less than StartBit, then ASSERT().
1409 @param Address MMIO register to write.
1410 @param StartBit The ordinal of the least significant bit in the bit field.
1412 @param EndBit The ordinal of the most significant bit in the bit field.
1414 @param AndData The value to AND with read value from the MMIO register.
1415 @param OrData The value to OR with the result of the AND operation.
1417 @return The value written back to the MMIO register.
1422 MmioBitFieldAndThenOr8 (
1432 BitFieldAndThenOr8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1437 Reads a 16-bit MMIO register, performs a bitwise inclusive OR, and writes the
1438 result back to the 16-bit MMIO register.
1440 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1441 inclusive OR between the read result and the value specified by OrData, and
1442 writes the result to the 16-bit MMIO register specified by Address. The value
1443 written to the MMIO register is returned. This function must guarantee that
1444 all MMIO read and write operations are serialized.
1446 If 16-bit MMIO register operations are not supported, then ASSERT().
1448 @param Address The MMIO register to write.
1449 @param OrData The value to OR with the read value from the MMIO register.
1451 @return The value written back to the MMIO register.
1461 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) | OrData
));
1465 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1466 back to the 16-bit MMIO register.
1468 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1469 between the read result and the value specified by AndData, and writes the
1470 result to the 16-bit MMIO register specified by Address. The value written to
1471 the MMIO register is returned. This function must guarantee that all MMIO
1472 read and write operations are serialized.
1474 If 16-bit MMIO register operations are not supported, then ASSERT().
1476 @param Address The MMIO register to write.
1477 @param AndData The value to AND with the read value from the MMIO register.
1479 @return The value written back to the MMIO register.
1489 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) & AndData
));
1493 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1494 inclusive OR, and writes the result back to the 16-bit MMIO register.
1496 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1497 between the read result and the value specified by AndData, performs a
1498 bitwise OR between the result of the AND operation and the value specified by
1499 OrData, and writes the result to the 16-bit MMIO register specified by
1500 Address. The value written to the MMIO register is returned. This function
1501 must guarantee that all MMIO read and write operations are serialized.
1503 If 16-bit MMIO register operations are not supported, then ASSERT().
1506 @param Address The MMIO register to write.
1507 @param AndData The value to AND with the read value from the MMIO register.
1508 @param OrData The value to OR with the result of the AND operation.
1510 @return The value written back to the MMIO register.
1521 return MmioWrite16 (Address
, (UINT16
) ((MmioRead16 (Address
) & AndData
) | OrData
));
1525 Reads a bit field of a MMIO register.
1527 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
1528 the StartBit and the EndBit. The value of the bit field is returned.
1530 If 16-bit MMIO register operations are not supported, then ASSERT().
1531 If StartBit is greater than 15, then ASSERT().
1532 If EndBit is greater than 15, then ASSERT().
1533 If EndBit is less than StartBit, then ASSERT().
1535 @param Address MMIO register to read.
1536 @param StartBit The ordinal of the least significant bit in the bit field.
1538 @param EndBit The ordinal of the most significant bit in the bit field.
1541 @return The value read from I/O port specified by StartBit and
1547 MmioBitFieldRead16 (
1553 return BitFieldRead16 (MmioRead16 (Address
), StartBit
, EndBit
);
1557 Writes a bit field to a MMIO register.
1559 Writes Value to the bit field of the MMIO register. The bit field is
1560 specified by the StartBit and the EndBit. All other bits in the destination
1561 MMIO register are preserved. The new value of the 16-bit register is returned.
1563 If 16-bit MMIO register operations are not supported, then ASSERT().
1564 If StartBit is greater than 15, then ASSERT().
1565 If EndBit is greater than 15, then ASSERT().
1566 If EndBit is less than StartBit, then ASSERT().
1568 @param Address MMIO register to write.
1569 @param StartBit The ordinal of the least significant bit in the bit field.
1571 @param EndBit The ordinal of the most significant bit in the bit field.
1573 @param Value New value of the bit field.
1575 @return The value written back to the MMIO register.
1580 MmioBitFieldWrite16 (
1587 return MmioWrite16 (
1589 BitFieldWrite16 (MmioRead16 (Address
), StartBit
, EndBit
, Value
)
1594 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
1595 writes the result back to the bit field in the 16-bit MMIO register.
1597 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1598 inclusive OR between the read result and the value specified by OrData, and
1599 writes the result to the 16-bit MMIO register specified by Address. The value
1600 written to the MMIO register is returned. This function must guarantee that
1601 all MMIO read and write operations are serialized. Extra left bits in OrData
1604 If 16-bit MMIO register operations are not supported, then ASSERT().
1605 If StartBit is greater than 15, then ASSERT().
1606 If EndBit is greater than 15, then ASSERT().
1607 If EndBit is less than StartBit, then ASSERT().
1609 @param Address MMIO register to write.
1610 @param StartBit The ordinal of the least significant bit in the bit field.
1612 @param EndBit The ordinal of the most significant bit in the bit field.
1614 @param OrData The value to OR with read value from the MMIO register.
1616 @return The value written back to the MMIO register.
1628 return MmioWrite16 (
1630 BitFieldOr16 (MmioRead16 (Address
), StartBit
, EndBit
, OrData
)
1635 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
1636 writes the result back to the bit field in the 16-bit MMIO register.
1638 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1639 between the read result and the value specified by AndData, and writes the
1640 result to the 16-bit MMIO register specified by Address. The value written to
1641 the MMIO register is returned. This function must guarantee that all MMIO
1642 read and write operations are serialized. Extra left bits in AndData are
1645 If 16-bit MMIO register operations are not supported, then ASSERT().
1646 If StartBit is greater than 15, then ASSERT().
1647 If EndBit is greater than 15, then ASSERT().
1648 If EndBit is less than StartBit, then ASSERT().
1650 @param Address MMIO register to write.
1651 @param StartBit The ordinal of the least significant bit in the bit field.
1653 @param EndBit The ordinal of the most significant bit in the bit field.
1655 @param AndData The value to AND with read value from the MMIO register.
1657 @return The value written back to the MMIO register.
1669 return MmioWrite16 (
1671 BitFieldAnd16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
)
1676 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
1677 by a bitwise inclusive OR, and writes the result back to the bit field in the
1678 16-bit MMIO register.
1680 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1681 followed by a bitwise inclusive OR between the read result and the value
1682 specified by AndData, and writes the result to the 16-bit MMIO register
1683 specified by Address. The value written to the MMIO register is returned.
1684 This function must guarantee that all MMIO read and write operations are
1685 serialized. Extra left bits in both AndData and OrData are stripped.
1687 If 16-bit MMIO register operations are not supported, then ASSERT().
1688 If StartBit is greater than 15, then ASSERT().
1689 If EndBit is greater than 15, then ASSERT().
1690 If EndBit is less than StartBit, then ASSERT().
1692 @param Address MMIO register to write.
1693 @param StartBit The ordinal of the least significant bit in the bit field.
1695 @param EndBit The ordinal of the most significant bit in the bit field.
1697 @param AndData The value to AND with read value from the MMIO register.
1698 @param OrData The value to OR with the result of the AND operation.
1700 @return The value written back to the MMIO register.
1705 MmioBitFieldAndThenOr16 (
1713 return MmioWrite16 (
1715 BitFieldAndThenOr16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1720 Reads a 32-bit MMIO register, performs a bitwise inclusive OR, and writes the
1721 result back to the 32-bit MMIO register.
1723 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1724 inclusive OR between the read result and the value specified by OrData, and
1725 writes the result to the 32-bit MMIO register specified by Address. The value
1726 written to the MMIO register is returned. This function must guarantee that
1727 all MMIO read and write operations are serialized.
1729 If 32-bit MMIO register operations are not supported, then ASSERT().
1731 @param Address The MMIO register to write.
1732 @param OrData The value to OR with the read value from the MMIO register.
1734 @return The value written back to the MMIO register.
1744 return MmioWrite32 (Address
, MmioRead32 (Address
) | OrData
);
1748 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
1749 back to the 32-bit MMIO register.
1751 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1752 between the read result and the value specified by AndData, and writes the
1753 result to the 32-bit MMIO register specified by Address. The value written to
1754 the MMIO register is returned. This function must guarantee that all MMIO
1755 read and write operations are serialized.
1757 If 32-bit MMIO register operations are not supported, then ASSERT().
1759 @param Address The MMIO register to write.
1760 @param AndData The value to AND with the read value from the MMIO register.
1762 @return The value written back to the MMIO register.
1772 return MmioWrite32 (Address
, MmioRead32 (Address
) & AndData
);
1776 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
1777 inclusive OR, and writes the result back to the 32-bit MMIO register.
1779 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1780 between the read result and the value specified by AndData, performs a
1781 bitwise OR between the result of the AND operation and the value specified by
1782 OrData, and writes the result to the 32-bit MMIO register specified by
1783 Address. The value written to the MMIO register is returned. This function
1784 must guarantee that all MMIO read and write operations are serialized.
1786 If 32-bit MMIO register operations are not supported, then ASSERT().
1789 @param Address The MMIO register to write.
1790 @param AndData The value to AND with the read value from the MMIO register.
1791 @param OrData The value to OR with the result of the AND operation.
1793 @return The value written back to the MMIO register.
1804 return MmioWrite32 (Address
, (MmioRead32 (Address
) & AndData
) | OrData
);
1808 Reads a bit field of a MMIO register.
1810 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
1811 the StartBit and the EndBit. The value of the bit field is returned.
1813 If 32-bit MMIO register operations are not supported, then ASSERT().
1814 If StartBit is greater than 31, then ASSERT().
1815 If EndBit is greater than 31, then ASSERT().
1816 If EndBit is less than StartBit, then ASSERT().
1818 @param Address MMIO register to read.
1819 @param StartBit The ordinal of the least significant bit in the bit field.
1821 @param EndBit The ordinal of the most significant bit in the bit field.
1824 @return The value read from I/O port specified by StartBit and
1830 MmioBitFieldRead32 (
1836 return BitFieldRead32 (MmioRead32 (Address
), StartBit
, EndBit
);
1840 Writes a bit field to a MMIO register.
1842 Writes Value to the bit field of the MMIO register. The bit field is
1843 specified by the StartBit and the EndBit. All other bits in the destination
1844 MMIO register are preserved. The new value of the 32-bit register is returned.
1846 If 32-bit MMIO register operations are not supported, then ASSERT().
1847 If StartBit is greater than 31, then ASSERT().
1848 If EndBit is greater than 31, then ASSERT().
1849 If EndBit is less than StartBit, then ASSERT().
1851 @param Address MMIO register to write.
1852 @param StartBit The ordinal of the least significant bit in the bit field.
1854 @param EndBit The ordinal of the most significant bit in the bit field.
1856 @param Value New value of the bit field.
1858 @return The value written back to the MMIO register.
1863 MmioBitFieldWrite32 (
1870 return MmioWrite32 (
1872 BitFieldWrite32 (MmioRead32 (Address
), StartBit
, EndBit
, Value
)
1877 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
1878 writes the result back to the bit field in the 32-bit MMIO register.
1880 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1881 inclusive OR between the read result and the value specified by OrData, and
1882 writes the result to the 32-bit MMIO register specified by Address. The value
1883 written to the MMIO register is returned. This function must guarantee that
1884 all MMIO read and write operations are serialized. Extra left bits in OrData
1887 If 32-bit MMIO register operations are not supported, then ASSERT().
1888 If StartBit is greater than 31, then ASSERT().
1889 If EndBit is greater than 31, then ASSERT().
1890 If EndBit is less than StartBit, then ASSERT().
1892 @param Address MMIO register to write.
1893 @param StartBit The ordinal of the least significant bit in the bit field.
1895 @param EndBit The ordinal of the most significant bit in the bit field.
1897 @param OrData The value to OR with read value from the MMIO register.
1899 @return The value written back to the MMIO register.
1911 return MmioWrite32 (
1913 BitFieldOr32 (MmioRead32 (Address
), StartBit
, EndBit
, OrData
)
1918 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
1919 writes the result back to the bit field in the 32-bit MMIO register.
1921 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1922 between the read result and the value specified by AndData, and writes the
1923 result to the 32-bit MMIO register specified by Address. The value written to
1924 the MMIO register is returned. This function must guarantee that all MMIO
1925 read and write operations are serialized. Extra left bits in AndData are
1928 If 32-bit MMIO register operations are not supported, then ASSERT().
1929 If StartBit is greater than 31, then ASSERT().
1930 If EndBit is greater than 31, then ASSERT().
1931 If EndBit is less than StartBit, then ASSERT().
1933 @param Address MMIO register to write.
1934 @param StartBit The ordinal of the least significant bit in the bit field.
1936 @param EndBit The ordinal of the most significant bit in the bit field.
1938 @param AndData The value to AND with read value from the MMIO register.
1940 @return The value written back to the MMIO register.
1952 return MmioWrite32 (
1954 BitFieldAnd32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
)
1959 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
1960 by a bitwise inclusive OR, and writes the result back to the bit field in the
1961 32-bit MMIO register.
1963 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1964 followed by a bitwise inclusive OR between the read result and the value
1965 specified by AndData, and writes the result to the 32-bit MMIO register
1966 specified by Address. The value written to the MMIO register is returned.
1967 This function must guarantee that all MMIO read and write operations are
1968 serialized. Extra left bits in both AndData and OrData are stripped.
1970 If 32-bit MMIO register operations are not supported, then ASSERT().
1971 If StartBit is greater than 31, then ASSERT().
1972 If EndBit is greater than 31, then ASSERT().
1973 If EndBit is less than StartBit, then ASSERT().
1975 @param Address MMIO register to write.
1976 @param StartBit The ordinal of the least significant bit in the bit field.
1978 @param EndBit The ordinal of the most significant bit in the bit field.
1980 @param AndData The value to AND with read value from the MMIO register.
1981 @param OrData The value to OR with the result of the AND operation.
1983 @return The value written back to the MMIO register.
1988 MmioBitFieldAndThenOr32 (
1996 return MmioWrite32 (
1998 BitFieldAndThenOr32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
, OrData
)
2003 Reads a 64-bit MMIO register, performs a bitwise inclusive OR, and writes the
2004 result back to the 64-bit MMIO register.
2006 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2007 inclusive OR between the read result and the value specified by OrData, and
2008 writes the result to the 64-bit MMIO register specified by Address. The value
2009 written to the MMIO register is returned. This function must guarantee that
2010 all MMIO read and write operations are serialized.
2012 If 64-bit MMIO register operations are not supported, then ASSERT().
2014 @param Address The MMIO register to write.
2015 @param OrData The value to OR with the read value from the MMIO register.
2017 @return The value written back to the MMIO register.
2027 return MmioWrite64 (Address
, MmioRead64 (Address
) | OrData
);
2031 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2032 back to the 64-bit MMIO register.
2034 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2035 between the read result and the value specified by AndData, and writes the
2036 result to the 64-bit MMIO register specified by Address. The value written to
2037 the MMIO register is returned. This function must guarantee that all MMIO
2038 read and write operations are serialized.
2040 If 64-bit MMIO register operations are not supported, then ASSERT().
2042 @param Address The MMIO register to write.
2043 @param AndData The value to AND with the read value from the MMIO register.
2045 @return The value written back to the MMIO register.
2055 return MmioWrite64 (Address
, MmioRead64 (Address
) & AndData
);
2059 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2060 inclusive OR, and writes the result back to the 64-bit MMIO register.
2062 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2063 between the read result and the value specified by AndData, performs a
2064 bitwise OR between the result of the AND operation and the value specified by
2065 OrData, and writes the result to the 64-bit MMIO register specified by
2066 Address. The value written to the MMIO register is returned. This function
2067 must guarantee that all MMIO read and write operations are serialized.
2069 If 64-bit MMIO register operations are not supported, then ASSERT().
2072 @param Address The MMIO register to write.
2073 @param AndData The value to AND with the read value from the MMIO register.
2074 @param OrData The value to OR with the result of the AND operation.
2076 @return The value written back to the MMIO register.
2087 return MmioWrite64 (Address
, (MmioRead64 (Address
) & AndData
) | OrData
);
2091 Reads a bit field of a MMIO register.
2093 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2094 the StartBit and the EndBit. The value of the bit field is returned.
2096 If 64-bit MMIO register operations are not supported, then ASSERT().
2097 If StartBit is greater than 63, then ASSERT().
2098 If EndBit is greater than 63, then ASSERT().
2099 If EndBit is less than StartBit, then ASSERT().
2101 @param Address MMIO register to read.
2102 @param StartBit The ordinal of the least significant bit in the bit field.
2104 @param EndBit The ordinal of the most significant bit in the bit field.
2107 @return The value read from I/O port specified by StartBit and
2113 MmioBitFieldRead64 (
2119 return BitFieldRead64 (MmioRead64 (Address
), StartBit
, EndBit
);
2123 Writes a bit field to a MMIO register.
2125 Writes Value to the bit field of the MMIO register. The bit field is
2126 specified by the StartBit and the EndBit. All other bits in the destination
2127 MMIO register are preserved. The new value of the 64-bit register is returned.
2129 If 64-bit MMIO register operations are not supported, then ASSERT().
2130 If StartBit is greater than 63, then ASSERT().
2131 If EndBit is greater than 63, then ASSERT().
2132 If EndBit is less than StartBit, then ASSERT().
2134 @param Address MMIO register to write.
2135 @param StartBit The ordinal of the least significant bit in the bit field.
2137 @param EndBit The ordinal of the most significant bit in the bit field.
2139 @param Value New value of the bit field.
2141 @return The value written back to the MMIO register.
2146 MmioBitFieldWrite64 (
2153 return MmioWrite64 (
2155 BitFieldWrite64 (MmioRead64 (Address
), StartBit
, EndBit
, Value
)
2160 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2161 writes the result back to the bit field in the 64-bit MMIO register.
2163 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2164 inclusive OR between the read result and the value specified by OrData, and
2165 writes the result to the 64-bit MMIO register specified by Address. The value
2166 written to the MMIO register is returned. This function must guarantee that
2167 all MMIO read and write operations are serialized. Extra left bits in OrData
2170 If 64-bit MMIO register operations are not supported, then ASSERT().
2171 If StartBit is greater than 63, then ASSERT().
2172 If EndBit is greater than 63, then ASSERT().
2173 If EndBit is less than StartBit, then ASSERT().
2175 @param Address MMIO register to write.
2176 @param StartBit The ordinal of the least significant bit in the bit field.
2178 @param EndBit The ordinal of the most significant bit in the bit field.
2180 @param OrData The value to OR with read value from the MMIO register.
2182 @return The value written back to the MMIO register.
2194 return MmioWrite64 (
2196 BitFieldOr64 (MmioRead64 (Address
), StartBit
, EndBit
, OrData
)
2201 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2202 writes the result back to the bit field in the 64-bit MMIO register.
2204 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2205 between the read result and the value specified by AndData, and writes the
2206 result to the 64-bit MMIO register specified by Address. The value written to
2207 the MMIO register is returned. This function must guarantee that all MMIO
2208 read and write operations are serialized. Extra left bits in AndData are
2211 If 64-bit MMIO register operations are not supported, then ASSERT().
2212 If StartBit is greater than 63, then ASSERT().
2213 If EndBit is greater than 63, then ASSERT().
2214 If EndBit is less than StartBit, then ASSERT().
2216 @param Address MMIO register to write.
2217 @param StartBit The ordinal of the least significant bit in the bit field.
2219 @param EndBit The ordinal of the most significant bit in the bit field.
2221 @param AndData The value to AND with read value from the MMIO register.
2223 @return The value written back to the MMIO register.
2235 return MmioWrite64 (
2237 BitFieldAnd64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
)
2242 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2243 by a bitwise inclusive OR, and writes the result back to the bit field in the
2244 64-bit MMIO register.
2246 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2247 followed by a bitwise inclusive OR between the read result and the value
2248 specified by AndData, and writes the result to the 64-bit MMIO register
2249 specified by Address. The value written to the MMIO register is returned.
2250 This function must guarantee that all MMIO read and write operations are
2251 serialized. Extra left bits in both AndData and OrData are stripped.
2253 If 64-bit MMIO register operations are not supported, then ASSERT().
2254 If StartBit is greater than 63, then ASSERT().
2255 If EndBit is greater than 63, then ASSERT().
2256 If EndBit is less than StartBit, then ASSERT().
2258 @param Address MMIO register to write.
2259 @param StartBit The ordinal of the least significant bit in the bit field.
2261 @param EndBit The ordinal of the most significant bit in the bit field.
2263 @param AndData The value to AND with read value from the MMIO register.
2264 @param OrData The value to OR with the result of the AND operation.
2266 @return The value written back to the MMIO register.
2271 MmioBitFieldAndThenOr64 (
2279 return MmioWrite64 (
2281 BitFieldAndThenOr64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
, OrData
)