]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/PeiIoLibCpuIo/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:
27 #include <Library/IoLib.h>
28 #include <Library/DebugLib.h>
29 #include <Library/BaseLib.h>
30 #include <Library/PeiServicesTablePointerLib.h>
33 Reads an 8-bit I/O port, performs a bitwise inclusive OR, and writes the
34 result back to the 8-bit I/O port.
36 Reads the 8-bit I/O port specified by Port, performs a bitwise inclusive OR
37 between the read result and the value specified by OrData, and writes the
38 result to the 8-bit I/O port specified by Port. The value written to the I/O
39 port is returned. This function must guarantee that all I/O read and write
40 operations are serialized.
42 If 8-bit I/O port operations are not supported, then ASSERT().
44 @param Port The I/O port to write.
45 @param OrData The value to OR with the read value from the I/O port.
47 @return The value written back to the I/O port.
57 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) | OrData
));
61 Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
62 to the 8-bit I/O port.
64 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
65 the read result and the value specified by AndData, and writes the result to
66 the 8-bit I/O port specified by Port. The value written to the I/O port is
67 returned. This function must guarantee that all I/O read and write operations
70 If 8-bit I/O port operations are not supported, then ASSERT().
72 @param Port The I/O port to write.
73 @param AndData The value to AND with the read value from the I/O port.
75 @return The value written back to the I/O port.
85 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) & AndData
));
89 Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
90 inclusive OR, and writes the result back to the 8-bit I/O port.
92 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
93 the read result and the value specified by AndData, performs a bitwise OR
94 between the result of the AND operation and the value specified by OrData,
95 and writes the result to the 8-bit I/O port specified by Port. The value
96 written to the I/O port is returned. This function must guarantee that all
97 I/O read and write operations are serialized.
99 If 8-bit I/O port operations are not supported, then ASSERT().
101 @param Port The I/O port to write.
102 @param AndData The value to AND with the read value from the I/O port.
103 @param OrData The value to OR with the result of the AND operation.
105 @return The value written back to the I/O port.
116 return IoWrite8 (Port
, (UINT8
) ((IoRead8 (Port
) & AndData
) | OrData
));
120 Reads a bit field of an I/O register.
122 Reads the bit field in an 8-bit I/O register. The bit field is specified by
123 the StartBit and the EndBit. The value of the bit field is returned.
125 If 8-bit I/O port operations are not supported, then ASSERT().
126 If StartBit is greater than 7, then ASSERT().
127 If EndBit is greater than 7, then ASSERT().
128 If EndBit is less than StartBit, then ASSERT().
130 @param Port The I/O port to read.
131 @param StartBit The ordinal of the least significant bit in the bit field.
133 @param EndBit The ordinal of the most significant bit in the bit field.
136 @return The value read.
147 return BitFieldRead8 (IoRead8 (Port
), StartBit
, EndBit
);
151 Writes a bit field to an I/O register.
153 Writes Value to the bit field of the I/O register. The bit field is specified
154 by the StartBit and the EndBit. All other bits in the destination I/O
155 register are preserved. The value written to the I/O port is returned. Extra
156 left bits in Value are stripped.
158 If 8-bit I/O port operations are not supported, then ASSERT().
159 If StartBit is greater than 7, then ASSERT().
160 If EndBit is greater than 7, then ASSERT().
161 If EndBit is less than StartBit, then ASSERT().
163 @param Port The I/O port to write.
164 @param StartBit The ordinal of the least significant bit in the bit field.
166 @param EndBit The ordinal of the most significant bit in the bit field.
168 @param Value New value of the bit field.
170 @return The value written back to the I/O port.
184 BitFieldWrite8 (IoRead8 (Port
), StartBit
, EndBit
, Value
)
189 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
190 result back to the bit field in the 8-bit port.
192 Reads the 8-bit I/O port specified by Port, performs a bitwise inclusive OR
193 between the read result and the value specified by OrData, and writes the
194 result to the 8-bit I/O port specified by Port. The value written to the I/O
195 port is returned. This function must guarantee that all I/O read and write
196 operations are serialized. Extra left bits in OrData are stripped.
198 If 8-bit I/O port operations are not supported, then ASSERT().
199 If StartBit is greater than 7, then ASSERT().
200 If EndBit is greater than 7, then ASSERT().
201 If EndBit is less than StartBit, then ASSERT().
203 @param Port The I/O port to write.
204 @param StartBit The ordinal of the least significant bit in the bit field.
206 @param EndBit The ordinal of the most significant bit in the bit field.
208 @param OrData The value to OR with the read value from the I/O port.
210 @return The value written back to the I/O port.
224 BitFieldOr8 (IoRead8 (Port
), StartBit
, EndBit
, OrData
)
229 Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
230 result back to the bit field in the 8-bit port.
232 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
233 the read result and the value specified by AndData, and writes the result to
234 the 8-bit I/O port specified by Port. The value written to the I/O port is
235 returned. This function must guarantee that all I/O read and write operations
236 are serialized. Extra left bits in AndData are stripped.
238 If 8-bit I/O port operations are not supported, then ASSERT().
239 If StartBit is greater than 7, then ASSERT().
240 If EndBit is greater than 7, then ASSERT().
241 If EndBit is less than StartBit, then ASSERT().
243 @param Port The I/O port to write.
244 @param StartBit The ordinal of the least significant bit in the bit field.
246 @param EndBit The ordinal of the most significant bit in the bit field.
248 @param AndData The value to AND with the read value from the I/O port.
250 @return The value written back to the I/O port.
264 BitFieldAnd8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
)
269 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
270 bitwise inclusive OR, and writes the result back to the bit field in the
273 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
274 by a bitwise inclusive OR between the read result and the value specified by
275 AndData, and writes the result to the 8-bit I/O port specified by Port. The
276 value written to the I/O port is returned. This function must guarantee that
277 all I/O read and write operations are serialized. Extra left bits in both
278 AndData and OrData are stripped.
280 If 8-bit I/O port operations are not supported, then ASSERT().
281 If StartBit is greater than 7, then ASSERT().
282 If EndBit is greater than 7, then ASSERT().
283 If EndBit is less than StartBit, then ASSERT().
285 @param Port The I/O port to write.
286 @param StartBit The ordinal of the least significant bit in the bit field.
288 @param EndBit The ordinal of the most significant bit in the bit field.
290 @param AndData The value to AND with the read value from the I/O port.
291 @param OrData The value to OR with the result of the AND operation.
293 @return The value written back to the I/O port.
298 IoBitFieldAndThenOr8 (
308 BitFieldAndThenOr8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
, OrData
)
313 Reads a 16-bit I/O port, performs a bitwise inclusive OR, and writes the
314 result back to the 16-bit I/O port.
316 Reads the 16-bit I/O port specified by Port, performs a bitwise inclusive OR
317 between the read result and the value specified by OrData, and writes the
318 result to the 16-bit I/O port specified by Port. The value written to the I/O
319 port is returned. This function must guarantee that all I/O read and write
320 operations are serialized.
322 If 16-bit I/O port operations are not supported, then ASSERT().
324 @param Port The I/O port to write.
325 @param OrData The value to OR with the read value from the I/O port.
327 @return The value written back to the I/O port.
337 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) | OrData
));
341 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
342 to the 16-bit I/O port.
344 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
345 the read result and the value specified by AndData, and writes the result to
346 the 16-bit I/O port specified by Port. The value written to the I/O port is
347 returned. This function must guarantee that all I/O read and write operations
350 If 16-bit I/O port operations are not supported, then ASSERT().
352 @param Port The I/O port to write.
353 @param AndData The value to AND with the read value from the I/O port.
355 @return The value written back to the I/O port.
365 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) & AndData
));
369 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
370 inclusive OR, and writes the result back to the 16-bit I/O port.
372 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
373 the read result and the value specified by AndData, performs a bitwise OR
374 between the result of the AND operation and the value specified by OrData,
375 and writes the result to the 16-bit I/O port specified by Port. The value
376 written to the I/O port is returned. This function must guarantee that all
377 I/O read and write operations are serialized.
379 If 16-bit I/O port operations are not supported, then ASSERT().
381 @param Port The I/O port to write.
382 @param AndData The value to AND with the read value from the I/O port.
383 @param OrData The value to OR with the result of the AND operation.
385 @return The value written back to the I/O port.
396 return IoWrite16 (Port
, (UINT16
) ((IoRead16 (Port
) & AndData
) | OrData
));
400 Reads a bit field of an I/O register.
402 Reads the bit field in a 16-bit I/O register. The bit field is specified by
403 the StartBit and the EndBit. The value of the bit field is returned.
405 If 16-bit I/O port operations are not supported, then ASSERT().
406 If StartBit is greater than 15, then ASSERT().
407 If EndBit is greater than 15, then ASSERT().
408 If EndBit is less than StartBit, then ASSERT().
410 @param Port The I/O port to read.
411 @param StartBit The ordinal of the least significant bit in the bit field.
413 @param EndBit The ordinal of the most significant bit in the bit field.
416 @return The value read.
427 return BitFieldRead16 (IoRead16 (Port
), StartBit
, EndBit
);
431 Writes a bit field to an I/O register.
433 Writes Value to the bit field of the I/O register. The bit field is specified
434 by the StartBit and the EndBit. All other bits in the destination I/O
435 register are preserved. The value written to the I/O port is returned. Extra
436 left bits in Value are stripped.
438 If 16-bit I/O port operations are not supported, then ASSERT().
439 If StartBit is greater than 15, then ASSERT().
440 If EndBit is greater than 15, then ASSERT().
441 If EndBit is less than StartBit, then ASSERT().
443 @param Port The I/O port to write.
444 @param StartBit The ordinal of the least significant bit in the bit field.
446 @param EndBit The ordinal of the most significant bit in the bit field.
448 @param Value New value of the bit field.
450 @return The value written back to the I/O port.
464 BitFieldWrite16 (IoRead16 (Port
), StartBit
, EndBit
, Value
)
469 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
470 result back to the bit field in the 16-bit port.
472 Reads the 16-bit I/O port specified by Port, performs a bitwise inclusive OR
473 between the read result and the value specified by OrData, and writes the
474 result to the 16-bit I/O port specified by Port. The value written to the I/O
475 port is returned. This function must guarantee that all I/O read and write
476 operations are serialized. Extra left bits in OrData are stripped.
478 If 16-bit I/O port operations are not supported, then ASSERT().
479 If StartBit is greater than 15, then ASSERT().
480 If EndBit is greater than 15, then ASSERT().
481 If EndBit is less than StartBit, then ASSERT().
483 @param Port The I/O port to write.
484 @param StartBit The ordinal of the least significant bit in the bit field.
486 @param EndBit The ordinal of the most significant bit in the bit field.
488 @param OrData The value to OR with the read value from the I/O port.
490 @return The value written back to the I/O port.
504 BitFieldOr16 (IoRead16 (Port
), StartBit
, EndBit
, OrData
)
509 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
510 result back to the bit field in the 16-bit port.
512 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
513 the read result and the value specified by AndData, and writes the result to
514 the 16-bit I/O port specified by Port. The value written to the I/O port is
515 returned. This function must guarantee that all I/O read and write operations
516 are serialized. Extra left bits in AndData are stripped.
518 If 16-bit I/O port operations are not supported, then ASSERT().
519 If StartBit is greater than 15, then ASSERT().
520 If EndBit is greater than 15, then ASSERT().
521 If EndBit is less than StartBit, then ASSERT().
523 @param Port The I/O port to write.
524 @param StartBit The ordinal of the least significant bit in the bit field.
526 @param EndBit The ordinal of the most significant bit in the bit field.
528 @param AndData The value to AND with the read value from the I/O port.
530 @return The value written back to the I/O port.
544 BitFieldAnd16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
)
549 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
550 bitwise inclusive OR, and writes the result back to the bit field in the
553 Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
554 by a bitwise inclusive OR between the read result and the value specified by
555 AndData, and writes the result to the 16-bit I/O port specified by Port. The
556 value written to the I/O port is returned. This function must guarantee that
557 all I/O read and write operations are serialized. Extra left bits in both
558 AndData and OrData are stripped.
560 If 16-bit I/O port operations are not supported, then ASSERT().
561 If StartBit is greater than 15, then ASSERT().
562 If EndBit is greater than 15, then ASSERT().
563 If EndBit is less than StartBit, then ASSERT().
565 @param Port The I/O port to write.
566 @param StartBit The ordinal of the least significant bit in the bit field.
568 @param EndBit The ordinal of the most significant bit in the bit field.
570 @param AndData The value to AND with the read value from the I/O port.
571 @param OrData The value to OR with the result of the AND operation.
573 @return The value written back to the I/O port.
578 IoBitFieldAndThenOr16 (
588 BitFieldAndThenOr16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
, OrData
)
593 Reads a 32-bit I/O port, performs a bitwise inclusive OR, and writes the
594 result back to the 32-bit I/O port.
596 Reads the 32-bit I/O port specified by Port, performs a bitwise inclusive OR
597 between the read result and the value specified by OrData, and writes the
598 result to the 32-bit I/O port specified by Port. The value written to the I/O
599 port is returned. This function must guarantee that all I/O read and write
600 operations are serialized.
602 If 32-bit I/O port operations are not supported, then ASSERT().
604 @param Port The I/O port to write.
605 @param OrData The value to OR with the read value from the I/O port.
607 @return The value written back to the I/O port.
617 return IoWrite32 (Port
, IoRead32 (Port
) | OrData
);
621 Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
622 to the 32-bit I/O port.
624 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
625 the read result and the value specified by AndData, and writes the result to
626 the 32-bit I/O port specified by Port. The value written to the I/O port is
627 returned. This function must guarantee that all I/O read and write operations
630 If 32-bit I/O port operations are not supported, then ASSERT().
632 @param Port The I/O port to write.
633 @param AndData The value to AND with the read value from the I/O port.
635 @return The value written back to the I/O port.
645 return IoWrite32 (Port
, IoRead32 (Port
) & AndData
);
649 Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
650 inclusive OR, and writes the result back to the 32-bit I/O port.
652 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
653 the read result and the value specified by AndData, performs a bitwise OR
654 between the result of the AND operation and the value specified by OrData,
655 and writes the result to the 32-bit I/O port specified by Port. The value
656 written to the I/O port is returned. This function must guarantee that all
657 I/O read and write operations are serialized.
659 If 32-bit I/O port operations are not supported, then ASSERT().
661 @param Port The I/O port to write.
662 @param AndData The value to AND with the read value from the I/O port.
663 @param OrData The value to OR with the result of the AND operation.
665 @return The value written back to the I/O port.
676 return IoWrite32 (Port
, (IoRead32 (Port
) & AndData
) | OrData
);
680 Reads a bit field of an I/O register.
682 Reads the bit field in a 32-bit I/O register. The bit field is specified by
683 the StartBit and the EndBit. The value of the bit field is returned.
685 If 32-bit I/O port operations are not supported, then ASSERT().
686 If StartBit is greater than 31, then ASSERT().
687 If EndBit is greater than 31, then ASSERT().
688 If EndBit is less than StartBit, then ASSERT().
690 @param Port The I/O port to read.
691 @param StartBit The ordinal of the least significant bit in the bit field.
693 @param EndBit The ordinal of the most significant bit in the bit field.
696 @return The value read.
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.
987 return BitFieldRead64 (IoRead64 (Port
), StartBit
, EndBit
);
991 Writes a bit field to an I/O register.
993 Writes Value to the bit field of the I/O register. The bit field is specified
994 by the StartBit and the EndBit. All other bits in the destination I/O
995 register are preserved. The value written to the I/O port is returned. Extra
996 left bits in Value are stripped.
998 If 64-bit I/O port operations are not supported, then ASSERT().
999 If StartBit is greater than 63, then ASSERT().
1000 If EndBit is greater than 63, then ASSERT().
1001 If EndBit is less than StartBit, then ASSERT().
1003 @param Port The I/O port to write.
1004 @param StartBit The ordinal of the least significant bit in the bit field.
1006 @param EndBit The ordinal of the most significant bit in the bit field.
1008 @param Value New value of the bit field.
1010 @return The value written back to the I/O port.
1024 BitFieldWrite64 (IoRead64 (Port
), StartBit
, EndBit
, Value
)
1029 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1030 result back to the bit field in the 64-bit port.
1032 Reads the 64-bit I/O port specified by Port, performs a bitwise inclusive OR
1033 between the read result and the value specified by OrData, and writes the
1034 result to the 64-bit I/O port specified by Port. The value written to the I/O
1035 port is returned. This function must guarantee that all I/O read and write
1036 operations are serialized. Extra left bits in OrData are stripped.
1038 If 64-bit I/O port operations are not supported, then ASSERT().
1039 If StartBit is greater than 63, then ASSERT().
1040 If EndBit is greater than 63, then ASSERT().
1041 If EndBit is less than StartBit, then ASSERT().
1043 @param Port The I/O port to write.
1044 @param StartBit The ordinal of the least significant bit in the bit field.
1046 @param EndBit The ordinal of the most significant bit in the bit field.
1048 @param OrData The value to OR with the read value from the I/O port.
1050 @return The value written back to the I/O port.
1064 BitFieldOr64 (IoRead64 (Port
), StartBit
, EndBit
, OrData
)
1069 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1070 result back to the bit field in the 64-bit port.
1072 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1073 the read result and the value specified by AndData, and writes the result to
1074 the 64-bit I/O port specified by Port. The value written to the I/O port is
1075 returned. This function must guarantee that all I/O read and write operations
1076 are serialized. Extra left bits in AndData are stripped.
1078 If 64-bit I/O port operations are not supported, then ASSERT().
1079 If StartBit is greater than 63, then ASSERT().
1080 If EndBit is greater than 63, then ASSERT().
1081 If EndBit is less than StartBit, then ASSERT().
1083 @param Port The I/O port to write.
1084 @param StartBit The ordinal of the least significant bit in the bit field.
1086 @param EndBit The ordinal of the most significant bit in the bit field.
1088 @param AndData The value to AND with the read value from the I/O port.
1090 @return The value written back to the I/O port.
1104 BitFieldAnd64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
)
1109 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
1110 bitwise inclusive OR, and writes the result back to the bit field in the
1113 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
1114 by a bitwise inclusive OR between the read result and the value specified by
1115 AndData, and writes the result to the 64-bit I/O port specified by Port. The
1116 value written to the I/O port is returned. This function must guarantee that
1117 all I/O read and write operations are serialized. Extra left bits in both
1118 AndData and OrData are stripped.
1120 If 64-bit I/O port operations are not supported, then ASSERT().
1121 If StartBit is greater than 63, then ASSERT().
1122 If EndBit is greater than 63, then ASSERT().
1123 If EndBit is less than StartBit, then ASSERT().
1125 @param Port The I/O port to write.
1126 @param StartBit The ordinal of the least significant bit in the bit field.
1128 @param EndBit The ordinal of the most significant bit in the bit field.
1130 @param AndData The value to AND with the read value from the I/O port.
1131 @param OrData The value to OR with the result of the AND operation.
1133 @return The value written back to the I/O port.
1138 IoBitFieldAndThenOr64 (
1148 BitFieldAndThenOr64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
, OrData
)
1153 Reads an 8-bit MMIO register, performs a bitwise inclusive OR, and writes the
1154 result back to the 8-bit MMIO register.
1156 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1157 inclusive OR between the read result and the value specified by OrData, and
1158 writes the result to the 8-bit MMIO register specified by Address. The value
1159 written to the MMIO register is returned. This function must guarantee that
1160 all MMIO read and write operations are serialized.
1162 If 8-bit MMIO register operations are not supported, then ASSERT().
1164 @param Address The MMIO register to write.
1165 @param OrData The value to OR with the read value from the MMIO register.
1167 @return The value written back to the MMIO register.
1177 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) | OrData
));
1181 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1182 back to the 8-bit MMIO register.
1184 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1185 between the read result and the value specified by AndData, and writes the
1186 result to the 8-bit MMIO register specified by Address. The value written to
1187 the MMIO register is returned. This function must guarantee that all MMIO
1188 read and write operations are serialized.
1190 If 8-bit MMIO register operations are not supported, then ASSERT().
1192 @param Address The MMIO register to write.
1193 @param AndData The value to AND with the read value from the MMIO register.
1195 @return The value written back to the MMIO register.
1205 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) & AndData
));
1209 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1210 inclusive OR, and writes the result back to the 8-bit MMIO register.
1212 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1213 between the read result and the value specified by AndData, performs a
1214 bitwise OR between the result of the AND operation and the value specified by
1215 OrData, and writes the result to the 8-bit MMIO register specified by
1216 Address. The value written to the MMIO register is returned. This function
1217 must guarantee that all MMIO read and write operations are serialized.
1219 If 8-bit MMIO register operations are not supported, then ASSERT().
1222 @param Address The MMIO register to write.
1223 @param AndData The value to AND with the read value from the MMIO register.
1224 @param OrData The value to OR with the result of the AND operation.
1226 @return The value written back to the MMIO register.
1237 return MmioWrite8 (Address
, (UINT8
) ((MmioRead8 (Address
) & AndData
) | OrData
));
1241 Reads a bit field of a MMIO register.
1243 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1244 the StartBit and the EndBit. The value of the bit field is returned.
1246 If 8-bit MMIO register operations are not supported, then ASSERT().
1247 If StartBit is greater than 7, then ASSERT().
1248 If EndBit is greater than 7, then ASSERT().
1249 If EndBit is less than StartBit, then ASSERT().
1251 @param Address MMIO register to read.
1252 @param StartBit The ordinal of the least significant bit in the bit field.
1254 @param EndBit The ordinal of the most significant bit in the bit field.
1257 @return The value read.
1268 return BitFieldRead8 (MmioRead8 (Address
), StartBit
, EndBit
);
1272 Writes a bit field to a MMIO register.
1274 Writes Value to the bit field of the MMIO register. The bit field is
1275 specified by the StartBit and the EndBit. All other bits in the destination
1276 MMIO register are preserved. The new value of the 8-bit register is returned.
1278 If 8-bit MMIO register operations are not supported, then ASSERT().
1279 If StartBit is greater than 7, then ASSERT().
1280 If EndBit is greater than 7, then ASSERT().
1281 If EndBit is less than StartBit, then ASSERT().
1283 @param Address MMIO register to write.
1284 @param StartBit The ordinal of the least significant bit in the bit field.
1286 @param EndBit The ordinal of the most significant bit in the bit field.
1288 @param Value New value of the bit field.
1290 @return The value written back to the MMIO register.
1295 MmioBitFieldWrite8 (
1304 BitFieldWrite8 (MmioRead8 (Address
), StartBit
, EndBit
, Value
)
1309 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1310 writes the result back to the bit field in the 8-bit MMIO register.
1312 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1313 inclusive OR between the read result and the value specified by OrData, and
1314 writes the result to the 8-bit MMIO register specified by Address. The value
1315 written to the MMIO register is returned. This function must guarantee that
1316 all MMIO read and write operations are serialized. Extra left bits in OrData
1319 If 8-bit MMIO register operations are not supported, then ASSERT().
1320 If StartBit is greater than 7, then ASSERT().
1321 If EndBit is greater than 7, then ASSERT().
1322 If EndBit is less than StartBit, then ASSERT().
1324 @param Address MMIO register to write.
1325 @param StartBit The ordinal of the least significant bit in the bit field.
1327 @param EndBit The ordinal of the most significant bit in the bit field.
1329 @param OrData The value to OR with read value from the MMIO register.
1331 @return The value written back to the MMIO register.
1345 BitFieldOr8 (MmioRead8 (Address
), StartBit
, EndBit
, OrData
)
1350 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1351 writes the result back to the bit field in the 8-bit MMIO register.
1353 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1354 between the read result and the value specified by AndData, and writes the
1355 result to the 8-bit MMIO register specified by Address. The value written to
1356 the MMIO register is returned. This function must guarantee that all MMIO
1357 read and write operations are serialized. Extra left bits in AndData are
1360 If 8-bit MMIO register operations are not supported, then ASSERT().
1361 If StartBit is greater than 7, then ASSERT().
1362 If EndBit is greater than 7, then ASSERT().
1363 If EndBit is less than StartBit, then ASSERT().
1365 @param Address MMIO register to write.
1366 @param StartBit The ordinal of the least significant bit in the bit field.
1368 @param EndBit The ordinal of the most significant bit in the bit field.
1370 @param AndData The value to AND with read value from the MMIO register.
1372 @return The value written back to the MMIO register.
1386 BitFieldAnd8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
)
1391 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1392 by a bitwise inclusive OR, and writes the result back to the bit field in the
1393 8-bit MMIO register.
1395 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1396 followed by a bitwise inclusive OR between the read result and the value
1397 specified by AndData, and writes the result to the 8-bit MMIO register
1398 specified by Address. The value written to the MMIO register is returned.
1399 This function must guarantee that all MMIO read and write operations are
1400 serialized. Extra left bits in both AndData and OrData are stripped.
1402 If 8-bit MMIO register operations are not supported, then ASSERT().
1403 If StartBit is greater than 7, then ASSERT().
1404 If EndBit is greater than 7, then ASSERT().
1405 If EndBit is less than StartBit, then ASSERT().
1407 @param Address MMIO register to write.
1408 @param StartBit The ordinal of the least significant bit in the bit field.
1410 @param EndBit The ordinal of the most significant bit in the bit field.
1412 @param AndData The value to AND with read value from the MMIO register.
1413 @param OrData The value to OR with the result of the AND operation.
1415 @return The value written back to the MMIO register.
1420 MmioBitFieldAndThenOr8 (
1430 BitFieldAndThenOr8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1435 Reads a 16-bit MMIO register, performs a bitwise inclusive OR, and writes the
1436 result back to the 16-bit MMIO register.
1438 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1439 inclusive OR between the read result and the value specified by OrData, and
1440 writes the result to the 16-bit MMIO register specified by Address. The value
1441 written to the MMIO register is returned. This function must guarantee that
1442 all MMIO read and write operations are serialized.
1444 If 16-bit MMIO register operations are not supported, then ASSERT().
1446 @param Address The MMIO register to write.
1447 @param OrData The value to OR with the read value from the MMIO register.
1449 @return The value written back to the MMIO register.
1459 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) | OrData
));
1463 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1464 back to the 16-bit MMIO register.
1466 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1467 between the read result and the value specified by AndData, and writes the
1468 result to the 16-bit MMIO register specified by Address. The value written to
1469 the MMIO register is returned. This function must guarantee that all MMIO
1470 read and write operations are serialized.
1472 If 16-bit MMIO register operations are not supported, then ASSERT().
1474 @param Address The MMIO register to write.
1475 @param AndData The value to AND with the read value from the MMIO register.
1477 @return The value written back to the MMIO register.
1487 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) & AndData
));
1491 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1492 inclusive OR, and writes the result back to the 16-bit MMIO register.
1494 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1495 between the read result and the value specified by AndData, performs a
1496 bitwise OR between the result of the AND operation and the value specified by
1497 OrData, and writes the result to the 16-bit MMIO register specified by
1498 Address. The value written to the MMIO register is returned. This function
1499 must guarantee that all MMIO read and write operations are serialized.
1501 If 16-bit MMIO register operations are not supported, then ASSERT().
1504 @param Address The MMIO register to write.
1505 @param AndData The value to AND with the read value from the MMIO register.
1506 @param OrData The value to OR with the result of the AND operation.
1508 @return The value written back to the MMIO register.
1519 return MmioWrite16 (Address
, (UINT16
) ((MmioRead16 (Address
) & AndData
) | OrData
));
1523 Reads a bit field of a MMIO register.
1525 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
1526 the StartBit and the EndBit. The value of the bit field is returned.
1528 If 16-bit MMIO register operations are not supported, then ASSERT().
1529 If StartBit is greater than 15, then ASSERT().
1530 If EndBit is greater than 15, then ASSERT().
1531 If EndBit is less than StartBit, then ASSERT().
1533 @param Address MMIO register to read.
1534 @param StartBit The ordinal of the least significant bit in the bit field.
1536 @param EndBit The ordinal of the most significant bit in the bit field.
1539 @return The value read.
1544 MmioBitFieldRead16 (
1550 return BitFieldRead16 (MmioRead16 (Address
), StartBit
, EndBit
);
1554 Writes a bit field to a MMIO register.
1556 Writes Value to the bit field of the MMIO register. The bit field is
1557 specified by the StartBit and the EndBit. All other bits in the destination
1558 MMIO register are preserved. The new value of the 16-bit register is returned.
1560 If 16-bit MMIO register operations are not supported, then ASSERT().
1561 If StartBit is greater than 15, then ASSERT().
1562 If EndBit is greater than 15, then ASSERT().
1563 If EndBit is less than StartBit, then ASSERT().
1565 @param Address MMIO register to write.
1566 @param StartBit The ordinal of the least significant bit in the bit field.
1568 @param EndBit The ordinal of the most significant bit in the bit field.
1570 @param Value New value of the bit field.
1572 @return The value written back to the MMIO register.
1577 MmioBitFieldWrite16 (
1584 return MmioWrite16 (
1586 BitFieldWrite16 (MmioRead16 (Address
), StartBit
, EndBit
, Value
)
1591 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
1592 writes the result back to the bit field in the 16-bit MMIO register.
1594 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1595 inclusive OR between the read result and the value specified by OrData, and
1596 writes the result to the 16-bit MMIO register specified by Address. The value
1597 written to the MMIO register is returned. This function must guarantee that
1598 all MMIO read and write operations are serialized. Extra left bits in OrData
1601 If 16-bit MMIO register operations are not supported, then ASSERT().
1602 If StartBit is greater than 15, then ASSERT().
1603 If EndBit is greater than 15, then ASSERT().
1604 If EndBit is less than StartBit, then ASSERT().
1606 @param Address MMIO register to write.
1607 @param StartBit The ordinal of the least significant bit in the bit field.
1609 @param EndBit The ordinal of the most significant bit in the bit field.
1611 @param OrData The value to OR with read value from the MMIO register.
1613 @return The value written back to the MMIO register.
1625 return MmioWrite16 (
1627 BitFieldOr16 (MmioRead16 (Address
), StartBit
, EndBit
, OrData
)
1632 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
1633 writes the result back to the bit field in the 16-bit MMIO register.
1635 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1636 between the read result and the value specified by AndData, and writes the
1637 result to the 16-bit MMIO register specified by Address. The value written to
1638 the MMIO register is returned. This function must guarantee that all MMIO
1639 read and write operations are serialized. Extra left bits in AndData are
1642 If 16-bit MMIO register operations are not supported, then ASSERT().
1643 If StartBit is greater than 15, then ASSERT().
1644 If EndBit is greater than 15, then ASSERT().
1645 If EndBit is less than StartBit, then ASSERT().
1647 @param Address MMIO register to write.
1648 @param StartBit The ordinal of the least significant bit in the bit field.
1650 @param EndBit The ordinal of the most significant bit in the bit field.
1652 @param AndData The value to AND with read value from the MMIO register.
1654 @return The value written back to the MMIO register.
1666 return MmioWrite16 (
1668 BitFieldAnd16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
)
1673 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
1674 by a bitwise inclusive OR, and writes the result back to the bit field in the
1675 16-bit MMIO register.
1677 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1678 followed by a bitwise inclusive OR between the read result and the value
1679 specified by AndData, and writes the result to the 16-bit MMIO register
1680 specified by Address. The value written to the MMIO register is returned.
1681 This function must guarantee that all MMIO read and write operations are
1682 serialized. Extra left bits in both AndData and OrData are stripped.
1684 If 16-bit MMIO register operations are not supported, then ASSERT().
1685 If StartBit is greater than 15, then ASSERT().
1686 If EndBit is greater than 15, then ASSERT().
1687 If EndBit is less than StartBit, then ASSERT().
1689 @param Address MMIO register to write.
1690 @param StartBit The ordinal of the least significant bit in the bit field.
1692 @param EndBit The ordinal of the most significant bit in the bit field.
1694 @param AndData The value to AND with read value from the MMIO register.
1695 @param OrData The value to OR with the result of the AND operation.
1697 @return The value written back to the MMIO register.
1702 MmioBitFieldAndThenOr16 (
1710 return MmioWrite16 (
1712 BitFieldAndThenOr16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1717 Reads a 32-bit MMIO register, performs a bitwise inclusive OR, and writes the
1718 result back to the 32-bit MMIO register.
1720 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1721 inclusive OR between the read result and the value specified by OrData, and
1722 writes the result to the 32-bit MMIO register specified by Address. The value
1723 written to the MMIO register is returned. This function must guarantee that
1724 all MMIO read and write operations are serialized.
1726 If 32-bit MMIO register operations are not supported, then ASSERT().
1728 @param Address The MMIO register to write.
1729 @param OrData The value to OR with the read value from the MMIO register.
1731 @return The value written back to the MMIO register.
1741 return MmioWrite32 (Address
, MmioRead32 (Address
) | OrData
);
1745 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
1746 back to the 32-bit MMIO register.
1748 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1749 between the read result and the value specified by AndData, and writes the
1750 result to the 32-bit MMIO register specified by Address. The value written to
1751 the MMIO register is returned. This function must guarantee that all MMIO
1752 read and write operations are serialized.
1754 If 32-bit MMIO register operations are not supported, then ASSERT().
1756 @param Address The MMIO register to write.
1757 @param AndData The value to AND with the read value from the MMIO register.
1759 @return The value written back to the MMIO register.
1769 return MmioWrite32 (Address
, MmioRead32 (Address
) & AndData
);
1773 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
1774 inclusive OR, and writes the result back to the 32-bit MMIO register.
1776 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1777 between the read result and the value specified by AndData, performs a
1778 bitwise OR between the result of the AND operation and the value specified by
1779 OrData, and writes the result to the 32-bit MMIO register specified by
1780 Address. The value written to the MMIO register is returned. This function
1781 must guarantee that all MMIO read and write operations are serialized.
1783 If 32-bit MMIO register operations are not supported, then ASSERT().
1786 @param Address The MMIO register to write.
1787 @param AndData The value to AND with the read value from the MMIO register.
1788 @param OrData The value to OR with the result of the AND operation.
1790 @return The value written back to the MMIO register.
1801 return MmioWrite32 (Address
, (MmioRead32 (Address
) & AndData
) | OrData
);
1805 Reads a bit field of a MMIO register.
1807 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
1808 the StartBit and the EndBit. The value of the bit field is returned.
1810 If 32-bit MMIO register operations are not supported, then ASSERT().
1811 If StartBit is greater than 31, then ASSERT().
1812 If EndBit is greater than 31, then ASSERT().
1813 If EndBit is less than StartBit, then ASSERT().
1815 @param Address MMIO register to read.
1816 @param StartBit The ordinal of the least significant bit in the bit field.
1818 @param EndBit The ordinal of the most significant bit in the bit field.
1821 @return The value read.
1826 MmioBitFieldRead32 (
1832 return BitFieldRead32 (MmioRead32 (Address
), StartBit
, EndBit
);
1836 Writes a bit field to a MMIO register.
1838 Writes Value to the bit field of the MMIO register. The bit field is
1839 specified by the StartBit and the EndBit. All other bits in the destination
1840 MMIO register are preserved. The new value of the 32-bit register is returned.
1842 If 32-bit MMIO register operations are not supported, then ASSERT().
1843 If StartBit is greater than 31, then ASSERT().
1844 If EndBit is greater than 31, then ASSERT().
1845 If EndBit is less than StartBit, then ASSERT().
1847 @param Address MMIO register to write.
1848 @param StartBit The ordinal of the least significant bit in the bit field.
1850 @param EndBit The ordinal of the most significant bit in the bit field.
1852 @param Value New value of the bit field.
1854 @return The value written back to the MMIO register.
1859 MmioBitFieldWrite32 (
1866 return MmioWrite32 (
1868 BitFieldWrite32 (MmioRead32 (Address
), StartBit
, EndBit
, Value
)
1873 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
1874 writes the result back to the bit field in the 32-bit MMIO register.
1876 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1877 inclusive OR between the read result and the value specified by OrData, and
1878 writes the result to the 32-bit MMIO register specified by Address. The value
1879 written to the MMIO register is returned. This function must guarantee that
1880 all MMIO read and write operations are serialized. Extra left bits in OrData
1883 If 32-bit MMIO register operations are not supported, then ASSERT().
1884 If StartBit is greater than 31, then ASSERT().
1885 If EndBit is greater than 31, then ASSERT().
1886 If EndBit is less than StartBit, then ASSERT().
1888 @param Address MMIO register to write.
1889 @param StartBit The ordinal of the least significant bit in the bit field.
1891 @param EndBit The ordinal of the most significant bit in the bit field.
1893 @param OrData The value to OR with read value from the MMIO register.
1895 @return The value written back to the MMIO register.
1907 return MmioWrite32 (
1909 BitFieldOr32 (MmioRead32 (Address
), StartBit
, EndBit
, OrData
)
1914 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
1915 writes the result back to the bit field in the 32-bit MMIO register.
1917 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1918 between the read result and the value specified by AndData, and writes the
1919 result to the 32-bit MMIO register specified by Address. The value written to
1920 the MMIO register is returned. This function must guarantee that all MMIO
1921 read and write operations are serialized. Extra left bits in AndData are
1924 If 32-bit MMIO register operations are not supported, then ASSERT().
1925 If StartBit is greater than 31, then ASSERT().
1926 If EndBit is greater than 31, then ASSERT().
1927 If EndBit is less than StartBit, then ASSERT().
1929 @param Address MMIO register to write.
1930 @param StartBit The ordinal of the least significant bit in the bit field.
1932 @param EndBit The ordinal of the most significant bit in the bit field.
1934 @param AndData The value to AND with read value from the MMIO register.
1936 @return The value written back to the MMIO register.
1948 return MmioWrite32 (
1950 BitFieldAnd32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
)
1955 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
1956 by a bitwise inclusive OR, and writes the result back to the bit field in the
1957 32-bit MMIO register.
1959 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1960 followed by a bitwise inclusive OR between the read result and the value
1961 specified by AndData, and writes the result to the 32-bit MMIO register
1962 specified by Address. The value written to the MMIO register is returned.
1963 This function must guarantee that all MMIO read and write operations are
1964 serialized. Extra left bits in both AndData and OrData are stripped.
1966 If 32-bit MMIO register operations are not supported, then ASSERT().
1967 If StartBit is greater than 31, then ASSERT().
1968 If EndBit is greater than 31, then ASSERT().
1969 If EndBit is less than StartBit, then ASSERT().
1971 @param Address MMIO register to write.
1972 @param StartBit The ordinal of the least significant bit in the bit field.
1974 @param EndBit The ordinal of the most significant bit in the bit field.
1976 @param AndData The value to AND with read value from the MMIO register.
1977 @param OrData The value to OR with the result of the AND operation.
1979 @return The value written back to the MMIO register.
1984 MmioBitFieldAndThenOr32 (
1992 return MmioWrite32 (
1994 BitFieldAndThenOr32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1999 Reads a 64-bit MMIO register, performs a bitwise inclusive OR, and writes the
2000 result back to the 64-bit MMIO register.
2002 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2003 inclusive OR between the read result and the value specified by OrData, and
2004 writes the result to the 64-bit MMIO register specified by Address. The value
2005 written to the MMIO register is returned. This function must guarantee that
2006 all MMIO read and write operations are serialized.
2008 If 64-bit MMIO register operations are not supported, then ASSERT().
2010 @param Address The MMIO register to write.
2011 @param OrData The value to OR with the read value from the MMIO register.
2013 @return The value written back to the MMIO register.
2023 return MmioWrite64 (Address
, MmioRead64 (Address
) | OrData
);
2027 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2028 back to the 64-bit MMIO register.
2030 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2031 between the read result and the value specified by AndData, and writes the
2032 result to the 64-bit MMIO register specified by Address. The value written to
2033 the MMIO register is returned. This function must guarantee that all MMIO
2034 read and write operations are serialized.
2036 If 64-bit MMIO register operations are not supported, then ASSERT().
2038 @param Address The MMIO register to write.
2039 @param AndData The value to AND with the read value from the MMIO register.
2041 @return The value written back to the MMIO register.
2051 return MmioWrite64 (Address
, MmioRead64 (Address
) & AndData
);
2055 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2056 inclusive OR, and writes the result back to the 64-bit MMIO register.
2058 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2059 between the read result and the value specified by AndData, performs a
2060 bitwise OR between the result of the AND operation and the value specified by
2061 OrData, and writes the result to the 64-bit MMIO register specified by
2062 Address. The value written to the MMIO register is returned. This function
2063 must guarantee that all MMIO read and write operations are serialized.
2065 If 64-bit MMIO register operations are not supported, then ASSERT().
2068 @param Address The MMIO register to write.
2069 @param AndData The value to AND with the read value from the MMIO register.
2070 @param OrData The value to OR with the result of the AND operation.
2072 @return The value written back to the MMIO register.
2083 return MmioWrite64 (Address
, (MmioRead64 (Address
) & AndData
) | OrData
);
2087 Reads a bit field of a MMIO register.
2089 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2090 the StartBit and the EndBit. The value of the bit field is returned.
2092 If 64-bit MMIO register operations are not supported, then ASSERT().
2093 If StartBit is greater than 63, then ASSERT().
2094 If EndBit is greater than 63, then ASSERT().
2095 If EndBit is less than StartBit, then ASSERT().
2097 @param Address MMIO register to read.
2098 @param StartBit The ordinal of the least significant bit in the bit field.
2100 @param EndBit The ordinal of the most significant bit in the bit field.
2103 @return The value read.
2108 MmioBitFieldRead64 (
2114 return BitFieldRead64 (MmioRead64 (Address
), StartBit
, EndBit
);
2118 Writes a bit field to a MMIO register.
2120 Writes Value to the bit field of the MMIO register. The bit field is
2121 specified by the StartBit and the EndBit. All other bits in the destination
2122 MMIO register are preserved. The new value of the 64-bit register is returned.
2124 If 64-bit MMIO register operations are not supported, then ASSERT().
2125 If StartBit is greater than 63, then ASSERT().
2126 If EndBit is greater than 63, then ASSERT().
2127 If EndBit is less than StartBit, then ASSERT().
2129 @param Address MMIO register to write.
2130 @param StartBit The ordinal of the least significant bit in the bit field.
2132 @param EndBit The ordinal of the most significant bit in the bit field.
2134 @param Value New value of the bit field.
2136 @return The value written back to the MMIO register.
2141 MmioBitFieldWrite64 (
2148 return MmioWrite64 (
2150 BitFieldWrite64 (MmioRead64 (Address
), StartBit
, EndBit
, Value
)
2155 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2156 writes the result back to the bit field in the 64-bit MMIO register.
2158 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2159 inclusive OR between the read result and the value specified by OrData, and
2160 writes the result to the 64-bit MMIO register specified by Address. The value
2161 written to the MMIO register is returned. This function must guarantee that
2162 all MMIO read and write operations are serialized. Extra left bits in OrData
2165 If 64-bit MMIO register operations are not supported, then ASSERT().
2166 If StartBit is greater than 63, then ASSERT().
2167 If EndBit is greater than 63, then ASSERT().
2168 If EndBit is less than StartBit, then ASSERT().
2170 @param Address MMIO register to write.
2171 @param StartBit The ordinal of the least significant bit in the bit field.
2173 @param EndBit The ordinal of the most significant bit in the bit field.
2175 @param OrData The value to OR with read value from the MMIO register.
2177 @return The value written back to the MMIO register.
2189 return MmioWrite64 (
2191 BitFieldOr64 (MmioRead64 (Address
), StartBit
, EndBit
, OrData
)
2196 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2197 writes the result back to the bit field in the 64-bit MMIO register.
2199 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2200 between the read result and the value specified by AndData, and writes the
2201 result to the 64-bit MMIO register specified by Address. The value written to
2202 the MMIO register is returned. This function must guarantee that all MMIO
2203 read and write operations are serialized. Extra left bits in AndData are
2206 If 64-bit MMIO register operations are not supported, then ASSERT().
2207 If StartBit is greater than 63, then ASSERT().
2208 If EndBit is greater than 63, then ASSERT().
2209 If EndBit is less than StartBit, then ASSERT().
2211 @param Address MMIO register to write.
2212 @param StartBit The ordinal of the least significant bit in the bit field.
2214 @param EndBit The ordinal of the most significant bit in the bit field.
2216 @param AndData The value to AND with read value from the MMIO register.
2218 @return The value written back to the MMIO register.
2230 return MmioWrite64 (
2232 BitFieldAnd64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
)
2237 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2238 by a bitwise inclusive OR, and writes the result back to the bit field in the
2239 64-bit MMIO register.
2241 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2242 followed by a bitwise inclusive OR between the read result and the value
2243 specified by AndData, and writes the result to the 64-bit MMIO register
2244 specified by Address. The value written to the MMIO register is returned.
2245 This function must guarantee that all MMIO read and write operations are
2246 serialized. Extra left bits in both AndData and OrData are stripped.
2248 If 64-bit MMIO register operations are not supported, then ASSERT().
2249 If StartBit is greater than 63, then ASSERT().
2250 If EndBit is greater than 63, then ASSERT().
2251 If EndBit is less than StartBit, then ASSERT().
2253 @param Address MMIO register to write.
2254 @param StartBit The ordinal of the least significant bit in the bit field.
2256 @param EndBit The ordinal of the most significant bit in the bit field.
2258 @param AndData The value to AND with read value from the MMIO register.
2259 @param OrData The value to OR with the result of the AND operation.
2261 @return The value written back to the MMIO register.
2266 MmioBitFieldAndThenOr64 (
2274 return MmioWrite64 (
2276 BitFieldAndThenOr64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
, OrData
)