]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/SmmIoLibSmmCpuIo2/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) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
10 The following IoLib instances share the same version of this file:
18 #include "SmmCpuIoLibInternal.h"
21 Reads an 8-bit I/O port, performs a bitwise OR, and writes the
22 result back to the 8-bit I/O port.
24 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
25 between the read result and the value specified by OrData, and writes the
26 result to the 8-bit I/O port specified by Port. The value written to the I/O
27 port is returned. This function must guarantee that all I/O read and write
28 operations are serialized.
30 If 8-bit I/O port operations are not supported, then ASSERT().
32 @param Port The I/O port to write.
33 @param OrData The value to OR with the read value from the I/O port.
35 @return The value written back to the I/O port.
45 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) | OrData
));
49 Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
50 to the 8-bit I/O port.
52 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
53 the read result and the value specified by AndData, and writes the result to
54 the 8-bit I/O port specified by Port. The value written to the I/O port is
55 returned. This function must guarantee that all I/O read and write operations
58 If 8-bit I/O port operations are not supported, then ASSERT().
60 @param Port The I/O port to write.
61 @param AndData The value to AND with the read value from the I/O port.
63 @return The value written back to the I/O port.
73 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) & AndData
));
77 Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
78 inclusive OR, and writes the result back to the 8-bit I/O port.
80 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
81 the read result and the value specified by AndData, performs a bitwise OR
82 between the result of the AND operation and the value specified by OrData,
83 and writes the result to the 8-bit I/O port specified by Port. The value
84 written to the I/O port is returned. This function must guarantee that all
85 I/O read and write operations are serialized.
87 If 8-bit I/O port operations are not supported, then ASSERT().
89 @param Port The I/O port to write.
90 @param AndData The value to AND with the read value from the I/O port.
91 @param OrData The value to OR with the result of the AND operation.
93 @return The value written back to the I/O port.
104 return IoWrite8 (Port
, (UINT8
) ((IoRead8 (Port
) & AndData
) | OrData
));
108 Reads a bit field of an I/O register.
110 Reads the bit field in an 8-bit I/O register. The bit field is specified by
111 the StartBit and the EndBit. The value of the bit field is returned.
113 If 8-bit I/O port operations are not supported, then ASSERT().
114 If StartBit is greater than 7, then ASSERT().
115 If EndBit is greater than 7, then ASSERT().
116 If EndBit is less than StartBit, then ASSERT().
118 @param Port The I/O port to read.
119 @param StartBit The ordinal of the least significant bit in the bit field.
121 @param EndBit The ordinal of the most significant bit in the bit field.
124 @return The value read.
135 return BitFieldRead8 (IoRead8 (Port
), StartBit
, EndBit
);
139 Writes a bit field to an I/O register.
141 Writes Value to the bit field of the I/O register. The bit field is specified
142 by the StartBit and the EndBit. All other bits in the destination I/O
143 register are preserved. The value written to the I/O port is returned. Extra
144 left bits in Value are stripped.
146 If 8-bit I/O port operations are not supported, then ASSERT().
147 If StartBit is greater than 7, then ASSERT().
148 If EndBit is greater than 7, then ASSERT().
149 If EndBit is less than StartBit, then ASSERT().
150 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
152 @param Port The I/O port to write.
153 @param StartBit The ordinal of the least significant bit in the bit field.
155 @param EndBit The ordinal of the most significant bit in the bit field.
157 @param Value The new value of the bit field.
159 @return The value written back to the I/O port.
173 BitFieldWrite8 (IoRead8 (Port
), StartBit
, EndBit
, Value
)
178 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
179 result back to the bit field in the 8-bit port.
181 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
182 between the read result and the value specified by OrData, and writes the
183 result to the 8-bit I/O port specified by Port. The value written to the I/O
184 port is returned. This function must guarantee that all I/O read and write
185 operations are serialized. Extra left bits in OrData are stripped.
187 If 8-bit I/O port operations are not supported, then ASSERT().
188 If StartBit is greater than 7, then ASSERT().
189 If EndBit is greater than 7, then ASSERT().
190 If EndBit is less than StartBit, then ASSERT().
191 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
193 @param Port The I/O port to write.
194 @param StartBit The ordinal of the least significant bit in the bit field.
196 @param EndBit The ordinal of the most significant bit in the bit field.
198 @param OrData The value to OR with the read value from the I/O port.
200 @return The value written back to the I/O port.
214 BitFieldOr8 (IoRead8 (Port
), StartBit
, EndBit
, OrData
)
219 Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
220 result back to the bit field in the 8-bit port.
222 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
223 the read result and the value specified by AndData, and writes the result to
224 the 8-bit I/O port specified by Port. The value written to the I/O port is
225 returned. This function must guarantee that all I/O read and write operations
226 are serialized. Extra left bits in AndData are stripped.
228 If 8-bit I/O port operations are not supported, then ASSERT().
229 If StartBit is greater than 7, then ASSERT().
230 If EndBit is greater than 7, then ASSERT().
231 If EndBit is less than StartBit, then ASSERT().
232 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
234 @param Port The I/O port to write.
235 @param StartBit The ordinal of the least significant bit in the bit field.
237 @param EndBit The ordinal of the most significant bit in the bit field.
239 @param AndData The value to AND with the read value from the I/O port.
241 @return The value written back to the I/O port.
255 BitFieldAnd8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
)
260 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
261 bitwise OR, and writes the result back to the bit field in the
264 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
265 by a bitwise OR between the read result and the value specified by
266 AndData, and writes the result to the 8-bit I/O port specified by Port. The
267 value written to the I/O port is returned. This function must guarantee that
268 all I/O read and write operations are serialized. Extra left bits in both
269 AndData and OrData are stripped.
271 If 8-bit I/O port operations are not supported, then ASSERT().
272 If StartBit is greater than 7, then ASSERT().
273 If EndBit is greater than 7, then ASSERT().
274 If EndBit is less than StartBit, then ASSERT().
275 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
276 If OrData is larger than the bitmask value range specified by StartBit and EndBit, 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().
317 @param Port The I/O port to write.
318 @param OrData The value to OR with the read value from the I/O port.
320 @return The value written back to the I/O port.
330 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) | OrData
));
334 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
335 to the 16-bit I/O port.
337 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
338 the read result and the value specified by AndData, and writes the result to
339 the 16-bit I/O port specified by Port. The value written to the I/O port is
340 returned. This function must guarantee that all I/O read and write operations
343 If 16-bit I/O port operations are not supported, then ASSERT().
345 @param Port The I/O port to write.
346 @param AndData The value to AND with the read value from the I/O port.
348 @return The value written back to the I/O port.
358 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) & AndData
));
362 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
363 inclusive OR, and writes the result back to the 16-bit I/O port.
365 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
366 the read result and the value specified by AndData, performs a bitwise OR
367 between the result of the AND operation and the value specified by OrData,
368 and writes the result to the 16-bit I/O port specified by Port. The value
369 written to the I/O port is returned. This function must guarantee that all
370 I/O read and write operations are serialized.
372 If 16-bit I/O port operations are not supported, then ASSERT().
374 @param Port The I/O port to write.
375 @param AndData The value to AND with the read value from the I/O port.
376 @param OrData The value to OR with the result of the AND operation.
378 @return The value written back to the I/O port.
389 return IoWrite16 (Port
, (UINT16
) ((IoRead16 (Port
) & AndData
) | OrData
));
393 Reads a bit field of an I/O register.
395 Reads the bit field in a 16-bit I/O register. The bit field is specified by
396 the StartBit and the EndBit. The value of the bit field is returned.
398 If 16-bit I/O port operations are not supported, then ASSERT().
399 If StartBit is greater than 15, then ASSERT().
400 If EndBit is greater than 15, then ASSERT().
401 If EndBit is less than StartBit, then ASSERT().
403 @param Port The I/O port to read.
404 @param StartBit The ordinal of the least significant bit in the bit field.
406 @param EndBit The ordinal of the most significant bit in the bit field.
409 @return The value read.
420 return BitFieldRead16 (IoRead16 (Port
), StartBit
, EndBit
);
424 Writes a bit field to an I/O register.
426 Writes Value to the bit field of the I/O register. The bit field is specified
427 by the StartBit and the EndBit. All other bits in the destination I/O
428 register are preserved. The value written to the I/O port is returned. Extra
429 left bits in Value are stripped.
431 If 16-bit I/O port operations are not supported, then ASSERT().
432 If StartBit is greater than 15, then ASSERT().
433 If EndBit is greater than 15, then ASSERT().
434 If EndBit is less than StartBit, then ASSERT().
435 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
437 @param Port The I/O port to write.
438 @param StartBit The ordinal of the least significant bit in the bit field.
440 @param EndBit The ordinal of the most significant bit in the bit field.
442 @param Value The new value of the bit field.
444 @return The value written back to the I/O port.
458 BitFieldWrite16 (IoRead16 (Port
), StartBit
, EndBit
, Value
)
463 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
464 result back to the bit field in the 16-bit port.
466 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
467 between the read result and the value specified by OrData, and writes the
468 result to the 16-bit I/O port specified by Port. The value written to the I/O
469 port is returned. This function must guarantee that all I/O read and write
470 operations are serialized. Extra left bits in OrData are stripped.
472 If 16-bit I/O port operations are not supported, then ASSERT().
473 If StartBit is greater than 15, then ASSERT().
474 If EndBit is greater than 15, then ASSERT().
475 If EndBit is less than StartBit, then ASSERT().
476 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
478 @param Port The I/O port to write.
479 @param StartBit The ordinal of the least significant bit in the bit field.
481 @param EndBit The ordinal of the most significant bit in the bit field.
483 @param OrData The value to OR with the read value from the I/O port.
485 @return The value written back to the I/O port.
499 BitFieldOr16 (IoRead16 (Port
), StartBit
, EndBit
, OrData
)
504 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
505 result back to the bit field in the 16-bit port.
507 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
508 the read result and the value specified by AndData, and writes the result to
509 the 16-bit I/O port specified by Port. The value written to the I/O port is
510 returned. This function must guarantee that all I/O read and write operations
511 are serialized. Extra left bits in AndData are stripped.
513 If 16-bit I/O port operations are not supported, then ASSERT().
514 If StartBit is greater than 15, then ASSERT().
515 If EndBit is greater than 15, then ASSERT().
516 If EndBit is less than StartBit, then ASSERT().
517 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
519 @param Port The I/O port to write.
520 @param StartBit The ordinal of the least significant bit in the bit field.
522 @param EndBit The ordinal of the most significant bit in the bit field.
524 @param AndData The value to AND with the read value from the I/O port.
526 @return The value written back to the I/O port.
540 BitFieldAnd16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
)
545 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
546 bitwise OR, and writes the result back to the bit field in the
549 Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
550 by a bitwise OR between the read result and the value specified by
551 AndData, and writes the result to the 16-bit I/O port specified by Port. The
552 value written to the I/O port is returned. This function must guarantee that
553 all I/O read and write operations are serialized. Extra left bits in both
554 AndData and OrData are stripped.
556 If 16-bit I/O port operations are not supported, then ASSERT().
557 If StartBit is greater than 15, then ASSERT().
558 If EndBit is greater than 15, then ASSERT().
559 If EndBit is less than StartBit, then ASSERT().
560 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
561 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
563 @param Port The I/O port to write.
564 @param StartBit The ordinal of the least significant bit in the bit field.
566 @param EndBit The ordinal of the most significant bit in the bit field.
568 @param AndData The value to AND with the read value from the I/O port.
569 @param OrData The value to OR with the result of the AND operation.
571 @return The value written back to the I/O port.
576 IoBitFieldAndThenOr16 (
586 BitFieldAndThenOr16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
, OrData
)
591 Reads a 32-bit I/O port, performs a bitwise OR, and writes the
592 result back to the 32-bit I/O port.
594 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
595 between the read result and the value specified by OrData, and writes the
596 result to the 32-bit I/O port specified by Port. The value written to the I/O
597 port is returned. This function must guarantee that all I/O read and write
598 operations are serialized.
600 If 32-bit I/O port operations are not supported, then ASSERT().
602 @param Port The I/O port to write.
603 @param OrData The value to OR with the read value from the I/O port.
605 @return The value written back to the I/O port.
615 return IoWrite32 (Port
, IoRead32 (Port
) | OrData
);
619 Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
620 to the 32-bit I/O port.
622 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
623 the read result and the value specified by AndData, and writes the result to
624 the 32-bit I/O port specified by Port. The value written to the I/O port is
625 returned. This function must guarantee that all I/O read and write operations
628 If 32-bit I/O port operations are not supported, then ASSERT().
630 @param Port The I/O port to write.
631 @param AndData The value to AND with the read value from the I/O port.
633 @return The value written back to the I/O port.
643 return IoWrite32 (Port
, IoRead32 (Port
) & AndData
);
647 Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
648 inclusive OR, and writes the result back to the 32-bit I/O port.
650 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
651 the read result and the value specified by AndData, performs a bitwise OR
652 between the result of the AND operation and the value specified by OrData,
653 and writes the result to the 32-bit I/O port specified by Port. The value
654 written to the I/O port is returned. This function must guarantee that all
655 I/O read and write operations are serialized.
657 If 32-bit I/O port operations are not supported, then ASSERT().
659 @param Port The I/O port to write.
660 @param AndData The value to AND with the read value from the I/O port.
661 @param OrData The value to OR with the result of the AND operation.
663 @return The value written back to the I/O port.
674 return IoWrite32 (Port
, (IoRead32 (Port
) & AndData
) | OrData
);
678 Reads a bit field of an I/O register.
680 Reads the bit field in a 32-bit I/O register. The bit field is specified by
681 the StartBit and the EndBit. The value of the bit field is returned.
683 If 32-bit I/O port operations are not supported, then ASSERT().
684 If StartBit is greater than 31, then ASSERT().
685 If EndBit is greater than 31, then ASSERT().
686 If EndBit is less than StartBit, then ASSERT().
688 @param Port The I/O port to read.
689 @param StartBit The ordinal of the least significant bit in the bit field.
691 @param EndBit The ordinal of the most significant bit in the bit field.
694 @return The value read.
705 return BitFieldRead32 (IoRead32 (Port
), StartBit
, EndBit
);
709 Writes a bit field to an I/O register.
711 Writes Value to the bit field of the I/O register. The bit field is specified
712 by the StartBit and the EndBit. All other bits in the destination I/O
713 register are preserved. The value written to the I/O port is returned. Extra
714 left bits in Value are stripped.
716 If 32-bit I/O port operations are not supported, then ASSERT().
717 If StartBit is greater than 31, then ASSERT().
718 If EndBit is greater than 31, then ASSERT().
719 If EndBit is less than StartBit, then ASSERT().
720 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
722 @param Port The I/O port to write.
723 @param StartBit The ordinal of the least significant bit in the bit field.
725 @param EndBit The ordinal of the most significant bit in the bit field.
727 @param Value The new value of the bit field.
729 @return The value written back to the I/O port.
743 BitFieldWrite32 (IoRead32 (Port
), StartBit
, EndBit
, Value
)
748 Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the
749 result back to the bit field in the 32-bit port.
751 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
752 between the read result and the value specified by OrData, and writes the
753 result to the 32-bit I/O port specified by Port. The value written to the I/O
754 port is returned. This function must guarantee that all I/O read and write
755 operations are serialized. Extra left bits in OrData are stripped.
757 If 32-bit I/O port operations are not supported, then ASSERT().
758 If StartBit is greater than 31, then ASSERT().
759 If EndBit is greater than 31, then ASSERT().
760 If EndBit is less than StartBit, then ASSERT().
761 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
763 @param Port The I/O port to write.
764 @param StartBit The ordinal of the least significant bit in the bit field.
766 @param EndBit The ordinal of the most significant bit in the bit field.
768 @param OrData The value to OR with the read value from the I/O port.
770 @return The value written back to the I/O port.
784 BitFieldOr32 (IoRead32 (Port
), StartBit
, EndBit
, OrData
)
789 Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
790 result back to the bit field in the 32-bit port.
792 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
793 the read result and the value specified by AndData, and writes the result to
794 the 32-bit I/O port specified by Port. The value written to the I/O port is
795 returned. This function must guarantee that all I/O read and write operations
796 are serialized. Extra left bits in AndData are stripped.
798 If 32-bit I/O port operations are not supported, then ASSERT().
799 If StartBit is greater than 31, then ASSERT().
800 If EndBit is greater than 31, then ASSERT().
801 If EndBit is less than StartBit, then ASSERT().
802 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
804 @param Port The I/O port to write.
805 @param StartBit The ordinal of the least significant bit in the bit field.
807 @param EndBit The ordinal of the most significant bit in the bit field.
809 @param AndData The value to AND with the read value from the I/O port.
811 @return The value written back to the I/O port.
825 BitFieldAnd32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
)
830 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
831 bitwise OR, and writes the result back to the bit field in the
834 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
835 by a bitwise OR between the read result and the value specified by
836 AndData, and writes the result to the 32-bit I/O port specified by Port. The
837 value written to the I/O port is returned. This function must guarantee that
838 all I/O read and write operations are serialized. Extra left bits in both
839 AndData and OrData are stripped.
841 If 32-bit I/O port operations are not supported, then ASSERT().
842 If StartBit is greater than 31, then ASSERT().
843 If EndBit is greater than 31, then ASSERT().
844 If EndBit is less than StartBit, then ASSERT().
845 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
846 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
848 @param Port The I/O port to write.
849 @param StartBit The ordinal of the least significant bit in the bit field.
851 @param EndBit The ordinal of the most significant bit in the bit field.
853 @param AndData The value to AND with the read value from the I/O port.
854 @param OrData The value to OR with the result of the AND operation.
856 @return The value written back to the I/O port.
861 IoBitFieldAndThenOr32 (
871 BitFieldAndThenOr32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
, OrData
)
876 Reads a 64-bit I/O port, performs a bitwise OR, and writes the
877 result back to the 64-bit I/O port.
879 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
880 between the read result and the value specified by OrData, and writes the
881 result to the 64-bit I/O port specified by Port. The value written to the I/O
882 port is returned. This function must guarantee that all I/O read and write
883 operations are serialized.
885 If 64-bit I/O port operations are not supported, then ASSERT().
887 @param Port The I/O port to write.
888 @param OrData The value to OR with the read value from the I/O port.
890 @return The value written back to the I/O port.
900 return IoWrite64 (Port
, IoRead64 (Port
) | OrData
);
904 Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
905 to the 64-bit I/O port.
907 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
908 the read result and the value specified by AndData, and writes the result to
909 the 64-bit I/O port specified by Port. The value written to the I/O port is
910 returned. This function must guarantee that all I/O read and write operations
913 If 64-bit I/O port operations are not supported, then ASSERT().
915 @param Port The I/O port to write.
916 @param AndData The value to AND with the read value from the I/O port.
918 @return The value written back to the I/O port.
928 return IoWrite64 (Port
, IoRead64 (Port
) & AndData
);
932 Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
933 inclusive OR, and writes the result back to the 64-bit I/O port.
935 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
936 the read result and the value specified by AndData, performs a bitwise OR
937 between the result of the AND operation and the value specified by OrData,
938 and writes the result to the 64-bit I/O port specified by Port. The value
939 written to the I/O port is returned. This function must guarantee that all
940 I/O read and write operations are serialized.
942 If 64-bit I/O port operations are not supported, then ASSERT().
944 @param Port The I/O port to write.
945 @param AndData The value to AND with the read value from the I/O port.
946 @param OrData The value to OR with the result of the AND operation.
948 @return The value written back to the I/O port.
959 return IoWrite64 (Port
, (IoRead64 (Port
) & AndData
) | OrData
);
963 Reads a bit field of an I/O register.
965 Reads the bit field in a 64-bit I/O register. The bit field is specified by
966 the StartBit and the EndBit. The value of the bit field is returned.
968 If 64-bit I/O port operations are not supported, then ASSERT().
969 If StartBit is greater than 63, then ASSERT().
970 If EndBit is greater than 63, then ASSERT().
971 If EndBit is less than StartBit, then ASSERT().
973 @param Port The I/O port to read.
974 @param StartBit The ordinal of the least significant bit in the bit field.
976 @param EndBit The ordinal of the most significant bit in the bit field.
979 @return The value read.
990 return BitFieldRead64 (IoRead64 (Port
), StartBit
, EndBit
);
994 Writes a bit field to an I/O register.
996 Writes Value to the bit field of the I/O register. The bit field is specified
997 by the StartBit and the EndBit. All other bits in the destination I/O
998 register are preserved. The value written to the I/O port is returned. Extra
999 left bits in Value are stripped.
1001 If 64-bit I/O port operations are not supported, then ASSERT().
1002 If StartBit is greater than 63, then ASSERT().
1003 If EndBit is greater than 63, then ASSERT().
1004 If EndBit is less than StartBit, then ASSERT().
1005 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1007 @param Port The I/O port to write.
1008 @param StartBit The ordinal of the least significant bit in the bit field.
1010 @param EndBit The ordinal of the most significant bit in the bit field.
1012 @param Value The new value of the bit field.
1014 @return The value written back to the I/O port.
1028 BitFieldWrite64 (IoRead64 (Port
), StartBit
, EndBit
, Value
)
1033 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1034 result back to the bit field in the 64-bit port.
1036 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
1037 between the read result and the value specified by OrData, and writes the
1038 result to the 64-bit I/O port specified by Port. The value written to the I/O
1039 port is returned. This function must guarantee that all I/O read and write
1040 operations are serialized. Extra left bits in OrData are stripped.
1042 If 64-bit I/O port operations are not supported, then ASSERT().
1043 If StartBit is greater than 63, then ASSERT().
1044 If EndBit is greater than 63, then ASSERT().
1045 If EndBit is less than StartBit, then ASSERT().
1046 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1048 @param Port The I/O port to write.
1049 @param StartBit The ordinal of the least significant bit in the bit field.
1051 @param EndBit The ordinal of the most significant bit in the bit field.
1053 @param OrData The value to OR with the read value from the I/O port.
1055 @return The value written back to the I/O port.
1069 BitFieldOr64 (IoRead64 (Port
), StartBit
, EndBit
, OrData
)
1074 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1075 result back to the bit field in the 64-bit port.
1077 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1078 the read result and the value specified by AndData, and writes the result to
1079 the 64-bit I/O port specified by Port. The value written to the I/O port is
1080 returned. This function must guarantee that all I/O read and write operations
1081 are serialized. Extra left bits in AndData are stripped.
1083 If 64-bit I/O port operations are not supported, then ASSERT().
1084 If StartBit is greater than 63, then ASSERT().
1085 If EndBit is greater than 63, then ASSERT().
1086 If EndBit is less than StartBit, then ASSERT().
1087 If AndData is larger than the bitmask value range specified by StartBit and EndBit, 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 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 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().
1130 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1131 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1133 @param Port The I/O port to write.
1134 @param StartBit The ordinal of the least significant bit in the bit field.
1136 @param EndBit The ordinal of the most significant bit in the bit field.
1138 @param AndData The value to AND with the read value from the I/O port.
1139 @param OrData The value to OR with the result of the AND operation.
1141 @return The value written back to the I/O port.
1146 IoBitFieldAndThenOr64 (
1156 BitFieldAndThenOr64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
, OrData
)
1161 Reads an 8-bit MMIO register, performs a bitwise OR, and writes the
1162 result back to the 8-bit MMIO register.
1164 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1165 inclusive OR between the read result and the value specified by OrData, and
1166 writes the result to the 8-bit MMIO register specified by Address. The value
1167 written to the MMIO register is returned. This function must guarantee that
1168 all MMIO read and write operations are serialized.
1170 If 8-bit MMIO register operations are not supported, then ASSERT().
1172 @param Address The MMIO register to write.
1173 @param OrData The value to OR with the read value from the MMIO register.
1175 @return The value written back to the MMIO register.
1185 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) | OrData
));
1189 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1190 back to the 8-bit MMIO register.
1192 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1193 between the read result and the value specified by AndData, and writes the
1194 result to the 8-bit MMIO register specified by Address. The value written to
1195 the MMIO register is returned. This function must guarantee that all MMIO
1196 read and write operations are serialized.
1198 If 8-bit MMIO register operations are not supported, then ASSERT().
1200 @param Address The MMIO register to write.
1201 @param AndData The value to AND with the read value from the MMIO register.
1203 @return The value written back to the MMIO register.
1213 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) & AndData
));
1217 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1218 inclusive OR, and writes the result back to the 8-bit MMIO register.
1220 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1221 between the read result and the value specified by AndData, performs a
1222 bitwise OR between the result of the AND operation and the value specified by
1223 OrData, and writes the result to the 8-bit MMIO register specified by
1224 Address. The value written to the MMIO register is returned. This function
1225 must guarantee that all MMIO read and write operations are serialized.
1227 If 8-bit MMIO register operations are not supported, then ASSERT().
1230 @param Address The MMIO register to write.
1231 @param AndData The value to AND with the read value from the MMIO register.
1232 @param OrData The value to OR with the result of the AND operation.
1234 @return The value written back to the MMIO register.
1245 return MmioWrite8 (Address
, (UINT8
) ((MmioRead8 (Address
) & AndData
) | OrData
));
1249 Reads a bit field of a MMIO register.
1251 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1252 the StartBit and the EndBit. The value of the bit field is returned.
1254 If 8-bit MMIO register operations are not supported, then ASSERT().
1255 If StartBit is greater than 7, then ASSERT().
1256 If EndBit is greater than 7, then ASSERT().
1257 If EndBit is less than StartBit, then ASSERT().
1259 @param Address The MMIO register to read.
1260 @param StartBit The ordinal of the least significant bit in the bit field.
1262 @param EndBit The ordinal of the most significant bit in the bit field.
1265 @return The value read.
1276 return BitFieldRead8 (MmioRead8 (Address
), StartBit
, EndBit
);
1280 Writes a bit field to a MMIO register.
1282 Writes Value to the bit field of the MMIO register. The bit field is
1283 specified by the StartBit and the EndBit. All other bits in the destination
1284 MMIO register are preserved. The new value of the 8-bit register is returned.
1286 If 8-bit MMIO register operations are not supported, then ASSERT().
1287 If StartBit is greater than 7, then ASSERT().
1288 If EndBit is greater than 7, then ASSERT().
1289 If EndBit is less than StartBit, then ASSERT().
1290 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1292 @param Address The MMIO register to write.
1293 @param StartBit The ordinal of the least significant bit in the bit field.
1295 @param EndBit The ordinal of the most significant bit in the bit field.
1297 @param Value The new value of the bit field.
1299 @return The value written back to the MMIO register.
1304 MmioBitFieldWrite8 (
1313 BitFieldWrite8 (MmioRead8 (Address
), StartBit
, EndBit
, Value
)
1318 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1319 writes the result back to the bit field in the 8-bit MMIO register.
1321 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1322 inclusive OR between the read result and the value specified by OrData, and
1323 writes the result to the 8-bit MMIO register specified by Address. The value
1324 written to the MMIO register is returned. This function must guarantee that
1325 all MMIO read and write operations are serialized. Extra left bits in OrData
1328 If 8-bit MMIO register operations are not supported, then ASSERT().
1329 If StartBit is greater than 7, then ASSERT().
1330 If EndBit is greater than 7, then ASSERT().
1331 If EndBit is less than StartBit, then ASSERT().
1332 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1334 @param Address The MMIO register to write.
1335 @param StartBit The ordinal of the least significant bit in the bit field.
1337 @param EndBit The ordinal of the most significant bit in the bit field.
1339 @param OrData The value to OR with read value from the MMIO register.
1341 @return The value written back to the MMIO register.
1355 BitFieldOr8 (MmioRead8 (Address
), StartBit
, EndBit
, OrData
)
1360 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1361 writes the result back to the bit field in the 8-bit MMIO register.
1363 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1364 between the read result and the value specified by AndData, and writes the
1365 result to the 8-bit MMIO register specified by Address. The value written to
1366 the MMIO register is returned. This function must guarantee that all MMIO
1367 read and write operations are serialized. Extra left bits in AndData are
1370 If 8-bit MMIO register operations are not supported, then ASSERT().
1371 If StartBit is greater than 7, then ASSERT().
1372 If EndBit is greater than 7, then ASSERT().
1373 If EndBit is less than StartBit, then ASSERT().
1374 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1376 @param Address The MMIO register to write.
1377 @param StartBit The ordinal of the least significant bit in the bit field.
1379 @param EndBit The ordinal of the most significant bit in the bit field.
1381 @param AndData The value to AND with read value from the MMIO register.
1383 @return The value written back to the MMIO register.
1397 BitFieldAnd8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
)
1402 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1403 by a bitwise OR, and writes the result back to the bit field in the
1404 8-bit MMIO register.
1406 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1407 followed by a bitwise OR between the read result and the value
1408 specified by AndData, and writes the result to the 8-bit MMIO register
1409 specified by Address. The value written to the MMIO register is returned.
1410 This function must guarantee that all MMIO read and write operations are
1411 serialized. Extra left bits in both AndData and OrData are stripped.
1413 If 8-bit MMIO register operations are not supported, then ASSERT().
1414 If StartBit is greater than 7, then ASSERT().
1415 If EndBit is greater than 7, then ASSERT().
1416 If EndBit is less than StartBit, then ASSERT().
1417 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1418 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1420 @param Address The MMIO register to write.
1421 @param StartBit The ordinal of the least significant bit in the bit field.
1423 @param EndBit The ordinal of the most significant bit in the bit field.
1425 @param AndData The value to AND with read value from the MMIO register.
1426 @param OrData The value to OR with the result of the AND operation.
1428 @return The value written back to the MMIO register.
1433 MmioBitFieldAndThenOr8 (
1443 BitFieldAndThenOr8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1448 Reads a 16-bit MMIO register, performs a bitwise OR, and writes the
1449 result back to the 16-bit MMIO register.
1451 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1452 inclusive OR between the read result and the value specified by OrData, and
1453 writes the result to the 16-bit MMIO register specified by Address. The value
1454 written to the MMIO register is returned. This function must guarantee that
1455 all MMIO read and write operations are serialized.
1457 If 16-bit MMIO register operations are not supported, then ASSERT().
1459 @param Address The MMIO register to write.
1460 @param OrData The value to OR with the read value from the MMIO register.
1462 @return The value written back to the MMIO register.
1472 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) | OrData
));
1476 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1477 back to the 16-bit MMIO register.
1479 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1480 between the read result and the value specified by AndData, and writes the
1481 result to the 16-bit MMIO register specified by Address. The value written to
1482 the MMIO register is returned. This function must guarantee that all MMIO
1483 read and write operations are serialized.
1485 If 16-bit MMIO register operations are not supported, then ASSERT().
1487 @param Address The MMIO register to write.
1488 @param AndData The value to AND with the read value from the MMIO register.
1490 @return The value written back to the MMIO register.
1500 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) & AndData
));
1504 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1505 inclusive OR, and writes the result back to the 16-bit MMIO register.
1507 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1508 between the read result and the value specified by AndData, performs a
1509 bitwise OR between the result of the AND operation and the value specified by
1510 OrData, and writes the result to the 16-bit MMIO register specified by
1511 Address. The value written to the MMIO register is returned. This function
1512 must guarantee that all MMIO read and write operations are serialized.
1514 If 16-bit MMIO register operations are not supported, then ASSERT().
1517 @param Address The MMIO register to write.
1518 @param AndData The value to AND with the read value from the MMIO register.
1519 @param OrData The value to OR with the result of the AND operation.
1521 @return The value written back to the MMIO register.
1532 return MmioWrite16 (Address
, (UINT16
) ((MmioRead16 (Address
) & AndData
) | OrData
));
1536 Reads a bit field of a MMIO register.
1538 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
1539 the StartBit and the EndBit. The value of the bit field is returned.
1541 If 16-bit MMIO register operations are not supported, then ASSERT().
1542 If StartBit is greater than 15, then ASSERT().
1543 If EndBit is greater than 15, then ASSERT().
1544 If EndBit is less than StartBit, then ASSERT().
1546 @param Address The MMIO register to read.
1547 @param StartBit The ordinal of the least significant bit in the bit field.
1549 @param EndBit The ordinal of the most significant bit in the bit field.
1552 @return The value read.
1557 MmioBitFieldRead16 (
1563 return BitFieldRead16 (MmioRead16 (Address
), StartBit
, EndBit
);
1567 Writes a bit field to a MMIO register.
1569 Writes Value to the bit field of the MMIO register. The bit field is
1570 specified by the StartBit and the EndBit. All other bits in the destination
1571 MMIO register are preserved. The new value of the 16-bit register is returned.
1573 If 16-bit MMIO register operations are not supported, then ASSERT().
1574 If StartBit is greater than 15, then ASSERT().
1575 If EndBit is greater than 15, then ASSERT().
1576 If EndBit is less than StartBit, then ASSERT().
1577 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1579 @param Address The MMIO register to write.
1580 @param StartBit The ordinal of the least significant bit in the bit field.
1582 @param EndBit The ordinal of the most significant bit in the bit field.
1584 @param Value The new value of the bit field.
1586 @return The value written back to the MMIO register.
1591 MmioBitFieldWrite16 (
1598 return MmioWrite16 (
1600 BitFieldWrite16 (MmioRead16 (Address
), StartBit
, EndBit
, Value
)
1605 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
1606 writes the result back to the bit field in the 16-bit MMIO register.
1608 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1609 inclusive OR between the read result and the value specified by OrData, and
1610 writes the result to the 16-bit MMIO register specified by Address. The value
1611 written to the MMIO register is returned. This function must guarantee that
1612 all MMIO read and write operations are serialized. Extra left bits in OrData
1615 If 16-bit MMIO register operations are not supported, then ASSERT().
1616 If StartBit is greater than 15, then ASSERT().
1617 If EndBit is greater than 15, then ASSERT().
1618 If EndBit is less than StartBit, then ASSERT().
1619 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1621 @param Address The MMIO register to write.
1622 @param StartBit The ordinal of the least significant bit in the bit field.
1624 @param EndBit The ordinal of the most significant bit in the bit field.
1626 @param OrData The value to OR with read value from the MMIO register.
1628 @return The value written back to the MMIO register.
1640 return MmioWrite16 (
1642 BitFieldOr16 (MmioRead16 (Address
), StartBit
, EndBit
, OrData
)
1647 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
1648 writes the result back to the bit field in the 16-bit MMIO register.
1650 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1651 between the read result and the value specified by AndData, and writes the
1652 result to the 16-bit MMIO register specified by Address. The value written to
1653 the MMIO register is returned. This function must guarantee that all MMIO
1654 read and write operations are serialized. Extra left bits in AndData are
1657 If 16-bit MMIO register operations are not supported, then ASSERT().
1658 If StartBit is greater than 15, then ASSERT().
1659 If EndBit is greater than 15, then ASSERT().
1660 If EndBit is less than StartBit, then ASSERT().
1661 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1663 @param Address The MMIO register to write.
1664 @param StartBit The ordinal of the least significant bit in the bit field.
1666 @param EndBit The ordinal of the most significant bit in the bit field.
1668 @param AndData The value to AND with read value from the MMIO register.
1670 @return The value written back to the MMIO register.
1682 return MmioWrite16 (
1684 BitFieldAnd16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
)
1689 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
1690 by a bitwise OR, and writes the result back to the bit field in the
1691 16-bit MMIO register.
1693 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1694 followed by a bitwise OR between the read result and the value
1695 specified by AndData, and writes the result to the 16-bit MMIO register
1696 specified by Address. The value written to the MMIO register is returned.
1697 This function must guarantee that all MMIO read and write operations are
1698 serialized. Extra left bits in both AndData and OrData are stripped.
1700 If 16-bit MMIO register operations are not supported, then ASSERT().
1701 If StartBit is greater than 15, then ASSERT().
1702 If EndBit is greater than 15, then ASSERT().
1703 If EndBit is less than StartBit, then ASSERT().
1704 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1705 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1707 @param Address The MMIO register to write.
1708 @param StartBit The ordinal of the least significant bit in the bit field.
1710 @param EndBit The ordinal of the most significant bit in the bit field.
1712 @param AndData The value to AND with read value from the MMIO register.
1713 @param OrData The value to OR with the result of the AND operation.
1715 @return The value written back to the MMIO register.
1720 MmioBitFieldAndThenOr16 (
1728 return MmioWrite16 (
1730 BitFieldAndThenOr16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1735 Reads a 32-bit MMIO register, performs a bitwise OR, and writes the
1736 result back to the 32-bit MMIO register.
1738 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1739 inclusive OR between the read result and the value specified by OrData, and
1740 writes the result to the 32-bit MMIO register specified by Address. The value
1741 written to the MMIO register is returned. This function must guarantee that
1742 all MMIO read and write operations are serialized.
1744 If 32-bit MMIO register operations are not supported, then ASSERT().
1746 @param Address The MMIO register to write.
1747 @param OrData The value to OR with the read value from the MMIO register.
1749 @return The value written back to the MMIO register.
1759 return MmioWrite32 (Address
, MmioRead32 (Address
) | OrData
);
1763 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
1764 back to the 32-bit MMIO register.
1766 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1767 between the read result and the value specified by AndData, and writes the
1768 result to the 32-bit MMIO register specified by Address. The value written to
1769 the MMIO register is returned. This function must guarantee that all MMIO
1770 read and write operations are serialized.
1772 If 32-bit MMIO register operations are not supported, then ASSERT().
1774 @param Address The MMIO register to write.
1775 @param AndData The value to AND with the read value from the MMIO register.
1777 @return The value written back to the MMIO register.
1787 return MmioWrite32 (Address
, MmioRead32 (Address
) & AndData
);
1791 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
1792 inclusive OR, and writes the result back to the 32-bit MMIO register.
1794 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1795 between the read result and the value specified by AndData, performs a
1796 bitwise OR between the result of the AND operation and the value specified by
1797 OrData, and writes the result to the 32-bit MMIO register specified by
1798 Address. The value written to the MMIO register is returned. This function
1799 must guarantee that all MMIO read and write operations are serialized.
1801 If 32-bit MMIO register operations are not supported, then ASSERT().
1804 @param Address The MMIO register to write.
1805 @param AndData The value to AND with the read value from the MMIO register.
1806 @param OrData The value to OR with the result of the AND operation.
1808 @return The value written back to the MMIO register.
1819 return MmioWrite32 (Address
, (MmioRead32 (Address
) & AndData
) | OrData
);
1823 Reads a bit field of a MMIO register.
1825 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
1826 the StartBit and the EndBit. The value of the bit field is returned.
1828 If 32-bit MMIO register operations are not supported, then ASSERT().
1829 If StartBit is greater than 31, then ASSERT().
1830 If EndBit is greater than 31, then ASSERT().
1831 If EndBit is less than StartBit, then ASSERT().
1833 @param Address The MMIO register to read.
1834 @param StartBit The ordinal of the least significant bit in the bit field.
1836 @param EndBit The ordinal of the most significant bit in the bit field.
1839 @return The value read.
1844 MmioBitFieldRead32 (
1850 return BitFieldRead32 (MmioRead32 (Address
), StartBit
, EndBit
);
1854 Writes a bit field to a MMIO register.
1856 Writes Value to the bit field of the MMIO register. The bit field is
1857 specified by the StartBit and the EndBit. All other bits in the destination
1858 MMIO register are preserved. The new value of the 32-bit register is returned.
1860 If 32-bit MMIO register operations are not supported, then ASSERT().
1861 If StartBit is greater than 31, then ASSERT().
1862 If EndBit is greater than 31, then ASSERT().
1863 If EndBit is less than StartBit, then ASSERT().
1864 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1866 @param Address The MMIO register to write.
1867 @param StartBit The ordinal of the least significant bit in the bit field.
1869 @param EndBit The ordinal of the most significant bit in the bit field.
1871 @param Value The new value of the bit field.
1873 @return The value written back to the MMIO register.
1878 MmioBitFieldWrite32 (
1885 return MmioWrite32 (
1887 BitFieldWrite32 (MmioRead32 (Address
), StartBit
, EndBit
, Value
)
1892 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
1893 writes the result back to the bit field in the 32-bit MMIO register.
1895 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1896 inclusive OR between the read result and the value specified by OrData, and
1897 writes the result to the 32-bit MMIO register specified by Address. The value
1898 written to the MMIO register is returned. This function must guarantee that
1899 all MMIO read and write operations are serialized. Extra left bits in OrData
1902 If 32-bit MMIO register operations are not supported, then ASSERT().
1903 If StartBit is greater than 31, then ASSERT().
1904 If EndBit is greater than 31, then ASSERT().
1905 If EndBit is less than StartBit, then ASSERT().
1906 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1908 @param Address The MMIO register to write.
1909 @param StartBit The ordinal of the least significant bit in the bit field.
1911 @param EndBit The ordinal of the most significant bit in the bit field.
1913 @param OrData The value to OR with read value from the MMIO register.
1915 @return The value written back to the MMIO register.
1927 return MmioWrite32 (
1929 BitFieldOr32 (MmioRead32 (Address
), StartBit
, EndBit
, OrData
)
1934 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
1935 writes the result back to the bit field in the 32-bit MMIO register.
1937 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1938 between the read result and the value specified by AndData, and writes the
1939 result to the 32-bit MMIO register specified by Address. The value written to
1940 the MMIO register is returned. This function must guarantee that all MMIO
1941 read and write operations are serialized. Extra left bits in AndData are
1944 If 32-bit MMIO register operations are not supported, then ASSERT().
1945 If StartBit is greater than 31, then ASSERT().
1946 If EndBit is greater than 31, then ASSERT().
1947 If EndBit is less than StartBit, then ASSERT().
1948 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1950 @param Address The MMIO register to write.
1951 @param StartBit The ordinal of the least significant bit in the bit field.
1953 @param EndBit The ordinal of the most significant bit in the bit field.
1955 @param AndData The value to AND with read value from the MMIO register.
1957 @return The value written back to the MMIO register.
1969 return MmioWrite32 (
1971 BitFieldAnd32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
)
1976 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
1977 by a bitwise OR, and writes the result back to the bit field in the
1978 32-bit MMIO register.
1980 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1981 followed by a bitwise OR between the read result and the value
1982 specified by AndData, and writes the result to the 32-bit MMIO register
1983 specified by Address. The value written to the MMIO register is returned.
1984 This function must guarantee that all MMIO read and write operations are
1985 serialized. Extra left bits in both AndData and OrData are stripped.
1987 If 32-bit MMIO register operations are not supported, then ASSERT().
1988 If StartBit is greater than 31, then ASSERT().
1989 If EndBit is greater than 31, then ASSERT().
1990 If EndBit is less than StartBit, then ASSERT().
1991 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1992 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1994 @param Address The MMIO register to write.
1995 @param StartBit The ordinal of the least significant bit in the bit field.
1997 @param EndBit The ordinal of the most significant bit in the bit field.
1999 @param AndData The value to AND with read value from the MMIO register.
2000 @param OrData The value to OR with the result of the AND operation.
2002 @return The value written back to the MMIO register.
2007 MmioBitFieldAndThenOr32 (
2015 return MmioWrite32 (
2017 BitFieldAndThenOr32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
, OrData
)
2022 Reads a 64-bit MMIO register, performs a bitwise OR, and writes the
2023 result back to the 64-bit MMIO register.
2025 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2026 inclusive OR between the read result and the value specified by OrData, and
2027 writes the result to the 64-bit MMIO register specified by Address. The value
2028 written to the MMIO register is returned. This function must guarantee that
2029 all MMIO read and write operations are serialized.
2031 If 64-bit MMIO register operations are not supported, then ASSERT().
2033 @param Address The MMIO register to write.
2034 @param OrData The value to OR with the read value from the MMIO register.
2036 @return The value written back to the MMIO register.
2046 return MmioWrite64 (Address
, MmioRead64 (Address
) | OrData
);
2050 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2051 back to the 64-bit MMIO register.
2053 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2054 between the read result and the value specified by AndData, and writes the
2055 result to the 64-bit MMIO register specified by Address. The value written to
2056 the MMIO register is returned. This function must guarantee that all MMIO
2057 read and write operations are serialized.
2059 If 64-bit MMIO register operations are not supported, then ASSERT().
2061 @param Address The MMIO register to write.
2062 @param AndData The value to AND with the read value from the MMIO register.
2064 @return The value written back to the MMIO register.
2074 return MmioWrite64 (Address
, MmioRead64 (Address
) & AndData
);
2078 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2079 inclusive OR, and writes the result back to the 64-bit MMIO register.
2081 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2082 between the read result and the value specified by AndData, performs a
2083 bitwise OR between the result of the AND operation and the value specified by
2084 OrData, and writes the result to the 64-bit MMIO register specified by
2085 Address. The value written to the MMIO register is returned. This function
2086 must guarantee that all MMIO read and write operations are serialized.
2088 If 64-bit MMIO register operations are not supported, then ASSERT().
2091 @param Address The MMIO register to write.
2092 @param AndData The value to AND with the read value from the MMIO register.
2093 @param OrData The value to OR with the result of the AND operation.
2095 @return The value written back to the MMIO register.
2106 return MmioWrite64 (Address
, (MmioRead64 (Address
) & AndData
) | OrData
);
2110 Reads a bit field of a MMIO register.
2112 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2113 the StartBit and the EndBit. The value of the bit field is returned.
2115 If 64-bit MMIO register operations are not supported, then ASSERT().
2116 If StartBit is greater than 63, then ASSERT().
2117 If EndBit is greater than 63, then ASSERT().
2118 If EndBit is less than StartBit, then ASSERT().
2120 @param Address The MMIO register to read.
2121 @param StartBit The ordinal of the least significant bit in the bit field.
2123 @param EndBit The ordinal of the most significant bit in the bit field.
2126 @return The value read.
2131 MmioBitFieldRead64 (
2137 return BitFieldRead64 (MmioRead64 (Address
), StartBit
, EndBit
);
2141 Writes a bit field to a MMIO register.
2143 Writes Value to the bit field of the MMIO register. The bit field is
2144 specified by the StartBit and the EndBit. All other bits in the destination
2145 MMIO register are preserved. The new value of the 64-bit register is returned.
2147 If 64-bit MMIO register operations are not supported, then ASSERT().
2148 If StartBit is greater than 63, then ASSERT().
2149 If EndBit is greater than 63, then ASSERT().
2150 If EndBit is less than StartBit, then ASSERT().
2151 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2153 @param Address The MMIO register to write.
2154 @param StartBit The ordinal of the least significant bit in the bit field.
2156 @param EndBit The ordinal of the most significant bit in the bit field.
2158 @param Value The new value of the bit field.
2160 @return The value written back to the MMIO register.
2165 MmioBitFieldWrite64 (
2172 return MmioWrite64 (
2174 BitFieldWrite64 (MmioRead64 (Address
), StartBit
, EndBit
, Value
)
2179 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2180 writes the result back to the bit field in the 64-bit MMIO register.
2182 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2183 inclusive OR between the read result and the value specified by OrData, and
2184 writes the result to the 64-bit MMIO register specified by Address. The value
2185 written to the MMIO register is returned. This function must guarantee that
2186 all MMIO read and write operations are serialized. Extra left bits in OrData
2189 If 64-bit MMIO register operations are not supported, then ASSERT().
2190 If StartBit is greater than 63, then ASSERT().
2191 If EndBit is greater than 63, then ASSERT().
2192 If EndBit is less than StartBit, then ASSERT().
2193 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2195 @param Address The MMIO register to write.
2196 @param StartBit The ordinal of the least significant bit in the bit field.
2198 @param EndBit The ordinal of the most significant bit in the bit field.
2200 @param OrData The value to OR with read value from the MMIO register.
2202 @return The value written back to the MMIO register.
2214 return MmioWrite64 (
2216 BitFieldOr64 (MmioRead64 (Address
), StartBit
, EndBit
, OrData
)
2221 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2222 writes the result back to the bit field in the 64-bit MMIO register.
2224 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2225 between the read result and the value specified by AndData, and writes the
2226 result to the 64-bit MMIO register specified by Address. The value written to
2227 the MMIO register is returned. This function must guarantee that all MMIO
2228 read and write operations are serialized. Extra left bits in AndData are
2231 If 64-bit MMIO register operations are not supported, then ASSERT().
2232 If StartBit is greater than 63, then ASSERT().
2233 If EndBit is greater than 63, then ASSERT().
2234 If EndBit is less than StartBit, then ASSERT().
2235 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2237 @param Address The MMIO register to write.
2238 @param StartBit The ordinal of the least significant bit in the bit field.
2240 @param EndBit The ordinal of the most significant bit in the bit field.
2242 @param AndData The value to AND with read value from the MMIO register.
2244 @return The value written back to the MMIO register.
2256 return MmioWrite64 (
2258 BitFieldAnd64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
)
2263 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2264 by a bitwise OR, and writes the result back to the bit field in the
2265 64-bit MMIO register.
2267 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2268 followed by a bitwise OR between the read result and the value
2269 specified by AndData, and writes the result to the 64-bit MMIO register
2270 specified by Address. The value written to the MMIO register is returned.
2271 This function must guarantee that all MMIO read and write operations are
2272 serialized. Extra left bits in both AndData and OrData are stripped.
2274 If 64-bit MMIO register operations are not supported, then ASSERT().
2275 If StartBit is greater than 63, then ASSERT().
2276 If EndBit is greater than 63, then ASSERT().
2277 If EndBit is less than StartBit, then ASSERT().
2278 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2279 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2281 @param Address The MMIO register to write.
2282 @param StartBit The ordinal of the least significant bit in the bit field.
2284 @param EndBit The ordinal of the most significant bit in the bit field.
2286 @param AndData The value to AND with read value from the MMIO register.
2287 @param OrData The value to OR with the result of the AND operation.
2289 @return The value written back to the MMIO register.
2294 MmioBitFieldAndThenOr64 (
2302 return MmioWrite64 (
2304 BitFieldAndThenOr64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
, OrData
)