]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/DxeIoLibEsal/IoHighLevel.c
2 High-level Io/Mmio functions.
4 Copyright (c) 2006 - 2011, 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().
148 @param Port The I/O port to write.
149 @param StartBit The ordinal of the least significant bit in the bit field.
151 @param EndBit The ordinal of the most significant bit in the bit field.
153 @param Value New value of the bit field.
155 @return The value written back to the I/O port.
169 BitFieldWrite8 (IoRead8 (Port
), StartBit
, EndBit
, Value
)
174 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
175 result back to the bit field in the 8-bit port.
177 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
178 between the read result and the value specified by OrData, and writes the
179 result to the 8-bit I/O port specified by Port. The value written to the I/O
180 port is returned. This function must guarantee that all I/O read and write
181 operations are serialized. Extra left bits in OrData are stripped.
183 If 8-bit I/O port operations are not supported, then ASSERT().
184 If StartBit is greater than 7, then ASSERT().
185 If EndBit is greater than 7, then ASSERT().
186 If EndBit is less than StartBit, then ASSERT().
188 @param Port The I/O port to write.
189 @param StartBit The ordinal of the least significant bit in the bit field.
191 @param EndBit The ordinal of the most significant bit in the bit field.
193 @param OrData The value to OR with the value read from the I/O port.
195 @return The value written back to the I/O port.
209 BitFieldOr8 (IoRead8 (Port
), StartBit
, EndBit
, OrData
)
214 Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
215 result back to the bit field in the 8-bit port.
217 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
218 the read result and the value specified by AndData, and writes the result to
219 the 8-bit I/O port specified by Port. The value written to the I/O port is
220 returned. This function must guarantee that all I/O read and write operations
221 are serialized. Extra left bits in AndData are stripped.
223 If 8-bit I/O port operations are not supported, then ASSERT().
224 If StartBit is greater than 7, then ASSERT().
225 If EndBit is greater than 7, then ASSERT().
226 If EndBit is less than StartBit, then ASSERT().
228 @param Port The I/O port to write.
229 @param StartBit The ordinal of the least significant bit in the bit field.
231 @param EndBit The ordinal of the most significant bit in the bit field.
233 @param AndData The value to AND with the value read from the I/O port.
235 @return The value written back to the I/O port.
249 BitFieldAnd8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
)
254 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
255 bitwise OR, and writes the result back to the bit field in the
258 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
259 by a bitwise OR between the read result and the value specified by
260 AndData, and writes the result to the 8-bit I/O port specified by Port. The
261 value written to the I/O port is returned. This function must guarantee that
262 all I/O read and write operations are serialized. Extra left bits in both
263 AndData and OrData are stripped.
265 If 8-bit I/O port operations are not supported, then ASSERT().
266 If StartBit is greater than 7, then ASSERT().
267 If EndBit is greater than 7, then ASSERT().
268 If EndBit is less than StartBit, then ASSERT().
270 @param Port The I/O port to write.
271 @param StartBit The ordinal of the least significant bit in the bit field.
273 @param EndBit The ordinal of the most significant bit in the bit field.
275 @param AndData The value to AND with the value read from the I/O port.
276 @param OrData The value to OR with the result of the AND operation.
278 @return The value written back to the I/O port.
283 IoBitFieldAndThenOr8 (
293 BitFieldAndThenOr8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
, OrData
)
298 Reads a 16-bit I/O port, performs a bitwise OR, and writes the
299 result back to the 16-bit I/O port.
301 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
302 between the read result and the value specified by OrData, and writes the
303 result to the 16-bit I/O port specified by Port. The value written to the I/O
304 port is returned. This function must guarantee that all I/O read and write
305 operations are serialized.
307 If 16-bit I/O port operations are not supported, then ASSERT().
309 @param Port The I/O port to write.
310 @param OrData The value to OR with the value read from the I/O port.
312 @return The value written back to the I/O port.
322 return IoWrite16 (Port
, (UINT16
)(IoRead16 (Port
) | OrData
));
326 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
327 to the 16-bit I/O port.
329 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
330 the read result and the value specified by AndData, and writes the result to
331 the 16-bit I/O port specified by Port. The value written to the I/O port is
332 returned. This function must guarantee that all I/O read and write operations
335 If 16-bit I/O port operations are not supported, then ASSERT().
337 @param Port The I/O port to write.
338 @param AndData The value to AND with the value read from the I/O port.
340 @return The value written back to the I/O port.
350 return IoWrite16 (Port
, (UINT16
)(IoRead16 (Port
) & AndData
));
354 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
355 inclusive OR, and writes the result back to the 16-bit I/O port.
357 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
358 the read result and the value specified by AndData, performs a bitwise OR
359 between the result of the AND operation and the value specified by OrData,
360 and writes the result to the 16-bit I/O port specified by Port. The value
361 written to the I/O port is returned. This function must guarantee that all
362 I/O read and write operations are serialized.
364 If 16-bit I/O port operations are not supported, then ASSERT().
366 @param Port The I/O port to write.
367 @param AndData The value to AND with the value read from the I/O port.
368 @param OrData The value to OR with the result of the AND operation.
370 @return The value written back to the I/O port.
381 return IoWrite16 (Port
, (UINT16
)((IoRead16 (Port
) & AndData
) | OrData
));
385 Reads a bit field of an I/O register.
387 Reads the bit field in a 16-bit I/O register. The bit field is specified by
388 the StartBit and the EndBit. The value of the bit field is returned.
390 If 16-bit I/O port operations are not supported, then ASSERT().
391 If StartBit is greater than 15, then ASSERT().
392 If EndBit is greater than 15, then ASSERT().
393 If EndBit is less than StartBit, then ASSERT().
395 @param Port The I/O port to read.
396 @param StartBit The ordinal of the least significant bit in the bit field.
398 @param EndBit The ordinal of the most significant bit in the bit field.
401 @return The value read.
412 return BitFieldRead16 (IoRead16 (Port
), StartBit
, EndBit
);
416 Writes a bit field to an I/O register.
418 Writes Value to the bit field of the I/O register. The bit field is specified
419 by the StartBit and the EndBit. All other bits in the destination I/O
420 register are preserved. The value written to the I/O port is returned. Extra
421 left bits in Value are stripped.
423 If 16-bit I/O port operations are not supported, then ASSERT().
424 If StartBit is greater than 15, then ASSERT().
425 If EndBit is greater than 15, then ASSERT().
426 If EndBit is less than StartBit, then ASSERT().
428 @param Port The I/O port to write.
429 @param StartBit The ordinal of the least significant bit in the bit field.
431 @param EndBit The ordinal of the most significant bit in the bit field.
433 @param Value New value of the bit field.
435 @return The value written back to the I/O port.
449 BitFieldWrite16 (IoRead16 (Port
), StartBit
, EndBit
, Value
)
454 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
455 result back to the bit field in the 16-bit port.
457 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
458 between the read result and the value specified by OrData, and writes the
459 result to the 16-bit I/O port specified by Port. The value written to the I/O
460 port is returned. This function must guarantee that all I/O read and write
461 operations are serialized. Extra left bits in OrData are stripped.
463 If 16-bit I/O port operations are not supported, then ASSERT().
464 If StartBit is greater than 15, then ASSERT().
465 If EndBit is greater than 15, then ASSERT().
466 If EndBit is less than StartBit, then ASSERT().
468 @param Port The I/O port to write.
469 @param StartBit The ordinal of the least significant bit in the bit field.
471 @param EndBit The ordinal of the most significant bit in the bit field.
473 @param OrData The value to OR with the value read from the I/O port.
475 @return The value written back to the I/O port.
489 BitFieldOr16 (IoRead16 (Port
), StartBit
, EndBit
, OrData
)
494 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
495 result back to the bit field in the 16-bit port.
497 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
498 the read result and the value specified by AndData, and writes the result to
499 the 16-bit I/O port specified by Port. The value written to the I/O port is
500 returned. This function must guarantee that all I/O read and write operations
501 are serialized. Extra left bits in AndData are stripped.
503 If 16-bit I/O port operations are not supported, then ASSERT().
504 If StartBit is greater than 15, then ASSERT().
505 If EndBit is greater than 15, then ASSERT().
506 If EndBit is less than StartBit, then ASSERT().
508 @param Port The I/O port to write.
509 @param StartBit The ordinal of the least significant bit in the bit field.
511 @param EndBit The ordinal of the most significant bit in the bit field.
513 @param AndData The value to AND with the value read from the I/O port.
515 @return The value written back to the I/O port.
529 BitFieldAnd16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
)
534 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
535 bitwise OR, and writes the result back to the bit field in the
538 Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
539 by a bitwise OR between the read result and the value specified by
540 AndData, and writes the result to the 16-bit I/O port specified by Port. The
541 value written to the I/O port is returned. This function must guarantee that
542 all I/O read and write operations are serialized. Extra left bits in both
543 AndData and OrData are stripped.
545 If 16-bit I/O port operations are not supported, then ASSERT().
546 If StartBit is greater than 15, then ASSERT().
547 If EndBit is greater than 15, then ASSERT().
548 If EndBit is less than StartBit, then ASSERT().
550 @param Port The I/O port to write.
551 @param StartBit The ordinal of the least significant bit in the bit field.
553 @param EndBit The ordinal of the most significant bit in the bit field.
555 @param AndData The value to AND with the value read from the I/O port.
556 @param OrData The value to OR with the result of the AND operation.
558 @return The value written back to the I/O port.
563 IoBitFieldAndThenOr16 (
573 BitFieldAndThenOr16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
, OrData
)
578 Reads a 32-bit I/O port, performs a bitwise OR, and writes the
579 result back to the 32-bit I/O port.
581 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
582 between the read result and the value specified by OrData, and writes the
583 result to the 32-bit I/O port specified by Port. The value written to the I/O
584 port is returned. This function must guarantee that all I/O read and write
585 operations are serialized.
587 If 32-bit I/O port operations are not supported, then ASSERT().
589 @param Port The I/O port to write.
590 @param OrData The value to OR with the value read from the I/O port.
592 @return The value written back to the I/O port.
602 return IoWrite32 (Port
, IoRead32 (Port
) | OrData
);
606 Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
607 to the 32-bit I/O port.
609 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
610 the read result and the value specified by AndData, and writes the result to
611 the 32-bit I/O port specified by Port. The value written to the I/O port is
612 returned. This function must guarantee that all I/O read and write operations
615 If 32-bit I/O port operations are not supported, then ASSERT().
617 @param Port The I/O port to write.
618 @param AndData The value to AND with the value read from the I/O port.
620 @return The value written back to the I/O port.
630 return IoWrite32 (Port
, IoRead32 (Port
) & AndData
);
634 Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
635 inclusive OR, and writes the result back to the 32-bit I/O port.
637 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
638 the read result and the value specified by AndData, performs a bitwise OR
639 between the result of the AND operation and the value specified by OrData,
640 and writes the result to the 32-bit I/O port specified by Port. The value
641 written to the I/O port is returned. This function must guarantee that all
642 I/O read and write operations are serialized.
644 If 32-bit I/O port operations are not supported, then ASSERT().
646 @param Port The I/O port to write.
647 @param AndData The value to AND with the value read from the I/O port.
648 @param OrData The value to OR with the result of the AND operation.
650 @return The value written back to the I/O port.
661 return IoWrite32 (Port
, (IoRead32 (Port
) & AndData
) | OrData
);
665 Reads a bit field of an I/O register.
667 Reads the bit field in a 32-bit I/O register. The bit field is specified by
668 the StartBit and the EndBit. The value of the bit field is returned.
670 If 32-bit I/O port operations are not supported, then ASSERT().
671 If StartBit is greater than 31, then ASSERT().
672 If EndBit is greater than 31, then ASSERT().
673 If EndBit is less than StartBit, then ASSERT().
675 @param Port The I/O port to read.
676 @param StartBit The ordinal of the least significant bit in the bit field.
678 @param EndBit The ordinal of the most significant bit in the bit field.
681 @return The value read.
692 return BitFieldRead32 (IoRead32 (Port
), StartBit
, EndBit
);
696 Writes a bit field to an I/O register.
698 Writes Value to the bit field of the I/O register. The bit field is specified
699 by the StartBit and the EndBit. All other bits in the destination I/O
700 register are preserved. The value written to the I/O port is returned. Extra
701 left bits in Value are stripped.
703 If 32-bit I/O port operations are not supported, then ASSERT().
704 If StartBit is greater than 31, then ASSERT().
705 If EndBit is greater than 31, then ASSERT().
706 If EndBit is less than StartBit, then ASSERT().
708 @param Port The I/O port to write.
709 @param StartBit The ordinal of the least significant bit in the bit field.
711 @param EndBit The ordinal of the most significant bit in the bit field.
713 @param Value New value of the bit field.
715 @return The value written back to the I/O port.
729 BitFieldWrite32 (IoRead32 (Port
), StartBit
, EndBit
, Value
)
734 Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the
735 result back to the bit field in the 32-bit port.
737 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
738 between the read result and the value specified by OrData, and writes the
739 result to the 32-bit I/O port specified by Port. The value written to the I/O
740 port is returned. This function must guarantee that all I/O read and write
741 operations are serialized. Extra left bits in OrData are stripped.
743 If 32-bit I/O port operations are not supported, then ASSERT().
744 If StartBit is greater than 31, then ASSERT().
745 If EndBit is greater than 31, then ASSERT().
746 If EndBit is less than StartBit, then ASSERT().
748 @param Port The I/O port to write.
749 @param StartBit The ordinal of the least significant bit in the bit field.
751 @param EndBit The ordinal of the most significant bit in the bit field.
753 @param OrData The value to OR with the value read from the I/O port.
755 @return The value written back to the I/O port.
769 BitFieldOr32 (IoRead32 (Port
), StartBit
, EndBit
, OrData
)
774 Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
775 result back to the bit field in the 32-bit port.
777 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
778 the read result and the value specified by AndData, and writes the result to
779 the 32-bit I/O port specified by Port. The value written to the I/O port is
780 returned. This function must guarantee that all I/O read and write operations
781 are serialized. Extra left bits in AndData are stripped.
783 If 32-bit I/O port operations are not supported, then ASSERT().
784 If StartBit is greater than 31, then ASSERT().
785 If EndBit is greater than 31, then ASSERT().
786 If EndBit is less than StartBit, then ASSERT().
788 @param Port The I/O port to write.
789 @param StartBit The ordinal of the least significant bit in the bit field.
791 @param EndBit The ordinal of the most significant bit in the bit field.
793 @param AndData The value to AND with the value read from the I/O port.
795 @return The value written back to the I/O port.
809 BitFieldAnd32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
)
814 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
815 bitwise OR, and writes the result back to the bit field in the
818 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
819 by a bitwise OR between the read result and the value specified by
820 AndData, and writes the result to the 32-bit I/O port specified by Port. The
821 value written to the I/O port is returned. This function must guarantee that
822 all I/O read and write operations are serialized. Extra left bits in both
823 AndData and OrData are stripped.
825 If 32-bit I/O port operations are not supported, then ASSERT().
826 If StartBit is greater than 31, then ASSERT().
827 If EndBit is greater than 31, then ASSERT().
828 If EndBit is less than StartBit, then ASSERT().
830 @param Port The I/O port to write.
831 @param StartBit The ordinal of the least significant bit in the bit field.
833 @param EndBit The ordinal of the most significant bit in the bit field.
835 @param AndData The value to AND with the value read from the I/O port.
836 @param OrData The value to OR with the result of the AND operation.
838 @return The value written back to the I/O port.
843 IoBitFieldAndThenOr32 (
853 BitFieldAndThenOr32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
, OrData
)
858 Reads a 64-bit I/O port, performs a bitwise OR, and writes the
859 result back to the 64-bit I/O port.
861 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
862 between the read result and the value specified by OrData, and writes the
863 result to the 64-bit I/O port specified by Port. The value written to the I/O
864 port is returned. This function must guarantee that all I/O read and write
865 operations are serialized.
867 If 64-bit I/O port operations are not supported, then ASSERT().
869 @param Port The I/O port to write.
870 @param OrData The value to OR with the value read from the I/O port.
872 @return The value written back to the I/O port.
882 return IoWrite64 (Port
, IoRead64 (Port
) | OrData
);
886 Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
887 to the 64-bit I/O port.
889 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
890 the read result and the value specified by AndData, and writes the result to
891 the 64-bit I/O port specified by Port. The value written to the I/O port is
892 returned. This function must guarantee that all I/O read and write operations
895 If 64-bit I/O port operations are not supported, then ASSERT().
897 @param Port The I/O port to write.
898 @param AndData The value to AND with the value read from the I/O port.
900 @return The value written back to the I/O port.
910 return IoWrite64 (Port
, IoRead64 (Port
) & AndData
);
914 Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
915 inclusive OR, and writes the result back to the 64-bit I/O port.
917 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
918 the read result and the value specified by AndData, performs a bitwise OR
919 between the result of the AND operation and the value specified by OrData,
920 and writes the result to the 64-bit I/O port specified by Port. The value
921 written to the I/O port is returned. This function must guarantee that all
922 I/O read and write operations are serialized.
924 If 64-bit I/O port operations are not supported, then ASSERT().
926 @param Port The I/O port to write.
927 @param AndData The value to AND with the value read from the I/O port.
928 @param OrData The value to OR with the result of the AND operation.
930 @return The value written back to the I/O port.
941 return IoWrite64 (Port
, (IoRead64 (Port
) & AndData
) | OrData
);
945 Reads a bit field of an I/O register.
947 Reads the bit field in a 64-bit I/O register. The bit field is specified by
948 the StartBit and the EndBit. The value of the bit field is returned.
950 If 64-bit I/O port operations are not supported, then ASSERT().
951 If StartBit is greater than 63, then ASSERT().
952 If EndBit is greater than 63, then ASSERT().
953 If EndBit is less than StartBit, then ASSERT().
955 @param Port The I/O port to read.
956 @param StartBit The ordinal of the least significant bit in the bit field.
958 @param EndBit The ordinal of the most significant bit in the bit field.
961 @return The value read.
972 return BitFieldRead64 (IoRead64 (Port
), StartBit
, EndBit
);
976 Writes a bit field to an I/O register.
978 Writes Value to the bit field of the I/O register. The bit field is specified
979 by the StartBit and the EndBit. All other bits in the destination I/O
980 register are preserved. The value written to the I/O port is returned. Extra
981 left bits in Value are stripped.
983 If 64-bit I/O port operations are not supported, then ASSERT().
984 If StartBit is greater than 63, then ASSERT().
985 If EndBit is greater than 63, then ASSERT().
986 If EndBit is less than StartBit, then ASSERT().
988 @param Port The I/O port to write.
989 @param StartBit The ordinal of the least significant bit in the bit field.
991 @param EndBit The ordinal of the most significant bit in the bit field.
993 @param Value New value of the bit field.
995 @return The value written back to the I/O port.
1009 BitFieldWrite64 (IoRead64 (Port
), StartBit
, EndBit
, Value
)
1014 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1015 result back to the bit field in the 64-bit port.
1017 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
1018 between the read result and the value specified by OrData, and writes the
1019 result to the 64-bit I/O port specified by Port. The value written to the I/O
1020 port is returned. This function must guarantee that all I/O read and write
1021 operations are serialized. Extra left bits in OrData are stripped.
1023 If 64-bit I/O port operations are not supported, then ASSERT().
1024 If StartBit is greater than 63, then ASSERT().
1025 If EndBit is greater than 63, then ASSERT().
1026 If EndBit is less than StartBit, then ASSERT().
1028 @param Port The I/O port to write.
1029 @param StartBit The ordinal of the least significant bit in the bit field.
1031 @param EndBit The ordinal of the most significant bit in the bit field.
1033 @param OrData The value to OR with the value read from the I/O port.
1035 @return The value written back to the I/O port.
1049 BitFieldOr64 (IoRead64 (Port
), StartBit
, EndBit
, OrData
)
1054 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1055 result back to the bit field in the 64-bit port.
1057 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1058 the read result and the value specified by AndData, and writes the result to
1059 the 64-bit I/O port specified by Port. The value written to the I/O port is
1060 returned. This function must guarantee that all I/O read and write operations
1061 are serialized. Extra left bits in AndData are stripped.
1063 If 64-bit I/O port operations are not supported, then ASSERT().
1064 If StartBit is greater than 63, then ASSERT().
1065 If EndBit is greater than 63, then ASSERT().
1066 If EndBit is less than StartBit, then ASSERT().
1068 @param Port The I/O port to write.
1069 @param StartBit The ordinal of the least significant bit in the bit field.
1071 @param EndBit The ordinal of the most significant bit in the bit field.
1073 @param AndData The value to AND with the value read from the I/O port.
1075 @return The value written back to the I/O port.
1089 BitFieldAnd64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
)
1094 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
1095 bitwise OR, and writes the result back to the bit field in the
1098 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
1099 by a bitwise OR between the read result and the value specified by
1100 AndData, and writes the result to the 64-bit I/O port specified by Port. The
1101 value written to the I/O port is returned. This function must guarantee that
1102 all I/O read and write operations are serialized. Extra left bits in both
1103 AndData and OrData are stripped.
1105 If 64-bit I/O port operations are not supported, then ASSERT().
1106 If StartBit is greater than 63, then ASSERT().
1107 If EndBit is greater than 63, then ASSERT().
1108 If EndBit is less than StartBit, then ASSERT().
1110 @param Port The I/O port to write.
1111 @param StartBit The ordinal of the least significant bit in the bit field.
1113 @param EndBit The ordinal of the most significant bit in the bit field.
1115 @param AndData The value to AND with the value read from the I/O port.
1116 @param OrData The value to OR with the result of the AND operation.
1118 @return The value written back to the I/O port.
1123 IoBitFieldAndThenOr64 (
1133 BitFieldAndThenOr64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
, OrData
)
1138 Reads an 8-bit MMIO register, performs a bitwise OR, and writes the
1139 result back to the 8-bit MMIO register.
1141 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1142 inclusive OR between the read result and the value specified by OrData, and
1143 writes the result to the 8-bit MMIO register specified by Address. The value
1144 written to the MMIO register is returned. This function must guarantee that
1145 all MMIO read and write operations are serialized.
1147 If 8-bit MMIO register operations are not supported, then ASSERT().
1149 @param Address The MMIO register to write.
1150 @param OrData The value to OR with the value read from the MMIO register.
1152 @return The value written back to the MMIO register.
1162 return MmioWrite8 (Address
, (UINT8
)(MmioRead8 (Address
) | OrData
));
1166 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1167 back to the 8-bit MMIO register.
1169 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1170 between the read result and the value specified by AndData, and writes the
1171 result to the 8-bit MMIO register specified by Address. The value written to
1172 the MMIO register is returned. This function must guarantee that all MMIO
1173 read and write operations are serialized.
1175 If 8-bit MMIO register operations are not supported, then ASSERT().
1177 @param Address The MMIO register to write.
1178 @param AndData The value to AND with the value read from the MMIO register.
1180 @return The value written back to the MMIO register.
1190 return MmioWrite8 (Address
, (UINT8
)(MmioRead8 (Address
) & AndData
));
1194 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1195 inclusive OR, and writes the result back to the 8-bit MMIO register.
1197 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1198 between the read result and the value specified by AndData, performs a
1199 bitwise OR between the result of the AND operation and the value specified by
1200 OrData, and writes the result to the 8-bit MMIO register specified by
1201 Address. The value written to the MMIO register is returned. This function
1202 must guarantee that all MMIO read and write operations are serialized.
1204 If 8-bit MMIO register operations are not supported, then ASSERT().
1207 @param Address The MMIO register to write.
1208 @param AndData The value to AND with the value read from the MMIO register.
1209 @param OrData The value to OR with the result of the AND operation.
1211 @return The value written back to the MMIO register.
1222 return MmioWrite8 (Address
, (UINT8
)((MmioRead8 (Address
) & AndData
) | OrData
));
1226 Reads a bit field of a MMIO register.
1228 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1229 the StartBit and the EndBit. The value of the bit field is returned.
1231 If 8-bit MMIO register operations are not supported, then ASSERT().
1232 If StartBit is greater than 7, then ASSERT().
1233 If EndBit is greater than 7, then ASSERT().
1234 If EndBit is less than StartBit, then ASSERT().
1236 @param Address MMIO register to read.
1237 @param StartBit The ordinal of the least significant bit in the bit field.
1239 @param EndBit The ordinal of the most significant bit in the bit field.
1242 @return The value read.
1253 return BitFieldRead8 (MmioRead8 (Address
), StartBit
, EndBit
);
1257 Writes a bit field to a MMIO register.
1259 Writes Value to the bit field of the MMIO register. The bit field is
1260 specified by the StartBit and the EndBit. All other bits in the destination
1261 MMIO register are preserved. The new value of the 8-bit register is returned.
1263 If 8-bit MMIO register operations are not supported, then ASSERT().
1264 If StartBit is greater than 7, then ASSERT().
1265 If EndBit is greater than 7, then ASSERT().
1266 If EndBit is less than StartBit, then ASSERT().
1268 @param Address MMIO register to write.
1269 @param StartBit The ordinal of the least significant bit in the bit field.
1271 @param EndBit The ordinal of the most significant bit in the bit field.
1273 @param Value New value of the bit field.
1275 @return The value written back to the MMIO register.
1280 MmioBitFieldWrite8 (
1289 BitFieldWrite8 (MmioRead8 (Address
), StartBit
, EndBit
, Value
)
1294 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1295 writes the result back to the bit field in the 8-bit MMIO register.
1297 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1298 inclusive OR between the read result and the value specified by OrData, and
1299 writes the result to the 8-bit MMIO register specified by Address. The value
1300 written to the MMIO register is returned. This function must guarantee that
1301 all MMIO read and write operations are serialized. Extra left bits in OrData
1304 If 8-bit MMIO register operations are not supported, then ASSERT().
1305 If StartBit is greater than 7, then ASSERT().
1306 If EndBit is greater than 7, then ASSERT().
1307 If EndBit is less than StartBit, then ASSERT().
1309 @param Address MMIO register to write.
1310 @param StartBit The ordinal of the least significant bit in the bit field.
1312 @param EndBit The ordinal of the most significant bit in the bit field.
1314 @param OrData The value to OR with value read from the MMIO register.
1316 @return The value written back to the MMIO register.
1330 BitFieldOr8 (MmioRead8 (Address
), StartBit
, EndBit
, OrData
)
1335 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1336 writes the result back to the bit field in the 8-bit MMIO register.
1338 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1339 between the read result and the value specified by AndData, and writes the
1340 result to the 8-bit MMIO register specified by Address. The value written to
1341 the MMIO register is returned. This function must guarantee that all MMIO
1342 read and write operations are serialized. Extra left bits in AndData are
1345 If 8-bit MMIO register operations are not supported, then ASSERT().
1346 If StartBit is greater than 7, then ASSERT().
1347 If EndBit is greater than 7, then ASSERT().
1348 If EndBit is less than StartBit, then ASSERT().
1350 @param Address MMIO register to write.
1351 @param StartBit The ordinal of the least significant bit in the bit field.
1353 @param EndBit The ordinal of the most significant bit in the bit field.
1355 @param AndData The value to AND with value read from the MMIO register.
1357 @return The value written back to the MMIO register.
1371 BitFieldAnd8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
)
1376 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1377 by a bitwise OR, and writes the result back to the bit field in the
1378 8-bit MMIO register.
1380 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1381 followed by a bitwise OR between the read result and the value
1382 specified by AndData, and writes the result to the 8-bit MMIO register
1383 specified by Address. The value written to the MMIO register is returned.
1384 This function must guarantee that all MMIO read and write operations are
1385 serialized. Extra left bits in both AndData and OrData are stripped.
1387 If 8-bit MMIO register operations are not supported, then ASSERT().
1388 If StartBit is greater than 7, then ASSERT().
1389 If EndBit is greater than 7, then ASSERT().
1390 If EndBit is less than StartBit, then ASSERT().
1392 @param Address MMIO register to write.
1393 @param StartBit The ordinal of the least significant bit in the bit field.
1395 @param EndBit The ordinal of the most significant bit in the bit field.
1397 @param AndData The value to AND with value read from the MMIO register.
1398 @param OrData The value to OR with the result of the AND operation.
1400 @return The value written back to the MMIO register.
1405 MmioBitFieldAndThenOr8 (
1415 BitFieldAndThenOr8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1420 Reads a 16-bit MMIO register, performs a bitwise OR, and writes the
1421 result back to the 16-bit MMIO register.
1423 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1424 inclusive OR between the read result and the value specified by OrData, and
1425 writes the result to the 16-bit MMIO register specified by Address. The value
1426 written to the MMIO register is returned. This function must guarantee that
1427 all MMIO read and write operations are serialized.
1429 If 16-bit MMIO register operations are not supported, then ASSERT().
1431 @param Address The MMIO register to write.
1432 @param OrData The value to OR with the value read from the MMIO register.
1434 @return The value written back to the MMIO register.
1444 return MmioWrite16 (Address
, (UINT16
)(MmioRead16 (Address
) | OrData
));
1448 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1449 back to the 16-bit MMIO register.
1451 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1452 between the read result and the value specified by AndData, and writes the
1453 result to the 16-bit MMIO register specified by Address. The value written to
1454 the MMIO register is returned. This function must guarantee that all MMIO
1455 read and write operations are serialized.
1457 If 16-bit MMIO register operations are not supported, then ASSERT().
1459 @param Address The MMIO register to write.
1460 @param AndData The value to AND with the value read from the MMIO register.
1462 @return The value written back to the MMIO register.
1472 return MmioWrite16 (Address
, (UINT16
)(MmioRead16 (Address
) & AndData
));
1476 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1477 inclusive OR, and writes the result back to the 16-bit MMIO register.
1479 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1480 between the read result and the value specified by AndData, performs a
1481 bitwise OR between the result of the AND operation and the value specified by
1482 OrData, and writes the result to the 16-bit MMIO register specified by
1483 Address. The value written to the MMIO register is returned. This function
1484 must guarantee that all MMIO read and write operations are serialized.
1486 If 16-bit MMIO register operations are not supported, then ASSERT().
1489 @param Address The MMIO register to write.
1490 @param AndData The value to AND with the value read from the MMIO register.
1491 @param OrData The value to OR with the result of the AND operation.
1493 @return The value written back to the MMIO register.
1504 return MmioWrite16 (Address
, (UINT16
)((MmioRead16 (Address
) & AndData
) | OrData
));
1508 Reads a bit field of a MMIO register.
1510 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
1511 the StartBit and the EndBit. The value of the bit field is returned.
1513 If 16-bit MMIO register operations are not supported, then ASSERT().
1514 If StartBit is greater than 15, then ASSERT().
1515 If EndBit is greater than 15, then ASSERT().
1516 If EndBit is less than StartBit, then ASSERT().
1518 @param Address MMIO register to read.
1519 @param StartBit The ordinal of the least significant bit in the bit field.
1521 @param EndBit The ordinal of the most significant bit in the bit field.
1524 @return The value read.
1529 MmioBitFieldRead16 (
1535 return BitFieldRead16 (MmioRead16 (Address
), StartBit
, EndBit
);
1539 Writes a bit field to a MMIO register.
1541 Writes Value to the bit field of the MMIO register. The bit field is
1542 specified by the StartBit and the EndBit. All other bits in the destination
1543 MMIO register are preserved. The new value of the 16-bit register is returned.
1545 If 16-bit MMIO register operations are not supported, then ASSERT().
1546 If StartBit is greater than 15, then ASSERT().
1547 If EndBit is greater than 15, then ASSERT().
1548 If EndBit is less than StartBit, then ASSERT().
1550 @param Address MMIO register to write.
1551 @param StartBit The ordinal of the least significant bit in the bit field.
1553 @param EndBit The ordinal of the most significant bit in the bit field.
1555 @param Value New value of the bit field.
1557 @return The value written back to the MMIO register.
1562 MmioBitFieldWrite16 (
1569 return MmioWrite16 (
1571 BitFieldWrite16 (MmioRead16 (Address
), StartBit
, EndBit
, Value
)
1576 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
1577 writes the result back to the bit field in the 16-bit MMIO register.
1579 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1580 inclusive OR between the read result and the value specified by OrData, and
1581 writes the result to the 16-bit MMIO register specified by Address. The value
1582 written to the MMIO register is returned. This function must guarantee that
1583 all MMIO read and write operations are serialized. Extra left bits in OrData
1586 If 16-bit MMIO register operations are not supported, then ASSERT().
1587 If StartBit is greater than 15, then ASSERT().
1588 If EndBit is greater than 15, then ASSERT().
1589 If EndBit is less than StartBit, then ASSERT().
1591 @param Address MMIO register to write.
1592 @param StartBit The ordinal of the least significant bit in the bit field.
1594 @param EndBit The ordinal of the most significant bit in the bit field.
1596 @param OrData The value to OR with value read from the MMIO register.
1598 @return The value written back to the MMIO register.
1610 return MmioWrite16 (
1612 BitFieldOr16 (MmioRead16 (Address
), StartBit
, EndBit
, OrData
)
1617 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
1618 writes the result back to the bit field in the 16-bit MMIO register.
1620 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1621 between the read result and the value specified by AndData, and writes the
1622 result to the 16-bit MMIO register specified by Address. The value written to
1623 the MMIO register is returned. This function must guarantee that all MMIO
1624 read and write operations are serialized. Extra left bits in AndData are
1627 If 16-bit MMIO register operations are not supported, then ASSERT().
1628 If StartBit is greater than 15, then ASSERT().
1629 If EndBit is greater than 15, then ASSERT().
1630 If EndBit is less than StartBit, then ASSERT().
1632 @param Address MMIO register to write.
1633 @param StartBit The ordinal of the least significant bit in the bit field.
1635 @param EndBit The ordinal of the most significant bit in the bit field.
1637 @param AndData The value to AND with value read from the MMIO register.
1639 @return The value written back to the MMIO register.
1651 return MmioWrite16 (
1653 BitFieldAnd16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
)
1658 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
1659 by a bitwise OR, and writes the result back to the bit field in the
1660 16-bit MMIO register.
1662 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1663 followed by a bitwise OR between the read result and the value
1664 specified by AndData, and writes the result to the 16-bit MMIO register
1665 specified by Address. The value written to the MMIO register is returned.
1666 This function must guarantee that all MMIO read and write operations are
1667 serialized. Extra left bits in both AndData and OrData are stripped.
1669 If 16-bit MMIO register operations are not supported, then ASSERT().
1670 If StartBit is greater than 15, then ASSERT().
1671 If EndBit is greater than 15, then ASSERT().
1672 If EndBit is less than StartBit, then ASSERT().
1674 @param Address MMIO register to write.
1675 @param StartBit The ordinal of the least significant bit in the bit field.
1677 @param EndBit The ordinal of the most significant bit in the bit field.
1679 @param AndData The value to AND with value read from the MMIO register.
1680 @param OrData The value to OR with the result of the AND operation.
1682 @return The value written back to the MMIO register.
1687 MmioBitFieldAndThenOr16 (
1695 return MmioWrite16 (
1697 BitFieldAndThenOr16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1702 Reads a 32-bit MMIO register, performs a bitwise OR, and writes the
1703 result back to the 32-bit MMIO register.
1705 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1706 inclusive OR between the read result and the value specified by OrData, and
1707 writes the result to the 32-bit MMIO register specified by Address. The value
1708 written to the MMIO register is returned. This function must guarantee that
1709 all MMIO read and write operations are serialized.
1711 If 32-bit MMIO register operations are not supported, then ASSERT().
1713 @param Address The MMIO register to write.
1714 @param OrData The value to OR with the value read from the MMIO register.
1716 @return The value written back to the MMIO register.
1726 return MmioWrite32 (Address
, MmioRead32 (Address
) | OrData
);
1730 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
1731 back to the 32-bit MMIO register.
1733 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1734 between the read result and the value specified by AndData, and writes the
1735 result to the 32-bit MMIO register specified by Address. The value written to
1736 the MMIO register is returned. This function must guarantee that all MMIO
1737 read and write operations are serialized.
1739 If 32-bit MMIO register operations are not supported, then ASSERT().
1741 @param Address The MMIO register to write.
1742 @param AndData The value to AND with the value read from the MMIO register.
1744 @return The value written back to the MMIO register.
1754 return MmioWrite32 (Address
, MmioRead32 (Address
) & AndData
);
1758 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
1759 inclusive OR, and writes the result back to the 32-bit MMIO register.
1761 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1762 between the read result and the value specified by AndData, performs a
1763 bitwise OR between the result of the AND operation and the value specified by
1764 OrData, and writes the result to the 32-bit MMIO register specified by
1765 Address. The value written to the MMIO register is returned. This function
1766 must guarantee that all MMIO read and write operations are serialized.
1768 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.
1773 @param OrData The value to OR with the result of the AND operation.
1775 @return The value written back to the MMIO register.
1786 return MmioWrite32 (Address
, (MmioRead32 (Address
) & AndData
) | OrData
);
1790 Reads a bit field of a MMIO register.
1792 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
1793 the StartBit and the EndBit. The value of the bit field is returned.
1795 If 32-bit MMIO register operations are not supported, then ASSERT().
1796 If StartBit is greater than 31, then ASSERT().
1797 If EndBit is greater than 31, then ASSERT().
1798 If EndBit is less than StartBit, then ASSERT().
1800 @param Address MMIO register to read.
1801 @param StartBit The ordinal of the least significant bit in the bit field.
1803 @param EndBit The ordinal of the most significant bit in the bit field.
1806 @return The value read.
1811 MmioBitFieldRead32 (
1817 return BitFieldRead32 (MmioRead32 (Address
), StartBit
, EndBit
);
1821 Writes a bit field to a MMIO register.
1823 Writes Value to the bit field of the MMIO register. The bit field is
1824 specified by the StartBit and the EndBit. All other bits in the destination
1825 MMIO register are preserved. The new value of the 32-bit register is returned.
1827 If 32-bit MMIO register operations are not supported, then ASSERT().
1828 If StartBit is greater than 31, then ASSERT().
1829 If EndBit is greater than 31, then ASSERT().
1830 If EndBit is less than StartBit, then ASSERT().
1832 @param Address MMIO register to write.
1833 @param StartBit The ordinal of the least significant bit in the bit field.
1835 @param EndBit The ordinal of the most significant bit in the bit field.
1837 @param Value New value of the bit field.
1839 @return The value written back to the MMIO register.
1844 MmioBitFieldWrite32 (
1851 return MmioWrite32 (
1853 BitFieldWrite32 (MmioRead32 (Address
), StartBit
, EndBit
, Value
)
1858 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
1859 writes the result back to the bit field in the 32-bit MMIO register.
1861 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1862 inclusive OR between the read result and the value specified by OrData, and
1863 writes the result to the 32-bit MMIO register specified by Address. The value
1864 written to the MMIO register is returned. This function must guarantee that
1865 all MMIO read and write operations are serialized. Extra left bits in OrData
1868 If 32-bit MMIO register operations are not supported, then ASSERT().
1869 If StartBit is greater than 31, then ASSERT().
1870 If EndBit is greater than 31, then ASSERT().
1871 If EndBit is less than StartBit, then ASSERT().
1873 @param Address MMIO register to write.
1874 @param StartBit The ordinal of the least significant bit in the bit field.
1876 @param EndBit The ordinal of the most significant bit in the bit field.
1878 @param OrData The value to OR with value read from the MMIO register.
1880 @return The value written back to the MMIO register.
1892 return MmioWrite32 (
1894 BitFieldOr32 (MmioRead32 (Address
), StartBit
, EndBit
, OrData
)
1899 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
1900 writes the result back to the bit field in the 32-bit MMIO register.
1902 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1903 between the read result and the value specified by AndData, and writes the
1904 result to the 32-bit MMIO register specified by Address. The value written to
1905 the MMIO register is returned. This function must guarantee that all MMIO
1906 read and write operations are serialized. Extra left bits in AndData are
1909 If 32-bit MMIO register operations are not supported, then ASSERT().
1910 If StartBit is greater than 31, then ASSERT().
1911 If EndBit is greater than 31, then ASSERT().
1912 If EndBit is less than StartBit, then ASSERT().
1914 @param Address MMIO register to write.
1915 @param StartBit The ordinal of the least significant bit in the bit field.
1917 @param EndBit The ordinal of the most significant bit in the bit field.
1919 @param AndData The value to AND with value read from the MMIO register.
1921 @return The value written back to the MMIO register.
1933 return MmioWrite32 (
1935 BitFieldAnd32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
)
1940 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
1941 by a bitwise OR, and writes the result back to the bit field in the
1942 32-bit MMIO register.
1944 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1945 followed by a bitwise OR between the read result and the value
1946 specified by AndData, and writes the result to the 32-bit MMIO register
1947 specified by Address. The value written to the MMIO register is returned.
1948 This function must guarantee that all MMIO read and write operations are
1949 serialized. Extra left bits in both AndData and OrData are stripped.
1951 If 32-bit MMIO register operations are not supported, then ASSERT().
1952 If StartBit is greater than 31, then ASSERT().
1953 If EndBit is greater than 31, then ASSERT().
1954 If EndBit is less than StartBit, then ASSERT().
1956 @param Address MMIO register to write.
1957 @param StartBit The ordinal of the least significant bit in the bit field.
1959 @param EndBit The ordinal of the most significant bit in the bit field.
1961 @param AndData The value to AND with value read from the MMIO register.
1962 @param OrData The value to OR with the result of the AND operation.
1964 @return The value written back to the MMIO register.
1969 MmioBitFieldAndThenOr32 (
1977 return MmioWrite32 (
1979 BitFieldAndThenOr32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1984 Reads a 64-bit MMIO register, performs a bitwise OR, and writes the
1985 result back to the 64-bit MMIO register.
1987 Reads the 64-bit MMIO register specified by Address, performs a bitwise
1988 inclusive OR between the read result and the value specified by OrData, and
1989 writes the result to the 64-bit MMIO register specified by Address. The value
1990 written to the MMIO register is returned. This function must guarantee that
1991 all MMIO read and write operations are serialized.
1993 If 64-bit MMIO register operations are not supported, then ASSERT().
1995 @param Address The MMIO register to write.
1996 @param OrData The value to OR with the value read from the MMIO register.
1998 @return The value written back to the MMIO register.
2008 return MmioWrite64 (Address
, MmioRead64 (Address
) | OrData
);
2012 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2013 back to the 64-bit MMIO register.
2015 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2016 between the read result and the value specified by AndData, and writes the
2017 result to the 64-bit MMIO register specified by Address. The value written to
2018 the MMIO register is returned. This function must guarantee that all MMIO
2019 read and write operations are serialized.
2021 If 64-bit MMIO register operations are not supported, then ASSERT().
2023 @param Address The MMIO register to write.
2024 @param AndData The value to AND with the value read from the MMIO register.
2026 @return The value written back to the MMIO register.
2036 return MmioWrite64 (Address
, MmioRead64 (Address
) & AndData
);
2040 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2041 inclusive OR, and writes the result back to the 64-bit MMIO register.
2043 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2044 between the read result and the value specified by AndData, performs a
2045 bitwise OR between the result of the AND operation and the value specified by
2046 OrData, and writes the result to the 64-bit MMIO register specified by
2047 Address. The value written to the MMIO register is returned. This function
2048 must guarantee that all MMIO read and write operations are serialized.
2050 If 64-bit MMIO register operations are not supported, then ASSERT().
2053 @param Address The MMIO register to write.
2054 @param AndData The value to AND with the value read from the MMIO register.
2055 @param OrData The value to OR with the result of the AND operation.
2057 @return The value written back to the MMIO register.
2068 return MmioWrite64 (Address
, (MmioRead64 (Address
) & AndData
) | OrData
);
2072 Reads a bit field of a MMIO register.
2074 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2075 the StartBit and the EndBit. The value of the bit field is returned.
2077 If 64-bit MMIO register operations are not supported, then ASSERT().
2078 If StartBit is greater than 63, then ASSERT().
2079 If EndBit is greater than 63, then ASSERT().
2080 If EndBit is less than StartBit, then ASSERT().
2082 @param Address MMIO register to read.
2083 @param StartBit The ordinal of the least significant bit in the bit field.
2085 @param EndBit The ordinal of the most significant bit in the bit field.
2088 @return The value read.
2093 MmioBitFieldRead64 (
2099 return BitFieldRead64 (MmioRead64 (Address
), StartBit
, EndBit
);
2103 Writes a bit field to a MMIO register.
2105 Writes Value to the bit field of the MMIO register. The bit field is
2106 specified by the StartBit and the EndBit. All other bits in the destination
2107 MMIO register are preserved. The new value of the 64-bit register is returned.
2109 If 64-bit MMIO register operations are not supported, then ASSERT().
2110 If StartBit is greater than 63, then ASSERT().
2111 If EndBit is greater than 63, then ASSERT().
2112 If EndBit is less than StartBit, then ASSERT().
2114 @param Address MMIO register to write.
2115 @param StartBit The ordinal of the least significant bit in the bit field.
2117 @param EndBit The ordinal of the most significant bit in the bit field.
2119 @param Value New value of the bit field.
2121 @return The value written back to the MMIO register.
2126 MmioBitFieldWrite64 (
2133 return MmioWrite64 (
2135 BitFieldWrite64 (MmioRead64 (Address
), StartBit
, EndBit
, Value
)
2140 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2141 writes the result back to the bit field in the 64-bit MMIO register.
2143 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2144 inclusive OR between the read result and the value specified by OrData, and
2145 writes the result to the 64-bit MMIO register specified by Address. The value
2146 written to the MMIO register is returned. This function must guarantee that
2147 all MMIO read and write operations are serialized. Extra left bits in OrData
2150 If 64-bit MMIO register operations are not supported, then ASSERT().
2151 If StartBit is greater than 63, then ASSERT().
2152 If EndBit is greater than 63, then ASSERT().
2153 If EndBit is less than StartBit, then ASSERT().
2155 @param Address MMIO register to write.
2156 @param StartBit The ordinal of the least significant bit in the bit field.
2158 @param EndBit The ordinal of the most significant bit in the bit field.
2160 @param OrData The value to OR with value read from the MMIO register.
2162 @return The value written back to the MMIO register.
2174 return MmioWrite64 (
2176 BitFieldOr64 (MmioRead64 (Address
), StartBit
, EndBit
, OrData
)
2181 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2182 writes the result back to the bit field in the 64-bit MMIO register.
2184 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2185 between the read result and the value specified by AndData, and writes the
2186 result to the 64-bit MMIO register specified by Address. The value written to
2187 the MMIO register is returned. This function must guarantee that all MMIO
2188 read and write operations are serialized. Extra left bits in AndData are
2191 If 64-bit MMIO register operations are not supported, then ASSERT().
2192 If StartBit is greater than 63, then ASSERT().
2193 If EndBit is greater than 63, then ASSERT().
2194 If EndBit is less than StartBit, then ASSERT().
2196 @param Address MMIO register to write.
2197 @param StartBit The ordinal of the least significant bit in the bit field.
2199 @param EndBit The ordinal of the most significant bit in the bit field.
2201 @param AndData The value to AND with value read from the MMIO register.
2203 @return The value written back to the MMIO register.
2215 return MmioWrite64 (
2217 BitFieldAnd64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
)
2222 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2223 by a bitwise OR, and writes the result back to the bit field in the
2224 64-bit MMIO register.
2226 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2227 followed by a bitwise OR between the read result and the value
2228 specified by AndData, and writes the result to the 64-bit MMIO register
2229 specified by Address. The value written to the MMIO register is returned.
2230 This function must guarantee that all MMIO read and write operations are
2231 serialized. Extra left bits in both AndData and OrData are stripped.
2233 If 64-bit MMIO register operations are not supported, then ASSERT().
2234 If StartBit is greater than 63, then ASSERT().
2235 If EndBit is greater than 63, then ASSERT().
2236 If EndBit is less than StartBit, then ASSERT().
2238 @param Address MMIO register to write.
2239 @param StartBit The ordinal of the least significant bit in the bit field.
2241 @param EndBit The ordinal of the most significant bit in the bit field.
2243 @param AndData The value to AND with value read from the MMIO register.
2244 @param OrData The value to OR with the result of the AND operation.
2246 @return The value written back to the MMIO register.
2251 MmioBitFieldAndThenOr64 (
2259 return MmioWrite64 (
2261 BitFieldAndThenOr64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
, OrData
)