]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c
2 High-level Io/Mmio functions.
4 All assertions for bit field operations are handled bit field functions in the
7 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
14 #include <Library/IoLib.h>
15 #include <Library/DebugLib.h>
16 #include <Library/BaseLib.h>
17 #include <Library/PeiServicesTablePointerLib.h>
20 Reads an 8-bit I/O port, performs a bitwise OR, and writes the
21 result back to the 8-bit I/O port.
23 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
24 between the read result and the value specified by OrData, and writes the
25 result to the 8-bit I/O port specified by Port. The value written to the I/O
26 port is returned. This function must guarantee that all I/O read and write
27 operations are serialized.
29 If 8-bit I/O port operations are not supported, then ASSERT().
31 @param Port The I/O port to write.
32 @param OrData The value to OR with the read value from the I/O port.
34 @return The value written back to the I/O port.
44 return IoWrite8 (Port
, (UINT8
)(IoRead8 (Port
) | OrData
));
48 Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
49 to the 8-bit I/O port.
51 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
52 the read result and the value specified by AndData, and writes the result to
53 the 8-bit I/O port specified by Port. The value written to the I/O port is
54 returned. This function must guarantee that all I/O read and write operations
57 If 8-bit I/O port operations are not supported, then ASSERT().
59 @param Port The I/O port to write.
60 @param AndData The value to AND with the read value from the I/O port.
62 @return The value written back to the I/O port.
72 return IoWrite8 (Port
, (UINT8
)(IoRead8 (Port
) & AndData
));
76 Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
77 OR, and writes the result back to the 8-bit I/O port.
79 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
80 the read result and the value specified by AndData, performs a bitwise OR
81 between the result of the AND operation and the value specified by OrData,
82 and writes the result to the 8-bit I/O port specified by Port. The value
83 written to the I/O port is returned. This function must guarantee that all
84 I/O read and write operations are serialized.
86 If 8-bit I/O port operations are not supported, then ASSERT().
88 @param Port The I/O port to write.
89 @param AndData The value to AND with the read value from the I/O port.
90 @param OrData The value to OR with the result of the AND operation.
92 @return The value written back to the I/O port.
103 return IoWrite8 (Port
, (UINT8
)((IoRead8 (Port
) & AndData
) | OrData
));
107 Reads a bit field of an I/O register.
109 Reads the bit field in an 8-bit I/O register. The bit field is specified by
110 the StartBit and the EndBit. The value of the bit field is returned.
112 If 8-bit I/O port operations are not supported, then ASSERT().
113 If StartBit is greater than 7, then ASSERT().
114 If EndBit is greater than 7, then ASSERT().
115 If EndBit is less than StartBit, then ASSERT().
117 @param Port The I/O port to read.
118 @param StartBit The ordinal of the least significant bit in the bit field.
120 @param EndBit The ordinal of the most significant bit in the bit field.
123 @return The value read.
134 return BitFieldRead8 (IoRead8 (Port
), StartBit
, EndBit
);
138 Writes a bit field to an I/O register.
140 Writes Value to the bit field of the I/O register. The bit field is specified
141 by the StartBit and the EndBit. All other bits in the destination I/O
142 register are preserved. The value written to the I/O port is returned.
144 If 8-bit I/O port operations are not supported, then ASSERT().
145 If StartBit is greater than 7, then ASSERT().
146 If EndBit is greater than 7, then ASSERT().
147 If EndBit is less than StartBit, then ASSERT().
148 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
150 @param Port The I/O port to write.
151 @param StartBit The ordinal of the least significant bit in the bit field.
153 @param EndBit The ordinal of the most significant bit in the bit field.
155 @param Value The new value of the bit field.
157 @return The value written back to the I/O port.
171 BitFieldWrite8 (IoRead8 (Port
), StartBit
, EndBit
, Value
)
176 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
177 result back to the bit field in the 8-bit port.
179 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
180 between the read result and the value specified by OrData, and writes the
181 result to the 8-bit I/O port specified by Port. The value written to the I/O
182 port is returned. This function must guarantee that all I/O read and write
183 operations are serialized. Extra left bits in OrData are stripped.
185 If 8-bit I/O port operations are not supported, then ASSERT().
186 If StartBit is greater than 7, then ASSERT().
187 If EndBit is greater than 7, then ASSERT().
188 If EndBit is less than StartBit, then ASSERT().
189 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
191 @param Port The I/O port to write.
192 @param StartBit The ordinal of the least significant bit in the bit field.
194 @param EndBit The ordinal of the most significant bit in the bit field.
196 @param OrData The value to OR with the read value from the I/O port.
198 @return The value written back to the I/O port.
212 BitFieldOr8 (IoRead8 (Port
), StartBit
, EndBit
, OrData
)
217 Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
218 result back to the bit field in the 8-bit port.
220 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
221 the read result and the value specified by AndData, and writes the result to
222 the 8-bit I/O port specified by Port. The value written to the I/O port is
223 returned. This function must guarantee that all I/O read and write operations
224 are serialized. Extra left bits in AndData are stripped.
226 If 8-bit I/O port operations are not supported, then ASSERT().
227 If StartBit is greater than 7, then ASSERT().
228 If EndBit is greater than 7, then ASSERT().
229 If EndBit is less than StartBit, then ASSERT().
230 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
232 @param Port The I/O port to write.
233 @param StartBit The ordinal of the least significant bit in the bit field.
235 @param EndBit The ordinal of the most significant bit in the bit field.
237 @param AndData The value to AND with the read value from the I/O port.
239 @return The value written back to the I/O port.
253 BitFieldAnd8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
)
258 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
259 bitwise OR, and writes the result back to the bit field in the
262 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
263 by a bitwise OR between the read result and the value specified by
264 AndData, and writes the result to the 8-bit I/O port specified by Port. The
265 value written to the I/O port is returned. This function must guarantee that
266 all I/O read and write operations are serialized. Extra left bits in both
267 AndData and OrData are stripped.
269 If 8-bit I/O port operations are not supported, then ASSERT().
270 If StartBit is greater than 7, then ASSERT().
271 If EndBit is greater than 7, then ASSERT().
272 If EndBit is less than StartBit, then ASSERT().
273 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
274 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
276 @param Port The I/O port to write.
277 @param StartBit The ordinal of the least significant bit in the bit field.
279 @param EndBit The ordinal of the most significant bit in the bit field.
281 @param AndData The value to AND with the read value from the I/O port.
282 @param OrData The value to OR with the result of the AND operation.
284 @return The value written back to the I/O port.
289 IoBitFieldAndThenOr8 (
299 BitFieldAndThenOr8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
, OrData
)
304 Reads a 16-bit I/O port, performs a bitwise OR, and writes the
305 result back to the 16-bit I/O port.
307 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
308 between the read result and the value specified by OrData, and writes the
309 result to the 16-bit I/O port specified by Port. The value written to the I/O
310 port is returned. This function must guarantee that all I/O read and write
311 operations are serialized.
313 If 16-bit I/O port operations are not supported, then ASSERT().
314 If Port is not aligned on a 16-bit boundary, then ASSERT().
316 @param Port The I/O port to write.
317 @param OrData The value to OR with the read value from the I/O port.
319 @return The value written back to the I/O port.
329 return IoWrite16 (Port
, (UINT16
)(IoRead16 (Port
) | OrData
));
333 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
334 to the 16-bit I/O port.
336 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
337 the read result and the value specified by AndData, and writes the result to
338 the 16-bit I/O port specified by Port. The value written to the I/O port is
339 returned. This function must guarantee that all I/O read and write operations
342 If 16-bit I/O port operations are not supported, then ASSERT().
343 If Port is not aligned on a 16-bit boundary, 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 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().
373 If Port is not aligned on a 16-bit boundary, then ASSERT().
375 @param Port The I/O port to write.
376 @param AndData The value to AND with the read value from the I/O port.
377 @param OrData The value to OR with the result of the AND operation.
379 @return The value written back to the I/O port.
390 return IoWrite16 (Port
, (UINT16
)((IoRead16 (Port
) & AndData
) | OrData
));
394 Reads a bit field of an I/O register.
396 Reads the bit field in a 16-bit I/O register. The bit field is specified by
397 the StartBit and the EndBit. The value of the bit field is returned.
399 If 16-bit I/O port operations are not supported, then ASSERT().
400 If Port is not aligned on a 16-bit boundary, then ASSERT().
401 If StartBit is greater than 15, then ASSERT().
402 If EndBit is greater than 15, then ASSERT().
403 If EndBit is less than StartBit, then ASSERT().
405 @param Port The I/O port to read.
406 @param StartBit The ordinal of the least significant bit in the bit field.
408 @param EndBit The ordinal of the most significant bit in the bit field.
411 @return The value read.
422 return BitFieldRead16 (IoRead16 (Port
), StartBit
, EndBit
);
426 Writes a bit field to an I/O register.
428 Writes Value to the bit field of the I/O register. The bit field is specified
429 by the StartBit and the EndBit. All other bits in the destination I/O
430 register are preserved. The value written to the I/O port is returned. Extra
431 left bits in Value are stripped.
433 If 16-bit I/O port operations are not supported, then ASSERT().
434 If Port is not aligned on a 16-bit boundary, then ASSERT().
435 If StartBit is greater than 15, then ASSERT().
436 If EndBit is greater than 15, then ASSERT().
437 If EndBit is less than StartBit, then ASSERT().
438 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
440 @param Port The I/O port to write.
441 @param StartBit The ordinal of the least significant bit in the bit field.
443 @param EndBit The ordinal of the most significant bit in the bit field.
445 @param Value The new value of the bit field.
447 @return The value written back to the I/O port.
461 BitFieldWrite16 (IoRead16 (Port
), StartBit
, EndBit
, Value
)
466 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
467 result back to the bit field in the 16-bit port.
469 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
470 between the read result and the value specified by OrData, and writes the
471 result to the 16-bit I/O port specified by Port. The value written to the I/O
472 port is returned. This function must guarantee that all I/O read and write
473 operations are serialized. Extra left bits in OrData are stripped.
475 If 16-bit I/O port operations are not supported, then ASSERT().
476 If Port is not aligned on a 16-bit boundary, then ASSERT().
477 If StartBit is greater than 15, then ASSERT().
478 If EndBit is greater than 15, then ASSERT().
479 If EndBit is less than StartBit, then ASSERT().
480 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
482 @param Port The I/O port to write.
483 @param StartBit The ordinal of the least significant bit in the bit field.
485 @param EndBit The ordinal of the most significant bit in the bit field.
487 @param OrData The value to OR with the read value from the I/O port.
489 @return The value written back to the I/O port.
503 BitFieldOr16 (IoRead16 (Port
), StartBit
, EndBit
, OrData
)
508 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
509 result back to the bit field in the 16-bit port.
511 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
512 the read result and the value specified by AndData, and writes the result to
513 the 16-bit I/O port specified by Port. The value written to the I/O port is
514 returned. This function must guarantee that all I/O read and write operations
515 are serialized. Extra left bits in AndData are stripped.
517 If 16-bit I/O port operations are not supported, then ASSERT().
518 If Port is not aligned on a 16-bit boundary, then ASSERT().
519 If StartBit is greater than 15, then ASSERT().
520 If EndBit is greater than 15, then ASSERT().
521 If EndBit is less than StartBit, then ASSERT().
522 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
524 @param Port The I/O port to write.
525 @param StartBit The ordinal of the least significant bit in the bit field.
527 @param EndBit The ordinal of the most significant bit in the bit field.
529 @param AndData The value to AND with the read value from the I/O port.
531 @return The value written back to the I/O port.
545 BitFieldAnd16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
)
550 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
551 bitwise OR, and writes the result back to the bit field in the
554 Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
555 by a bitwise OR between the read result and the value specified by
556 AndData, and writes the result to the 16-bit I/O port specified by Port. The
557 value written to the I/O port is returned. This function must guarantee that
558 all I/O read and write operations are serialized. Extra left bits in both
559 AndData and OrData are stripped.
561 If 16-bit I/O port operations are not supported, then ASSERT().
562 If Port is not aligned on a 16-bit boundary, then ASSERT().
563 If StartBit is greater than 15, then ASSERT().
564 If EndBit is greater than 15, then ASSERT().
565 If EndBit is less than StartBit, then ASSERT().
566 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
567 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
569 @param Port The I/O port to write.
570 @param StartBit The ordinal of the least significant bit in the bit field.
572 @param EndBit The ordinal of the most significant bit in the bit field.
574 @param AndData The value to AND with the read value from the I/O port.
575 @param OrData The value to OR with the result of the AND operation.
577 @return The value written back to the I/O port.
582 IoBitFieldAndThenOr16 (
592 BitFieldAndThenOr16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
, OrData
)
597 Reads a 32-bit I/O port, performs a bitwise OR, and writes the
598 result back to the 32-bit I/O port.
600 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
601 between the read result and the value specified by OrData, and writes the
602 result to the 32-bit I/O port specified by Port. The value written to the I/O
603 port is returned. This function must guarantee that all I/O read and write
604 operations are serialized.
606 If 32-bit I/O port operations are not supported, then ASSERT().
607 If Port is not aligned on a 32-bit boundary, then ASSERT().
609 @param Port The I/O port to write.
610 @param OrData The value to OR with the read value from the I/O port.
612 @return The value written back to the I/O port.
622 return IoWrite32 (Port
, IoRead32 (Port
) | OrData
);
626 Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
627 to the 32-bit I/O port.
629 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
630 the read result and the value specified by AndData, and writes the result to
631 the 32-bit I/O port specified by Port. The value written to the I/O port is
632 returned. This function must guarantee that all I/O read and write operations
635 If 32-bit I/O port operations are not supported, then ASSERT().
636 If Port is not aligned on a 32-bit boundary, 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 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().
666 If Port is not aligned on a 32-bit boundary, then ASSERT().
668 @param Port The I/O port to write.
669 @param AndData The value to AND with the read value from the I/O port.
670 @param OrData The value to OR with the result of the AND operation.
672 @return The value written back to the I/O port.
683 return IoWrite32 (Port
, (IoRead32 (Port
) & AndData
) | OrData
);
687 Reads a bit field of an I/O register.
689 Reads the bit field in a 32-bit I/O register. The bit field is specified by
690 the StartBit and the EndBit. The value of the bit field is returned.
692 If 32-bit I/O port operations are not supported, then ASSERT().
693 If Port is not aligned on a 32-bit boundary, then ASSERT().
694 If StartBit is greater than 31, then ASSERT().
695 If EndBit is greater than 31, then ASSERT().
696 If EndBit is less than StartBit, then ASSERT().
698 @param Port The I/O port to read.
699 @param StartBit The ordinal of the least significant bit in the bit field.
701 @param EndBit The ordinal of the most significant bit in the bit field.
704 @return The value read.
715 return BitFieldRead32 (IoRead32 (Port
), StartBit
, EndBit
);
719 Writes a bit field to an I/O register.
721 Writes Value to the bit field of the I/O register. The bit field is specified
722 by the StartBit and the EndBit. All other bits in the destination I/O
723 register are preserved. The value written to the I/O port is returned. Extra
724 left bits in Value are stripped.
726 If 32-bit I/O port operations are not supported, then ASSERT().
727 If Port is not aligned on a 32-bit boundary, then ASSERT().
728 If StartBit is greater than 31, then ASSERT().
729 If EndBit is greater than 31, then ASSERT().
730 If EndBit is less than StartBit, then ASSERT().
731 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
733 @param Port The I/O port to write.
734 @param StartBit The ordinal of the least significant bit in the bit field.
736 @param EndBit The ordinal of the most significant bit in the bit field.
738 @param Value The new value of the bit field.
740 @return The value written back to the I/O port.
754 BitFieldWrite32 (IoRead32 (Port
), StartBit
, EndBit
, Value
)
759 Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the
760 result back to the bit field in the 32-bit port.
762 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
763 between the read result and the value specified by OrData, and writes the
764 result to the 32-bit I/O port specified by Port. The value written to the I/O
765 port is returned. This function must guarantee that all I/O read and write
766 operations are serialized. Extra left bits in OrData are stripped.
768 If 32-bit I/O port operations are not supported, then ASSERT().
769 If Port is not aligned on a 32-bit boundary, then ASSERT().
770 If StartBit is greater than 31, then ASSERT().
771 If EndBit is greater than 31, then ASSERT().
772 If EndBit is less than StartBit, then ASSERT().
773 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
775 @param Port The I/O port to write.
776 @param StartBit The ordinal of the least significant bit in the bit field.
778 @param EndBit The ordinal of the most significant bit in the bit field.
780 @param OrData The value to OR with the read value from the I/O port.
782 @return The value written back to the I/O port.
796 BitFieldOr32 (IoRead32 (Port
), StartBit
, EndBit
, OrData
)
801 Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
802 result back to the bit field in the 32-bit port.
804 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
805 the read result and the value specified by AndData, and writes the result to
806 the 32-bit I/O port specified by Port. The value written to the I/O port is
807 returned. This function must guarantee that all I/O read and write operations
808 are serialized. Extra left bits in AndData are stripped.
810 If 32-bit I/O port operations are not supported, then ASSERT().
811 If Port is not aligned on a 32-bit boundary, then ASSERT().
812 If StartBit is greater than 31, then ASSERT().
813 If EndBit is greater than 31, then ASSERT().
814 If EndBit is less than StartBit, then ASSERT().
815 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
817 @param Port The I/O port to write.
818 @param StartBit The ordinal of the least significant bit in the bit field.
820 @param EndBit The ordinal of the most significant bit in the bit field.
822 @param AndData The value to AND with the read value from the I/O port.
824 @return The value written back to the I/O port.
838 BitFieldAnd32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
)
843 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
844 bitwise OR, and writes the result back to the bit field in the
847 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
848 by a bitwise OR between the read result and the value specified by
849 AndData, and writes the result to the 32-bit I/O port specified by Port. The
850 value written to the I/O port is returned. This function must guarantee that
851 all I/O read and write operations are serialized. Extra left bits in both
852 AndData and OrData are stripped.
854 If 32-bit I/O port operations are not supported, then ASSERT().
855 If Port is not aligned on a 32-bit boundary, then ASSERT().
856 If StartBit is greater than 31, then ASSERT().
857 If EndBit is greater than 31, then ASSERT().
858 If EndBit is less than StartBit, then ASSERT().
859 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
860 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
862 @param Port The I/O port to write.
863 @param StartBit The ordinal of the least significant bit in the bit field.
865 @param EndBit The ordinal of the most significant bit in the bit field.
867 @param AndData The value to AND with the read value from the I/O port.
868 @param OrData The value to OR with the result of the AND operation.
870 @return The value written back to the I/O port.
875 IoBitFieldAndThenOr32 (
885 BitFieldAndThenOr32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
, OrData
)
890 Reads a 64-bit I/O port, performs a bitwise OR, and writes the
891 result back to the 64-bit I/O port.
893 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
894 between the read result and the value specified by OrData, and writes the
895 result to the 64-bit I/O port specified by Port. The value written to the I/O
896 port is returned. This function must guarantee that all I/O read and write
897 operations are serialized.
899 If 64-bit I/O port operations are not supported, then ASSERT().
900 If Port is not aligned on a 64-bit boundary, then ASSERT().
902 @param Port The I/O port to write.
903 @param OrData The value to OR with the read value from the I/O port.
905 @return The value written back to the I/O port.
915 return IoWrite64 (Port
, IoRead64 (Port
) | OrData
);
919 Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
920 to the 64-bit I/O port.
922 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
923 the read result and the value specified by AndData, and writes the result to
924 the 64-bit I/O port specified by Port. The value written to the I/O port is
925 returned. This function must guarantee that all I/O read and write operations
928 If 64-bit I/O port operations are not supported, then ASSERT().
929 If Port is not aligned on a 64-bit boundary, then ASSERT().
931 @param Port The I/O port to write.
932 @param AndData The value to AND with the read value from the I/O port.
934 @return The value written back to the I/O port.
944 return IoWrite64 (Port
, IoRead64 (Port
) & AndData
);
948 Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
949 OR, and writes the result back to the 64-bit I/O port.
951 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
952 the read result and the value specified by AndData, performs a bitwise OR
953 between the result of the AND operation and the value specified by OrData,
954 and writes the result to the 64-bit I/O port specified by Port. The value
955 written to the I/O port is returned. This function must guarantee that all
956 I/O read and write operations are serialized.
958 If 64-bit I/O port operations are not supported, then ASSERT().
959 If Port is not aligned on a 64-bit boundary, then ASSERT().
961 @param Port The I/O port to write.
962 @param AndData The value to AND with the read value from the I/O port.
963 @param OrData The value to OR with the result of the AND operation.
965 @return The value written back to the I/O port.
976 return IoWrite64 (Port
, (IoRead64 (Port
) & AndData
) | OrData
);
980 Reads a bit field of an I/O register.
982 Reads the bit field in a 64-bit I/O register. The bit field is specified by
983 the StartBit and the EndBit. The value of the bit field is returned.
985 If 64-bit I/O port operations are not supported, then ASSERT().
986 If Port is not aligned on a 64-bit boundary, then ASSERT().
987 If StartBit is greater than 63, then ASSERT().
988 If EndBit is greater than 63, then ASSERT().
989 If EndBit is less than StartBit, then ASSERT().
991 @param Port The I/O port to read.
992 @param StartBit The ordinal of the least significant bit in the bit field.
994 @param EndBit The ordinal of the most significant bit in the bit field.
997 @return The value read.
1008 return BitFieldRead64 (IoRead64 (Port
), StartBit
, EndBit
);
1012 Writes a bit field to an I/O register.
1014 Writes Value to the bit field of the I/O register. The bit field is specified
1015 by the StartBit and the EndBit. All other bits in the destination I/O
1016 register are preserved. The value written to the I/O port is returned. Extra
1017 left bits in Value are stripped.
1019 If 64-bit I/O port operations are not supported, then ASSERT().
1020 If Port is not aligned on a 64-bit boundary, then ASSERT().
1021 If StartBit is greater than 63, then ASSERT().
1022 If EndBit is greater than 63, then ASSERT().
1023 If EndBit is less than StartBit, then ASSERT().
1024 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1026 @param Port The I/O port to write.
1027 @param StartBit The ordinal of the least significant bit in the bit field.
1029 @param EndBit The ordinal of the most significant bit in the bit field.
1031 @param Value The new value of the bit field.
1033 @return The value written back to the I/O port.
1047 BitFieldWrite64 (IoRead64 (Port
), StartBit
, EndBit
, Value
)
1052 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1053 result back to the bit field in the 64-bit port.
1055 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
1056 between the read result and the value specified by OrData, and writes the
1057 result to the 64-bit I/O port specified by Port. The value written to the I/O
1058 port is returned. This function must guarantee that all I/O read and write
1059 operations are serialized. Extra left bits in OrData are stripped.
1061 If 64-bit I/O port operations are not supported, then ASSERT().
1062 If Port is not aligned on a 64-bit boundary, then ASSERT().
1063 If StartBit is greater than 63, then ASSERT().
1064 If EndBit is greater than 63, then ASSERT().
1065 If EndBit is less than StartBit, then ASSERT().
1066 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1068 @param Port The I/O port to write.
1069 @param StartBit The ordinal of the least significant bit in the bit field.
1071 @param EndBit The ordinal of the most significant bit in the bit field.
1073 @param OrData The value to OR with the read value from the I/O port.
1075 @return The value written back to the I/O port.
1089 BitFieldOr64 (IoRead64 (Port
), StartBit
, EndBit
, OrData
)
1094 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1095 result back to the bit field in the 64-bit port.
1097 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1098 the read result and the value specified by AndData, and writes the result to
1099 the 64-bit I/O port specified by Port. The value written to the I/O port is
1100 returned. This function must guarantee that all I/O read and write operations
1101 are serialized. Extra left bits in AndData are stripped.
1103 If 64-bit I/O port operations are not supported, then ASSERT().
1104 If Port is not aligned on a 64-bit boundary, then ASSERT().
1105 If StartBit is greater than 63, then ASSERT().
1106 If EndBit is greater than 63, then ASSERT().
1107 If EndBit is less than StartBit, then ASSERT().
1108 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1110 @param Port The I/O port to write.
1111 @param StartBit The ordinal of the least significant bit in the bit field.
1113 @param EndBit The ordinal of the most significant bit in the bit field.
1115 @param AndData The value to AND with the read value from the I/O port.
1117 @return The value written back to the I/O port.
1131 BitFieldAnd64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
)
1136 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
1137 bitwise OR, and writes the result back to the bit field in the
1140 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
1141 by a bitwise OR between the read result and the value specified by
1142 AndData, and writes the result to the 64-bit I/O port specified by Port. The
1143 value written to the I/O port is returned. This function must guarantee that
1144 all I/O read and write operations are serialized. Extra left bits in both
1145 AndData and OrData are stripped.
1147 If 64-bit I/O port operations are not supported, then ASSERT().
1148 If Port is not aligned on a 64-bit boundary, then ASSERT().
1149 If StartBit is greater than 63, then ASSERT().
1150 If EndBit is greater than 63, then ASSERT().
1151 If EndBit is less than StartBit, then ASSERT().
1152 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1153 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1155 @param Port The I/O port to write.
1156 @param StartBit The ordinal of the least significant bit in the bit field.
1158 @param EndBit The ordinal of the most significant bit in the bit field.
1160 @param AndData The value to AND with the read value from the I/O port.
1161 @param OrData The value to OR with the result of the AND operation.
1163 @return The value written back to the I/O port.
1168 IoBitFieldAndThenOr64 (
1178 BitFieldAndThenOr64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
, OrData
)
1183 Reads an 8-bit MMIO register, performs a bitwise OR, and writes the
1184 result back to the 8-bit MMIO register.
1186 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1187 OR between the read result and the value specified by OrData, and
1188 writes the result to the 8-bit MMIO register specified by Address. The value
1189 written to the MMIO register is returned. This function must guarantee that
1190 all MMIO read and write operations are serialized.
1192 If 8-bit MMIO register operations are not supported, then ASSERT().
1194 @param Address The MMIO register to write.
1195 @param OrData The value to OR with the read value from the MMIO register.
1197 @return The value written back to the MMIO register.
1207 return MmioWrite8 (Address
, (UINT8
)(MmioRead8 (Address
) | OrData
));
1211 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1212 back to the 8-bit MMIO register.
1214 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1215 between the read result and the value specified by AndData, and writes the
1216 result to the 8-bit MMIO register specified by Address. The value written to
1217 the MMIO register is returned. This function must guarantee that all MMIO
1218 read and write operations are serialized.
1220 If 8-bit MMIO register operations are not supported, then ASSERT().
1222 @param Address The MMIO register to write.
1223 @param AndData The value to AND with the read value from the MMIO register.
1225 @return The value written back to the MMIO register.
1235 return MmioWrite8 (Address
, (UINT8
)(MmioRead8 (Address
) & AndData
));
1239 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1240 OR, and writes the result back to the 8-bit MMIO register.
1242 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1243 between the read result and the value specified by AndData, performs a
1244 bitwise OR between the result of the AND operation and the value specified by
1245 OrData, and writes the result to the 8-bit MMIO register specified by
1246 Address. The value written to the MMIO register is returned. This function
1247 must guarantee that all MMIO read and write operations are serialized.
1249 If 8-bit MMIO register operations are not supported, then ASSERT().
1252 @param Address The MMIO register to write.
1253 @param AndData The value to AND with the read value from the MMIO register.
1254 @param OrData The value to OR with the result of the AND operation.
1256 @return The value written back to the MMIO register.
1267 return MmioWrite8 (Address
, (UINT8
)((MmioRead8 (Address
) & AndData
) | OrData
));
1271 Reads a bit field of a MMIO register.
1273 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1274 the StartBit and the EndBit. The value of the bit field is returned.
1276 If 8-bit MMIO register operations are not supported, then ASSERT().
1277 If StartBit is greater than 7, then ASSERT().
1278 If EndBit is greater than 7, then ASSERT().
1279 If EndBit is less than StartBit, then ASSERT().
1281 @param Address The MMIO register to read.
1282 @param StartBit The ordinal of the least significant bit in the bit field.
1284 @param EndBit The ordinal of the most significant bit in the bit field.
1287 @return The value read.
1298 return BitFieldRead8 (MmioRead8 (Address
), StartBit
, EndBit
);
1302 Writes a bit field to a MMIO register.
1304 Writes Value to the bit field of the MMIO register. The bit field is
1305 specified by the StartBit and the EndBit. All other bits in the destination
1306 MMIO register are preserved. The new value of the 8-bit register is returned.
1308 If 8-bit MMIO register operations are not supported, then ASSERT().
1309 If StartBit is greater than 7, then ASSERT().
1310 If EndBit is greater than 7, then ASSERT().
1311 If EndBit is less than StartBit, then ASSERT().
1312 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1314 @param Address The MMIO register to write.
1315 @param StartBit The ordinal of the least significant bit in the bit field.
1317 @param EndBit The ordinal of the most significant bit in the bit field.
1319 @param Value The new value of the bit field.
1321 @return The value written back to the MMIO register.
1326 MmioBitFieldWrite8 (
1335 BitFieldWrite8 (MmioRead8 (Address
), StartBit
, EndBit
, Value
)
1340 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1341 writes the result back to the bit field in the 8-bit MMIO register.
1343 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1344 OR between the read result and the value specified by OrData, and
1345 writes the result to the 8-bit MMIO register specified by Address. The value
1346 written to the MMIO register is returned. This function must guarantee that
1347 all MMIO read and write operations are serialized. Extra left bits in OrData
1350 If 8-bit MMIO register operations are not supported, then ASSERT().
1351 If StartBit is greater than 7, then ASSERT().
1352 If EndBit is greater than 7, then ASSERT().
1353 If EndBit is less than StartBit, then ASSERT().
1354 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1356 @param Address The MMIO register to write.
1357 @param StartBit The ordinal of the least significant bit in the bit field.
1359 @param EndBit The ordinal of the most significant bit in the bit field.
1361 @param OrData The value to OR with read value from the MMIO register.
1363 @return The value written back to the MMIO register.
1377 BitFieldOr8 (MmioRead8 (Address
), StartBit
, EndBit
, OrData
)
1382 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1383 writes the result back to the bit field in the 8-bit MMIO register.
1385 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1386 between the read result and the value specified by AndData, and writes the
1387 result to the 8-bit MMIO register specified by Address. The value written to
1388 the MMIO register is returned. This function must guarantee that all MMIO
1389 read and write operations are serialized. Extra left bits in AndData are
1392 If 8-bit MMIO register operations are not supported, then ASSERT().
1393 If StartBit is greater than 7, then ASSERT().
1394 If EndBit is greater than 7, then ASSERT().
1395 If EndBit is less than StartBit, then ASSERT().
1396 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1398 @param Address The MMIO register to write.
1399 @param StartBit The ordinal of the least significant bit in the bit field.
1401 @param EndBit The ordinal of the most significant bit in the bit field.
1403 @param AndData The value to AND with read value from the MMIO register.
1405 @return The value written back to the MMIO register.
1419 BitFieldAnd8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
)
1424 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1425 by a bitwise OR, and writes the result back to the bit field in the
1426 8-bit MMIO register.
1428 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1429 followed by a bitwise OR between the read result and the value
1430 specified by AndData, and writes the result to the 8-bit MMIO register
1431 specified by Address. The value written to the MMIO register is returned.
1432 This function must guarantee that all MMIO read and write operations are
1433 serialized. Extra left bits in both AndData and OrData are stripped.
1435 If 8-bit MMIO register operations are not supported, then ASSERT().
1436 If StartBit is greater than 7, then ASSERT().
1437 If EndBit is greater than 7, then ASSERT().
1438 If EndBit is less than StartBit, then ASSERT().
1439 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1440 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1442 @param Address The MMIO register to write.
1443 @param StartBit The ordinal of the least significant bit in the bit field.
1445 @param EndBit The ordinal of the most significant bit in the bit field.
1447 @param AndData The value to AND with read value from the MMIO register.
1448 @param OrData The value to OR with the result of the AND operation.
1450 @return The value written back to the MMIO register.
1455 MmioBitFieldAndThenOr8 (
1465 BitFieldAndThenOr8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1470 Reads a 16-bit MMIO register, performs a bitwise OR, and writes the
1471 result back to the 16-bit MMIO register.
1473 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1474 OR between the read result and the value specified by OrData, and
1475 writes the result to the 16-bit MMIO register specified by Address. The value
1476 written to the MMIO register is returned. This function must guarantee that
1477 all MMIO read and write operations are serialized.
1479 If 16-bit MMIO register operations are not supported, then ASSERT().
1480 If Address is not aligned on a 16-bit boundary, then ASSERT().
1482 @param Address The MMIO register to write.
1483 @param OrData The value to OR with the read value from the MMIO register.
1485 @return The value written back to the MMIO register.
1495 return MmioWrite16 (Address
, (UINT16
)(MmioRead16 (Address
) | OrData
));
1499 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1500 back to the 16-bit MMIO register.
1502 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1503 between the read result and the value specified by AndData, and writes the
1504 result to the 16-bit MMIO register specified by Address. The value written to
1505 the MMIO register is returned. This function must guarantee that all MMIO
1506 read and write operations are serialized.
1508 If 16-bit MMIO register operations are not supported, then ASSERT().
1509 If Address is not aligned on a 16-bit boundary, then ASSERT().
1511 @param Address The MMIO register to write.
1512 @param AndData The value to AND with the read value from the MMIO register.
1514 @return The value written back to the MMIO register.
1524 return MmioWrite16 (Address
, (UINT16
)(MmioRead16 (Address
) & AndData
));
1528 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1529 OR, and writes the result back to the 16-bit MMIO register.
1531 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1532 between the read result and the value specified by AndData, performs a
1533 bitwise OR between the result of the AND operation and the value specified by
1534 OrData, and writes the result to the 16-bit MMIO register specified by
1535 Address. The value written to the MMIO register is returned. This function
1536 must guarantee that all MMIO read and write operations are serialized.
1538 If 16-bit MMIO register operations are not supported, then ASSERT().
1539 If Address is not aligned on a 16-bit boundary, then ASSERT().
1541 @param Address The MMIO register to write.
1542 @param AndData The value to AND with the read value from the MMIO register.
1543 @param OrData The value to OR with the result of the AND operation.
1545 @return The value written back to the MMIO register.
1556 return MmioWrite16 (Address
, (UINT16
)((MmioRead16 (Address
) & AndData
) | OrData
));
1560 Reads a bit field of a MMIO register.
1562 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
1563 the StartBit and the EndBit. The value of the bit field is returned.
1565 If 16-bit MMIO register operations are not supported, then ASSERT().
1566 If Address is not aligned on a 16-bit boundary, 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 The MMIO register to read.
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.
1577 @return The value read.
1582 MmioBitFieldRead16 (
1588 return BitFieldRead16 (MmioRead16 (Address
), StartBit
, EndBit
);
1592 Writes a bit field to a MMIO register.
1594 Writes Value to the bit field of the MMIO register. The bit field is
1595 specified by the StartBit and the EndBit. All other bits in the destination
1596 MMIO register are preserved. The new value of the 16-bit register is returned.
1598 If 16-bit MMIO register operations are not supported, then ASSERT().
1599 If Address is not aligned on a 16-bit boundary, then ASSERT().
1600 If StartBit is greater than 15, then ASSERT().
1601 If EndBit is greater than 15, then ASSERT().
1602 If EndBit is less than StartBit, then ASSERT().
1603 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1605 @param Address The MMIO register to write.
1606 @param StartBit The ordinal of the least significant bit in the bit field.
1608 @param EndBit The ordinal of the most significant bit in the bit field.
1610 @param Value The new value of the bit field.
1612 @return The value written back to the MMIO register.
1617 MmioBitFieldWrite16 (
1624 return MmioWrite16 (
1626 BitFieldWrite16 (MmioRead16 (Address
), StartBit
, EndBit
, Value
)
1631 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
1632 writes the result back to the bit field in the 16-bit MMIO register.
1634 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1635 OR between the read result and the value specified by OrData, and
1636 writes the result to the 16-bit MMIO register specified by Address. The value
1637 written to the MMIO register is returned. This function must guarantee that
1638 all MMIO read and write operations are serialized. Extra left bits in OrData
1641 If 16-bit MMIO register operations are not supported, then ASSERT().
1642 If Address is not aligned on a 16-bit boundary, then ASSERT().
1643 If StartBit is greater than 15, then ASSERT().
1644 If EndBit is greater than 15, then ASSERT().
1645 If EndBit is less than StartBit, then ASSERT().
1646 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1648 @param Address The MMIO register to write.
1649 @param StartBit The ordinal of the least significant bit in the bit field.
1651 @param EndBit The ordinal of the most significant bit in the bit field.
1653 @param OrData The value to OR with read value from the MMIO register.
1655 @return The value written back to the MMIO register.
1667 return MmioWrite16 (
1669 BitFieldOr16 (MmioRead16 (Address
), StartBit
, EndBit
, OrData
)
1674 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
1675 writes the result back to the bit field in the 16-bit MMIO register.
1677 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1678 between the read result and the value specified by AndData, and writes the
1679 result to the 16-bit MMIO register specified by Address. The value written to
1680 the MMIO register is returned. This function must guarantee that all MMIO
1681 read and write operations are serialized. Extra left bits in AndData are
1684 If 16-bit MMIO register operations are not supported, then ASSERT().
1685 If Address is not aligned on a 16-bit boundary, then ASSERT().
1686 If StartBit is greater than 15, then ASSERT().
1687 If EndBit is greater than 15, then ASSERT().
1688 If EndBit is less than StartBit, then ASSERT().
1689 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1691 @param Address The MMIO register to write.
1692 @param StartBit The ordinal of the least significant bit in the bit field.
1694 @param EndBit The ordinal of the most significant bit in the bit field.
1696 @param AndData The value to AND with read value from the MMIO register.
1698 @return The value written back to the MMIO register.
1710 return MmioWrite16 (
1712 BitFieldAnd16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
)
1717 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
1718 by a bitwise OR, and writes the result back to the bit field in the
1719 16-bit MMIO register.
1721 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1722 followed by a bitwise OR between the read result and the value
1723 specified by AndData, and writes the result to the 16-bit MMIO register
1724 specified by Address. The value written to the MMIO register is returned.
1725 This function must guarantee that all MMIO read and write operations are
1726 serialized. Extra left bits in both AndData and OrData are stripped.
1728 If 16-bit MMIO register operations are not supported, then ASSERT().
1729 If Address is not aligned on a 16-bit boundary, then ASSERT().
1730 If StartBit is greater than 15, then ASSERT().
1731 If EndBit is greater than 15, then ASSERT().
1732 If EndBit is less than StartBit, then ASSERT().
1733 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1734 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1736 @param Address The MMIO register to write.
1737 @param StartBit The ordinal of the least significant bit in the bit field.
1739 @param EndBit The ordinal of the most significant bit in the bit field.
1741 @param AndData The value to AND with read value from the MMIO register.
1742 @param OrData The value to OR with the result of the AND operation.
1744 @return The value written back to the MMIO register.
1749 MmioBitFieldAndThenOr16 (
1757 return MmioWrite16 (
1759 BitFieldAndThenOr16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1764 Reads a 32-bit MMIO register, performs a bitwise OR, and writes the
1765 result back to the 32-bit MMIO register.
1767 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1768 OR between the read result and the value specified by OrData, and
1769 writes the result to the 32-bit MMIO register specified by Address. The value
1770 written to the MMIO register is returned. This function must guarantee that
1771 all MMIO read and write operations are serialized.
1773 If 32-bit MMIO register operations are not supported, then ASSERT().
1774 If Address is not aligned on a 32-bit boundary, then ASSERT().
1776 @param Address The MMIO register to write.
1777 @param OrData The value to OR with the read value from the MMIO register.
1779 @return The value written back to the MMIO register.
1789 return MmioWrite32 (Address
, MmioRead32 (Address
) | OrData
);
1793 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
1794 back to the 32-bit MMIO register.
1796 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1797 between the read result and the value specified by AndData, and writes the
1798 result to the 32-bit MMIO register specified by Address. The value written to
1799 the MMIO register is returned. This function must guarantee that all MMIO
1800 read and write operations are serialized.
1802 If 32-bit MMIO register operations are not supported, then ASSERT().
1803 If Address is not aligned on a 32-bit boundary, then ASSERT().
1805 @param Address The MMIO register to write.
1806 @param AndData The value to AND with the read value from the MMIO register.
1808 @return The value written back to the MMIO register.
1818 return MmioWrite32 (Address
, MmioRead32 (Address
) & AndData
);
1822 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
1823 OR, and writes the result back to the 32-bit MMIO register.
1825 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1826 between the read result and the value specified by AndData, performs a
1827 bitwise OR between the result of the AND operation and the value specified by
1828 OrData, and writes the result to the 32-bit MMIO register specified by
1829 Address. The value written to the MMIO register is returned. This function
1830 must guarantee that all MMIO read and write operations are serialized.
1832 If 32-bit MMIO register operations are not supported, then ASSERT().
1833 If Address is not aligned on a 32-bit boundary, then ASSERT().
1835 @param Address The MMIO register to write.
1836 @param AndData The value to AND with the read value from the MMIO register.
1837 @param OrData The value to OR with the result of the AND operation.
1839 @return The value written back to the MMIO register.
1850 return MmioWrite32 (Address
, (MmioRead32 (Address
) & AndData
) | OrData
);
1854 Reads a bit field of a MMIO register.
1856 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
1857 the StartBit and the EndBit. The value of the bit field is returned.
1859 If 32-bit MMIO register operations are not supported, then ASSERT().
1860 If Address is not aligned on a 32-bit boundary, 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().
1865 @param Address The MMIO register to read.
1866 @param StartBit The ordinal of the least significant bit in the bit field.
1868 @param EndBit The ordinal of the most significant bit in the bit field.
1871 @return The value read.
1876 MmioBitFieldRead32 (
1882 return BitFieldRead32 (MmioRead32 (Address
), StartBit
, EndBit
);
1886 Writes a bit field to a MMIO register.
1888 Writes Value to the bit field of the MMIO register. The bit field is
1889 specified by the StartBit and the EndBit. All other bits in the destination
1890 MMIO register are preserved. The new value of the 32-bit register is returned.
1892 If 32-bit MMIO register operations are not supported, then ASSERT().
1893 If Address is not aligned on a 32-bit boundary, then ASSERT().
1894 If StartBit is greater than 31, then ASSERT().
1895 If EndBit is greater than 31, then ASSERT().
1896 If EndBit is less than StartBit, then ASSERT().
1897 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1899 @param Address The MMIO register to write.
1900 @param StartBit The ordinal of the least significant bit in the bit field.
1902 @param EndBit The ordinal of the most significant bit in the bit field.
1904 @param Value The new value of the bit field.
1906 @return The value written back to the MMIO register.
1911 MmioBitFieldWrite32 (
1918 return MmioWrite32 (
1920 BitFieldWrite32 (MmioRead32 (Address
), StartBit
, EndBit
, Value
)
1925 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
1926 writes the result back to the bit field in the 32-bit MMIO register.
1928 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1929 OR between the read result and the value specified by OrData, and
1930 writes the result to the 32-bit MMIO register specified by Address. The value
1931 written to the MMIO register is returned. This function must guarantee that
1932 all MMIO read and write operations are serialized. Extra left bits in OrData
1935 If 32-bit MMIO register operations are not supported, then ASSERT().
1936 If Address is not aligned on a 32-bit boundary, then ASSERT().
1937 If StartBit is greater than 31, then ASSERT().
1938 If EndBit is greater than 31, then ASSERT().
1939 If EndBit is less than StartBit, then ASSERT().
1940 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1942 @param Address The MMIO register to write.
1943 @param StartBit The ordinal of the least significant bit in the bit field.
1945 @param EndBit The ordinal of the most significant bit in the bit field.
1947 @param OrData The value to OR with read value from the MMIO register.
1949 @return The value written back to the MMIO register.
1961 return MmioWrite32 (
1963 BitFieldOr32 (MmioRead32 (Address
), StartBit
, EndBit
, OrData
)
1968 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
1969 writes the result back to the bit field in the 32-bit MMIO register.
1971 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1972 between the read result and the value specified by AndData, and writes the
1973 result to the 32-bit MMIO register specified by Address. The value written to
1974 the MMIO register is returned. This function must guarantee that all MMIO
1975 read and write operations are serialized. Extra left bits in AndData are
1978 If 32-bit MMIO register operations are not supported, then ASSERT().
1979 If Address is not aligned on a 32-bit boundary, then ASSERT().
1980 If StartBit is greater than 31, then ASSERT().
1981 If EndBit is greater than 31, then ASSERT().
1982 If EndBit is less than StartBit, then ASSERT().
1983 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1985 @param Address The MMIO register to write.
1986 @param StartBit The ordinal of the least significant bit in the bit field.
1988 @param EndBit The ordinal of the most significant bit in the bit field.
1990 @param AndData The value to AND with read value from the MMIO register.
1992 @return The value written back to the MMIO register.
2004 return MmioWrite32 (
2006 BitFieldAnd32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
)
2011 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
2012 by a bitwise OR, and writes the result back to the bit field in the
2013 32-bit MMIO register.
2015 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
2016 followed by a bitwise OR between the read result and the value
2017 specified by AndData, and writes the result to the 32-bit MMIO register
2018 specified by Address. The value written to the MMIO register is returned.
2019 This function must guarantee that all MMIO read and write operations are
2020 serialized. Extra left bits in both AndData and OrData are stripped.
2022 If 32-bit MMIO register operations are not supported, then ASSERT().
2023 If Address is not aligned on a 32-bit boundary, then ASSERT().
2024 If StartBit is greater than 31, then ASSERT().
2025 If EndBit is greater than 31, then ASSERT().
2026 If EndBit is less than StartBit, then ASSERT().
2027 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2028 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2030 @param Address The MMIO register to write.
2031 @param StartBit The ordinal of the least significant bit in the bit field.
2033 @param EndBit The ordinal of the most significant bit in the bit field.
2035 @param AndData The value to AND with read value from the MMIO register.
2036 @param OrData The value to OR with the result of the AND operation.
2038 @return The value written back to the MMIO register.
2043 MmioBitFieldAndThenOr32 (
2051 return MmioWrite32 (
2053 BitFieldAndThenOr32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
, OrData
)
2058 Reads a 64-bit MMIO register, performs a bitwise OR, and writes the
2059 result back to the 64-bit MMIO register.
2061 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2062 OR between the read result and the value specified by OrData, and
2063 writes the result to the 64-bit MMIO register specified by Address. The value
2064 written to the MMIO register is returned. This function must guarantee that
2065 all MMIO read and write operations are serialized.
2067 If 64-bit MMIO register operations are not supported, then ASSERT().
2068 If Address is not aligned on a 64-bit boundary, then ASSERT().
2070 @param Address The MMIO register to write.
2071 @param OrData The value to OR with the read value from the MMIO register.
2073 @return The value written back to the MMIO register.
2083 return MmioWrite64 (Address
, MmioRead64 (Address
) | OrData
);
2087 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2088 back to the 64-bit MMIO register.
2090 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2091 between the read result and the value specified by AndData, and writes the
2092 result to the 64-bit MMIO register specified by Address. The value written to
2093 the MMIO register is returned. This function must guarantee that all MMIO
2094 read and write operations are serialized.
2096 If 64-bit MMIO register operations are not supported, then ASSERT().
2097 If Address is not aligned on a 64-bit boundary, then ASSERT().
2099 @param Address The MMIO register to write.
2100 @param AndData The value to AND with the read value from the MMIO register.
2102 @return The value written back to the MMIO register.
2112 return MmioWrite64 (Address
, MmioRead64 (Address
) & AndData
);
2116 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2117 OR, and writes the result back to the 64-bit MMIO register.
2119 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2120 between the read result and the value specified by AndData, performs a
2121 bitwise OR between the result of the AND operation and the value specified by
2122 OrData, and writes the result to the 64-bit MMIO register specified by
2123 Address. The value written to the MMIO register is returned. This function
2124 must guarantee that all MMIO read and write operations are serialized.
2126 If 64-bit MMIO register operations are not supported, then ASSERT().
2127 If Address is not aligned on a 64-bit boundary, then ASSERT().
2129 @param Address The MMIO register to write.
2130 @param AndData The value to AND with the read value from the MMIO register.
2131 @param OrData The value to OR with the result of the AND operation.
2133 @return The value written back to the MMIO register.
2144 return MmioWrite64 (Address
, (MmioRead64 (Address
) & AndData
) | OrData
);
2148 Reads a bit field of a MMIO register.
2150 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2151 the StartBit and the EndBit. The value of the bit field is returned.
2153 If 64-bit MMIO register operations are not supported, then ASSERT().
2154 If Address is not aligned on a 64-bit boundary, then ASSERT().
2155 If StartBit is greater than 63, then ASSERT().
2156 If EndBit is greater than 63, then ASSERT().
2157 If EndBit is less than StartBit, then ASSERT().
2159 @param Address The MMIO register to read.
2160 @param StartBit The ordinal of the least significant bit in the bit field.
2162 @param EndBit The ordinal of the most significant bit in the bit field.
2165 @return The value read.
2170 MmioBitFieldRead64 (
2176 return BitFieldRead64 (MmioRead64 (Address
), StartBit
, EndBit
);
2180 Writes a bit field to a MMIO register.
2182 Writes Value to the bit field of the MMIO register. The bit field is
2183 specified by the StartBit and the EndBit. All other bits in the destination
2184 MMIO register are preserved. The new value of the 64-bit register is returned.
2186 If 64-bit MMIO register operations are not supported, then ASSERT().
2187 If Address is not aligned on a 64-bit boundary, then ASSERT().
2188 If StartBit is greater than 63, then ASSERT().
2189 If EndBit is greater than 63, then ASSERT().
2190 If EndBit is less than StartBit, then ASSERT().
2191 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2193 @param Address The MMIO register to write.
2194 @param StartBit The ordinal of the least significant bit in the bit field.
2196 @param EndBit The ordinal of the most significant bit in the bit field.
2198 @param Value The new value of the bit field.
2200 @return The value written back to the MMIO register.
2205 MmioBitFieldWrite64 (
2212 return MmioWrite64 (
2214 BitFieldWrite64 (MmioRead64 (Address
), StartBit
, EndBit
, Value
)
2219 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2220 writes the result back to the bit field in the 64-bit MMIO register.
2222 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2223 OR between the read result and the value specified by OrData, and
2224 writes the result to the 64-bit MMIO register specified by Address. The value
2225 written to the MMIO register is returned. This function must guarantee that
2226 all MMIO read and write operations are serialized. Extra left bits in OrData
2229 If 64-bit MMIO register operations are not supported, then ASSERT().
2230 If Address is not aligned on a 64-bit boundary, then ASSERT().
2231 If StartBit is greater than 63, then ASSERT().
2232 If EndBit is greater than 63, then ASSERT().
2233 If EndBit is less than StartBit, then ASSERT().
2234 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2236 @param Address MMIO register to write.
2237 @param StartBit The ordinal of the least significant bit in the bit field.
2239 @param EndBit The ordinal of the most significant bit in the bit field.
2241 @param OrData The value to OR with read value from the MMIO register.
2243 @return The value written back to the MMIO register.
2255 return MmioWrite64 (
2257 BitFieldOr64 (MmioRead64 (Address
), StartBit
, EndBit
, OrData
)
2262 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2263 writes the result back to the bit field in the 64-bit MMIO register.
2265 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2266 between the read result and the value specified by AndData, and writes the
2267 result to the 64-bit MMIO register specified by Address. The value written to
2268 the MMIO register is returned. This function must guarantee that all MMIO
2269 read and write operations are serialized. Extra left bits in AndData are
2272 If 64-bit MMIO register operations are not supported, then ASSERT().
2273 If Address is not aligned on a 64-bit boundary, then ASSERT().
2274 If StartBit is greater than 63, then ASSERT().
2275 If EndBit is greater than 63, then ASSERT().
2276 If EndBit is less than StartBit, then ASSERT().
2277 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2279 @param Address MMIO register to write.
2280 @param StartBit The ordinal of the least significant bit in the bit field.
2282 @param EndBit The ordinal of the most significant bit in the bit field.
2284 @param AndData The value to AND with read value from the MMIO register.
2286 @return The value written back to the MMIO register.
2298 return MmioWrite64 (
2300 BitFieldAnd64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
)
2305 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2306 by a bitwise OR, and writes the result back to the bit field in the
2307 64-bit MMIO register.
2309 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2310 followed by a bitwise OR between the read result and the value
2311 specified by AndData, and writes the result to the 64-bit MMIO register
2312 specified by Address. The value written to the MMIO register is returned.
2313 This function must guarantee that all MMIO read and write operations are
2314 serialized. Extra left bits in both AndData and OrData are stripped.
2316 If 64-bit MMIO register operations are not supported, then ASSERT().
2317 If Address is not aligned on a 64-bit boundary, then ASSERT().
2318 If StartBit is greater than 63, then ASSERT().
2319 If EndBit is greater than 63, then ASSERT().
2320 If EndBit is less than StartBit, then ASSERT().
2321 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2322 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2324 @param Address The MMIO register to write.
2325 @param StartBit The ordinal of the least significant bit in the bit field.
2327 @param EndBit The ordinal of the most significant bit in the bit field.
2329 @param AndData The value to AND with read value from the MMIO register.
2330 @param OrData The value to OR with the result of the AND operation.
2332 @return The value written back to the MMIO register.
2337 MmioBitFieldAndThenOr64 (
2345 return MmioWrite64 (
2347 BitFieldAndThenOr64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
, OrData
)