]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c
2 High-level Io/Mmio functions.
4 All assertions for bit field operations are handled bit field functions in the
7 Copyright (c) 2006 - 2008, 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 contain the same copy of this file:
24 #include "BaseIoLibIntrinsicInternal.h"
27 Reads an 8-bit I/O port, performs a bitwise OR, and writes the
28 result back to the 8-bit I/O port.
30 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
31 between the read result and the value specified by OrData, and writes the
32 result to the 8-bit I/O port specified by Port. The value written to the I/O
33 port is returned. This function must guarantee that all I/O read and write
34 operations are serialized.
36 If 8-bit I/O port operations are not supported, then ASSERT().
38 @param Port The I/O port to write.
39 @param OrData The value to OR with the read value from the I/O port.
41 @return The value written back to the I/O port.
51 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) | OrData
));
55 Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
56 to the 8-bit I/O port.
58 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
59 the read result and the value specified by AndData, and writes the result to
60 the 8-bit I/O port specified by Port. The value written to the I/O port is
61 returned. This function must guarantee that all I/O read and write operations
64 If 8-bit I/O port operations are not supported, then ASSERT().
66 @param Port The I/O port to write.
67 @param AndData The value to AND with the read value from the I/O port.
69 @return The value written back to the I/O port.
79 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) & AndData
));
83 Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
84 OR, and writes the result back to the 8-bit I/O port.
86 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
87 the read result and the value specified by AndData, performs a bitwise OR
88 between the result of the AND operation and the value specified by OrData,
89 and writes the result to the 8-bit I/O port specified by Port. The value
90 written to the I/O port is returned. This function must guarantee that all
91 I/O read and write operations are serialized.
93 If 8-bit I/O port operations are not supported, then ASSERT().
95 @param Port The I/O port to write.
96 @param AndData The value to AND with the read value from the I/O port.
97 @param OrData The value to OR with the result of the AND operation.
99 @return The value written back to the I/O port.
110 return IoWrite8 (Port
, (UINT8
) ((IoRead8 (Port
) & AndData
) | OrData
));
114 Reads a bit field of an I/O register.
116 Reads the bit field in an 8-bit I/O register. The bit field is specified by
117 the StartBit and the EndBit. The value of the bit field is returned.
119 If 8-bit I/O port operations are not supported, then ASSERT().
120 If StartBit is greater than 7, then ASSERT().
121 If EndBit is greater than 7, then ASSERT().
122 If EndBit is less than StartBit, then ASSERT().
124 @param Port The I/O port to read.
125 @param StartBit The ordinal of the least significant bit in the bit field.
127 @param EndBit The ordinal of the most significant bit in the bit field.
130 @return The value read.
141 return BitFieldRead8 (IoRead8 (Port
), StartBit
, EndBit
);
145 Writes a bit field to an I/O register.
147 Writes Value to the bit field of the I/O register. The bit field is specified
148 by the StartBit and the EndBit. All other bits in the destination I/O
149 register are preserved. The value written to the I/O port is returned.
151 If 8-bit I/O port operations are not supported, then ASSERT().
152 If StartBit is greater than 7, then ASSERT().
153 If EndBit is greater than 7, then ASSERT().
154 If EndBit is less than StartBit, then ASSERT().
156 @param Port The I/O port to write.
157 @param StartBit The ordinal of the least significant bit in the bit field.
159 @param EndBit The ordinal of the most significant bit in the bit field.
161 @param Value New value of the bit field.
163 @return The value written back to the I/O port.
177 BitFieldWrite8 (IoRead8 (Port
), StartBit
, EndBit
, Value
)
182 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
183 result back to the bit field in the 8-bit port.
185 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
186 between the read result and the value specified by OrData, and writes the
187 result to the 8-bit I/O port specified by Port. The value written to the I/O
188 port is returned. This function must guarantee that all I/O read and write
189 operations are serialized. Extra left bits in OrData are stripped.
191 If 8-bit I/O port operations are not supported, then ASSERT().
192 If StartBit is greater than 7, then ASSERT().
193 If EndBit is greater than 7, then ASSERT().
194 If EndBit is less than StartBit, 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().
236 @param Port The I/O port to write.
237 @param StartBit The ordinal of the least significant bit in the bit field.
239 @param EndBit The ordinal of the most significant bit in the bit field.
241 @param AndData The value to AND with the read value from the I/O port.
243 @return The value written back to the I/O port.
257 BitFieldAnd8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
)
262 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
263 bitwise OR, and writes the result back to the bit field in the
266 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
267 by a bitwise OR between the read result and the value specified by
268 AndData, and writes the result to the 8-bit I/O port specified by Port. The
269 value written to the I/O port is returned. This function must guarantee that
270 all I/O read and write operations are serialized. Extra left bits in both
271 AndData and OrData are stripped.
273 If 8-bit I/O port operations are not supported, then ASSERT().
274 If StartBit is greater than 7, then ASSERT().
275 If EndBit is greater than 7, then ASSERT().
276 If EndBit is less than StartBit, then ASSERT().
278 @param Port The I/O port to write.
279 @param StartBit The ordinal of the least significant bit in the bit field.
281 @param EndBit The ordinal of the most significant bit in the bit field.
283 @param AndData The value to AND with the read value from the I/O port.
284 @param OrData The value to OR with the result of the AND operation.
286 @return The value written back to the I/O port.
291 IoBitFieldAndThenOr8 (
301 BitFieldAndThenOr8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
, OrData
)
306 Reads a 16-bit I/O port, performs a bitwise OR, and writes the
307 result back to the 16-bit I/O port.
309 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
310 between the read result and the value specified by OrData, and writes the
311 result to the 16-bit I/O port specified by Port. The value written to the I/O
312 port is returned. This function must guarantee that all I/O read and write
313 operations are serialized.
315 If 16-bit I/O port operations are not supported, then ASSERT().
316 If Port is not aligned on a 16-bit boundary, then ASSERT().
318 @param Port The I/O port to write.
319 @param OrData The value to OR with the read value from the I/O port.
321 @return The value written back to the I/O port.
331 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) | OrData
));
335 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
336 to the 16-bit I/O port.
338 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
339 the read result and the value specified by AndData, and writes the result to
340 the 16-bit I/O port specified by Port. The value written to the I/O port is
341 returned. This function must guarantee that all I/O read and write operations
344 If 16-bit I/O port operations are not supported, then ASSERT().
345 If Port is not aligned on a 16-bit boundary, then ASSERT().
347 @param Port The I/O port to write.
348 @param AndData The value to AND with the read value from the I/O port.
350 @return The value written back to the I/O port.
360 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) & AndData
));
364 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
365 OR, and writes the result back to the 16-bit I/O port.
367 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
368 the read result and the value specified by AndData, performs a bitwise OR
369 between the result of the AND operation and the value specified by OrData,
370 and writes the result to the 16-bit I/O port specified by Port. The value
371 written to the I/O port is returned. This function must guarantee that all
372 I/O read and write operations are serialized.
374 If 16-bit I/O port operations are not supported, then ASSERT().
375 If Port is not aligned on a 16-bit boundary, 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 Port is not aligned on a 16-bit boundary, then ASSERT().
403 If StartBit is greater than 15, then ASSERT().
404 If EndBit is greater than 15, then ASSERT().
405 If EndBit is less than StartBit, then ASSERT().
407 @param Port The I/O port to read.
408 @param StartBit The ordinal of the least significant bit in the bit field.
410 @param EndBit The ordinal of the most significant bit in the bit field.
413 @return The value read.
424 return BitFieldRead16 (IoRead16 (Port
), StartBit
, EndBit
);
428 Writes a bit field to an I/O register.
430 Writes Value to the bit field of the I/O register. The bit field is specified
431 by the StartBit and the EndBit. All other bits in the destination I/O
432 register are preserved. The value written to the I/O port is returned. Extra
433 left bits in Value are stripped.
435 If 16-bit I/O port operations are not supported, then ASSERT().
436 If Port is not aligned on a 16-bit boundary, then ASSERT().
437 If StartBit is greater than 15, then ASSERT().
438 If EndBit is greater than 15, then ASSERT().
439 If EndBit is less than StartBit, then ASSERT().
441 @param Port The I/O port to write.
442 @param StartBit The ordinal of the least significant bit in the bit field.
444 @param EndBit The ordinal of the most significant bit in the bit field.
446 @param Value New value of the bit field.
448 @return The value written back to the I/O port.
462 BitFieldWrite16 (IoRead16 (Port
), StartBit
, EndBit
, Value
)
467 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
468 result back to the bit field in the 16-bit port.
470 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
471 between the read result and the value specified by OrData, and writes the
472 result to the 16-bit I/O port specified by Port. The value written to the I/O
473 port is returned. This function must guarantee that all I/O read and write
474 operations are serialized. Extra left bits in OrData are stripped.
476 If 16-bit I/O port operations are not supported, then ASSERT().
477 If Port is not aligned on a 16-bit boundary, then ASSERT().
478 If StartBit is greater than 15, then ASSERT().
479 If EndBit is greater than 15, then ASSERT().
480 If EndBit is less than StartBit, then ASSERT().
482 @param Port The I/O port to write.
483 @param StartBit The ordinal of the least significant bit in the bit field.
485 @param EndBit The ordinal of the most significant bit in the bit field.
487 @param OrData The value to OR with the read value from the I/O port.
489 @return The value written back to the I/O port.
503 BitFieldOr16 (IoRead16 (Port
), StartBit
, EndBit
, OrData
)
508 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
509 result back to the bit field in the 16-bit port.
511 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
512 the read result and the value specified by AndData, and writes the result to
513 the 16-bit I/O port specified by Port. The value written to the I/O port is
514 returned. This function must guarantee that all I/O read and write operations
515 are serialized. Extra left bits in AndData are stripped.
517 If 16-bit I/O port operations are not supported, then ASSERT().
518 If Port is not aligned on a 16-bit boundary, 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 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 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 Port is not aligned on a 16-bit boundary, then ASSERT().
562 If StartBit is greater than 15, then ASSERT().
563 If EndBit is greater than 15, then ASSERT().
564 If EndBit is less than StartBit, 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().
604 If Port is not aligned on a 32-bit boundary, then ASSERT().
606 @param Port The I/O port to write.
607 @param OrData The value to OR with the read value from the I/O port.
609 @return The value written back to the I/O port.
619 return IoWrite32 (Port
, IoRead32 (Port
) | OrData
);
623 Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
624 to the 32-bit I/O port.
626 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
627 the read result and the value specified by AndData, and writes the result to
628 the 32-bit I/O port specified by Port. The value written to the I/O port is
629 returned. This function must guarantee that all I/O read and write operations
632 If 32-bit I/O port operations are not supported, then ASSERT().
633 If Port is not aligned on a 32-bit boundary, then ASSERT().
635 @param Port The I/O port to write.
636 @param AndData The value to AND with the read value from the I/O port.
638 @return The value written back to the I/O port.
648 return IoWrite32 (Port
, IoRead32 (Port
) & AndData
);
652 Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
653 OR, and writes the result back to the 32-bit I/O port.
655 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
656 the read result and the value specified by AndData, performs a bitwise OR
657 between the result of the AND operation and the value specified by OrData,
658 and writes the result to the 32-bit I/O port specified by Port. The value
659 written to the I/O port is returned. This function must guarantee that all
660 I/O read and write operations are serialized.
662 If 32-bit I/O port operations are not supported, then ASSERT().
663 If Port is not aligned on a 32-bit boundary, then ASSERT().
665 @param Port The I/O port to write.
666 @param AndData The value to AND with the read value from the I/O port.
667 @param OrData The value to OR with the result of the AND operation.
669 @return The value written back to the I/O port.
680 return IoWrite32 (Port
, (IoRead32 (Port
) & AndData
) | OrData
);
684 Reads a bit field of an I/O register.
686 Reads the bit field in a 32-bit I/O register. The bit field is specified by
687 the StartBit and the EndBit. The value of the bit field is returned.
689 If 32-bit I/O port operations are not supported, then ASSERT().
690 If Port is not aligned on a 32-bit boundary, then ASSERT().
691 If StartBit is greater than 31, then ASSERT().
692 If EndBit is greater than 31, then ASSERT().
693 If EndBit is less than StartBit, then ASSERT().
695 @param Port The I/O port to read.
696 @param StartBit The ordinal of the least significant bit in the bit field.
698 @param EndBit The ordinal of the most significant bit in the bit field.
701 @return The value read.
712 return BitFieldRead32 (IoRead32 (Port
), StartBit
, EndBit
);
716 Writes a bit field to an I/O register.
718 Writes Value to the bit field of the I/O register. The bit field is specified
719 by the StartBit and the EndBit. All other bits in the destination I/O
720 register are preserved. The value written to the I/O port is returned. Extra
721 left bits in Value are stripped.
723 If 32-bit I/O port operations are not supported, then ASSERT().
724 If Port is not aligned on a 32-bit boundary, then ASSERT().
725 If StartBit is greater than 31, then ASSERT().
726 If EndBit is greater than 31, then ASSERT().
727 If EndBit is less than StartBit, then ASSERT().
729 @param Port The I/O port to write.
730 @param StartBit The ordinal of the least significant bit in the bit field.
732 @param EndBit The ordinal of the most significant bit in the bit field.
734 @param Value New value of the bit field.
736 @return The value written back to the I/O port.
750 BitFieldWrite32 (IoRead32 (Port
), StartBit
, EndBit
, Value
)
755 Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the
756 result back to the bit field in the 32-bit port.
758 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
759 between the read result and the value specified by OrData, and writes the
760 result to the 32-bit I/O port specified by Port. The value written to the I/O
761 port is returned. This function must guarantee that all I/O read and write
762 operations are serialized. Extra left bits in OrData are stripped.
764 If 32-bit I/O port operations are not supported, then ASSERT().
765 If Port is not aligned on a 32-bit boundary, then ASSERT().
766 If StartBit is greater than 31, then ASSERT().
767 If EndBit is greater than 31, then ASSERT().
768 If EndBit is less than StartBit, then ASSERT().
770 @param Port The I/O port to write.
771 @param StartBit The ordinal of the least significant bit in the bit field.
773 @param EndBit The ordinal of the most significant bit in the bit field.
775 @param OrData The value to OR with the read value from the I/O port.
777 @return The value written back to the I/O port.
791 BitFieldOr32 (IoRead32 (Port
), StartBit
, EndBit
, OrData
)
796 Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
797 result back to the bit field in the 32-bit port.
799 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
800 the read result and the value specified by AndData, and writes the result to
801 the 32-bit I/O port specified by Port. The value written to the I/O port is
802 returned. This function must guarantee that all I/O read and write operations
803 are serialized. Extra left bits in AndData are stripped.
805 If 32-bit I/O port operations are not supported, then ASSERT().
806 If Port is not aligned on a 32-bit boundary, then ASSERT().
807 If StartBit is greater than 31, then ASSERT().
808 If EndBit is greater than 31, then ASSERT().
809 If EndBit is less than StartBit, then ASSERT().
811 @param Port The I/O port to write.
812 @param StartBit The ordinal of the least significant bit in the bit field.
814 @param EndBit The ordinal of the most significant bit in the bit field.
816 @param AndData The value to AND with the read value from the I/O port.
818 @return The value written back to the I/O port.
832 BitFieldAnd32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
)
837 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
838 bitwise OR, and writes the result back to the bit field in the
841 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
842 by a bitwise OR between the read result and the value specified by
843 AndData, and writes the result to the 32-bit I/O port specified by Port. The
844 value written to the I/O port is returned. This function must guarantee that
845 all I/O read and write operations are serialized. Extra left bits in both
846 AndData and OrData are stripped.
848 If 32-bit I/O port operations are not supported, then ASSERT().
849 If Port is not aligned on a 32-bit boundary, then ASSERT().
850 If StartBit is greater than 31, then ASSERT().
851 If EndBit is greater than 31, then ASSERT().
852 If EndBit is less than StartBit, then ASSERT().
854 @param Port The I/O port to write.
855 @param StartBit The ordinal of the least significant bit in the bit field.
857 @param EndBit The ordinal of the most significant bit in the bit field.
859 @param AndData The value to AND with the read value from the I/O port.
860 @param OrData The value to OR with the result of the AND operation.
862 @return The value written back to the I/O port.
867 IoBitFieldAndThenOr32 (
877 BitFieldAndThenOr32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
, OrData
)
882 Reads a 64-bit I/O port, performs a bitwise OR, and writes the
883 result back to the 64-bit I/O port.
885 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
886 between the read result and the value specified by OrData, and writes the
887 result to the 64-bit I/O port specified by Port. The value written to the I/O
888 port is returned. This function must guarantee that all I/O read and write
889 operations are serialized.
891 If 64-bit I/O port operations are not supported, then ASSERT().
892 If Port is not aligned on a 64-bit boundary, then ASSERT().
894 @param Port The I/O port to write.
895 @param OrData The value to OR with the read value from the I/O port.
897 @return The value written back to the I/O port.
907 return IoWrite64 (Port
, IoRead64 (Port
) | OrData
);
911 Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
912 to the 64-bit I/O port.
914 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
915 the read result and the value specified by AndData, and writes the result to
916 the 64-bit I/O port specified by Port. The value written to the I/O port is
917 returned. This function must guarantee that all I/O read and write operations
920 If 64-bit I/O port operations are not supported, then ASSERT().
921 If Port is not aligned on a 64-bit boundary, then ASSERT().
923 @param Port The I/O port to write.
924 @param AndData The value to AND with the read value from the I/O port.
926 @return The value written back to the I/O port.
936 return IoWrite64 (Port
, IoRead64 (Port
) & AndData
);
940 Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
941 OR, and writes the result back to the 64-bit I/O port.
943 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
944 the read result and the value specified by AndData, performs a bitwise OR
945 between the result of the AND operation and the value specified by OrData,
946 and writes the result to the 64-bit I/O port specified by Port. The value
947 written to the I/O port is returned. This function must guarantee that all
948 I/O read and write operations are serialized.
950 If 64-bit I/O port operations are not supported, then ASSERT().
951 If Port is not aligned on a 64-bit boundary, then ASSERT().
953 @param Port The I/O port to write.
954 @param AndData The value to AND with the read value from the I/O port.
955 @param OrData The value to OR with the result of the AND operation.
957 @return The value written back to the I/O port.
968 return IoWrite64 (Port
, (IoRead64 (Port
) & AndData
) | OrData
);
972 Reads a bit field of an I/O register.
974 Reads the bit field in a 64-bit I/O register. The bit field is specified by
975 the StartBit and the EndBit. The value of the bit field is returned.
977 If 64-bit I/O port operations are not supported, then ASSERT().
978 If Port is not aligned on a 64-bit boundary, then ASSERT().
979 If StartBit is greater than 63, then ASSERT().
980 If EndBit is greater than 63, then ASSERT().
981 If EndBit is less than StartBit, then ASSERT().
983 @param Port The I/O port to read.
984 @param StartBit The ordinal of the least significant bit in the bit field.
986 @param EndBit The ordinal of the most significant bit in the bit field.
989 @return The value read.
1000 return BitFieldRead64 (IoRead64 (Port
), StartBit
, EndBit
);
1004 Writes a bit field to an I/O register.
1006 Writes Value to the bit field of the I/O register. The bit field is specified
1007 by the StartBit and the EndBit. All other bits in the destination I/O
1008 register are preserved. The value written to the I/O port is returned. Extra
1009 left bits in Value are stripped.
1011 If 64-bit I/O port operations are not supported, then ASSERT().
1012 If Port is not aligned on a 64-bit boundary, then ASSERT().
1013 If StartBit is greater than 63, then ASSERT().
1014 If EndBit is greater than 63, then ASSERT().
1015 If EndBit is less than StartBit, then ASSERT().
1017 @param Port The I/O port to write.
1018 @param StartBit The ordinal of the least significant bit in the bit field.
1020 @param EndBit The ordinal of the most significant bit in the bit field.
1022 @param Value New value of the bit field.
1024 @return The value written back to the I/O port.
1038 BitFieldWrite64 (IoRead64 (Port
), StartBit
, EndBit
, Value
)
1043 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1044 result back to the bit field in the 64-bit port.
1046 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
1047 between the read result and the value specified by OrData, and writes the
1048 result to the 64-bit I/O port specified by Port. The value written to the I/O
1049 port is returned. This function must guarantee that all I/O read and write
1050 operations are serialized. Extra left bits in OrData are stripped.
1052 If 64-bit I/O port operations are not supported, then ASSERT().
1053 If Port is not aligned on a 64-bit boundary, then ASSERT().
1054 If StartBit is greater than 63, then ASSERT().
1055 If EndBit is greater than 63, then ASSERT().
1056 If EndBit is less than StartBit, then ASSERT().
1058 @param Port The I/O port to write.
1059 @param StartBit The ordinal of the least significant bit in the bit field.
1061 @param EndBit The ordinal of the most significant bit in the bit field.
1063 @param OrData The value to OR with the read value from the I/O port.
1065 @return The value written back to the I/O port.
1079 BitFieldOr64 (IoRead64 (Port
), StartBit
, EndBit
, OrData
)
1084 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1085 result back to the bit field in the 64-bit port.
1087 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1088 the read result and the value specified by AndData, and writes the result to
1089 the 64-bit I/O port specified by Port. The value written to the I/O port is
1090 returned. This function must guarantee that all I/O read and write operations
1091 are serialized. Extra left bits in AndData are stripped.
1093 If 64-bit I/O port operations are not supported, then ASSERT().
1094 If Port is not aligned on a 64-bit boundary, then ASSERT().
1095 If StartBit is greater than 63, then ASSERT().
1096 If EndBit is greater than 63, then ASSERT().
1097 If EndBit is less than StartBit, then ASSERT().
1099 @param Port The I/O port to write.
1100 @param StartBit The ordinal of the least significant bit in the bit field.
1102 @param EndBit The ordinal of the most significant bit in the bit field.
1104 @param AndData The value to AND with the read value from the I/O port.
1106 @return The value written back to the I/O port.
1120 BitFieldAnd64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
)
1125 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
1126 bitwise OR, and writes the result back to the bit field in the
1129 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
1130 by a bitwise OR between the read result and the value specified by
1131 AndData, and writes the result to the 64-bit I/O port specified by Port. The
1132 value written to the I/O port is returned. This function must guarantee that
1133 all I/O read and write operations are serialized. Extra left bits in both
1134 AndData and OrData are stripped.
1136 If 64-bit I/O port operations are not supported, then ASSERT().
1137 If Port is not aligned on a 64-bit boundary, then ASSERT().
1138 If StartBit is greater than 63, then ASSERT().
1139 If EndBit is greater than 63, then ASSERT().
1140 If EndBit is less than StartBit, then ASSERT().
1142 @param Port The I/O port to write.
1143 @param StartBit The ordinal of the least significant bit in the bit field.
1145 @param EndBit The ordinal of the most significant bit in the bit field.
1147 @param AndData The value to AND with the read value from the I/O port.
1148 @param OrData The value to OR with the result of the AND operation.
1150 @return The value written back to the I/O port.
1155 IoBitFieldAndThenOr64 (
1165 BitFieldAndThenOr64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
, OrData
)
1170 Reads an 8-bit MMIO register, performs a bitwise OR, and writes the
1171 result back to the 8-bit MMIO register.
1173 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1174 OR between the read result and the value specified by OrData, and
1175 writes the result to the 8-bit MMIO register specified by Address. The value
1176 written to the MMIO register is returned. This function must guarantee that
1177 all MMIO read and write operations are serialized.
1179 If 8-bit MMIO register operations are not supported, then ASSERT().
1181 @param Address The MMIO register to write.
1182 @param OrData The value to OR with the read value from the MMIO register.
1184 @return The value written back to the MMIO register.
1194 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) | OrData
));
1198 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1199 back to the 8-bit MMIO register.
1201 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1202 between the read result and the value specified by AndData, and writes the
1203 result to the 8-bit MMIO register specified by Address. The value written to
1204 the MMIO register is returned. This function must guarantee that all MMIO
1205 read and write operations are serialized.
1207 If 8-bit MMIO register operations are not supported, then ASSERT().
1209 @param Address The MMIO register to write.
1210 @param AndData The value to AND with the read value from the MMIO register.
1212 @return The value written back to the MMIO register.
1222 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) & AndData
));
1226 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1227 OR, and writes the result back to the 8-bit MMIO register.
1229 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1230 between the read result and the value specified by AndData, performs a
1231 bitwise OR between the result of the AND operation and the value specified by
1232 OrData, and writes the result to the 8-bit MMIO register specified by
1233 Address. The value written to the MMIO register is returned. This function
1234 must guarantee that all MMIO read and write operations are serialized.
1236 If 8-bit MMIO register operations are not supported, then ASSERT().
1239 @param Address The MMIO register to write.
1240 @param AndData The value to AND with the read value from the MMIO register.
1241 @param OrData The value to OR with the result of the AND operation.
1243 @return The value written back to the MMIO register.
1254 return MmioWrite8 (Address
, (UINT8
) ((MmioRead8 (Address
) & AndData
) | OrData
));
1258 Reads a bit field of a MMIO register.
1260 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1261 the StartBit and the EndBit. The value of the bit field is returned.
1263 If 8-bit MMIO register operations are not supported, then ASSERT().
1264 If StartBit is greater than 7, then ASSERT().
1265 If EndBit is greater than 7, then ASSERT().
1266 If EndBit is less than StartBit, then ASSERT().
1268 @param Address MMIO register to read.
1269 @param StartBit The ordinal of the least significant bit in the bit field.
1271 @param EndBit The ordinal of the most significant bit in the bit field.
1274 @return The value read.
1285 return BitFieldRead8 (MmioRead8 (Address
), StartBit
, EndBit
);
1289 Writes a bit field to a MMIO register.
1291 Writes Value to the bit field of the MMIO register. The bit field is
1292 specified by the StartBit and the EndBit. All other bits in the destination
1293 MMIO register are preserved. The new value of the 8-bit register is returned.
1295 If 8-bit MMIO register operations are not supported, then ASSERT().
1296 If StartBit is greater than 7, then ASSERT().
1297 If EndBit is greater than 7, then ASSERT().
1298 If EndBit is less than StartBit, then ASSERT().
1300 @param Address MMIO register to write.
1301 @param StartBit The ordinal of the least significant bit in the bit field.
1303 @param EndBit The ordinal of the most significant bit in the bit field.
1305 @param Value New value of the bit field.
1307 @return The value written back to the MMIO register.
1312 MmioBitFieldWrite8 (
1321 BitFieldWrite8 (MmioRead8 (Address
), StartBit
, EndBit
, Value
)
1326 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1327 writes the result back to the bit field in the 8-bit MMIO register.
1329 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1330 OR between the read result and the value specified by OrData, and
1331 writes the result to the 8-bit MMIO register specified by Address. The value
1332 written to the MMIO register is returned. This function must guarantee that
1333 all MMIO read and write operations are serialized. Extra left bits in OrData
1336 If 8-bit MMIO register operations are not supported, then ASSERT().
1337 If StartBit is greater than 7, then ASSERT().
1338 If EndBit is greater than 7, then ASSERT().
1339 If EndBit is less than StartBit, then ASSERT().
1341 @param Address MMIO register to write.
1342 @param StartBit The ordinal of the least significant bit in the bit field.
1344 @param EndBit The ordinal of the most significant bit in the bit field.
1346 @param OrData The value to OR with read value from the MMIO register.
1348 @return The value written back to the MMIO register.
1362 BitFieldOr8 (MmioRead8 (Address
), StartBit
, EndBit
, OrData
)
1367 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1368 writes the result back to the bit field in the 8-bit MMIO register.
1370 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1371 between the read result and the value specified by AndData, and writes the
1372 result to the 8-bit MMIO register specified by Address. The value written to
1373 the MMIO register is returned. This function must guarantee that all MMIO
1374 read and write operations are serialized. Extra left bits in AndData are
1377 If 8-bit MMIO register operations are not supported, then ASSERT().
1378 If StartBit is greater than 7, then ASSERT().
1379 If EndBit is greater than 7, then ASSERT().
1380 If EndBit is less than StartBit, then ASSERT().
1382 @param Address MMIO register to write.
1383 @param StartBit The ordinal of the least significant bit in the bit field.
1385 @param EndBit The ordinal of the most significant bit in the bit field.
1387 @param AndData The value to AND with read value from the MMIO register.
1389 @return The value written back to the MMIO register.
1403 BitFieldAnd8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
)
1408 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1409 by a bitwise OR, and writes the result back to the bit field in the
1410 8-bit MMIO register.
1412 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1413 followed by a bitwise OR between the read result and the value
1414 specified by AndData, and writes the result to the 8-bit MMIO register
1415 specified by Address. The value written to the MMIO register is returned.
1416 This function must guarantee that all MMIO read and write operations are
1417 serialized. Extra left bits in both AndData and OrData are stripped.
1419 If 8-bit MMIO register operations are not supported, then ASSERT().
1420 If StartBit is greater than 7, then ASSERT().
1421 If EndBit is greater than 7, then ASSERT().
1422 If EndBit is less than StartBit, then ASSERT().
1424 @param Address MMIO register to write.
1425 @param StartBit The ordinal of the least significant bit in the bit field.
1427 @param EndBit The ordinal of the most significant bit in the bit field.
1429 @param AndData The value to AND with read value from the MMIO register.
1430 @param OrData The value to OR with the result of the AND operation.
1432 @return The value written back to the MMIO register.
1437 MmioBitFieldAndThenOr8 (
1447 BitFieldAndThenOr8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1452 Reads a 16-bit MMIO register, performs a bitwise OR, and writes the
1453 result back to the 16-bit MMIO register.
1455 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1456 OR between the read result and the value specified by OrData, and
1457 writes the result to the 16-bit MMIO register specified by Address. The value
1458 written to the MMIO register is returned. This function must guarantee that
1459 all MMIO read and write operations are serialized.
1461 If 16-bit MMIO register operations are not supported, then ASSERT().
1462 If Address is not aligned on a 16-bit boundary, then ASSERT().
1464 @param Address The MMIO register to write.
1465 @param OrData The value to OR with the read value from the MMIO register.
1467 @return The value written back to the MMIO register.
1477 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) | OrData
));
1481 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1482 back to the 16-bit MMIO register.
1484 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1485 between the read result and the value specified by AndData, and writes the
1486 result to the 16-bit MMIO register specified by Address. The value written to
1487 the MMIO register is returned. This function must guarantee that all MMIO
1488 read and write operations are serialized.
1490 If 16-bit MMIO register operations are not supported, then ASSERT().
1491 If Address is not aligned on a 16-bit boundary, then ASSERT().
1493 @param Address The MMIO register to write.
1494 @param AndData The value to AND with the read value from the MMIO register.
1496 @return The value written back to the MMIO register.
1506 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) & AndData
));
1510 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1511 OR, and writes the result back to the 16-bit MMIO register.
1513 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1514 between the read result and the value specified by AndData, performs a
1515 bitwise OR between the result of the AND operation and the value specified by
1516 OrData, and writes the result to the 16-bit MMIO register specified by
1517 Address. The value written to the MMIO register is returned. This function
1518 must guarantee that all MMIO read and write operations are serialized.
1520 If 16-bit MMIO register operations are not supported, then ASSERT().
1521 If Address is not aligned on a 16-bit boundary, then ASSERT().
1523 @param Address The MMIO register to write.
1524 @param AndData The value to AND with the read value from the MMIO register.
1525 @param OrData The value to OR with the result of the AND operation.
1527 @return The value written back to the MMIO register.
1538 return MmioWrite16 (Address
, (UINT16
) ((MmioRead16 (Address
) & AndData
) | OrData
));
1542 Reads a bit field of a MMIO register.
1544 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
1545 the StartBit and the EndBit. The value of the bit field is returned.
1547 If 16-bit MMIO register operations are not supported, then ASSERT().
1548 If Address is not aligned on a 16-bit boundary, then ASSERT().
1549 If StartBit is greater than 15, then ASSERT().
1550 If EndBit is greater than 15, then ASSERT().
1551 If EndBit is less than StartBit, then ASSERT().
1553 @param Address MMIO register to read.
1554 @param StartBit The ordinal of the least significant bit in the bit field.
1556 @param EndBit The ordinal of the most significant bit in the bit field.
1559 @return The value read.
1564 MmioBitFieldRead16 (
1570 return BitFieldRead16 (MmioRead16 (Address
), StartBit
, EndBit
);
1574 Writes a bit field to a MMIO register.
1576 Writes Value to the bit field of the MMIO register. The bit field is
1577 specified by the StartBit and the EndBit. All other bits in the destination
1578 MMIO register are preserved. The new value of the 16-bit register is returned.
1580 If 16-bit MMIO register operations are not supported, then ASSERT().
1581 If Address is not aligned on a 16-bit boundary, then ASSERT().
1582 If StartBit is greater than 15, then ASSERT().
1583 If EndBit is greater than 15, then ASSERT().
1584 If EndBit is less than StartBit, then ASSERT().
1586 @param Address MMIO register to write.
1587 @param StartBit The ordinal of the least significant bit in the bit field.
1589 @param EndBit The ordinal of the most significant bit in the bit field.
1591 @param Value New value of the bit field.
1593 @return The value written back to the MMIO register.
1598 MmioBitFieldWrite16 (
1605 return MmioWrite16 (
1607 BitFieldWrite16 (MmioRead16 (Address
), StartBit
, EndBit
, Value
)
1612 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
1613 writes the result back to the bit field in the 16-bit MMIO register.
1615 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1616 OR between the read result and the value specified by OrData, and
1617 writes the result to the 16-bit MMIO register specified by Address. The value
1618 written to the MMIO register is returned. This function must guarantee that
1619 all MMIO read and write operations are serialized. Extra left bits in OrData
1622 If 16-bit MMIO register operations are not supported, then ASSERT().
1623 If Address is not aligned on a 16-bit boundary, then ASSERT().
1624 If StartBit is greater than 15, then ASSERT().
1625 If EndBit is greater than 15, then ASSERT().
1626 If EndBit is less than StartBit, then ASSERT().
1628 @param Address MMIO register to write.
1629 @param StartBit The ordinal of the least significant bit in the bit field.
1631 @param EndBit The ordinal of the most significant bit in the bit field.
1633 @param OrData The value to OR with read value from the MMIO register.
1635 @return The value written back to the MMIO register.
1647 return MmioWrite16 (
1649 BitFieldOr16 (MmioRead16 (Address
), StartBit
, EndBit
, OrData
)
1654 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
1655 writes the result back to the bit field in the 16-bit MMIO register.
1657 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1658 between the read result and the value specified by AndData, and writes the
1659 result to the 16-bit MMIO register specified by Address. The value written to
1660 the MMIO register is returned. This function must guarantee that all MMIO
1661 read and write operations are serialized. Extra left bits in AndData are
1664 If 16-bit MMIO register operations are not supported, then ASSERT().
1665 If Address is not aligned on a 16-bit boundary, then ASSERT().
1666 If StartBit is greater than 15, then ASSERT().
1667 If EndBit is greater than 15, then ASSERT().
1668 If EndBit is less than StartBit, then ASSERT().
1670 @param Address MMIO register to write.
1671 @param StartBit The ordinal of the least significant bit in the bit field.
1673 @param EndBit The ordinal of the most significant bit in the bit field.
1675 @param AndData The value to AND with read value from the MMIO register.
1677 @return The value written back to the MMIO register.
1689 return MmioWrite16 (
1691 BitFieldAnd16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
)
1696 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
1697 by a bitwise OR, and writes the result back to the bit field in the
1698 16-bit MMIO register.
1700 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1701 followed by a bitwise OR between the read result and the value
1702 specified by AndData, and writes the result to the 16-bit MMIO register
1703 specified by Address. The value written to the MMIO register is returned.
1704 This function must guarantee that all MMIO read and write operations are
1705 serialized. Extra left bits in both AndData and OrData are stripped.
1707 If 16-bit MMIO register operations are not supported, then ASSERT().
1708 If Address is not aligned on a 16-bit boundary, then ASSERT().
1709 If StartBit is greater than 15, then ASSERT().
1710 If EndBit is greater than 15, then ASSERT().
1711 If EndBit is less than StartBit, then ASSERT().
1713 @param Address MMIO register to write.
1714 @param StartBit The ordinal of the least significant bit in the bit field.
1716 @param EndBit The ordinal of the most significant bit in the bit field.
1718 @param AndData The value to AND with read value from the MMIO register.
1719 @param OrData The value to OR with the result of the AND operation.
1721 @return The value written back to the MMIO register.
1726 MmioBitFieldAndThenOr16 (
1734 return MmioWrite16 (
1736 BitFieldAndThenOr16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1741 Reads a 32-bit MMIO register, performs a bitwise OR, and writes the
1742 result back to the 32-bit MMIO register.
1744 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1745 OR between the read result and the value specified by OrData, and
1746 writes the result to the 32-bit MMIO register specified by Address. The value
1747 written to the MMIO register is returned. This function must guarantee that
1748 all MMIO read and write operations are serialized.
1750 If 32-bit MMIO register operations are not supported, then ASSERT().
1751 If Address is not aligned on a 32-bit boundary, then ASSERT().
1753 @param Address The MMIO register to write.
1754 @param OrData The value to OR with the read value from the MMIO register.
1756 @return The value written back to the MMIO register.
1766 return MmioWrite32 (Address
, MmioRead32 (Address
) | OrData
);
1770 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
1771 back to the 32-bit MMIO register.
1773 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1774 between the read result and the value specified by AndData, and writes the
1775 result to the 32-bit MMIO register specified by Address. The value written to
1776 the MMIO register is returned. This function must guarantee that all MMIO
1777 read and write operations are serialized.
1779 If 32-bit MMIO register operations are not supported, then ASSERT().
1780 If Address is not aligned on a 32-bit boundary, then ASSERT().
1782 @param Address The MMIO register to write.
1783 @param AndData The value to AND with the read value from the MMIO register.
1785 @return The value written back to the MMIO register.
1795 return MmioWrite32 (Address
, MmioRead32 (Address
) & AndData
);
1799 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
1800 OR, and writes the result back to the 32-bit MMIO register.
1802 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1803 between the read result and the value specified by AndData, performs a
1804 bitwise OR between the result of the AND operation and the value specified by
1805 OrData, and writes the result to the 32-bit MMIO register specified by
1806 Address. The value written to the MMIO register is returned. This function
1807 must guarantee that all MMIO read and write operations are serialized.
1809 If 32-bit MMIO register operations are not supported, then ASSERT().
1810 If Address is not aligned on a 32-bit boundary, then ASSERT().
1812 @param Address The MMIO register to write.
1813 @param AndData The value to AND with the read value from the MMIO register.
1814 @param OrData The value to OR with the result of the AND operation.
1816 @return The value written back to the MMIO register.
1827 return MmioWrite32 (Address
, (MmioRead32 (Address
) & AndData
) | OrData
);
1831 Reads a bit field of a MMIO register.
1833 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
1834 the StartBit and the EndBit. The value of the bit field is returned.
1836 If 32-bit MMIO register operations are not supported, then ASSERT().
1837 If Address is not aligned on a 32-bit boundary, then ASSERT().
1838 If StartBit is greater than 31, then ASSERT().
1839 If EndBit is greater than 31, then ASSERT().
1840 If EndBit is less than StartBit, then ASSERT().
1842 @param Address MMIO register to read.
1843 @param StartBit The ordinal of the least significant bit in the bit field.
1845 @param EndBit The ordinal of the most significant bit in the bit field.
1848 @return The value read.
1853 MmioBitFieldRead32 (
1859 return BitFieldRead32 (MmioRead32 (Address
), StartBit
, EndBit
);
1863 Writes a bit field to a MMIO register.
1865 Writes Value to the bit field of the MMIO register. The bit field is
1866 specified by the StartBit and the EndBit. All other bits in the destination
1867 MMIO register are preserved. The new value of the 32-bit register is returned.
1869 If 32-bit MMIO register operations are not supported, then ASSERT().
1870 If Address is not aligned on a 32-bit boundary, then ASSERT().
1871 If StartBit is greater than 31, then ASSERT().
1872 If EndBit is greater than 31, then ASSERT().
1873 If EndBit is less than StartBit, then ASSERT().
1875 @param Address MMIO register to write.
1876 @param StartBit The ordinal of the least significant bit in the bit field.
1878 @param EndBit The ordinal of the most significant bit in the bit field.
1880 @param Value New value of the bit field.
1882 @return The value written back to the MMIO register.
1887 MmioBitFieldWrite32 (
1894 return MmioWrite32 (
1896 BitFieldWrite32 (MmioRead32 (Address
), StartBit
, EndBit
, Value
)
1901 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
1902 writes the result back to the bit field in the 32-bit MMIO register.
1904 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1905 OR between the read result and the value specified by OrData, and
1906 writes the result to the 32-bit MMIO register specified by Address. The value
1907 written to the MMIO register is returned. This function must guarantee that
1908 all MMIO read and write operations are serialized. Extra left bits in OrData
1911 If 32-bit MMIO register operations are not supported, then ASSERT().
1912 If Address is not aligned on a 32-bit boundary, then ASSERT().
1913 If StartBit is greater than 31, then ASSERT().
1914 If EndBit is greater than 31, then ASSERT().
1915 If EndBit is less than StartBit, then ASSERT().
1917 @param Address MMIO register to write.
1918 @param StartBit The ordinal of the least significant bit in the bit field.
1920 @param EndBit The ordinal of the most significant bit in the bit field.
1922 @param OrData The value to OR with read value from the MMIO register.
1924 @return The value written back to the MMIO register.
1936 return MmioWrite32 (
1938 BitFieldOr32 (MmioRead32 (Address
), StartBit
, EndBit
, OrData
)
1943 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
1944 writes the result back to the bit field in the 32-bit MMIO register.
1946 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1947 between the read result and the value specified by AndData, and writes the
1948 result to the 32-bit MMIO register specified by Address. The value written to
1949 the MMIO register is returned. This function must guarantee that all MMIO
1950 read and write operations are serialized. Extra left bits in AndData are
1953 If 32-bit MMIO register operations are not supported, then ASSERT().
1954 If Address is not aligned on a 32-bit boundary, then ASSERT().
1955 If StartBit is greater than 31, then ASSERT().
1956 If EndBit is greater than 31, then ASSERT().
1957 If EndBit is less than StartBit, then ASSERT().
1959 @param Address MMIO register to write.
1960 @param StartBit The ordinal of the least significant bit in the bit field.
1962 @param EndBit The ordinal of the most significant bit in the bit field.
1964 @param AndData The value to AND with read value from the MMIO register.
1966 @return The value written back to the MMIO register.
1978 return MmioWrite32 (
1980 BitFieldAnd32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
)
1985 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
1986 by a bitwise OR, and writes the result back to the bit field in the
1987 32-bit MMIO register.
1989 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1990 followed by a bitwise OR between the read result and the value
1991 specified by AndData, and writes the result to the 32-bit MMIO register
1992 specified by Address. The value written to the MMIO register is returned.
1993 This function must guarantee that all MMIO read and write operations are
1994 serialized. Extra left bits in both AndData and OrData are stripped.
1996 If 32-bit MMIO register operations are not supported, then ASSERT().
1997 If Address is not aligned on a 32-bit boundary, then ASSERT().
1998 If StartBit is greater than 31, then ASSERT().
1999 If EndBit is greater than 31, then ASSERT().
2000 If EndBit is less than StartBit, then ASSERT().
2002 @param Address MMIO register to write.
2003 @param StartBit The ordinal of the least significant bit in the bit field.
2005 @param EndBit The ordinal of the most significant bit in the bit field.
2007 @param AndData The value to AND with read value from the MMIO register.
2008 @param OrData The value to OR with the result of the AND operation.
2010 @return The value written back to the MMIO register.
2015 MmioBitFieldAndThenOr32 (
2023 return MmioWrite32 (
2025 BitFieldAndThenOr32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
, OrData
)
2030 Reads a 64-bit MMIO register, performs a bitwise OR, and writes the
2031 result back to the 64-bit MMIO register.
2033 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2034 OR between the read result and the value specified by OrData, and
2035 writes the result to the 64-bit MMIO register specified by Address. The value
2036 written to the MMIO register is returned. This function must guarantee that
2037 all MMIO read and write operations are serialized.
2039 If 64-bit MMIO register operations are not supported, then ASSERT().
2040 If Address is not aligned on a 64-bit boundary, then ASSERT().
2042 @param Address The MMIO register to write.
2043 @param OrData The value to OR with the read value from the MMIO register.
2045 @return The value written back to the MMIO register.
2055 return MmioWrite64 (Address
, MmioRead64 (Address
) | OrData
);
2059 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2060 back to the 64-bit MMIO register.
2062 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2063 between the read result and the value specified by AndData, and writes the
2064 result to the 64-bit MMIO register specified by Address. The value written to
2065 the MMIO register is returned. This function must guarantee that all MMIO
2066 read and write operations are serialized.
2068 If 64-bit MMIO register operations are not supported, then ASSERT().
2069 If Address is not aligned on a 64-bit boundary, then ASSERT().
2071 @param Address The MMIO register to write.
2072 @param AndData The value to AND with the read value from the MMIO register.
2074 @return The value written back to the MMIO register.
2084 return MmioWrite64 (Address
, MmioRead64 (Address
) & AndData
);
2088 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2089 OR, and writes the result back to the 64-bit MMIO register.
2091 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2092 between the read result and the value specified by AndData, performs a
2093 bitwise OR between the result of the AND operation and the value specified by
2094 OrData, and writes the result to the 64-bit MMIO register specified by
2095 Address. The value written to the MMIO register is returned. This function
2096 must guarantee that all MMIO read and write operations are serialized.
2098 If 64-bit MMIO register operations are not supported, then ASSERT().
2099 If Address is not aligned on a 64-bit boundary, then ASSERT().
2101 @param Address The MMIO register to write.
2102 @param AndData The value to AND with the read value from the MMIO register.
2103 @param OrData The value to OR with the result of the AND operation.
2105 @return The value written back to the MMIO register.
2116 return MmioWrite64 (Address
, (MmioRead64 (Address
) & AndData
) | OrData
);
2120 Reads a bit field of a MMIO register.
2122 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2123 the StartBit and the EndBit. The value of the bit field is returned.
2125 If 64-bit MMIO register operations are not supported, then ASSERT().
2126 If Address is not aligned on a 64-bit boundary, then ASSERT().
2127 If StartBit is greater than 63, then ASSERT().
2128 If EndBit is greater than 63, then ASSERT().
2129 If EndBit is less than StartBit, then ASSERT().
2131 @param Address MMIO register to read.
2132 @param StartBit The ordinal of the least significant bit in the bit field.
2134 @param EndBit The ordinal of the most significant bit in the bit field.
2137 @return The value read.
2142 MmioBitFieldRead64 (
2148 return BitFieldRead64 (MmioRead64 (Address
), StartBit
, EndBit
);
2152 Writes a bit field to a MMIO register.
2154 Writes Value to the bit field of the MMIO register. The bit field is
2155 specified by the StartBit and the EndBit. All other bits in the destination
2156 MMIO register are preserved. The new value of the 64-bit register is returned.
2158 If 64-bit MMIO register operations are not supported, then ASSERT().
2159 If Address is not aligned on a 64-bit boundary, then ASSERT().
2160 If StartBit is greater than 63, then ASSERT().
2161 If EndBit is greater than 63, then ASSERT().
2162 If EndBit is less than StartBit, then ASSERT().
2164 @param Address MMIO register to write.
2165 @param StartBit The ordinal of the least significant bit in the bit field.
2167 @param EndBit The ordinal of the most significant bit in the bit field.
2169 @param Value New value of the bit field.
2171 @return The value written back to the MMIO register.
2176 MmioBitFieldWrite64 (
2183 return MmioWrite64 (
2185 BitFieldWrite64 (MmioRead64 (Address
), StartBit
, EndBit
, Value
)
2190 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2191 writes the result back to the bit field in the 64-bit MMIO register.
2193 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2194 OR between the read result and the value specified by OrData, and
2195 writes the result to the 64-bit MMIO register specified by Address. The value
2196 written to the MMIO register is returned. This function must guarantee that
2197 all MMIO read and write operations are serialized. Extra left bits in OrData
2200 If 64-bit MMIO register operations are not supported, then ASSERT().
2201 If Address is not aligned on a 64-bit boundary, then ASSERT().
2202 If StartBit is greater than 63, then ASSERT().
2203 If EndBit is greater than 63, then ASSERT().
2204 If EndBit is less than StartBit, then ASSERT().
2206 @param Address MMIO register to write.
2207 @param StartBit The ordinal of the least significant bit in the bit field.
2209 @param EndBit The ordinal of the most significant bit in the bit field.
2211 @param OrData The value to OR with read value from the MMIO register.
2213 @return The value written back to the MMIO register.
2225 return MmioWrite64 (
2227 BitFieldOr64 (MmioRead64 (Address
), StartBit
, EndBit
, OrData
)
2232 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2233 writes the result back to the bit field in the 64-bit MMIO register.
2235 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2236 between the read result and the value specified by AndData, and writes the
2237 result to the 64-bit MMIO register specified by Address. The value written to
2238 the MMIO register is returned. This function must guarantee that all MMIO
2239 read and write operations are serialized. Extra left bits in AndData are
2242 If 64-bit MMIO register operations are not supported, then ASSERT().
2243 If Address is not aligned on a 64-bit boundary, then ASSERT().
2244 If StartBit is greater than 63, then ASSERT().
2245 If EndBit is greater than 63, then ASSERT().
2246 If EndBit is less than StartBit, then ASSERT().
2248 @param Address MMIO register to write.
2249 @param StartBit The ordinal of the least significant bit in the bit field.
2251 @param EndBit The ordinal of the most significant bit in the bit field.
2253 @param AndData The value to AND with read value from the MMIO register.
2255 @return The value written back to the MMIO register.
2267 return MmioWrite64 (
2269 BitFieldAnd64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
)
2274 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2275 by a bitwise OR, and writes the result back to the bit field in the
2276 64-bit MMIO register.
2278 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2279 followed by a bitwise OR between the read result and the value
2280 specified by AndData, and writes the result to the 64-bit MMIO register
2281 specified by Address. The value written to the MMIO register is returned.
2282 This function must guarantee that all MMIO read and write operations are
2283 serialized. Extra left bits in both AndData and OrData are stripped.
2285 If 64-bit MMIO register operations are not supported, then ASSERT().
2286 If Address is not aligned on a 64-bit boundary, then ASSERT().
2287 If StartBit is greater than 63, then ASSERT().
2288 If EndBit is greater than 63, then ASSERT().
2289 If EndBit is less than StartBit, then ASSERT().
2291 @param Address MMIO register to write.
2292 @param StartBit The ordinal of the least significant bit in the bit field.
2294 @param EndBit The ordinal of the most significant bit in the bit field.
2296 @param AndData The value to AND with read value from the MMIO register.
2297 @param OrData The value to OR with the result of the AND operation.
2299 @return The value written back to the MMIO register.
2304 MmioBitFieldAndThenOr64 (
2312 return MmioWrite64 (
2314 BitFieldAndThenOr64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
, OrData
)