]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/SmmIoLibSmmCpuIo2/IoHighLevel.c
2 High-level Io/Mmio functions.
4 All assertions for bit field operations are handled bit field functions in the
7 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
8 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 The following IoLib instances share the same version of this file:
24 #include "SmmCpuIoLibInternal.h"
27 Reads an 8-bit I/O port, performs a bitwise OR, and writes the
28 result back to the 8-bit I/O port.
30 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
31 between the read result and the value specified by OrData, and writes the
32 result to the 8-bit I/O port specified by Port. The value written to the I/O
33 port is returned. This function must guarantee that all I/O read and write
34 operations are serialized.
36 If 8-bit I/O port operations are not supported, then ASSERT().
38 @param Port The I/O port to write.
39 @param OrData The value to OR with the read value from the I/O port.
41 @return The value written back to the I/O port.
51 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) | OrData
));
55 Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
56 to the 8-bit I/O port.
58 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
59 the read result and the value specified by AndData, and writes the result to
60 the 8-bit I/O port specified by Port. The value written to the I/O port is
61 returned. This function must guarantee that all I/O read and write operations
64 If 8-bit I/O port operations are not supported, then ASSERT().
66 @param Port The I/O port to write.
67 @param AndData The value to AND with the read value from the I/O port.
69 @return The value written back to the I/O port.
79 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) & AndData
));
83 Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
84 inclusive OR, and writes the result back to the 8-bit I/O port.
86 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
87 the read result and the value specified by AndData, performs a bitwise OR
88 between the result of the AND operation and the value specified by OrData,
89 and writes the result to the 8-bit I/O port specified by Port. The value
90 written to the I/O port is returned. This function must guarantee that all
91 I/O read and write operations are serialized.
93 If 8-bit I/O port operations are not supported, then ASSERT().
95 @param Port The I/O port to write.
96 @param AndData The value to AND with the read value from the I/O port.
97 @param OrData The value to OR with the result of the AND operation.
99 @return The value written back to the I/O port.
110 return IoWrite8 (Port
, (UINT8
) ((IoRead8 (Port
) & AndData
) | OrData
));
114 Reads a bit field of an I/O register.
116 Reads the bit field in an 8-bit I/O register. The bit field is specified by
117 the StartBit and the EndBit. The value of the bit field is returned.
119 If 8-bit I/O port operations are not supported, then ASSERT().
120 If StartBit is greater than 7, then ASSERT().
121 If EndBit is greater than 7, then ASSERT().
122 If EndBit is less than StartBit, then ASSERT().
124 @param Port The I/O port to read.
125 @param StartBit The ordinal of the least significant bit in the bit field.
127 @param EndBit The ordinal of the most significant bit in the bit field.
130 @return The value read.
141 return BitFieldRead8 (IoRead8 (Port
), StartBit
, EndBit
);
145 Writes a bit field to an I/O register.
147 Writes Value to the bit field of the I/O register. The bit field is specified
148 by the StartBit and the EndBit. All other bits in the destination I/O
149 register are preserved. The value written to the I/O port is returned. Extra
150 left bits in Value are stripped.
152 If 8-bit I/O port operations are not supported, then ASSERT().
153 If StartBit is greater than 7, then ASSERT().
154 If EndBit is greater than 7, then ASSERT().
155 If EndBit is less than StartBit, then ASSERT().
156 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
158 @param Port The I/O port to write.
159 @param StartBit The ordinal of the least significant bit in the bit field.
161 @param EndBit The ordinal of the most significant bit in the bit field.
163 @param Value The new value of the bit field.
165 @return The value written back to the I/O port.
179 BitFieldWrite8 (IoRead8 (Port
), StartBit
, EndBit
, Value
)
184 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
185 result back to the bit field in the 8-bit port.
187 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
188 between the read result and the value specified by OrData, and writes the
189 result to the 8-bit I/O port specified by Port. The value written to the I/O
190 port is returned. This function must guarantee that all I/O read and write
191 operations are serialized. Extra left bits in OrData are stripped.
193 If 8-bit I/O port operations are not supported, then ASSERT().
194 If StartBit is greater than 7, then ASSERT().
195 If EndBit is greater than 7, then ASSERT().
196 If EndBit is less than StartBit, then ASSERT().
197 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
199 @param Port The I/O port to write.
200 @param StartBit The ordinal of the least significant bit in the bit field.
202 @param EndBit The ordinal of the most significant bit in the bit field.
204 @param OrData The value to OR with the read value from the I/O port.
206 @return The value written back to the I/O port.
220 BitFieldOr8 (IoRead8 (Port
), StartBit
, EndBit
, OrData
)
225 Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
226 result back to the bit field in the 8-bit port.
228 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
229 the read result and the value specified by AndData, and writes the result to
230 the 8-bit I/O port specified by Port. The value written to the I/O port is
231 returned. This function must guarantee that all I/O read and write operations
232 are serialized. Extra left bits in AndData are stripped.
234 If 8-bit I/O port operations are not supported, then ASSERT().
235 If StartBit is greater than 7, then ASSERT().
236 If EndBit is greater than 7, then ASSERT().
237 If EndBit is less than StartBit, then ASSERT().
238 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
240 @param Port The I/O port to write.
241 @param StartBit The ordinal of the least significant bit in the bit field.
243 @param EndBit The ordinal of the most significant bit in the bit field.
245 @param AndData The value to AND with the read value from the I/O port.
247 @return The value written back to the I/O port.
261 BitFieldAnd8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
)
266 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
267 bitwise OR, and writes the result back to the bit field in the
270 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
271 by a bitwise OR between the read result and the value specified by
272 AndData, and writes the result to the 8-bit I/O port specified by Port. The
273 value written to the I/O port is returned. This function must guarantee that
274 all I/O read and write operations are serialized. Extra left bits in both
275 AndData and OrData are stripped.
277 If 8-bit I/O port operations are not supported, then ASSERT().
278 If StartBit is greater than 7, then ASSERT().
279 If EndBit is greater than 7, then ASSERT().
280 If EndBit is less than StartBit, then ASSERT().
281 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
282 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
284 @param Port The I/O port to write.
285 @param StartBit The ordinal of the least significant bit in the bit field.
287 @param EndBit The ordinal of the most significant bit in the bit field.
289 @param AndData The value to AND with the read value from the I/O port.
290 @param OrData The value to OR with the result of the AND operation.
292 @return The value written back to the I/O port.
297 IoBitFieldAndThenOr8 (
307 BitFieldAndThenOr8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
, OrData
)
312 Reads a 16-bit I/O port, performs a bitwise OR, and writes the
313 result back to the 16-bit I/O port.
315 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
316 between the read result and the value specified by OrData, and writes the
317 result to the 16-bit I/O port specified by Port. The value written to the I/O
318 port is returned. This function must guarantee that all I/O read and write
319 operations are serialized.
321 If 16-bit I/O port operations are not supported, then ASSERT().
323 @param Port The I/O port to write.
324 @param OrData The value to OR with the read value from the I/O port.
326 @return The value written back to the I/O port.
336 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) | OrData
));
340 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
341 to the 16-bit I/O port.
343 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
344 the read result and the value specified by AndData, and writes the result to
345 the 16-bit I/O port specified by Port. The value written to the I/O port is
346 returned. This function must guarantee that all I/O read and write operations
349 If 16-bit I/O port operations are not supported, then ASSERT().
351 @param Port The I/O port to write.
352 @param AndData The value to AND with the read value from the I/O port.
354 @return The value written back to the I/O port.
364 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) & AndData
));
368 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
369 inclusive OR, and writes the result back to the 16-bit I/O port.
371 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
372 the read result and the value specified by AndData, performs a bitwise OR
373 between the result of the AND operation and the value specified by OrData,
374 and writes the result to the 16-bit I/O port specified by Port. The value
375 written to the I/O port is returned. This function must guarantee that all
376 I/O read and write operations are serialized.
378 If 16-bit I/O port operations are not supported, then ASSERT().
380 @param Port The I/O port to write.
381 @param AndData The value to AND with the read value from the I/O port.
382 @param OrData The value to OR with the result of the AND operation.
384 @return The value written back to the I/O port.
395 return IoWrite16 (Port
, (UINT16
) ((IoRead16 (Port
) & AndData
) | OrData
));
399 Reads a bit field of an I/O register.
401 Reads the bit field in a 16-bit I/O register. The bit field is specified by
402 the StartBit and the EndBit. The value of the bit field is returned.
404 If 16-bit I/O port operations are not supported, then ASSERT().
405 If StartBit is greater than 15, then ASSERT().
406 If EndBit is greater than 15, then ASSERT().
407 If EndBit is less than StartBit, then ASSERT().
409 @param Port The I/O port to read.
410 @param StartBit The ordinal of the least significant bit in the bit field.
412 @param EndBit The ordinal of the most significant bit in the bit field.
415 @return The value read.
426 return BitFieldRead16 (IoRead16 (Port
), StartBit
, EndBit
);
430 Writes a bit field to an I/O register.
432 Writes Value to the bit field of the I/O register. The bit field is specified
433 by the StartBit and the EndBit. All other bits in the destination I/O
434 register are preserved. The value written to the I/O port is returned. Extra
435 left bits in Value are stripped.
437 If 16-bit I/O port operations are not supported, then ASSERT().
438 If StartBit is greater than 15, then ASSERT().
439 If EndBit is greater than 15, then ASSERT().
440 If EndBit is less than StartBit, then ASSERT().
441 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
443 @param Port The I/O port to write.
444 @param StartBit The ordinal of the least significant bit in the bit field.
446 @param EndBit The ordinal of the most significant bit in the bit field.
448 @param Value The new value of the bit field.
450 @return The value written back to the I/O port.
464 BitFieldWrite16 (IoRead16 (Port
), StartBit
, EndBit
, Value
)
469 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
470 result back to the bit field in the 16-bit port.
472 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
473 between the read result and the value specified by OrData, and writes the
474 result to the 16-bit I/O port specified by Port. The value written to the I/O
475 port is returned. This function must guarantee that all I/O read and write
476 operations are serialized. Extra left bits in OrData are stripped.
478 If 16-bit I/O port operations are not supported, then ASSERT().
479 If StartBit is greater than 15, then ASSERT().
480 If EndBit is greater than 15, then ASSERT().
481 If EndBit is less than StartBit, then ASSERT().
482 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
484 @param Port The I/O port to write.
485 @param StartBit The ordinal of the least significant bit in the bit field.
487 @param EndBit The ordinal of the most significant bit in the bit field.
489 @param OrData The value to OR with the read value from the I/O port.
491 @return The value written back to the I/O port.
505 BitFieldOr16 (IoRead16 (Port
), StartBit
, EndBit
, OrData
)
510 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
511 result back to the bit field in the 16-bit port.
513 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
514 the read result and the value specified by AndData, and writes the result to
515 the 16-bit I/O port specified by Port. The value written to the I/O port is
516 returned. This function must guarantee that all I/O read and write operations
517 are serialized. Extra left bits in AndData are stripped.
519 If 16-bit I/O port operations are not supported, then ASSERT().
520 If StartBit is greater than 15, then ASSERT().
521 If EndBit is greater than 15, then ASSERT().
522 If EndBit is less than StartBit, then ASSERT().
523 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
525 @param Port The I/O port to write.
526 @param StartBit The ordinal of the least significant bit in the bit field.
528 @param EndBit The ordinal of the most significant bit in the bit field.
530 @param AndData The value to AND with the read value from the I/O port.
532 @return The value written back to the I/O port.
546 BitFieldAnd16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
)
551 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
552 bitwise OR, and writes the result back to the bit field in the
555 Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
556 by a bitwise OR between the read result and the value specified by
557 AndData, and writes the result to the 16-bit I/O port specified by Port. The
558 value written to the I/O port is returned. This function must guarantee that
559 all I/O read and write operations are serialized. Extra left bits in both
560 AndData and OrData are stripped.
562 If 16-bit I/O port operations are not supported, then ASSERT().
563 If StartBit is greater than 15, then ASSERT().
564 If EndBit is greater than 15, then ASSERT().
565 If EndBit is less than StartBit, then ASSERT().
566 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
567 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
569 @param Port The I/O port to write.
570 @param StartBit The ordinal of the least significant bit in the bit field.
572 @param EndBit The ordinal of the most significant bit in the bit field.
574 @param AndData The value to AND with the read value from the I/O port.
575 @param OrData The value to OR with the result of the AND operation.
577 @return The value written back to the I/O port.
582 IoBitFieldAndThenOr16 (
592 BitFieldAndThenOr16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
, OrData
)
597 Reads a 32-bit I/O port, performs a bitwise OR, and writes the
598 result back to the 32-bit I/O port.
600 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
601 between the read result and the value specified by OrData, and writes the
602 result to the 32-bit I/O port specified by Port. The value written to the I/O
603 port is returned. This function must guarantee that all I/O read and write
604 operations are serialized.
606 If 32-bit I/O port operations are not supported, then ASSERT().
608 @param Port The I/O port to write.
609 @param OrData The value to OR with the read value from the I/O port.
611 @return The value written back to the I/O port.
621 return IoWrite32 (Port
, IoRead32 (Port
) | OrData
);
625 Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
626 to the 32-bit I/O port.
628 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
629 the read result and the value specified by AndData, and writes the result to
630 the 32-bit I/O port specified by Port. The value written to the I/O port is
631 returned. This function must guarantee that all I/O read and write operations
634 If 32-bit I/O port operations are not supported, then ASSERT().
636 @param Port The I/O port to write.
637 @param AndData The value to AND with the read value from the I/O port.
639 @return The value written back to the I/O port.
649 return IoWrite32 (Port
, IoRead32 (Port
) & AndData
);
653 Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
654 inclusive OR, and writes the result back to the 32-bit I/O port.
656 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
657 the read result and the value specified by AndData, performs a bitwise OR
658 between the result of the AND operation and the value specified by OrData,
659 and writes the result to the 32-bit I/O port specified by Port. The value
660 written to the I/O port is returned. This function must guarantee that all
661 I/O read and write operations are serialized.
663 If 32-bit I/O port operations are not supported, then ASSERT().
665 @param Port The I/O port to write.
666 @param AndData The value to AND with the read value from the I/O port.
667 @param OrData The value to OR with the result of the AND operation.
669 @return The value written back to the I/O port.
680 return IoWrite32 (Port
, (IoRead32 (Port
) & AndData
) | OrData
);
684 Reads a bit field of an I/O register.
686 Reads the bit field in a 32-bit I/O register. The bit field is specified by
687 the StartBit and the EndBit. The value of the bit field is returned.
689 If 32-bit I/O port operations are not supported, then ASSERT().
690 If StartBit is greater than 31, then ASSERT().
691 If EndBit is greater than 31, then ASSERT().
692 If EndBit is less than StartBit, then ASSERT().
694 @param Port The I/O port to read.
695 @param StartBit The ordinal of the least significant bit in the bit field.
697 @param EndBit The ordinal of the most significant bit in the bit field.
700 @return The value read.
711 return BitFieldRead32 (IoRead32 (Port
), StartBit
, EndBit
);
715 Writes a bit field to an I/O register.
717 Writes Value to the bit field of the I/O register. The bit field is specified
718 by the StartBit and the EndBit. All other bits in the destination I/O
719 register are preserved. The value written to the I/O port is returned. Extra
720 left bits in Value are stripped.
722 If 32-bit I/O port operations are not supported, then ASSERT().
723 If StartBit is greater than 31, then ASSERT().
724 If EndBit is greater than 31, then ASSERT().
725 If EndBit is less than StartBit, then ASSERT().
726 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
728 @param Port The I/O port to write.
729 @param StartBit The ordinal of the least significant bit in the bit field.
731 @param EndBit The ordinal of the most significant bit in the bit field.
733 @param Value The new value of the bit field.
735 @return The value written back to the I/O port.
749 BitFieldWrite32 (IoRead32 (Port
), StartBit
, EndBit
, Value
)
754 Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the
755 result back to the bit field in the 32-bit port.
757 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
758 between the read result and the value specified by OrData, and writes the
759 result to the 32-bit I/O port specified by Port. The value written to the I/O
760 port is returned. This function must guarantee that all I/O read and write
761 operations are serialized. Extra left bits in OrData are stripped.
763 If 32-bit I/O port operations are not supported, then ASSERT().
764 If StartBit is greater than 31, then ASSERT().
765 If EndBit is greater than 31, then ASSERT().
766 If EndBit is less than StartBit, then ASSERT().
767 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
769 @param Port The I/O port to write.
770 @param StartBit The ordinal of the least significant bit in the bit field.
772 @param EndBit The ordinal of the most significant bit in the bit field.
774 @param OrData The value to OR with the read value from the I/O port.
776 @return The value written back to the I/O port.
790 BitFieldOr32 (IoRead32 (Port
), StartBit
, EndBit
, OrData
)
795 Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
796 result back to the bit field in the 32-bit port.
798 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
799 the read result and the value specified by AndData, and writes the result to
800 the 32-bit I/O port specified by Port. The value written to the I/O port is
801 returned. This function must guarantee that all I/O read and write operations
802 are serialized. Extra left bits in AndData are stripped.
804 If 32-bit I/O port operations are not supported, then ASSERT().
805 If StartBit is greater than 31, then ASSERT().
806 If EndBit is greater than 31, then ASSERT().
807 If EndBit is less than StartBit, then ASSERT().
808 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
810 @param Port The I/O port to write.
811 @param StartBit The ordinal of the least significant bit in the bit field.
813 @param EndBit The ordinal of the most significant bit in the bit field.
815 @param AndData The value to AND with the read value from the I/O port.
817 @return The value written back to the I/O port.
831 BitFieldAnd32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
)
836 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
837 bitwise OR, and writes the result back to the bit field in the
840 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
841 by a bitwise OR between the read result and the value specified by
842 AndData, and writes the result to the 32-bit I/O port specified by Port. The
843 value written to the I/O port is returned. This function must guarantee that
844 all I/O read and write operations are serialized. Extra left bits in both
845 AndData and OrData are stripped.
847 If 32-bit I/O port operations are not supported, then ASSERT().
848 If StartBit is greater than 31, then ASSERT().
849 If EndBit is greater than 31, then ASSERT().
850 If EndBit is less than StartBit, then ASSERT().
851 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
852 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
854 @param Port The I/O port to write.
855 @param StartBit The ordinal of the least significant bit in the bit field.
857 @param EndBit The ordinal of the most significant bit in the bit field.
859 @param AndData The value to AND with the read value from the I/O port.
860 @param OrData The value to OR with the result of the AND operation.
862 @return The value written back to the I/O port.
867 IoBitFieldAndThenOr32 (
877 BitFieldAndThenOr32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
, OrData
)
882 Reads a 64-bit I/O port, performs a bitwise OR, and writes the
883 result back to the 64-bit I/O port.
885 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
886 between the read result and the value specified by OrData, and writes the
887 result to the 64-bit I/O port specified by Port. The value written to the I/O
888 port is returned. This function must guarantee that all I/O read and write
889 operations are serialized.
891 If 64-bit I/O port operations are not supported, then ASSERT().
893 @param Port The I/O port to write.
894 @param OrData The value to OR with the read value from the I/O port.
896 @return The value written back to the I/O port.
906 return IoWrite64 (Port
, IoRead64 (Port
) | OrData
);
910 Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
911 to the 64-bit I/O port.
913 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
914 the read result and the value specified by AndData, and writes the result to
915 the 64-bit I/O port specified by Port. The value written to the I/O port is
916 returned. This function must guarantee that all I/O read and write operations
919 If 64-bit I/O port operations are not supported, then ASSERT().
921 @param Port The I/O port to write.
922 @param AndData The value to AND with the read value from the I/O port.
924 @return The value written back to the I/O port.
934 return IoWrite64 (Port
, IoRead64 (Port
) & AndData
);
938 Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
939 inclusive OR, and writes the result back to the 64-bit I/O port.
941 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
942 the read result and the value specified by AndData, performs a bitwise OR
943 between the result of the AND operation and the value specified by OrData,
944 and writes the result to the 64-bit I/O port specified by Port. The value
945 written to the I/O port is returned. This function must guarantee that all
946 I/O read and write operations are serialized.
948 If 64-bit I/O port operations are not supported, then ASSERT().
950 @param Port The I/O port to write.
951 @param AndData The value to AND with the read value from the I/O port.
952 @param OrData The value to OR with the result of the AND operation.
954 @return The value written back to the I/O port.
965 return IoWrite64 (Port
, (IoRead64 (Port
) & AndData
) | OrData
);
969 Reads a bit field of an I/O register.
971 Reads the bit field in a 64-bit I/O register. The bit field is specified by
972 the StartBit and the EndBit. The value of the bit field is returned.
974 If 64-bit I/O port operations are not supported, then ASSERT().
975 If StartBit is greater than 63, then ASSERT().
976 If EndBit is greater than 63, then ASSERT().
977 If EndBit is less than StartBit, then ASSERT().
979 @param Port The I/O port to read.
980 @param StartBit The ordinal of the least significant bit in the bit field.
982 @param EndBit The ordinal of the most significant bit in the bit field.
985 @return The value read.
996 return BitFieldRead64 (IoRead64 (Port
), StartBit
, EndBit
);
1000 Writes a bit field to an I/O register.
1002 Writes Value to the bit field of the I/O register. The bit field is specified
1003 by the StartBit and the EndBit. All other bits in the destination I/O
1004 register are preserved. The value written to the I/O port is returned. Extra
1005 left bits in Value are stripped.
1007 If 64-bit I/O port operations are not supported, then ASSERT().
1008 If StartBit is greater than 63, then ASSERT().
1009 If EndBit is greater than 63, then ASSERT().
1010 If EndBit is less than StartBit, then ASSERT().
1011 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1013 @param Port The I/O port to write.
1014 @param StartBit The ordinal of the least significant bit in the bit field.
1016 @param EndBit The ordinal of the most significant bit in the bit field.
1018 @param Value The new value of the bit field.
1020 @return The value written back to the I/O port.
1034 BitFieldWrite64 (IoRead64 (Port
), StartBit
, EndBit
, Value
)
1039 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1040 result back to the bit field in the 64-bit port.
1042 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
1043 between the read result and the value specified by OrData, and writes the
1044 result to the 64-bit I/O port specified by Port. The value written to the I/O
1045 port is returned. This function must guarantee that all I/O read and write
1046 operations are serialized. Extra left bits in OrData are stripped.
1048 If 64-bit I/O port operations are not supported, then ASSERT().
1049 If StartBit is greater than 63, then ASSERT().
1050 If EndBit is greater than 63, then ASSERT().
1051 If EndBit is less than StartBit, then ASSERT().
1052 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1054 @param Port The I/O port to write.
1055 @param StartBit The ordinal of the least significant bit in the bit field.
1057 @param EndBit The ordinal of the most significant bit in the bit field.
1059 @param OrData The value to OR with the read value from the I/O port.
1061 @return The value written back to the I/O port.
1075 BitFieldOr64 (IoRead64 (Port
), StartBit
, EndBit
, OrData
)
1080 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1081 result back to the bit field in the 64-bit port.
1083 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1084 the read result and the value specified by AndData, and writes the result to
1085 the 64-bit I/O port specified by Port. The value written to the I/O port is
1086 returned. This function must guarantee that all I/O read and write operations
1087 are serialized. Extra left bits in AndData are stripped.
1089 If 64-bit I/O port operations are not supported, then ASSERT().
1090 If StartBit is greater than 63, then ASSERT().
1091 If EndBit is greater than 63, then ASSERT().
1092 If EndBit is less than StartBit, then ASSERT().
1093 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1095 @param Port The I/O port to write.
1096 @param StartBit The ordinal of the least significant bit in the bit field.
1098 @param EndBit The ordinal of the most significant bit in the bit field.
1100 @param AndData The value to AND with the read value from the I/O port.
1102 @return The value written back to the I/O port.
1116 BitFieldAnd64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
)
1121 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
1122 bitwise OR, and writes the result back to the bit field in the
1125 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
1126 by a bitwise OR between the read result and the value specified by
1127 AndData, and writes the result to the 64-bit I/O port specified by Port. The
1128 value written to the I/O port is returned. This function must guarantee that
1129 all I/O read and write operations are serialized. Extra left bits in both
1130 AndData and OrData are stripped.
1132 If 64-bit I/O port operations are not supported, then ASSERT().
1133 If StartBit is greater than 63, then ASSERT().
1134 If EndBit is greater than 63, then ASSERT().
1135 If EndBit is less than StartBit, then ASSERT().
1136 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1137 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1139 @param Port The I/O port to write.
1140 @param StartBit The ordinal of the least significant bit in the bit field.
1142 @param EndBit The ordinal of the most significant bit in the bit field.
1144 @param AndData The value to AND with the read value from the I/O port.
1145 @param OrData The value to OR with the result of the AND operation.
1147 @return The value written back to the I/O port.
1152 IoBitFieldAndThenOr64 (
1162 BitFieldAndThenOr64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
, OrData
)
1167 Reads an 8-bit MMIO register, performs a bitwise OR, and writes the
1168 result back to the 8-bit MMIO register.
1170 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1171 inclusive OR between the read result and the value specified by OrData, and
1172 writes the result to the 8-bit MMIO register specified by Address. The value
1173 written to the MMIO register is returned. This function must guarantee that
1174 all MMIO read and write operations are serialized.
1176 If 8-bit MMIO register operations are not supported, then ASSERT().
1178 @param Address The MMIO register to write.
1179 @param OrData The value to OR with the read value from the MMIO register.
1181 @return The value written back to the MMIO register.
1191 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) | OrData
));
1195 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1196 back to the 8-bit MMIO register.
1198 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1199 between the read result and the value specified by AndData, and writes the
1200 result to the 8-bit MMIO register specified by Address. The value written to
1201 the MMIO register is returned. This function must guarantee that all MMIO
1202 read and write operations are serialized.
1204 If 8-bit MMIO register operations are not supported, then ASSERT().
1206 @param Address The MMIO register to write.
1207 @param AndData The value to AND with the read value from the MMIO register.
1209 @return The value written back to the MMIO register.
1219 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) & AndData
));
1223 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1224 inclusive OR, and writes the result back to the 8-bit MMIO register.
1226 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1227 between the read result and the value specified by AndData, performs a
1228 bitwise OR between the result of the AND operation and the value specified by
1229 OrData, and writes the result to the 8-bit MMIO register specified by
1230 Address. The value written to the MMIO register is returned. This function
1231 must guarantee that all MMIO read and write operations are serialized.
1233 If 8-bit MMIO register operations are not supported, then ASSERT().
1236 @param Address The MMIO register to write.
1237 @param AndData The value to AND with the read value from the MMIO register.
1238 @param OrData The value to OR with the result of the AND operation.
1240 @return The value written back to the MMIO register.
1251 return MmioWrite8 (Address
, (UINT8
) ((MmioRead8 (Address
) & AndData
) | OrData
));
1255 Reads a bit field of a MMIO register.
1257 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1258 the StartBit and the EndBit. The value of the bit field is returned.
1260 If 8-bit MMIO register operations are not supported, then ASSERT().
1261 If StartBit is greater than 7, then ASSERT().
1262 If EndBit is greater than 7, then ASSERT().
1263 If EndBit is less than StartBit, then ASSERT().
1265 @param Address The MMIO register to read.
1266 @param StartBit The ordinal of the least significant bit in the bit field.
1268 @param EndBit The ordinal of the most significant bit in the bit field.
1271 @return The value read.
1282 return BitFieldRead8 (MmioRead8 (Address
), StartBit
, EndBit
);
1286 Writes a bit field to a MMIO register.
1288 Writes Value to the bit field of the MMIO register. The bit field is
1289 specified by the StartBit and the EndBit. All other bits in the destination
1290 MMIO register are preserved. The new value of the 8-bit register is returned.
1292 If 8-bit MMIO register operations are not supported, then ASSERT().
1293 If StartBit is greater than 7, then ASSERT().
1294 If EndBit is greater than 7, then ASSERT().
1295 If EndBit is less than StartBit, then ASSERT().
1296 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1298 @param Address The MMIO register to write.
1299 @param StartBit The ordinal of the least significant bit in the bit field.
1301 @param EndBit The ordinal of the most significant bit in the bit field.
1303 @param Value The new value of the bit field.
1305 @return The value written back to the MMIO register.
1310 MmioBitFieldWrite8 (
1319 BitFieldWrite8 (MmioRead8 (Address
), StartBit
, EndBit
, Value
)
1324 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1325 writes the result back to the bit field in the 8-bit MMIO register.
1327 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1328 inclusive OR between the read result and the value specified by OrData, and
1329 writes the result to the 8-bit MMIO register specified by Address. The value
1330 written to the MMIO register is returned. This function must guarantee that
1331 all MMIO read and write operations are serialized. Extra left bits in OrData
1334 If 8-bit MMIO register operations are not supported, then ASSERT().
1335 If StartBit is greater than 7, then ASSERT().
1336 If EndBit is greater than 7, then ASSERT().
1337 If EndBit is less than StartBit, then ASSERT().
1338 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1340 @param Address The MMIO register to write.
1341 @param StartBit The ordinal of the least significant bit in the bit field.
1343 @param EndBit The ordinal of the most significant bit in the bit field.
1345 @param OrData The value to OR with read value from the MMIO register.
1347 @return The value written back to the MMIO register.
1361 BitFieldOr8 (MmioRead8 (Address
), StartBit
, EndBit
, OrData
)
1366 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1367 writes the result back to the bit field in the 8-bit MMIO register.
1369 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1370 between the read result and the value specified by AndData, and writes the
1371 result to the 8-bit MMIO register specified by Address. The value written to
1372 the MMIO register is returned. This function must guarantee that all MMIO
1373 read and write operations are serialized. Extra left bits in AndData are
1376 If 8-bit MMIO register operations are not supported, then ASSERT().
1377 If StartBit is greater than 7, then ASSERT().
1378 If EndBit is greater than 7, then ASSERT().
1379 If EndBit is less than StartBit, then ASSERT().
1380 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1382 @param Address The MMIO register to write.
1383 @param StartBit The ordinal of the least significant bit in the bit field.
1385 @param EndBit The ordinal of the most significant bit in the bit field.
1387 @param AndData The value to AND with read value from the MMIO register.
1389 @return The value written back to the MMIO register.
1403 BitFieldAnd8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
)
1408 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1409 by a bitwise OR, and writes the result back to the bit field in the
1410 8-bit MMIO register.
1412 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1413 followed by a bitwise OR between the read result and the value
1414 specified by AndData, and writes the result to the 8-bit MMIO register
1415 specified by Address. The value written to the MMIO register is returned.
1416 This function must guarantee that all MMIO read and write operations are
1417 serialized. Extra left bits in both AndData and OrData are stripped.
1419 If 8-bit MMIO register operations are not supported, then ASSERT().
1420 If StartBit is greater than 7, then ASSERT().
1421 If EndBit is greater than 7, then ASSERT().
1422 If EndBit is less than StartBit, then ASSERT().
1423 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1424 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1426 @param Address The MMIO register to write.
1427 @param StartBit The ordinal of the least significant bit in the bit field.
1429 @param EndBit The ordinal of the most significant bit in the bit field.
1431 @param AndData The value to AND with read value from the MMIO register.
1432 @param OrData The value to OR with the result of the AND operation.
1434 @return The value written back to the MMIO register.
1439 MmioBitFieldAndThenOr8 (
1449 BitFieldAndThenOr8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1454 Reads a 16-bit MMIO register, performs a bitwise OR, and writes the
1455 result back to the 16-bit MMIO register.
1457 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1458 inclusive OR between the read result and the value specified by OrData, and
1459 writes the result to the 16-bit MMIO register specified by Address. The value
1460 written to the MMIO register is returned. This function must guarantee that
1461 all MMIO read and write operations are serialized.
1463 If 16-bit MMIO register operations are not supported, then ASSERT().
1465 @param Address The MMIO register to write.
1466 @param OrData The value to OR with the read value from the MMIO register.
1468 @return The value written back to the MMIO register.
1478 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) | OrData
));
1482 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1483 back to the 16-bit MMIO register.
1485 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1486 between the read result and the value specified by AndData, and writes the
1487 result to the 16-bit MMIO register specified by Address. The value written to
1488 the MMIO register is returned. This function must guarantee that all MMIO
1489 read and write operations are serialized.
1491 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.
1496 @return The value written back to the MMIO register.
1506 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) & AndData
));
1510 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1511 inclusive OR, and writes the result back to the 16-bit MMIO register.
1513 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1514 between the read result and the value specified by AndData, performs a
1515 bitwise OR between the result of the AND operation and the value specified by
1516 OrData, and writes the result to the 16-bit MMIO register specified by
1517 Address. The value written to the MMIO register is returned. This function
1518 must guarantee that all MMIO read and write operations are serialized.
1520 If 16-bit MMIO register operations are not supported, then ASSERT().
1523 @param Address The MMIO register to write.
1524 @param AndData The value to AND with the read value from the MMIO register.
1525 @param OrData The value to OR with the result of the AND operation.
1527 @return The value written back to the MMIO register.
1538 return MmioWrite16 (Address
, (UINT16
) ((MmioRead16 (Address
) & AndData
) | OrData
));
1542 Reads a bit field of a MMIO register.
1544 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
1545 the StartBit and the EndBit. The value of the bit field is returned.
1547 If 16-bit MMIO register operations are not supported, then ASSERT().
1548 If StartBit is greater than 15, then ASSERT().
1549 If EndBit is greater than 15, then ASSERT().
1550 If EndBit is less than StartBit, then ASSERT().
1552 @param Address The MMIO register to read.
1553 @param StartBit The ordinal of the least significant bit in the bit field.
1555 @param EndBit The ordinal of the most significant bit in the bit field.
1558 @return The value read.
1563 MmioBitFieldRead16 (
1569 return BitFieldRead16 (MmioRead16 (Address
), StartBit
, EndBit
);
1573 Writes a bit field to a MMIO register.
1575 Writes Value to the bit field of the MMIO register. The bit field is
1576 specified by the StartBit and the EndBit. All other bits in the destination
1577 MMIO register are preserved. The new value of the 16-bit register is returned.
1579 If 16-bit MMIO register operations are not supported, then ASSERT().
1580 If StartBit is greater than 15, then ASSERT().
1581 If EndBit is greater than 15, then ASSERT().
1582 If EndBit is less than StartBit, then ASSERT().
1583 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1585 @param Address The MMIO register to write.
1586 @param StartBit The ordinal of the least significant bit in the bit field.
1588 @param EndBit The ordinal of the most significant bit in the bit field.
1590 @param Value The new value of the bit field.
1592 @return The value written back to the MMIO register.
1597 MmioBitFieldWrite16 (
1604 return MmioWrite16 (
1606 BitFieldWrite16 (MmioRead16 (Address
), StartBit
, EndBit
, Value
)
1611 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
1612 writes the result back to the bit field in the 16-bit MMIO register.
1614 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1615 inclusive OR between the read result and the value specified by OrData, and
1616 writes the result to the 16-bit MMIO register specified by Address. The value
1617 written to the MMIO register is returned. This function must guarantee that
1618 all MMIO read and write operations are serialized. Extra left bits in OrData
1621 If 16-bit MMIO register operations are not supported, then ASSERT().
1622 If StartBit is greater than 15, then ASSERT().
1623 If EndBit is greater than 15, then ASSERT().
1624 If EndBit is less than StartBit, then ASSERT().
1625 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1627 @param Address The MMIO register to write.
1628 @param StartBit The ordinal of the least significant bit in the bit field.
1630 @param EndBit The ordinal of the most significant bit in the bit field.
1632 @param OrData The value to OR with read value from the MMIO register.
1634 @return The value written back to the MMIO register.
1646 return MmioWrite16 (
1648 BitFieldOr16 (MmioRead16 (Address
), StartBit
, EndBit
, OrData
)
1653 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
1654 writes the result back to the bit field in the 16-bit MMIO register.
1656 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1657 between the read result and the value specified by AndData, and writes the
1658 result to the 16-bit MMIO register specified by Address. The value written to
1659 the MMIO register is returned. This function must guarantee that all MMIO
1660 read and write operations are serialized. Extra left bits in AndData are
1663 If 16-bit MMIO register operations are not supported, then ASSERT().
1664 If StartBit is greater than 15, then ASSERT().
1665 If EndBit is greater than 15, then ASSERT().
1666 If EndBit is less than StartBit, then ASSERT().
1667 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1669 @param Address The MMIO register to write.
1670 @param StartBit The ordinal of the least significant bit in the bit field.
1672 @param EndBit The ordinal of the most significant bit in the bit field.
1674 @param AndData The value to AND with read value from the MMIO register.
1676 @return The value written back to the MMIO register.
1688 return MmioWrite16 (
1690 BitFieldAnd16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
)
1695 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
1696 by a bitwise OR, and writes the result back to the bit field in the
1697 16-bit MMIO register.
1699 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1700 followed by a bitwise OR between the read result and the value
1701 specified by AndData, and writes the result to the 16-bit MMIO register
1702 specified by Address. The value written to the MMIO register is returned.
1703 This function must guarantee that all MMIO read and write operations are
1704 serialized. Extra left bits in both AndData and OrData are stripped.
1706 If 16-bit MMIO register operations are not supported, then ASSERT().
1707 If StartBit is greater than 15, then ASSERT().
1708 If EndBit is greater than 15, then ASSERT().
1709 If EndBit is less than StartBit, then ASSERT().
1710 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1711 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1713 @param Address The MMIO register to write.
1714 @param StartBit The ordinal of the least significant bit in the bit field.
1716 @param EndBit The ordinal of the most significant bit in the bit field.
1718 @param AndData The value to AND with read value from the MMIO register.
1719 @param OrData The value to OR with the result of the AND operation.
1721 @return The value written back to the MMIO register.
1726 MmioBitFieldAndThenOr16 (
1734 return MmioWrite16 (
1736 BitFieldAndThenOr16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1741 Reads a 32-bit MMIO register, performs a bitwise OR, and writes the
1742 result back to the 32-bit MMIO register.
1744 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1745 inclusive OR between the read result and the value specified by OrData, and
1746 writes the result to the 32-bit MMIO register specified by Address. The value
1747 written to the MMIO register is returned. This function must guarantee that
1748 all MMIO read and write operations are serialized.
1750 If 32-bit MMIO register operations are not supported, then ASSERT().
1752 @param Address The MMIO register to write.
1753 @param OrData The value to OR with the read value from the MMIO register.
1755 @return The value written back to the MMIO register.
1765 return MmioWrite32 (Address
, MmioRead32 (Address
) | OrData
);
1769 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
1770 back to the 32-bit MMIO register.
1772 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1773 between the read result and the value specified by AndData, and writes the
1774 result to the 32-bit MMIO register specified by Address. The value written to
1775 the MMIO register is returned. This function must guarantee that all MMIO
1776 read and write operations are serialized.
1778 If 32-bit MMIO register operations are not supported, then ASSERT().
1780 @param Address The MMIO register to write.
1781 @param AndData The value to AND with the read value from the MMIO register.
1783 @return The value written back to the MMIO register.
1793 return MmioWrite32 (Address
, MmioRead32 (Address
) & AndData
);
1797 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
1798 inclusive OR, and writes the result back to the 32-bit MMIO register.
1800 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1801 between the read result and the value specified by AndData, performs a
1802 bitwise OR between the result of the AND operation and the value specified by
1803 OrData, and writes the result to the 32-bit MMIO register specified by
1804 Address. The value written to the MMIO register is returned. This function
1805 must guarantee that all MMIO read and write operations are serialized.
1807 If 32-bit MMIO register operations are not supported, then ASSERT().
1810 @param Address The MMIO register to write.
1811 @param AndData The value to AND with the read value from the MMIO register.
1812 @param OrData The value to OR with the result of the AND operation.
1814 @return The value written back to the MMIO register.
1825 return MmioWrite32 (Address
, (MmioRead32 (Address
) & AndData
) | OrData
);
1829 Reads a bit field of a MMIO register.
1831 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
1832 the StartBit and the EndBit. The value of the bit field is returned.
1834 If 32-bit MMIO register operations are not supported, then ASSERT().
1835 If StartBit is greater than 31, then ASSERT().
1836 If EndBit is greater than 31, then ASSERT().
1837 If EndBit is less than StartBit, then ASSERT().
1839 @param Address The MMIO register to read.
1840 @param StartBit The ordinal of the least significant bit in the bit field.
1842 @param EndBit The ordinal of the most significant bit in the bit field.
1845 @return The value read.
1850 MmioBitFieldRead32 (
1856 return BitFieldRead32 (MmioRead32 (Address
), StartBit
, EndBit
);
1860 Writes a bit field to a MMIO register.
1862 Writes Value to the bit field of the MMIO register. The bit field is
1863 specified by the StartBit and the EndBit. All other bits in the destination
1864 MMIO register are preserved. The new value of the 32-bit register is returned.
1866 If 32-bit MMIO register operations are not supported, then ASSERT().
1867 If StartBit is greater than 31, then ASSERT().
1868 If EndBit is greater than 31, then ASSERT().
1869 If EndBit is less than StartBit, then ASSERT().
1870 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1872 @param Address The MMIO register to write.
1873 @param StartBit The ordinal of the least significant bit in the bit field.
1875 @param EndBit The ordinal of the most significant bit in the bit field.
1877 @param Value The new value of the bit field.
1879 @return The value written back to the MMIO register.
1884 MmioBitFieldWrite32 (
1891 return MmioWrite32 (
1893 BitFieldWrite32 (MmioRead32 (Address
), StartBit
, EndBit
, Value
)
1898 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
1899 writes the result back to the bit field in the 32-bit MMIO register.
1901 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1902 inclusive OR between the read result and the value specified by OrData, and
1903 writes the result to the 32-bit MMIO register specified by Address. The value
1904 written to the MMIO register is returned. This function must guarantee that
1905 all MMIO read and write operations are serialized. Extra left bits in OrData
1908 If 32-bit MMIO register operations are not supported, then ASSERT().
1909 If StartBit is greater than 31, then ASSERT().
1910 If EndBit is greater than 31, then ASSERT().
1911 If EndBit is less than StartBit, then ASSERT().
1912 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1914 @param Address The MMIO register to write.
1915 @param StartBit The ordinal of the least significant bit in the bit field.
1917 @param EndBit The ordinal of the most significant bit in the bit field.
1919 @param OrData The value to OR with read value from the MMIO register.
1921 @return The value written back to the MMIO register.
1933 return MmioWrite32 (
1935 BitFieldOr32 (MmioRead32 (Address
), StartBit
, EndBit
, OrData
)
1940 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
1941 writes the result back to the bit field in the 32-bit MMIO register.
1943 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1944 between the read result and the value specified by AndData, and writes the
1945 result to the 32-bit MMIO register specified by Address. The value written to
1946 the MMIO register is returned. This function must guarantee that all MMIO
1947 read and write operations are serialized. Extra left bits in AndData are
1950 If 32-bit MMIO register operations are not supported, then ASSERT().
1951 If StartBit is greater than 31, then ASSERT().
1952 If EndBit is greater than 31, then ASSERT().
1953 If EndBit is less than StartBit, then ASSERT().
1954 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1956 @param Address The MMIO register to write.
1957 @param StartBit The ordinal of the least significant bit in the bit field.
1959 @param EndBit The ordinal of the most significant bit in the bit field.
1961 @param AndData The value to AND with read value from the MMIO register.
1963 @return The value written back to the MMIO register.
1975 return MmioWrite32 (
1977 BitFieldAnd32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
)
1982 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
1983 by a bitwise OR, and writes the result back to the bit field in the
1984 32-bit MMIO register.
1986 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1987 followed by a bitwise OR between the read result and the value
1988 specified by AndData, and writes the result to the 32-bit MMIO register
1989 specified by Address. The value written to the MMIO register is returned.
1990 This function must guarantee that all MMIO read and write operations are
1991 serialized. Extra left bits in both AndData and OrData are stripped.
1993 If 32-bit MMIO register operations are not supported, then ASSERT().
1994 If StartBit is greater than 31, then ASSERT().
1995 If EndBit is greater than 31, then ASSERT().
1996 If EndBit is less than StartBit, then ASSERT().
1997 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1998 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2000 @param Address The MMIO register to write.
2001 @param StartBit The ordinal of the least significant bit in the bit field.
2003 @param EndBit The ordinal of the most significant bit in the bit field.
2005 @param AndData The value to AND with read value from the MMIO register.
2006 @param OrData The value to OR with the result of the AND operation.
2008 @return The value written back to the MMIO register.
2013 MmioBitFieldAndThenOr32 (
2021 return MmioWrite32 (
2023 BitFieldAndThenOr32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
, OrData
)
2028 Reads a 64-bit MMIO register, performs a bitwise OR, and writes the
2029 result back to the 64-bit MMIO register.
2031 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2032 inclusive OR between the read result and the value specified by OrData, and
2033 writes the result to the 64-bit MMIO register specified by Address. The value
2034 written to the MMIO register is returned. This function must guarantee that
2035 all MMIO read and write operations are serialized.
2037 If 64-bit MMIO register operations are not supported, then ASSERT().
2039 @param Address The MMIO register to write.
2040 @param OrData The value to OR with the read value from the MMIO register.
2042 @return The value written back to the MMIO register.
2052 return MmioWrite64 (Address
, MmioRead64 (Address
) | OrData
);
2056 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2057 back to the 64-bit MMIO register.
2059 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2060 between the read result and the value specified by AndData, and writes the
2061 result to the 64-bit MMIO register specified by Address. The value written to
2062 the MMIO register is returned. This function must guarantee that all MMIO
2063 read and write operations are serialized.
2065 If 64-bit MMIO register operations are not supported, then ASSERT().
2067 @param Address The MMIO register to write.
2068 @param AndData The value to AND with the read value from the MMIO register.
2070 @return The value written back to the MMIO register.
2080 return MmioWrite64 (Address
, MmioRead64 (Address
) & AndData
);
2084 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2085 inclusive OR, and writes the result back to the 64-bit MMIO register.
2087 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2088 between the read result and the value specified by AndData, performs a
2089 bitwise OR between the result of the AND operation and the value specified by
2090 OrData, and writes the result to the 64-bit MMIO register specified by
2091 Address. The value written to the MMIO register is returned. This function
2092 must guarantee that all MMIO read and write operations are serialized.
2094 If 64-bit MMIO register operations are not supported, then ASSERT().
2097 @param Address The MMIO register to write.
2098 @param AndData The value to AND with the read value from the MMIO register.
2099 @param OrData The value to OR with the result of the AND operation.
2101 @return The value written back to the MMIO register.
2112 return MmioWrite64 (Address
, (MmioRead64 (Address
) & AndData
) | OrData
);
2116 Reads a bit field of a MMIO register.
2118 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2119 the StartBit and the EndBit. The value of the bit field is returned.
2121 If 64-bit MMIO register operations are not supported, then ASSERT().
2122 If StartBit is greater than 63, then ASSERT().
2123 If EndBit is greater than 63, then ASSERT().
2124 If EndBit is less than StartBit, then ASSERT().
2126 @param Address The MMIO register to read.
2127 @param StartBit The ordinal of the least significant bit in the bit field.
2129 @param EndBit The ordinal of the most significant bit in the bit field.
2132 @return The value read.
2137 MmioBitFieldRead64 (
2143 return BitFieldRead64 (MmioRead64 (Address
), StartBit
, EndBit
);
2147 Writes a bit field to a MMIO register.
2149 Writes Value to the bit field of the MMIO register. The bit field is
2150 specified by the StartBit and the EndBit. All other bits in the destination
2151 MMIO register are preserved. The new value of the 64-bit register is returned.
2153 If 64-bit MMIO register operations are not supported, then ASSERT().
2154 If StartBit is greater than 63, then ASSERT().
2155 If EndBit is greater than 63, then ASSERT().
2156 If EndBit is less than StartBit, then ASSERT().
2157 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2159 @param Address The 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 Value The new value of the bit field.
2166 @return The value written back to the MMIO register.
2171 MmioBitFieldWrite64 (
2178 return MmioWrite64 (
2180 BitFieldWrite64 (MmioRead64 (Address
), StartBit
, EndBit
, Value
)
2185 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, 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
2189 inclusive OR between the read result and the value specified by OrData, and
2190 writes the result to the 64-bit MMIO register specified by Address. The value
2191 written to the MMIO register is returned. This function must guarantee that
2192 all MMIO read and write operations are serialized. Extra left bits in OrData
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().
2199 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2201 @param Address The MMIO register to write.
2202 @param StartBit The ordinal of the least significant bit in the bit field.
2204 @param EndBit The ordinal of the most significant bit in the bit field.
2206 @param OrData The value to OR with read value from the MMIO register.
2208 @return The value written back to the MMIO register.
2220 return MmioWrite64 (
2222 BitFieldOr64 (MmioRead64 (Address
), StartBit
, EndBit
, OrData
)
2227 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2228 writes the result back to the bit field in the 64-bit MMIO register.
2230 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2231 between the read result and the value specified by AndData, and writes the
2232 result to the 64-bit MMIO register specified by Address. The value written to
2233 the MMIO register is returned. This function must guarantee that all MMIO
2234 read and write operations are serialized. Extra left bits in AndData are
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().
2241 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2243 @param Address The MMIO register to write.
2244 @param StartBit The ordinal of the least significant bit in the bit field.
2246 @param EndBit The ordinal of the most significant bit in the bit field.
2248 @param AndData The value to AND with read value from the MMIO register.
2250 @return The value written back to the MMIO register.
2262 return MmioWrite64 (
2264 BitFieldAnd64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
)
2269 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2270 by a bitwise OR, and writes the result back to the bit field in the
2271 64-bit MMIO register.
2273 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2274 followed by a bitwise OR between the read result and the value
2275 specified by AndData, and writes the result to the 64-bit MMIO register
2276 specified by Address. The value written to the MMIO register is returned.
2277 This function must guarantee that all MMIO read and write operations are
2278 serialized. Extra left bits in both AndData and OrData are stripped.
2280 If 64-bit MMIO register operations are not supported, then ASSERT().
2281 If StartBit is greater than 63, then ASSERT().
2282 If EndBit is greater than 63, then ASSERT().
2283 If EndBit is less than StartBit, then ASSERT().
2284 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2285 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2287 @param Address The MMIO register to write.
2288 @param StartBit The ordinal of the least significant bit in the bit field.
2290 @param EndBit The ordinal of the most significant bit in the bit field.
2292 @param AndData The value to AND with read value from the MMIO register.
2293 @param OrData The value to OR with the result of the AND operation.
2295 @return The value written back to the MMIO register.
2300 MmioBitFieldAndThenOr64 (
2308 return MmioWrite64 (
2310 BitFieldAndThenOr64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
, OrData
)