]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c
e853a8e71558fdf57738a3196564bea4392771bd
2 High-level Io/Mmio functions.
4 All assertions for bit field operations are handled bit field functions in the
7 Copyright (c) 2006, Intel Corporation<BR>
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 Module Name: IoHighLevel.c
18 The following IoLib instances share the same version of this file:
27 // The package level header files this module uses
31 // The Library classes this module consumes
33 #include <Library/IoLib.h>
34 #include <Library/DebugLib.h>
35 #include <Library/BaseLib.h>
36 #include <Library/PeiServicesTablePointerLib.h>
39 Reads an 8-bit I/O port, performs a bitwise inclusive OR, and writes the
40 result back to the 8-bit I/O port.
42 Reads the 8-bit I/O port specified by Port, performs a bitwise inclusive OR
43 between the read result and the value specified by OrData, and writes the
44 result to the 8-bit I/O port specified by Port. The value written to the I/O
45 port is returned. This function must guarantee that all I/O read and write
46 operations are serialized.
48 If 8-bit I/O port operations are not supported, then ASSERT().
50 @param Port The I/O port to write.
51 @param OrData The value to OR with the read value from the I/O port.
53 @return The value written back to the I/O port.
63 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) | OrData
));
67 Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
68 to the 8-bit I/O port.
70 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
71 the read result and the value specified by AndData, and writes the result to
72 the 8-bit I/O port specified by Port. The value written to the I/O port is
73 returned. This function must guarantee that all I/O read and write operations
76 If 8-bit I/O port operations are not supported, then ASSERT().
78 @param Port The I/O port to write.
79 @param AndData The value to AND with the read value from the I/O port.
81 @return The value written back to the I/O port.
91 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) & AndData
));
95 Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
96 inclusive OR, and writes the result back to the 8-bit I/O port.
98 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
99 the read result and the value specified by AndData, performs a bitwise OR
100 between the result of the AND operation and the value specified by OrData,
101 and writes the result to the 8-bit I/O port specified by Port. The value
102 written to the I/O port is returned. This function must guarantee that all
103 I/O read and write operations are serialized.
105 If 8-bit I/O port operations are not supported, then ASSERT().
107 @param Port The I/O port to write.
108 @param AndData The value to AND with the read value from the I/O port.
109 @param OrData The value to OR with the result of the AND operation.
111 @return The value written back to the I/O port.
122 return IoWrite8 (Port
, (UINT8
) ((IoRead8 (Port
) & AndData
) | OrData
));
126 Reads a bit field of an I/O register.
128 Reads the bit field in an 8-bit I/O register. The bit field is specified by
129 the StartBit and the EndBit. The value of the bit field is returned.
131 If 8-bit I/O port operations are not supported, then ASSERT().
132 If StartBit is greater than 7, then ASSERT().
133 If EndBit is greater than 7, then ASSERT().
134 If EndBit is less than StartBit, then ASSERT().
136 @param Port The I/O port to read.
137 @param StartBit The ordinal of the least significant bit in the bit field.
139 @param EndBit The ordinal of the most significant bit in the bit field.
142 @return The value read.
153 return BitFieldRead8 (IoRead8 (Port
), StartBit
, EndBit
);
157 Writes a bit field to an I/O register.
159 Writes Value to the bit field of the I/O register. The bit field is specified
160 by the StartBit and the EndBit. All other bits in the destination I/O
161 register are preserved. The value written to the I/O port is returned. Extra
162 left bits in Value are stripped.
164 If 8-bit I/O port operations are not supported, then ASSERT().
165 If StartBit is greater than 7, then ASSERT().
166 If EndBit is greater than 7, then ASSERT().
167 If EndBit is less than StartBit, then ASSERT().
169 @param Port The I/O port to write.
170 @param StartBit The ordinal of the least significant bit in the bit field.
172 @param EndBit The ordinal of the most significant bit in the bit field.
174 @param Value New value of the bit field.
176 @return The value written back to the I/O port.
190 BitFieldWrite8 (IoRead8 (Port
), StartBit
, EndBit
, Value
)
195 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
196 result back to the bit field in the 8-bit port.
198 Reads the 8-bit I/O port specified by Port, performs a bitwise inclusive OR
199 between the read result and the value specified by OrData, and writes the
200 result to the 8-bit I/O port specified by Port. The value written to the I/O
201 port is returned. This function must guarantee that all I/O read and write
202 operations are serialized. Extra left bits in OrData are stripped.
204 If 8-bit I/O port operations are not supported, then ASSERT().
205 If StartBit is greater than 7, then ASSERT().
206 If EndBit is greater than 7, then ASSERT().
207 If EndBit is less than StartBit, then ASSERT().
209 @param Port The I/O port to write.
210 @param StartBit The ordinal of the least significant bit in the bit field.
212 @param EndBit The ordinal of the most significant bit in the bit field.
214 @param OrData The value to OR with the read value from the I/O port.
216 @return The value written back to the I/O port.
230 BitFieldOr8 (IoRead8 (Port
), StartBit
, EndBit
, OrData
)
235 Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
236 result back to the bit field in the 8-bit port.
238 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
239 the read result and the value specified by AndData, and writes the result to
240 the 8-bit I/O port specified by Port. The value written to the I/O port is
241 returned. This function must guarantee that all I/O read and write operations
242 are serialized. Extra left bits in AndData are stripped.
244 If 8-bit I/O port operations are not supported, then ASSERT().
245 If StartBit is greater than 7, then ASSERT().
246 If EndBit is greater than 7, then ASSERT().
247 If EndBit is less than StartBit, then ASSERT().
249 @param Port The I/O port to write.
250 @param StartBit The ordinal of the least significant bit in the bit field.
252 @param EndBit The ordinal of the most significant bit in the bit field.
254 @param AndData The value to AND with the read value from the I/O port.
256 @return The value written back to the I/O port.
270 BitFieldAnd8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
)
275 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
276 bitwise inclusive OR, and writes the result back to the bit field in the
279 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
280 by a bitwise inclusive OR between the read result and the value specified by
281 AndData, and writes the result to the 8-bit I/O port specified by Port. The
282 value written to the I/O port is returned. This function must guarantee that
283 all I/O read and write operations are serialized. Extra left bits in both
284 AndData and OrData are stripped.
286 If 8-bit I/O port operations are not supported, then ASSERT().
287 If StartBit is greater than 7, then ASSERT().
288 If EndBit is greater than 7, then ASSERT().
289 If EndBit is less than StartBit, then ASSERT().
291 @param Port The I/O port to write.
292 @param StartBit The ordinal of the least significant bit in the bit field.
294 @param EndBit The ordinal of the most significant bit in the bit field.
296 @param AndData The value to AND with the read value from the I/O port.
297 @param OrData The value to OR with the result of the AND operation.
299 @return The value written back to the I/O port.
304 IoBitFieldAndThenOr8 (
314 BitFieldAndThenOr8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
, OrData
)
319 Reads a 16-bit I/O port, performs a bitwise inclusive OR, and writes the
320 result back to the 16-bit I/O port.
322 Reads the 16-bit I/O port specified by Port, performs a bitwise inclusive OR
323 between the read result and the value specified by OrData, and writes the
324 result to the 16-bit I/O port specified by Port. The value written to the I/O
325 port is returned. This function must guarantee that all I/O read and write
326 operations are serialized.
328 If 16-bit I/O port operations are not supported, then ASSERT().
330 @param Port The I/O port to write.
331 @param OrData The value to OR with the read value from the I/O port.
333 @return The value written back to the I/O port.
343 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) | OrData
));
347 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
348 to the 16-bit I/O port.
350 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
351 the read result and the value specified by AndData, and writes the result to
352 the 16-bit I/O port specified by Port. The value written to the I/O port is
353 returned. This function must guarantee that all I/O read and write operations
356 If 16-bit I/O port operations are not supported, then ASSERT().
358 @param Port The I/O port to write.
359 @param AndData The value to AND with the read value from the I/O port.
361 @return The value written back to the I/O port.
371 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) & AndData
));
375 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
376 inclusive OR, and writes the result back to the 16-bit I/O port.
378 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
379 the read result and the value specified by AndData, performs a bitwise OR
380 between the result of the AND operation and the value specified by OrData,
381 and writes the result to the 16-bit I/O port specified by Port. The value
382 written to the I/O port is returned. This function must guarantee that all
383 I/O read and write operations are serialized.
385 If 16-bit I/O port operations are not supported, then ASSERT().
387 @param Port The I/O port to write.
388 @param AndData The value to AND with the read value from the I/O port.
389 @param OrData The value to OR with the result of the AND operation.
391 @return The value written back to the I/O port.
402 return IoWrite16 (Port
, (UINT16
) ((IoRead16 (Port
) & AndData
) | OrData
));
406 Reads a bit field of an I/O register.
408 Reads the bit field in a 16-bit I/O register. The bit field is specified by
409 the StartBit and the EndBit. The value of the bit field is returned.
411 If 16-bit I/O port operations are not supported, then ASSERT().
412 If StartBit is greater than 15, then ASSERT().
413 If EndBit is greater than 15, then ASSERT().
414 If EndBit is less than StartBit, then ASSERT().
416 @param Port The I/O port to read.
417 @param StartBit The ordinal of the least significant bit in the bit field.
419 @param EndBit The ordinal of the most significant bit in the bit field.
422 @return The value read.
433 return BitFieldRead16 (IoRead16 (Port
), StartBit
, EndBit
);
437 Writes a bit field to an I/O register.
439 Writes Value to the bit field of the I/O register. The bit field is specified
440 by the StartBit and the EndBit. All other bits in the destination I/O
441 register are preserved. The value written to the I/O port is returned. Extra
442 left bits in Value are stripped.
444 If 16-bit I/O port operations are not supported, then ASSERT().
445 If StartBit is greater than 15, then ASSERT().
446 If EndBit is greater than 15, then ASSERT().
447 If EndBit is less than StartBit, then ASSERT().
449 @param Port The I/O port to write.
450 @param StartBit The ordinal of the least significant bit in the bit field.
452 @param EndBit The ordinal of the most significant bit in the bit field.
454 @param Value New value of the bit field.
456 @return The value written back to the I/O port.
470 BitFieldWrite16 (IoRead16 (Port
), StartBit
, EndBit
, Value
)
475 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
476 result back to the bit field in the 16-bit port.
478 Reads the 16-bit I/O port specified by Port, performs a bitwise inclusive OR
479 between the read result and the value specified by OrData, and writes the
480 result to the 16-bit I/O port specified by Port. The value written to the I/O
481 port is returned. This function must guarantee that all I/O read and write
482 operations are serialized. Extra left bits in OrData are stripped.
484 If 16-bit I/O port operations are not supported, then ASSERT().
485 If StartBit is greater than 15, then ASSERT().
486 If EndBit is greater than 15, then ASSERT().
487 If EndBit is less than StartBit, then ASSERT().
489 @param Port The I/O port to write.
490 @param StartBit The ordinal of the least significant bit in the bit field.
492 @param EndBit The ordinal of the most significant bit in the bit field.
494 @param OrData The value to OR with the read value from the I/O port.
496 @return The value written back to the I/O port.
510 BitFieldOr16 (IoRead16 (Port
), StartBit
, EndBit
, OrData
)
515 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
516 result back to the bit field in the 16-bit port.
518 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
519 the read result and the value specified by AndData, and writes the result to
520 the 16-bit I/O port specified by Port. The value written to the I/O port is
521 returned. This function must guarantee that all I/O read and write operations
522 are serialized. Extra left bits in AndData are stripped.
524 If 16-bit I/O port operations are not supported, then ASSERT().
525 If StartBit is greater than 15, then ASSERT().
526 If EndBit is greater than 15, then ASSERT().
527 If EndBit is less than StartBit, then ASSERT().
529 @param Port The I/O port to write.
530 @param StartBit The ordinal of the least significant bit in the bit field.
532 @param EndBit The ordinal of the most significant bit in the bit field.
534 @param AndData The value to AND with the read value from the I/O port.
536 @return The value written back to the I/O port.
550 BitFieldAnd16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
)
555 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
556 bitwise inclusive OR, and writes the result back to the bit field in the
559 Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
560 by a bitwise inclusive OR between the read result and the value specified by
561 AndData, and writes the result to the 16-bit I/O port specified by Port. The
562 value written to the I/O port is returned. This function must guarantee that
563 all I/O read and write operations are serialized. Extra left bits in both
564 AndData and OrData are stripped.
566 If 16-bit I/O port operations are not supported, then ASSERT().
567 If StartBit is greater than 15, then ASSERT().
568 If EndBit is greater than 15, then ASSERT().
569 If EndBit is less than StartBit, then ASSERT().
571 @param Port The I/O port to write.
572 @param StartBit The ordinal of the least significant bit in the bit field.
574 @param EndBit The ordinal of the most significant bit in the bit field.
576 @param AndData The value to AND with the read value from the I/O port.
577 @param OrData The value to OR with the result of the AND operation.
579 @return The value written back to the I/O port.
584 IoBitFieldAndThenOr16 (
594 BitFieldAndThenOr16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
, OrData
)
599 Reads a 32-bit I/O port, performs a bitwise inclusive OR, and writes the
600 result back to the 32-bit I/O port.
602 Reads the 32-bit I/O port specified by Port, performs a bitwise inclusive OR
603 between the read result and the value specified by OrData, and writes the
604 result to the 32-bit I/O port specified by Port. The value written to the I/O
605 port is returned. This function must guarantee that all I/O read and write
606 operations are serialized.
608 If 32-bit I/O port operations are not supported, then ASSERT().
610 @param Port The I/O port to write.
611 @param OrData The value to OR with the read value from the I/O port.
613 @return The value written back to the I/O port.
623 return IoWrite32 (Port
, IoRead32 (Port
) | OrData
);
627 Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
628 to the 32-bit I/O port.
630 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
631 the read result and the value specified by AndData, and writes the result to
632 the 32-bit I/O port specified by Port. The value written to the I/O port is
633 returned. This function must guarantee that all I/O read and write operations
636 If 32-bit I/O port operations are not supported, then ASSERT().
638 @param Port The I/O port to write.
639 @param AndData The value to AND with the read value from the I/O port.
641 @return The value written back to the I/O port.
651 return IoWrite32 (Port
, IoRead32 (Port
) & AndData
);
655 Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
656 inclusive OR, and writes the result back to the 32-bit I/O port.
658 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
659 the read result and the value specified by AndData, performs a bitwise OR
660 between the result of the AND operation and the value specified by OrData,
661 and writes the result to the 32-bit I/O port specified by Port. The value
662 written to the I/O port is returned. This function must guarantee that all
663 I/O read and write operations are serialized.
665 If 32-bit I/O port operations are not supported, then ASSERT().
667 @param Port The I/O port to write.
668 @param AndData The value to AND with the read value from the I/O port.
669 @param OrData The value to OR with the result of the AND operation.
671 @return The value written back to the I/O port.
682 return IoWrite32 (Port
, (IoRead32 (Port
) & AndData
) | OrData
);
686 Reads a bit field of an I/O register.
688 Reads the bit field in a 32-bit I/O register. The bit field is specified by
689 the StartBit and the EndBit. The value of the bit field is returned.
691 If 32-bit I/O port operations are not supported, then ASSERT().
692 If StartBit is greater than 31, then ASSERT().
693 If EndBit is greater than 31, then ASSERT().
694 If EndBit is less than StartBit, then ASSERT().
696 @param Port The I/O port to read.
697 @param StartBit The ordinal of the least significant bit in the bit field.
699 @param EndBit The ordinal of the most significant bit in the bit field.
702 @return The value read.
713 return BitFieldRead32 (IoRead32 (Port
), StartBit
, EndBit
);
717 Writes a bit field to an I/O register.
719 Writes Value to the bit field of the I/O register. The bit field is specified
720 by the StartBit and the EndBit. All other bits in the destination I/O
721 register are preserved. The value written to the I/O port is returned. Extra
722 left bits in Value are stripped.
724 If 32-bit I/O port operations are not supported, 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 inclusive 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 StartBit is greater than 31, then ASSERT().
766 If EndBit is greater than 31, then ASSERT().
767 If EndBit is less than StartBit, then ASSERT().
769 @param Port The I/O port to write.
770 @param StartBit The ordinal of the least significant bit in the bit field.
772 @param EndBit The ordinal of the most significant bit in the bit field.
774 @param OrData The value to OR with the read value from the I/O port.
776 @return The value written back to the I/O port.
790 BitFieldOr32 (IoRead32 (Port
), StartBit
, EndBit
, OrData
)
795 Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
796 result back to the bit field in the 32-bit port.
798 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
799 the read result and the value specified by AndData, and writes the result to
800 the 32-bit I/O port specified by Port. The value written to the I/O port is
801 returned. This function must guarantee that all I/O read and write operations
802 are serialized. Extra left bits in AndData are stripped.
804 If 32-bit I/O port operations are not supported, then ASSERT().
805 If StartBit is greater than 31, then ASSERT().
806 If EndBit is greater than 31, then ASSERT().
807 If EndBit is less than StartBit, then ASSERT().
809 @param Port The I/O port to write.
810 @param StartBit The ordinal of the least significant bit in the bit field.
812 @param EndBit The ordinal of the most significant bit in the bit field.
814 @param AndData The value to AND with the read value from the I/O port.
816 @return The value written back to the I/O port.
830 BitFieldAnd32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
)
835 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
836 bitwise inclusive OR, and writes the result back to the bit field in the
839 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
840 by a bitwise inclusive OR between the read result and the value specified by
841 AndData, and writes the result to the 32-bit I/O port specified by Port. The
842 value written to the I/O port is returned. This function must guarantee that
843 all I/O read and write operations are serialized. Extra left bits in both
844 AndData and OrData are stripped.
846 If 32-bit I/O port operations are not supported, then ASSERT().
847 If StartBit is greater than 31, then ASSERT().
848 If EndBit is greater than 31, then ASSERT().
849 If EndBit is less than StartBit, 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 inclusive 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 inclusive 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().
1009 @param Port The I/O port to write.
1010 @param StartBit The ordinal of the least significant bit in the bit field.
1012 @param EndBit The ordinal of the most significant bit in the bit field.
1014 @param Value New value of the bit field.
1016 @return The value written back to the I/O port.
1030 BitFieldWrite64 (IoRead64 (Port
), StartBit
, EndBit
, Value
)
1035 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1036 result back to the bit field in the 64-bit port.
1038 Reads the 64-bit I/O port specified by Port, performs a bitwise inclusive OR
1039 between the read result and the value specified by OrData, and writes the
1040 result to the 64-bit I/O port specified by Port. The value written to the I/O
1041 port is returned. This function must guarantee that all I/O read and write
1042 operations are serialized. Extra left bits in OrData are stripped.
1044 If 64-bit I/O port operations are not supported, then ASSERT().
1045 If StartBit is greater than 63, then ASSERT().
1046 If EndBit is greater than 63, then ASSERT().
1047 If EndBit is less than StartBit, then ASSERT().
1049 @param Port The I/O port to write.
1050 @param StartBit The ordinal of the least significant bit in the bit field.
1052 @param EndBit The ordinal of the most significant bit in the bit field.
1054 @param OrData The value to OR with the read value from the I/O port.
1056 @return The value written back to the I/O port.
1070 BitFieldOr64 (IoRead64 (Port
), StartBit
, EndBit
, OrData
)
1075 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1076 result back to the bit field in the 64-bit port.
1078 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1079 the read result and the value specified by AndData, and writes the result to
1080 the 64-bit I/O port specified by Port. The value written to the I/O port is
1081 returned. This function must guarantee that all I/O read and write operations
1082 are serialized. Extra left bits in AndData are stripped.
1084 If 64-bit I/O port operations are not supported, then ASSERT().
1085 If StartBit is greater than 63, then ASSERT().
1086 If EndBit is greater than 63, then ASSERT().
1087 If EndBit is less than StartBit, then ASSERT().
1089 @param Port The I/O port to write.
1090 @param StartBit The ordinal of the least significant bit in the bit field.
1092 @param EndBit The ordinal of the most significant bit in the bit field.
1094 @param AndData The value to AND with the read value from the I/O port.
1096 @return The value written back to the I/O port.
1110 BitFieldAnd64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
)
1115 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
1116 bitwise inclusive OR, and writes the result back to the bit field in the
1119 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
1120 by a bitwise inclusive OR between the read result and the value specified by
1121 AndData, and writes the result to the 64-bit I/O port specified by Port. The
1122 value written to the I/O port is returned. This function must guarantee that
1123 all I/O read and write operations are serialized. Extra left bits in both
1124 AndData and OrData are stripped.
1126 If 64-bit I/O port operations are not supported, then ASSERT().
1127 If StartBit is greater than 63, then ASSERT().
1128 If EndBit is greater than 63, then ASSERT().
1129 If EndBit is less than StartBit, then ASSERT().
1131 @param Port The I/O port to write.
1132 @param StartBit The ordinal of the least significant bit in the bit field.
1134 @param EndBit The ordinal of the most significant bit in the bit field.
1136 @param AndData The value to AND with the read value from the I/O port.
1137 @param OrData The value to OR with the result of the AND operation.
1139 @return The value written back to the I/O port.
1144 IoBitFieldAndThenOr64 (
1154 BitFieldAndThenOr64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
, OrData
)
1159 Reads an 8-bit MMIO register, performs a bitwise inclusive OR, and writes the
1160 result back to the 8-bit MMIO register.
1162 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1163 inclusive OR between the read result and the value specified by OrData, and
1164 writes the result to the 8-bit MMIO register specified by Address. The value
1165 written to the MMIO register is returned. This function must guarantee that
1166 all MMIO read and write operations are serialized.
1168 If 8-bit MMIO register operations are not supported, then ASSERT().
1170 @param Address The MMIO register to write.
1171 @param OrData The value to OR with the read value from the MMIO register.
1173 @return The value written back to the MMIO register.
1183 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) | OrData
));
1187 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1188 back to the 8-bit MMIO register.
1190 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1191 between the read result and the value specified by AndData, and writes the
1192 result to the 8-bit MMIO register specified by Address. The value written to
1193 the MMIO register is returned. This function must guarantee that all MMIO
1194 read and write operations are serialized.
1196 If 8-bit MMIO register operations are not supported, then ASSERT().
1198 @param Address The MMIO register to write.
1199 @param AndData The value to AND with the read value from the MMIO register.
1201 @return The value written back to the MMIO register.
1211 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) & AndData
));
1215 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1216 inclusive OR, and writes the result back to the 8-bit MMIO register.
1218 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1219 between the read result and the value specified by AndData, performs a
1220 bitwise OR between the result of the AND operation and the value specified by
1221 OrData, and writes the result to the 8-bit MMIO register specified by
1222 Address. The value written to the MMIO register is returned. This function
1223 must guarantee that all MMIO read and write operations are serialized.
1225 If 8-bit MMIO register operations are not supported, then ASSERT().
1228 @param Address The MMIO register to write.
1229 @param AndData The value to AND with the read value from the MMIO register.
1230 @param OrData The value to OR with the result of the AND operation.
1232 @return The value written back to the MMIO register.
1243 return MmioWrite8 (Address
, (UINT8
) ((MmioRead8 (Address
) & AndData
) | OrData
));
1247 Reads a bit field of a MMIO register.
1249 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1250 the StartBit and the EndBit. The value of the bit field is returned.
1252 If 8-bit MMIO register operations are not supported, then ASSERT().
1253 If StartBit is greater than 7, then ASSERT().
1254 If EndBit is greater than 7, then ASSERT().
1255 If EndBit is less than StartBit, then ASSERT().
1257 @param Address MMIO register to read.
1258 @param StartBit The ordinal of the least significant bit in the bit field.
1260 @param EndBit The ordinal of the most significant bit in the bit field.
1263 @return The value read.
1274 return BitFieldRead8 (MmioRead8 (Address
), StartBit
, EndBit
);
1278 Writes a bit field to a MMIO register.
1280 Writes Value to the bit field of the MMIO register. The bit field is
1281 specified by the StartBit and the EndBit. All other bits in the destination
1282 MMIO register are preserved. The new value of the 8-bit register is returned.
1284 If 8-bit MMIO register operations are not supported, then ASSERT().
1285 If StartBit is greater than 7, then ASSERT().
1286 If EndBit is greater than 7, then ASSERT().
1287 If EndBit is less than StartBit, then ASSERT().
1289 @param Address MMIO register to write.
1290 @param StartBit The ordinal of the least significant bit in the bit field.
1292 @param EndBit The ordinal of the most significant bit in the bit field.
1294 @param Value New value of the bit field.
1296 @return The value written back to the MMIO register.
1301 MmioBitFieldWrite8 (
1310 BitFieldWrite8 (MmioRead8 (Address
), StartBit
, EndBit
, Value
)
1315 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1316 writes the result back to the bit field in the 8-bit MMIO register.
1318 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1319 inclusive OR between the read result and the value specified by OrData, and
1320 writes the result to the 8-bit MMIO register specified by Address. The value
1321 written to the MMIO register is returned. This function must guarantee that
1322 all MMIO read and write operations are serialized. Extra left bits in OrData
1325 If 8-bit MMIO register operations are not supported, then ASSERT().
1326 If StartBit is greater than 7, then ASSERT().
1327 If EndBit is greater than 7, then ASSERT().
1328 If EndBit is less than StartBit, then ASSERT().
1330 @param Address MMIO register to write.
1331 @param StartBit The ordinal of the least significant bit in the bit field.
1333 @param EndBit The ordinal of the most significant bit in the bit field.
1335 @param OrData The value to OR with read value from the MMIO register.
1337 @return The value written back to the MMIO register.
1351 BitFieldOr8 (MmioRead8 (Address
), StartBit
, EndBit
, OrData
)
1356 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1357 writes the result back to the bit field in the 8-bit MMIO register.
1359 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1360 between the read result and the value specified by AndData, and writes the
1361 result to the 8-bit MMIO register specified by Address. The value written to
1362 the MMIO register is returned. This function must guarantee that all MMIO
1363 read and write operations are serialized. Extra left bits in AndData are
1366 If 8-bit MMIO register operations are not supported, then ASSERT().
1367 If StartBit is greater than 7, then ASSERT().
1368 If EndBit is greater than 7, then ASSERT().
1369 If EndBit is less than StartBit, then ASSERT().
1371 @param Address MMIO register to write.
1372 @param StartBit The ordinal of the least significant bit in the bit field.
1374 @param EndBit The ordinal of the most significant bit in the bit field.
1376 @param AndData The value to AND with read value from the MMIO register.
1378 @return The value written back to the MMIO register.
1392 BitFieldAnd8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
)
1397 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1398 by a bitwise inclusive OR, and writes the result back to the bit field in the
1399 8-bit MMIO register.
1401 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1402 followed by a bitwise inclusive OR between the read result and the value
1403 specified by AndData, and writes the result to the 8-bit MMIO register
1404 specified by Address. The value written to the MMIO register is returned.
1405 This function must guarantee that all MMIO read and write operations are
1406 serialized. Extra left bits in both AndData and OrData are stripped.
1408 If 8-bit MMIO register operations are not supported, then ASSERT().
1409 If StartBit is greater than 7, then ASSERT().
1410 If EndBit is greater than 7, then ASSERT().
1411 If EndBit is less than StartBit, then ASSERT().
1413 @param Address MMIO register to write.
1414 @param StartBit The ordinal of the least significant bit in the bit field.
1416 @param EndBit The ordinal of the most significant bit in the bit field.
1418 @param AndData The value to AND with read value from the MMIO register.
1419 @param OrData The value to OR with the result of the AND operation.
1421 @return The value written back to the MMIO register.
1426 MmioBitFieldAndThenOr8 (
1436 BitFieldAndThenOr8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1441 Reads a 16-bit MMIO register, performs a bitwise inclusive OR, and writes the
1442 result back to the 16-bit MMIO register.
1444 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1445 inclusive OR between the read result and the value specified by OrData, and
1446 writes the result to the 16-bit MMIO register specified by Address. The value
1447 written to the MMIO register is returned. This function must guarantee that
1448 all MMIO read and write operations are serialized.
1450 If 16-bit MMIO register operations are not supported, then ASSERT().
1452 @param Address The MMIO register to write.
1453 @param OrData The value to OR with the read value from the MMIO register.
1455 @return The value written back to the MMIO register.
1465 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) | OrData
));
1469 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1470 back to the 16-bit MMIO register.
1472 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1473 between the read result and the value specified by AndData, and writes the
1474 result to the 16-bit MMIO register specified by Address. The value written to
1475 the MMIO register is returned. This function must guarantee that all MMIO
1476 read and write operations are serialized.
1478 If 16-bit MMIO register operations are not supported, then ASSERT().
1480 @param Address The MMIO register to write.
1481 @param AndData The value to AND with the read value from the MMIO register.
1483 @return The value written back to the MMIO register.
1493 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) & AndData
));
1497 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1498 inclusive OR, and writes the result back to the 16-bit MMIO register.
1500 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1501 between the read result and the value specified by AndData, performs a
1502 bitwise OR between the result of the AND operation and the value specified by
1503 OrData, and writes the result to the 16-bit MMIO register specified by
1504 Address. The value written to the MMIO register is returned. This function
1505 must guarantee that all MMIO read and write operations are serialized.
1507 If 16-bit MMIO register operations are not supported, then ASSERT().
1510 @param Address The MMIO register to write.
1511 @param AndData The value to AND with the read value from the MMIO register.
1512 @param OrData The value to OR with the result of the AND operation.
1514 @return The value written back to the MMIO register.
1525 return MmioWrite16 (Address
, (UINT16
) ((MmioRead16 (Address
) & AndData
) | OrData
));
1529 Reads a bit field of a MMIO register.
1531 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
1532 the StartBit and the EndBit. The value of the bit field is returned.
1534 If 16-bit MMIO register operations are not supported, then ASSERT().
1535 If StartBit is greater than 15, then ASSERT().
1536 If EndBit is greater than 15, then ASSERT().
1537 If EndBit is less than StartBit, then ASSERT().
1539 @param Address MMIO register to read.
1540 @param StartBit The ordinal of the least significant bit in the bit field.
1542 @param EndBit The ordinal of the most significant bit in the bit field.
1545 @return The value read.
1550 MmioBitFieldRead16 (
1556 return BitFieldRead16 (MmioRead16 (Address
), StartBit
, EndBit
);
1560 Writes a bit field to a MMIO register.
1562 Writes Value to the bit field of the MMIO register. The bit field is
1563 specified by the StartBit and the EndBit. All other bits in the destination
1564 MMIO register are preserved. The new value of the 16-bit register is returned.
1566 If 16-bit MMIO register operations are not supported, then ASSERT().
1567 If StartBit is greater than 15, then ASSERT().
1568 If EndBit is greater than 15, then ASSERT().
1569 If EndBit is less than StartBit, then ASSERT().
1571 @param Address MMIO register to write.
1572 @param StartBit The ordinal of the least significant bit in the bit field.
1574 @param EndBit The ordinal of the most significant bit in the bit field.
1576 @param Value New value of the bit field.
1578 @return The value written back to the MMIO register.
1583 MmioBitFieldWrite16 (
1590 return MmioWrite16 (
1592 BitFieldWrite16 (MmioRead16 (Address
), StartBit
, EndBit
, Value
)
1597 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
1598 writes the result back to the bit field in the 16-bit MMIO register.
1600 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1601 inclusive OR between the read result and the value specified by OrData, and
1602 writes the result to the 16-bit MMIO register specified by Address. The value
1603 written to the MMIO register is returned. This function must guarantee that
1604 all MMIO read and write operations are serialized. Extra left bits in OrData
1607 If 16-bit MMIO register operations are not supported, then ASSERT().
1608 If StartBit is greater than 15, then ASSERT().
1609 If EndBit is greater than 15, then ASSERT().
1610 If EndBit is less than StartBit, then ASSERT().
1612 @param Address MMIO register to write.
1613 @param StartBit The ordinal of the least significant bit in the bit field.
1615 @param EndBit The ordinal of the most significant bit in the bit field.
1617 @param OrData The value to OR with read value from the MMIO register.
1619 @return The value written back to the MMIO register.
1631 return MmioWrite16 (
1633 BitFieldOr16 (MmioRead16 (Address
), StartBit
, EndBit
, OrData
)
1638 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
1639 writes the result back to the bit field in the 16-bit MMIO register.
1641 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1642 between the read result and the value specified by AndData, and writes the
1643 result to the 16-bit MMIO register specified by Address. The value written to
1644 the MMIO register is returned. This function must guarantee that all MMIO
1645 read and write operations are serialized. Extra left bits in AndData are
1648 If 16-bit MMIO register operations are not supported, then ASSERT().
1649 If StartBit is greater than 15, then ASSERT().
1650 If EndBit is greater than 15, then ASSERT().
1651 If EndBit is less than StartBit, then ASSERT().
1653 @param Address MMIO register to write.
1654 @param StartBit The ordinal of the least significant bit in the bit field.
1656 @param EndBit The ordinal of the most significant bit in the bit field.
1658 @param AndData The value to AND with read value from the MMIO register.
1660 @return The value written back to the MMIO register.
1672 return MmioWrite16 (
1674 BitFieldAnd16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
)
1679 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
1680 by a bitwise inclusive OR, and writes the result back to the bit field in the
1681 16-bit MMIO register.
1683 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1684 followed by a bitwise inclusive OR between the read result and the value
1685 specified by AndData, and writes the result to the 16-bit MMIO register
1686 specified by Address. The value written to the MMIO register is returned.
1687 This function must guarantee that all MMIO read and write operations are
1688 serialized. Extra left bits in both AndData and OrData are stripped.
1690 If 16-bit MMIO register operations are not supported, then ASSERT().
1691 If StartBit is greater than 15, then ASSERT().
1692 If EndBit is greater than 15, then ASSERT().
1693 If EndBit is less than StartBit, then ASSERT().
1695 @param Address MMIO register to write.
1696 @param StartBit The ordinal of the least significant bit in the bit field.
1698 @param EndBit The ordinal of the most significant bit in the bit field.
1700 @param AndData The value to AND with read value from the MMIO register.
1701 @param OrData The value to OR with the result of the AND operation.
1703 @return The value written back to the MMIO register.
1708 MmioBitFieldAndThenOr16 (
1716 return MmioWrite16 (
1718 BitFieldAndThenOr16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1723 Reads a 32-bit MMIO register, performs a bitwise inclusive OR, and writes the
1724 result back to the 32-bit MMIO register.
1726 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1727 inclusive OR between the read result and the value specified by OrData, and
1728 writes the result to the 32-bit MMIO register specified by Address. The value
1729 written to the MMIO register is returned. This function must guarantee that
1730 all MMIO read and write operations are serialized.
1732 If 32-bit MMIO register operations are not supported, then ASSERT().
1734 @param Address The MMIO register to write.
1735 @param OrData The value to OR with the read value from the MMIO register.
1737 @return The value written back to the MMIO register.
1747 return MmioWrite32 (Address
, MmioRead32 (Address
) | OrData
);
1751 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
1752 back to the 32-bit MMIO register.
1754 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1755 between the read result and the value specified by AndData, and writes the
1756 result to the 32-bit MMIO register specified by Address. The value written to
1757 the MMIO register is returned. This function must guarantee that all MMIO
1758 read and write operations are serialized.
1760 If 32-bit MMIO register operations are not supported, then ASSERT().
1762 @param Address The MMIO register to write.
1763 @param AndData The value to AND with the read value from the MMIO register.
1765 @return The value written back to the MMIO register.
1775 return MmioWrite32 (Address
, MmioRead32 (Address
) & AndData
);
1779 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
1780 inclusive OR, and writes the result back to the 32-bit MMIO register.
1782 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1783 between the read result and the value specified by AndData, performs a
1784 bitwise OR between the result of the AND operation and the value specified by
1785 OrData, and writes the result to the 32-bit MMIO register specified by
1786 Address. The value written to the MMIO register is returned. This function
1787 must guarantee that all MMIO read and write operations are serialized.
1789 If 32-bit MMIO register operations are not supported, then ASSERT().
1792 @param Address The MMIO register to write.
1793 @param AndData The value to AND with the read value from the MMIO register.
1794 @param OrData The value to OR with the result of the AND operation.
1796 @return The value written back to the MMIO register.
1807 return MmioWrite32 (Address
, (MmioRead32 (Address
) & AndData
) | OrData
);
1811 Reads a bit field of a MMIO register.
1813 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
1814 the StartBit and the EndBit. The value of the bit field is returned.
1816 If 32-bit MMIO register operations are not supported, then ASSERT().
1817 If StartBit is greater than 31, then ASSERT().
1818 If EndBit is greater than 31, then ASSERT().
1819 If EndBit is less than StartBit, then ASSERT().
1821 @param Address MMIO register to read.
1822 @param StartBit The ordinal of the least significant bit in the bit field.
1824 @param EndBit The ordinal of the most significant bit in the bit field.
1827 @return The value read.
1832 MmioBitFieldRead32 (
1838 return BitFieldRead32 (MmioRead32 (Address
), StartBit
, EndBit
);
1842 Writes a bit field to a MMIO register.
1844 Writes Value to the bit field of the MMIO register. The bit field is
1845 specified by the StartBit and the EndBit. All other bits in the destination
1846 MMIO register are preserved. The new value of the 32-bit register is returned.
1848 If 32-bit MMIO register operations are not supported, then ASSERT().
1849 If StartBit is greater than 31, then ASSERT().
1850 If EndBit is greater than 31, then ASSERT().
1851 If EndBit is less than StartBit, then ASSERT().
1853 @param Address MMIO register to write.
1854 @param StartBit The ordinal of the least significant bit in the bit field.
1856 @param EndBit The ordinal of the most significant bit in the bit field.
1858 @param Value New value of the bit field.
1860 @return The value written back to the MMIO register.
1865 MmioBitFieldWrite32 (
1872 return MmioWrite32 (
1874 BitFieldWrite32 (MmioRead32 (Address
), StartBit
, EndBit
, Value
)
1879 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
1880 writes the result back to the bit field in the 32-bit MMIO register.
1882 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1883 inclusive OR between the read result and the value specified by OrData, and
1884 writes the result to the 32-bit MMIO register specified by Address. The value
1885 written to the MMIO register is returned. This function must guarantee that
1886 all MMIO read and write operations are serialized. Extra left bits in OrData
1889 If 32-bit MMIO register operations are not supported, then ASSERT().
1890 If StartBit is greater than 31, then ASSERT().
1891 If EndBit is greater than 31, then ASSERT().
1892 If EndBit is less than StartBit, then ASSERT().
1894 @param Address MMIO register to write.
1895 @param StartBit The ordinal of the least significant bit in the bit field.
1897 @param EndBit The ordinal of the most significant bit in the bit field.
1899 @param OrData The value to OR with read value from the MMIO register.
1901 @return The value written back to the MMIO register.
1913 return MmioWrite32 (
1915 BitFieldOr32 (MmioRead32 (Address
), StartBit
, EndBit
, OrData
)
1920 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
1921 writes the result back to the bit field in the 32-bit MMIO register.
1923 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1924 between the read result and the value specified by AndData, and writes the
1925 result to the 32-bit MMIO register specified by Address. The value written to
1926 the MMIO register is returned. This function must guarantee that all MMIO
1927 read and write operations are serialized. Extra left bits in AndData are
1930 If 32-bit MMIO register operations are not supported, then ASSERT().
1931 If StartBit is greater than 31, then ASSERT().
1932 If EndBit is greater than 31, then ASSERT().
1933 If EndBit is less than StartBit, then ASSERT().
1935 @param Address MMIO register to write.
1936 @param StartBit The ordinal of the least significant bit in the bit field.
1938 @param EndBit The ordinal of the most significant bit in the bit field.
1940 @param AndData The value to AND with read value from the MMIO register.
1942 @return The value written back to the MMIO register.
1954 return MmioWrite32 (
1956 BitFieldAnd32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
)
1961 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
1962 by a bitwise inclusive OR, and writes the result back to the bit field in the
1963 32-bit MMIO register.
1965 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1966 followed by a bitwise inclusive OR between the read result and the value
1967 specified by AndData, and writes the result to the 32-bit MMIO register
1968 specified by Address. The value written to the MMIO register is returned.
1969 This function must guarantee that all MMIO read and write operations are
1970 serialized. Extra left bits in both AndData and OrData are stripped.
1972 If 32-bit MMIO register operations are not supported, then ASSERT().
1973 If StartBit is greater than 31, then ASSERT().
1974 If EndBit is greater than 31, then ASSERT().
1975 If EndBit is less than StartBit, then ASSERT().
1977 @param Address MMIO register to write.
1978 @param StartBit The ordinal of the least significant bit in the bit field.
1980 @param EndBit The ordinal of the most significant bit in the bit field.
1982 @param AndData The value to AND with read value from the MMIO register.
1983 @param OrData The value to OR with the result of the AND operation.
1985 @return The value written back to the MMIO register.
1990 MmioBitFieldAndThenOr32 (
1998 return MmioWrite32 (
2000 BitFieldAndThenOr32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
, OrData
)
2005 Reads a 64-bit MMIO register, performs a bitwise inclusive OR, and writes the
2006 result back to the 64-bit MMIO register.
2008 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2009 inclusive OR between the read result and the value specified by OrData, and
2010 writes the result to the 64-bit MMIO register specified by Address. The value
2011 written to the MMIO register is returned. This function must guarantee that
2012 all MMIO read and write operations are serialized.
2014 If 64-bit MMIO register operations are not supported, then ASSERT().
2016 @param Address The MMIO register to write.
2017 @param OrData The value to OR with the read value from the MMIO register.
2019 @return The value written back to the MMIO register.
2029 return MmioWrite64 (Address
, MmioRead64 (Address
) | OrData
);
2033 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2034 back to the 64-bit MMIO register.
2036 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2037 between the read result and the value specified by AndData, and writes the
2038 result to the 64-bit MMIO register specified by Address. The value written to
2039 the MMIO register is returned. This function must guarantee that all MMIO
2040 read and write operations are serialized.
2042 If 64-bit MMIO register operations are not supported, then ASSERT().
2044 @param Address The MMIO register to write.
2045 @param AndData The value to AND with the read value from the MMIO register.
2047 @return The value written back to the MMIO register.
2057 return MmioWrite64 (Address
, MmioRead64 (Address
) & AndData
);
2061 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2062 inclusive OR, and writes the result back to the 64-bit MMIO register.
2064 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2065 between the read result and the value specified by AndData, performs a
2066 bitwise OR between the result of the AND operation and the value specified by
2067 OrData, and writes the result to the 64-bit MMIO register specified by
2068 Address. The value written to the MMIO register is returned. This function
2069 must guarantee that all MMIO read and write operations are serialized.
2071 If 64-bit MMIO register operations are not supported, then ASSERT().
2074 @param Address The MMIO register to write.
2075 @param AndData The value to AND with the read value from the MMIO register.
2076 @param OrData The value to OR with the result of the AND operation.
2078 @return The value written back to the MMIO register.
2089 return MmioWrite64 (Address
, (MmioRead64 (Address
) & AndData
) | OrData
);
2093 Reads a bit field of a MMIO register.
2095 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2096 the StartBit and the EndBit. The value of the bit field is returned.
2098 If 64-bit MMIO register operations are not supported, then ASSERT().
2099 If StartBit is greater than 63, then ASSERT().
2100 If EndBit is greater than 63, then ASSERT().
2101 If EndBit is less than StartBit, then ASSERT().
2103 @param Address MMIO register to read.
2104 @param StartBit The ordinal of the least significant bit in the bit field.
2106 @param EndBit The ordinal of the most significant bit in the bit field.
2109 @return The value read.
2114 MmioBitFieldRead64 (
2120 return BitFieldRead64 (MmioRead64 (Address
), StartBit
, EndBit
);
2124 Writes a bit field to a MMIO register.
2126 Writes Value to the bit field of the MMIO register. The bit field is
2127 specified by the StartBit and the EndBit. All other bits in the destination
2128 MMIO register are preserved. The new value of the 64-bit register is returned.
2130 If 64-bit MMIO register operations are not supported, then ASSERT().
2131 If StartBit is greater than 63, then ASSERT().
2132 If EndBit is greater than 63, then ASSERT().
2133 If EndBit is less than StartBit, then ASSERT().
2135 @param Address MMIO register to write.
2136 @param StartBit The ordinal of the least significant bit in the bit field.
2138 @param EndBit The ordinal of the most significant bit in the bit field.
2140 @param Value New value of the bit field.
2142 @return The value written back to the MMIO register.
2147 MmioBitFieldWrite64 (
2154 return MmioWrite64 (
2156 BitFieldWrite64 (MmioRead64 (Address
), StartBit
, EndBit
, Value
)
2161 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2162 writes the result back to the bit field in the 64-bit MMIO register.
2164 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2165 inclusive OR between the read result and the value specified by OrData, and
2166 writes the result to the 64-bit MMIO register specified by Address. The value
2167 written to the MMIO register is returned. This function must guarantee that
2168 all MMIO read and write operations are serialized. Extra left bits in OrData
2171 If 64-bit MMIO register operations are not supported, then ASSERT().
2172 If StartBit is greater than 63, then ASSERT().
2173 If EndBit is greater than 63, then ASSERT().
2174 If EndBit is less than StartBit, then ASSERT().
2176 @param Address MMIO register to write.
2177 @param StartBit The ordinal of the least significant bit in the bit field.
2179 @param EndBit The ordinal of the most significant bit in the bit field.
2181 @param OrData The value to OR with read value from the MMIO register.
2183 @return The value written back to the MMIO register.
2195 return MmioWrite64 (
2197 BitFieldOr64 (MmioRead64 (Address
), StartBit
, EndBit
, OrData
)
2202 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2203 writes the result back to the bit field in the 64-bit MMIO register.
2205 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2206 between the read result and the value specified by AndData, and writes the
2207 result to the 64-bit MMIO register specified by Address. The value written to
2208 the MMIO register is returned. This function must guarantee that all MMIO
2209 read and write operations are serialized. Extra left bits in AndData are
2212 If 64-bit MMIO register operations are not supported, then ASSERT().
2213 If StartBit is greater than 63, then ASSERT().
2214 If EndBit is greater than 63, then ASSERT().
2215 If EndBit is less than StartBit, then ASSERT().
2217 @param Address MMIO register to write.
2218 @param StartBit The ordinal of the least significant bit in the bit field.
2220 @param EndBit The ordinal of the most significant bit in the bit field.
2222 @param AndData The value to AND with read value from the MMIO register.
2224 @return The value written back to the MMIO register.
2236 return MmioWrite64 (
2238 BitFieldAnd64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
)
2243 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2244 by a bitwise inclusive OR, and writes the result back to the bit field in the
2245 64-bit MMIO register.
2247 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2248 followed by a bitwise inclusive OR between the read result and the value
2249 specified by AndData, and writes the result to the 64-bit MMIO register
2250 specified by Address. The value written to the MMIO register is returned.
2251 This function must guarantee that all MMIO read and write operations are
2252 serialized. Extra left bits in both AndData and OrData are stripped.
2254 If 64-bit MMIO register operations are not supported, then ASSERT().
2255 If StartBit is greater than 63, then ASSERT().
2256 If EndBit is greater than 63, then ASSERT().
2257 If EndBit is less than StartBit, then ASSERT().
2259 @param Address MMIO register to write.
2260 @param StartBit The ordinal of the least significant bit in the bit field.
2262 @param EndBit The ordinal of the most significant bit in the bit field.
2264 @param AndData The value to AND with read value from the MMIO register.
2265 @param OrData The value to OR with the result of the AND operation.
2267 @return The value written back to the MMIO register.
2272 MmioBitFieldAndThenOr64 (
2280 return MmioWrite64 (
2282 BitFieldAndThenOr64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
, OrData
)