]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c
2 High-level Io/Mmio functions.
4 All assertions for bit field operations are handled bit field functions in the
7 Copyright (c) 2006, Intel Corporation<BR>
8 All rights reserved. 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:
25 // The package level header files this module uses
29 // The Library classes this module consumes
31 #include <Library/IoLib.h>
32 #include <Library/DebugLib.h>
33 #include <Library/BaseLib.h>
34 #include <Library/PeiServicesTablePointerLib.h>
37 Reads an 8-bit I/O port, performs a bitwise inclusive OR, and writes the
38 result back to the 8-bit I/O port.
40 Reads the 8-bit I/O port specified by Port, performs a bitwise inclusive OR
41 between the read result and the value specified by OrData, and writes the
42 result to the 8-bit I/O port specified by Port. The value written to the I/O
43 port is returned. This function must guarantee that all I/O read and write
44 operations are serialized.
46 If 8-bit I/O port operations are not supported, then ASSERT().
48 @param Port The I/O port to write.
49 @param OrData The value to OR with the read value from the I/O port.
51 @return The value written back to the I/O port.
61 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) | OrData
));
65 Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
66 to the 8-bit I/O port.
68 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
69 the read result and the value specified by AndData, and writes the result to
70 the 8-bit I/O port specified by Port. The value written to the I/O port is
71 returned. This function must guarantee that all I/O read and write operations
74 If 8-bit I/O port operations are not supported, then ASSERT().
76 @param Port The I/O port to write.
77 @param AndData The value to AND with the read value from the I/O port.
79 @return The value written back to the I/O port.
89 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) & AndData
));
93 Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
94 inclusive OR, and writes the result back to the 8-bit I/O port.
96 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
97 the read result and the value specified by AndData, performs a bitwise OR
98 between the result of the AND operation and the value specified by OrData,
99 and writes the result to the 8-bit I/O port specified by Port. The value
100 written to the I/O port is returned. This function must guarantee that all
101 I/O read and write operations are serialized.
103 If 8-bit I/O port operations are not supported, then ASSERT().
105 @param Port The I/O port to write.
106 @param AndData The value to AND with the read value from the I/O port.
107 @param OrData The value to OR with the result of the AND operation.
109 @return The value written back to the I/O port.
120 return IoWrite8 (Port
, (UINT8
) ((IoRead8 (Port
) & AndData
) | OrData
));
124 Reads a bit field of an I/O register.
126 Reads the bit field in an 8-bit I/O register. The bit field is specified by
127 the StartBit and the EndBit. The value of the bit field is returned.
129 If 8-bit I/O port operations are not supported, then ASSERT().
130 If StartBit is greater than 7, then ASSERT().
131 If EndBit is greater than 7, then ASSERT().
132 If EndBit is less than StartBit, then ASSERT().
134 @param Port The I/O port to read.
135 @param StartBit The ordinal of the least significant bit in the bit field.
137 @param EndBit The ordinal of the most significant bit in the bit field.
140 @return The value read.
151 return BitFieldRead8 (IoRead8 (Port
), StartBit
, EndBit
);
155 Writes a bit field to an I/O register.
157 Writes Value to the bit field of the I/O register. The bit field is specified
158 by the StartBit and the EndBit. All other bits in the destination I/O
159 register are preserved. The value written to the I/O port is returned. Extra
160 left bits in Value are stripped.
162 If 8-bit I/O port operations are not supported, then ASSERT().
163 If StartBit is greater than 7, then ASSERT().
164 If EndBit is greater than 7, then ASSERT().
165 If EndBit is less than StartBit, then ASSERT().
167 @param Port The I/O port to write.
168 @param StartBit The ordinal of the least significant bit in the bit field.
170 @param EndBit The ordinal of the most significant bit in the bit field.
172 @param Value New value of the bit field.
174 @return The value written back to the I/O port.
188 BitFieldWrite8 (IoRead8 (Port
), StartBit
, EndBit
, Value
)
193 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
194 result back to the bit field in the 8-bit port.
196 Reads the 8-bit I/O port specified by Port, performs a bitwise inclusive OR
197 between the read result and the value specified by OrData, and writes the
198 result to the 8-bit I/O port specified by Port. The value written to the I/O
199 port is returned. This function must guarantee that all I/O read and write
200 operations are serialized. Extra left bits in OrData are stripped.
202 If 8-bit I/O port operations are not supported, then ASSERT().
203 If StartBit is greater than 7, then ASSERT().
204 If EndBit is greater than 7, then ASSERT().
205 If EndBit is less than StartBit, then ASSERT().
207 @param Port The I/O port to write.
208 @param StartBit The ordinal of the least significant bit in the bit field.
210 @param EndBit The ordinal of the most significant bit in the bit field.
212 @param OrData The value to OR with the read value from the I/O port.
214 @return The value written back to the I/O port.
228 BitFieldOr8 (IoRead8 (Port
), StartBit
, EndBit
, OrData
)
233 Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
234 result back to the bit field in the 8-bit port.
236 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
237 the read result and the value specified by AndData, and writes the result to
238 the 8-bit I/O port specified by Port. The value written to the I/O port is
239 returned. This function must guarantee that all I/O read and write operations
240 are serialized. Extra left bits in AndData are stripped.
242 If 8-bit I/O port operations are not supported, then ASSERT().
243 If StartBit is greater than 7, then ASSERT().
244 If EndBit is greater than 7, then ASSERT().
245 If EndBit is less than StartBit, then ASSERT().
247 @param Port The I/O port to write.
248 @param StartBit The ordinal of the least significant bit in the bit field.
250 @param EndBit The ordinal of the most significant bit in the bit field.
252 @param AndData The value to AND with the read value from the I/O port.
254 @return The value written back to the I/O port.
268 BitFieldAnd8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
)
273 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
274 bitwise inclusive OR, and writes the result back to the bit field in the
277 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
278 by a bitwise inclusive OR between the read result and the value specified by
279 AndData, and writes the result to the 8-bit I/O port specified by Port. The
280 value written to the I/O port is returned. This function must guarantee that
281 all I/O read and write operations are serialized. Extra left bits in both
282 AndData and OrData are stripped.
284 If 8-bit I/O port operations are not supported, then ASSERT().
285 If StartBit is greater than 7, then ASSERT().
286 If EndBit is greater than 7, then ASSERT().
287 If EndBit is less than StartBit, then ASSERT().
289 @param Port The I/O port to write.
290 @param StartBit The ordinal of the least significant bit in the bit field.
292 @param EndBit The ordinal of the most significant bit in the bit field.
294 @param AndData The value to AND with the read value from the I/O port.
295 @param OrData The value to OR with the result of the AND operation.
297 @return The value written back to the I/O port.
302 IoBitFieldAndThenOr8 (
312 BitFieldAndThenOr8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
, OrData
)
317 Reads a 16-bit I/O port, performs a bitwise inclusive OR, and writes the
318 result back to the 16-bit I/O port.
320 Reads the 16-bit I/O port specified by Port, performs a bitwise inclusive OR
321 between the read result and the value specified by OrData, and writes the
322 result to the 16-bit I/O port specified by Port. The value written to the I/O
323 port is returned. This function must guarantee that all I/O read and write
324 operations are serialized.
326 If 16-bit I/O port operations are not supported, then ASSERT().
328 @param Port The I/O port to write.
329 @param OrData The value to OR with the read value from the I/O port.
331 @return The value written back to the I/O port.
341 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) | OrData
));
345 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
346 to the 16-bit I/O port.
348 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
349 the read result and the value specified by AndData, and writes the result to
350 the 16-bit I/O port specified by Port. The value written to the I/O port is
351 returned. This function must guarantee that all I/O read and write operations
354 If 16-bit I/O port operations are not supported, then ASSERT().
356 @param Port The I/O port to write.
357 @param AndData The value to AND with the read value from the I/O port.
359 @return The value written back to the I/O port.
369 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) & AndData
));
373 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
374 inclusive OR, and writes the result back to the 16-bit I/O port.
376 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
377 the read result and the value specified by AndData, performs a bitwise OR
378 between the result of the AND operation and the value specified by OrData,
379 and writes the result to the 16-bit I/O port specified by Port. The value
380 written to the I/O port is returned. This function must guarantee that all
381 I/O read and write operations are serialized.
383 If 16-bit I/O port operations are not supported, then ASSERT().
385 @param Port The I/O port to write.
386 @param AndData The value to AND with the read value from the I/O port.
387 @param OrData The value to OR with the result of the AND operation.
389 @return The value written back to the I/O port.
400 return IoWrite16 (Port
, (UINT16
) ((IoRead16 (Port
) & AndData
) | OrData
));
404 Reads a bit field of an I/O register.
406 Reads the bit field in a 16-bit I/O register. The bit field is specified by
407 the StartBit and the EndBit. The value of the bit field is returned.
409 If 16-bit I/O port operations are not supported, then ASSERT().
410 If StartBit is greater than 15, then ASSERT().
411 If EndBit is greater than 15, then ASSERT().
412 If EndBit is less than StartBit, then ASSERT().
414 @param Port The I/O port to read.
415 @param StartBit The ordinal of the least significant bit in the bit field.
417 @param EndBit The ordinal of the most significant bit in the bit field.
420 @return The value read.
431 return BitFieldRead16 (IoRead16 (Port
), StartBit
, EndBit
);
435 Writes a bit field to an I/O register.
437 Writes Value to the bit field of the I/O register. The bit field is specified
438 by the StartBit and the EndBit. All other bits in the destination I/O
439 register are preserved. The value written to the I/O port is returned. Extra
440 left bits in Value are stripped.
442 If 16-bit I/O port operations are not supported, then ASSERT().
443 If StartBit is greater than 15, then ASSERT().
444 If EndBit is greater than 15, then ASSERT().
445 If EndBit is less than StartBit, then ASSERT().
447 @param Port The I/O port to write.
448 @param StartBit The ordinal of the least significant bit in the bit field.
450 @param EndBit The ordinal of the most significant bit in the bit field.
452 @param Value New value of the bit field.
454 @return The value written back to the I/O port.
468 BitFieldWrite16 (IoRead16 (Port
), StartBit
, EndBit
, Value
)
473 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
474 result back to the bit field in the 16-bit port.
476 Reads the 16-bit I/O port specified by Port, performs a bitwise inclusive OR
477 between the read result and the value specified by OrData, and writes the
478 result to the 16-bit I/O port specified by Port. The value written to the I/O
479 port is returned. This function must guarantee that all I/O read and write
480 operations are serialized. Extra left bits in OrData are stripped.
482 If 16-bit I/O port operations are not supported, then ASSERT().
483 If StartBit is greater than 15, then ASSERT().
484 If EndBit is greater than 15, then ASSERT().
485 If EndBit is less than StartBit, then ASSERT().
487 @param Port The I/O port to write.
488 @param StartBit The ordinal of the least significant bit in the bit field.
490 @param EndBit The ordinal of the most significant bit in the bit field.
492 @param OrData The value to OR with the read value from the I/O port.
494 @return The value written back to the I/O port.
508 BitFieldOr16 (IoRead16 (Port
), StartBit
, EndBit
, OrData
)
513 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
514 result back to the bit field in the 16-bit port.
516 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
517 the read result and the value specified by AndData, and writes the result to
518 the 16-bit I/O port specified by Port. The value written to the I/O port is
519 returned. This function must guarantee that all I/O read and write operations
520 are serialized. Extra left bits in AndData are stripped.
522 If 16-bit I/O port operations are not supported, then ASSERT().
523 If StartBit is greater than 15, then ASSERT().
524 If EndBit is greater than 15, then ASSERT().
525 If EndBit is less than StartBit, then ASSERT().
527 @param Port The I/O port to write.
528 @param StartBit The ordinal of the least significant bit in the bit field.
530 @param EndBit The ordinal of the most significant bit in the bit field.
532 @param AndData The value to AND with the read value from the I/O port.
534 @return The value written back to the I/O port.
548 BitFieldAnd16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
)
553 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
554 bitwise inclusive OR, and writes the result back to the bit field in the
557 Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
558 by a bitwise inclusive OR between the read result and the value specified by
559 AndData, and writes the result to the 16-bit I/O port specified by Port. The
560 value written to the I/O port is returned. This function must guarantee that
561 all I/O read and write operations are serialized. Extra left bits in both
562 AndData and OrData are stripped.
564 If 16-bit I/O port operations are not supported, then ASSERT().
565 If StartBit is greater than 15, then ASSERT().
566 If EndBit is greater than 15, then ASSERT().
567 If EndBit is less than StartBit, 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 inclusive 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 inclusive 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().
727 @param Port The I/O port to write.
728 @param StartBit The ordinal of the least significant bit in the bit field.
730 @param EndBit The ordinal of the most significant bit in the bit field.
732 @param Value New value of the bit field.
734 @return The value written back to the I/O port.
748 BitFieldWrite32 (IoRead32 (Port
), StartBit
, EndBit
, Value
)
753 Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the
754 result back to the bit field in the 32-bit port.
756 Reads the 32-bit I/O port specified by Port, performs a bitwise inclusive OR
757 between the read result and the value specified by OrData, and writes the
758 result to the 32-bit I/O port specified by Port. The value written to the I/O
759 port is returned. This function must guarantee that all I/O read and write
760 operations are serialized. Extra left bits in OrData are stripped.
762 If 32-bit I/O port operations are not supported, then ASSERT().
763 If StartBit is greater than 31, then ASSERT().
764 If EndBit is greater than 31, then ASSERT().
765 If EndBit is less than StartBit, then ASSERT().
767 @param Port The I/O port to write.
768 @param StartBit The ordinal of the least significant bit in the bit field.
770 @param EndBit The ordinal of the most significant bit in the bit field.
772 @param OrData The value to OR with the read value from the I/O port.
774 @return The value written back to the I/O port.
788 BitFieldOr32 (IoRead32 (Port
), StartBit
, EndBit
, OrData
)
793 Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
794 result back to the bit field in the 32-bit port.
796 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
797 the read result and the value specified by AndData, and writes the result to
798 the 32-bit I/O port specified by Port. The value written to the I/O port is
799 returned. This function must guarantee that all I/O read and write operations
800 are serialized. Extra left bits in AndData are stripped.
802 If 32-bit I/O port operations are not supported, then ASSERT().
803 If StartBit is greater than 31, then ASSERT().
804 If EndBit is greater than 31, then ASSERT().
805 If EndBit is less than StartBit, then ASSERT().
807 @param Port The I/O port to write.
808 @param StartBit The ordinal of the least significant bit in the bit field.
810 @param EndBit The ordinal of the most significant bit in the bit field.
812 @param AndData The value to AND with the read value from the I/O port.
814 @return The value written back to the I/O port.
828 BitFieldAnd32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
)
833 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
834 bitwise inclusive OR, and writes the result back to the bit field in the
837 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
838 by a bitwise inclusive OR between the read result and the value specified by
839 AndData, and writes the result to the 32-bit I/O port specified by Port. The
840 value written to the I/O port is returned. This function must guarantee that
841 all I/O read and write operations are serialized. Extra left bits in both
842 AndData and OrData are stripped.
844 If 32-bit I/O port operations are not supported, then ASSERT().
845 If StartBit is greater than 31, then ASSERT().
846 If EndBit is greater than 31, then ASSERT().
847 If EndBit is less than StartBit, then ASSERT().
849 @param Port The I/O port to write.
850 @param StartBit The ordinal of the least significant bit in the bit field.
852 @param EndBit The ordinal of the most significant bit in the bit field.
854 @param AndData The value to AND with the read value from the I/O port.
855 @param OrData The value to OR with the result of the AND operation.
857 @return The value written back to the I/O port.
862 IoBitFieldAndThenOr32 (
872 BitFieldAndThenOr32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
, OrData
)
877 Reads a 64-bit I/O port, performs a bitwise inclusive OR, and writes the
878 result back to the 64-bit I/O port.
880 Reads the 64-bit I/O port specified by Port, performs a bitwise inclusive OR
881 between the read result and the value specified by OrData, and writes the
882 result to the 64-bit I/O port specified by Port. The value written to the I/O
883 port is returned. This function must guarantee that all I/O read and write
884 operations are serialized.
886 If 64-bit I/O port operations are not supported, then ASSERT().
888 @param Port The I/O port to write.
889 @param OrData The value to OR with the read value from the I/O port.
891 @return The value written back to the I/O port.
901 return IoWrite64 (Port
, IoRead64 (Port
) | OrData
);
905 Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
906 to the 64-bit I/O port.
908 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
909 the read result and the value specified by AndData, and writes the result to
910 the 64-bit I/O port specified by Port. The value written to the I/O port is
911 returned. This function must guarantee that all I/O read and write operations
914 If 64-bit I/O port operations are not supported, then ASSERT().
916 @param Port The I/O port to write.
917 @param AndData The value to AND with the read value from the I/O port.
919 @return The value written back to the I/O port.
929 return IoWrite64 (Port
, IoRead64 (Port
) & AndData
);
933 Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
934 inclusive OR, and writes the result back to the 64-bit I/O port.
936 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
937 the read result and the value specified by AndData, performs a bitwise OR
938 between the result of the AND operation and the value specified by OrData,
939 and writes the result to the 64-bit I/O port specified by Port. The value
940 written to the I/O port is returned. This function must guarantee that all
941 I/O read and write operations are serialized.
943 If 64-bit I/O port operations are not supported, then ASSERT().
945 @param Port The I/O port to write.
946 @param AndData The value to AND with the read value from the I/O port.
947 @param OrData The value to OR with the result of the AND operation.
949 @return The value written back to the I/O port.
960 return IoWrite64 (Port
, (IoRead64 (Port
) & AndData
) | OrData
);
964 Reads a bit field of an I/O register.
966 Reads the bit field in a 64-bit I/O register. The bit field is specified by
967 the StartBit and the EndBit. The value of the bit field is returned.
969 If 64-bit I/O port operations are not supported, then ASSERT().
970 If StartBit is greater than 63, then ASSERT().
971 If EndBit is greater than 63, then ASSERT().
972 If EndBit is less than StartBit, then ASSERT().
974 @param Port The I/O port to read.
975 @param StartBit The ordinal of the least significant bit in the bit field.
977 @param EndBit The ordinal of the most significant bit in the bit field.
980 @return The value read.
991 return BitFieldRead64 (IoRead64 (Port
), StartBit
, EndBit
);
995 Writes a bit field to an I/O register.
997 Writes Value to the bit field of the I/O register. The bit field is specified
998 by the StartBit and the EndBit. All other bits in the destination I/O
999 register are preserved. The value written to the I/O port is returned. Extra
1000 left bits in Value are stripped.
1002 If 64-bit I/O port operations are not supported, then ASSERT().
1003 If StartBit is greater than 63, then ASSERT().
1004 If EndBit is greater than 63, then ASSERT().
1005 If EndBit is less than StartBit, then ASSERT().
1007 @param Port The I/O port to write.
1008 @param StartBit The ordinal of the least significant bit in the bit field.
1010 @param EndBit The ordinal of the most significant bit in the bit field.
1012 @param Value New value of the bit field.
1014 @return The value written back to the I/O port.
1028 BitFieldWrite64 (IoRead64 (Port
), StartBit
, EndBit
, Value
)
1033 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1034 result back to the bit field in the 64-bit port.
1036 Reads the 64-bit I/O port specified by Port, performs a bitwise inclusive OR
1037 between the read result and the value specified by OrData, and writes the
1038 result to the 64-bit I/O port specified by Port. The value written to the I/O
1039 port is returned. This function must guarantee that all I/O read and write
1040 operations are serialized. Extra left bits in OrData are stripped.
1042 If 64-bit I/O port operations are not supported, then ASSERT().
1043 If StartBit is greater than 63, then ASSERT().
1044 If EndBit is greater than 63, then ASSERT().
1045 If EndBit is less than StartBit, then ASSERT().
1047 @param Port The I/O port to write.
1048 @param StartBit The ordinal of the least significant bit in the bit field.
1050 @param EndBit The ordinal of the most significant bit in the bit field.
1052 @param OrData The value to OR with the read value from the I/O port.
1054 @return The value written back to the I/O port.
1068 BitFieldOr64 (IoRead64 (Port
), StartBit
, EndBit
, OrData
)
1073 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1074 result back to the bit field in the 64-bit port.
1076 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1077 the read result and the value specified by AndData, and writes the result to
1078 the 64-bit I/O port specified by Port. The value written to the I/O port is
1079 returned. This function must guarantee that all I/O read and write operations
1080 are serialized. Extra left bits in AndData are stripped.
1082 If 64-bit I/O port operations are not supported, then ASSERT().
1083 If StartBit is greater than 63, then ASSERT().
1084 If EndBit is greater than 63, then ASSERT().
1085 If EndBit is less than StartBit, then ASSERT().
1087 @param Port The I/O port to write.
1088 @param StartBit The ordinal of the least significant bit in the bit field.
1090 @param EndBit The ordinal of the most significant bit in the bit field.
1092 @param AndData The value to AND with the read value from the I/O port.
1094 @return The value written back to the I/O port.
1108 BitFieldAnd64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
)
1113 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
1114 bitwise inclusive OR, and writes the result back to the bit field in the
1117 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
1118 by a bitwise inclusive OR between the read result and the value specified by
1119 AndData, and writes the result to the 64-bit I/O port specified by Port. The
1120 value written to the I/O port is returned. This function must guarantee that
1121 all I/O read and write operations are serialized. Extra left bits in both
1122 AndData and OrData are stripped.
1124 If 64-bit I/O port operations are not supported, then ASSERT().
1125 If StartBit is greater than 63, then ASSERT().
1126 If EndBit is greater than 63, then ASSERT().
1127 If EndBit is less than StartBit, then ASSERT().
1129 @param Port The I/O port to write.
1130 @param StartBit The ordinal of the least significant bit in the bit field.
1132 @param EndBit The ordinal of the most significant bit in the bit field.
1134 @param AndData The value to AND with the read value from the I/O port.
1135 @param OrData The value to OR with the result of the AND operation.
1137 @return The value written back to the I/O port.
1142 IoBitFieldAndThenOr64 (
1152 BitFieldAndThenOr64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
, OrData
)
1157 Reads an 8-bit MMIO register, performs a bitwise inclusive OR, and writes the
1158 result back to the 8-bit MMIO register.
1160 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1161 inclusive OR between the read result and the value specified by OrData, and
1162 writes the result to the 8-bit MMIO register specified by Address. The value
1163 written to the MMIO register is returned. This function must guarantee that
1164 all MMIO read and write operations are serialized.
1166 If 8-bit MMIO register operations are not supported, then ASSERT().
1168 @param Address The MMIO register to write.
1169 @param OrData The value to OR with the read value from the MMIO register.
1171 @return The value written back to the MMIO register.
1181 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) | OrData
));
1185 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1186 back to the 8-bit MMIO register.
1188 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1189 between the read result and the value specified by AndData, and writes the
1190 result to the 8-bit MMIO register specified by Address. The value written to
1191 the MMIO register is returned. This function must guarantee that all MMIO
1192 read and write operations are serialized.
1194 If 8-bit MMIO register operations are not supported, then ASSERT().
1196 @param Address The MMIO register to write.
1197 @param AndData The value to AND with the read value from the MMIO register.
1199 @return The value written back to the MMIO register.
1209 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) & AndData
));
1213 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1214 inclusive OR, and writes the result back to the 8-bit MMIO register.
1216 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1217 between the read result and the value specified by AndData, performs a
1218 bitwise OR between the result of the AND operation and the value specified by
1219 OrData, and writes the result to the 8-bit MMIO register specified by
1220 Address. The value written to the MMIO register is returned. This function
1221 must guarantee that all MMIO read and write operations are serialized.
1223 If 8-bit MMIO register operations are not supported, then ASSERT().
1226 @param Address The MMIO register to write.
1227 @param AndData The value to AND with the read value from the MMIO register.
1228 @param OrData The value to OR with the result of the AND operation.
1230 @return The value written back to the MMIO register.
1241 return MmioWrite8 (Address
, (UINT8
) ((MmioRead8 (Address
) & AndData
) | OrData
));
1245 Reads a bit field of a MMIO register.
1247 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1248 the StartBit and the EndBit. The value of the bit field is returned.
1250 If 8-bit MMIO register operations are not supported, then ASSERT().
1251 If StartBit is greater than 7, then ASSERT().
1252 If EndBit is greater than 7, then ASSERT().
1253 If EndBit is less than StartBit, then ASSERT().
1255 @param Address MMIO register to read.
1256 @param StartBit The ordinal of the least significant bit in the bit field.
1258 @param EndBit The ordinal of the most significant bit in the bit field.
1261 @return The value read.
1272 return BitFieldRead8 (MmioRead8 (Address
), StartBit
, EndBit
);
1276 Writes a bit field to a MMIO register.
1278 Writes Value to the bit field of the MMIO register. The bit field is
1279 specified by the StartBit and the EndBit. All other bits in the destination
1280 MMIO register are preserved. The new value of the 8-bit register is returned.
1282 If 8-bit MMIO register operations are not supported, then ASSERT().
1283 If StartBit is greater than 7, then ASSERT().
1284 If EndBit is greater than 7, then ASSERT().
1285 If EndBit is less than StartBit, then ASSERT().
1287 @param Address MMIO register to write.
1288 @param StartBit The ordinal of the least significant bit in the bit field.
1290 @param EndBit The ordinal of the most significant bit in the bit field.
1292 @param Value New value of the bit field.
1294 @return The value written back to the MMIO register.
1299 MmioBitFieldWrite8 (
1308 BitFieldWrite8 (MmioRead8 (Address
), StartBit
, EndBit
, Value
)
1313 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1314 writes the result back to the bit field in the 8-bit MMIO register.
1316 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1317 inclusive OR between the read result and the value specified by OrData, and
1318 writes the result to the 8-bit MMIO register specified by Address. The value
1319 written to the MMIO register is returned. This function must guarantee that
1320 all MMIO read and write operations are serialized. Extra left bits in OrData
1323 If 8-bit MMIO register operations are not supported, then ASSERT().
1324 If StartBit is greater than 7, then ASSERT().
1325 If EndBit is greater than 7, then ASSERT().
1326 If EndBit is less than StartBit, then ASSERT().
1328 @param Address MMIO register to write.
1329 @param StartBit The ordinal of the least significant bit in the bit field.
1331 @param EndBit The ordinal of the most significant bit in the bit field.
1333 @param OrData The value to OR with read value from the MMIO register.
1335 @return The value written back to the MMIO register.
1349 BitFieldOr8 (MmioRead8 (Address
), StartBit
, EndBit
, OrData
)
1354 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1355 writes the result back to the bit field in the 8-bit MMIO register.
1357 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1358 between the read result and the value specified by AndData, and writes the
1359 result to the 8-bit MMIO register specified by Address. The value written to
1360 the MMIO register is returned. This function must guarantee that all MMIO
1361 read and write operations are serialized. Extra left bits in AndData are
1364 If 8-bit MMIO register operations are not supported, then ASSERT().
1365 If StartBit is greater than 7, then ASSERT().
1366 If EndBit is greater than 7, then ASSERT().
1367 If EndBit is less than StartBit, then ASSERT().
1369 @param Address MMIO register to write.
1370 @param StartBit The ordinal of the least significant bit in the bit field.
1372 @param EndBit The ordinal of the most significant bit in the bit field.
1374 @param AndData The value to AND with read value from the MMIO register.
1376 @return The value written back to the MMIO register.
1390 BitFieldAnd8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
)
1395 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1396 by a bitwise inclusive OR, and writes the result back to the bit field in the
1397 8-bit MMIO register.
1399 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1400 followed by a bitwise inclusive OR between the read result and the value
1401 specified by AndData, and writes the result to the 8-bit MMIO register
1402 specified by Address. The value written to the MMIO register is returned.
1403 This function must guarantee that all MMIO read and write operations are
1404 serialized. Extra left bits in both AndData and OrData are stripped.
1406 If 8-bit MMIO register operations are not supported, then ASSERT().
1407 If StartBit is greater than 7, then ASSERT().
1408 If EndBit is greater than 7, then ASSERT().
1409 If EndBit is less than StartBit, then ASSERT().
1411 @param Address MMIO register to write.
1412 @param StartBit The ordinal of the least significant bit in the bit field.
1414 @param EndBit The ordinal of the most significant bit in the bit field.
1416 @param AndData The value to AND with read value from the MMIO register.
1417 @param OrData The value to OR with the result of the AND operation.
1419 @return The value written back to the MMIO register.
1424 MmioBitFieldAndThenOr8 (
1434 BitFieldAndThenOr8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1439 Reads a 16-bit MMIO register, performs a bitwise inclusive OR, and writes the
1440 result back to the 16-bit MMIO register.
1442 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1443 inclusive OR between the read result and the value specified by OrData, and
1444 writes the result to the 16-bit MMIO register specified by Address. The value
1445 written to the MMIO register is returned. This function must guarantee that
1446 all MMIO read and write operations are serialized.
1448 If 16-bit MMIO register operations are not supported, then ASSERT().
1450 @param Address The MMIO register to write.
1451 @param OrData The value to OR with the read value from the MMIO register.
1453 @return The value written back to the MMIO register.
1463 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) | OrData
));
1467 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1468 back to the 16-bit MMIO register.
1470 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1471 between the read result and the value specified by AndData, and writes the
1472 result to the 16-bit MMIO register specified by Address. The value written to
1473 the MMIO register is returned. This function must guarantee that all MMIO
1474 read and write operations are serialized.
1476 If 16-bit MMIO register operations are not supported, then ASSERT().
1478 @param Address The MMIO register to write.
1479 @param AndData The value to AND with the read value from the MMIO register.
1481 @return The value written back to the MMIO register.
1491 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) & AndData
));
1495 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1496 inclusive OR, and writes the result back to the 16-bit MMIO register.
1498 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1499 between the read result and the value specified by AndData, performs a
1500 bitwise OR between the result of the AND operation and the value specified by
1501 OrData, and writes the result to the 16-bit MMIO register specified by
1502 Address. The value written to the MMIO register is returned. This function
1503 must guarantee that all MMIO read and write operations are serialized.
1505 If 16-bit MMIO register operations are not supported, then ASSERT().
1508 @param Address The MMIO register to write.
1509 @param AndData The value to AND with the read value from the MMIO register.
1510 @param OrData The value to OR with the result of the AND operation.
1512 @return The value written back to the MMIO register.
1523 return MmioWrite16 (Address
, (UINT16
) ((MmioRead16 (Address
) & AndData
) | OrData
));
1527 Reads a bit field of a MMIO register.
1529 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
1530 the StartBit and the EndBit. The value of the bit field is returned.
1532 If 16-bit MMIO register operations are not supported, then ASSERT().
1533 If StartBit is greater than 15, then ASSERT().
1534 If EndBit is greater than 15, then ASSERT().
1535 If EndBit is less than StartBit, then ASSERT().
1537 @param Address MMIO register to read.
1538 @param StartBit The ordinal of the least significant bit in the bit field.
1540 @param EndBit The ordinal of the most significant bit in the bit field.
1543 @return The value read.
1548 MmioBitFieldRead16 (
1554 return BitFieldRead16 (MmioRead16 (Address
), StartBit
, EndBit
);
1558 Writes a bit field to a MMIO register.
1560 Writes Value to the bit field of the MMIO register. The bit field is
1561 specified by the StartBit and the EndBit. All other bits in the destination
1562 MMIO register are preserved. The new value of the 16-bit register is returned.
1564 If 16-bit MMIO register operations are not supported, then ASSERT().
1565 If StartBit is greater than 15, then ASSERT().
1566 If EndBit is greater than 15, then ASSERT().
1567 If EndBit is less than StartBit, then ASSERT().
1569 @param Address MMIO register to write.
1570 @param StartBit The ordinal of the least significant bit in the bit field.
1572 @param EndBit The ordinal of the most significant bit in the bit field.
1574 @param Value New value of the bit field.
1576 @return The value written back to the MMIO register.
1581 MmioBitFieldWrite16 (
1588 return MmioWrite16 (
1590 BitFieldWrite16 (MmioRead16 (Address
), StartBit
, EndBit
, Value
)
1595 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
1596 writes the result back to the bit field in the 16-bit MMIO register.
1598 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1599 inclusive OR between the read result and the value specified by OrData, and
1600 writes the result to the 16-bit MMIO register specified by Address. The value
1601 written to the MMIO register is returned. This function must guarantee that
1602 all MMIO read and write operations are serialized. Extra left bits in OrData
1605 If 16-bit MMIO register operations are not supported, then ASSERT().
1606 If StartBit is greater than 15, then ASSERT().
1607 If EndBit is greater than 15, then ASSERT().
1608 If EndBit is less than StartBit, then ASSERT().
1610 @param Address MMIO register to write.
1611 @param StartBit The ordinal of the least significant bit in the bit field.
1613 @param EndBit The ordinal of the most significant bit in the bit field.
1615 @param OrData The value to OR with read value from the MMIO register.
1617 @return The value written back to the MMIO register.
1629 return MmioWrite16 (
1631 BitFieldOr16 (MmioRead16 (Address
), StartBit
, EndBit
, OrData
)
1636 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
1637 writes the result back to the bit field in the 16-bit MMIO register.
1639 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1640 between the read result and the value specified by AndData, and writes the
1641 result to the 16-bit MMIO register specified by Address. The value written to
1642 the MMIO register is returned. This function must guarantee that all MMIO
1643 read and write operations are serialized. Extra left bits in AndData are
1646 If 16-bit MMIO register operations are not supported, then ASSERT().
1647 If StartBit is greater than 15, then ASSERT().
1648 If EndBit is greater than 15, then ASSERT().
1649 If EndBit is less than StartBit, then ASSERT().
1651 @param Address MMIO register to write.
1652 @param StartBit The ordinal of the least significant bit in the bit field.
1654 @param EndBit The ordinal of the most significant bit in the bit field.
1656 @param AndData The value to AND with read value from the MMIO register.
1658 @return The value written back to the MMIO register.
1670 return MmioWrite16 (
1672 BitFieldAnd16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
)
1677 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
1678 by a bitwise inclusive OR, and writes the result back to the bit field in the
1679 16-bit MMIO register.
1681 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1682 followed by a bitwise inclusive OR between the read result and the value
1683 specified by AndData, and writes the result to the 16-bit MMIO register
1684 specified by Address. The value written to the MMIO register is returned.
1685 This function must guarantee that all MMIO read and write operations are
1686 serialized. Extra left bits in both AndData and OrData are stripped.
1688 If 16-bit MMIO register operations are not supported, then ASSERT().
1689 If StartBit is greater than 15, then ASSERT().
1690 If EndBit is greater than 15, then ASSERT().
1691 If EndBit is less than StartBit, then ASSERT().
1693 @param Address MMIO register to write.
1694 @param StartBit The ordinal of the least significant bit in the bit field.
1696 @param EndBit The ordinal of the most significant bit in the bit field.
1698 @param AndData The value to AND with read value from the MMIO register.
1699 @param OrData The value to OR with the result of the AND operation.
1701 @return The value written back to the MMIO register.
1706 MmioBitFieldAndThenOr16 (
1714 return MmioWrite16 (
1716 BitFieldAndThenOr16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1721 Reads a 32-bit MMIO register, performs a bitwise inclusive OR, and writes the
1722 result back to the 32-bit MMIO register.
1724 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1725 inclusive OR between the read result and the value specified by OrData, and
1726 writes the result to the 32-bit MMIO register specified by Address. The value
1727 written to the MMIO register is returned. This function must guarantee that
1728 all MMIO read and write operations are serialized.
1730 If 32-bit MMIO register operations are not supported, then ASSERT().
1732 @param Address The MMIO register to write.
1733 @param OrData The value to OR with the read value from the MMIO register.
1735 @return The value written back to the MMIO register.
1745 return MmioWrite32 (Address
, MmioRead32 (Address
) | OrData
);
1749 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
1750 back to the 32-bit MMIO register.
1752 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1753 between the read result and the value specified by AndData, and writes the
1754 result to the 32-bit MMIO register specified by Address. The value written to
1755 the MMIO register is returned. This function must guarantee that all MMIO
1756 read and write operations are serialized.
1758 If 32-bit MMIO register operations are not supported, then ASSERT().
1760 @param Address The MMIO register to write.
1761 @param AndData The value to AND with the read value from the MMIO register.
1763 @return The value written back to the MMIO register.
1773 return MmioWrite32 (Address
, MmioRead32 (Address
) & AndData
);
1777 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
1778 inclusive OR, and writes the result back to the 32-bit MMIO register.
1780 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1781 between the read result and the value specified by AndData, performs a
1782 bitwise OR between the result of the AND operation and the value specified by
1783 OrData, and writes the result to the 32-bit MMIO register specified by
1784 Address. The value written to the MMIO register is returned. This function
1785 must guarantee that all MMIO read and write operations are serialized.
1787 If 32-bit MMIO register operations are not supported, then ASSERT().
1790 @param Address The MMIO register to write.
1791 @param AndData The value to AND with the read value from the MMIO register.
1792 @param OrData The value to OR with the result of the AND operation.
1794 @return The value written back to the MMIO register.
1805 return MmioWrite32 (Address
, (MmioRead32 (Address
) & AndData
) | OrData
);
1809 Reads a bit field of a MMIO register.
1811 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
1812 the StartBit and the EndBit. The value of the bit field is returned.
1814 If 32-bit MMIO register operations are not supported, then ASSERT().
1815 If StartBit is greater than 31, then ASSERT().
1816 If EndBit is greater than 31, then ASSERT().
1817 If EndBit is less than StartBit, then ASSERT().
1819 @param Address MMIO register to read.
1820 @param StartBit The ordinal of the least significant bit in the bit field.
1822 @param EndBit The ordinal of the most significant bit in the bit field.
1825 @return The value read.
1830 MmioBitFieldRead32 (
1836 return BitFieldRead32 (MmioRead32 (Address
), StartBit
, EndBit
);
1840 Writes a bit field to a MMIO register.
1842 Writes Value to the bit field of the MMIO register. The bit field is
1843 specified by the StartBit and the EndBit. All other bits in the destination
1844 MMIO register are preserved. The new value of the 32-bit register is returned.
1846 If 32-bit MMIO register operations are not supported, then ASSERT().
1847 If StartBit is greater than 31, then ASSERT().
1848 If EndBit is greater than 31, then ASSERT().
1849 If EndBit is less than StartBit, then ASSERT().
1851 @param Address MMIO register to write.
1852 @param StartBit The ordinal of the least significant bit in the bit field.
1854 @param EndBit The ordinal of the most significant bit in the bit field.
1856 @param Value New value of the bit field.
1858 @return The value written back to the MMIO register.
1863 MmioBitFieldWrite32 (
1870 return MmioWrite32 (
1872 BitFieldWrite32 (MmioRead32 (Address
), StartBit
, EndBit
, Value
)
1877 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
1878 writes the result back to the bit field in the 32-bit MMIO register.
1880 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1881 inclusive OR between the read result and the value specified by OrData, and
1882 writes the result to the 32-bit MMIO register specified by Address. The value
1883 written to the MMIO register is returned. This function must guarantee that
1884 all MMIO read and write operations are serialized. Extra left bits in OrData
1887 If 32-bit MMIO register operations are not supported, then ASSERT().
1888 If StartBit is greater than 31, then ASSERT().
1889 If EndBit is greater than 31, then ASSERT().
1890 If EndBit is less than StartBit, then ASSERT().
1892 @param Address MMIO register to write.
1893 @param StartBit The ordinal of the least significant bit in the bit field.
1895 @param EndBit The ordinal of the most significant bit in the bit field.
1897 @param OrData The value to OR with read value from the MMIO register.
1899 @return The value written back to the MMIO register.
1911 return MmioWrite32 (
1913 BitFieldOr32 (MmioRead32 (Address
), StartBit
, EndBit
, OrData
)
1918 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
1919 writes the result back to the bit field in the 32-bit MMIO register.
1921 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1922 between the read result and the value specified by AndData, and writes the
1923 result to the 32-bit MMIO register specified by Address. The value written to
1924 the MMIO register is returned. This function must guarantee that all MMIO
1925 read and write operations are serialized. Extra left bits in AndData are
1928 If 32-bit MMIO register operations are not supported, then ASSERT().
1929 If StartBit is greater than 31, then ASSERT().
1930 If EndBit is greater than 31, then ASSERT().
1931 If EndBit is less than StartBit, then ASSERT().
1933 @param Address MMIO register to write.
1934 @param StartBit The ordinal of the least significant bit in the bit field.
1936 @param EndBit The ordinal of the most significant bit in the bit field.
1938 @param AndData The value to AND with read value from the MMIO register.
1940 @return The value written back to the MMIO register.
1952 return MmioWrite32 (
1954 BitFieldAnd32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
)
1959 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
1960 by a bitwise inclusive OR, and writes the result back to the bit field in the
1961 32-bit MMIO register.
1963 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1964 followed by a bitwise inclusive OR between the read result and the value
1965 specified by AndData, and writes the result to the 32-bit MMIO register
1966 specified by Address. The value written to the MMIO register is returned.
1967 This function must guarantee that all MMIO read and write operations are
1968 serialized. Extra left bits in both AndData and OrData are stripped.
1970 If 32-bit MMIO register operations are not supported, then ASSERT().
1971 If StartBit is greater than 31, then ASSERT().
1972 If EndBit is greater than 31, then ASSERT().
1973 If EndBit is less than StartBit, then ASSERT().
1975 @param Address MMIO register to write.
1976 @param StartBit The ordinal of the least significant bit in the bit field.
1978 @param EndBit The ordinal of the most significant bit in the bit field.
1980 @param AndData The value to AND with read value from the MMIO register.
1981 @param OrData The value to OR with the result of the AND operation.
1983 @return The value written back to the MMIO register.
1988 MmioBitFieldAndThenOr32 (
1996 return MmioWrite32 (
1998 BitFieldAndThenOr32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
, OrData
)
2003 Reads a 64-bit MMIO register, performs a bitwise inclusive OR, and writes the
2004 result back to the 64-bit MMIO register.
2006 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2007 inclusive OR between the read result and the value specified by OrData, and
2008 writes the result to the 64-bit MMIO register specified by Address. The value
2009 written to the MMIO register is returned. This function must guarantee that
2010 all MMIO read and write operations are serialized.
2012 If 64-bit MMIO register operations are not supported, then ASSERT().
2014 @param Address The MMIO register to write.
2015 @param OrData The value to OR with the read value from the MMIO register.
2017 @return The value written back to the MMIO register.
2027 return MmioWrite64 (Address
, MmioRead64 (Address
) | OrData
);
2031 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2032 back to the 64-bit MMIO register.
2034 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2035 between the read result and the value specified by AndData, and writes the
2036 result to the 64-bit MMIO register specified by Address. The value written to
2037 the MMIO register is returned. This function must guarantee that all MMIO
2038 read and write operations are serialized.
2040 If 64-bit MMIO register operations are not supported, then ASSERT().
2042 @param Address The MMIO register to write.
2043 @param AndData The value to AND with the read value from the MMIO register.
2045 @return The value written back to the MMIO register.
2055 return MmioWrite64 (Address
, MmioRead64 (Address
) & AndData
);
2059 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2060 inclusive OR, and writes the result back to the 64-bit MMIO register.
2062 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2063 between the read result and the value specified by AndData, performs a
2064 bitwise OR between the result of the AND operation and the value specified by
2065 OrData, and writes the result to the 64-bit MMIO register specified by
2066 Address. The value written to the MMIO register is returned. This function
2067 must guarantee that all MMIO read and write operations are serialized.
2069 If 64-bit MMIO register operations are not supported, then ASSERT().
2072 @param Address The MMIO register to write.
2073 @param AndData The value to AND with the read value from the MMIO register.
2074 @param OrData The value to OR with the result of the AND operation.
2076 @return The value written back to the MMIO register.
2087 return MmioWrite64 (Address
, (MmioRead64 (Address
) & AndData
) | OrData
);
2091 Reads a bit field of a MMIO register.
2093 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2094 the StartBit and the EndBit. The value of the bit field is returned.
2096 If 64-bit MMIO register operations are not supported, then ASSERT().
2097 If StartBit is greater than 63, then ASSERT().
2098 If EndBit is greater than 63, then ASSERT().
2099 If EndBit is less than StartBit, then ASSERT().
2101 @param Address MMIO register to read.
2102 @param StartBit The ordinal of the least significant bit in the bit field.
2104 @param EndBit The ordinal of the most significant bit in the bit field.
2107 @return The value read.
2112 MmioBitFieldRead64 (
2118 return BitFieldRead64 (MmioRead64 (Address
), StartBit
, EndBit
);
2122 Writes a bit field to a MMIO register.
2124 Writes Value to the bit field of the MMIO register. The bit field is
2125 specified by the StartBit and the EndBit. All other bits in the destination
2126 MMIO register are preserved. The new value of the 64-bit register is returned.
2128 If 64-bit MMIO register operations are not supported, then ASSERT().
2129 If StartBit is greater than 63, then ASSERT().
2130 If EndBit is greater than 63, then ASSERT().
2131 If EndBit is less than StartBit, then ASSERT().
2133 @param Address MMIO register to write.
2134 @param StartBit The ordinal of the least significant bit in the bit field.
2136 @param EndBit The ordinal of the most significant bit in the bit field.
2138 @param Value New value of the bit field.
2140 @return The value written back to the MMIO register.
2145 MmioBitFieldWrite64 (
2152 return MmioWrite64 (
2154 BitFieldWrite64 (MmioRead64 (Address
), StartBit
, EndBit
, Value
)
2159 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2160 writes the result back to the bit field in the 64-bit MMIO register.
2162 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2163 inclusive OR between the read result and the value specified by OrData, and
2164 writes the result to the 64-bit MMIO register specified by Address. The value
2165 written to the MMIO register is returned. This function must guarantee that
2166 all MMIO read and write operations are serialized. Extra left bits in OrData
2169 If 64-bit MMIO register operations are not supported, then ASSERT().
2170 If StartBit is greater than 63, then ASSERT().
2171 If EndBit is greater than 63, then ASSERT().
2172 If EndBit is less than StartBit, then ASSERT().
2174 @param Address MMIO register to write.
2175 @param StartBit The ordinal of the least significant bit in the bit field.
2177 @param EndBit The ordinal of the most significant bit in the bit field.
2179 @param OrData The value to OR with read value from the MMIO register.
2181 @return The value written back to the MMIO register.
2193 return MmioWrite64 (
2195 BitFieldOr64 (MmioRead64 (Address
), StartBit
, EndBit
, OrData
)
2200 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2201 writes the result back to the bit field in the 64-bit MMIO register.
2203 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2204 between the read result and the value specified by AndData, and writes the
2205 result to the 64-bit MMIO register specified by Address. The value written to
2206 the MMIO register is returned. This function must guarantee that all MMIO
2207 read and write operations are serialized. Extra left bits in AndData are
2210 If 64-bit MMIO register operations are not supported, then ASSERT().
2211 If StartBit is greater than 63, then ASSERT().
2212 If EndBit is greater than 63, then ASSERT().
2213 If EndBit is less than StartBit, then ASSERT().
2215 @param Address MMIO register to write.
2216 @param StartBit The ordinal of the least significant bit in the bit field.
2218 @param EndBit The ordinal of the most significant bit in the bit field.
2220 @param AndData The value to AND with read value from the MMIO register.
2222 @return The value written back to the MMIO register.
2234 return MmioWrite64 (
2236 BitFieldAnd64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
)
2241 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2242 by a bitwise inclusive OR, and writes the result back to the bit field in the
2243 64-bit MMIO register.
2245 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2246 followed by a bitwise inclusive OR between the read result and the value
2247 specified by AndData, and writes the result to the 64-bit MMIO register
2248 specified by Address. The value written to the MMIO register is returned.
2249 This function must guarantee that all MMIO read and write operations are
2250 serialized. Extra left bits in both AndData and OrData are stripped.
2252 If 64-bit MMIO register operations are not supported, then ASSERT().
2253 If StartBit is greater than 63, then ASSERT().
2254 If EndBit is greater than 63, then ASSERT().
2255 If EndBit is less than StartBit, then ASSERT().
2257 @param Address MMIO register to write.
2258 @param StartBit The ordinal of the least significant bit in the bit field.
2260 @param EndBit The ordinal of the most significant bit in the bit field.
2262 @param AndData The value to AND with read value from the MMIO register.
2263 @param OrData The value to OR with the result of the AND operation.
2265 @return The value written back to the MMIO register.
2270 MmioBitFieldAndThenOr64 (
2278 return MmioWrite64 (
2280 BitFieldAndThenOr64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
, OrData
)