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 Module Name: IoHighLevel.c
18 The following IoLib instances share the same version of this file:
26 #include "DxeCpuIoLibInternal.h"
29 Reads an 8-bit I/O port, performs a bitwise inclusive OR, and writes the
30 result back to the 8-bit I/O port.
32 Reads the 8-bit I/O port specified by Port, performs a bitwise inclusive OR
33 between the read result and the value specified by OrData, and writes the
34 result to the 8-bit I/O port specified by Port. The value written to the I/O
35 port is returned. This function must guarantee that all I/O read and write
36 operations are serialized.
38 If 8-bit I/O port operations are not supported, then ASSERT().
40 @param Port The I/O port to write.
41 @param OrData The value to OR with the read value from the I/O port.
43 @return The value written back to the I/O port.
53 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) | OrData
));
57 Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
58 to the 8-bit I/O port.
60 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
61 the read result and the value specified by AndData, and writes the result to
62 the 8-bit I/O port specified by Port. The value written to the I/O port is
63 returned. This function must guarantee that all I/O read and write operations
66 If 8-bit I/O port operations are not supported, then ASSERT().
68 @param Port The I/O port to write.
69 @param AndData The value to AND with the read value from the I/O port.
71 @return The value written back to the I/O port.
81 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) & AndData
));
85 Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
86 inclusive OR, and writes the result back to the 8-bit I/O port.
88 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
89 the read result and the value specified by AndData, performs a bitwise OR
90 between the result of the AND operation and the value specified by OrData,
91 and writes the result to the 8-bit I/O port specified by Port. The value
92 written to the I/O port is returned. This function must guarantee that all
93 I/O read and write operations are serialized.
95 If 8-bit I/O port operations are not supported, then ASSERT().
97 @param Port The I/O port to write.
98 @param AndData The value to AND with the read value from the I/O port.
99 @param OrData The value to OR with the result of the AND operation.
101 @return The value written back to the I/O port.
112 return IoWrite8 (Port
, (UINT8
) ((IoRead8 (Port
) & AndData
) | OrData
));
116 Reads a bit field of an I/O register.
118 Reads the bit field in an 8-bit I/O register. The bit field is specified by
119 the StartBit and the EndBit. The value of the bit field is returned.
121 If 8-bit I/O port operations are not supported, then ASSERT().
122 If StartBit is greater than 7, then ASSERT().
123 If EndBit is greater than 7, then ASSERT().
124 If EndBit is less than StartBit, then ASSERT().
126 @param Port The I/O port to read.
127 @param StartBit The ordinal of the least significant bit in the bit field.
129 @param EndBit The ordinal of the most significant bit in the bit field.
132 @return The value read.
143 return BitFieldRead8 (IoRead8 (Port
), StartBit
, EndBit
);
147 Writes a bit field to an I/O register.
149 Writes Value to the bit field of the I/O register. The bit field is specified
150 by the StartBit and the EndBit. All other bits in the destination I/O
151 register are preserved. The value written to the I/O port is returned. Extra
152 left bits in Value are stripped.
154 If 8-bit I/O port operations are not supported, then ASSERT().
155 If StartBit is greater than 7, then ASSERT().
156 If EndBit is greater than 7, then ASSERT().
157 If EndBit is less than StartBit, then ASSERT().
159 @param Port The I/O port to write.
160 @param StartBit The ordinal of the least significant bit in the bit field.
162 @param EndBit The ordinal of the most significant bit in the bit field.
164 @param Value New value of the bit field.
166 @return The value written back to the I/O port.
180 BitFieldWrite8 (IoRead8 (Port
), StartBit
, EndBit
, Value
)
185 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
186 result back to the bit field in the 8-bit port.
188 Reads the 8-bit I/O port specified by Port, performs a bitwise inclusive OR
189 between the read result and the value specified by OrData, and writes the
190 result to the 8-bit I/O port specified by Port. The value written to the I/O
191 port is returned. This function must guarantee that all I/O read and write
192 operations are serialized. Extra left bits in OrData are stripped.
194 If 8-bit I/O port operations are not supported, then ASSERT().
195 If StartBit is greater than 7, then ASSERT().
196 If EndBit is greater than 7, then ASSERT().
197 If EndBit is less than StartBit, 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().
239 @param Port The I/O port to write.
240 @param StartBit The ordinal of the least significant bit in the bit field.
242 @param EndBit The ordinal of the most significant bit in the bit field.
244 @param AndData The value to AND with the read value from the I/O port.
246 @return The value written back to the I/O port.
260 BitFieldAnd8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
)
265 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
266 bitwise inclusive OR, and writes the result back to the bit field in the
269 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
270 by a bitwise inclusive OR between the read result and the value specified by
271 AndData, and writes the result to the 8-bit I/O port specified by Port. The
272 value written to the I/O port is returned. This function must guarantee that
273 all I/O read and write operations are serialized. Extra left bits in both
274 AndData and OrData are stripped.
276 If 8-bit I/O port operations are not supported, then ASSERT().
277 If StartBit is greater than 7, then ASSERT().
278 If EndBit is greater than 7, then ASSERT().
279 If EndBit is less than StartBit, then ASSERT().
281 @param Port The I/O port to write.
282 @param StartBit The ordinal of the least significant bit in the bit field.
284 @param EndBit The ordinal of the most significant bit in the bit field.
286 @param AndData The value to AND with the read value from the I/O port.
287 @param OrData The value to OR with the result of the AND operation.
289 @return The value written back to the I/O port.
294 IoBitFieldAndThenOr8 (
304 BitFieldAndThenOr8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
, OrData
)
309 Reads a 16-bit I/O port, performs a bitwise inclusive OR, and writes the
310 result back to the 16-bit I/O port.
312 Reads the 16-bit I/O port specified by Port, performs a bitwise inclusive OR
313 between the read result and the value specified by OrData, and writes the
314 result to the 16-bit I/O port specified by Port. The value written to the I/O
315 port is returned. This function must guarantee that all I/O read and write
316 operations are serialized.
318 If 16-bit I/O port operations are not supported, then ASSERT().
320 @param Port The I/O port to write.
321 @param OrData The value to OR with the read value from the I/O port.
323 @return The value written back to the I/O port.
333 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) | OrData
));
337 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
338 to the 16-bit I/O port.
340 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
341 the read result and the value specified by AndData, and writes the result to
342 the 16-bit I/O port specified by Port. The value written to the I/O port is
343 returned. This function must guarantee that all I/O read and write operations
346 If 16-bit I/O port operations are not supported, then ASSERT().
348 @param Port The I/O port to write.
349 @param AndData The value to AND with the read value from the I/O port.
351 @return The value written back to the I/O port.
361 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) & AndData
));
365 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
366 inclusive OR, and writes the result back to the 16-bit I/O port.
368 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
369 the read result and the value specified by AndData, performs a bitwise OR
370 between the result of the AND operation and the value specified by OrData,
371 and writes the result to the 16-bit I/O port specified by Port. The value
372 written to the I/O port is returned. This function must guarantee that all
373 I/O read and write operations are serialized.
375 If 16-bit I/O port operations are not supported, then ASSERT().
377 @param Port The I/O port to write.
378 @param AndData The value to AND with the read value from the I/O port.
379 @param OrData The value to OR with the result of the AND operation.
381 @return The value written back to the I/O port.
392 return IoWrite16 (Port
, (UINT16
) ((IoRead16 (Port
) & AndData
) | OrData
));
396 Reads a bit field of an I/O register.
398 Reads the bit field in a 16-bit I/O register. The bit field is specified by
399 the StartBit and the EndBit. The value of the bit field is returned.
401 If 16-bit I/O port operations are not supported, then ASSERT().
402 If StartBit is greater than 15, then ASSERT().
403 If EndBit is greater than 15, then ASSERT().
404 If EndBit is less than StartBit, then ASSERT().
406 @param Port The I/O port to read.
407 @param StartBit The ordinal of the least significant bit in the bit field.
409 @param EndBit The ordinal of the most significant bit in the bit field.
412 @return The value read.
423 return BitFieldRead16 (IoRead16 (Port
), StartBit
, EndBit
);
427 Writes a bit field to an I/O register.
429 Writes Value to the bit field of the I/O register. The bit field is specified
430 by the StartBit and the EndBit. All other bits in the destination I/O
431 register are preserved. The value written to the I/O port is returned. Extra
432 left bits in Value are stripped.
434 If 16-bit I/O port operations are not supported, then ASSERT().
435 If StartBit is greater than 15, then ASSERT().
436 If EndBit is greater than 15, then ASSERT().
437 If EndBit is less than StartBit, then ASSERT().
439 @param Port The I/O port to write.
440 @param StartBit The ordinal of the least significant bit in the bit field.
442 @param EndBit The ordinal of the most significant bit in the bit field.
444 @param Value New value of the bit field.
446 @return The value written back to the I/O port.
460 BitFieldWrite16 (IoRead16 (Port
), StartBit
, EndBit
, Value
)
465 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
466 result back to the bit field in the 16-bit port.
468 Reads the 16-bit I/O port specified by Port, performs a bitwise inclusive OR
469 between the read result and the value specified by OrData, and writes the
470 result to the 16-bit I/O port specified by Port. The value written to the I/O
471 port is returned. This function must guarantee that all I/O read and write
472 operations are serialized. Extra left bits in OrData are stripped.
474 If 16-bit I/O port operations are not supported, then ASSERT().
475 If StartBit is greater than 15, then ASSERT().
476 If EndBit is greater than 15, then ASSERT().
477 If EndBit is less than StartBit, then ASSERT().
479 @param Port The I/O port to write.
480 @param StartBit The ordinal of the least significant bit in the bit field.
482 @param EndBit The ordinal of the most significant bit in the bit field.
484 @param OrData The value to OR with the read value from the I/O port.
486 @return The value written back to the I/O port.
500 BitFieldOr16 (IoRead16 (Port
), StartBit
, EndBit
, OrData
)
505 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
506 result back to the bit field in the 16-bit port.
508 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
509 the read result and the value specified by AndData, and writes the result to
510 the 16-bit I/O port specified by Port. The value written to the I/O port is
511 returned. This function must guarantee that all I/O read and write operations
512 are serialized. Extra left bits in AndData are stripped.
514 If 16-bit I/O port operations are not supported, then ASSERT().
515 If StartBit is greater than 15, then ASSERT().
516 If EndBit is greater than 15, then ASSERT().
517 If EndBit is less than StartBit, then ASSERT().
519 @param Port The I/O port to write.
520 @param StartBit The ordinal of the least significant bit in the bit field.
522 @param EndBit The ordinal of the most significant bit in the bit field.
524 @param AndData The value to AND with the read value from the I/O port.
526 @return The value written back to the I/O port.
540 BitFieldAnd16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
)
545 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
546 bitwise inclusive OR, and writes the result back to the bit field in the
549 Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
550 by a bitwise inclusive OR between the read result and the value specified by
551 AndData, and writes the result to the 16-bit I/O port specified by Port. The
552 value written to the I/O port is returned. This function must guarantee that
553 all I/O read and write operations are serialized. Extra left bits in both
554 AndData and OrData are stripped.
556 If 16-bit I/O port operations are not supported, then ASSERT().
557 If StartBit is greater than 15, then ASSERT().
558 If EndBit is greater than 15, then ASSERT().
559 If EndBit is less than StartBit, then ASSERT().
561 @param Port The I/O port to write.
562 @param StartBit The ordinal of the least significant bit in the bit field.
564 @param EndBit The ordinal of the most significant bit in the bit field.
566 @param AndData The value to AND with the read value from the I/O port.
567 @param OrData The value to OR with the result of the AND operation.
569 @return The value written back to the I/O port.
574 IoBitFieldAndThenOr16 (
584 BitFieldAndThenOr16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
, OrData
)
589 Reads a 32-bit I/O port, performs a bitwise inclusive OR, and writes the
590 result back to the 32-bit I/O port.
592 Reads the 32-bit I/O port specified by Port, performs a bitwise inclusive OR
593 between the read result and the value specified by OrData, and writes the
594 result to the 32-bit I/O port specified by Port. The value written to the I/O
595 port is returned. This function must guarantee that all I/O read and write
596 operations are serialized.
598 If 32-bit I/O port operations are not supported, then ASSERT().
600 @param Port The I/O port to write.
601 @param OrData The value to OR with the read value from the I/O port.
603 @return The value written back to the I/O port.
613 return IoWrite32 (Port
, IoRead32 (Port
) | OrData
);
617 Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
618 to the 32-bit I/O port.
620 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
621 the read result and the value specified by AndData, and writes the result to
622 the 32-bit I/O port specified by Port. The value written to the I/O port is
623 returned. This function must guarantee that all I/O read and write operations
626 If 32-bit I/O port operations are not supported, then ASSERT().
628 @param Port The I/O port to write.
629 @param AndData The value to AND with the read value from the I/O port.
631 @return The value written back to the I/O port.
641 return IoWrite32 (Port
, IoRead32 (Port
) & AndData
);
645 Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
646 inclusive OR, and writes the result back to the 32-bit I/O port.
648 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
649 the read result and the value specified by AndData, performs a bitwise OR
650 between the result of the AND operation and the value specified by OrData,
651 and writes the result to the 32-bit I/O port specified by Port. The value
652 written to the I/O port is returned. This function must guarantee that all
653 I/O read and write operations are serialized.
655 If 32-bit I/O port operations are not supported, then ASSERT().
657 @param Port The I/O port to write.
658 @param AndData The value to AND with the read value from the I/O port.
659 @param OrData The value to OR with the result of the AND operation.
661 @return The value written back to the I/O port.
672 return IoWrite32 (Port
, (IoRead32 (Port
) & AndData
) | OrData
);
676 Reads a bit field of an I/O register.
678 Reads the bit field in a 32-bit I/O register. The bit field is specified by
679 the StartBit and the EndBit. The value of the bit field is returned.
681 If 32-bit I/O port operations are not supported, then ASSERT().
682 If StartBit is greater than 31, then ASSERT().
683 If EndBit is greater than 31, then ASSERT().
684 If EndBit is less than StartBit, then ASSERT().
686 @param Port The I/O port to read.
687 @param StartBit The ordinal of the least significant bit in the bit field.
689 @param EndBit The ordinal of the most significant bit in the bit field.
692 @return The value read.
703 return BitFieldRead32 (IoRead32 (Port
), StartBit
, EndBit
);
707 Writes a bit field to an I/O register.
709 Writes Value to the bit field of the I/O register. The bit field is specified
710 by the StartBit and the EndBit. All other bits in the destination I/O
711 register are preserved. The value written to the I/O port is returned. Extra
712 left bits in Value are stripped.
714 If 32-bit I/O port operations are not supported, then ASSERT().
715 If StartBit is greater than 31, then ASSERT().
716 If EndBit is greater than 31, then ASSERT().
717 If EndBit is less than StartBit, then ASSERT().
719 @param Port The I/O port to write.
720 @param StartBit The ordinal of the least significant bit in the bit field.
722 @param EndBit The ordinal of the most significant bit in the bit field.
724 @param Value New value of the bit field.
726 @return The value written back to the I/O port.
740 BitFieldWrite32 (IoRead32 (Port
), StartBit
, EndBit
, Value
)
745 Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the
746 result back to the bit field in the 32-bit port.
748 Reads the 32-bit I/O port specified by Port, performs a bitwise inclusive OR
749 between the read result and the value specified by OrData, and writes the
750 result to the 32-bit I/O port specified by Port. The value written to the I/O
751 port is returned. This function must guarantee that all I/O read and write
752 operations are serialized. Extra left bits in OrData are stripped.
754 If 32-bit I/O port operations are not supported, then ASSERT().
755 If StartBit is greater than 31, then ASSERT().
756 If EndBit is greater than 31, then ASSERT().
757 If EndBit is less than StartBit, then ASSERT().
759 @param Port The I/O port to write.
760 @param StartBit The ordinal of the least significant bit in the bit field.
762 @param EndBit The ordinal of the most significant bit in the bit field.
764 @param OrData The value to OR with the read value from the I/O port.
766 @return The value written back to the I/O port.
780 BitFieldOr32 (IoRead32 (Port
), StartBit
, EndBit
, OrData
)
785 Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
786 result back to the bit field in the 32-bit port.
788 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
789 the read result and the value specified by AndData, and writes the result to
790 the 32-bit I/O port specified by Port. The value written to the I/O port is
791 returned. This function must guarantee that all I/O read and write operations
792 are serialized. Extra left bits in AndData are stripped.
794 If 32-bit I/O port operations are not supported, then ASSERT().
795 If StartBit is greater than 31, then ASSERT().
796 If EndBit is greater than 31, then ASSERT().
797 If EndBit is less than StartBit, then ASSERT().
799 @param Port The I/O port to write.
800 @param StartBit The ordinal of the least significant bit in the bit field.
802 @param EndBit The ordinal of the most significant bit in the bit field.
804 @param AndData The value to AND with the read value from the I/O port.
806 @return The value written back to the I/O port.
820 BitFieldAnd32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
)
825 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
826 bitwise inclusive OR, and writes the result back to the bit field in the
829 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
830 by a bitwise inclusive OR between the read result and the value specified by
831 AndData, and writes the result to the 32-bit I/O port specified by Port. The
832 value written to the I/O port is returned. This function must guarantee that
833 all I/O read and write operations are serialized. Extra left bits in both
834 AndData and OrData are stripped.
836 If 32-bit I/O port operations are not supported, then ASSERT().
837 If StartBit is greater than 31, then ASSERT().
838 If EndBit is greater than 31, then ASSERT().
839 If EndBit is less than StartBit, then ASSERT().
841 @param Port The I/O port to write.
842 @param StartBit The ordinal of the least significant bit in the bit field.
844 @param EndBit The ordinal of the most significant bit in the bit field.
846 @param AndData The value to AND with the read value from the I/O port.
847 @param OrData The value to OR with the result of the AND operation.
849 @return The value written back to the I/O port.
854 IoBitFieldAndThenOr32 (
864 BitFieldAndThenOr32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
, OrData
)
869 Reads a 64-bit I/O port, performs a bitwise inclusive OR, and writes the
870 result back to the 64-bit I/O port.
872 Reads the 64-bit I/O port specified by Port, performs a bitwise inclusive OR
873 between the read result and the value specified by OrData, and writes the
874 result to the 64-bit I/O port specified by Port. The value written to the I/O
875 port is returned. This function must guarantee that all I/O read and write
876 operations are serialized.
878 If 64-bit I/O port operations are not supported, then ASSERT().
880 @param Port The I/O port to write.
881 @param OrData The value to OR with the read value from the I/O port.
883 @return The value written back to the I/O port.
893 return IoWrite64 (Port
, IoRead64 (Port
) | OrData
);
897 Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
898 to the 64-bit I/O port.
900 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
901 the read result and the value specified by AndData, and writes the result to
902 the 64-bit I/O port specified by Port. The value written to the I/O port is
903 returned. This function must guarantee that all I/O read and write operations
906 If 64-bit I/O port operations are not supported, then ASSERT().
908 @param Port The I/O port to write.
909 @param AndData The value to AND with the read value from the I/O port.
911 @return The value written back to the I/O port.
921 return IoWrite64 (Port
, IoRead64 (Port
) & AndData
);
925 Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
926 inclusive OR, and writes the result back to the 64-bit I/O port.
928 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
929 the read result and the value specified by AndData, performs a bitwise OR
930 between the result of the AND operation and the value specified by OrData,
931 and writes the result to the 64-bit I/O port specified by Port. The value
932 written to the I/O port is returned. This function must guarantee that all
933 I/O read and write operations are serialized.
935 If 64-bit I/O port operations are not supported, then ASSERT().
937 @param Port The I/O port to write.
938 @param AndData The value to AND with the read value from the I/O port.
939 @param OrData The value to OR with the result of the AND operation.
941 @return The value written back to the I/O port.
952 return IoWrite64 (Port
, (IoRead64 (Port
) & AndData
) | OrData
);
956 Reads a bit field of an I/O register.
958 Reads the bit field in a 64-bit I/O register. The bit field is specified by
959 the StartBit and the EndBit. The value of the bit field is returned.
961 If 64-bit I/O port operations are not supported, then ASSERT().
962 If StartBit is greater than 63, then ASSERT().
963 If EndBit is greater than 63, then ASSERT().
964 If EndBit is less than StartBit, then ASSERT().
966 @param Port The I/O port to read.
967 @param StartBit The ordinal of the least significant bit in the bit field.
969 @param EndBit The ordinal of the most significant bit in the bit field.
972 @return The value read.
983 return BitFieldRead64 (IoRead64 (Port
), StartBit
, EndBit
);
987 Writes a bit field to an I/O register.
989 Writes Value to the bit field of the I/O register. The bit field is specified
990 by the StartBit and the EndBit. All other bits in the destination I/O
991 register are preserved. The value written to the I/O port is returned. Extra
992 left bits in Value are stripped.
994 If 64-bit I/O port operations are not supported, then ASSERT().
995 If StartBit is greater than 63, then ASSERT().
996 If EndBit is greater than 63, then ASSERT().
997 If EndBit is less than StartBit, then ASSERT().
999 @param Port The I/O port to write.
1000 @param StartBit The ordinal of the least significant bit in the bit field.
1002 @param EndBit The ordinal of the most significant bit in the bit field.
1004 @param Value New value of the bit field.
1006 @return The value written back to the I/O port.
1020 BitFieldWrite64 (IoRead64 (Port
), StartBit
, EndBit
, Value
)
1025 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1026 result back to the bit field in the 64-bit port.
1028 Reads the 64-bit I/O port specified by Port, performs a bitwise inclusive OR
1029 between the read result and the value specified by OrData, and writes the
1030 result to the 64-bit I/O port specified by Port. The value written to the I/O
1031 port is returned. This function must guarantee that all I/O read and write
1032 operations are serialized. Extra left bits in OrData are stripped.
1034 If 64-bit I/O port operations are not supported, then ASSERT().
1035 If StartBit is greater than 63, then ASSERT().
1036 If EndBit is greater than 63, then ASSERT().
1037 If EndBit is less than StartBit, then ASSERT().
1039 @param Port The I/O port to write.
1040 @param StartBit The ordinal of the least significant bit in the bit field.
1042 @param EndBit The ordinal of the most significant bit in the bit field.
1044 @param OrData The value to OR with the read value from the I/O port.
1046 @return The value written back to the I/O port.
1060 BitFieldOr64 (IoRead64 (Port
), StartBit
, EndBit
, OrData
)
1065 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1066 result back to the bit field in the 64-bit port.
1068 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1069 the read result and the value specified by AndData, and writes the result to
1070 the 64-bit I/O port specified by Port. The value written to the I/O port is
1071 returned. This function must guarantee that all I/O read and write operations
1072 are serialized. Extra left bits in AndData are stripped.
1074 If 64-bit I/O port operations are not supported, then ASSERT().
1075 If StartBit is greater than 63, then ASSERT().
1076 If EndBit is greater than 63, then ASSERT().
1077 If EndBit is less than StartBit, then ASSERT().
1079 @param Port The I/O port to write.
1080 @param StartBit The ordinal of the least significant bit in the bit field.
1082 @param EndBit The ordinal of the most significant bit in the bit field.
1084 @param AndData The value to AND with the read value from the I/O port.
1086 @return The value written back to the I/O port.
1100 BitFieldAnd64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
)
1105 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
1106 bitwise inclusive OR, and writes the result back to the bit field in the
1109 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
1110 by a bitwise inclusive OR between the read result and the value specified by
1111 AndData, and writes the result to the 64-bit I/O port specified by Port. The
1112 value written to the I/O port is returned. This function must guarantee that
1113 all I/O read and write operations are serialized. Extra left bits in both
1114 AndData and OrData are stripped.
1116 If 64-bit I/O port operations are not supported, then ASSERT().
1117 If StartBit is greater than 63, then ASSERT().
1118 If EndBit is greater than 63, then ASSERT().
1119 If EndBit is less than StartBit, then ASSERT().
1121 @param Port The I/O port to write.
1122 @param StartBit The ordinal of the least significant bit in the bit field.
1124 @param EndBit The ordinal of the most significant bit in the bit field.
1126 @param AndData The value to AND with the read value from the I/O port.
1127 @param OrData The value to OR with the result of the AND operation.
1129 @return The value written back to the I/O port.
1134 IoBitFieldAndThenOr64 (
1144 BitFieldAndThenOr64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
, OrData
)
1149 Reads an 8-bit MMIO register, performs a bitwise inclusive OR, and writes the
1150 result back to the 8-bit MMIO register.
1152 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1153 inclusive OR between the read result and the value specified by OrData, and
1154 writes the result to the 8-bit MMIO register specified by Address. The value
1155 written to the MMIO register is returned. This function must guarantee that
1156 all MMIO read and write operations are serialized.
1158 If 8-bit MMIO register operations are not supported, then ASSERT().
1160 @param Address The MMIO register to write.
1161 @param OrData The value to OR with the read value from the MMIO register.
1163 @return The value written back to the MMIO register.
1173 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) | OrData
));
1177 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1178 back to the 8-bit MMIO register.
1180 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1181 between the read result and the value specified by AndData, and writes the
1182 result to the 8-bit MMIO register specified by Address. The value written to
1183 the MMIO register is returned. This function must guarantee that all MMIO
1184 read and write operations are serialized.
1186 If 8-bit MMIO register operations are not supported, then ASSERT().
1188 @param Address The MMIO register to write.
1189 @param AndData The value to AND with the read value from the MMIO register.
1191 @return The value written back to the MMIO register.
1201 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) & AndData
));
1205 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1206 inclusive OR, and writes the result back to the 8-bit MMIO register.
1208 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1209 between the read result and the value specified by AndData, performs a
1210 bitwise OR between the result of the AND operation and the value specified by
1211 OrData, and writes the result to the 8-bit MMIO register specified by
1212 Address. The value written to the MMIO register is returned. This function
1213 must guarantee that all MMIO read and write operations are serialized.
1215 If 8-bit MMIO register operations are not supported, then ASSERT().
1218 @param Address The MMIO register to write.
1219 @param AndData The value to AND with the read value from the MMIO register.
1220 @param OrData The value to OR with the result of the AND operation.
1222 @return The value written back to the MMIO register.
1233 return MmioWrite8 (Address
, (UINT8
) ((MmioRead8 (Address
) & AndData
) | OrData
));
1237 Reads a bit field of a MMIO register.
1239 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1240 the StartBit and the EndBit. The value of the bit field is returned.
1242 If 8-bit MMIO register operations are not supported, then ASSERT().
1243 If StartBit is greater than 7, then ASSERT().
1244 If EndBit is greater than 7, then ASSERT().
1245 If EndBit is less than StartBit, then ASSERT().
1247 @param Address MMIO register to read.
1248 @param StartBit The ordinal of the least significant bit in the bit field.
1250 @param EndBit The ordinal of the most significant bit in the bit field.
1253 @return The value read.
1264 return BitFieldRead8 (MmioRead8 (Address
), StartBit
, EndBit
);
1268 Writes a bit field to a MMIO register.
1270 Writes Value to the bit field of the MMIO register. The bit field is
1271 specified by the StartBit and the EndBit. All other bits in the destination
1272 MMIO register are preserved. The new value of the 8-bit register is returned.
1274 If 8-bit MMIO register operations are not supported, then ASSERT().
1275 If StartBit is greater than 7, then ASSERT().
1276 If EndBit is greater than 7, then ASSERT().
1277 If EndBit is less than StartBit, then ASSERT().
1279 @param Address MMIO register to write.
1280 @param StartBit The ordinal of the least significant bit in the bit field.
1282 @param EndBit The ordinal of the most significant bit in the bit field.
1284 @param Value New value of the bit field.
1286 @return The value written back to the MMIO register.
1291 MmioBitFieldWrite8 (
1300 BitFieldWrite8 (MmioRead8 (Address
), StartBit
, EndBit
, Value
)
1305 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1306 writes the result back to the bit field in the 8-bit MMIO register.
1308 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1309 inclusive OR between the read result and the value specified by OrData, and
1310 writes the result to the 8-bit MMIO register specified by Address. The value
1311 written to the MMIO register is returned. This function must guarantee that
1312 all MMIO read and write operations are serialized. Extra left bits in OrData
1315 If 8-bit MMIO register operations are not supported, then ASSERT().
1316 If StartBit is greater than 7, then ASSERT().
1317 If EndBit is greater than 7, then ASSERT().
1318 If EndBit is less than StartBit, then ASSERT().
1320 @param Address MMIO register to write.
1321 @param StartBit The ordinal of the least significant bit in the bit field.
1323 @param EndBit The ordinal of the most significant bit in the bit field.
1325 @param OrData The value to OR with read value from the MMIO register.
1327 @return The value written back to the MMIO register.
1341 BitFieldOr8 (MmioRead8 (Address
), StartBit
, EndBit
, OrData
)
1346 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1347 writes the result back to the bit field in the 8-bit MMIO register.
1349 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1350 between the read result and the value specified by AndData, and writes the
1351 result to the 8-bit MMIO register specified by Address. The value written to
1352 the MMIO register is returned. This function must guarantee that all MMIO
1353 read and write operations are serialized. Extra left bits in AndData are
1356 If 8-bit MMIO register operations are not supported, then ASSERT().
1357 If StartBit is greater than 7, then ASSERT().
1358 If EndBit is greater than 7, then ASSERT().
1359 If EndBit is less than StartBit, then ASSERT().
1361 @param Address MMIO register to write.
1362 @param StartBit The ordinal of the least significant bit in the bit field.
1364 @param EndBit The ordinal of the most significant bit in the bit field.
1366 @param AndData The value to AND with read value from the MMIO register.
1368 @return The value written back to the MMIO register.
1382 BitFieldAnd8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
)
1387 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1388 by a bitwise inclusive OR, and writes the result back to the bit field in the
1389 8-bit MMIO register.
1391 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1392 followed by a bitwise inclusive OR between the read result and the value
1393 specified by AndData, and writes the result to the 8-bit MMIO register
1394 specified by Address. The value written to the MMIO register is returned.
1395 This function must guarantee that all MMIO read and write operations are
1396 serialized. Extra left bits in both AndData and OrData are stripped.
1398 If 8-bit MMIO register operations are not supported, then ASSERT().
1399 If StartBit is greater than 7, then ASSERT().
1400 If EndBit is greater than 7, then ASSERT().
1401 If EndBit is less than StartBit, then ASSERT().
1403 @param Address MMIO register to write.
1404 @param StartBit The ordinal of the least significant bit in the bit field.
1406 @param EndBit The ordinal of the most significant bit in the bit field.
1408 @param AndData The value to AND with read value from the MMIO register.
1409 @param OrData The value to OR with the result of the AND operation.
1411 @return The value written back to the MMIO register.
1416 MmioBitFieldAndThenOr8 (
1426 BitFieldAndThenOr8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1431 Reads a 16-bit MMIO register, performs a bitwise inclusive OR, and writes the
1432 result back to the 16-bit MMIO register.
1434 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1435 inclusive OR between the read result and the value specified by OrData, and
1436 writes the result to the 16-bit MMIO register specified by Address. The value
1437 written to the MMIO register is returned. This function must guarantee that
1438 all MMIO read and write operations are serialized.
1440 If 16-bit MMIO register operations are not supported, then ASSERT().
1442 @param Address The MMIO register to write.
1443 @param OrData The value to OR with the read value from the MMIO register.
1445 @return The value written back to the MMIO register.
1455 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) | OrData
));
1459 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1460 back to the 16-bit MMIO register.
1462 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1463 between the read result and the value specified by AndData, and writes the
1464 result to the 16-bit MMIO register specified by Address. The value written to
1465 the MMIO register is returned. This function must guarantee that all MMIO
1466 read and write operations are serialized.
1468 If 16-bit MMIO register operations are not supported, then ASSERT().
1470 @param Address The MMIO register to write.
1471 @param AndData The value to AND with the read value from the MMIO register.
1473 @return The value written back to the MMIO register.
1483 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) & AndData
));
1487 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1488 inclusive OR, and writes the result back to the 16-bit MMIO register.
1490 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1491 between the read result and the value specified by AndData, performs a
1492 bitwise OR between the result of the AND operation and the value specified by
1493 OrData, and writes the result to the 16-bit MMIO register specified by
1494 Address. The value written to the MMIO register is returned. This function
1495 must guarantee that all MMIO read and write operations are serialized.
1497 If 16-bit MMIO register operations are not supported, then ASSERT().
1500 @param Address The MMIO register to write.
1501 @param AndData The value to AND with the read value from the MMIO register.
1502 @param OrData The value to OR with the result of the AND operation.
1504 @return The value written back to the MMIO register.
1515 return MmioWrite16 (Address
, (UINT16
) ((MmioRead16 (Address
) & AndData
) | OrData
));
1519 Reads a bit field of a MMIO register.
1521 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
1522 the StartBit and the EndBit. The value of the bit field is returned.
1524 If 16-bit MMIO register operations are not supported, then ASSERT().
1525 If StartBit is greater than 15, then ASSERT().
1526 If EndBit is greater than 15, then ASSERT().
1527 If EndBit is less than StartBit, then ASSERT().
1529 @param Address MMIO register to read.
1530 @param StartBit The ordinal of the least significant bit in the bit field.
1532 @param EndBit The ordinal of the most significant bit in the bit field.
1535 @return The value read.
1540 MmioBitFieldRead16 (
1546 return BitFieldRead16 (MmioRead16 (Address
), StartBit
, EndBit
);
1550 Writes a bit field to a MMIO register.
1552 Writes Value to the bit field of the MMIO register. The bit field is
1553 specified by the StartBit and the EndBit. All other bits in the destination
1554 MMIO register are preserved. The new value of the 16-bit register is returned.
1556 If 16-bit MMIO register operations are not supported, then ASSERT().
1557 If StartBit is greater than 15, then ASSERT().
1558 If EndBit is greater than 15, then ASSERT().
1559 If EndBit is less than StartBit, then ASSERT().
1561 @param Address MMIO register to write.
1562 @param StartBit The ordinal of the least significant bit in the bit field.
1564 @param EndBit The ordinal of the most significant bit in the bit field.
1566 @param Value New value of the bit field.
1568 @return The value written back to the MMIO register.
1573 MmioBitFieldWrite16 (
1580 return MmioWrite16 (
1582 BitFieldWrite16 (MmioRead16 (Address
), StartBit
, EndBit
, Value
)
1587 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
1588 writes the result back to the bit field in the 16-bit MMIO register.
1590 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1591 inclusive OR between the read result and the value specified by OrData, and
1592 writes the result to the 16-bit MMIO register specified by Address. The value
1593 written to the MMIO register is returned. This function must guarantee that
1594 all MMIO read and write operations are serialized. Extra left bits in OrData
1597 If 16-bit MMIO register operations are not supported, then ASSERT().
1598 If StartBit is greater than 15, then ASSERT().
1599 If EndBit is greater than 15, then ASSERT().
1600 If EndBit is less than StartBit, then ASSERT().
1602 @param Address MMIO register to write.
1603 @param StartBit The ordinal of the least significant bit in the bit field.
1605 @param EndBit The ordinal of the most significant bit in the bit field.
1607 @param OrData The value to OR with read value from the MMIO register.
1609 @return The value written back to the MMIO register.
1621 return MmioWrite16 (
1623 BitFieldOr16 (MmioRead16 (Address
), StartBit
, EndBit
, OrData
)
1628 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
1629 writes the result back to the bit field in the 16-bit MMIO register.
1631 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1632 between the read result and the value specified by AndData, and writes the
1633 result to the 16-bit MMIO register specified by Address. The value written to
1634 the MMIO register is returned. This function must guarantee that all MMIO
1635 read and write operations are serialized. Extra left bits in AndData are
1638 If 16-bit MMIO register operations are not supported, then ASSERT().
1639 If StartBit is greater than 15, then ASSERT().
1640 If EndBit is greater than 15, then ASSERT().
1641 If EndBit is less than StartBit, then ASSERT().
1643 @param Address MMIO register to write.
1644 @param StartBit The ordinal of the least significant bit in the bit field.
1646 @param EndBit The ordinal of the most significant bit in the bit field.
1648 @param AndData The value to AND with read value from the MMIO register.
1650 @return The value written back to the MMIO register.
1662 return MmioWrite16 (
1664 BitFieldAnd16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
)
1669 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
1670 by a bitwise inclusive OR, and writes the result back to the bit field in the
1671 16-bit MMIO register.
1673 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1674 followed by a bitwise inclusive OR between the read result and the value
1675 specified by AndData, and writes the result to the 16-bit MMIO register
1676 specified by Address. The value written to the MMIO register is returned.
1677 This function must guarantee that all MMIO read and write operations are
1678 serialized. Extra left bits in both AndData and OrData are stripped.
1680 If 16-bit MMIO register operations are not supported, then ASSERT().
1681 If StartBit is greater than 15, then ASSERT().
1682 If EndBit is greater than 15, then ASSERT().
1683 If EndBit is less than StartBit, then ASSERT().
1685 @param Address MMIO register to write.
1686 @param StartBit The ordinal of the least significant bit in the bit field.
1688 @param EndBit The ordinal of the most significant bit in the bit field.
1690 @param AndData The value to AND with read value from the MMIO register.
1691 @param OrData The value to OR with the result of the AND operation.
1693 @return The value written back to the MMIO register.
1698 MmioBitFieldAndThenOr16 (
1706 return MmioWrite16 (
1708 BitFieldAndThenOr16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1713 Reads a 32-bit MMIO register, performs a bitwise inclusive OR, and writes the
1714 result back to the 32-bit MMIO register.
1716 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1717 inclusive OR between the read result and the value specified by OrData, and
1718 writes the result to the 32-bit MMIO register specified by Address. The value
1719 written to the MMIO register is returned. This function must guarantee that
1720 all MMIO read and write operations are serialized.
1722 If 32-bit MMIO register operations are not supported, then ASSERT().
1724 @param Address The MMIO register to write.
1725 @param OrData The value to OR with the read value from the MMIO register.
1727 @return The value written back to the MMIO register.
1737 return MmioWrite32 (Address
, MmioRead32 (Address
) | OrData
);
1741 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
1742 back to the 32-bit MMIO register.
1744 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1745 between the read result and the value specified by AndData, and writes the
1746 result to the 32-bit MMIO register specified by Address. The value written to
1747 the MMIO register is returned. This function must guarantee that all MMIO
1748 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 AndData The value to AND with the read value from the MMIO register.
1755 @return The value written back to the MMIO register.
1765 return MmioWrite32 (Address
, MmioRead32 (Address
) & AndData
);
1769 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
1770 inclusive OR, and writes the result 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, performs a
1774 bitwise OR between the result of the AND operation and the value specified by
1775 OrData, and writes the result to the 32-bit MMIO register specified by
1776 Address. The value written to the MMIO register is returned. This function
1777 must guarantee that all MMIO read and write operations are serialized.
1779 If 32-bit MMIO register operations are not supported, then ASSERT().
1782 @param Address The MMIO register to write.
1783 @param AndData The value to AND with the read value from the MMIO register.
1784 @param OrData The value to OR with the result of the AND operation.
1786 @return The value written back to the MMIO register.
1797 return MmioWrite32 (Address
, (MmioRead32 (Address
) & AndData
) | OrData
);
1801 Reads a bit field of a MMIO register.
1803 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
1804 the StartBit and the EndBit. The value of the bit field is returned.
1806 If 32-bit MMIO register operations are not supported, then ASSERT().
1807 If StartBit is greater than 31, then ASSERT().
1808 If EndBit is greater than 31, then ASSERT().
1809 If EndBit is less than StartBit, then ASSERT().
1811 @param Address MMIO register to read.
1812 @param StartBit The ordinal of the least significant bit in the bit field.
1814 @param EndBit The ordinal of the most significant bit in the bit field.
1817 @return The value read.
1822 MmioBitFieldRead32 (
1828 return BitFieldRead32 (MmioRead32 (Address
), StartBit
, EndBit
);
1832 Writes a bit field to a MMIO register.
1834 Writes Value to the bit field of the MMIO register. The bit field is
1835 specified by the StartBit and the EndBit. All other bits in the destination
1836 MMIO register are preserved. The new value of the 32-bit register is returned.
1838 If 32-bit MMIO register operations are not supported, then ASSERT().
1839 If StartBit is greater than 31, then ASSERT().
1840 If EndBit is greater than 31, then ASSERT().
1841 If EndBit is less than StartBit, then ASSERT().
1843 @param Address MMIO register to write.
1844 @param StartBit The ordinal of the least significant bit in the bit field.
1846 @param EndBit The ordinal of the most significant bit in the bit field.
1848 @param Value New value of the bit field.
1850 @return The value written back to the MMIO register.
1855 MmioBitFieldWrite32 (
1862 return MmioWrite32 (
1864 BitFieldWrite32 (MmioRead32 (Address
), StartBit
, EndBit
, Value
)
1869 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
1870 writes the result back to the bit field in the 32-bit MMIO register.
1872 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1873 inclusive OR between the read result and the value specified by OrData, and
1874 writes the result to the 32-bit MMIO register specified by Address. The value
1875 written to the MMIO register is returned. This function must guarantee that
1876 all MMIO read and write operations are serialized. Extra left bits in OrData
1879 If 32-bit MMIO register operations are not supported, then ASSERT().
1880 If StartBit is greater than 31, then ASSERT().
1881 If EndBit is greater than 31, then ASSERT().
1882 If EndBit is less than StartBit, then ASSERT().
1884 @param Address MMIO register to write.
1885 @param StartBit The ordinal of the least significant bit in the bit field.
1887 @param EndBit The ordinal of the most significant bit in the bit field.
1889 @param OrData The value to OR with read value from the MMIO register.
1891 @return The value written back to the MMIO register.
1903 return MmioWrite32 (
1905 BitFieldOr32 (MmioRead32 (Address
), StartBit
, EndBit
, OrData
)
1910 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
1911 writes the result back to the bit field in the 32-bit MMIO register.
1913 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1914 between the read result and the value specified by AndData, and writes the
1915 result to the 32-bit MMIO register specified by Address. The value written to
1916 the MMIO register is returned. This function must guarantee that all MMIO
1917 read and write operations are serialized. Extra left bits in AndData are
1920 If 32-bit MMIO register operations are not supported, then ASSERT().
1921 If StartBit is greater than 31, then ASSERT().
1922 If EndBit is greater than 31, then ASSERT().
1923 If EndBit is less than StartBit, then ASSERT().
1925 @param Address MMIO register to write.
1926 @param StartBit The ordinal of the least significant bit in the bit field.
1928 @param EndBit The ordinal of the most significant bit in the bit field.
1930 @param AndData The value to AND with read value from the MMIO register.
1932 @return The value written back to the MMIO register.
1944 return MmioWrite32 (
1946 BitFieldAnd32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
)
1951 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
1952 by a bitwise inclusive OR, and writes the result back to the bit field in the
1953 32-bit MMIO register.
1955 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1956 followed by a bitwise inclusive OR between the read result and the value
1957 specified by AndData, and writes the result to the 32-bit MMIO register
1958 specified by Address. The value written to the MMIO register is returned.
1959 This function must guarantee that all MMIO read and write operations are
1960 serialized. Extra left bits in both AndData and OrData are stripped.
1962 If 32-bit MMIO register operations are not supported, then ASSERT().
1963 If StartBit is greater than 31, then ASSERT().
1964 If EndBit is greater than 31, then ASSERT().
1965 If EndBit is less than StartBit, then ASSERT().
1967 @param Address MMIO register to write.
1968 @param StartBit The ordinal of the least significant bit in the bit field.
1970 @param EndBit The ordinal of the most significant bit in the bit field.
1972 @param AndData The value to AND with read value from the MMIO register.
1973 @param OrData The value to OR with the result of the AND operation.
1975 @return The value written back to the MMIO register.
1980 MmioBitFieldAndThenOr32 (
1988 return MmioWrite32 (
1990 BitFieldAndThenOr32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1995 Reads a 64-bit MMIO register, performs a bitwise inclusive OR, and writes the
1996 result back to the 64-bit MMIO register.
1998 Reads the 64-bit MMIO register specified by Address, performs a bitwise
1999 inclusive OR between the read result and the value specified by OrData, and
2000 writes the result to the 64-bit MMIO register specified by Address. The value
2001 written to the MMIO register is returned. This function must guarantee that
2002 all MMIO read and write operations are serialized.
2004 If 64-bit MMIO register operations are not supported, then ASSERT().
2006 @param Address The MMIO register to write.
2007 @param OrData The value to OR with the read value from the MMIO register.
2009 @return The value written back to the MMIO register.
2019 return MmioWrite64 (Address
, MmioRead64 (Address
) | OrData
);
2023 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2024 back to the 64-bit MMIO register.
2026 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2027 between the read result and the value specified by AndData, and writes the
2028 result to the 64-bit MMIO register specified by Address. The value written to
2029 the MMIO register is returned. This function must guarantee that all MMIO
2030 read and write operations are serialized.
2032 If 64-bit MMIO register operations are not supported, then ASSERT().
2034 @param Address The MMIO register to write.
2035 @param AndData The value to AND with the read value from the MMIO register.
2037 @return The value written back to the MMIO register.
2047 return MmioWrite64 (Address
, MmioRead64 (Address
) & AndData
);
2051 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2052 inclusive OR, and writes the result back to the 64-bit MMIO register.
2054 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2055 between the read result and the value specified by AndData, performs a
2056 bitwise OR between the result of the AND operation and the value specified by
2057 OrData, and writes the result to the 64-bit MMIO register specified by
2058 Address. The value written to the MMIO register is returned. This function
2059 must guarantee that all MMIO read and write operations are serialized.
2061 If 64-bit MMIO register operations are not supported, then ASSERT().
2064 @param Address The MMIO register to write.
2065 @param AndData The value to AND with the read value from the MMIO register.
2066 @param OrData The value to OR with the result of the AND operation.
2068 @return The value written back to the MMIO register.
2079 return MmioWrite64 (Address
, (MmioRead64 (Address
) & AndData
) | OrData
);
2083 Reads a bit field of a MMIO register.
2085 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2086 the StartBit and the EndBit. The value of the bit field is returned.
2088 If 64-bit MMIO register operations are not supported, then ASSERT().
2089 If StartBit is greater than 63, then ASSERT().
2090 If EndBit is greater than 63, then ASSERT().
2091 If EndBit is less than StartBit, then ASSERT().
2093 @param Address MMIO register to read.
2094 @param StartBit The ordinal of the least significant bit in the bit field.
2096 @param EndBit The ordinal of the most significant bit in the bit field.
2099 @return The value read.
2104 MmioBitFieldRead64 (
2110 return BitFieldRead64 (MmioRead64 (Address
), StartBit
, EndBit
);
2114 Writes a bit field to a MMIO register.
2116 Writes Value to the bit field of the MMIO register. The bit field is
2117 specified by the StartBit and the EndBit. All other bits in the destination
2118 MMIO register are preserved. The new value of the 64-bit register is returned.
2120 If 64-bit MMIO register operations are not supported, then ASSERT().
2121 If StartBit is greater than 63, then ASSERT().
2122 If EndBit is greater than 63, then ASSERT().
2123 If EndBit is less than StartBit, then ASSERT().
2125 @param Address MMIO register to write.
2126 @param StartBit The ordinal of the least significant bit in the bit field.
2128 @param EndBit The ordinal of the most significant bit in the bit field.
2130 @param Value New value of the bit field.
2132 @return The value written back to the MMIO register.
2137 MmioBitFieldWrite64 (
2144 return MmioWrite64 (
2146 BitFieldWrite64 (MmioRead64 (Address
), StartBit
, EndBit
, Value
)
2151 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2152 writes the result back to the bit field in the 64-bit MMIO register.
2154 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2155 inclusive OR between the read result and the value specified by OrData, and
2156 writes the result to the 64-bit MMIO register specified by Address. The value
2157 written to the MMIO register is returned. This function must guarantee that
2158 all MMIO read and write operations are serialized. Extra left bits in OrData
2161 If 64-bit MMIO register operations are not supported, then ASSERT().
2162 If StartBit is greater than 63, then ASSERT().
2163 If EndBit is greater than 63, then ASSERT().
2164 If EndBit is less than StartBit, then ASSERT().
2166 @param Address MMIO register to write.
2167 @param StartBit The ordinal of the least significant bit in the bit field.
2169 @param EndBit The ordinal of the most significant bit in the bit field.
2171 @param OrData The value to OR with read value from the MMIO register.
2173 @return The value written back to the MMIO register.
2185 return MmioWrite64 (
2187 BitFieldOr64 (MmioRead64 (Address
), StartBit
, EndBit
, OrData
)
2192 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2193 writes the result back to the bit field in the 64-bit MMIO register.
2195 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2196 between the read result and the value specified by AndData, and writes the
2197 result to the 64-bit MMIO register specified by Address. The value written to
2198 the MMIO register is returned. This function must guarantee that all MMIO
2199 read and write operations are serialized. Extra left bits in AndData are
2202 If 64-bit MMIO register operations are not supported, then ASSERT().
2203 If StartBit is greater than 63, then ASSERT().
2204 If EndBit is greater than 63, then ASSERT().
2205 If EndBit is less than StartBit, then ASSERT().
2207 @param Address MMIO register to write.
2208 @param StartBit The ordinal of the least significant bit in the bit field.
2210 @param EndBit The ordinal of the most significant bit in the bit field.
2212 @param AndData The value to AND with read value from the MMIO register.
2214 @return The value written back to the MMIO register.
2226 return MmioWrite64 (
2228 BitFieldAnd64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
)
2233 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2234 by a bitwise inclusive OR, and writes the result back to the bit field in the
2235 64-bit MMIO register.
2237 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2238 followed by a bitwise inclusive OR between the read result and the value
2239 specified by AndData, and writes the result to the 64-bit MMIO register
2240 specified by Address. The value written to the MMIO register is returned.
2241 This function must guarantee that all MMIO read and write operations are
2242 serialized. Extra left bits in both AndData and OrData are stripped.
2244 If 64-bit MMIO register operations are not supported, then ASSERT().
2245 If StartBit is greater than 63, then ASSERT().
2246 If EndBit is greater than 63, then ASSERT().
2247 If EndBit is less than StartBit, then ASSERT().
2249 @param Address MMIO register to write.
2250 @param StartBit The ordinal of the least significant bit in the bit field.
2252 @param EndBit The ordinal of the most significant bit in the bit field.
2254 @param AndData The value to AND with read value from the MMIO register.
2255 @param OrData The value to OR with the result of the AND operation.
2257 @return The value written back to the MMIO register.
2262 MmioBitFieldAndThenOr64 (
2270 return MmioWrite64 (
2272 BitFieldAndThenOr64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
, OrData
)