]>
git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Library/DxeIoLibCpuIo/IoHighLevel.c
53352c19e73d7b7afde3491b18463fc64616b882
2 High-level Io/Mmio functions.
4 All assertions for bit field operations are handled bit field functions in the
7 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
10 Module Name: IoHighLevel.c
12 The following IoLib instances share the same version of this file:
21 #include "DxeCpuIoLibInternal.h"
24 Reads an 8-bit I/O port, performs a bitwise OR, and writes the
25 result back to the 8-bit I/O port.
27 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
28 between the read result and the value specified by OrData, and writes the
29 result to the 8-bit I/O port specified by Port. The value written to the I/O
30 port is returned. This function must guarantee that all I/O read and write
31 operations are serialized.
33 If 8-bit I/O port operations are not supported, then ASSERT().
35 @param Port The I/O port to write.
36 @param OrData The value to OR with the read value from the I/O port.
38 @return The value written back to the I/O port.
48 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) | OrData
));
52 Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
53 to the 8-bit I/O port.
55 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
56 the read result and the value specified by AndData, and writes the result to
57 the 8-bit I/O port specified by Port. The value written to the I/O port is
58 returned. This function must guarantee that all I/O read and write operations
61 If 8-bit I/O port operations are not supported, then ASSERT().
63 @param Port The I/O port to write.
64 @param AndData The value to AND with the read value from the I/O port.
66 @return The value written back to the I/O port.
76 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) & AndData
));
80 Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
81 inclusive OR, and writes the result back to the 8-bit I/O port.
83 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
84 the read result and the value specified by AndData, performs a bitwise OR
85 between the result of the AND operation and the value specified by OrData,
86 and writes the result to the 8-bit I/O port specified by Port. The value
87 written to the I/O port is returned. This function must guarantee that all
88 I/O read and write operations are serialized.
90 If 8-bit I/O port operations are not supported, then ASSERT().
92 @param Port The I/O port to write.
93 @param AndData The value to AND with the read value from the I/O port.
94 @param OrData The value to OR with the result of the AND operation.
96 @return The value written back to the I/O port.
107 return IoWrite8 (Port
, (UINT8
) ((IoRead8 (Port
) & AndData
) | OrData
));
111 Reads a bit field of an I/O register.
113 Reads the bit field in an 8-bit I/O register. The bit field is specified by
114 the StartBit and the EndBit. The value of the bit field is returned.
116 If 8-bit I/O port operations are not supported, then ASSERT().
117 If StartBit is greater than 7, then ASSERT().
118 If EndBit is greater than 7, then ASSERT().
119 If EndBit is less than StartBit, then ASSERT().
121 @param Port The I/O port to read.
122 @param StartBit The ordinal of the least significant bit in the bit field.
124 @param EndBit The ordinal of the most significant bit in the bit field.
127 @return The value read.
138 return BitFieldRead8 (IoRead8 (Port
), StartBit
, EndBit
);
142 Writes a bit field to an I/O register.
144 Writes Value to the bit field of the I/O register. The bit field is specified
145 by the StartBit and the EndBit. All other bits in the destination I/O
146 register are preserved. The value written to the I/O port is returned. Extra
147 left bits in Value are stripped.
149 If 8-bit I/O port operations are not supported, then ASSERT().
150 If StartBit is greater than 7, then ASSERT().
151 If EndBit is greater than 7, then ASSERT().
152 If EndBit is less than StartBit, then ASSERT().
153 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
155 @param Port The I/O port to write.
156 @param StartBit The ordinal of the least significant bit in the bit field.
158 @param EndBit The ordinal of the most significant bit in the bit field.
160 @param Value New value of the bit field.
162 @return The value written back to the I/O port.
176 BitFieldWrite8 (IoRead8 (Port
), StartBit
, EndBit
, Value
)
181 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
182 result back to the bit field in the 8-bit port.
184 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
185 between the read result and the value specified by OrData, and writes the
186 result to the 8-bit I/O port specified by Port. The value written to the I/O
187 port is returned. This function must guarantee that all I/O read and write
188 operations are serialized. Extra left bits in OrData are stripped.
190 If 8-bit I/O port operations are not supported, then ASSERT().
191 If StartBit is greater than 7, then ASSERT().
192 If EndBit is greater than 7, then ASSERT().
193 If EndBit is less than StartBit, then ASSERT().
194 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
196 @param Port The I/O port to write.
197 @param StartBit The ordinal of the least significant bit in the bit field.
199 @param EndBit The ordinal of the most significant bit in the bit field.
201 @param OrData The value to OR with the read value from the I/O port.
203 @return The value written back to the I/O port.
217 BitFieldOr8 (IoRead8 (Port
), StartBit
, EndBit
, OrData
)
222 Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
223 result back to the bit field in the 8-bit port.
225 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
226 the read result and the value specified by AndData, and writes the result to
227 the 8-bit I/O port specified by Port. The value written to the I/O port is
228 returned. This function must guarantee that all I/O read and write operations
229 are serialized. Extra left bits in AndData are stripped.
231 If 8-bit I/O port operations are not supported, then ASSERT().
232 If StartBit is greater than 7, then ASSERT().
233 If EndBit is greater than 7, then ASSERT().
234 If EndBit is less than StartBit, then ASSERT().
235 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
237 @param Port The I/O port to write.
238 @param StartBit The ordinal of the least significant bit in the bit field.
240 @param EndBit The ordinal of the most significant bit in the bit field.
242 @param AndData The value to AND with the read value from the I/O port.
244 @return The value written back to the I/O port.
258 BitFieldAnd8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
)
263 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
264 bitwise OR, and writes the result back to the bit field in the
267 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
268 by a bitwise OR between the read result and the value specified by
269 AndData, and writes the result to the 8-bit I/O port specified by Port. The
270 value written to the I/O port is returned. This function must guarantee that
271 all I/O read and write operations are serialized. Extra left bits in both
272 AndData and OrData are stripped.
274 If 8-bit I/O port operations are not supported, then ASSERT().
275 If StartBit is greater than 7, then ASSERT().
276 If EndBit is greater than 7, then ASSERT().
277 If EndBit is less than StartBit, then ASSERT().
278 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
279 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
281 @param Port The I/O port to write.
282 @param StartBit The ordinal of the least significant bit in the bit field.
284 @param EndBit The ordinal of the most significant bit in the bit field.
286 @param AndData The value to AND with the read value from the I/O port.
287 @param OrData The value to OR with the result of the AND operation.
289 @return The value written back to the I/O port.
294 IoBitFieldAndThenOr8 (
304 BitFieldAndThenOr8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
, OrData
)
309 Reads a 16-bit I/O port, performs a bitwise OR, and writes the
310 result back to the 16-bit I/O port.
312 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
313 between the read result and the value specified by OrData, and writes the
314 result to the 16-bit I/O port specified by Port. The value written to the I/O
315 port is returned. This function must guarantee that all I/O read and write
316 operations are serialized.
318 If 16-bit I/O port operations are not supported, then ASSERT().
320 @param Port The I/O port to write.
321 @param OrData The value to OR with the read value from the I/O port.
323 @return The value written back to the I/O port.
333 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) | OrData
));
337 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
338 to the 16-bit I/O port.
340 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
341 the read result and the value specified by AndData, and writes the result to
342 the 16-bit I/O port specified by Port. The value written to the I/O port is
343 returned. This function must guarantee that all I/O read and write operations
346 If 16-bit I/O port operations are not supported, then ASSERT().
348 @param Port The I/O port to write.
349 @param AndData The value to AND with the read value from the I/O port.
351 @return The value written back to the I/O port.
361 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) & AndData
));
365 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
366 inclusive OR, and writes the result back to the 16-bit I/O port.
368 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
369 the read result and the value specified by AndData, performs a bitwise OR
370 between the result of the AND operation and the value specified by OrData,
371 and writes the result to the 16-bit I/O port specified by Port. The value
372 written to the I/O port is returned. This function must guarantee that all
373 I/O read and write operations are serialized.
375 If 16-bit I/O port operations are not supported, then ASSERT().
377 @param Port The I/O port to write.
378 @param AndData The value to AND with the read value from the I/O port.
379 @param OrData The value to OR with the result of the AND operation.
381 @return The value written back to the I/O port.
392 return IoWrite16 (Port
, (UINT16
) ((IoRead16 (Port
) & AndData
) | OrData
));
396 Reads a bit field of an I/O register.
398 Reads the bit field in a 16-bit I/O register. The bit field is specified by
399 the StartBit and the EndBit. The value of the bit field is returned.
401 If 16-bit I/O port operations are not supported, then ASSERT().
402 If StartBit is greater than 15, then ASSERT().
403 If EndBit is greater than 15, then ASSERT().
404 If EndBit is less than StartBit, then ASSERT().
406 @param Port The I/O port to read.
407 @param StartBit The ordinal of the least significant bit in the bit field.
409 @param EndBit The ordinal of the most significant bit in the bit field.
412 @return The value read.
423 return BitFieldRead16 (IoRead16 (Port
), StartBit
, EndBit
);
427 Writes a bit field to an I/O register.
429 Writes Value to the bit field of the I/O register. The bit field is specified
430 by the StartBit and the EndBit. All other bits in the destination I/O
431 register are preserved. The value written to the I/O port is returned. Extra
432 left bits in Value are stripped.
434 If 16-bit I/O port operations are not supported, then ASSERT().
435 If StartBit is greater than 15, then ASSERT().
436 If EndBit is greater than 15, then ASSERT().
437 If EndBit is less than StartBit, then ASSERT().
438 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
440 @param Port The I/O port to write.
441 @param StartBit The ordinal of the least significant bit in the bit field.
443 @param EndBit The ordinal of the most significant bit in the bit field.
445 @param Value New value of the bit field.
447 @return The value written back to the I/O port.
461 BitFieldWrite16 (IoRead16 (Port
), StartBit
, EndBit
, Value
)
466 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
467 result back to the bit field in the 16-bit port.
469 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
470 between the read result and the value specified by OrData, and writes the
471 result to the 16-bit I/O port specified by Port. The value written to the I/O
472 port is returned. This function must guarantee that all I/O read and write
473 operations are serialized. Extra left bits in OrData are stripped.
475 If 16-bit I/O port operations are not supported, then ASSERT().
476 If StartBit is greater than 15, then ASSERT().
477 If EndBit is greater than 15, then ASSERT().
478 If EndBit is less than StartBit, then ASSERT().
479 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
481 @param Port The I/O port to write.
482 @param StartBit The ordinal of the least significant bit in the bit field.
484 @param EndBit The ordinal of the most significant bit in the bit field.
486 @param OrData The value to OR with the read value from the I/O port.
488 @return The value written back to the I/O port.
502 BitFieldOr16 (IoRead16 (Port
), StartBit
, EndBit
, OrData
)
507 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
508 result back to the bit field in the 16-bit port.
510 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
511 the read result and the value specified by AndData, and writes the result to
512 the 16-bit I/O port specified by Port. The value written to the I/O port is
513 returned. This function must guarantee that all I/O read and write operations
514 are serialized. Extra left bits in AndData are stripped.
516 If 16-bit I/O port operations are not supported, then ASSERT().
517 If StartBit is greater than 15, then ASSERT().
518 If EndBit is greater than 15, then ASSERT().
519 If EndBit is less than StartBit, then ASSERT().
520 If AndData is larger than the bitmask value range specified by StartBit and EndBit, 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 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 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().
563 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
564 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
566 @param Port The I/O port to write.
567 @param StartBit The ordinal of the least significant bit in the bit field.
569 @param EndBit The ordinal of the most significant bit in the bit field.
571 @param AndData The value to AND with the read value from the I/O port.
572 @param OrData The value to OR with the result of the AND operation.
574 @return The value written back to the I/O port.
579 IoBitFieldAndThenOr16 (
589 BitFieldAndThenOr16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
, OrData
)
594 Reads a 32-bit I/O port, performs a bitwise OR, and writes the
595 result back to the 32-bit I/O port.
597 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
598 between the read result and the value specified by OrData, and writes the
599 result to the 32-bit I/O port specified by Port. The value written to the I/O
600 port is returned. This function must guarantee that all I/O read and write
601 operations are serialized.
603 If 32-bit I/O port operations are not supported, then ASSERT().
605 @param Port The I/O port to write.
606 @param OrData The value to OR with the read value from the I/O port.
608 @return The value written back to the I/O port.
618 return IoWrite32 (Port
, IoRead32 (Port
) | OrData
);
622 Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
623 to the 32-bit I/O port.
625 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
626 the read result and the value specified by AndData, and writes the result to
627 the 32-bit I/O port specified by Port. The value written to the I/O port is
628 returned. This function must guarantee that all I/O read and write operations
631 If 32-bit I/O port operations are not supported, then ASSERT().
633 @param Port The I/O port to write.
634 @param AndData The value to AND with the read value from the I/O port.
636 @return The value written back to the I/O port.
646 return IoWrite32 (Port
, IoRead32 (Port
) & AndData
);
650 Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
651 inclusive OR, and writes the result back to the 32-bit I/O port.
653 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
654 the read result and the value specified by AndData, performs a bitwise OR
655 between the result of the AND operation and the value specified by OrData,
656 and writes the result to the 32-bit I/O port specified by Port. The value
657 written to the I/O port is returned. This function must guarantee that all
658 I/O read and write operations are serialized.
660 If 32-bit I/O port operations are not supported, then ASSERT().
662 @param Port The I/O port to write.
663 @param AndData The value to AND with the read value from the I/O port.
664 @param OrData The value to OR with the result of the AND operation.
666 @return The value written back to the I/O port.
677 return IoWrite32 (Port
, (IoRead32 (Port
) & AndData
) | OrData
);
681 Reads a bit field of an I/O register.
683 Reads the bit field in a 32-bit I/O register. The bit field is specified by
684 the StartBit and the EndBit. The value of the bit field is returned.
686 If 32-bit I/O port operations are not supported, then ASSERT().
687 If StartBit is greater than 31, then ASSERT().
688 If EndBit is greater than 31, then ASSERT().
689 If EndBit is less than StartBit, then ASSERT().
691 @param Port The I/O port to read.
692 @param StartBit The ordinal of the least significant bit in the bit field.
694 @param EndBit The ordinal of the most significant bit in the bit field.
697 @return The value read.
708 return BitFieldRead32 (IoRead32 (Port
), StartBit
, EndBit
);
712 Writes a bit field to an I/O register.
714 Writes Value to the bit field of the I/O register. The bit field is specified
715 by the StartBit and the EndBit. All other bits in the destination I/O
716 register are preserved. The value written to the I/O port is returned. Extra
717 left bits in Value are stripped.
719 If 32-bit I/O port operations are not supported, then ASSERT().
720 If StartBit is greater than 31, then ASSERT().
721 If EndBit is greater than 31, then ASSERT().
722 If EndBit is less than StartBit, then ASSERT().
723 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
725 @param Port The I/O port to write.
726 @param StartBit The ordinal of the least significant bit in the bit field.
728 @param EndBit The ordinal of the most significant bit in the bit field.
730 @param Value New value of the bit field.
732 @return The value written back to the I/O port.
746 BitFieldWrite32 (IoRead32 (Port
), StartBit
, EndBit
, Value
)
751 Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the
752 result back to the bit field in the 32-bit port.
754 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
755 between the read result and the value specified by OrData, and writes the
756 result to the 32-bit I/O port specified by Port. The value written to the I/O
757 port is returned. This function must guarantee that all I/O read and write
758 operations are serialized. Extra left bits in OrData are stripped.
760 If 32-bit I/O port operations are not supported, then ASSERT().
761 If StartBit is greater than 31, then ASSERT().
762 If EndBit is greater than 31, then ASSERT().
763 If EndBit is less than StartBit, then ASSERT().
764 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
766 @param Port The I/O port to write.
767 @param StartBit The ordinal of the least significant bit in the bit field.
769 @param EndBit The ordinal of the most significant bit in the bit field.
771 @param OrData The value to OR with the read value from the I/O port.
773 @return The value written back to the I/O port.
787 BitFieldOr32 (IoRead32 (Port
), StartBit
, EndBit
, OrData
)
792 Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
793 result back to the bit field in the 32-bit port.
795 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
796 the read result and the value specified by AndData, and writes the result to
797 the 32-bit I/O port specified by Port. The value written to the I/O port is
798 returned. This function must guarantee that all I/O read and write operations
799 are serialized. Extra left bits in AndData are stripped.
801 If 32-bit I/O port operations are not supported, then ASSERT().
802 If StartBit is greater than 31, then ASSERT().
803 If EndBit is greater than 31, then ASSERT().
804 If EndBit is less than StartBit, then ASSERT().
805 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
807 @param Port The I/O port to write.
808 @param StartBit The ordinal of the least significant bit in the bit field.
810 @param EndBit The ordinal of the most significant bit in the bit field.
812 @param AndData The value to AND with the read value from the I/O port.
814 @return The value written back to the I/O port.
828 BitFieldAnd32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
)
833 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
834 bitwise OR, and writes the result back to the bit field in the
837 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
838 by a bitwise OR between the read result and the value specified by
839 AndData, and writes the result to the 32-bit I/O port specified by Port. The
840 value written to the I/O port is returned. This function must guarantee that
841 all I/O read and write operations are serialized. Extra left bits in both
842 AndData and OrData are stripped.
844 If 32-bit I/O port operations are not supported, then ASSERT().
845 If StartBit is greater than 31, then ASSERT().
846 If EndBit is greater than 31, then ASSERT().
847 If EndBit is less than StartBit, then ASSERT().
848 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
849 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
851 @param Port The I/O port to write.
852 @param StartBit The ordinal of the least significant bit in the bit field.
854 @param EndBit The ordinal of the most significant bit in the bit field.
856 @param AndData The value to AND with the read value from the I/O port.
857 @param OrData The value to OR with the result of the AND operation.
859 @return The value written back to the I/O port.
864 IoBitFieldAndThenOr32 (
874 BitFieldAndThenOr32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
, OrData
)
879 Reads a 64-bit I/O port, performs a bitwise OR, and writes the
880 result back to the 64-bit I/O port.
882 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
883 between the read result and the value specified by OrData, and writes the
884 result to the 64-bit I/O port specified by Port. The value written to the I/O
885 port is returned. This function must guarantee that all I/O read and write
886 operations are serialized.
888 If 64-bit I/O port operations are not supported, then ASSERT().
890 @param Port The I/O port to write.
891 @param OrData The value to OR with the read value from the I/O port.
893 @return The value written back to the I/O port.
903 return IoWrite64 (Port
, IoRead64 (Port
) | OrData
);
907 Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
908 to the 64-bit I/O port.
910 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
911 the read result and the value specified by AndData, and writes the result to
912 the 64-bit I/O port specified by Port. The value written to the I/O port is
913 returned. This function must guarantee that all I/O read and write operations
916 If 64-bit I/O port operations are not supported, then ASSERT().
918 @param Port The I/O port to write.
919 @param AndData The value to AND with the read value from the I/O port.
921 @return The value written back to the I/O port.
931 return IoWrite64 (Port
, IoRead64 (Port
) & AndData
);
935 Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
936 inclusive OR, and writes the result back to the 64-bit I/O port.
938 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
939 the read result and the value specified by AndData, performs a bitwise OR
940 between the result of the AND operation and the value specified by OrData,
941 and writes the result to the 64-bit I/O port specified by Port. The value
942 written to the I/O port is returned. This function must guarantee that all
943 I/O read and write operations are serialized.
945 If 64-bit I/O port operations are not supported, then ASSERT().
947 @param Port The I/O port to write.
948 @param AndData The value to AND with the read value from the I/O port.
949 @param OrData The value to OR with the result of the AND operation.
951 @return The value written back to the I/O port.
962 return IoWrite64 (Port
, (IoRead64 (Port
) & AndData
) | OrData
);
966 Reads a bit field of an I/O register.
968 Reads the bit field in a 64-bit I/O register. The bit field is specified by
969 the StartBit and the EndBit. The value of the bit field is returned.
971 If 64-bit I/O port operations are not supported, then ASSERT().
972 If StartBit is greater than 63, then ASSERT().
973 If EndBit is greater than 63, then ASSERT().
974 If EndBit is less than StartBit, then ASSERT().
976 @param Port The I/O port to read.
977 @param StartBit The ordinal of the least significant bit in the bit field.
979 @param EndBit The ordinal of the most significant bit in the bit field.
982 @return The value read.
993 return BitFieldRead64 (IoRead64 (Port
), StartBit
, EndBit
);
997 Writes a bit field to an I/O register.
999 Writes Value to the bit field of the I/O register. The bit field is specified
1000 by the StartBit and the EndBit. All other bits in the destination I/O
1001 register are preserved. The value written to the I/O port is returned. Extra
1002 left bits in Value are stripped.
1004 If 64-bit I/O port operations are not supported, then ASSERT().
1005 If StartBit is greater than 63, then ASSERT().
1006 If EndBit is greater than 63, then ASSERT().
1007 If EndBit is less than StartBit, then ASSERT().
1008 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1010 @param Port The I/O port to write.
1011 @param StartBit The ordinal of the least significant bit in the bit field.
1013 @param EndBit The ordinal of the most significant bit in the bit field.
1015 @param Value New value of the bit field.
1017 @return The value written back to the I/O port.
1031 BitFieldWrite64 (IoRead64 (Port
), StartBit
, EndBit
, Value
)
1036 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1037 result back to the bit field in the 64-bit port.
1039 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
1040 between the read result and the value specified by OrData, and writes the
1041 result to the 64-bit I/O port specified by Port. The value written to the I/O
1042 port is returned. This function must guarantee that all I/O read and write
1043 operations are serialized. Extra left bits in OrData are stripped.
1045 If 64-bit I/O port operations are not supported, then ASSERT().
1046 If StartBit is greater than 63, then ASSERT().
1047 If EndBit is greater than 63, then ASSERT().
1048 If EndBit is less than StartBit, then ASSERT().
1049 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1051 @param Port The I/O port to write.
1052 @param StartBit The ordinal of the least significant bit in the bit field.
1054 @param EndBit The ordinal of the most significant bit in the bit field.
1056 @param OrData The value to OR with the read value from the I/O port.
1058 @return The value written back to the I/O port.
1072 BitFieldOr64 (IoRead64 (Port
), StartBit
, EndBit
, OrData
)
1077 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1078 result back to the bit field in the 64-bit port.
1080 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1081 the read result and the value specified by AndData, and writes the result to
1082 the 64-bit I/O port specified by Port. The value written to the I/O port is
1083 returned. This function must guarantee that all I/O read and write operations
1084 are serialized. Extra left bits in AndData are stripped.
1086 If 64-bit I/O port operations are not supported, then ASSERT().
1087 If StartBit is greater than 63, then ASSERT().
1088 If EndBit is greater than 63, then ASSERT().
1089 If EndBit is less than StartBit, then ASSERT().
1090 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1092 @param Port The I/O port to write.
1093 @param StartBit The ordinal of the least significant bit in the bit field.
1095 @param EndBit The ordinal of the most significant bit in the bit field.
1097 @param AndData The value to AND with the read value from the I/O port.
1099 @return The value written back to the I/O port.
1113 BitFieldAnd64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
)
1118 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
1119 bitwise OR, and writes the result back to the bit field in the
1122 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
1123 by a bitwise OR between the read result and the value specified by
1124 AndData, and writes the result to the 64-bit I/O port specified by Port. The
1125 value written to the I/O port is returned. This function must guarantee that
1126 all I/O read and write operations are serialized. Extra left bits in both
1127 AndData and OrData are stripped.
1129 If 64-bit I/O port operations are not supported, then ASSERT().
1130 If StartBit is greater than 63, then ASSERT().
1131 If EndBit is greater than 63, then ASSERT().
1132 If EndBit is less than StartBit, then ASSERT().
1133 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1134 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1136 @param Port The I/O port to write.
1137 @param StartBit The ordinal of the least significant bit in the bit field.
1139 @param EndBit The ordinal of the most significant bit in the bit field.
1141 @param AndData The value to AND with the read value from the I/O port.
1142 @param OrData The value to OR with the result of the AND operation.
1144 @return The value written back to the I/O port.
1149 IoBitFieldAndThenOr64 (
1159 BitFieldAndThenOr64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
, OrData
)
1164 Reads an 8-bit MMIO register, performs a bitwise OR, and writes the
1165 result back to the 8-bit MMIO register.
1167 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1168 inclusive OR between the read result and the value specified by OrData, and
1169 writes the result to the 8-bit MMIO register specified by Address. The value
1170 written to the MMIO register is returned. This function must guarantee that
1171 all MMIO read and write operations are serialized.
1173 If 8-bit MMIO register operations are not supported, then ASSERT().
1175 @param Address The MMIO register to write.
1176 @param OrData The value to OR with the read value from the MMIO register.
1178 @return The value written back to the MMIO register.
1188 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) | OrData
));
1192 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1193 back to the 8-bit MMIO register.
1195 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1196 between the read result and the value specified by AndData, and writes the
1197 result to the 8-bit MMIO register specified by Address. The value written to
1198 the MMIO register is returned. This function must guarantee that all MMIO
1199 read and write operations are serialized.
1201 If 8-bit MMIO register operations are not supported, then ASSERT().
1203 @param Address The MMIO register to write.
1204 @param AndData The value to AND with the read value from the MMIO register.
1206 @return The value written back to the MMIO register.
1216 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) & AndData
));
1220 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1221 inclusive OR, and writes the result back to the 8-bit MMIO register.
1223 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1224 between the read result and the value specified by AndData, performs a
1225 bitwise OR between the result of the AND operation and the value specified by
1226 OrData, and writes the result to the 8-bit MMIO register specified by
1227 Address. The value written to the MMIO register is returned. This function
1228 must guarantee that all MMIO read and write operations are serialized.
1230 If 8-bit MMIO register operations are not supported, then ASSERT().
1233 @param Address The MMIO register to write.
1234 @param AndData The value to AND with the read value from the MMIO register.
1235 @param OrData The value to OR with the result of the AND operation.
1237 @return The value written back to the MMIO register.
1248 return MmioWrite8 (Address
, (UINT8
) ((MmioRead8 (Address
) & AndData
) | OrData
));
1252 Reads a bit field of a MMIO register.
1254 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1255 the StartBit and the EndBit. The value of the bit field is returned.
1257 If 8-bit MMIO register operations are not supported, then ASSERT().
1258 If StartBit is greater than 7, then ASSERT().
1259 If EndBit is greater than 7, then ASSERT().
1260 If EndBit is less than StartBit, then ASSERT().
1262 @param Address MMIO register to read.
1263 @param StartBit The ordinal of the least significant bit in the bit field.
1265 @param EndBit The ordinal of the most significant bit in the bit field.
1268 @return The value read.
1279 return BitFieldRead8 (MmioRead8 (Address
), StartBit
, EndBit
);
1283 Writes a bit field to a MMIO register.
1285 Writes Value to the bit field of the MMIO register. The bit field is
1286 specified by the StartBit and the EndBit. All other bits in the destination
1287 MMIO register are preserved. The new value of the 8-bit register is returned.
1289 If 8-bit MMIO register operations are not supported, then ASSERT().
1290 If StartBit is greater than 7, then ASSERT().
1291 If EndBit is greater than 7, then ASSERT().
1292 If EndBit is less than StartBit, then ASSERT().
1293 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1295 @param Address MMIO register to write.
1296 @param StartBit The ordinal of the least significant bit in the bit field.
1298 @param EndBit The ordinal of the most significant bit in the bit field.
1300 @param Value New value of the bit field.
1302 @return The value written back to the MMIO register.
1307 MmioBitFieldWrite8 (
1316 BitFieldWrite8 (MmioRead8 (Address
), StartBit
, EndBit
, Value
)
1321 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1322 writes the result back to the bit field in the 8-bit MMIO register.
1324 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1325 inclusive OR between the read result and the value specified by OrData, and
1326 writes the result to the 8-bit MMIO register specified by Address. The value
1327 written to the MMIO register is returned. This function must guarantee that
1328 all MMIO read and write operations are serialized. Extra left bits in OrData
1331 If 8-bit MMIO register operations are not supported, then ASSERT().
1332 If StartBit is greater than 7, then ASSERT().
1333 If EndBit is greater than 7, then ASSERT().
1334 If EndBit is less than StartBit, then ASSERT().
1335 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1337 @param Address MMIO register to write.
1338 @param StartBit The ordinal of the least significant bit in the bit field.
1340 @param EndBit The ordinal of the most significant bit in the bit field.
1342 @param OrData The value to OR with read value from the MMIO register.
1344 @return The value written back to the MMIO register.
1358 BitFieldOr8 (MmioRead8 (Address
), StartBit
, EndBit
, OrData
)
1363 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1364 writes the result back to the bit field in the 8-bit MMIO register.
1366 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1367 between the read result and the value specified by AndData, and writes the
1368 result to the 8-bit MMIO register specified by Address. The value written to
1369 the MMIO register is returned. This function must guarantee that all MMIO
1370 read and write operations are serialized. Extra left bits in AndData are
1373 If 8-bit MMIO register operations are not supported, then ASSERT().
1374 If StartBit is greater than 7, then ASSERT().
1375 If EndBit is greater than 7, then ASSERT().
1376 If EndBit is less than StartBit, then ASSERT().
1377 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1379 @param Address MMIO register to write.
1380 @param StartBit The ordinal of the least significant bit in the bit field.
1382 @param EndBit The ordinal of the most significant bit in the bit field.
1384 @param AndData The value to AND with read value from the MMIO register.
1386 @return The value written back to the MMIO register.
1400 BitFieldAnd8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
)
1405 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1406 by a bitwise OR, and writes the result back to the bit field in the
1407 8-bit MMIO register.
1409 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1410 followed by a bitwise OR between the read result and the value
1411 specified by AndData, and writes the result to the 8-bit MMIO register
1412 specified by Address. The value written to the MMIO register is returned.
1413 This function must guarantee that all MMIO read and write operations are
1414 serialized. Extra left bits in both AndData and OrData are stripped.
1416 If 8-bit MMIO register operations are not supported, then ASSERT().
1417 If StartBit is greater than 7, then ASSERT().
1418 If EndBit is greater than 7, then ASSERT().
1419 If EndBit is less than StartBit, then ASSERT().
1420 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1421 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1423 @param Address MMIO register to write.
1424 @param StartBit The ordinal of the least significant bit in the bit field.
1426 @param EndBit The ordinal of the most significant bit in the bit field.
1428 @param AndData The value to AND with read value from the MMIO register.
1429 @param OrData The value to OR with the result of the AND operation.
1431 @return The value written back to the MMIO register.
1436 MmioBitFieldAndThenOr8 (
1446 BitFieldAndThenOr8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1451 Reads a 16-bit MMIO register, performs a bitwise OR, and writes the
1452 result back to the 16-bit MMIO register.
1454 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1455 inclusive OR between the read result and the value specified by OrData, and
1456 writes the result to the 16-bit MMIO register specified by Address. The value
1457 written to the MMIO register is returned. This function must guarantee that
1458 all MMIO read and write operations are serialized.
1460 If 16-bit MMIO register operations are not supported, then ASSERT().
1462 @param Address The MMIO register to write.
1463 @param OrData The value to OR with the read value from the MMIO register.
1465 @return The value written back to the MMIO register.
1475 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) | OrData
));
1479 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1480 back to the 16-bit MMIO register.
1482 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1483 between the read result and the value specified by AndData, and writes the
1484 result to the 16-bit MMIO register specified by Address. The value written to
1485 the MMIO register is returned. This function must guarantee that all MMIO
1486 read and write operations are serialized.
1488 If 16-bit MMIO register operations are not supported, then ASSERT().
1490 @param Address The MMIO register to write.
1491 @param AndData The value to AND with the read value from the MMIO register.
1493 @return The value written back to the MMIO register.
1503 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) & AndData
));
1507 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1508 inclusive OR, and writes the result back to the 16-bit MMIO register.
1510 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1511 between the read result and the value specified by AndData, performs a
1512 bitwise OR between the result of the AND operation and the value specified by
1513 OrData, and writes the result to the 16-bit MMIO register specified by
1514 Address. The value written to the MMIO register is returned. This function
1515 must guarantee that all MMIO read and write operations are serialized.
1517 If 16-bit MMIO register operations are not supported, then ASSERT().
1520 @param Address The MMIO register to write.
1521 @param AndData The value to AND with the read value from the MMIO register.
1522 @param OrData The value to OR with the result of the AND operation.
1524 @return The value written back to the MMIO register.
1535 return MmioWrite16 (Address
, (UINT16
) ((MmioRead16 (Address
) & AndData
) | OrData
));
1539 Reads a bit field of a MMIO register.
1541 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
1542 the StartBit and the EndBit. The value of the bit field is returned.
1544 If 16-bit MMIO register operations are not supported, then ASSERT().
1545 If StartBit is greater than 15, then ASSERT().
1546 If EndBit is greater than 15, then ASSERT().
1547 If EndBit is less than StartBit, then ASSERT().
1549 @param Address MMIO register to read.
1550 @param StartBit The ordinal of the least significant bit in the bit field.
1552 @param EndBit The ordinal of the most significant bit in the bit field.
1555 @return The value read.
1560 MmioBitFieldRead16 (
1566 return BitFieldRead16 (MmioRead16 (Address
), StartBit
, EndBit
);
1570 Writes a bit field to a MMIO register.
1572 Writes Value to the bit field of the MMIO register. The bit field is
1573 specified by the StartBit and the EndBit. All other bits in the destination
1574 MMIO register are preserved. The new value of the 16-bit register is returned.
1576 If 16-bit MMIO register operations are not supported, then ASSERT().
1577 If StartBit is greater than 15, then ASSERT().
1578 If EndBit is greater than 15, then ASSERT().
1579 If EndBit is less than StartBit, then ASSERT().
1580 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1582 @param Address MMIO register to write.
1583 @param StartBit The ordinal of the least significant bit in the bit field.
1585 @param EndBit The ordinal of the most significant bit in the bit field.
1587 @param Value New value of the bit field.
1589 @return The value written back to the MMIO register.
1594 MmioBitFieldWrite16 (
1601 return MmioWrite16 (
1603 BitFieldWrite16 (MmioRead16 (Address
), StartBit
, EndBit
, Value
)
1608 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
1609 writes the result back to the bit field in the 16-bit MMIO register.
1611 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1612 inclusive OR between the read result and the value specified by OrData, and
1613 writes the result to the 16-bit MMIO register specified by Address. The value
1614 written to the MMIO register is returned. This function must guarantee that
1615 all MMIO read and write operations are serialized. Extra left bits in OrData
1618 If 16-bit MMIO register operations are not supported, then ASSERT().
1619 If StartBit is greater than 15, then ASSERT().
1620 If EndBit is greater than 15, then ASSERT().
1621 If EndBit is less than StartBit, then ASSERT().
1622 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1624 @param Address MMIO register to write.
1625 @param StartBit The ordinal of the least significant bit in the bit field.
1627 @param EndBit The ordinal of the most significant bit in the bit field.
1629 @param OrData The value to OR with read value from the MMIO register.
1631 @return The value written back to the MMIO register.
1643 return MmioWrite16 (
1645 BitFieldOr16 (MmioRead16 (Address
), StartBit
, EndBit
, OrData
)
1650 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
1651 writes the result back to the bit field in the 16-bit MMIO register.
1653 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1654 between the read result and the value specified by AndData, and writes the
1655 result to the 16-bit MMIO register specified by Address. The value written to
1656 the MMIO register is returned. This function must guarantee that all MMIO
1657 read and write operations are serialized. Extra left bits in AndData are
1660 If 16-bit MMIO register operations are not supported, then ASSERT().
1661 If StartBit is greater than 15, then ASSERT().
1662 If EndBit is greater than 15, then ASSERT().
1663 If EndBit is less than StartBit, then ASSERT().
1664 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1666 @param Address MMIO register to write.
1667 @param StartBit The ordinal of the least significant bit in the bit field.
1669 @param EndBit The ordinal of the most significant bit in the bit field.
1671 @param AndData The value to AND with read value from the MMIO register.
1673 @return The value written back to the MMIO register.
1685 return MmioWrite16 (
1687 BitFieldAnd16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
)
1692 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
1693 by a bitwise OR, and writes the result back to the bit field in the
1694 16-bit MMIO register.
1696 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1697 followed by a bitwise OR between the read result and the value
1698 specified by AndData, and writes the result to the 16-bit MMIO register
1699 specified by Address. The value written to the MMIO register is returned.
1700 This function must guarantee that all MMIO read and write operations are
1701 serialized. Extra left bits in both AndData and OrData are stripped.
1703 If 16-bit MMIO register operations are not supported, then ASSERT().
1704 If StartBit is greater than 15, then ASSERT().
1705 If EndBit is greater than 15, then ASSERT().
1706 If EndBit is less than StartBit, then ASSERT().
1707 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1708 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1710 @param Address MMIO register to write.
1711 @param StartBit The ordinal of the least significant bit in the bit field.
1713 @param EndBit The ordinal of the most significant bit in the bit field.
1715 @param AndData The value to AND with read value from the MMIO register.
1716 @param OrData The value to OR with the result of the AND operation.
1718 @return The value written back to the MMIO register.
1723 MmioBitFieldAndThenOr16 (
1731 return MmioWrite16 (
1733 BitFieldAndThenOr16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1738 Reads a 32-bit MMIO register, performs a bitwise OR, and writes the
1739 result back to the 32-bit MMIO register.
1741 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1742 inclusive OR between the read result and the value specified by OrData, and
1743 writes the result to the 32-bit MMIO register specified by Address. The value
1744 written to the MMIO register is returned. This function must guarantee that
1745 all MMIO read and write operations are serialized.
1747 If 32-bit MMIO register operations are not supported, then ASSERT().
1749 @param Address The MMIO register to write.
1750 @param OrData The value to OR with the read value from the MMIO register.
1752 @return The value written back to the MMIO register.
1762 return MmioWrite32 (Address
, MmioRead32 (Address
) | OrData
);
1766 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
1767 back to the 32-bit MMIO register.
1769 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1770 between the read result and the value specified by AndData, and writes the
1771 result to the 32-bit MMIO register specified by Address. The value written to
1772 the MMIO register is returned. This function must guarantee that all MMIO
1773 read and write operations are serialized.
1775 If 32-bit MMIO register operations are not supported, then ASSERT().
1777 @param Address The MMIO register to write.
1778 @param AndData The value to AND with the read value from the MMIO register.
1780 @return The value written back to the MMIO register.
1790 return MmioWrite32 (Address
, MmioRead32 (Address
) & AndData
);
1794 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
1795 inclusive OR, and writes the result back to the 32-bit MMIO register.
1797 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1798 between the read result and the value specified by AndData, performs a
1799 bitwise OR between the result of the AND operation and the value specified by
1800 OrData, and writes the result to the 32-bit MMIO register specified by
1801 Address. The value written to the MMIO register is returned. This function
1802 must guarantee that all MMIO read and write operations are serialized.
1804 If 32-bit MMIO register operations are not supported, then ASSERT().
1807 @param Address The MMIO register to write.
1808 @param AndData The value to AND with the read value from the MMIO register.
1809 @param OrData The value to OR with the result of the AND operation.
1811 @return The value written back to the MMIO register.
1822 return MmioWrite32 (Address
, (MmioRead32 (Address
) & AndData
) | OrData
);
1826 Reads a bit field of a MMIO register.
1828 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
1829 the StartBit and the EndBit. The value of the bit field is returned.
1831 If 32-bit MMIO register operations are not supported, then ASSERT().
1832 If StartBit is greater than 31, then ASSERT().
1833 If EndBit is greater than 31, then ASSERT().
1834 If EndBit is less than StartBit, then ASSERT().
1836 @param Address MMIO register to read.
1837 @param StartBit The ordinal of the least significant bit in the bit field.
1839 @param EndBit The ordinal of the most significant bit in the bit field.
1842 @return The value read.
1847 MmioBitFieldRead32 (
1853 return BitFieldRead32 (MmioRead32 (Address
), StartBit
, EndBit
);
1857 Writes a bit field to a MMIO register.
1859 Writes Value to the bit field of the MMIO register. The bit field is
1860 specified by the StartBit and the EndBit. All other bits in the destination
1861 MMIO register are preserved. The new value of the 32-bit register is returned.
1863 If 32-bit MMIO register operations are not supported, then ASSERT().
1864 If StartBit is greater than 31, then ASSERT().
1865 If EndBit is greater than 31, then ASSERT().
1866 If EndBit is less than StartBit, then ASSERT().
1867 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1869 @param Address MMIO register to write.
1870 @param StartBit The ordinal of the least significant bit in the bit field.
1872 @param EndBit The ordinal of the most significant bit in the bit field.
1874 @param Value New value of the bit field.
1876 @return The value written back to the MMIO register.
1881 MmioBitFieldWrite32 (
1888 return MmioWrite32 (
1890 BitFieldWrite32 (MmioRead32 (Address
), StartBit
, EndBit
, Value
)
1895 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
1896 writes the result back to the bit field in the 32-bit MMIO register.
1898 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1899 inclusive OR between the read result and the value specified by OrData, and
1900 writes the result to the 32-bit MMIO register specified by Address. The value
1901 written to the MMIO register is returned. This function must guarantee that
1902 all MMIO read and write operations are serialized. Extra left bits in OrData
1905 If 32-bit MMIO register operations are not supported, then ASSERT().
1906 If StartBit is greater than 31, then ASSERT().
1907 If EndBit is greater than 31, then ASSERT().
1908 If EndBit is less than StartBit, then ASSERT().
1909 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1911 @param Address MMIO register to write.
1912 @param StartBit The ordinal of the least significant bit in the bit field.
1914 @param EndBit The ordinal of the most significant bit in the bit field.
1916 @param OrData The value to OR with read value from the MMIO register.
1918 @return The value written back to the MMIO register.
1930 return MmioWrite32 (
1932 BitFieldOr32 (MmioRead32 (Address
), StartBit
, EndBit
, OrData
)
1937 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
1938 writes the result back to the bit field in the 32-bit MMIO register.
1940 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1941 between the read result and the value specified by AndData, and writes the
1942 result to the 32-bit MMIO register specified by Address. The value written to
1943 the MMIO register is returned. This function must guarantee that all MMIO
1944 read and write operations are serialized. Extra left bits in AndData are
1947 If 32-bit MMIO register operations are not supported, then ASSERT().
1948 If StartBit is greater than 31, then ASSERT().
1949 If EndBit is greater than 31, then ASSERT().
1950 If EndBit is less than StartBit, then ASSERT().
1951 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1953 @param Address MMIO register to write.
1954 @param StartBit The ordinal of the least significant bit in the bit field.
1956 @param EndBit The ordinal of the most significant bit in the bit field.
1958 @param AndData The value to AND with read value from the MMIO register.
1960 @return The value written back to the MMIO register.
1972 return MmioWrite32 (
1974 BitFieldAnd32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
)
1979 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
1980 by a bitwise OR, and writes the result back to the bit field in the
1981 32-bit MMIO register.
1983 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1984 followed by a bitwise OR between the read result and the value
1985 specified by AndData, and writes the result to the 32-bit MMIO register
1986 specified by Address. The value written to the MMIO register is returned.
1987 This function must guarantee that all MMIO read and write operations are
1988 serialized. Extra left bits in both AndData and OrData are stripped.
1990 If 32-bit MMIO register operations are not supported, then ASSERT().
1991 If StartBit is greater than 31, then ASSERT().
1992 If EndBit is greater than 31, then ASSERT().
1993 If EndBit is less than StartBit, then ASSERT().
1994 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1995 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1997 @param Address MMIO register to write.
1998 @param StartBit The ordinal of the least significant bit in the bit field.
2000 @param EndBit The ordinal of the most significant bit in the bit field.
2002 @param AndData The value to AND with read value from the MMIO register.
2003 @param OrData The value to OR with the result of the AND operation.
2005 @return The value written back to the MMIO register.
2010 MmioBitFieldAndThenOr32 (
2018 return MmioWrite32 (
2020 BitFieldAndThenOr32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
, OrData
)
2025 Reads a 64-bit MMIO register, performs a bitwise OR, and writes the
2026 result back to the 64-bit MMIO register.
2028 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2029 inclusive OR between the read result and the value specified by OrData, and
2030 writes the result to the 64-bit MMIO register specified by Address. The value
2031 written to the MMIO register is returned. This function must guarantee that
2032 all MMIO read and write operations are serialized.
2034 If 64-bit MMIO register operations are not supported, then ASSERT().
2036 @param Address The MMIO register to write.
2037 @param OrData The value to OR with the read value from the MMIO register.
2039 @return The value written back to the MMIO register.
2049 return MmioWrite64 (Address
, MmioRead64 (Address
) | OrData
);
2053 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2054 back to the 64-bit MMIO register.
2056 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2057 between the read result and the value specified by AndData, and writes the
2058 result to the 64-bit MMIO register specified by Address. The value written to
2059 the MMIO register is returned. This function must guarantee that all MMIO
2060 read and write operations are serialized.
2062 If 64-bit MMIO register operations are not supported, then ASSERT().
2064 @param Address The MMIO register to write.
2065 @param AndData The value to AND with the read value from the MMIO register.
2067 @return The value written back to the MMIO register.
2077 return MmioWrite64 (Address
, MmioRead64 (Address
) & AndData
);
2081 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2082 inclusive OR, and writes the result back to the 64-bit MMIO register.
2084 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2085 between the read result and the value specified by AndData, performs a
2086 bitwise OR between the result of the AND operation and the value specified by
2087 OrData, and writes the result to the 64-bit MMIO register specified by
2088 Address. The value written to the MMIO register is returned. This function
2089 must guarantee that all MMIO read and write operations are serialized.
2091 If 64-bit MMIO register operations are not supported, then ASSERT().
2094 @param Address The MMIO register to write.
2095 @param AndData The value to AND with the read value from the MMIO register.
2096 @param OrData The value to OR with the result of the AND operation.
2098 @return The value written back to the MMIO register.
2109 return MmioWrite64 (Address
, (MmioRead64 (Address
) & AndData
) | OrData
);
2113 Reads a bit field of a MMIO register.
2115 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2116 the StartBit and the EndBit. The value of the bit field is returned.
2118 If 64-bit MMIO register operations are not supported, then ASSERT().
2119 If StartBit is greater than 63, then ASSERT().
2120 If EndBit is greater than 63, then ASSERT().
2121 If EndBit is less than StartBit, then ASSERT().
2123 @param Address MMIO register to read.
2124 @param StartBit The ordinal of the least significant bit in the bit field.
2126 @param EndBit The ordinal of the most significant bit in the bit field.
2129 @return The value read.
2134 MmioBitFieldRead64 (
2140 return BitFieldRead64 (MmioRead64 (Address
), StartBit
, EndBit
);
2144 Writes a bit field to a MMIO register.
2146 Writes Value to the bit field of the MMIO register. The bit field is
2147 specified by the StartBit and the EndBit. All other bits in the destination
2148 MMIO register are preserved. The new value of the 64-bit register is returned.
2150 If 64-bit MMIO register operations are not supported, then ASSERT().
2151 If StartBit is greater than 63, then ASSERT().
2152 If EndBit is greater than 63, then ASSERT().
2153 If EndBit is less than StartBit, then ASSERT().
2154 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2156 @param Address MMIO register to write.
2157 @param StartBit The ordinal of the least significant bit in the bit field.
2159 @param EndBit The ordinal of the most significant bit in the bit field.
2161 @param Value New value of the bit field.
2163 @return The value written back to the MMIO register.
2168 MmioBitFieldWrite64 (
2175 return MmioWrite64 (
2177 BitFieldWrite64 (MmioRead64 (Address
), StartBit
, EndBit
, Value
)
2182 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2183 writes the result back to the bit field in the 64-bit MMIO register.
2185 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2186 inclusive OR between the read result and the value specified by OrData, and
2187 writes the result to the 64-bit MMIO register specified by Address. The value
2188 written to the MMIO register is returned. This function must guarantee that
2189 all MMIO read and write operations are serialized. Extra left bits in OrData
2192 If 64-bit MMIO register operations are not supported, then ASSERT().
2193 If StartBit is greater than 63, then ASSERT().
2194 If EndBit is greater than 63, then ASSERT().
2195 If EndBit is less than StartBit, then ASSERT().
2196 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2198 @param Address MMIO register to write.
2199 @param StartBit The ordinal of the least significant bit in the bit field.
2201 @param EndBit The ordinal of the most significant bit in the bit field.
2203 @param OrData The value to OR with read value from the MMIO register.
2205 @return The value written back to the MMIO register.
2217 return MmioWrite64 (
2219 BitFieldOr64 (MmioRead64 (Address
), StartBit
, EndBit
, OrData
)
2224 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2225 writes the result back to the bit field in the 64-bit MMIO register.
2227 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2228 between the read result and the value specified by AndData, and writes the
2229 result to the 64-bit MMIO register specified by Address. The value written to
2230 the MMIO register is returned. This function must guarantee that all MMIO
2231 read and write operations are serialized. Extra left bits in AndData are
2234 If 64-bit MMIO register operations are not supported, then ASSERT().
2235 If StartBit is greater than 63, then ASSERT().
2236 If EndBit is greater than 63, then ASSERT().
2237 If EndBit is less than StartBit, then ASSERT().
2238 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2240 @param Address MMIO register to write.
2241 @param StartBit The ordinal of the least significant bit in the bit field.
2243 @param EndBit The ordinal of the most significant bit in the bit field.
2245 @param AndData The value to AND with read value from the MMIO register.
2247 @return The value written back to the MMIO register.
2259 return MmioWrite64 (
2261 BitFieldAnd64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
)
2266 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2267 by a bitwise OR, and writes the result back to the bit field in the
2268 64-bit MMIO register.
2270 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2271 followed by a bitwise OR between the read result and the value
2272 specified by AndData, and writes the result to the 64-bit MMIO register
2273 specified by Address. The value written to the MMIO register is returned.
2274 This function must guarantee that all MMIO read and write operations are
2275 serialized. Extra left bits in both AndData and OrData are stripped.
2277 If 64-bit MMIO register operations are not supported, then ASSERT().
2278 If StartBit is greater than 63, then ASSERT().
2279 If EndBit is greater than 63, then ASSERT().
2280 If EndBit is less than StartBit, then ASSERT().
2281 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2282 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2284 @param Address MMIO register to write.
2285 @param StartBit The ordinal of the least significant bit in the bit field.
2287 @param EndBit The ordinal of the most significant bit in the bit field.
2289 @param AndData The value to AND with read value from the MMIO register.
2290 @param OrData The value to OR with the result of the AND operation.
2292 @return The value written back to the MMIO register.
2297 MmioBitFieldAndThenOr64 (
2305 return MmioWrite64 (
2307 BitFieldAndThenOr64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
, OrData
)