]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/DxeIoLibEsal/IoHighLevel.c
2 High-level Io/Mmio functions.
4 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "DxeIoLibEsalInternal.h"
18 Reads an 8-bit I/O port, performs a bitwise OR, and writes the
19 result back to the 8-bit I/O port.
21 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
22 between the read result and the value specified by OrData, and writes the
23 result to the 8-bit I/O port specified by Port. The value written to the I/O
24 port is returned. This function must guarantee that all I/O read and write
25 operations are serialized.
27 If 8-bit I/O port operations are not supported, then ASSERT().
29 @param Port The I/O port to write.
30 @param OrData The value to OR with the value read from the I/O port.
32 @return The value written back to the I/O port.
42 return IoWrite8 (Port
, (UINT8
)(IoRead8 (Port
) | OrData
));
46 Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
47 to the 8-bit I/O port.
49 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
50 the read result and the value specified by AndData, and writes the result to
51 the 8-bit I/O port specified by Port. The value written to the I/O port is
52 returned. This function must guarantee that all I/O read and write operations
55 If 8-bit I/O port operations are not supported, then ASSERT().
57 @param Port The I/O port to write.
58 @param AndData The value to AND with the value read from the I/O port.
60 @return The value written back to the I/O port.
70 return IoWrite8 (Port
, (UINT8
)(IoRead8 (Port
) & AndData
));
74 Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
75 inclusive OR, and writes the result back to the 8-bit I/O port.
77 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
78 the read result and the value specified by AndData, performs a bitwise OR
79 between the result of the AND operation and the value specified by OrData,
80 and writes the result to the 8-bit I/O port specified by Port. The value
81 written to the I/O port is returned. This function must guarantee that all
82 I/O read and write operations are serialized.
84 If 8-bit I/O port operations are not supported, then ASSERT().
86 @param Port The I/O port to write.
87 @param AndData The value to AND with the value read from the I/O port.
88 @param OrData The value to OR with the result of the AND operation.
90 @return The value written back to the I/O port.
101 return IoWrite8 (Port
, (UINT8
)((IoRead8 (Port
) & AndData
) | OrData
));
105 Reads a bit field of an I/O register.
107 Reads the bit field in an 8-bit I/O register. The bit field is specified by
108 the StartBit and the EndBit. The value of the bit field is returned.
110 If 8-bit I/O port operations are not supported, then ASSERT().
111 If StartBit is greater than 7, then ASSERT().
112 If EndBit is greater than 7, then ASSERT().
113 If EndBit is less than StartBit, then ASSERT().
115 @param Port The I/O port to read.
116 @param StartBit The ordinal of the least significant bit in the bit field.
118 @param EndBit The ordinal of the most significant bit in the bit field.
121 @return The value read.
132 return BitFieldRead8 (IoRead8 (Port
), StartBit
, EndBit
);
136 Writes a bit field to an I/O register.
138 Writes Value to the bit field of the I/O register. The bit field is specified
139 by the StartBit and the EndBit. All other bits in the destination I/O
140 register are preserved. The value written to the I/O port is returned. Extra
141 left bits in Value are stripped.
143 If 8-bit I/O port operations are not supported, then ASSERT().
144 If StartBit is greater than 7, then ASSERT().
145 If EndBit is greater than 7, then ASSERT().
146 If EndBit is less than StartBit, then ASSERT().
147 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
149 @param Port The I/O port to write.
150 @param StartBit The ordinal of the least significant bit in the bit field.
152 @param EndBit The ordinal of the most significant bit in the bit field.
154 @param Value New value of the bit field.
156 @return The value written back to the I/O port.
170 BitFieldWrite8 (IoRead8 (Port
), StartBit
, EndBit
, Value
)
175 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
176 result back to the bit field in the 8-bit port.
178 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
179 between the read result and the value specified by OrData, and writes the
180 result to the 8-bit I/O port specified by Port. The value written to the I/O
181 port is returned. This function must guarantee that all I/O read and write
182 operations are serialized. Extra left bits in OrData are stripped.
184 If 8-bit I/O port operations are not supported, then ASSERT().
185 If StartBit is greater than 7, then ASSERT().
186 If EndBit is greater than 7, then ASSERT().
187 If EndBit is less than StartBit, then ASSERT().
188 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
190 @param Port The I/O port to write.
191 @param StartBit The ordinal of the least significant bit in the bit field.
193 @param EndBit The ordinal of the most significant bit in the bit field.
195 @param OrData The value to OR with the value read from the I/O port.
197 @return The value written back to the I/O port.
211 BitFieldOr8 (IoRead8 (Port
), StartBit
, EndBit
, OrData
)
216 Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
217 result back to the bit field in the 8-bit port.
219 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
220 the read result and the value specified by AndData, and writes the result to
221 the 8-bit I/O port specified by Port. The value written to the I/O port is
222 returned. This function must guarantee that all I/O read and write operations
223 are serialized. Extra left bits in AndData are stripped.
225 If 8-bit I/O port operations are not supported, then ASSERT().
226 If StartBit is greater than 7, then ASSERT().
227 If EndBit is greater than 7, then ASSERT().
228 If EndBit is less than StartBit, then ASSERT().
229 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
231 @param Port The I/O port to write.
232 @param StartBit The ordinal of the least significant bit in the bit field.
234 @param EndBit The ordinal of the most significant bit in the bit field.
236 @param AndData The value to AND with the value read from the I/O port.
238 @return The value written back to the I/O port.
252 BitFieldAnd8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
)
257 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
258 bitwise OR, and writes the result back to the bit field in the
261 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
262 by a bitwise OR between the read result and the value specified by
263 AndData, and writes the result to the 8-bit I/O port specified by Port. The
264 value written to the I/O port is returned. This function must guarantee that
265 all I/O read and write operations are serialized. Extra left bits in both
266 AndData and OrData are stripped.
268 If 8-bit I/O port operations are not supported, then ASSERT().
269 If StartBit is greater than 7, then ASSERT().
270 If EndBit is greater than 7, then ASSERT().
271 If EndBit is less than StartBit, then ASSERT().
272 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
273 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
275 @param Port The I/O port to write.
276 @param StartBit The ordinal of the least significant bit in the bit field.
278 @param EndBit The ordinal of the most significant bit in the bit field.
280 @param AndData The value to AND with the value read from the I/O port.
281 @param OrData The value to OR with the result of the AND operation.
283 @return The value written back to the I/O port.
288 IoBitFieldAndThenOr8 (
298 BitFieldAndThenOr8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
, OrData
)
303 Reads a 16-bit I/O port, performs a bitwise OR, and writes the
304 result back to the 16-bit I/O port.
306 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
307 between the read result and the value specified by OrData, and writes the
308 result to the 16-bit I/O port specified by Port. The value written to the I/O
309 port is returned. This function must guarantee that all I/O read and write
310 operations are serialized.
312 If 16-bit I/O port operations are not supported, then ASSERT().
314 @param Port The I/O port to write.
315 @param OrData The value to OR with the value read from the I/O port.
317 @return The value written back to the I/O port.
327 return IoWrite16 (Port
, (UINT16
)(IoRead16 (Port
) | OrData
));
331 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
332 to the 16-bit I/O port.
334 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
335 the read result and the value specified by AndData, and writes the result to
336 the 16-bit I/O port specified by Port. The value written to the I/O port is
337 returned. This function must guarantee that all I/O read and write operations
340 If 16-bit I/O port operations are not supported, then ASSERT().
342 @param Port The I/O port to write.
343 @param AndData The value to AND with the value read from the I/O port.
345 @return The value written back to the I/O port.
355 return IoWrite16 (Port
, (UINT16
)(IoRead16 (Port
) & AndData
));
359 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
360 inclusive OR, and writes the result back to the 16-bit I/O port.
362 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
363 the read result and the value specified by AndData, performs a bitwise OR
364 between the result of the AND operation and the value specified by OrData,
365 and writes the result to the 16-bit I/O port specified by Port. The value
366 written to the I/O port is returned. This function must guarantee that all
367 I/O read and write operations are serialized.
369 If 16-bit I/O port operations are not supported, then ASSERT().
371 @param Port The I/O port to write.
372 @param AndData The value to AND with the value read from the I/O port.
373 @param OrData The value to OR with the result of the AND operation.
375 @return The value written back to the I/O port.
386 return IoWrite16 (Port
, (UINT16
)((IoRead16 (Port
) & AndData
) | OrData
));
390 Reads a bit field of an I/O register.
392 Reads the bit field in a 16-bit I/O register. The bit field is specified by
393 the StartBit and the EndBit. The value of the bit field is returned.
395 If 16-bit I/O port operations are not supported, then ASSERT().
396 If StartBit is greater than 15, then ASSERT().
397 If EndBit is greater than 15, then ASSERT().
398 If EndBit is less than StartBit, then ASSERT().
400 @param Port The I/O port to read.
401 @param StartBit The ordinal of the least significant bit in the bit field.
403 @param EndBit The ordinal of the most significant bit in the bit field.
406 @return The value read.
417 return BitFieldRead16 (IoRead16 (Port
), StartBit
, EndBit
);
421 Writes a bit field to an I/O register.
423 Writes Value to the bit field of the I/O register. The bit field is specified
424 by the StartBit and the EndBit. All other bits in the destination I/O
425 register are preserved. The value written to the I/O port is returned. Extra
426 left bits in Value are stripped.
428 If 16-bit I/O port operations are not supported, then ASSERT().
429 If StartBit is greater than 15, then ASSERT().
430 If EndBit is greater than 15, then ASSERT().
431 If EndBit is less than StartBit, then ASSERT().
432 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
434 @param Port The I/O port to write.
435 @param StartBit The ordinal of the least significant bit in the bit field.
437 @param EndBit The ordinal of the most significant bit in the bit field.
439 @param Value New value of the bit field.
441 @return The value written back to the I/O port.
455 BitFieldWrite16 (IoRead16 (Port
), StartBit
, EndBit
, Value
)
460 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
461 result back to the bit field in the 16-bit port.
463 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
464 between the read result and the value specified by OrData, and writes the
465 result to the 16-bit I/O port specified by Port. The value written to the I/O
466 port is returned. This function must guarantee that all I/O read and write
467 operations are serialized. Extra left bits in OrData are stripped.
469 If 16-bit I/O port operations are not supported, then ASSERT().
470 If StartBit is greater than 15, then ASSERT().
471 If EndBit is greater than 15, then ASSERT().
472 If EndBit is less than StartBit, then ASSERT().
473 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
475 @param Port The I/O port to write.
476 @param StartBit The ordinal of the least significant bit in the bit field.
478 @param EndBit The ordinal of the most significant bit in the bit field.
480 @param OrData The value to OR with the value read from the I/O port.
482 @return The value written back to the I/O port.
496 BitFieldOr16 (IoRead16 (Port
), StartBit
, EndBit
, OrData
)
501 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
502 result back to the bit field in the 16-bit port.
504 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
505 the read result and the value specified by AndData, and writes the result to
506 the 16-bit I/O port specified by Port. The value written to the I/O port is
507 returned. This function must guarantee that all I/O read and write operations
508 are serialized. Extra left bits in AndData are stripped.
510 If 16-bit I/O port operations are not supported, then ASSERT().
511 If StartBit is greater than 15, then ASSERT().
512 If EndBit is greater than 15, then ASSERT().
513 If EndBit is less than StartBit, then ASSERT().
514 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
516 @param Port The I/O port to write.
517 @param StartBit The ordinal of the least significant bit in the bit field.
519 @param EndBit The ordinal of the most significant bit in the bit field.
521 @param AndData The value to AND with the value read from the I/O port.
523 @return The value written back to the I/O port.
537 BitFieldAnd16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
)
542 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
543 bitwise OR, and writes the result back to the bit field in the
546 Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
547 by a bitwise OR between the read result and the value specified by
548 AndData, and writes the result to the 16-bit I/O port specified by Port. The
549 value written to the I/O port is returned. This function must guarantee that
550 all I/O read and write operations are serialized. Extra left bits in both
551 AndData and OrData are stripped.
553 If 16-bit I/O port operations are not supported, then ASSERT().
554 If StartBit is greater than 15, then ASSERT().
555 If EndBit is greater than 15, then ASSERT().
556 If EndBit is less than StartBit, then ASSERT().
557 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
558 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
560 @param Port The I/O port to write.
561 @param StartBit The ordinal of the least significant bit in the bit field.
563 @param EndBit The ordinal of the most significant bit in the bit field.
565 @param AndData The value to AND with the value read from the I/O port.
566 @param OrData The value to OR with the result of the AND operation.
568 @return The value written back to the I/O port.
573 IoBitFieldAndThenOr16 (
583 BitFieldAndThenOr16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
, OrData
)
588 Reads a 32-bit I/O port, performs a bitwise OR, and writes the
589 result back to the 32-bit I/O port.
591 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
592 between the read result and the value specified by OrData, and writes the
593 result to the 32-bit I/O port specified by Port. The value written to the I/O
594 port is returned. This function must guarantee that all I/O read and write
595 operations are serialized.
597 If 32-bit I/O port operations are not supported, then ASSERT().
599 @param Port The I/O port to write.
600 @param OrData The value to OR with the value read from the I/O port.
602 @return The value written back to the I/O port.
612 return IoWrite32 (Port
, IoRead32 (Port
) | OrData
);
616 Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
617 to the 32-bit I/O port.
619 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
620 the read result and the value specified by AndData, and writes the result to
621 the 32-bit I/O port specified by Port. The value written to the I/O port is
622 returned. This function must guarantee that all I/O read and write operations
625 If 32-bit I/O port operations are not supported, then ASSERT().
627 @param Port The I/O port to write.
628 @param AndData The value to AND with the value read from the I/O port.
630 @return The value written back to the I/O port.
640 return IoWrite32 (Port
, IoRead32 (Port
) & AndData
);
644 Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
645 inclusive OR, and writes the result back to the 32-bit I/O port.
647 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
648 the read result and the value specified by AndData, performs a bitwise OR
649 between the result of the AND operation and the value specified by OrData,
650 and writes the result to the 32-bit I/O port specified by Port. The value
651 written to the I/O port is returned. This function must guarantee that all
652 I/O read and write operations are serialized.
654 If 32-bit I/O port operations are not supported, then ASSERT().
656 @param Port The I/O port to write.
657 @param AndData The value to AND with the value read from the I/O port.
658 @param OrData The value to OR with the result of the AND operation.
660 @return The value written back to the I/O port.
671 return IoWrite32 (Port
, (IoRead32 (Port
) & AndData
) | OrData
);
675 Reads a bit field of an I/O register.
677 Reads the bit field in a 32-bit I/O register. The bit field is specified by
678 the StartBit and the EndBit. The value of the bit field is returned.
680 If 32-bit I/O port operations are not supported, then ASSERT().
681 If StartBit is greater than 31, then ASSERT().
682 If EndBit is greater than 31, then ASSERT().
683 If EndBit is less than StartBit, then ASSERT().
685 @param Port The I/O port to read.
686 @param StartBit The ordinal of the least significant bit in the bit field.
688 @param EndBit The ordinal of the most significant bit in the bit field.
691 @return The value read.
702 return BitFieldRead32 (IoRead32 (Port
), StartBit
, EndBit
);
706 Writes a bit field to an I/O register.
708 Writes Value to the bit field of the I/O register. The bit field is specified
709 by the StartBit and the EndBit. All other bits in the destination I/O
710 register are preserved. The value written to the I/O port is returned. Extra
711 left bits in Value are stripped.
713 If 32-bit I/O port operations are not supported, then ASSERT().
714 If StartBit is greater than 31, then ASSERT().
715 If EndBit is greater than 31, then ASSERT().
716 If EndBit is less than StartBit, then ASSERT().
717 If Value is larger than the bitmask value range specified by StartBit and EndBit, 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 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().
758 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
760 @param Port The I/O port to write.
761 @param StartBit The ordinal of the least significant bit in the bit field.
763 @param EndBit The ordinal of the most significant bit in the bit field.
765 @param OrData The value to OR with the value read from the I/O port.
767 @return The value written back to the I/O port.
781 BitFieldOr32 (IoRead32 (Port
), StartBit
, EndBit
, OrData
)
786 Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
787 result back to the bit field in the 32-bit port.
789 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
790 the read result and the value specified by AndData, and writes the result to
791 the 32-bit I/O port specified by Port. The value written to the I/O port is
792 returned. This function must guarantee that all I/O read and write operations
793 are serialized. Extra left bits in AndData are stripped.
795 If 32-bit I/O port operations are not supported, then ASSERT().
796 If StartBit is greater than 31, then ASSERT().
797 If EndBit is greater than 31, then ASSERT().
798 If EndBit is less than StartBit, then ASSERT().
799 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
801 @param Port The I/O port to write.
802 @param StartBit The ordinal of the least significant bit in the bit field.
804 @param EndBit The ordinal of the most significant bit in the bit field.
806 @param AndData The value to AND with the value read from the I/O port.
808 @return The value written back to the I/O port.
822 BitFieldAnd32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
)
827 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
828 bitwise OR, and writes the result back to the bit field in the
831 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
832 by a bitwise OR between the read result and the value specified by
833 AndData, and writes the result to the 32-bit I/O port specified by Port. The
834 value written to the I/O port is returned. This function must guarantee that
835 all I/O read and write operations are serialized. Extra left bits in both
836 AndData and OrData are stripped.
838 If 32-bit I/O port operations are not supported, then ASSERT().
839 If StartBit is greater than 31, then ASSERT().
840 If EndBit is greater than 31, then ASSERT().
841 If EndBit is less than StartBit, then ASSERT().
842 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
843 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
845 @param Port The I/O port to write.
846 @param StartBit The ordinal of the least significant bit in the bit field.
848 @param EndBit The ordinal of the most significant bit in the bit field.
850 @param AndData The value to AND with the value read from the I/O port.
851 @param OrData The value to OR with the result of the AND operation.
853 @return The value written back to the I/O port.
858 IoBitFieldAndThenOr32 (
868 BitFieldAndThenOr32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
, OrData
)
873 Reads a 64-bit I/O port, performs a bitwise OR, and writes the
874 result back to the 64-bit I/O port.
876 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
877 between the read result and the value specified by OrData, and writes the
878 result to the 64-bit I/O port specified by Port. The value written to the I/O
879 port is returned. This function must guarantee that all I/O read and write
880 operations are serialized.
882 If 64-bit I/O port operations are not supported, then ASSERT().
884 @param Port The I/O port to write.
885 @param OrData The value to OR with the value read from the I/O port.
887 @return The value written back to the I/O port.
897 return IoWrite64 (Port
, IoRead64 (Port
) | OrData
);
901 Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
902 to the 64-bit I/O port.
904 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
905 the read result and the value specified by AndData, and writes the result to
906 the 64-bit I/O port specified by Port. The value written to the I/O port is
907 returned. This function must guarantee that all I/O read and write operations
910 If 64-bit I/O port operations are not supported, then ASSERT().
912 @param Port The I/O port to write.
913 @param AndData The value to AND with the value read from the I/O port.
915 @return The value written back to the I/O port.
925 return IoWrite64 (Port
, IoRead64 (Port
) & AndData
);
929 Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
930 inclusive OR, and writes the result back to the 64-bit I/O port.
932 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
933 the read result and the value specified by AndData, performs a bitwise OR
934 between the result of the AND operation and the value specified by OrData,
935 and writes the result to the 64-bit I/O port specified by Port. The value
936 written to the I/O port is returned. This function must guarantee that all
937 I/O read and write operations are serialized.
939 If 64-bit I/O port operations are not supported, then ASSERT().
941 @param Port The I/O port to write.
942 @param AndData The value to AND with the value read from the I/O port.
943 @param OrData The value to OR with the result of the AND operation.
945 @return The value written back to the I/O port.
956 return IoWrite64 (Port
, (IoRead64 (Port
) & AndData
) | OrData
);
960 Reads a bit field of an I/O register.
962 Reads the bit field in a 64-bit I/O register. The bit field is specified by
963 the StartBit and the EndBit. The value of the bit field is returned.
965 If 64-bit I/O port operations are not supported, then ASSERT().
966 If StartBit is greater than 63, then ASSERT().
967 If EndBit is greater than 63, then ASSERT().
968 If EndBit is less than StartBit, then ASSERT().
970 @param Port The I/O port to read.
971 @param StartBit The ordinal of the least significant bit in the bit field.
973 @param EndBit The ordinal of the most significant bit in the bit field.
976 @return The value read.
987 return BitFieldRead64 (IoRead64 (Port
), StartBit
, EndBit
);
991 Writes a bit field to an I/O register.
993 Writes Value to the bit field of the I/O register. The bit field is specified
994 by the StartBit and the EndBit. All other bits in the destination I/O
995 register are preserved. The value written to the I/O port is returned. Extra
996 left bits in Value are stripped.
998 If 64-bit I/O port operations are not supported, then ASSERT().
999 If StartBit is greater than 63, then ASSERT().
1000 If EndBit is greater than 63, then ASSERT().
1001 If EndBit is less than StartBit, then ASSERT().
1002 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1004 @param Port The I/O port to write.
1005 @param StartBit The ordinal of the least significant bit in the bit field.
1007 @param EndBit The ordinal of the most significant bit in the bit field.
1009 @param Value New value of the bit field.
1011 @return The value written back to the I/O port.
1025 BitFieldWrite64 (IoRead64 (Port
), StartBit
, EndBit
, Value
)
1030 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1031 result back to the bit field in the 64-bit port.
1033 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
1034 between the read result and the value specified by OrData, and writes the
1035 result to the 64-bit I/O port specified by Port. The value written to the I/O
1036 port is returned. This function must guarantee that all I/O read and write
1037 operations are serialized. Extra left bits in OrData are stripped.
1039 If 64-bit I/O port operations are not supported, then ASSERT().
1040 If StartBit is greater than 63, then ASSERT().
1041 If EndBit is greater than 63, then ASSERT().
1042 If EndBit is less than StartBit, then ASSERT().
1043 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1045 @param Port The I/O port to write.
1046 @param StartBit The ordinal of the least significant bit in the bit field.
1048 @param EndBit The ordinal of the most significant bit in the bit field.
1050 @param OrData The value to OR with the value read from the I/O port.
1052 @return The value written back to the I/O port.
1066 BitFieldOr64 (IoRead64 (Port
), StartBit
, EndBit
, OrData
)
1071 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1072 result back to the bit field in the 64-bit port.
1074 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1075 the read result and the value specified by AndData, and writes the result to
1076 the 64-bit I/O port specified by Port. The value written to the I/O port is
1077 returned. This function must guarantee that all I/O read and write operations
1078 are serialized. Extra left bits in AndData are stripped.
1080 If 64-bit I/O port operations are not supported, then ASSERT().
1081 If StartBit is greater than 63, then ASSERT().
1082 If EndBit is greater than 63, then ASSERT().
1083 If EndBit is less than StartBit, then ASSERT().
1084 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1086 @param Port The I/O port to write.
1087 @param StartBit The ordinal of the least significant bit in the bit field.
1089 @param EndBit The ordinal of the most significant bit in the bit field.
1091 @param AndData The value to AND with the value read from the I/O port.
1093 @return The value written back to the I/O port.
1107 BitFieldAnd64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
)
1112 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
1113 bitwise OR, and writes the result back to the bit field in the
1116 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
1117 by a bitwise OR between the read result and the value specified by
1118 AndData, and writes the result to the 64-bit I/O port specified by Port. The
1119 value written to the I/O port is returned. This function must guarantee that
1120 all I/O read and write operations are serialized. Extra left bits in both
1121 AndData and OrData are stripped.
1123 If 64-bit I/O port operations are not supported, then ASSERT().
1124 If StartBit is greater than 63, then ASSERT().
1125 If EndBit is greater than 63, then ASSERT().
1126 If EndBit is less than StartBit, then ASSERT().
1127 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1128 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1130 @param Port The I/O port to write.
1131 @param StartBit The ordinal of the least significant bit in the bit field.
1133 @param EndBit The ordinal of the most significant bit in the bit field.
1135 @param AndData The value to AND with the value read from the I/O port.
1136 @param OrData The value to OR with the result of the AND operation.
1138 @return The value written back to the I/O port.
1143 IoBitFieldAndThenOr64 (
1153 BitFieldAndThenOr64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
, OrData
)
1158 Reads an 8-bit MMIO register, performs a bitwise OR, and writes the
1159 result back to the 8-bit MMIO register.
1161 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1162 inclusive OR between the read result and the value specified by OrData, and
1163 writes the result to the 8-bit MMIO register specified by Address. The value
1164 written to the MMIO register is returned. This function must guarantee that
1165 all MMIO read and write operations are serialized.
1167 If 8-bit MMIO register operations are not supported, then ASSERT().
1169 @param Address The MMIO register to write.
1170 @param OrData The value to OR with the value read from the MMIO register.
1172 @return The value written back to the MMIO register.
1182 return MmioWrite8 (Address
, (UINT8
)(MmioRead8 (Address
) | OrData
));
1186 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1187 back to the 8-bit MMIO register.
1189 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1190 between the read result and the value specified by AndData, and writes the
1191 result to the 8-bit MMIO register specified by Address. The value written to
1192 the MMIO register is returned. This function must guarantee that all MMIO
1193 read and write operations are serialized.
1195 If 8-bit MMIO register operations are not supported, then ASSERT().
1197 @param Address The MMIO register to write.
1198 @param AndData The value to AND with the value read from the MMIO register.
1200 @return The value written back to the MMIO register.
1210 return MmioWrite8 (Address
, (UINT8
)(MmioRead8 (Address
) & AndData
));
1214 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1215 inclusive OR, and writes the result back to the 8-bit MMIO register.
1217 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1218 between the read result and the value specified by AndData, performs a
1219 bitwise OR between the result of the AND operation and the value specified by
1220 OrData, and writes the result to the 8-bit MMIO register specified by
1221 Address. The value written to the MMIO register is returned. This function
1222 must guarantee that all MMIO read and write operations are serialized.
1224 If 8-bit MMIO register operations are not supported, then ASSERT().
1227 @param Address The MMIO register to write.
1228 @param AndData The value to AND with the value read from the MMIO register.
1229 @param OrData The value to OR with the result of the AND operation.
1231 @return The value written back to the MMIO register.
1242 return MmioWrite8 (Address
, (UINT8
)((MmioRead8 (Address
) & AndData
) | OrData
));
1246 Reads a bit field of a MMIO register.
1248 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1249 the StartBit and the EndBit. The value of the bit field is returned.
1251 If 8-bit MMIO register operations are not supported, then ASSERT().
1252 If StartBit is greater than 7, then ASSERT().
1253 If EndBit is greater than 7, then ASSERT().
1254 If EndBit is less than StartBit, then ASSERT().
1256 @param Address MMIO register to read.
1257 @param StartBit The ordinal of the least significant bit in the bit field.
1259 @param EndBit The ordinal of the most significant bit in the bit field.
1262 @return The value read.
1273 return BitFieldRead8 (MmioRead8 (Address
), StartBit
, EndBit
);
1277 Writes a bit field to a MMIO register.
1279 Writes Value to the bit field of the MMIO register. The bit field is
1280 specified by the StartBit and the EndBit. All other bits in the destination
1281 MMIO register are preserved. The new value of the 8-bit register is returned.
1283 If 8-bit MMIO register operations are not supported, then ASSERT().
1284 If StartBit is greater than 7, then ASSERT().
1285 If EndBit is greater than 7, then ASSERT().
1286 If EndBit is less than StartBit, then ASSERT().
1287 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1289 @param Address MMIO register to write.
1290 @param StartBit The ordinal of the least significant bit in the bit field.
1292 @param EndBit The ordinal of the most significant bit in the bit field.
1294 @param Value New value of the bit field.
1296 @return The value written back to the MMIO register.
1301 MmioBitFieldWrite8 (
1310 BitFieldWrite8 (MmioRead8 (Address
), StartBit
, EndBit
, Value
)
1315 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1316 writes the result back to the bit field in the 8-bit MMIO register.
1318 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1319 inclusive OR between the read result and the value specified by OrData, and
1320 writes the result to the 8-bit MMIO register specified by Address. The value
1321 written to the MMIO register is returned. This function must guarantee that
1322 all MMIO read and write operations are serialized. Extra left bits in OrData
1325 If 8-bit MMIO register operations are not supported, then ASSERT().
1326 If StartBit is greater than 7, then ASSERT().
1327 If EndBit is greater than 7, then ASSERT().
1328 If EndBit is less than StartBit, then ASSERT().
1329 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1331 @param Address MMIO register to write.
1332 @param StartBit The ordinal of the least significant bit in the bit field.
1334 @param EndBit The ordinal of the most significant bit in the bit field.
1336 @param OrData The value to OR with value read from the MMIO register.
1338 @return The value written back to the MMIO register.
1352 BitFieldOr8 (MmioRead8 (Address
), StartBit
, EndBit
, OrData
)
1357 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1358 writes the result back to the bit field in the 8-bit MMIO register.
1360 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1361 between the read result and the value specified by AndData, and writes the
1362 result to the 8-bit MMIO register specified by Address. The value written to
1363 the MMIO register is returned. This function must guarantee that all MMIO
1364 read and write operations are serialized. Extra left bits in AndData are
1367 If 8-bit MMIO register operations are not supported, then ASSERT().
1368 If StartBit is greater than 7, then ASSERT().
1369 If EndBit is greater than 7, then ASSERT().
1370 If EndBit is less than StartBit, then ASSERT().
1371 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1373 @param Address MMIO register to write.
1374 @param StartBit The ordinal of the least significant bit in the bit field.
1376 @param EndBit The ordinal of the most significant bit in the bit field.
1378 @param AndData The value to AND with value read from the MMIO register.
1380 @return The value written back to the MMIO register.
1394 BitFieldAnd8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
)
1399 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1400 by a bitwise OR, and writes the result back to the bit field in the
1401 8-bit MMIO register.
1403 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1404 followed by a bitwise OR between the read result and the value
1405 specified by AndData, and writes the result to the 8-bit MMIO register
1406 specified by Address. The value written to the MMIO register is returned.
1407 This function must guarantee that all MMIO read and write operations are
1408 serialized. Extra left bits in both AndData and OrData are stripped.
1410 If 8-bit MMIO register operations are not supported, then ASSERT().
1411 If StartBit is greater than 7, then ASSERT().
1412 If EndBit is greater than 7, then ASSERT().
1413 If EndBit is less than StartBit, then ASSERT().
1414 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1415 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1417 @param Address MMIO register to write.
1418 @param StartBit The ordinal of the least significant bit in the bit field.
1420 @param EndBit The ordinal of the most significant bit in the bit field.
1422 @param AndData The value to AND with value read from the MMIO register.
1423 @param OrData The value to OR with the result of the AND operation.
1425 @return The value written back to the MMIO register.
1430 MmioBitFieldAndThenOr8 (
1440 BitFieldAndThenOr8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1445 Reads a 16-bit MMIO register, performs a bitwise OR, and writes the
1446 result back to the 16-bit MMIO register.
1448 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1449 inclusive OR between the read result and the value specified by OrData, and
1450 writes the result to the 16-bit MMIO register specified by Address. The value
1451 written to the MMIO register is returned. This function must guarantee that
1452 all MMIO read and write operations are serialized.
1454 If 16-bit MMIO register operations are not supported, then ASSERT().
1456 @param Address The MMIO register to write.
1457 @param OrData The value to OR with the value read from the MMIO register.
1459 @return The value written back to the MMIO register.
1469 return MmioWrite16 (Address
, (UINT16
)(MmioRead16 (Address
) | OrData
));
1473 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1474 back to the 16-bit MMIO register.
1476 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1477 between the read result and the value specified by AndData, and writes the
1478 result to the 16-bit MMIO register specified by Address. The value written to
1479 the MMIO register is returned. This function must guarantee that all MMIO
1480 read and write operations are serialized.
1482 If 16-bit MMIO register operations are not supported, then ASSERT().
1484 @param Address The MMIO register to write.
1485 @param AndData The value to AND with the value read from the MMIO register.
1487 @return The value written back to the MMIO register.
1497 return MmioWrite16 (Address
, (UINT16
)(MmioRead16 (Address
) & AndData
));
1501 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1502 inclusive OR, and writes the result back to the 16-bit MMIO register.
1504 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1505 between the read result and the value specified by AndData, performs a
1506 bitwise OR between the result of the AND operation and the value specified by
1507 OrData, and writes the result to the 16-bit MMIO register specified by
1508 Address. The value written to the MMIO register is returned. This function
1509 must guarantee that all MMIO read and write operations are serialized.
1511 If 16-bit MMIO register operations are not supported, then ASSERT().
1514 @param Address The MMIO register to write.
1515 @param AndData The value to AND with the value read from the MMIO register.
1516 @param OrData The value to OR with the result of the AND operation.
1518 @return The value written back to the MMIO register.
1529 return MmioWrite16 (Address
, (UINT16
)((MmioRead16 (Address
) & AndData
) | OrData
));
1533 Reads a bit field of a MMIO register.
1535 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
1536 the StartBit and the EndBit. The value of the bit field is returned.
1538 If 16-bit MMIO register operations are not supported, then ASSERT().
1539 If StartBit is greater than 15, then ASSERT().
1540 If EndBit is greater than 15, then ASSERT().
1541 If EndBit is less than StartBit, then ASSERT().
1543 @param Address MMIO register to read.
1544 @param StartBit The ordinal of the least significant bit in the bit field.
1546 @param EndBit The ordinal of the most significant bit in the bit field.
1549 @return The value read.
1554 MmioBitFieldRead16 (
1560 return BitFieldRead16 (MmioRead16 (Address
), StartBit
, EndBit
);
1564 Writes a bit field to a MMIO register.
1566 Writes Value to the bit field of the MMIO register. The bit field is
1567 specified by the StartBit and the EndBit. All other bits in the destination
1568 MMIO register are preserved. The new value of the 16-bit register is returned.
1570 If 16-bit MMIO register operations are not supported, then ASSERT().
1571 If StartBit is greater than 15, then ASSERT().
1572 If EndBit is greater than 15, then ASSERT().
1573 If EndBit is less than StartBit, then ASSERT().
1574 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1576 @param Address MMIO register to write.
1577 @param StartBit The ordinal of the least significant bit in the bit field.
1579 @param EndBit The ordinal of the most significant bit in the bit field.
1581 @param Value New value of the bit field.
1583 @return The value written back to the MMIO register.
1588 MmioBitFieldWrite16 (
1595 return MmioWrite16 (
1597 BitFieldWrite16 (MmioRead16 (Address
), StartBit
, EndBit
, Value
)
1602 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
1603 writes the result back to the bit field in the 16-bit MMIO register.
1605 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1606 inclusive OR between the read result and the value specified by OrData, and
1607 writes the result to the 16-bit MMIO register specified by Address. The value
1608 written to the MMIO register is returned. This function must guarantee that
1609 all MMIO read and write operations are serialized. Extra left bits in OrData
1612 If 16-bit MMIO register operations are not supported, then ASSERT().
1613 If StartBit is greater than 15, then ASSERT().
1614 If EndBit is greater than 15, then ASSERT().
1615 If EndBit is less than StartBit, then ASSERT().
1616 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1618 @param Address MMIO register to write.
1619 @param StartBit The ordinal of the least significant bit in the bit field.
1621 @param EndBit The ordinal of the most significant bit in the bit field.
1623 @param OrData The value to OR with value read from the MMIO register.
1625 @return The value written back to the MMIO register.
1637 return MmioWrite16 (
1639 BitFieldOr16 (MmioRead16 (Address
), StartBit
, EndBit
, OrData
)
1644 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
1645 writes the result back to the bit field in the 16-bit MMIO register.
1647 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1648 between the read result and the value specified by AndData, and writes the
1649 result to the 16-bit MMIO register specified by Address. The value written to
1650 the MMIO register is returned. This function must guarantee that all MMIO
1651 read and write operations are serialized. Extra left bits in AndData are
1654 If 16-bit MMIO register operations are not supported, then ASSERT().
1655 If StartBit is greater than 15, then ASSERT().
1656 If EndBit is greater than 15, then ASSERT().
1657 If EndBit is less than StartBit, then ASSERT().
1658 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1660 @param Address MMIO register to write.
1661 @param StartBit The ordinal of the least significant bit in the bit field.
1663 @param EndBit The ordinal of the most significant bit in the bit field.
1665 @param AndData The value to AND with value read from the MMIO register.
1667 @return The value written back to the MMIO register.
1679 return MmioWrite16 (
1681 BitFieldAnd16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
)
1686 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
1687 by a bitwise OR, and writes the result back to the bit field in the
1688 16-bit MMIO register.
1690 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1691 followed by a bitwise OR between the read result and the value
1692 specified by AndData, and writes the result to the 16-bit MMIO register
1693 specified by Address. The value written to the MMIO register is returned.
1694 This function must guarantee that all MMIO read and write operations are
1695 serialized. Extra left bits in both AndData and OrData are stripped.
1697 If 16-bit MMIO register operations are not supported, then ASSERT().
1698 If StartBit is greater than 15, then ASSERT().
1699 If EndBit is greater than 15, then ASSERT().
1700 If EndBit is less than StartBit, then ASSERT().
1701 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1702 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1704 @param Address MMIO register to write.
1705 @param StartBit The ordinal of the least significant bit in the bit field.
1707 @param EndBit The ordinal of the most significant bit in the bit field.
1709 @param AndData The value to AND with value read from the MMIO register.
1710 @param OrData The value to OR with the result of the AND operation.
1712 @return The value written back to the MMIO register.
1717 MmioBitFieldAndThenOr16 (
1725 return MmioWrite16 (
1727 BitFieldAndThenOr16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1732 Reads a 32-bit MMIO register, performs a bitwise OR, and writes the
1733 result back to the 32-bit MMIO register.
1735 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1736 inclusive OR between the read result and the value specified by OrData, and
1737 writes the result to the 32-bit MMIO register specified by Address. The value
1738 written to the MMIO register is returned. This function must guarantee that
1739 all MMIO read and write operations are serialized.
1741 If 32-bit MMIO register operations are not supported, then ASSERT().
1743 @param Address The MMIO register to write.
1744 @param OrData The value to OR with the value read from the MMIO register.
1746 @return The value written back to the MMIO register.
1756 return MmioWrite32 (Address
, MmioRead32 (Address
) | OrData
);
1760 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
1761 back to the 32-bit MMIO register.
1763 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1764 between the read result and the value specified by AndData, and writes the
1765 result to the 32-bit MMIO register specified by Address. The value written to
1766 the MMIO register is returned. This function must guarantee that all MMIO
1767 read and write operations are serialized.
1769 If 32-bit MMIO register operations are not supported, then ASSERT().
1771 @param Address The MMIO register to write.
1772 @param AndData The value to AND with the value read from the MMIO register.
1774 @return The value written back to the MMIO register.
1784 return MmioWrite32 (Address
, MmioRead32 (Address
) & AndData
);
1788 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
1789 inclusive OR, and writes the result back to the 32-bit MMIO register.
1791 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1792 between the read result and the value specified by AndData, performs a
1793 bitwise OR between the result of the AND operation and the value specified by
1794 OrData, and writes the result to the 32-bit MMIO register specified by
1795 Address. The value written to the MMIO register is returned. This function
1796 must guarantee that all MMIO read and write operations are serialized.
1798 If 32-bit MMIO register operations are not supported, then ASSERT().
1801 @param Address The MMIO register to write.
1802 @param AndData The value to AND with the value read from the MMIO register.
1803 @param OrData The value to OR with the result of the AND operation.
1805 @return The value written back to the MMIO register.
1816 return MmioWrite32 (Address
, (MmioRead32 (Address
) & AndData
) | OrData
);
1820 Reads a bit field of a MMIO register.
1822 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
1823 the StartBit and the EndBit. The value of the bit field is returned.
1825 If 32-bit MMIO register operations are not supported, then ASSERT().
1826 If StartBit is greater than 31, then ASSERT().
1827 If EndBit is greater than 31, then ASSERT().
1828 If EndBit is less than StartBit, then ASSERT().
1830 @param Address MMIO register to read.
1831 @param StartBit The ordinal of the least significant bit in the bit field.
1833 @param EndBit The ordinal of the most significant bit in the bit field.
1836 @return The value read.
1841 MmioBitFieldRead32 (
1847 return BitFieldRead32 (MmioRead32 (Address
), StartBit
, EndBit
);
1851 Writes a bit field to a MMIO register.
1853 Writes Value to the bit field of the MMIO register. The bit field is
1854 specified by the StartBit and the EndBit. All other bits in the destination
1855 MMIO register are preserved. The new value of the 32-bit register is returned.
1857 If 32-bit MMIO register operations are not supported, then ASSERT().
1858 If StartBit is greater than 31, then ASSERT().
1859 If EndBit is greater than 31, then ASSERT().
1860 If EndBit is less than StartBit, then ASSERT().
1861 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1863 @param Address MMIO register to write.
1864 @param StartBit The ordinal of the least significant bit in the bit field.
1866 @param EndBit The ordinal of the most significant bit in the bit field.
1868 @param Value New value of the bit field.
1870 @return The value written back to the MMIO register.
1875 MmioBitFieldWrite32 (
1882 return MmioWrite32 (
1884 BitFieldWrite32 (MmioRead32 (Address
), StartBit
, EndBit
, Value
)
1889 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
1890 writes the result back to the bit field in the 32-bit MMIO register.
1892 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1893 inclusive OR between the read result and the value specified by OrData, and
1894 writes the result to the 32-bit MMIO register specified by Address. The value
1895 written to the MMIO register is returned. This function must guarantee that
1896 all MMIO read and write operations are serialized. Extra left bits in OrData
1899 If 32-bit MMIO register operations are not supported, then ASSERT().
1900 If StartBit is greater than 31, then ASSERT().
1901 If EndBit is greater than 31, then ASSERT().
1902 If EndBit is less than StartBit, then ASSERT().
1903 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1905 @param Address MMIO register to write.
1906 @param StartBit The ordinal of the least significant bit in the bit field.
1908 @param EndBit The ordinal of the most significant bit in the bit field.
1910 @param OrData The value to OR with value read from the MMIO register.
1912 @return The value written back to the MMIO register.
1924 return MmioWrite32 (
1926 BitFieldOr32 (MmioRead32 (Address
), StartBit
, EndBit
, OrData
)
1931 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
1932 writes the result back to the bit field in the 32-bit MMIO register.
1934 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1935 between the read result and the value specified by AndData, and writes the
1936 result to the 32-bit MMIO register specified by Address. The value written to
1937 the MMIO register is returned. This function must guarantee that all MMIO
1938 read and write operations are serialized. Extra left bits in AndData are
1941 If 32-bit MMIO register operations are not supported, then ASSERT().
1942 If StartBit is greater than 31, then ASSERT().
1943 If EndBit is greater than 31, then ASSERT().
1944 If EndBit is less than StartBit, then ASSERT().
1945 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1947 @param Address MMIO register to write.
1948 @param StartBit The ordinal of the least significant bit in the bit field.
1950 @param EndBit The ordinal of the most significant bit in the bit field.
1952 @param AndData The value to AND with value read from the MMIO register.
1954 @return The value written back to the MMIO register.
1966 return MmioWrite32 (
1968 BitFieldAnd32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
)
1973 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
1974 by a bitwise OR, and writes the result back to the bit field in the
1975 32-bit MMIO register.
1977 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1978 followed by a bitwise OR between the read result and the value
1979 specified by AndData, and writes the result to the 32-bit MMIO register
1980 specified by Address. The value written to the MMIO register is returned.
1981 This function must guarantee that all MMIO read and write operations are
1982 serialized. Extra left bits in both AndData and OrData are stripped.
1984 If 32-bit MMIO register operations are not supported, then ASSERT().
1985 If StartBit is greater than 31, then ASSERT().
1986 If EndBit is greater than 31, then ASSERT().
1987 If EndBit is less than StartBit, then ASSERT().
1988 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1989 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1991 @param Address MMIO register to write.
1992 @param StartBit The ordinal of the least significant bit in the bit field.
1994 @param EndBit The ordinal of the most significant bit in the bit field.
1996 @param AndData The value to AND with value read from the MMIO register.
1997 @param OrData The value to OR with the result of the AND operation.
1999 @return The value written back to the MMIO register.
2004 MmioBitFieldAndThenOr32 (
2012 return MmioWrite32 (
2014 BitFieldAndThenOr32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
, OrData
)
2019 Reads a 64-bit MMIO register, performs a bitwise OR, and writes the
2020 result back to the 64-bit MMIO register.
2022 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2023 inclusive OR between the read result and the value specified by OrData, and
2024 writes the result to the 64-bit MMIO register specified by Address. The value
2025 written to the MMIO register is returned. This function must guarantee that
2026 all MMIO read and write operations are serialized.
2028 If 64-bit MMIO register operations are not supported, then ASSERT().
2030 @param Address The MMIO register to write.
2031 @param OrData The value to OR with the value read from the MMIO register.
2033 @return The value written back to the MMIO register.
2043 return MmioWrite64 (Address
, MmioRead64 (Address
) | OrData
);
2047 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2048 back to the 64-bit MMIO register.
2050 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2051 between the read result and the value specified by AndData, and writes the
2052 result to the 64-bit MMIO register specified by Address. The value written to
2053 the MMIO register is returned. This function must guarantee that all MMIO
2054 read and write operations are serialized.
2056 If 64-bit MMIO register operations are not supported, then ASSERT().
2058 @param Address The MMIO register to write.
2059 @param AndData The value to AND with the value read from the MMIO register.
2061 @return The value written back to the MMIO register.
2071 return MmioWrite64 (Address
, MmioRead64 (Address
) & AndData
);
2075 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2076 inclusive OR, and writes the result back to the 64-bit MMIO register.
2078 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2079 between the read result and the value specified by AndData, performs a
2080 bitwise OR between the result of the AND operation and the value specified by
2081 OrData, and writes the result to the 64-bit MMIO register specified by
2082 Address. The value written to the MMIO register is returned. This function
2083 must guarantee that all MMIO read and write operations are serialized.
2085 If 64-bit MMIO register operations are not supported, then ASSERT().
2088 @param Address The MMIO register to write.
2089 @param AndData The value to AND with the value read from the MMIO register.
2090 @param OrData The value to OR with the result of the AND operation.
2092 @return The value written back to the MMIO register.
2103 return MmioWrite64 (Address
, (MmioRead64 (Address
) & AndData
) | OrData
);
2107 Reads a bit field of a MMIO register.
2109 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2110 the StartBit and the EndBit. The value of the bit field is returned.
2112 If 64-bit MMIO register operations are not supported, then ASSERT().
2113 If StartBit is greater than 63, then ASSERT().
2114 If EndBit is greater than 63, then ASSERT().
2115 If EndBit is less than StartBit, then ASSERT().
2117 @param Address MMIO register to read.
2118 @param StartBit The ordinal of the least significant bit in the bit field.
2120 @param EndBit The ordinal of the most significant bit in the bit field.
2123 @return The value read.
2128 MmioBitFieldRead64 (
2134 return BitFieldRead64 (MmioRead64 (Address
), StartBit
, EndBit
);
2138 Writes a bit field to a MMIO register.
2140 Writes Value to the bit field of the MMIO register. The bit field is
2141 specified by the StartBit and the EndBit. All other bits in the destination
2142 MMIO register are preserved. The new value of the 64-bit register is returned.
2144 If 64-bit MMIO register operations are not supported, then ASSERT().
2145 If StartBit is greater than 63, then ASSERT().
2146 If EndBit is greater than 63, then ASSERT().
2147 If EndBit is less than StartBit, then ASSERT().
2148 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2150 @param Address MMIO register to write.
2151 @param StartBit The ordinal of the least significant bit in the bit field.
2153 @param EndBit The ordinal of the most significant bit in the bit field.
2155 @param Value New value of the bit field.
2157 @return The value written back to the MMIO register.
2162 MmioBitFieldWrite64 (
2169 return MmioWrite64 (
2171 BitFieldWrite64 (MmioRead64 (Address
), StartBit
, EndBit
, Value
)
2176 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2177 writes the result back to the bit field in the 64-bit MMIO register.
2179 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2180 inclusive OR between the read result and the value specified by OrData, and
2181 writes the result to the 64-bit MMIO register specified by Address. The value
2182 written to the MMIO register is returned. This function must guarantee that
2183 all MMIO read and write operations are serialized. Extra left bits in OrData
2186 If 64-bit MMIO register operations are not supported, then ASSERT().
2187 If StartBit is greater than 63, then ASSERT().
2188 If EndBit is greater than 63, then ASSERT().
2189 If EndBit is less than StartBit, then ASSERT().
2190 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2192 @param Address MMIO register to write.
2193 @param StartBit The ordinal of the least significant bit in the bit field.
2195 @param EndBit The ordinal of the most significant bit in the bit field.
2197 @param OrData The value to OR with value read from the MMIO register.
2199 @return The value written back to the MMIO register.
2211 return MmioWrite64 (
2213 BitFieldOr64 (MmioRead64 (Address
), StartBit
, EndBit
, OrData
)
2218 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2219 writes the result back to the bit field in the 64-bit MMIO register.
2221 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2222 between the read result and the value specified by AndData, and writes the
2223 result to the 64-bit MMIO register specified by Address. The value written to
2224 the MMIO register is returned. This function must guarantee that all MMIO
2225 read and write operations are serialized. Extra left bits in AndData are
2228 If 64-bit MMIO register operations are not supported, then ASSERT().
2229 If StartBit is greater than 63, then ASSERT().
2230 If EndBit is greater than 63, then ASSERT().
2231 If EndBit is less than StartBit, then ASSERT().
2232 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2234 @param Address MMIO register to write.
2235 @param StartBit The ordinal of the least significant bit in the bit field.
2237 @param EndBit The ordinal of the most significant bit in the bit field.
2239 @param AndData The value to AND with value read from the MMIO register.
2241 @return The value written back to the MMIO register.
2253 return MmioWrite64 (
2255 BitFieldAnd64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
)
2260 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2261 by a bitwise OR, and writes the result back to the bit field in the
2262 64-bit MMIO register.
2264 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2265 followed by a bitwise OR between the read result and the value
2266 specified by AndData, and writes the result to the 64-bit MMIO register
2267 specified by Address. The value written to the MMIO register is returned.
2268 This function must guarantee that all MMIO read and write operations are
2269 serialized. Extra left bits in both AndData and OrData are stripped.
2271 If 64-bit MMIO register operations are not supported, then ASSERT().
2272 If StartBit is greater than 63, then ASSERT().
2273 If EndBit is greater than 63, then ASSERT().
2274 If EndBit is less than StartBit, then ASSERT().
2275 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2276 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2278 @param Address MMIO register to write.
2279 @param StartBit The ordinal of the least significant bit in the bit field.
2281 @param EndBit The ordinal of the most significant bit in the bit field.
2283 @param AndData The value to AND with value read from the MMIO register.
2284 @param OrData The value to OR with the result of the AND operation.
2286 @return The value written back to the MMIO register.
2291 MmioBitFieldAndThenOr64 (
2299 return MmioWrite64 (
2301 BitFieldAndThenOr64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
, OrData
)