]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/DxeIoLibCpuIo2/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) 2010, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials are licensed and made available
9 under the terms and conditions of the BSD License which accompanies this
10 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.
19 #include "DxeCpuIo2LibInternal.h"
22 Reads an 8-bit I/O port, performs a bitwise OR, and writes the
23 result back to the 8-bit I/O port.
25 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
26 between the read result and the value specified by OrData, and writes the
27 result to the 8-bit I/O port specified by Port. The value written to the I/O
28 port is returned. This function must guarantee that all I/O read and write
29 operations are serialized.
31 If 8-bit I/O port operations are not supported, then ASSERT().
33 @param Port The I/O port to write.
34 @param OrData The value to OR with the read value from the I/O port.
36 @return The value written back to the I/O port.
46 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) | OrData
));
50 Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
51 to the 8-bit I/O port.
53 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
54 the read result and the value specified by AndData, and writes the result to
55 the 8-bit I/O port specified by Port. The value written to the I/O port is
56 returned. This function must guarantee that all I/O read and write operations
59 If 8-bit I/O port operations are not supported, then ASSERT().
61 @param Port The I/O port to write.
62 @param AndData The value to AND with the read value from the I/O port.
64 @return The value written back to the I/O port.
74 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) & AndData
));
78 Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
79 inclusive OR, and writes the result back to the 8-bit I/O port.
81 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
82 the read result and the value specified by AndData, performs a bitwise OR
83 between the result of the AND operation and the value specified by OrData,
84 and writes the result to the 8-bit I/O port specified by Port. The value
85 written to the I/O port is returned. This function must guarantee that all
86 I/O read and write operations are serialized.
88 If 8-bit I/O port operations are not supported, then ASSERT().
90 @param Port The I/O port to write.
91 @param AndData The value to AND with the read value from the I/O port.
92 @param OrData The value to OR with the result of the AND operation.
94 @return The value written back to the I/O port.
105 return IoWrite8 (Port
, (UINT8
) ((IoRead8 (Port
) & AndData
) | OrData
));
109 Reads a bit field of an I/O register.
111 Reads the bit field in an 8-bit I/O register. The bit field is specified by
112 the StartBit and the EndBit. The value of the bit field is returned.
114 If 8-bit I/O port operations are not supported, then ASSERT().
115 If StartBit is greater than 7, then ASSERT().
116 If EndBit is greater than 7, then ASSERT().
117 If EndBit is less than StartBit, then ASSERT().
119 @param Port The I/O port to read.
120 @param StartBit The ordinal of the least significant bit in the bit field.
122 @param EndBit The ordinal of the most significant bit in the bit field.
125 @return The value read.
136 return BitFieldRead8 (IoRead8 (Port
), StartBit
, EndBit
);
140 Writes a bit field to an I/O register.
142 Writes Value to the bit field of the I/O register. The bit field is specified
143 by the StartBit and the EndBit. All other bits in the destination I/O
144 register are preserved. The value written to the I/O port is returned. Extra
145 left bits in Value are stripped.
147 If 8-bit I/O port operations are not supported, then ASSERT().
148 If StartBit is greater than 7, then ASSERT().
149 If EndBit is greater than 7, then ASSERT().
150 If EndBit is less than StartBit, then ASSERT().
152 @param Port The I/O port to write.
153 @param StartBit The ordinal of the least significant bit in the bit field.
155 @param EndBit The ordinal of the most significant bit in the bit field.
157 @param Value New value of the bit field.
159 @return The value written back to the I/O port.
173 BitFieldWrite8 (IoRead8 (Port
), StartBit
, EndBit
, Value
)
178 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
179 result back to the bit field in the 8-bit port.
181 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
182 between the read result and the value specified by OrData, and writes the
183 result to the 8-bit I/O port specified by Port. The value written to the I/O
184 port is returned. This function must guarantee that all I/O read and write
185 operations are serialized. Extra left bits in OrData are stripped.
187 If 8-bit I/O port operations are not supported, then ASSERT().
188 If StartBit is greater than 7, then ASSERT().
189 If EndBit is greater than 7, then ASSERT().
190 If EndBit is less than StartBit, then ASSERT().
192 @param Port The I/O port to write.
193 @param StartBit The ordinal of the least significant bit in the bit field.
195 @param EndBit The ordinal of the most significant bit in the bit field.
197 @param OrData The value to OR with the read value from the I/O port.
199 @return The value written back to the I/O port.
213 BitFieldOr8 (IoRead8 (Port
), StartBit
, EndBit
, OrData
)
218 Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
219 result back to the bit field in the 8-bit port.
221 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
222 the read result and the value specified by AndData, and writes the result to
223 the 8-bit I/O port specified by Port. The value written to the I/O port is
224 returned. This function must guarantee that all I/O read and write operations
225 are serialized. Extra left bits in AndData are stripped.
227 If 8-bit I/O port operations are not supported, then ASSERT().
228 If StartBit is greater than 7, then ASSERT().
229 If EndBit is greater than 7, then ASSERT().
230 If EndBit is less than StartBit, 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().
274 @param Port The I/O port to write.
275 @param StartBit The ordinal of the least significant bit in the bit field.
277 @param EndBit The ordinal of the most significant bit in the bit field.
279 @param AndData The value to AND with the read value from the I/O port.
280 @param OrData The value to OR with the result of the AND operation.
282 @return The value written back to the I/O port.
287 IoBitFieldAndThenOr8 (
297 BitFieldAndThenOr8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
, OrData
)
302 Reads a 16-bit I/O port, performs a bitwise OR, and writes the
303 result back to the 16-bit I/O port.
305 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
306 between the read result and the value specified by OrData, and writes the
307 result to the 16-bit I/O port specified by Port. The value written to the I/O
308 port is returned. This function must guarantee that all I/O read and write
309 operations are serialized.
311 If 16-bit I/O port operations are not supported, then ASSERT().
313 @param Port The I/O port to write.
314 @param OrData The value to OR with the read value from the I/O port.
316 @return The value written back to the I/O port.
326 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) | OrData
));
330 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
331 to the 16-bit I/O port.
333 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
334 the read result and the value specified by AndData, and writes the result to
335 the 16-bit I/O port specified by Port. The value written to the I/O port is
336 returned. This function must guarantee that all I/O read and write operations
339 If 16-bit I/O port operations are not supported, then ASSERT().
341 @param Port The I/O port to write.
342 @param AndData The value to AND with the read value from the I/O port.
344 @return The value written back to the I/O port.
354 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) & AndData
));
358 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
359 inclusive OR, and writes the result back to the 16-bit I/O port.
361 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
362 the read result and the value specified by AndData, performs a bitwise OR
363 between the result of the AND operation and the value specified by OrData,
364 and writes the result to the 16-bit I/O port specified by Port. The value
365 written to the I/O port is returned. This function must guarantee that all
366 I/O read and write operations are serialized.
368 If 16-bit I/O port operations are not supported, then ASSERT().
370 @param Port The I/O port to write.
371 @param AndData The value to AND with the read value from the I/O port.
372 @param OrData The value to OR with the result of the AND operation.
374 @return The value written back to the I/O port.
385 return IoWrite16 (Port
, (UINT16
) ((IoRead16 (Port
) & AndData
) | OrData
));
389 Reads a bit field of an I/O register.
391 Reads the bit field in a 16-bit I/O register. The bit field is specified by
392 the StartBit and the EndBit. The value of the bit field is returned.
394 If 16-bit I/O port operations are not supported, then ASSERT().
395 If StartBit is greater than 15, then ASSERT().
396 If EndBit is greater than 15, then ASSERT().
397 If EndBit is less than StartBit, then ASSERT().
399 @param Port The I/O port to read.
400 @param StartBit The ordinal of the least significant bit in the bit field.
402 @param EndBit The ordinal of the most significant bit in the bit field.
405 @return The value read.
416 return BitFieldRead16 (IoRead16 (Port
), StartBit
, EndBit
);
420 Writes a bit field to an I/O register.
422 Writes Value to the bit field of the I/O register. The bit field is specified
423 by the StartBit and the EndBit. All other bits in the destination I/O
424 register are preserved. The value written to the I/O port is returned. Extra
425 left bits in Value are stripped.
427 If 16-bit I/O port operations are not supported, then ASSERT().
428 If StartBit is greater than 15, then ASSERT().
429 If EndBit is greater than 15, then ASSERT().
430 If EndBit is less than StartBit, then ASSERT().
432 @param Port The I/O port to write.
433 @param StartBit The ordinal of the least significant bit in the bit field.
435 @param EndBit The ordinal of the most significant bit in the bit field.
437 @param Value New value of the bit field.
439 @return The value written back to the I/O port.
453 BitFieldWrite16 (IoRead16 (Port
), StartBit
, EndBit
, Value
)
458 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
459 result back to the bit field in the 16-bit port.
461 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
462 between the read result and the value specified by OrData, and writes the
463 result to the 16-bit I/O port specified by Port. The value written to the I/O
464 port is returned. This function must guarantee that all I/O read and write
465 operations are serialized. Extra left bits in OrData are stripped.
467 If 16-bit I/O port operations are not supported, then ASSERT().
468 If StartBit is greater than 15, then ASSERT().
469 If EndBit is greater than 15, then ASSERT().
470 If EndBit is less than StartBit, then ASSERT().
472 @param Port The I/O port to write.
473 @param StartBit The ordinal of the least significant bit in the bit field.
475 @param EndBit The ordinal of the most significant bit in the bit field.
477 @param OrData The value to OR with the read value from the I/O port.
479 @return The value written back to the I/O port.
493 BitFieldOr16 (IoRead16 (Port
), StartBit
, EndBit
, OrData
)
498 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
499 result back to the bit field in the 16-bit port.
501 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
502 the read result and the value specified by AndData, and writes the result to
503 the 16-bit I/O port specified by Port. The value written to the I/O port is
504 returned. This function must guarantee that all I/O read and write operations
505 are serialized. Extra left bits in AndData are stripped.
507 If 16-bit I/O port operations are not supported, then ASSERT().
508 If StartBit is greater than 15, then ASSERT().
509 If EndBit is greater than 15, then ASSERT().
510 If EndBit is less than StartBit, then ASSERT().
512 @param Port The I/O port to write.
513 @param StartBit The ordinal of the least significant bit in the bit field.
515 @param EndBit The ordinal of the most significant bit in the bit field.
517 @param AndData The value to AND with the read value from the I/O port.
519 @return The value written back to the I/O port.
533 BitFieldAnd16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
)
538 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
539 bitwise OR, and writes the result back to the bit field in the
542 Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
543 by a bitwise OR between the read result and the value specified by
544 AndData, and writes the result to the 16-bit I/O port specified by Port. The
545 value written to the I/O port is returned. This function must guarantee that
546 all I/O read and write operations are serialized. Extra left bits in both
547 AndData and OrData are stripped.
549 If 16-bit I/O port operations are not supported, then ASSERT().
550 If StartBit is greater than 15, then ASSERT().
551 If EndBit is greater than 15, then ASSERT().
552 If EndBit is less than StartBit, then ASSERT().
554 @param Port The I/O port to write.
555 @param StartBit The ordinal of the least significant bit in the bit field.
557 @param EndBit The ordinal of the most significant bit in the bit field.
559 @param AndData The value to AND with the read value from the I/O port.
560 @param OrData The value to OR with the result of the AND operation.
562 @return The value written back to the I/O port.
567 IoBitFieldAndThenOr16 (
577 BitFieldAndThenOr16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
, OrData
)
582 Reads a 32-bit I/O port, performs a bitwise OR, and writes the
583 result back to the 32-bit I/O port.
585 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
586 between the read result and the value specified by OrData, and writes the
587 result to the 32-bit I/O port specified by Port. The value written to the I/O
588 port is returned. This function must guarantee that all I/O read and write
589 operations are serialized.
591 If 32-bit I/O port operations are not supported, then ASSERT().
593 @param Port The I/O port to write.
594 @param OrData The value to OR with the read value from the I/O port.
596 @return The value written back to the I/O port.
606 return IoWrite32 (Port
, IoRead32 (Port
) | OrData
);
610 Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
611 to the 32-bit I/O port.
613 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
614 the read result and the value specified by AndData, and writes the result to
615 the 32-bit I/O port specified by Port. The value written to the I/O port is
616 returned. This function must guarantee that all I/O read and write operations
619 If 32-bit I/O port operations are not supported, then ASSERT().
621 @param Port The I/O port to write.
622 @param AndData The value to AND with the read value from the I/O port.
624 @return The value written back to the I/O port.
634 return IoWrite32 (Port
, IoRead32 (Port
) & AndData
);
638 Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
639 inclusive OR, and writes the result back to the 32-bit I/O port.
641 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
642 the read result and the value specified by AndData, performs a bitwise OR
643 between the result of the AND operation and the value specified by OrData,
644 and writes the result to the 32-bit I/O port specified by Port. The value
645 written to the I/O port is returned. This function must guarantee that all
646 I/O read and write operations are serialized.
648 If 32-bit I/O port operations are not supported, then ASSERT().
650 @param Port The I/O port to write.
651 @param AndData The value to AND with the read value from the I/O port.
652 @param OrData The value to OR with the result of the AND operation.
654 @return The value written back to the I/O port.
665 return IoWrite32 (Port
, (IoRead32 (Port
) & AndData
) | OrData
);
669 Reads a bit field of an I/O register.
671 Reads the bit field in a 32-bit I/O register. The bit field is specified by
672 the StartBit and the EndBit. The value of the bit field is returned.
674 If 32-bit I/O port operations are not supported, then ASSERT().
675 If StartBit is greater than 31, then ASSERT().
676 If EndBit is greater than 31, then ASSERT().
677 If EndBit is less than StartBit, then ASSERT().
679 @param Port The I/O port to read.
680 @param StartBit The ordinal of the least significant bit in the bit field.
682 @param EndBit The ordinal of the most significant bit in the bit field.
685 @return The value read.
696 return BitFieldRead32 (IoRead32 (Port
), StartBit
, EndBit
);
700 Writes a bit field to an I/O register.
702 Writes Value to the bit field of the I/O register. The bit field is specified
703 by the StartBit and the EndBit. All other bits in the destination I/O
704 register are preserved. The value written to the I/O port is returned. Extra
705 left bits in Value are stripped.
707 If 32-bit I/O port operations are not supported, then ASSERT().
708 If StartBit is greater than 31, then ASSERT().
709 If EndBit is greater than 31, then ASSERT().
710 If EndBit is less than StartBit, then ASSERT().
712 @param Port The I/O port to write.
713 @param StartBit The ordinal of the least significant bit in the bit field.
715 @param EndBit The ordinal of the most significant bit in the bit field.
717 @param Value New value of the bit field.
719 @return The value written back to the I/O port.
733 BitFieldWrite32 (IoRead32 (Port
), StartBit
, EndBit
, Value
)
738 Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the
739 result back to the bit field in the 32-bit port.
741 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
742 between the read result and the value specified by OrData, and writes the
743 result to the 32-bit I/O port specified by Port. The value written to the I/O
744 port is returned. This function must guarantee that all I/O read and write
745 operations are serialized. Extra left bits in OrData are stripped.
747 If 32-bit I/O port operations are not supported, then ASSERT().
748 If StartBit is greater than 31, then ASSERT().
749 If EndBit is greater than 31, then ASSERT().
750 If EndBit is less than StartBit, then ASSERT().
752 @param Port The I/O port to write.
753 @param StartBit The ordinal of the least significant bit in the bit field.
755 @param EndBit The ordinal of the most significant bit in the bit field.
757 @param OrData The value to OR with the read value from the I/O port.
759 @return The value written back to the I/O port.
773 BitFieldOr32 (IoRead32 (Port
), StartBit
, EndBit
, OrData
)
778 Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
779 result back to the bit field in the 32-bit port.
781 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
782 the read result and the value specified by AndData, and writes the result to
783 the 32-bit I/O port specified by Port. The value written to the I/O port is
784 returned. This function must guarantee that all I/O read and write operations
785 are serialized. Extra left bits in AndData are stripped.
787 If 32-bit I/O port operations are not supported, then ASSERT().
788 If StartBit is greater than 31, then ASSERT().
789 If EndBit is greater than 31, then ASSERT().
790 If EndBit is less than StartBit, then ASSERT().
792 @param Port The I/O port to write.
793 @param StartBit The ordinal of the least significant bit in the bit field.
795 @param EndBit The ordinal of the most significant bit in the bit field.
797 @param AndData The value to AND with the read value from the I/O port.
799 @return The value written back to the I/O port.
813 BitFieldAnd32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
)
818 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
819 bitwise OR, and writes the result back to the bit field in the
822 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
823 by a bitwise OR between the read result and the value specified by
824 AndData, and writes the result to the 32-bit I/O port specified by Port. The
825 value written to the I/O port is returned. This function must guarantee that
826 all I/O read and write operations are serialized. Extra left bits in both
827 AndData and OrData are stripped.
829 If 32-bit I/O port operations are not supported, then ASSERT().
830 If StartBit is greater than 31, then ASSERT().
831 If EndBit is greater than 31, then ASSERT().
832 If EndBit is less than StartBit, then ASSERT().
834 @param Port The I/O port to write.
835 @param StartBit The ordinal of the least significant bit in the bit field.
837 @param EndBit The ordinal of the most significant bit in the bit field.
839 @param AndData The value to AND with the read value from the I/O port.
840 @param OrData The value to OR with the result of the AND operation.
842 @return The value written back to the I/O port.
847 IoBitFieldAndThenOr32 (
857 BitFieldAndThenOr32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
, OrData
)
862 Reads a 64-bit I/O port, performs a bitwise OR, and writes the
863 result back to the 64-bit I/O port.
865 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
866 between the read result and the value specified by OrData, and writes the
867 result to the 64-bit I/O port specified by Port. The value written to the I/O
868 port is returned. This function must guarantee that all I/O read and write
869 operations are serialized.
871 If 64-bit I/O port operations are not supported, then ASSERT().
873 @param Port The I/O port to write.
874 @param OrData The value to OR with the read value from the I/O port.
876 @return The value written back to the I/O port.
886 return IoWrite64 (Port
, IoRead64 (Port
) | OrData
);
890 Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
891 to the 64-bit I/O port.
893 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
894 the read result and the value specified by AndData, and writes the result to
895 the 64-bit I/O port specified by Port. The value written to the I/O port is
896 returned. This function must guarantee that all I/O read and write operations
899 If 64-bit I/O port operations are not supported, then ASSERT().
901 @param Port The I/O port to write.
902 @param AndData The value to AND with the read value from the I/O port.
904 @return The value written back to the I/O port.
914 return IoWrite64 (Port
, IoRead64 (Port
) & AndData
);
918 Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
919 inclusive OR, and writes the result back to the 64-bit I/O port.
921 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
922 the read result and the value specified by AndData, performs a bitwise OR
923 between the result of the AND operation and the value specified by OrData,
924 and writes the result to the 64-bit I/O port specified by Port. The value
925 written to the I/O port is returned. This function must guarantee that all
926 I/O read and write operations are serialized.
928 If 64-bit I/O port operations are not supported, then ASSERT().
930 @param Port The I/O port to write.
931 @param AndData The value to AND with the read value from the I/O port.
932 @param OrData The value to OR with the result of the AND operation.
934 @return The value written back to the I/O port.
945 return IoWrite64 (Port
, (IoRead64 (Port
) & AndData
) | OrData
);
949 Reads a bit field of an I/O register.
951 Reads the bit field in a 64-bit I/O register. The bit field is specified by
952 the StartBit and the EndBit. The value of the bit field is returned.
954 If 64-bit I/O port operations are not supported, then ASSERT().
955 If StartBit is greater than 63, then ASSERT().
956 If EndBit is greater than 63, then ASSERT().
957 If EndBit is less than StartBit, then ASSERT().
959 @param Port The I/O port to read.
960 @param StartBit The ordinal of the least significant bit in the bit field.
962 @param EndBit The ordinal of the most significant bit in the bit field.
965 @return The value read.
976 return BitFieldRead64 (IoRead64 (Port
), StartBit
, EndBit
);
980 Writes a bit field to an I/O register.
982 Writes Value to the bit field of the I/O register. The bit field is specified
983 by the StartBit and the EndBit. All other bits in the destination I/O
984 register are preserved. The value written to the I/O port is returned. Extra
985 left bits in Value are stripped.
987 If 64-bit I/O port operations are not supported, then ASSERT().
988 If StartBit is greater than 63, then ASSERT().
989 If EndBit is greater than 63, then ASSERT().
990 If EndBit is less than StartBit, then ASSERT().
992 @param Port The I/O port to write.
993 @param StartBit The ordinal of the least significant bit in the bit field.
995 @param EndBit The ordinal of the most significant bit in the bit field.
997 @param Value New value of the bit field.
999 @return The value written back to the I/O port.
1013 BitFieldWrite64 (IoRead64 (Port
), StartBit
, EndBit
, Value
)
1018 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1019 result back to the bit field in the 64-bit port.
1021 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
1022 between the read result and the value specified by OrData, and writes the
1023 result to the 64-bit I/O port specified by Port. The value written to the I/O
1024 port is returned. This function must guarantee that all I/O read and write
1025 operations are serialized. Extra left bits in OrData are stripped.
1027 If 64-bit I/O port operations are not supported, then ASSERT().
1028 If StartBit is greater than 63, then ASSERT().
1029 If EndBit is greater than 63, then ASSERT().
1030 If EndBit is less than StartBit, then ASSERT().
1032 @param Port The I/O port to write.
1033 @param StartBit The ordinal of the least significant bit in the bit field.
1035 @param EndBit The ordinal of the most significant bit in the bit field.
1037 @param OrData The value to OR with the read value from the I/O port.
1039 @return The value written back to the I/O port.
1053 BitFieldOr64 (IoRead64 (Port
), StartBit
, EndBit
, OrData
)
1058 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1059 result back to the bit field in the 64-bit port.
1061 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1062 the read result and the value specified by AndData, and writes the result to
1063 the 64-bit I/O port specified by Port. The value written to the I/O port is
1064 returned. This function must guarantee that all I/O read and write operations
1065 are serialized. Extra left bits in AndData are stripped.
1067 If 64-bit I/O port operations are not supported, then ASSERT().
1068 If StartBit is greater than 63, then ASSERT().
1069 If EndBit is greater than 63, then ASSERT().
1070 If EndBit is less than StartBit, then ASSERT().
1072 @param Port The I/O port to write.
1073 @param StartBit The ordinal of the least significant bit in the bit field.
1075 @param EndBit The ordinal of the most significant bit in the bit field.
1077 @param AndData The value to AND with the read value from the I/O port.
1079 @return The value written back to the I/O port.
1093 BitFieldAnd64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
)
1098 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
1099 bitwise OR, and writes the result back to the bit field in the
1102 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
1103 by a bitwise OR between the read result and the value specified by
1104 AndData, and writes the result to the 64-bit I/O port specified by Port. The
1105 value written to the I/O port is returned. This function must guarantee that
1106 all I/O read and write operations are serialized. Extra left bits in both
1107 AndData and OrData are stripped.
1109 If 64-bit I/O port operations are not supported, then ASSERT().
1110 If StartBit is greater than 63, then ASSERT().
1111 If EndBit is greater than 63, then ASSERT().
1112 If EndBit is less than StartBit, then ASSERT().
1114 @param Port The I/O port to write.
1115 @param StartBit The ordinal of the least significant bit in the bit field.
1117 @param EndBit The ordinal of the most significant bit in the bit field.
1119 @param AndData The value to AND with the read value from the I/O port.
1120 @param OrData The value to OR with the result of the AND operation.
1122 @return The value written back to the I/O port.
1127 IoBitFieldAndThenOr64 (
1137 BitFieldAndThenOr64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
, OrData
)
1142 Reads an 8-bit MMIO register, performs a bitwise OR, and writes the
1143 result back to the 8-bit MMIO register.
1145 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1146 inclusive OR between the read result and the value specified by OrData, and
1147 writes the result to the 8-bit MMIO register specified by Address. The value
1148 written to the MMIO register is returned. This function must guarantee that
1149 all MMIO read and write operations are serialized.
1151 If 8-bit MMIO register operations are not supported, then ASSERT().
1153 @param Address The MMIO register to write.
1154 @param OrData The value to OR with the read value from the MMIO register.
1156 @return The value written back to the MMIO register.
1166 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) | OrData
));
1170 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1171 back to the 8-bit MMIO register.
1173 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1174 between the read result and the value specified by AndData, and writes the
1175 result to the 8-bit MMIO register specified by Address. The value written to
1176 the MMIO register is returned. This function must guarantee that all MMIO
1177 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 AndData The value to AND 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
) & AndData
));
1198 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1199 inclusive OR, and writes the result 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, performs a
1203 bitwise OR between the result of the AND operation and the value specified by
1204 OrData, and writes the result to the 8-bit MMIO register specified by
1205 Address. The value written to the MMIO register is returned. This function
1206 must guarantee that all MMIO read and write operations are serialized.
1208 If 8-bit MMIO register operations are not supported, then ASSERT().
1211 @param Address The MMIO register to write.
1212 @param AndData The value to AND with the read value from the MMIO register.
1213 @param OrData The value to OR with the result of the AND operation.
1215 @return The value written back to the MMIO register.
1226 return MmioWrite8 (Address
, (UINT8
) ((MmioRead8 (Address
) & AndData
) | OrData
));
1230 Reads a bit field of a MMIO register.
1232 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1233 the StartBit and the EndBit. The value of the bit field is returned.
1235 If 8-bit MMIO register operations are not supported, then ASSERT().
1236 If StartBit is greater than 7, then ASSERT().
1237 If EndBit is greater than 7, then ASSERT().
1238 If EndBit is less than StartBit, then ASSERT().
1240 @param Address MMIO register to read.
1241 @param StartBit The ordinal of the least significant bit in the bit field.
1243 @param EndBit The ordinal of the most significant bit in the bit field.
1246 @return The value read.
1257 return BitFieldRead8 (MmioRead8 (Address
), StartBit
, EndBit
);
1261 Writes a bit field to a MMIO register.
1263 Writes Value to the bit field of the MMIO register. The bit field is
1264 specified by the StartBit and the EndBit. All other bits in the destination
1265 MMIO register are preserved. The new value of the 8-bit register is returned.
1267 If 8-bit MMIO register operations are not supported, then ASSERT().
1268 If StartBit is greater than 7, then ASSERT().
1269 If EndBit is greater than 7, then ASSERT().
1270 If EndBit is less than StartBit, then ASSERT().
1272 @param Address MMIO register to write.
1273 @param StartBit The ordinal of the least significant bit in the bit field.
1275 @param EndBit The ordinal of the most significant bit in the bit field.
1277 @param Value New value of the bit field.
1279 @return The value written back to the MMIO register.
1284 MmioBitFieldWrite8 (
1293 BitFieldWrite8 (MmioRead8 (Address
), StartBit
, EndBit
, Value
)
1298 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1299 writes the result back to the bit field in the 8-bit MMIO register.
1301 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1302 inclusive OR between the read result and the value specified by OrData, and
1303 writes the result to the 8-bit MMIO register specified by Address. The value
1304 written to the MMIO register is returned. This function must guarantee that
1305 all MMIO read and write operations are serialized. Extra left bits in OrData
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().
1313 @param Address MMIO register to write.
1314 @param StartBit The ordinal of the least significant bit in the bit field.
1316 @param EndBit The ordinal of the most significant bit in the bit field.
1318 @param OrData The value to OR with read value from the MMIO register.
1320 @return The value written back to the MMIO register.
1334 BitFieldOr8 (MmioRead8 (Address
), StartBit
, EndBit
, OrData
)
1339 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1340 writes the result back to the bit field in the 8-bit MMIO register.
1342 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1343 between the read result and the value specified by AndData, and writes the
1344 result to the 8-bit MMIO register specified by Address. The value written to
1345 the MMIO register is returned. This function must guarantee that all MMIO
1346 read and write operations are serialized. Extra left bits in AndData are
1349 If 8-bit MMIO register operations are not supported, then ASSERT().
1350 If StartBit is greater than 7, then ASSERT().
1351 If EndBit is greater than 7, then ASSERT().
1352 If EndBit is less than StartBit, then ASSERT().
1354 @param Address MMIO register to write.
1355 @param StartBit The ordinal of the least significant bit in the bit field.
1357 @param EndBit The ordinal of the most significant bit in the bit field.
1359 @param AndData The value to AND with read value from the MMIO register.
1361 @return The value written back to the MMIO register.
1375 BitFieldAnd8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
)
1380 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1381 by a bitwise OR, and writes the result back to the bit field in the
1382 8-bit MMIO register.
1384 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1385 followed by a bitwise OR between the read result and the value
1386 specified by AndData, and writes the result to the 8-bit MMIO register
1387 specified by Address. The value written to the MMIO register is returned.
1388 This function must guarantee that all MMIO read and write operations are
1389 serialized. Extra left bits in both AndData and OrData are stripped.
1391 If 8-bit MMIO register operations are not supported, then ASSERT().
1392 If StartBit is greater than 7, then ASSERT().
1393 If EndBit is greater than 7, then ASSERT().
1394 If EndBit is less than StartBit, then ASSERT().
1396 @param Address MMIO register to write.
1397 @param StartBit The ordinal of the least significant bit in the bit field.
1399 @param EndBit The ordinal of the most significant bit in the bit field.
1401 @param AndData The value to AND with read value from the MMIO register.
1402 @param OrData The value to OR with the result of the AND operation.
1404 @return The value written back to the MMIO register.
1409 MmioBitFieldAndThenOr8 (
1419 BitFieldAndThenOr8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1424 Reads a 16-bit MMIO register, performs a bitwise OR, and writes the
1425 result back to the 16-bit MMIO register.
1427 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1428 inclusive OR between the read result and the value specified by OrData, and
1429 writes the result to the 16-bit MMIO register specified by Address. The value
1430 written to the MMIO register is returned. This function must guarantee that
1431 all MMIO read and write operations are serialized.
1433 If 16-bit MMIO register operations are not supported, then ASSERT().
1435 @param Address The MMIO register to write.
1436 @param OrData The value to OR with the read value from the MMIO register.
1438 @return The value written back to the MMIO register.
1448 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) | OrData
));
1452 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1453 back to the 16-bit MMIO register.
1455 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1456 between the read result and the value specified by AndData, and writes the
1457 result to the 16-bit MMIO register specified by Address. The value written to
1458 the MMIO register is returned. This function must guarantee that all MMIO
1459 read and write operations are serialized.
1461 If 16-bit MMIO register operations are not supported, then ASSERT().
1463 @param Address The MMIO register to write.
1464 @param AndData The value to AND with the read value from the MMIO register.
1466 @return The value written back to the MMIO register.
1476 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) & AndData
));
1480 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1481 inclusive OR, and writes the result back to the 16-bit MMIO register.
1483 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1484 between the read result and the value specified by AndData, performs a
1485 bitwise OR between the result of the AND operation and the value specified by
1486 OrData, and writes the result to the 16-bit MMIO register specified by
1487 Address. The value written to the MMIO register is returned. This function
1488 must guarantee that all MMIO read and write operations are serialized.
1490 If 16-bit MMIO register operations are not supported, then ASSERT().
1493 @param Address The MMIO register to write.
1494 @param AndData The value to AND with the read value from the MMIO register.
1495 @param OrData The value to OR with the result of the AND operation.
1497 @return The value written back to the MMIO register.
1508 return MmioWrite16 (Address
, (UINT16
) ((MmioRead16 (Address
) & AndData
) | OrData
));
1512 Reads a bit field of a MMIO register.
1514 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
1515 the StartBit and the EndBit. The value of the bit field is returned.
1517 If 16-bit MMIO register operations are not supported, then ASSERT().
1518 If StartBit is greater than 15, then ASSERT().
1519 If EndBit is greater than 15, then ASSERT().
1520 If EndBit is less than StartBit, then ASSERT().
1522 @param Address MMIO register to read.
1523 @param StartBit The ordinal of the least significant bit in the bit field.
1525 @param EndBit The ordinal of the most significant bit in the bit field.
1528 @return The value read.
1533 MmioBitFieldRead16 (
1539 return BitFieldRead16 (MmioRead16 (Address
), StartBit
, EndBit
);
1543 Writes a bit field to a MMIO register.
1545 Writes Value to the bit field of the MMIO register. The bit field is
1546 specified by the StartBit and the EndBit. All other bits in the destination
1547 MMIO register are preserved. The new value of the 16-bit register is returned.
1549 If 16-bit MMIO register operations are not supported, then ASSERT().
1550 If StartBit is greater than 15, then ASSERT().
1551 If EndBit is greater than 15, then ASSERT().
1552 If EndBit is less than StartBit, then ASSERT().
1554 @param Address MMIO register to write.
1555 @param StartBit The ordinal of the least significant bit in the bit field.
1557 @param EndBit The ordinal of the most significant bit in the bit field.
1559 @param Value New value of the bit field.
1561 @return The value written back to the MMIO register.
1566 MmioBitFieldWrite16 (
1573 return MmioWrite16 (
1575 BitFieldWrite16 (MmioRead16 (Address
), StartBit
, EndBit
, Value
)
1580 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
1581 writes the result back to the bit field in the 16-bit MMIO register.
1583 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1584 inclusive OR between the read result and the value specified by OrData, and
1585 writes the result to the 16-bit MMIO register specified by Address. The value
1586 written to the MMIO register is returned. This function must guarantee that
1587 all MMIO read and write operations are serialized. Extra left bits in OrData
1590 If 16-bit MMIO register operations are not supported, then ASSERT().
1591 If StartBit is greater than 15, then ASSERT().
1592 If EndBit is greater than 15, then ASSERT().
1593 If EndBit is less than StartBit, then ASSERT().
1595 @param Address MMIO register to write.
1596 @param StartBit The ordinal of the least significant bit in the bit field.
1598 @param EndBit The ordinal of the most significant bit in the bit field.
1600 @param OrData The value to OR with read value from the MMIO register.
1602 @return The value written back to the MMIO register.
1614 return MmioWrite16 (
1616 BitFieldOr16 (MmioRead16 (Address
), StartBit
, EndBit
, OrData
)
1621 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
1622 writes the result back to the bit field in the 16-bit MMIO register.
1624 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1625 between the read result and the value specified by AndData, and writes the
1626 result to the 16-bit MMIO register specified by Address. The value written to
1627 the MMIO register is returned. This function must guarantee that all MMIO
1628 read and write operations are serialized. Extra left bits in AndData are
1631 If 16-bit MMIO register operations are not supported, then ASSERT().
1632 If StartBit is greater than 15, then ASSERT().
1633 If EndBit is greater than 15, then ASSERT().
1634 If EndBit is less than StartBit, then ASSERT().
1636 @param Address MMIO register to write.
1637 @param StartBit The ordinal of the least significant bit in the bit field.
1639 @param EndBit The ordinal of the most significant bit in the bit field.
1641 @param AndData The value to AND with read value from the MMIO register.
1643 @return The value written back to the MMIO register.
1655 return MmioWrite16 (
1657 BitFieldAnd16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
)
1662 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
1663 by a bitwise OR, and writes the result back to the bit field in the
1664 16-bit MMIO register.
1666 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1667 followed by a bitwise OR between the read result and the value
1668 specified by AndData, and writes the result to the 16-bit MMIO register
1669 specified by Address. The value written to the MMIO register is returned.
1670 This function must guarantee that all MMIO read and write operations are
1671 serialized. Extra left bits in both AndData and OrData are stripped.
1673 If 16-bit MMIO register operations are not supported, then ASSERT().
1674 If StartBit is greater than 15, then ASSERT().
1675 If EndBit is greater than 15, then ASSERT().
1676 If EndBit is less than StartBit, then ASSERT().
1678 @param Address MMIO register to write.
1679 @param StartBit The ordinal of the least significant bit in the bit field.
1681 @param EndBit The ordinal of the most significant bit in the bit field.
1683 @param AndData The value to AND with read value from the MMIO register.
1684 @param OrData The value to OR with the result of the AND operation.
1686 @return The value written back to the MMIO register.
1691 MmioBitFieldAndThenOr16 (
1699 return MmioWrite16 (
1701 BitFieldAndThenOr16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1706 Reads a 32-bit MMIO register, performs a bitwise OR, and writes the
1707 result back to the 32-bit MMIO register.
1709 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1710 inclusive OR between the read result and the value specified by OrData, and
1711 writes the result to the 32-bit MMIO register specified by Address. The value
1712 written to the MMIO register is returned. This function must guarantee that
1713 all MMIO read and write operations are serialized.
1715 If 32-bit MMIO register operations are not supported, then ASSERT().
1717 @param Address The MMIO register to write.
1718 @param OrData The value to OR with the read value from the MMIO register.
1720 @return The value written back to the MMIO register.
1730 return MmioWrite32 (Address
, MmioRead32 (Address
) | OrData
);
1734 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
1735 back to the 32-bit MMIO register.
1737 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1738 between the read result and the value specified by AndData, and writes the
1739 result to the 32-bit MMIO register specified by Address. The value written to
1740 the MMIO register is returned. This function must guarantee that all MMIO
1741 read and write operations are serialized.
1743 If 32-bit MMIO register operations are not supported, then ASSERT().
1745 @param Address The MMIO register to write.
1746 @param AndData The value to AND with the read value from the MMIO register.
1748 @return The value written back to the MMIO register.
1758 return MmioWrite32 (Address
, MmioRead32 (Address
) & AndData
);
1762 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
1763 inclusive OR, and writes the result back to the 32-bit MMIO register.
1765 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1766 between the read result and the value specified by AndData, performs a
1767 bitwise OR between the result of the AND operation and the value specified by
1768 OrData, and writes the result to the 32-bit MMIO register specified by
1769 Address. The value written to the MMIO register is returned. This function
1770 must guarantee that all MMIO read and write operations are serialized.
1772 If 32-bit MMIO register operations are not supported, then ASSERT().
1775 @param Address The MMIO register to write.
1776 @param AndData The value to AND with the read value from the MMIO register.
1777 @param OrData The value to OR with the result of the AND operation.
1779 @return The value written back to the MMIO register.
1790 return MmioWrite32 (Address
, (MmioRead32 (Address
) & AndData
) | OrData
);
1794 Reads a bit field of a MMIO register.
1796 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
1797 the StartBit and the EndBit. The value of the bit field is returned.
1799 If 32-bit MMIO register operations are not supported, then ASSERT().
1800 If StartBit is greater than 31, then ASSERT().
1801 If EndBit is greater than 31, then ASSERT().
1802 If EndBit is less than StartBit, then ASSERT().
1804 @param Address MMIO register to read.
1805 @param StartBit The ordinal of the least significant bit in the bit field.
1807 @param EndBit The ordinal of the most significant bit in the bit field.
1810 @return The value read.
1815 MmioBitFieldRead32 (
1821 return BitFieldRead32 (MmioRead32 (Address
), StartBit
, EndBit
);
1825 Writes a bit field to a MMIO register.
1827 Writes Value to the bit field of the MMIO register. The bit field is
1828 specified by the StartBit and the EndBit. All other bits in the destination
1829 MMIO register are preserved. The new value of the 32-bit register is returned.
1831 If 32-bit MMIO register operations are not supported, then ASSERT().
1832 If StartBit is greater than 31, then ASSERT().
1833 If EndBit is greater than 31, then ASSERT().
1834 If EndBit is less than StartBit, then ASSERT().
1836 @param Address MMIO register to write.
1837 @param StartBit The ordinal of the least significant bit in the bit field.
1839 @param EndBit The ordinal of the most significant bit in the bit field.
1841 @param Value New value of the bit field.
1843 @return The value written back to the MMIO register.
1848 MmioBitFieldWrite32 (
1855 return MmioWrite32 (
1857 BitFieldWrite32 (MmioRead32 (Address
), StartBit
, EndBit
, Value
)
1862 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
1863 writes the result back to the bit field in the 32-bit MMIO register.
1865 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1866 inclusive OR between the read result and the value specified by OrData, and
1867 writes the result to the 32-bit MMIO register specified by Address. The value
1868 written to the MMIO register is returned. This function must guarantee that
1869 all MMIO read and write operations are serialized. Extra left bits in OrData
1872 If 32-bit MMIO register operations are not supported, then ASSERT().
1873 If StartBit is greater than 31, then ASSERT().
1874 If EndBit is greater than 31, then ASSERT().
1875 If EndBit is less than StartBit, then ASSERT().
1877 @param Address MMIO register to write.
1878 @param StartBit The ordinal of the least significant bit in the bit field.
1880 @param EndBit The ordinal of the most significant bit in the bit field.
1882 @param OrData The value to OR with read value from the MMIO register.
1884 @return The value written back to the MMIO register.
1896 return MmioWrite32 (
1898 BitFieldOr32 (MmioRead32 (Address
), StartBit
, EndBit
, OrData
)
1903 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
1904 writes the result back to the bit field in the 32-bit MMIO register.
1906 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1907 between the read result and the value specified by AndData, and writes the
1908 result to the 32-bit MMIO register specified by Address. The value written to
1909 the MMIO register is returned. This function must guarantee that all MMIO
1910 read and write operations are serialized. Extra left bits in AndData are
1913 If 32-bit MMIO register operations are not supported, then ASSERT().
1914 If StartBit is greater than 31, then ASSERT().
1915 If EndBit is greater than 31, then ASSERT().
1916 If EndBit is less than StartBit, then ASSERT().
1918 @param Address MMIO register to write.
1919 @param StartBit The ordinal of the least significant bit in the bit field.
1921 @param EndBit The ordinal of the most significant bit in the bit field.
1923 @param AndData The value to AND with read value from the MMIO register.
1925 @return The value written back to the MMIO register.
1937 return MmioWrite32 (
1939 BitFieldAnd32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
)
1944 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
1945 by a bitwise OR, and writes the result back to the bit field in the
1946 32-bit MMIO register.
1948 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1949 followed by a bitwise OR between the read result and the value
1950 specified by AndData, and writes the result to the 32-bit MMIO register
1951 specified by Address. The value written to the MMIO register is returned.
1952 This function must guarantee that all MMIO read and write operations are
1953 serialized. Extra left bits in both AndData and OrData are stripped.
1955 If 32-bit MMIO register operations are not supported, then ASSERT().
1956 If StartBit is greater than 31, then ASSERT().
1957 If EndBit is greater than 31, then ASSERT().
1958 If EndBit is less than StartBit, then ASSERT().
1960 @param Address MMIO register to write.
1961 @param StartBit The ordinal of the least significant bit in the bit field.
1963 @param EndBit The ordinal of the most significant bit in the bit field.
1965 @param AndData The value to AND with read value from the MMIO register.
1966 @param OrData The value to OR with the result of the AND operation.
1968 @return The value written back to the MMIO register.
1973 MmioBitFieldAndThenOr32 (
1981 return MmioWrite32 (
1983 BitFieldAndThenOr32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1988 Reads a 64-bit MMIO register, performs a bitwise OR, and writes the
1989 result back to the 64-bit MMIO register.
1991 Reads the 64-bit MMIO register specified by Address, performs a bitwise
1992 inclusive OR between the read result and the value specified by OrData, and
1993 writes the result to the 64-bit MMIO register specified by Address. The value
1994 written to the MMIO register is returned. This function must guarantee that
1995 all MMIO read and write operations are serialized.
1997 If 64-bit MMIO register operations are not supported, then ASSERT().
1999 @param Address The MMIO register to write.
2000 @param OrData The value to OR with the read value from the MMIO register.
2002 @return The value written back to the MMIO register.
2012 return MmioWrite64 (Address
, MmioRead64 (Address
) | OrData
);
2016 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2017 back to the 64-bit MMIO register.
2019 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2020 between the read result and the value specified by AndData, and writes the
2021 result to the 64-bit MMIO register specified by Address. The value written to
2022 the MMIO register is returned. This function must guarantee that all MMIO
2023 read and write operations are serialized.
2025 If 64-bit MMIO register operations are not supported, then ASSERT().
2027 @param Address The MMIO register to write.
2028 @param AndData The value to AND with the read value from the MMIO register.
2030 @return The value written back to the MMIO register.
2040 return MmioWrite64 (Address
, MmioRead64 (Address
) & AndData
);
2044 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2045 inclusive OR, and writes the result back to the 64-bit MMIO register.
2047 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2048 between the read result and the value specified by AndData, performs a
2049 bitwise OR between the result of the AND operation and the value specified by
2050 OrData, and writes the result to the 64-bit MMIO register specified by
2051 Address. The value written to the MMIO register is returned. This function
2052 must guarantee that all MMIO read and write operations are serialized.
2054 If 64-bit MMIO register operations are not supported, then ASSERT().
2057 @param Address The MMIO register to write.
2058 @param AndData The value to AND with the read value from the MMIO register.
2059 @param OrData The value to OR with the result of the AND operation.
2061 @return The value written back to the MMIO register.
2072 return MmioWrite64 (Address
, (MmioRead64 (Address
) & AndData
) | OrData
);
2076 Reads a bit field of a MMIO register.
2078 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2079 the StartBit and the EndBit. The value of the bit field is returned.
2081 If 64-bit MMIO register operations are not supported, then ASSERT().
2082 If StartBit is greater than 63, then ASSERT().
2083 If EndBit is greater than 63, then ASSERT().
2084 If EndBit is less than StartBit, then ASSERT().
2086 @param Address MMIO register to read.
2087 @param StartBit The ordinal of the least significant bit in the bit field.
2089 @param EndBit The ordinal of the most significant bit in the bit field.
2092 @return The value read.
2097 MmioBitFieldRead64 (
2103 return BitFieldRead64 (MmioRead64 (Address
), StartBit
, EndBit
);
2107 Writes a bit field to a MMIO register.
2109 Writes Value to the bit field of the MMIO register. The bit field is
2110 specified by the StartBit and the EndBit. All other bits in the destination
2111 MMIO register are preserved. The new value of the 64-bit register is returned.
2113 If 64-bit MMIO register operations are not supported, then ASSERT().
2114 If StartBit is greater than 63, then ASSERT().
2115 If EndBit is greater than 63, then ASSERT().
2116 If EndBit is less than StartBit, then ASSERT().
2118 @param Address MMIO register to write.
2119 @param StartBit The ordinal of the least significant bit in the bit field.
2121 @param EndBit The ordinal of the most significant bit in the bit field.
2123 @param Value New value of the bit field.
2125 @return The value written back to the MMIO register.
2130 MmioBitFieldWrite64 (
2137 return MmioWrite64 (
2139 BitFieldWrite64 (MmioRead64 (Address
), StartBit
, EndBit
, Value
)
2144 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2145 writes the result back to the bit field in the 64-bit MMIO register.
2147 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2148 inclusive OR between the read result and the value specified by OrData, and
2149 writes the result to the 64-bit MMIO register specified by Address. The value
2150 written to the MMIO register is returned. This function must guarantee that
2151 all MMIO read and write operations are serialized. Extra left bits in OrData
2154 If 64-bit MMIO register operations are not supported, 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 MMIO register to write.
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.
2164 @param OrData The value to OR with read value from the MMIO register.
2166 @return The value written back to the MMIO register.
2178 return MmioWrite64 (
2180 BitFieldOr64 (MmioRead64 (Address
), StartBit
, EndBit
, OrData
)
2185 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2186 writes the result back to the bit field in the 64-bit MMIO register.
2188 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2189 between the read result and the value specified by AndData, and writes the
2190 result to the 64-bit MMIO register specified by Address. The value written to
2191 the MMIO register is returned. This function must guarantee that all MMIO
2192 read and write operations are serialized. Extra left bits in AndData are
2195 If 64-bit MMIO register operations are not supported, then ASSERT().
2196 If StartBit is greater than 63, then ASSERT().
2197 If EndBit is greater than 63, then ASSERT().
2198 If EndBit is less than StartBit, then ASSERT().
2200 @param Address MMIO register to write.
2201 @param StartBit The ordinal of the least significant bit in the bit field.
2203 @param EndBit The ordinal of the most significant bit in the bit field.
2205 @param AndData The value to AND with read value from the MMIO register.
2207 @return The value written back to the MMIO register.
2219 return MmioWrite64 (
2221 BitFieldAnd64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
)
2226 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2227 by a bitwise OR, and writes the result back to the bit field in the
2228 64-bit MMIO register.
2230 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2231 followed by a bitwise OR between the read result and the value
2232 specified by AndData, and writes the result to the 64-bit MMIO register
2233 specified by Address. The value written to the MMIO register is returned.
2234 This function must guarantee that all MMIO read and write operations are
2235 serialized. Extra left bits in both AndData and OrData are stripped.
2237 If 64-bit MMIO register operations are not supported, then ASSERT().
2238 If StartBit is greater than 63, then ASSERT().
2239 If EndBit is greater than 63, then ASSERT().
2240 If EndBit is less than StartBit, then ASSERT().
2242 @param Address MMIO register to write.
2243 @param StartBit The ordinal of the least significant bit in the bit field.
2245 @param EndBit The ordinal of the most significant bit in the bit field.
2247 @param AndData The value to AND with read value from the MMIO register.
2248 @param OrData The value to OR with the result of the AND operation.
2250 @return The value written back to the MMIO register.
2255 MmioBitFieldAndThenOr64 (
2263 return MmioWrite64 (
2265 BitFieldAndThenOr64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
, OrData
)