]>
git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Library/DxeIoLibCpuIo/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 - 2012, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 Module Name: IoHighLevel.c
18 The following IoLib instances share the same version of this file:
27 #include "DxeCpuIoLibInternal.h"
30 Reads an 8-bit I/O port, performs a bitwise OR, and writes the
31 result back to the 8-bit I/O port.
33 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
34 between the read result and the value specified by OrData, and writes the
35 result to the 8-bit I/O port specified by Port. The value written to the I/O
36 port is returned. This function must guarantee that all I/O read and write
37 operations are serialized.
39 If 8-bit I/O port operations are not supported, then ASSERT().
41 @param Port The I/O port to write.
42 @param OrData The value to OR with the read value from the I/O port.
44 @return The value written back to the I/O port.
54 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) | OrData
));
58 Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
59 to the 8-bit I/O port.
61 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
62 the read result and the value specified by AndData, and writes the result to
63 the 8-bit I/O port specified by Port. The value written to the I/O port is
64 returned. This function must guarantee that all I/O read and write operations
67 If 8-bit I/O port operations are not supported, then ASSERT().
69 @param Port The I/O port to write.
70 @param AndData The value to AND with the read value from the I/O port.
72 @return The value written back to the I/O port.
82 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) & AndData
));
86 Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
87 inclusive OR, and writes the result back to the 8-bit I/O port.
89 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
90 the read result and the value specified by AndData, performs a bitwise OR
91 between the result of the AND operation and the value specified by OrData,
92 and writes the result to the 8-bit I/O port specified by Port. The value
93 written to the I/O port is returned. This function must guarantee that all
94 I/O read and write operations are serialized.
96 If 8-bit I/O port operations are not supported, then ASSERT().
98 @param Port The I/O port to write.
99 @param AndData The value to AND with the read value from the I/O port.
100 @param OrData The value to OR with the result of the AND operation.
102 @return The value written back to the I/O port.
113 return IoWrite8 (Port
, (UINT8
) ((IoRead8 (Port
) & AndData
) | OrData
));
117 Reads a bit field of an I/O register.
119 Reads the bit field in an 8-bit I/O register. The bit field is specified by
120 the StartBit and the EndBit. The value of the bit field is returned.
122 If 8-bit I/O port operations are not supported, then ASSERT().
123 If StartBit is greater than 7, then ASSERT().
124 If EndBit is greater than 7, then ASSERT().
125 If EndBit is less than StartBit, then ASSERT().
127 @param Port The I/O port to read.
128 @param StartBit The ordinal of the least significant bit in the bit field.
130 @param EndBit The ordinal of the most significant bit in the bit field.
133 @return The value read.
144 return BitFieldRead8 (IoRead8 (Port
), StartBit
, EndBit
);
148 Writes a bit field to an I/O register.
150 Writes Value to the bit field of the I/O register. The bit field is specified
151 by the StartBit and the EndBit. All other bits in the destination I/O
152 register are preserved. The value written to the I/O port is returned. Extra
153 left bits in Value are stripped.
155 If 8-bit I/O port operations are not supported, then ASSERT().
156 If StartBit is greater than 7, then ASSERT().
157 If EndBit is greater than 7, then ASSERT().
158 If EndBit is less than StartBit, then ASSERT().
159 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
161 @param Port The I/O port to write.
162 @param StartBit The ordinal of the least significant bit in the bit field.
164 @param EndBit The ordinal of the most significant bit in the bit field.
166 @param Value New value of the bit field.
168 @return The value written back to the I/O port.
182 BitFieldWrite8 (IoRead8 (Port
), StartBit
, EndBit
, Value
)
187 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
188 result back to the bit field in the 8-bit port.
190 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
191 between the read result and the value specified by OrData, and writes the
192 result to the 8-bit I/O port specified by Port. The value written to the I/O
193 port is returned. This function must guarantee that all I/O read and write
194 operations are serialized. Extra left bits in OrData are stripped.
196 If 8-bit I/O port operations are not supported, then ASSERT().
197 If StartBit is greater than 7, then ASSERT().
198 If EndBit is greater than 7, then ASSERT().
199 If EndBit is less than StartBit, then ASSERT().
200 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
202 @param Port The I/O port to write.
203 @param StartBit The ordinal of the least significant bit in the bit field.
205 @param EndBit The ordinal of the most significant bit in the bit field.
207 @param OrData The value to OR with the read value from the I/O port.
209 @return The value written back to the I/O port.
223 BitFieldOr8 (IoRead8 (Port
), StartBit
, EndBit
, OrData
)
228 Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
229 result back to the bit field in the 8-bit port.
231 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
232 the read result and the value specified by AndData, and writes the result to
233 the 8-bit I/O port specified by Port. The value written to the I/O port is
234 returned. This function must guarantee that all I/O read and write operations
235 are serialized. Extra left bits in AndData are stripped.
237 If 8-bit I/O port operations are not supported, then ASSERT().
238 If StartBit is greater than 7, then ASSERT().
239 If EndBit is greater than 7, then ASSERT().
240 If EndBit is less than StartBit, then ASSERT().
241 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
243 @param Port The I/O port to write.
244 @param StartBit The ordinal of the least significant bit in the bit field.
246 @param EndBit The ordinal of the most significant bit in the bit field.
248 @param AndData The value to AND with the read value from the I/O port.
250 @return The value written back to the I/O port.
264 BitFieldAnd8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
)
269 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
270 bitwise OR, and writes the result back to the bit field in the
273 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
274 by a bitwise OR between the read result and the value specified by
275 AndData, and writes the result to the 8-bit I/O port specified by Port. The
276 value written to the I/O port is returned. This function must guarantee that
277 all I/O read and write operations are serialized. Extra left bits in both
278 AndData and OrData are stripped.
280 If 8-bit I/O port operations are not supported, then ASSERT().
281 If StartBit is greater than 7, then ASSERT().
282 If EndBit is greater than 7, then ASSERT().
283 If EndBit is less than StartBit, then ASSERT().
284 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
285 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
287 @param Port The I/O port to write.
288 @param StartBit The ordinal of the least significant bit in the bit field.
290 @param EndBit The ordinal of the most significant bit in the bit field.
292 @param AndData The value to AND with the read value from the I/O port.
293 @param OrData The value to OR with the result of the AND operation.
295 @return The value written back to the I/O port.
300 IoBitFieldAndThenOr8 (
310 BitFieldAndThenOr8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
, OrData
)
315 Reads a 16-bit I/O port, performs a bitwise OR, and writes the
316 result back to the 16-bit I/O port.
318 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
319 between the read result and the value specified by OrData, and writes the
320 result to the 16-bit I/O port specified by Port. The value written to the I/O
321 port is returned. This function must guarantee that all I/O read and write
322 operations are serialized.
324 If 16-bit I/O port operations are not supported, then ASSERT().
326 @param Port The I/O port to write.
327 @param OrData The value to OR with the read value from the I/O port.
329 @return The value written back to the I/O port.
339 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) | OrData
));
343 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
344 to the 16-bit I/O port.
346 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
347 the read result and the value specified by AndData, and writes the result to
348 the 16-bit I/O port specified by Port. The value written to the I/O port is
349 returned. This function must guarantee that all I/O read and write operations
352 If 16-bit I/O port operations are not supported, then ASSERT().
354 @param Port The I/O port to write.
355 @param AndData The value to AND with the read value from the I/O port.
357 @return The value written back to the I/O port.
367 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) & AndData
));
371 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
372 inclusive OR, and writes the result back to the 16-bit I/O port.
374 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
375 the read result and the value specified by AndData, performs a bitwise OR
376 between the result of the AND operation and the value specified by OrData,
377 and writes the result to the 16-bit I/O port specified by Port. The value
378 written to the I/O port is returned. This function must guarantee that all
379 I/O read and write operations are serialized.
381 If 16-bit I/O port operations are not supported, then ASSERT().
383 @param Port The I/O port to write.
384 @param AndData The value to AND with the read value from the I/O port.
385 @param OrData The value to OR with the result of the AND operation.
387 @return The value written back to the I/O port.
398 return IoWrite16 (Port
, (UINT16
) ((IoRead16 (Port
) & AndData
) | OrData
));
402 Reads a bit field of an I/O register.
404 Reads the bit field in a 16-bit I/O register. The bit field is specified by
405 the StartBit and the EndBit. The value of the bit field is returned.
407 If 16-bit I/O port operations are not supported, then ASSERT().
408 If StartBit is greater than 15, then ASSERT().
409 If EndBit is greater than 15, then ASSERT().
410 If EndBit is less than StartBit, then ASSERT().
412 @param Port The I/O port to read.
413 @param StartBit The ordinal of the least significant bit in the bit field.
415 @param EndBit The ordinal of the most significant bit in the bit field.
418 @return The value read.
429 return BitFieldRead16 (IoRead16 (Port
), StartBit
, EndBit
);
433 Writes a bit field to an I/O register.
435 Writes Value to the bit field of the I/O register. The bit field is specified
436 by the StartBit and the EndBit. All other bits in the destination I/O
437 register are preserved. The value written to the I/O port is returned. Extra
438 left bits in Value are stripped.
440 If 16-bit I/O port operations are not supported, then ASSERT().
441 If StartBit is greater than 15, then ASSERT().
442 If EndBit is greater than 15, then ASSERT().
443 If EndBit is less than StartBit, then ASSERT().
444 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
446 @param Port The I/O port to write.
447 @param StartBit The ordinal of the least significant bit in the bit field.
449 @param EndBit The ordinal of the most significant bit in the bit field.
451 @param Value New value of the bit field.
453 @return The value written back to the I/O port.
467 BitFieldWrite16 (IoRead16 (Port
), StartBit
, EndBit
, Value
)
472 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
473 result back to the bit field in the 16-bit port.
475 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
476 between the read result and the value specified by OrData, and writes the
477 result to the 16-bit I/O port specified by Port. The value written to the I/O
478 port is returned. This function must guarantee that all I/O read and write
479 operations are serialized. Extra left bits in OrData are stripped.
481 If 16-bit I/O port operations are not supported, then ASSERT().
482 If StartBit is greater than 15, then ASSERT().
483 If EndBit is greater than 15, then ASSERT().
484 If EndBit is less than StartBit, then ASSERT().
485 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
487 @param Port The I/O port to write.
488 @param StartBit The ordinal of the least significant bit in the bit field.
490 @param EndBit The ordinal of the most significant bit in the bit field.
492 @param OrData The value to OR with the read value from the I/O port.
494 @return The value written back to the I/O port.
508 BitFieldOr16 (IoRead16 (Port
), StartBit
, EndBit
, OrData
)
513 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
514 result back to the bit field in the 16-bit port.
516 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
517 the read result and the value specified by AndData, and writes the result to
518 the 16-bit I/O port specified by Port. The value written to the I/O port is
519 returned. This function must guarantee that all I/O read and write operations
520 are serialized. Extra left bits in AndData are stripped.
522 If 16-bit I/O port operations are not supported, then ASSERT().
523 If StartBit is greater than 15, then ASSERT().
524 If EndBit is greater than 15, then ASSERT().
525 If EndBit is less than StartBit, then ASSERT().
526 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
528 @param Port The I/O port to write.
529 @param StartBit The ordinal of the least significant bit in the bit field.
531 @param EndBit The ordinal of the most significant bit in the bit field.
533 @param AndData The value to AND with the read value from the I/O port.
535 @return The value written back to the I/O port.
549 BitFieldAnd16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
)
554 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
555 bitwise OR, and writes the result back to the bit field in the
558 Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
559 by a bitwise OR between the read result and the value specified by
560 AndData, and writes the result to the 16-bit I/O port specified by Port. The
561 value written to the I/O port is returned. This function must guarantee that
562 all I/O read and write operations are serialized. Extra left bits in both
563 AndData and OrData are stripped.
565 If 16-bit I/O port operations are not supported, then ASSERT().
566 If StartBit is greater than 15, then ASSERT().
567 If EndBit is greater than 15, then ASSERT().
568 If EndBit is less than StartBit, then ASSERT().
569 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
570 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
572 @param Port The I/O port to write.
573 @param StartBit The ordinal of the least significant bit in the bit field.
575 @param EndBit The ordinal of the most significant bit in the bit field.
577 @param AndData The value to AND with the read value from the I/O port.
578 @param OrData The value to OR with the result of the AND operation.
580 @return The value written back to the I/O port.
585 IoBitFieldAndThenOr16 (
595 BitFieldAndThenOr16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
, OrData
)
600 Reads a 32-bit I/O port, performs a bitwise OR, and writes the
601 result back to the 32-bit I/O port.
603 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
604 between the read result and the value specified by OrData, and writes the
605 result to the 32-bit I/O port specified by Port. The value written to the I/O
606 port is returned. This function must guarantee that all I/O read and write
607 operations are serialized.
609 If 32-bit I/O port operations are not supported, then ASSERT().
611 @param Port The I/O port to write.
612 @param OrData The value to OR with the read value from the I/O port.
614 @return The value written back to the I/O port.
624 return IoWrite32 (Port
, IoRead32 (Port
) | OrData
);
628 Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
629 to the 32-bit I/O port.
631 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
632 the read result and the value specified by AndData, and writes the result to
633 the 32-bit I/O port specified by Port. The value written to the I/O port is
634 returned. This function must guarantee that all I/O read and write operations
637 If 32-bit I/O port operations are not supported, then ASSERT().
639 @param Port The I/O port to write.
640 @param AndData The value to AND with the read value from the I/O port.
642 @return The value written back to the I/O port.
652 return IoWrite32 (Port
, IoRead32 (Port
) & AndData
);
656 Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
657 inclusive OR, and writes the result back to the 32-bit I/O port.
659 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
660 the read result and the value specified by AndData, performs a bitwise OR
661 between the result of the AND operation and the value specified by OrData,
662 and writes the result to the 32-bit I/O port specified by Port. The value
663 written to the I/O port is returned. This function must guarantee that all
664 I/O read and write operations are serialized.
666 If 32-bit I/O port operations are not supported, 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 StartBit is greater than 31, then ASSERT().
694 If EndBit is greater than 31, then ASSERT().
695 If EndBit is less than StartBit, then ASSERT().
697 @param Port The I/O port to read.
698 @param StartBit The ordinal of the least significant bit in the bit field.
700 @param EndBit The ordinal of the most significant bit in the bit field.
703 @return The value read.
714 return BitFieldRead32 (IoRead32 (Port
), StartBit
, EndBit
);
718 Writes a bit field to an I/O register.
720 Writes Value to the bit field of the I/O register. The bit field is specified
721 by the StartBit and the EndBit. All other bits in the destination I/O
722 register are preserved. The value written to the I/O port is returned. Extra
723 left bits in Value are stripped.
725 If 32-bit I/O port operations are not supported, then ASSERT().
726 If StartBit is greater than 31, then ASSERT().
727 If EndBit is greater than 31, then ASSERT().
728 If EndBit is less than StartBit, then ASSERT().
729 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
731 @param Port The I/O port to write.
732 @param StartBit The ordinal of the least significant bit in the bit field.
734 @param EndBit The ordinal of the most significant bit in the bit field.
736 @param Value New value of the bit field.
738 @return The value written back to the I/O port.
752 BitFieldWrite32 (IoRead32 (Port
), StartBit
, EndBit
, Value
)
757 Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the
758 result back to the bit field in the 32-bit port.
760 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
761 between the read result and the value specified by OrData, and writes the
762 result to the 32-bit I/O port specified by Port. The value written to the I/O
763 port is returned. This function must guarantee that all I/O read and write
764 operations are serialized. Extra left bits in OrData are stripped.
766 If 32-bit I/O port operations are not supported, then ASSERT().
767 If StartBit is greater than 31, then ASSERT().
768 If EndBit is greater than 31, then ASSERT().
769 If EndBit is less than StartBit, then ASSERT().
770 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
772 @param Port The I/O port to write.
773 @param StartBit The ordinal of the least significant bit in the bit field.
775 @param EndBit The ordinal of the most significant bit in the bit field.
777 @param OrData The value to OR with the read value from the I/O port.
779 @return The value written back to the I/O port.
793 BitFieldOr32 (IoRead32 (Port
), StartBit
, EndBit
, OrData
)
798 Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
799 result back to the bit field in the 32-bit port.
801 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
802 the read result and the value specified by AndData, and writes the result to
803 the 32-bit I/O port specified by Port. The value written to the I/O port is
804 returned. This function must guarantee that all I/O read and write operations
805 are serialized. Extra left bits in AndData are stripped.
807 If 32-bit I/O port operations are not supported, then ASSERT().
808 If StartBit is greater than 31, then ASSERT().
809 If EndBit is greater than 31, then ASSERT().
810 If EndBit is less than StartBit, then ASSERT().
811 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
813 @param Port The I/O port to write.
814 @param StartBit The ordinal of the least significant bit in the bit field.
816 @param EndBit The ordinal of the most significant bit in the bit field.
818 @param AndData The value to AND with the read value from the I/O port.
820 @return The value written back to the I/O port.
834 BitFieldAnd32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
)
839 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
840 bitwise OR, and writes the result back to the bit field in the
843 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
844 by a bitwise OR between the read result and the value specified by
845 AndData, and writes the result to the 32-bit I/O port specified by Port. The
846 value written to the I/O port is returned. This function must guarantee that
847 all I/O read and write operations are serialized. Extra left bits in both
848 AndData and OrData are stripped.
850 If 32-bit I/O port operations are not supported, then ASSERT().
851 If StartBit is greater than 31, then ASSERT().
852 If EndBit is greater than 31, then ASSERT().
853 If EndBit is less than StartBit, then ASSERT().
854 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
855 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
857 @param Port The I/O port to write.
858 @param StartBit The ordinal of the least significant bit in the bit field.
860 @param EndBit The ordinal of the most significant bit in the bit field.
862 @param AndData The value to AND with the read value from the I/O port.
863 @param OrData The value to OR with the result of the AND operation.
865 @return The value written back to the I/O port.
870 IoBitFieldAndThenOr32 (
880 BitFieldAndThenOr32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
, OrData
)
885 Reads a 64-bit I/O port, performs a bitwise OR, and writes the
886 result back to the 64-bit I/O port.
888 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
889 between the read result and the value specified by OrData, and writes the
890 result to the 64-bit I/O port specified by Port. The value written to the I/O
891 port is returned. This function must guarantee that all I/O read and write
892 operations are serialized.
894 If 64-bit I/O port operations are not supported, then ASSERT().
896 @param Port The I/O port to write.
897 @param OrData The value to OR with the read value from the I/O port.
899 @return The value written back to the I/O port.
909 return IoWrite64 (Port
, IoRead64 (Port
) | OrData
);
913 Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
914 to the 64-bit I/O port.
916 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
917 the read result and the value specified by AndData, and writes the result to
918 the 64-bit I/O port specified by Port. The value written to the I/O port is
919 returned. This function must guarantee that all I/O read and write operations
922 If 64-bit I/O port operations are not supported, then ASSERT().
924 @param Port The I/O port to write.
925 @param AndData The value to AND with the read value from the I/O port.
927 @return The value written back to the I/O port.
937 return IoWrite64 (Port
, IoRead64 (Port
) & AndData
);
941 Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
942 inclusive OR, and writes the result back to the 64-bit I/O port.
944 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
945 the read result and the value specified by AndData, performs a bitwise OR
946 between the result of the AND operation and the value specified by OrData,
947 and writes the result to the 64-bit I/O port specified by Port. The value
948 written to the I/O port is returned. This function must guarantee that all
949 I/O read and write operations are serialized.
951 If 64-bit I/O port operations are not supported, then ASSERT().
953 @param Port The I/O port to write.
954 @param AndData The value to AND with the read value from the I/O port.
955 @param OrData The value to OR with the result of the AND operation.
957 @return The value written back to the I/O port.
968 return IoWrite64 (Port
, (IoRead64 (Port
) & AndData
) | OrData
);
972 Reads a bit field of an I/O register.
974 Reads the bit field in a 64-bit I/O register. The bit field is specified by
975 the StartBit and the EndBit. The value of the bit field is returned.
977 If 64-bit I/O port operations are not supported, then ASSERT().
978 If StartBit is greater than 63, then ASSERT().
979 If EndBit is greater than 63, then ASSERT().
980 If EndBit is less than StartBit, then ASSERT().
982 @param Port The I/O port to read.
983 @param StartBit The ordinal of the least significant bit in the bit field.
985 @param EndBit The ordinal of the most significant bit in the bit field.
988 @return The value read.
999 return BitFieldRead64 (IoRead64 (Port
), StartBit
, EndBit
);
1003 Writes a bit field to an I/O register.
1005 Writes Value to the bit field of the I/O register. The bit field is specified
1006 by the StartBit and the EndBit. All other bits in the destination I/O
1007 register are preserved. The value written to the I/O port is returned. Extra
1008 left bits in Value are stripped.
1010 If 64-bit I/O port operations are not supported, then ASSERT().
1011 If StartBit is greater than 63, then ASSERT().
1012 If EndBit is greater than 63, then ASSERT().
1013 If EndBit is less than StartBit, then ASSERT().
1014 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1016 @param Port The I/O port to write.
1017 @param StartBit The ordinal of the least significant bit in the bit field.
1019 @param EndBit The ordinal of the most significant bit in the bit field.
1021 @param Value New value of the bit field.
1023 @return The value written back to the I/O port.
1037 BitFieldWrite64 (IoRead64 (Port
), StartBit
, EndBit
, Value
)
1042 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1043 result back to the bit field in the 64-bit port.
1045 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
1046 between the read result and the value specified by OrData, and writes the
1047 result to the 64-bit I/O port specified by Port. The value written to the I/O
1048 port is returned. This function must guarantee that all I/O read and write
1049 operations are serialized. Extra left bits in OrData are stripped.
1051 If 64-bit I/O port operations are not supported, then ASSERT().
1052 If StartBit is greater than 63, then ASSERT().
1053 If EndBit is greater than 63, then ASSERT().
1054 If EndBit is less than StartBit, then ASSERT().
1055 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1057 @param Port The I/O port to write.
1058 @param StartBit The ordinal of the least significant bit in the bit field.
1060 @param EndBit The ordinal of the most significant bit in the bit field.
1062 @param OrData The value to OR with the read value from the I/O port.
1064 @return The value written back to the I/O port.
1078 BitFieldOr64 (IoRead64 (Port
), StartBit
, EndBit
, OrData
)
1083 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1084 result back to the bit field in the 64-bit port.
1086 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1087 the read result and the value specified by AndData, and writes the result to
1088 the 64-bit I/O port specified by Port. The value written to the I/O port is
1089 returned. This function must guarantee that all I/O read and write operations
1090 are serialized. Extra left bits in AndData are stripped.
1092 If 64-bit I/O port operations are not supported, then ASSERT().
1093 If StartBit is greater than 63, then ASSERT().
1094 If EndBit is greater than 63, then ASSERT().
1095 If EndBit is less than StartBit, then ASSERT().
1096 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1098 @param Port The I/O port to write.
1099 @param StartBit The ordinal of the least significant bit in the bit field.
1101 @param EndBit The ordinal of the most significant bit in the bit field.
1103 @param AndData The value to AND with the read value from the I/O port.
1105 @return The value written back to the I/O port.
1119 BitFieldAnd64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
)
1124 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
1125 bitwise OR, and writes the result back to the bit field in the
1128 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
1129 by a bitwise OR between the read result and the value specified by
1130 AndData, and writes the result to the 64-bit I/O port specified by Port. The
1131 value written to the I/O port is returned. This function must guarantee that
1132 all I/O read and write operations are serialized. Extra left bits in both
1133 AndData and OrData are stripped.
1135 If 64-bit I/O port operations are not supported, then ASSERT().
1136 If StartBit is greater than 63, then ASSERT().
1137 If EndBit is greater than 63, then ASSERT().
1138 If EndBit is less than StartBit, then ASSERT().
1139 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1140 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1142 @param Port The I/O port to write.
1143 @param StartBit The ordinal of the least significant bit in the bit field.
1145 @param EndBit The ordinal of the most significant bit in the bit field.
1147 @param AndData The value to AND with the read value from the I/O port.
1148 @param OrData The value to OR with the result of the AND operation.
1150 @return The value written back to the I/O port.
1155 IoBitFieldAndThenOr64 (
1165 BitFieldAndThenOr64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
, OrData
)
1170 Reads an 8-bit MMIO register, performs a bitwise OR, and writes the
1171 result back to the 8-bit MMIO register.
1173 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1174 inclusive OR between the read result and the value specified by OrData, and
1175 writes the result to the 8-bit MMIO register specified by Address. The value
1176 written to the MMIO register is returned. This function must guarantee that
1177 all MMIO read and write operations are serialized.
1179 If 8-bit MMIO register operations are not supported, then ASSERT().
1181 @param Address The MMIO register to write.
1182 @param OrData The value to OR with the read value from the MMIO register.
1184 @return The value written back to the MMIO register.
1194 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) | OrData
));
1198 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1199 back to the 8-bit MMIO register.
1201 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1202 between the read result and the value specified by AndData, and writes the
1203 result to the 8-bit MMIO register specified by Address. The value written to
1204 the MMIO register is returned. This function must guarantee that all MMIO
1205 read and write operations are serialized.
1207 If 8-bit MMIO register operations are not supported, then ASSERT().
1209 @param Address The MMIO register to write.
1210 @param AndData The value to AND with the read value from the MMIO register.
1212 @return The value written back to the MMIO register.
1222 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) & AndData
));
1226 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1227 inclusive OR, and writes the result back to the 8-bit MMIO register.
1229 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1230 between the read result and the value specified by AndData, performs a
1231 bitwise OR between the result of the AND operation and the value specified by
1232 OrData, and writes the result to the 8-bit MMIO register specified by
1233 Address. The value written to the MMIO register is returned. This function
1234 must guarantee that all MMIO read and write operations are serialized.
1236 If 8-bit MMIO register operations are not supported, then ASSERT().
1239 @param Address The MMIO register to write.
1240 @param AndData The value to AND with the read value from the MMIO register.
1241 @param OrData The value to OR with the result of the AND operation.
1243 @return The value written back to the MMIO register.
1254 return MmioWrite8 (Address
, (UINT8
) ((MmioRead8 (Address
) & AndData
) | OrData
));
1258 Reads a bit field of a MMIO register.
1260 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1261 the StartBit and the EndBit. The value of the bit field is returned.
1263 If 8-bit MMIO register operations are not supported, then ASSERT().
1264 If StartBit is greater than 7, then ASSERT().
1265 If EndBit is greater than 7, then ASSERT().
1266 If EndBit is less than StartBit, then ASSERT().
1268 @param Address MMIO register to read.
1269 @param StartBit The ordinal of the least significant bit in the bit field.
1271 @param EndBit The ordinal of the most significant bit in the bit field.
1274 @return The value read.
1285 return BitFieldRead8 (MmioRead8 (Address
), StartBit
, EndBit
);
1289 Writes a bit field to a MMIO register.
1291 Writes Value to the bit field of the MMIO register. The bit field is
1292 specified by the StartBit and the EndBit. All other bits in the destination
1293 MMIO register are preserved. The new value of the 8-bit register is returned.
1295 If 8-bit MMIO register operations are not supported, then ASSERT().
1296 If StartBit is greater than 7, then ASSERT().
1297 If EndBit is greater than 7, then ASSERT().
1298 If EndBit is less than StartBit, then ASSERT().
1299 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1301 @param Address MMIO register to write.
1302 @param StartBit The ordinal of the least significant bit in the bit field.
1304 @param EndBit The ordinal of the most significant bit in the bit field.
1306 @param Value New value of the bit field.
1308 @return The value written back to the MMIO register.
1313 MmioBitFieldWrite8 (
1322 BitFieldWrite8 (MmioRead8 (Address
), StartBit
, EndBit
, Value
)
1327 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1328 writes the result back to the bit field in the 8-bit MMIO register.
1330 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1331 inclusive OR between the read result and the value specified by OrData, and
1332 writes the result to the 8-bit MMIO register specified by Address. The value
1333 written to the MMIO register is returned. This function must guarantee that
1334 all MMIO read and write operations are serialized. Extra left bits in OrData
1337 If 8-bit MMIO register operations are not supported, then ASSERT().
1338 If StartBit is greater than 7, then ASSERT().
1339 If EndBit is greater than 7, then ASSERT().
1340 If EndBit is less than StartBit, then ASSERT().
1341 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1343 @param Address MMIO register to write.
1344 @param StartBit The ordinal of the least significant bit in the bit field.
1346 @param EndBit The ordinal of the most significant bit in the bit field.
1348 @param OrData The value to OR with read value from the MMIO register.
1350 @return The value written back to the MMIO register.
1364 BitFieldOr8 (MmioRead8 (Address
), StartBit
, EndBit
, OrData
)
1369 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1370 writes the result back to the bit field in the 8-bit MMIO register.
1372 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1373 between the read result and the value specified by AndData, and writes the
1374 result to the 8-bit MMIO register specified by Address. The value written to
1375 the MMIO register is returned. This function must guarantee that all MMIO
1376 read and write operations are serialized. Extra left bits in AndData are
1379 If 8-bit MMIO register operations are not supported, then ASSERT().
1380 If StartBit is greater than 7, then ASSERT().
1381 If EndBit is greater than 7, then ASSERT().
1382 If EndBit is less than StartBit, then ASSERT().
1383 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1385 @param Address MMIO register to write.
1386 @param StartBit The ordinal of the least significant bit in the bit field.
1388 @param EndBit The ordinal of the most significant bit in the bit field.
1390 @param AndData The value to AND with read value from the MMIO register.
1392 @return The value written back to the MMIO register.
1406 BitFieldAnd8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
)
1411 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1412 by a bitwise OR, and writes the result back to the bit field in the
1413 8-bit MMIO register.
1415 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1416 followed by a bitwise OR between the read result and the value
1417 specified by AndData, and writes the result to the 8-bit MMIO register
1418 specified by Address. The value written to the MMIO register is returned.
1419 This function must guarantee that all MMIO read and write operations are
1420 serialized. Extra left bits in both AndData and OrData are stripped.
1422 If 8-bit MMIO register operations are not supported, then ASSERT().
1423 If StartBit is greater than 7, then ASSERT().
1424 If EndBit is greater than 7, then ASSERT().
1425 If EndBit is less than StartBit, then ASSERT().
1426 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1427 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1429 @param Address MMIO register to write.
1430 @param StartBit The ordinal of the least significant bit in the bit field.
1432 @param EndBit The ordinal of the most significant bit in the bit field.
1434 @param AndData The value to AND with read value from the MMIO register.
1435 @param OrData The value to OR with the result of the AND operation.
1437 @return The value written back to the MMIO register.
1442 MmioBitFieldAndThenOr8 (
1452 BitFieldAndThenOr8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1457 Reads a 16-bit MMIO register, performs a bitwise OR, and writes the
1458 result back to the 16-bit MMIO register.
1460 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1461 inclusive OR between the read result and the value specified by OrData, and
1462 writes the result to the 16-bit MMIO register specified by Address. The value
1463 written to the MMIO register is returned. This function must guarantee that
1464 all MMIO read and write operations are serialized.
1466 If 16-bit MMIO register operations are not supported, then ASSERT().
1468 @param Address The MMIO register to write.
1469 @param OrData The value to OR with the read value from the MMIO register.
1471 @return The value written back to the MMIO register.
1481 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) | OrData
));
1485 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1486 back to the 16-bit MMIO register.
1488 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1489 between the read result and the value specified by AndData, and writes the
1490 result to the 16-bit MMIO register specified by Address. The value written to
1491 the MMIO register is returned. This function must guarantee that all MMIO
1492 read and write operations are serialized.
1494 If 16-bit MMIO register operations are not supported, then ASSERT().
1496 @param Address The MMIO register to write.
1497 @param AndData The value to AND with the read value from the MMIO register.
1499 @return The value written back to the MMIO register.
1509 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) & AndData
));
1513 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1514 inclusive OR, and writes the result back to the 16-bit MMIO register.
1516 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1517 between the read result and the value specified by AndData, performs a
1518 bitwise OR between the result of the AND operation and the value specified by
1519 OrData, and writes the result to the 16-bit MMIO register specified by
1520 Address. The value written to the MMIO register is returned. This function
1521 must guarantee that all MMIO read and write operations are serialized.
1523 If 16-bit MMIO register operations are not supported, then ASSERT().
1526 @param Address The MMIO register to write.
1527 @param AndData The value to AND with the read value from the MMIO register.
1528 @param OrData The value to OR with the result of the AND operation.
1530 @return The value written back to the MMIO register.
1541 return MmioWrite16 (Address
, (UINT16
) ((MmioRead16 (Address
) & AndData
) | OrData
));
1545 Reads a bit field of a MMIO register.
1547 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
1548 the StartBit and the EndBit. The value of the bit field is returned.
1550 If 16-bit MMIO register operations are not supported, then ASSERT().
1551 If StartBit is greater than 15, then ASSERT().
1552 If EndBit is greater than 15, then ASSERT().
1553 If EndBit is less than StartBit, then ASSERT().
1555 @param Address MMIO register to read.
1556 @param StartBit The ordinal of the least significant bit in the bit field.
1558 @param EndBit The ordinal of the most significant bit in the bit field.
1561 @return The value read.
1566 MmioBitFieldRead16 (
1572 return BitFieldRead16 (MmioRead16 (Address
), StartBit
, EndBit
);
1576 Writes a bit field to a MMIO register.
1578 Writes Value to the bit field of the MMIO register. The bit field is
1579 specified by the StartBit and the EndBit. All other bits in the destination
1580 MMIO register are preserved. The new value of the 16-bit register is returned.
1582 If 16-bit MMIO register operations are not supported, then ASSERT().
1583 If StartBit is greater than 15, then ASSERT().
1584 If EndBit is greater than 15, then ASSERT().
1585 If EndBit is less than StartBit, then ASSERT().
1586 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1588 @param Address MMIO register to write.
1589 @param StartBit The ordinal of the least significant bit in the bit field.
1591 @param EndBit The ordinal of the most significant bit in the bit field.
1593 @param Value New value of the bit field.
1595 @return The value written back to the MMIO register.
1600 MmioBitFieldWrite16 (
1607 return MmioWrite16 (
1609 BitFieldWrite16 (MmioRead16 (Address
), StartBit
, EndBit
, Value
)
1614 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
1615 writes the result back to the bit field in the 16-bit MMIO register.
1617 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1618 inclusive OR between the read result and the value specified by OrData, and
1619 writes the result to the 16-bit MMIO register specified by Address. The value
1620 written to the MMIO register is returned. This function must guarantee that
1621 all MMIO read and write operations are serialized. Extra left bits in OrData
1624 If 16-bit MMIO register operations are not supported, then ASSERT().
1625 If StartBit is greater than 15, then ASSERT().
1626 If EndBit is greater than 15, then ASSERT().
1627 If EndBit is less than StartBit, then ASSERT().
1628 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1630 @param Address MMIO register to write.
1631 @param StartBit The ordinal of the least significant bit in the bit field.
1633 @param EndBit The ordinal of the most significant bit in the bit field.
1635 @param OrData The value to OR with read value from the MMIO register.
1637 @return The value written back to the MMIO register.
1649 return MmioWrite16 (
1651 BitFieldOr16 (MmioRead16 (Address
), StartBit
, EndBit
, OrData
)
1656 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
1657 writes the result back to the bit field in the 16-bit MMIO register.
1659 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1660 between the read result and the value specified by AndData, and writes the
1661 result to the 16-bit MMIO register specified by Address. The value written to
1662 the MMIO register is returned. This function must guarantee that all MMIO
1663 read and write operations are serialized. Extra left bits in AndData are
1666 If 16-bit MMIO register operations are not supported, then ASSERT().
1667 If StartBit is greater than 15, then ASSERT().
1668 If EndBit is greater than 15, then ASSERT().
1669 If EndBit is less than StartBit, then ASSERT().
1670 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1672 @param Address MMIO register to write.
1673 @param StartBit The ordinal of the least significant bit in the bit field.
1675 @param EndBit The ordinal of the most significant bit in the bit field.
1677 @param AndData The value to AND with read value from the MMIO register.
1679 @return The value written back to the MMIO register.
1691 return MmioWrite16 (
1693 BitFieldAnd16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
)
1698 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
1699 by a bitwise OR, and writes the result back to the bit field in the
1700 16-bit MMIO register.
1702 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1703 followed by a bitwise OR between the read result and the value
1704 specified by AndData, and writes the result to the 16-bit MMIO register
1705 specified by Address. The value written to the MMIO register is returned.
1706 This function must guarantee that all MMIO read and write operations are
1707 serialized. Extra left bits in both AndData and OrData are stripped.
1709 If 16-bit MMIO register operations are not supported, then ASSERT().
1710 If StartBit is greater than 15, then ASSERT().
1711 If EndBit is greater than 15, then ASSERT().
1712 If EndBit is less than StartBit, then ASSERT().
1713 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1714 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1716 @param Address MMIO register to write.
1717 @param StartBit The ordinal of the least significant bit in the bit field.
1719 @param EndBit The ordinal of the most significant bit in the bit field.
1721 @param AndData The value to AND with read value from the MMIO register.
1722 @param OrData The value to OR with the result of the AND operation.
1724 @return The value written back to the MMIO register.
1729 MmioBitFieldAndThenOr16 (
1737 return MmioWrite16 (
1739 BitFieldAndThenOr16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1744 Reads a 32-bit MMIO register, performs a bitwise OR, and writes the
1745 result back to the 32-bit MMIO register.
1747 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1748 inclusive OR between the read result and the value specified by OrData, and
1749 writes the result to the 32-bit MMIO register specified by Address. The value
1750 written to the MMIO register is returned. This function must guarantee that
1751 all MMIO read and write operations are serialized.
1753 If 32-bit MMIO register operations are not supported, then ASSERT().
1755 @param Address The MMIO register to write.
1756 @param OrData The value to OR with the read value from the MMIO register.
1758 @return The value written back to the MMIO register.
1768 return MmioWrite32 (Address
, MmioRead32 (Address
) | OrData
);
1772 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
1773 back to the 32-bit MMIO register.
1775 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1776 between the read result and the value specified by AndData, and writes the
1777 result to the 32-bit MMIO register specified by Address. The value written to
1778 the MMIO register is returned. This function must guarantee that all MMIO
1779 read and write operations are serialized.
1781 If 32-bit MMIO register operations are not supported, then ASSERT().
1783 @param Address The MMIO register to write.
1784 @param AndData The value to AND with the read value from the MMIO register.
1786 @return The value written back to the MMIO register.
1796 return MmioWrite32 (Address
, MmioRead32 (Address
) & AndData
);
1800 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
1801 inclusive OR, and writes the result back to the 32-bit MMIO register.
1803 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1804 between the read result and the value specified by AndData, performs a
1805 bitwise OR between the result of the AND operation and the value specified by
1806 OrData, and writes the result to the 32-bit MMIO register specified by
1807 Address. The value written to the MMIO register is returned. This function
1808 must guarantee that all MMIO read and write operations are serialized.
1810 If 32-bit MMIO register operations are not supported, then ASSERT().
1813 @param Address The MMIO register to write.
1814 @param AndData The value to AND with the read value from the MMIO register.
1815 @param OrData The value to OR with the result of the AND operation.
1817 @return The value written back to the MMIO register.
1828 return MmioWrite32 (Address
, (MmioRead32 (Address
) & AndData
) | OrData
);
1832 Reads a bit field of a MMIO register.
1834 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
1835 the StartBit and the EndBit. The value of the bit field is returned.
1837 If 32-bit MMIO register operations are not supported, then ASSERT().
1838 If StartBit is greater than 31, then ASSERT().
1839 If EndBit is greater than 31, then ASSERT().
1840 If EndBit is less than StartBit, then ASSERT().
1842 @param Address MMIO register to read.
1843 @param StartBit The ordinal of the least significant bit in the bit field.
1845 @param EndBit The ordinal of the most significant bit in the bit field.
1848 @return The value read.
1853 MmioBitFieldRead32 (
1859 return BitFieldRead32 (MmioRead32 (Address
), StartBit
, EndBit
);
1863 Writes a bit field to a MMIO register.
1865 Writes Value to the bit field of the MMIO register. The bit field is
1866 specified by the StartBit and the EndBit. All other bits in the destination
1867 MMIO register are preserved. The new value of the 32-bit register is returned.
1869 If 32-bit MMIO register operations are not supported, then ASSERT().
1870 If StartBit is greater than 31, then ASSERT().
1871 If EndBit is greater than 31, then ASSERT().
1872 If EndBit is less than StartBit, then ASSERT().
1873 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1875 @param Address MMIO register to write.
1876 @param StartBit The ordinal of the least significant bit in the bit field.
1878 @param EndBit The ordinal of the most significant bit in the bit field.
1880 @param Value New value of the bit field.
1882 @return The value written back to the MMIO register.
1887 MmioBitFieldWrite32 (
1894 return MmioWrite32 (
1896 BitFieldWrite32 (MmioRead32 (Address
), StartBit
, EndBit
, Value
)
1901 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
1902 writes the result back to the bit field in the 32-bit MMIO register.
1904 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1905 inclusive OR between the read result and the value specified by OrData, and
1906 writes the result to the 32-bit MMIO register specified by Address. The value
1907 written to the MMIO register is returned. This function must guarantee that
1908 all MMIO read and write operations are serialized. Extra left bits in OrData
1911 If 32-bit MMIO register operations are not supported, then ASSERT().
1912 If StartBit is greater than 31, then ASSERT().
1913 If EndBit is greater than 31, then ASSERT().
1914 If EndBit is less than StartBit, then ASSERT().
1915 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1917 @param Address MMIO register to write.
1918 @param StartBit The ordinal of the least significant bit in the bit field.
1920 @param EndBit The ordinal of the most significant bit in the bit field.
1922 @param OrData The value to OR with read value from the MMIO register.
1924 @return The value written back to the MMIO register.
1936 return MmioWrite32 (
1938 BitFieldOr32 (MmioRead32 (Address
), StartBit
, EndBit
, OrData
)
1943 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
1944 writes the result back to the bit field in the 32-bit MMIO register.
1946 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1947 between the read result and the value specified by AndData, and writes the
1948 result to the 32-bit MMIO register specified by Address. The value written to
1949 the MMIO register is returned. This function must guarantee that all MMIO
1950 read and write operations are serialized. Extra left bits in AndData are
1953 If 32-bit MMIO register operations are not supported, then ASSERT().
1954 If StartBit is greater than 31, then ASSERT().
1955 If EndBit is greater than 31, then ASSERT().
1956 If EndBit is less than StartBit, then ASSERT().
1957 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1959 @param Address MMIO register to write.
1960 @param StartBit The ordinal of the least significant bit in the bit field.
1962 @param EndBit The ordinal of the most significant bit in the bit field.
1964 @param AndData The value to AND with read value from the MMIO register.
1966 @return The value written back to the MMIO register.
1978 return MmioWrite32 (
1980 BitFieldAnd32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
)
1985 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
1986 by a bitwise OR, and writes the result back to the bit field in the
1987 32-bit MMIO register.
1989 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1990 followed by a bitwise OR between the read result and the value
1991 specified by AndData, and writes the result to the 32-bit MMIO register
1992 specified by Address. The value written to the MMIO register is returned.
1993 This function must guarantee that all MMIO read and write operations are
1994 serialized. Extra left bits in both AndData and OrData are stripped.
1996 If 32-bit MMIO register operations are not supported, then ASSERT().
1997 If StartBit is greater than 31, then ASSERT().
1998 If EndBit is greater than 31, then ASSERT().
1999 If EndBit is less than StartBit, then ASSERT().
2000 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2001 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2003 @param Address MMIO register to write.
2004 @param StartBit The ordinal of the least significant bit in the bit field.
2006 @param EndBit The ordinal of the most significant bit in the bit field.
2008 @param AndData The value to AND with read value from the MMIO register.
2009 @param OrData The value to OR with the result of the AND operation.
2011 @return The value written back to the MMIO register.
2016 MmioBitFieldAndThenOr32 (
2024 return MmioWrite32 (
2026 BitFieldAndThenOr32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
, OrData
)
2031 Reads a 64-bit MMIO register, performs a bitwise OR, and writes the
2032 result back to the 64-bit MMIO register.
2034 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2035 inclusive OR between the read result and the value specified by OrData, and
2036 writes the result to the 64-bit MMIO register specified by Address. The value
2037 written to the MMIO register is returned. This function must guarantee that
2038 all MMIO read and write operations are serialized.
2040 If 64-bit MMIO register operations are not supported, then ASSERT().
2042 @param Address The MMIO register to write.
2043 @param OrData The value to OR with the read value from the MMIO register.
2045 @return The value written back to the MMIO register.
2055 return MmioWrite64 (Address
, MmioRead64 (Address
) | OrData
);
2059 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2060 back to the 64-bit MMIO register.
2062 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2063 between the read result and the value specified by AndData, and writes the
2064 result to the 64-bit MMIO register specified by Address. The value written to
2065 the MMIO register is returned. This function must guarantee that all MMIO
2066 read and write operations are serialized.
2068 If 64-bit MMIO register operations are not supported, then ASSERT().
2070 @param Address The MMIO register to write.
2071 @param AndData The value to AND with the read value from the MMIO register.
2073 @return The value written back to the MMIO register.
2083 return MmioWrite64 (Address
, MmioRead64 (Address
) & AndData
);
2087 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2088 inclusive OR, and writes the result 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, performs a
2092 bitwise OR between the result of the AND operation and the value specified by
2093 OrData, and writes the result to the 64-bit MMIO register specified by
2094 Address. The value written to the MMIO register is returned. This function
2095 must guarantee that all MMIO read and write operations are serialized.
2097 If 64-bit MMIO register operations are not supported, then ASSERT().
2100 @param Address The MMIO register to write.
2101 @param AndData The value to AND with the read value from the MMIO register.
2102 @param OrData The value to OR with the result of the AND operation.
2104 @return The value written back to the MMIO register.
2115 return MmioWrite64 (Address
, (MmioRead64 (Address
) & AndData
) | OrData
);
2119 Reads a bit field of a MMIO register.
2121 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2122 the StartBit and the EndBit. The value of the bit field is returned.
2124 If 64-bit MMIO register operations are not supported, then ASSERT().
2125 If StartBit is greater than 63, then ASSERT().
2126 If EndBit is greater than 63, then ASSERT().
2127 If EndBit is less than StartBit, then ASSERT().
2129 @param Address MMIO register to read.
2130 @param StartBit The ordinal of the least significant bit in the bit field.
2132 @param EndBit The ordinal of the most significant bit in the bit field.
2135 @return The value read.
2140 MmioBitFieldRead64 (
2146 return BitFieldRead64 (MmioRead64 (Address
), StartBit
, EndBit
);
2150 Writes a bit field to a MMIO register.
2152 Writes Value to the bit field of the MMIO register. The bit field is
2153 specified by the StartBit and the EndBit. All other bits in the destination
2154 MMIO register are preserved. The new value of the 64-bit register is returned.
2156 If 64-bit MMIO register operations are not supported, then ASSERT().
2157 If StartBit is greater than 63, then ASSERT().
2158 If EndBit is greater than 63, then ASSERT().
2159 If EndBit is less than StartBit, then ASSERT().
2160 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2162 @param Address MMIO register to write.
2163 @param StartBit The ordinal of the least significant bit in the bit field.
2165 @param EndBit The ordinal of the most significant bit in the bit field.
2167 @param Value New value of the bit field.
2169 @return The value written back to the MMIO register.
2174 MmioBitFieldWrite64 (
2181 return MmioWrite64 (
2183 BitFieldWrite64 (MmioRead64 (Address
), StartBit
, EndBit
, Value
)
2188 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2189 writes the result back to the bit field in the 64-bit MMIO register.
2191 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2192 inclusive OR between the read result and the value specified by OrData, and
2193 writes the result to the 64-bit MMIO register specified by Address. The value
2194 written to the MMIO register is returned. This function must guarantee that
2195 all MMIO read and write operations are serialized. Extra left bits in OrData
2198 If 64-bit MMIO register operations are not supported, then ASSERT().
2199 If StartBit is greater than 63, then ASSERT().
2200 If EndBit is greater than 63, then ASSERT().
2201 If EndBit is less than StartBit, then ASSERT().
2202 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2204 @param Address MMIO register to write.
2205 @param StartBit The ordinal of the least significant bit in the bit field.
2207 @param EndBit The ordinal of the most significant bit in the bit field.
2209 @param OrData The value to OR with read value from the MMIO register.
2211 @return The value written back to the MMIO register.
2223 return MmioWrite64 (
2225 BitFieldOr64 (MmioRead64 (Address
), StartBit
, EndBit
, OrData
)
2230 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2231 writes the result back to the bit field in the 64-bit MMIO register.
2233 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2234 between the read result and the value specified by AndData, and writes the
2235 result to the 64-bit MMIO register specified by Address. The value written to
2236 the MMIO register is returned. This function must guarantee that all MMIO
2237 read and write operations are serialized. Extra left bits in AndData are
2240 If 64-bit MMIO register operations are not supported, then ASSERT().
2241 If StartBit is greater than 63, then ASSERT().
2242 If EndBit is greater than 63, then ASSERT().
2243 If EndBit is less than StartBit, then ASSERT().
2244 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2246 @param Address MMIO register to write.
2247 @param StartBit The ordinal of the least significant bit in the bit field.
2249 @param EndBit The ordinal of the most significant bit in the bit field.
2251 @param AndData The value to AND with read value from the MMIO register.
2253 @return The value written back to the MMIO register.
2265 return MmioWrite64 (
2267 BitFieldAnd64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
)
2272 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2273 by a bitwise OR, and writes the result back to the bit field in the
2274 64-bit MMIO register.
2276 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2277 followed by a bitwise OR between the read result and the value
2278 specified by AndData, and writes the result to the 64-bit MMIO register
2279 specified by Address. The value written to the MMIO register is returned.
2280 This function must guarantee that all MMIO read and write operations are
2281 serialized. Extra left bits in both AndData and OrData are stripped.
2283 If 64-bit MMIO register operations are not supported, then ASSERT().
2284 If StartBit is greater than 63, then ASSERT().
2285 If EndBit is greater than 63, then ASSERT().
2286 If EndBit is less than StartBit, then ASSERT().
2287 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2288 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2290 @param Address MMIO register to write.
2291 @param StartBit The ordinal of the least significant bit in the bit field.
2293 @param EndBit The ordinal of the most significant bit in the bit field.
2295 @param AndData The value to AND with read value from the MMIO register.
2296 @param OrData The value to OR with the result of the AND operation.
2298 @return The value written back to the MMIO register.
2303 MmioBitFieldAndThenOr64 (
2311 return MmioWrite64 (
2313 BitFieldAndThenOr64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
, OrData
)