]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/PeiIoLibCpuIo/IoHighLevel.c
2 High-level Io/Mmio functions.
4 All assertions for bit field operations are handled bit field functions in the
7 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php.
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 #include <Library/IoLib.h>
22 #include <Library/DebugLib.h>
23 #include <Library/BaseLib.h>
24 #include <Library/PeiServicesTablePointerLib.h>
27 Reads an 8-bit I/O port, performs a bitwise OR, and writes the
28 result back to the 8-bit I/O port.
30 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
31 between the read result and the value specified by OrData, and writes the
32 result to the 8-bit I/O port specified by Port. The value written to the I/O
33 port is returned. This function must guarantee that all I/O read and write
34 operations are serialized.
36 If 8-bit I/O port operations are not supported, then ASSERT().
38 @param Port The I/O port to write.
39 @param OrData The value to OR with the read value from the I/O port.
41 @return The value written back to the I/O port.
51 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) | OrData
));
55 Reads an 8-bit I/O port, performs a bitwise AND, and writes the result back
56 to the 8-bit I/O port.
58 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
59 the read result and the value specified by AndData, and writes the result to
60 the 8-bit I/O port specified by Port. The value written to the I/O port is
61 returned. This function must guarantee that all I/O read and write operations
64 If 8-bit I/O port operations are not supported, then ASSERT().
66 @param Port The I/O port to write.
67 @param AndData The value to AND with the read value from the I/O port.
69 @return The value written back to the I/O port.
79 return IoWrite8 (Port
, (UINT8
) (IoRead8 (Port
) & AndData
));
83 Reads an 8-bit I/O port, performs a bitwise AND followed by a bitwise
84 OR, and writes the result back to the 8-bit I/O port.
86 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
87 the read result and the value specified by AndData, performs a bitwise OR
88 between the result of the AND operation and the value specified by OrData,
89 and writes the result to the 8-bit I/O port specified by Port. The value
90 written to the I/O port is returned. This function must guarantee that all
91 I/O read and write operations are serialized.
93 If 8-bit I/O port operations are not supported, then ASSERT().
95 @param Port The I/O port to write.
96 @param AndData The value to AND with the read value from the I/O port.
97 @param OrData The value to OR with the result of the AND operation.
99 @return The value written back to the I/O port.
110 return IoWrite8 (Port
, (UINT8
) ((IoRead8 (Port
) & AndData
) | OrData
));
114 Reads a bit field of an I/O register.
116 Reads the bit field in an 8-bit I/O register. The bit field is specified by
117 the StartBit and the EndBit. The value of the bit field is returned.
119 If 8-bit I/O port operations are not supported, then ASSERT().
120 If StartBit is greater than 7, then ASSERT().
121 If EndBit is greater than 7, then ASSERT().
122 If EndBit is less than StartBit, then ASSERT().
124 @param Port The I/O port to read.
125 @param StartBit The ordinal of the least significant bit in the bit field.
127 @param EndBit The ordinal of the most significant bit in the bit field.
130 @return The value read.
141 return BitFieldRead8 (IoRead8 (Port
), StartBit
, EndBit
);
145 Writes a bit field to an I/O register.
147 Writes Value to the bit field of the I/O register. The bit field is specified
148 by the StartBit and the EndBit. All other bits in the destination I/O
149 register are preserved. The value written to the I/O port is returned.
151 If 8-bit I/O port operations are not supported, then ASSERT().
152 If StartBit is greater than 7, then ASSERT().
153 If EndBit is greater than 7, then ASSERT().
154 If EndBit is less than StartBit, then ASSERT().
155 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
157 @param Port The I/O port to write.
158 @param StartBit The ordinal of the least significant bit in the bit field.
160 @param EndBit The ordinal of the most significant bit in the bit field.
162 @param Value The new value of the bit field.
164 @return The value written back to the I/O port.
178 BitFieldWrite8 (IoRead8 (Port
), StartBit
, EndBit
, Value
)
183 Reads a bit field in an 8-bit port, performs a bitwise OR, and writes the
184 result back to the bit field in the 8-bit port.
186 Reads the 8-bit I/O port specified by Port, performs a bitwise OR
187 between the read result and the value specified by OrData, and writes the
188 result to the 8-bit I/O port specified by Port. The value written to the I/O
189 port is returned. This function must guarantee that all I/O read and write
190 operations are serialized. Extra left bits in OrData are stripped.
192 If 8-bit I/O port operations are not supported, then ASSERT().
193 If StartBit is greater than 7, then ASSERT().
194 If EndBit is greater than 7, then ASSERT().
195 If EndBit is less than StartBit, then ASSERT().
196 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
198 @param Port The I/O port to write.
199 @param StartBit The ordinal of the least significant bit in the bit field.
201 @param EndBit The ordinal of the most significant bit in the bit field.
203 @param OrData The value to OR with the read value from the I/O port.
205 @return The value written back to the I/O port.
219 BitFieldOr8 (IoRead8 (Port
), StartBit
, EndBit
, OrData
)
224 Reads a bit field in an 8-bit port, performs a bitwise AND, and writes the
225 result back to the bit field in the 8-bit port.
227 Reads the 8-bit I/O port specified by Port, performs a bitwise AND between
228 the read result and the value specified by AndData, and writes the result to
229 the 8-bit I/O port specified by Port. The value written to the I/O port is
230 returned. This function must guarantee that all I/O read and write operations
231 are serialized. Extra left bits in AndData are stripped.
233 If 8-bit I/O port operations are not supported, then ASSERT().
234 If StartBit is greater than 7, then ASSERT().
235 If EndBit is greater than 7, then ASSERT().
236 If EndBit is less than StartBit, then ASSERT().
237 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
239 @param Port The I/O port to write.
240 @param StartBit The ordinal of the least significant bit in the bit field.
242 @param EndBit The ordinal of the most significant bit in the bit field.
244 @param AndData The value to AND with the read value from the I/O port.
246 @return The value written back to the I/O port.
260 BitFieldAnd8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
)
265 Reads a bit field in an 8-bit port, performs a bitwise AND followed by a
266 bitwise OR, and writes the result back to the bit field in the
269 Reads the 8-bit I/O port specified by Port, performs a bitwise AND followed
270 by a bitwise OR between the read result and the value specified by
271 AndData, and writes the result to the 8-bit I/O port specified by Port. The
272 value written to the I/O port is returned. This function must guarantee that
273 all I/O read and write operations are serialized. Extra left bits in both
274 AndData and OrData are stripped.
276 If 8-bit I/O port operations are not supported, then ASSERT().
277 If StartBit is greater than 7, then ASSERT().
278 If EndBit is greater than 7, then ASSERT().
279 If EndBit is less than StartBit, then ASSERT().
280 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
281 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
283 @param Port The I/O port to write.
284 @param StartBit The ordinal of the least significant bit in the bit field.
286 @param EndBit The ordinal of the most significant bit in the bit field.
288 @param AndData The value to AND with the read value from the I/O port.
289 @param OrData The value to OR with the result of the AND operation.
291 @return The value written back to the I/O port.
296 IoBitFieldAndThenOr8 (
306 BitFieldAndThenOr8 (IoRead8 (Port
), StartBit
, EndBit
, AndData
, OrData
)
311 Reads a 16-bit I/O port, performs a bitwise OR, and writes the
312 result back to the 16-bit I/O port.
314 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
315 between the read result and the value specified by OrData, and writes the
316 result to the 16-bit I/O port specified by Port. The value written to the I/O
317 port is returned. This function must guarantee that all I/O read and write
318 operations are serialized.
320 If 16-bit I/O port operations are not supported, then ASSERT().
321 If Port is not aligned on a 16-bit boundary, then ASSERT().
323 @param Port The I/O port to write.
324 @param OrData The value to OR with the read value from the I/O port.
326 @return The value written back to the I/O port.
336 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) | OrData
));
340 Reads a 16-bit I/O port, performs a bitwise AND, and writes the result back
341 to the 16-bit I/O port.
343 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
344 the read result and the value specified by AndData, and writes the result to
345 the 16-bit I/O port specified by Port. The value written to the I/O port is
346 returned. This function must guarantee that all I/O read and write operations
349 If 16-bit I/O port operations are not supported, then ASSERT().
350 If Port is not aligned on a 16-bit boundary, then ASSERT().
352 @param Port The I/O port to write.
353 @param AndData The value to AND with the read value from the I/O port.
355 @return The value written back to the I/O port.
365 return IoWrite16 (Port
, (UINT16
) (IoRead16 (Port
) & AndData
));
369 Reads a 16-bit I/O port, performs a bitwise AND followed by a bitwise
370 OR, and writes the result back to the 16-bit I/O port.
372 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
373 the read result and the value specified by AndData, performs a bitwise OR
374 between the result of the AND operation and the value specified by OrData,
375 and writes the result to the 16-bit I/O port specified by Port. The value
376 written to the I/O port is returned. This function must guarantee that all
377 I/O read and write operations are serialized.
379 If 16-bit I/O port operations are not supported, then ASSERT().
380 If Port is not aligned on a 16-bit boundary, then ASSERT().
382 @param Port The I/O port to write.
383 @param AndData The value to AND with the read value from the I/O port.
384 @param OrData The value to OR with the result of the AND operation.
386 @return The value written back to the I/O port.
397 return IoWrite16 (Port
, (UINT16
) ((IoRead16 (Port
) & AndData
) | OrData
));
401 Reads a bit field of an I/O register.
403 Reads the bit field in a 16-bit I/O register. The bit field is specified by
404 the StartBit and the EndBit. The value of the bit field is returned.
406 If 16-bit I/O port operations are not supported, then ASSERT().
407 If Port is not aligned on a 16-bit boundary, then ASSERT().
408 If StartBit is greater than 15, then ASSERT().
409 If EndBit is greater than 15, then ASSERT().
410 If EndBit is less than StartBit, then ASSERT().
412 @param Port The I/O port to read.
413 @param StartBit The ordinal of the least significant bit in the bit field.
415 @param EndBit The ordinal of the most significant bit in the bit field.
418 @return The value read.
429 return BitFieldRead16 (IoRead16 (Port
), StartBit
, EndBit
);
433 Writes a bit field to an I/O register.
435 Writes Value to the bit field of the I/O register. The bit field is specified
436 by the StartBit and the EndBit. All other bits in the destination I/O
437 register are preserved. The value written to the I/O port is returned. Extra
438 left bits in Value are stripped.
440 If 16-bit I/O port operations are not supported, then ASSERT().
441 If Port is not aligned on a 16-bit boundary, then ASSERT().
442 If StartBit is greater than 15, then ASSERT().
443 If EndBit is greater than 15, then ASSERT().
444 If EndBit is less than StartBit, then ASSERT().
445 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
447 @param Port The I/O port to write.
448 @param StartBit The ordinal of the least significant bit in the bit field.
450 @param EndBit The ordinal of the most significant bit in the bit field.
452 @param Value The new value of the bit field.
454 @return The value written back to the I/O port.
468 BitFieldWrite16 (IoRead16 (Port
), StartBit
, EndBit
, Value
)
473 Reads a bit field in a 16-bit port, performs a bitwise OR, and writes the
474 result back to the bit field in the 16-bit port.
476 Reads the 16-bit I/O port specified by Port, performs a bitwise OR
477 between the read result and the value specified by OrData, and writes the
478 result to the 16-bit I/O port specified by Port. The value written to the I/O
479 port is returned. This function must guarantee that all I/O read and write
480 operations are serialized. Extra left bits in OrData are stripped.
482 If 16-bit I/O port operations are not supported, then ASSERT().
483 If Port is not aligned on a 16-bit boundary, then ASSERT().
484 If StartBit is greater than 15, then ASSERT().
485 If EndBit is greater than 15, then ASSERT().
486 If EndBit is less than StartBit, then ASSERT().
487 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
489 @param Port The I/O port to write.
490 @param StartBit The ordinal of the least significant bit in the bit field.
492 @param EndBit The ordinal of the most significant bit in the bit field.
494 @param OrData The value to OR with the read value from the I/O port.
496 @return The value written back to the I/O port.
510 BitFieldOr16 (IoRead16 (Port
), StartBit
, EndBit
, OrData
)
515 Reads a bit field in a 16-bit port, performs a bitwise AND, and writes the
516 result back to the bit field in the 16-bit port.
518 Reads the 16-bit I/O port specified by Port, performs a bitwise AND between
519 the read result and the value specified by AndData, and writes the result to
520 the 16-bit I/O port specified by Port. The value written to the I/O port is
521 returned. This function must guarantee that all I/O read and write operations
522 are serialized. Extra left bits in AndData are stripped.
524 If 16-bit I/O port operations are not supported, then ASSERT().
525 If Port is not aligned on a 16-bit boundary, then ASSERT().
526 If StartBit is greater than 15, then ASSERT().
527 If EndBit is greater than 15, then ASSERT().
528 If EndBit is less than StartBit, then ASSERT().
529 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
531 @param Port The I/O port to write.
532 @param StartBit The ordinal of the least significant bit in the bit field.
534 @param EndBit The ordinal of the most significant bit in the bit field.
536 @param AndData The value to AND with the read value from the I/O port.
538 @return The value written back to the I/O port.
552 BitFieldAnd16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
)
557 Reads a bit field in a 16-bit port, performs a bitwise AND followed by a
558 bitwise OR, and writes the result back to the bit field in the
561 Reads the 16-bit I/O port specified by Port, performs a bitwise AND followed
562 by a bitwise OR between the read result and the value specified by
563 AndData, and writes the result to the 16-bit I/O port specified by Port. The
564 value written to the I/O port is returned. This function must guarantee that
565 all I/O read and write operations are serialized. Extra left bits in both
566 AndData and OrData are stripped.
568 If 16-bit I/O port operations are not supported, then ASSERT().
569 If Port is not aligned on a 16-bit boundary, then ASSERT().
570 If StartBit is greater than 15, then ASSERT().
571 If EndBit is greater than 15, then ASSERT().
572 If EndBit is less than StartBit, then ASSERT().
573 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
574 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
576 @param Port The I/O port to write.
577 @param StartBit The ordinal of the least significant bit in the bit field.
579 @param EndBit The ordinal of the most significant bit in the bit field.
581 @param AndData The value to AND with the read value from the I/O port.
582 @param OrData The value to OR with the result of the AND operation.
584 @return The value written back to the I/O port.
589 IoBitFieldAndThenOr16 (
599 BitFieldAndThenOr16 (IoRead16 (Port
), StartBit
, EndBit
, AndData
, OrData
)
604 Reads a 32-bit I/O port, performs a bitwise OR, and writes the
605 result back to the 32-bit I/O port.
607 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
608 between the read result and the value specified by OrData, and writes the
609 result to the 32-bit I/O port specified by Port. The value written to the I/O
610 port is returned. This function must guarantee that all I/O read and write
611 operations are serialized.
613 If 32-bit I/O port operations are not supported, then ASSERT().
614 If Port is not aligned on a 32-bit boundary, then ASSERT().
616 @param Port The I/O port to write.
617 @param OrData The value to OR with the read value from the I/O port.
619 @return The value written back to the I/O port.
629 return IoWrite32 (Port
, IoRead32 (Port
) | OrData
);
633 Reads a 32-bit I/O port, performs a bitwise AND, and writes the result back
634 to the 32-bit I/O port.
636 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
637 the read result and the value specified by AndData, and writes the result to
638 the 32-bit I/O port specified by Port. The value written to the I/O port is
639 returned. This function must guarantee that all I/O read and write operations
642 If 32-bit I/O port operations are not supported, then ASSERT().
643 If Port is not aligned on a 32-bit boundary, then ASSERT().
645 @param Port The I/O port to write.
646 @param AndData The value to AND with the read value from the I/O port.
648 @return The value written back to the I/O port.
658 return IoWrite32 (Port
, IoRead32 (Port
) & AndData
);
662 Reads a 32-bit I/O port, performs a bitwise AND followed by a bitwise
663 OR, and writes the result back to the 32-bit I/O port.
665 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
666 the read result and the value specified by AndData, performs a bitwise OR
667 between the result of the AND operation and the value specified by OrData,
668 and writes the result to the 32-bit I/O port specified by Port. The value
669 written to the I/O port is returned. This function must guarantee that all
670 I/O read and write operations are serialized.
672 If 32-bit I/O port operations are not supported, then ASSERT().
673 If Port is not aligned on a 32-bit boundary, then ASSERT().
675 @param Port The I/O port to write.
676 @param AndData The value to AND with the read value from the I/O port.
677 @param OrData The value to OR with the result of the AND operation.
679 @return The value written back to the I/O port.
690 return IoWrite32 (Port
, (IoRead32 (Port
) & AndData
) | OrData
);
694 Reads a bit field of an I/O register.
696 Reads the bit field in a 32-bit I/O register. The bit field is specified by
697 the StartBit and the EndBit. The value of the bit field is returned.
699 If 32-bit I/O port operations are not supported, then ASSERT().
700 If Port is not aligned on a 32-bit boundary, then ASSERT().
701 If StartBit is greater than 31, then ASSERT().
702 If EndBit is greater than 31, then ASSERT().
703 If EndBit is less than StartBit, then ASSERT().
705 @param Port The I/O port to read.
706 @param StartBit The ordinal of the least significant bit in the bit field.
708 @param EndBit The ordinal of the most significant bit in the bit field.
711 @return The value read.
722 return BitFieldRead32 (IoRead32 (Port
), StartBit
, EndBit
);
726 Writes a bit field to an I/O register.
728 Writes Value to the bit field of the I/O register. The bit field is specified
729 by the StartBit and the EndBit. All other bits in the destination I/O
730 register are preserved. The value written to the I/O port is returned. Extra
731 left bits in Value are stripped.
733 If 32-bit I/O port operations are not supported, then ASSERT().
734 If Port is not aligned on a 32-bit boundary, then ASSERT().
735 If StartBit is greater than 31, then ASSERT().
736 If EndBit is greater than 31, then ASSERT().
737 If EndBit is less than StartBit, then ASSERT().
738 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
740 @param Port The I/O port to write.
741 @param StartBit The ordinal of the least significant bit in the bit field.
743 @param EndBit The ordinal of the most significant bit in the bit field.
745 @param Value The new value of the bit field.
747 @return The value written back to the I/O port.
761 BitFieldWrite32 (IoRead32 (Port
), StartBit
, EndBit
, Value
)
766 Reads a bit field in a 32-bit port, performs a bitwise OR, and writes the
767 result back to the bit field in the 32-bit port.
769 Reads the 32-bit I/O port specified by Port, performs a bitwise OR
770 between the read result and the value specified by OrData, and writes the
771 result to the 32-bit I/O port specified by Port. The value written to the I/O
772 port is returned. This function must guarantee that all I/O read and write
773 operations are serialized. Extra left bits in OrData are stripped.
775 If 32-bit I/O port operations are not supported, then ASSERT().
776 If Port is not aligned on a 32-bit boundary, then ASSERT().
777 If StartBit is greater than 31, then ASSERT().
778 If EndBit is greater than 31, then ASSERT().
779 If EndBit is less than StartBit, then ASSERT().
780 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
782 @param Port The I/O port to write.
783 @param StartBit The ordinal of the least significant bit in the bit field.
785 @param EndBit The ordinal of the most significant bit in the bit field.
787 @param OrData The value to OR with the read value from the I/O port.
789 @return The value written back to the I/O port.
803 BitFieldOr32 (IoRead32 (Port
), StartBit
, EndBit
, OrData
)
808 Reads a bit field in a 32-bit port, performs a bitwise AND, and writes the
809 result back to the bit field in the 32-bit port.
811 Reads the 32-bit I/O port specified by Port, performs a bitwise AND between
812 the read result and the value specified by AndData, and writes the result to
813 the 32-bit I/O port specified by Port. The value written to the I/O port is
814 returned. This function must guarantee that all I/O read and write operations
815 are serialized. Extra left bits in AndData are stripped.
817 If 32-bit I/O port operations are not supported, then ASSERT().
818 If Port is not aligned on a 32-bit boundary, then ASSERT().
819 If StartBit is greater than 31, then ASSERT().
820 If EndBit is greater than 31, then ASSERT().
821 If EndBit is less than StartBit, then ASSERT().
822 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
824 @param Port The I/O port to write.
825 @param StartBit The ordinal of the least significant bit in the bit field.
827 @param EndBit The ordinal of the most significant bit in the bit field.
829 @param AndData The value to AND with the read value from the I/O port.
831 @return The value written back to the I/O port.
845 BitFieldAnd32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
)
850 Reads a bit field in a 32-bit port, performs a bitwise AND followed by a
851 bitwise OR, and writes the result back to the bit field in the
854 Reads the 32-bit I/O port specified by Port, performs a bitwise AND followed
855 by a bitwise OR between the read result and the value specified by
856 AndData, and writes the result to the 32-bit I/O port specified by Port. The
857 value written to the I/O port is returned. This function must guarantee that
858 all I/O read and write operations are serialized. Extra left bits in both
859 AndData and OrData are stripped.
861 If 32-bit I/O port operations are not supported, then ASSERT().
862 If Port is not aligned on a 32-bit boundary, then ASSERT().
863 If StartBit is greater than 31, then ASSERT().
864 If EndBit is greater than 31, then ASSERT().
865 If EndBit is less than StartBit, then ASSERT().
866 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
867 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
869 @param Port The I/O port to write.
870 @param StartBit The ordinal of the least significant bit in the bit field.
872 @param EndBit The ordinal of the most significant bit in the bit field.
874 @param AndData The value to AND with the read value from the I/O port.
875 @param OrData The value to OR with the result of the AND operation.
877 @return The value written back to the I/O port.
882 IoBitFieldAndThenOr32 (
892 BitFieldAndThenOr32 (IoRead32 (Port
), StartBit
, EndBit
, AndData
, OrData
)
897 Reads a 64-bit I/O port, performs a bitwise OR, and writes the
898 result back to the 64-bit I/O port.
900 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
901 between the read result and the value specified by OrData, and writes the
902 result to the 64-bit I/O port specified by Port. The value written to the I/O
903 port is returned. This function must guarantee that all I/O read and write
904 operations are serialized.
906 If 64-bit I/O port operations are not supported, then ASSERT().
907 If Port is not aligned on a 64-bit boundary, then ASSERT().
909 @param Port The I/O port to write.
910 @param OrData The value to OR with the read value from the I/O port.
912 @return The value written back to the I/O port.
922 return IoWrite64 (Port
, IoRead64 (Port
) | OrData
);
926 Reads a 64-bit I/O port, performs a bitwise AND, and writes the result back
927 to the 64-bit I/O port.
929 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
930 the read result and the value specified by AndData, and writes the result to
931 the 64-bit I/O port specified by Port. The value written to the I/O port is
932 returned. This function must guarantee that all I/O read and write operations
935 If 64-bit I/O port operations are not supported, then ASSERT().
936 If Port is not aligned on a 64-bit boundary, then ASSERT().
938 @param Port The I/O port to write.
939 @param AndData The value to AND with the read value from the I/O port.
941 @return The value written back to the I/O port.
951 return IoWrite64 (Port
, IoRead64 (Port
) & AndData
);
955 Reads a 64-bit I/O port, performs a bitwise AND followed by a bitwise
956 OR, and writes the result back to the 64-bit I/O port.
958 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
959 the read result and the value specified by AndData, performs a bitwise OR
960 between the result of the AND operation and the value specified by OrData,
961 and writes the result to the 64-bit I/O port specified by Port. The value
962 written to the I/O port is returned. This function must guarantee that all
963 I/O read and write operations are serialized.
965 If 64-bit I/O port operations are not supported, then ASSERT().
966 If Port is not aligned on a 64-bit boundary, then ASSERT().
968 @param Port The I/O port to write.
969 @param AndData The value to AND with the read value from the I/O port.
970 @param OrData The value to OR with the result of the AND operation.
972 @return The value written back to the I/O port.
983 return IoWrite64 (Port
, (IoRead64 (Port
) & AndData
) | OrData
);
987 Reads a bit field of an I/O register.
989 Reads the bit field in a 64-bit I/O register. The bit field is specified by
990 the StartBit and the EndBit. The value of the bit field is returned.
992 If 64-bit I/O port operations are not supported, then ASSERT().
993 If Port is not aligned on a 64-bit boundary, then ASSERT().
994 If StartBit is greater than 63, then ASSERT().
995 If EndBit is greater than 63, then ASSERT().
996 If EndBit is less than StartBit, then ASSERT().
998 @param Port The I/O port to read.
999 @param StartBit The ordinal of the least significant bit in the bit field.
1001 @param EndBit The ordinal of the most significant bit in the bit field.
1004 @return The value read.
1015 return BitFieldRead64 (IoRead64 (Port
), StartBit
, EndBit
);
1019 Writes a bit field to an I/O register.
1021 Writes Value to the bit field of the I/O register. The bit field is specified
1022 by the StartBit and the EndBit. All other bits in the destination I/O
1023 register are preserved. The value written to the I/O port is returned. Extra
1024 left bits in Value are stripped.
1026 If 64-bit I/O port operations are not supported, then ASSERT().
1027 If Port is not aligned on a 64-bit boundary, then ASSERT().
1028 If StartBit is greater than 63, then ASSERT().
1029 If EndBit is greater than 63, then ASSERT().
1030 If EndBit is less than StartBit, then ASSERT().
1031 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1033 @param Port The I/O port to write.
1034 @param StartBit The ordinal of the least significant bit in the bit field.
1036 @param EndBit The ordinal of the most significant bit in the bit field.
1038 @param Value The new value of the bit field.
1040 @return The value written back to the I/O port.
1054 BitFieldWrite64 (IoRead64 (Port
), StartBit
, EndBit
, Value
)
1059 Reads a bit field in a 64-bit port, performs a bitwise OR, and writes the
1060 result back to the bit field in the 64-bit port.
1062 Reads the 64-bit I/O port specified by Port, performs a bitwise OR
1063 between the read result and the value specified by OrData, and writes the
1064 result to the 64-bit I/O port specified by Port. The value written to the I/O
1065 port is returned. This function must guarantee that all I/O read and write
1066 operations are serialized. Extra left bits in OrData are stripped.
1068 If 64-bit I/O port operations are not supported, then ASSERT().
1069 If Port is not aligned on a 64-bit boundary, then ASSERT().
1070 If StartBit is greater than 63, then ASSERT().
1071 If EndBit is greater than 63, then ASSERT().
1072 If EndBit is less than StartBit, then ASSERT().
1073 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1075 @param Port The I/O port to write.
1076 @param StartBit The ordinal of the least significant bit in the bit field.
1078 @param EndBit The ordinal of the most significant bit in the bit field.
1080 @param OrData The value to OR with the read value from the I/O port.
1082 @return The value written back to the I/O port.
1096 BitFieldOr64 (IoRead64 (Port
), StartBit
, EndBit
, OrData
)
1101 Reads a bit field in a 64-bit port, performs a bitwise AND, and writes the
1102 result back to the bit field in the 64-bit port.
1104 Reads the 64-bit I/O port specified by Port, performs a bitwise AND between
1105 the read result and the value specified by AndData, and writes the result to
1106 the 64-bit I/O port specified by Port. The value written to the I/O port is
1107 returned. This function must guarantee that all I/O read and write operations
1108 are serialized. Extra left bits in AndData are stripped.
1110 If 64-bit I/O port operations are not supported, then ASSERT().
1111 If Port is not aligned on a 64-bit boundary, then ASSERT().
1112 If StartBit is greater than 63, then ASSERT().
1113 If EndBit is greater than 63, then ASSERT().
1114 If EndBit is less than StartBit, then ASSERT().
1115 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1117 @param Port The I/O port to write.
1118 @param StartBit The ordinal of the least significant bit in the bit field.
1120 @param EndBit The ordinal of the most significant bit in the bit field.
1122 @param AndData The value to AND with the read value from the I/O port.
1124 @return The value written back to the I/O port.
1138 BitFieldAnd64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
)
1143 Reads a bit field in a 64-bit port, performs a bitwise AND followed by a
1144 bitwise OR, and writes the result back to the bit field in the
1147 Reads the 64-bit I/O port specified by Port, performs a bitwise AND followed
1148 by a bitwise OR between the read result and the value specified by
1149 AndData, and writes the result to the 64-bit I/O port specified by Port. The
1150 value written to the I/O port is returned. This function must guarantee that
1151 all I/O read and write operations are serialized. Extra left bits in both
1152 AndData and OrData are stripped.
1154 If 64-bit I/O port operations are not supported, then ASSERT().
1155 If Port is not aligned on a 64-bit boundary, then ASSERT().
1156 If StartBit is greater than 63, then ASSERT().
1157 If EndBit is greater than 63, then ASSERT().
1158 If EndBit is less than StartBit, then ASSERT().
1159 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1160 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1162 @param Port The I/O port to write.
1163 @param StartBit The ordinal of the least significant bit in the bit field.
1165 @param EndBit The ordinal of the most significant bit in the bit field.
1167 @param AndData The value to AND with the read value from the I/O port.
1168 @param OrData The value to OR with the result of the AND operation.
1170 @return The value written back to the I/O port.
1175 IoBitFieldAndThenOr64 (
1185 BitFieldAndThenOr64 (IoRead64 (Port
), StartBit
, EndBit
, AndData
, OrData
)
1190 Reads an 8-bit MMIO register, performs a bitwise OR, and writes the
1191 result back to the 8-bit MMIO register.
1193 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1194 OR between the read result and the value specified by OrData, and
1195 writes the result to the 8-bit MMIO register specified by Address. The value
1196 written to the MMIO register is returned. This function must guarantee that
1197 all MMIO read and write operations are serialized.
1199 If 8-bit MMIO register operations are not supported, then ASSERT().
1201 @param Address The MMIO register to write.
1202 @param OrData The value to OR with the read value from the MMIO register.
1204 @return The value written back to the MMIO register.
1214 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) | OrData
));
1218 Reads an 8-bit MMIO register, performs a bitwise AND, and writes the result
1219 back to the 8-bit MMIO register.
1221 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1222 between the read result and the value specified by AndData, and writes the
1223 result to the 8-bit MMIO register specified by Address. The value written to
1224 the MMIO register is returned. This function must guarantee that all MMIO
1225 read and write operations are serialized.
1227 If 8-bit MMIO register operations are not supported, then ASSERT().
1229 @param Address The MMIO register to write.
1230 @param AndData The value to AND with the read value from the MMIO register.
1232 @return The value written back to the MMIO register.
1242 return MmioWrite8 (Address
, (UINT8
) (MmioRead8 (Address
) & AndData
));
1246 Reads an 8-bit MMIO register, performs a bitwise AND followed by a bitwise
1247 OR, and writes the result back to the 8-bit MMIO register.
1249 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1250 between the read result and the value specified by AndData, performs a
1251 bitwise OR between the result of the AND operation and the value specified by
1252 OrData, and writes the result to the 8-bit MMIO register specified by
1253 Address. The value written to the MMIO register is returned. This function
1254 must guarantee that all MMIO read and write operations are serialized.
1256 If 8-bit MMIO register operations are not supported, then ASSERT().
1259 @param Address The MMIO register to write.
1260 @param AndData The value to AND with the read value from the MMIO register.
1261 @param OrData The value to OR with the result of the AND operation.
1263 @return The value written back to the MMIO register.
1274 return MmioWrite8 (Address
, (UINT8
) ((MmioRead8 (Address
) & AndData
) | OrData
));
1278 Reads a bit field of a MMIO register.
1280 Reads the bit field in an 8-bit MMIO register. The bit field is specified by
1281 the StartBit and the EndBit. The value of the bit field 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().
1288 @param Address The MMIO register to read.
1289 @param StartBit The ordinal of the least significant bit in the bit field.
1291 @param EndBit The ordinal of the most significant bit in the bit field.
1294 @return The value read.
1305 return BitFieldRead8 (MmioRead8 (Address
), StartBit
, EndBit
);
1309 Writes a bit field to a MMIO register.
1311 Writes Value to the bit field of the MMIO register. The bit field is
1312 specified by the StartBit and the EndBit. All other bits in the destination
1313 MMIO register are preserved. The new value of the 8-bit register is returned.
1315 If 8-bit MMIO register operations are not supported, then ASSERT().
1316 If StartBit is greater than 7, then ASSERT().
1317 If EndBit is greater than 7, then ASSERT().
1318 If EndBit is less than StartBit, then ASSERT().
1319 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1321 @param Address The MMIO register to write.
1322 @param StartBit The ordinal of the least significant bit in the bit field.
1324 @param EndBit The ordinal of the most significant bit in the bit field.
1326 @param Value The new value of the bit field.
1328 @return The value written back to the MMIO register.
1333 MmioBitFieldWrite8 (
1342 BitFieldWrite8 (MmioRead8 (Address
), StartBit
, EndBit
, Value
)
1347 Reads a bit field in an 8-bit MMIO register, performs a bitwise OR, and
1348 writes the result back to the bit field in the 8-bit MMIO register.
1350 Reads the 8-bit MMIO register specified by Address, performs a bitwise
1351 OR between the read result and the value specified by OrData, and
1352 writes the result to the 8-bit MMIO register specified by Address. The value
1353 written to the MMIO register is returned. This function must guarantee that
1354 all MMIO read and write operations are serialized. Extra left bits in OrData
1357 If 8-bit MMIO register operations are not supported, then ASSERT().
1358 If StartBit is greater than 7, then ASSERT().
1359 If EndBit is greater than 7, then ASSERT().
1360 If EndBit is less than StartBit, then ASSERT().
1361 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1363 @param Address The MMIO register to write.
1364 @param StartBit The ordinal of the least significant bit in the bit field.
1366 @param EndBit The ordinal of the most significant bit in the bit field.
1368 @param OrData The value to OR with read value from the MMIO register.
1370 @return The value written back to the MMIO register.
1384 BitFieldOr8 (MmioRead8 (Address
), StartBit
, EndBit
, OrData
)
1389 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND, and
1390 writes the result back to the bit field in the 8-bit MMIO register.
1392 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1393 between the read result and the value specified by AndData, and writes the
1394 result to the 8-bit MMIO register specified by Address. The value written to
1395 the MMIO register is returned. This function must guarantee that all MMIO
1396 read and write operations are serialized. Extra left bits in AndData are
1399 If 8-bit MMIO register operations are not supported, then ASSERT().
1400 If StartBit is greater than 7, then ASSERT().
1401 If EndBit is greater than 7, then ASSERT().
1402 If EndBit is less than StartBit, then ASSERT().
1403 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1405 @param Address The MMIO register to write.
1406 @param StartBit The ordinal of the least significant bit in the bit field.
1408 @param EndBit The ordinal of the most significant bit in the bit field.
1410 @param AndData The value to AND with read value from the MMIO register.
1412 @return The value written back to the MMIO register.
1426 BitFieldAnd8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
)
1431 Reads a bit field in an 8-bit MMIO register, performs a bitwise AND followed
1432 by a bitwise OR, and writes the result back to the bit field in the
1433 8-bit MMIO register.
1435 Reads the 8-bit MMIO register specified by Address, performs a bitwise AND
1436 followed by a bitwise OR between the read result and the value
1437 specified by AndData, and writes the result to the 8-bit MMIO register
1438 specified by Address. The value written to the MMIO register is returned.
1439 This function must guarantee that all MMIO read and write operations are
1440 serialized. Extra left bits in both AndData and OrData are stripped.
1442 If 8-bit MMIO register operations are not supported, then ASSERT().
1443 If StartBit is greater than 7, then ASSERT().
1444 If EndBit is greater than 7, then ASSERT().
1445 If EndBit is less than StartBit, then ASSERT().
1446 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1447 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1449 @param Address The MMIO register to write.
1450 @param StartBit The ordinal of the least significant bit in the bit field.
1452 @param EndBit The ordinal of the most significant bit in the bit field.
1454 @param AndData The value to AND with read value from the MMIO register.
1455 @param OrData The value to OR with the result of the AND operation.
1457 @return The value written back to the MMIO register.
1462 MmioBitFieldAndThenOr8 (
1472 BitFieldAndThenOr8 (MmioRead8 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1477 Reads a 16-bit MMIO register, performs a bitwise OR, and writes the
1478 result back to the 16-bit MMIO register.
1480 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1481 OR between the read result and the value specified by OrData, and
1482 writes the result to the 16-bit MMIO register specified by Address. The value
1483 written to the MMIO register is returned. This function must guarantee that
1484 all MMIO read and write operations are serialized.
1486 If 16-bit MMIO register operations are not supported, then ASSERT().
1487 If Address is not aligned on a 16-bit boundary, then ASSERT().
1489 @param Address The MMIO register to write.
1490 @param OrData The value to OR with the read value from the MMIO register.
1492 @return The value written back to the MMIO register.
1502 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) | OrData
));
1506 Reads a 16-bit MMIO register, performs a bitwise AND, and writes the result
1507 back to the 16-bit MMIO register.
1509 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1510 between the read result and the value specified by AndData, and writes the
1511 result to the 16-bit MMIO register specified by Address. The value written to
1512 the MMIO register is returned. This function must guarantee that all MMIO
1513 read and write operations are serialized.
1515 If 16-bit MMIO register operations are not supported, then ASSERT().
1516 If Address is not aligned on a 16-bit boundary, then ASSERT().
1518 @param Address The MMIO register to write.
1519 @param AndData The value to AND with the read value from the MMIO register.
1521 @return The value written back to the MMIO register.
1531 return MmioWrite16 (Address
, (UINT16
) (MmioRead16 (Address
) & AndData
));
1535 Reads a 16-bit MMIO register, performs a bitwise AND followed by a bitwise
1536 OR, and writes the result back to the 16-bit MMIO register.
1538 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1539 between the read result and the value specified by AndData, performs a
1540 bitwise OR between the result of the AND operation and the value specified by
1541 OrData, and writes the result to the 16-bit MMIO register specified by
1542 Address. The value written to the MMIO register is returned. This function
1543 must guarantee that all MMIO read and write operations are serialized.
1545 If 16-bit MMIO register operations are not supported, then ASSERT().
1546 If Address is not aligned on a 16-bit boundary, then ASSERT().
1548 @param Address The MMIO register to write.
1549 @param AndData The value to AND with the read value from the MMIO register.
1550 @param OrData The value to OR with the result of the AND operation.
1552 @return The value written back to the MMIO register.
1563 return MmioWrite16 (Address
, (UINT16
) ((MmioRead16 (Address
) & AndData
) | OrData
));
1567 Reads a bit field of a MMIO register.
1569 Reads the bit field in a 16-bit MMIO register. The bit field is specified by
1570 the StartBit and the EndBit. The value of the bit field is returned.
1572 If 16-bit MMIO register operations are not supported, then ASSERT().
1573 If Address is not aligned on a 16-bit boundary, then ASSERT().
1574 If StartBit is greater than 15, then ASSERT().
1575 If EndBit is greater than 15, then ASSERT().
1576 If EndBit is less than StartBit, then ASSERT().
1578 @param Address The MMIO register to read.
1579 @param StartBit The ordinal of the least significant bit in the bit field.
1581 @param EndBit The ordinal of the most significant bit in the bit field.
1584 @return The value read.
1589 MmioBitFieldRead16 (
1595 return BitFieldRead16 (MmioRead16 (Address
), StartBit
, EndBit
);
1599 Writes a bit field to a MMIO register.
1601 Writes Value to the bit field of the MMIO register. The bit field is
1602 specified by the StartBit and the EndBit. All other bits in the destination
1603 MMIO register are preserved. The new value of the 16-bit register is returned.
1605 If 16-bit MMIO register operations are not supported, then ASSERT().
1606 If Address is not aligned on a 16-bit boundary, then ASSERT().
1607 If StartBit is greater than 15, then ASSERT().
1608 If EndBit is greater than 15, then ASSERT().
1609 If EndBit is less than StartBit, then ASSERT().
1610 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1612 @param Address The MMIO register to write.
1613 @param StartBit The ordinal of the least significant bit in the bit field.
1615 @param EndBit The ordinal of the most significant bit in the bit field.
1617 @param Value The new value of the bit field.
1619 @return The value written back to the MMIO register.
1624 MmioBitFieldWrite16 (
1631 return MmioWrite16 (
1633 BitFieldWrite16 (MmioRead16 (Address
), StartBit
, EndBit
, Value
)
1638 Reads a bit field in a 16-bit MMIO register, performs a bitwise OR, and
1639 writes the result back to the bit field in the 16-bit MMIO register.
1641 Reads the 16-bit MMIO register specified by Address, performs a bitwise
1642 OR between the read result and the value specified by OrData, and
1643 writes the result to the 16-bit MMIO register specified by Address. The value
1644 written to the MMIO register is returned. This function must guarantee that
1645 all MMIO read and write operations are serialized. Extra left bits in OrData
1648 If 16-bit MMIO register operations are not supported, then ASSERT().
1649 If Address is not aligned on a 16-bit boundary, then ASSERT().
1650 If StartBit is greater than 15, then ASSERT().
1651 If EndBit is greater than 15, then ASSERT().
1652 If EndBit is less than StartBit, then ASSERT().
1653 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1655 @param Address The MMIO register to write.
1656 @param StartBit The ordinal of the least significant bit in the bit field.
1658 @param EndBit The ordinal of the most significant bit in the bit field.
1660 @param OrData The value to OR with read value from the MMIO register.
1662 @return The value written back to the MMIO register.
1674 return MmioWrite16 (
1676 BitFieldOr16 (MmioRead16 (Address
), StartBit
, EndBit
, OrData
)
1681 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND, and
1682 writes the result back to the bit field in the 16-bit MMIO register.
1684 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1685 between the read result and the value specified by AndData, and writes the
1686 result to the 16-bit MMIO register specified by Address. The value written to
1687 the MMIO register is returned. This function must guarantee that all MMIO
1688 read and write operations are serialized. Extra left bits in AndData are
1691 If 16-bit MMIO register operations are not supported, then ASSERT().
1692 If Address is not aligned on a 16-bit boundary, then ASSERT().
1693 If StartBit is greater than 15, then ASSERT().
1694 If EndBit is greater than 15, then ASSERT().
1695 If EndBit is less than StartBit, then ASSERT().
1696 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1698 @param Address The MMIO register to write.
1699 @param StartBit The ordinal of the least significant bit in the bit field.
1701 @param EndBit The ordinal of the most significant bit in the bit field.
1703 @param AndData The value to AND with read value from the MMIO register.
1705 @return The value written back to the MMIO register.
1717 return MmioWrite16 (
1719 BitFieldAnd16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
)
1724 Reads a bit field in a 16-bit MMIO register, performs a bitwise AND followed
1725 by a bitwise OR, and writes the result back to the bit field in the
1726 16-bit MMIO register.
1728 Reads the 16-bit MMIO register specified by Address, performs a bitwise AND
1729 followed by a bitwise OR between the read result and the value
1730 specified by AndData, and writes the result to the 16-bit MMIO register
1731 specified by Address. The value written to the MMIO register is returned.
1732 This function must guarantee that all MMIO read and write operations are
1733 serialized. Extra left bits in both AndData and OrData are stripped.
1735 If 16-bit MMIO register operations are not supported, then ASSERT().
1736 If Address is not aligned on a 16-bit boundary, then ASSERT().
1737 If StartBit is greater than 15, then ASSERT().
1738 If EndBit is greater than 15, then ASSERT().
1739 If EndBit is less than StartBit, then ASSERT().
1740 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1741 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1743 @param Address The MMIO register to write.
1744 @param StartBit The ordinal of the least significant bit in the bit field.
1746 @param EndBit The ordinal of the most significant bit in the bit field.
1748 @param AndData The value to AND with read value from the MMIO register.
1749 @param OrData The value to OR with the result of the AND operation.
1751 @return The value written back to the MMIO register.
1756 MmioBitFieldAndThenOr16 (
1764 return MmioWrite16 (
1766 BitFieldAndThenOr16 (MmioRead16 (Address
), StartBit
, EndBit
, AndData
, OrData
)
1771 Reads a 32-bit MMIO register, performs a bitwise OR, and writes the
1772 result back to the 32-bit MMIO register.
1774 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1775 OR between the read result and the value specified by OrData, and
1776 writes the result to the 32-bit MMIO register specified by Address. The value
1777 written to the MMIO register is returned. This function must guarantee that
1778 all MMIO read and write operations are serialized.
1780 If 32-bit MMIO register operations are not supported, then ASSERT().
1781 If Address is not aligned on a 32-bit boundary, then ASSERT().
1783 @param Address The MMIO register to write.
1784 @param OrData The value to OR with the read value from the MMIO register.
1786 @return The value written back to the MMIO register.
1796 return MmioWrite32 (Address
, MmioRead32 (Address
) | OrData
);
1800 Reads a 32-bit MMIO register, performs a bitwise AND, and writes the result
1801 back to the 32-bit MMIO register.
1803 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1804 between the read result and the value specified by AndData, and writes the
1805 result to the 32-bit MMIO register specified by Address. The value written to
1806 the MMIO register is returned. This function must guarantee that all MMIO
1807 read and write operations are serialized.
1809 If 32-bit MMIO register operations are not supported, then ASSERT().
1810 If Address is not aligned on a 32-bit boundary, then ASSERT().
1812 @param Address The MMIO register to write.
1813 @param AndData The value to AND with the read value from the MMIO register.
1815 @return The value written back to the MMIO register.
1825 return MmioWrite32 (Address
, MmioRead32 (Address
) & AndData
);
1829 Reads a 32-bit MMIO register, performs a bitwise AND followed by a bitwise
1830 OR, and writes the result back to the 32-bit MMIO register.
1832 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1833 between the read result and the value specified by AndData, performs a
1834 bitwise OR between the result of the AND operation and the value specified by
1835 OrData, and writes the result to the 32-bit MMIO register specified by
1836 Address. The value written to the MMIO register is returned. This function
1837 must guarantee that all MMIO read and write operations are serialized.
1839 If 32-bit MMIO register operations are not supported, then ASSERT().
1840 If Address is not aligned on a 32-bit boundary, then ASSERT().
1842 @param Address The MMIO register to write.
1843 @param AndData The value to AND with the read value from the MMIO register.
1844 @param OrData The value to OR with the result of the AND operation.
1846 @return The value written back to the MMIO register.
1857 return MmioWrite32 (Address
, (MmioRead32 (Address
) & AndData
) | OrData
);
1861 Reads a bit field of a MMIO register.
1863 Reads the bit field in a 32-bit MMIO register. The bit field is specified by
1864 the StartBit and the EndBit. The value of the bit field is returned.
1866 If 32-bit MMIO register operations are not supported, then ASSERT().
1867 If Address is not aligned on a 32-bit boundary, then ASSERT().
1868 If StartBit is greater than 31, then ASSERT().
1869 If EndBit is greater than 31, then ASSERT().
1870 If EndBit is less than StartBit, then ASSERT().
1872 @param Address The MMIO register to read.
1873 @param StartBit The ordinal of the least significant bit in the bit field.
1875 @param EndBit The ordinal of the most significant bit in the bit field.
1878 @return The value read.
1883 MmioBitFieldRead32 (
1889 return BitFieldRead32 (MmioRead32 (Address
), StartBit
, EndBit
);
1893 Writes a bit field to a MMIO register.
1895 Writes Value to the bit field of the MMIO register. The bit field is
1896 specified by the StartBit and the EndBit. All other bits in the destination
1897 MMIO register are preserved. The new value of the 32-bit register is returned.
1899 If 32-bit MMIO register operations are not supported, then ASSERT().
1900 If Address is not aligned on a 32-bit boundary, then ASSERT().
1901 If StartBit is greater than 31, then ASSERT().
1902 If EndBit is greater than 31, then ASSERT().
1903 If EndBit is less than StartBit, then ASSERT().
1904 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1906 @param Address The MMIO register to write.
1907 @param StartBit The ordinal of the least significant bit in the bit field.
1909 @param EndBit The ordinal of the most significant bit in the bit field.
1911 @param Value The new value of the bit field.
1913 @return The value written back to the MMIO register.
1918 MmioBitFieldWrite32 (
1925 return MmioWrite32 (
1927 BitFieldWrite32 (MmioRead32 (Address
), StartBit
, EndBit
, Value
)
1932 Reads a bit field in a 32-bit MMIO register, performs a bitwise OR, and
1933 writes the result back to the bit field in the 32-bit MMIO register.
1935 Reads the 32-bit MMIO register specified by Address, performs a bitwise
1936 OR between the read result and the value specified by OrData, and
1937 writes the result to the 32-bit MMIO register specified by Address. The value
1938 written to the MMIO register is returned. This function must guarantee that
1939 all MMIO read and write operations are serialized. Extra left bits in OrData
1942 If 32-bit MMIO register operations are not supported, then ASSERT().
1943 If Address is not aligned on a 32-bit boundary, then ASSERT().
1944 If StartBit is greater than 31, then ASSERT().
1945 If EndBit is greater than 31, then ASSERT().
1946 If EndBit is less than StartBit, then ASSERT().
1947 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1949 @param Address The MMIO register to write.
1950 @param StartBit The ordinal of the least significant bit in the bit field.
1952 @param EndBit The ordinal of the most significant bit in the bit field.
1954 @param OrData The value to OR with read value from the MMIO register.
1956 @return The value written back to the MMIO register.
1968 return MmioWrite32 (
1970 BitFieldOr32 (MmioRead32 (Address
), StartBit
, EndBit
, OrData
)
1975 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND, and
1976 writes the result back to the bit field in the 32-bit MMIO register.
1978 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
1979 between the read result and the value specified by AndData, and writes the
1980 result to the 32-bit MMIO register specified by Address. The value written to
1981 the MMIO register is returned. This function must guarantee that all MMIO
1982 read and write operations are serialized. Extra left bits in AndData are
1985 If 32-bit MMIO register operations are not supported, then ASSERT().
1986 If Address is not aligned on a 32-bit boundary, then ASSERT().
1987 If StartBit is greater than 31, then ASSERT().
1988 If EndBit is greater than 31, then ASSERT().
1989 If EndBit is less than StartBit, then ASSERT().
1990 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
1992 @param Address The MMIO register to write.
1993 @param StartBit The ordinal of the least significant bit in the bit field.
1995 @param EndBit The ordinal of the most significant bit in the bit field.
1997 @param AndData The value to AND with read value from the MMIO register.
1999 @return The value written back to the MMIO register.
2011 return MmioWrite32 (
2013 BitFieldAnd32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
)
2018 Reads a bit field in a 32-bit MMIO register, performs a bitwise AND followed
2019 by a bitwise OR, and writes the result back to the bit field in the
2020 32-bit MMIO register.
2022 Reads the 32-bit MMIO register specified by Address, performs a bitwise AND
2023 followed by a bitwise OR between the read result and the value
2024 specified by AndData, and writes the result to the 32-bit MMIO register
2025 specified by Address. The value written to the MMIO register is returned.
2026 This function must guarantee that all MMIO read and write operations are
2027 serialized. Extra left bits in both AndData and OrData are stripped.
2029 If 32-bit MMIO register operations are not supported, then ASSERT().
2030 If Address is not aligned on a 32-bit boundary, then ASSERT().
2031 If StartBit is greater than 31, then ASSERT().
2032 If EndBit is greater than 31, then ASSERT().
2033 If EndBit is less than StartBit, then ASSERT().
2034 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2035 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2037 @param Address The MMIO register to write.
2038 @param StartBit The ordinal of the least significant bit in the bit field.
2040 @param EndBit The ordinal of the most significant bit in the bit field.
2042 @param AndData The value to AND with read value from the MMIO register.
2043 @param OrData The value to OR with the result of the AND operation.
2045 @return The value written back to the MMIO register.
2050 MmioBitFieldAndThenOr32 (
2058 return MmioWrite32 (
2060 BitFieldAndThenOr32 (MmioRead32 (Address
), StartBit
, EndBit
, AndData
, OrData
)
2065 Reads a 64-bit MMIO register, performs a bitwise OR, and writes the
2066 result back to the 64-bit MMIO register.
2068 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2069 OR between the read result and the value specified by OrData, and
2070 writes the result to the 64-bit MMIO register specified by Address. The value
2071 written to the MMIO register is returned. This function must guarantee that
2072 all MMIO read and write operations are serialized.
2074 If 64-bit MMIO register operations are not supported, then ASSERT().
2075 If Address is not aligned on a 64-bit boundary, then ASSERT().
2077 @param Address The MMIO register to write.
2078 @param OrData The value to OR with the read value from the MMIO register.
2080 @return The value written back to the MMIO register.
2090 return MmioWrite64 (Address
, MmioRead64 (Address
) | OrData
);
2094 Reads a 64-bit MMIO register, performs a bitwise AND, and writes the result
2095 back to the 64-bit MMIO register.
2097 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2098 between the read result and the value specified by AndData, and writes the
2099 result to the 64-bit MMIO register specified by Address. The value written to
2100 the MMIO register is returned. This function must guarantee that all MMIO
2101 read and write operations are serialized.
2103 If 64-bit MMIO register operations are not supported, then ASSERT().
2104 If Address is not aligned on a 64-bit boundary, then ASSERT().
2106 @param Address The MMIO register to write.
2107 @param AndData The value to AND with the read value from the MMIO register.
2109 @return The value written back to the MMIO register.
2119 return MmioWrite64 (Address
, MmioRead64 (Address
) & AndData
);
2123 Reads a 64-bit MMIO register, performs a bitwise AND followed by a bitwise
2124 OR, and writes the result back to the 64-bit MMIO register.
2126 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2127 between the read result and the value specified by AndData, performs a
2128 bitwise OR between the result of the AND operation and the value specified by
2129 OrData, and writes the result to the 64-bit MMIO register specified by
2130 Address. The value written to the MMIO register is returned. This function
2131 must guarantee that all MMIO read and write operations are serialized.
2133 If 64-bit MMIO register operations are not supported, then ASSERT().
2134 If Address is not aligned on a 64-bit boundary, then ASSERT().
2136 @param Address The MMIO register to write.
2137 @param AndData The value to AND with the read value from the MMIO register.
2138 @param OrData The value to OR with the result of the AND operation.
2140 @return The value written back to the MMIO register.
2151 return MmioWrite64 (Address
, (MmioRead64 (Address
) & AndData
) | OrData
);
2155 Reads a bit field of a MMIO register.
2157 Reads the bit field in a 64-bit MMIO register. The bit field is specified by
2158 the StartBit and the EndBit. The value of the bit field is returned.
2160 If 64-bit MMIO register operations are not supported, then ASSERT().
2161 If Address is not aligned on a 64-bit boundary, then ASSERT().
2162 If StartBit is greater than 63, then ASSERT().
2163 If EndBit is greater than 63, then ASSERT().
2164 If EndBit is less than StartBit, then ASSERT().
2166 @param Address The MMIO register to read.
2167 @param StartBit The ordinal of the least significant bit in the bit field.
2169 @param EndBit The ordinal of the most significant bit in the bit field.
2172 @return The value read.
2177 MmioBitFieldRead64 (
2183 return BitFieldRead64 (MmioRead64 (Address
), StartBit
, EndBit
);
2187 Writes a bit field to a MMIO register.
2189 Writes Value to the bit field of the MMIO register. The bit field is
2190 specified by the StartBit and the EndBit. All other bits in the destination
2191 MMIO register are preserved. The new value of the 64-bit register is returned.
2193 If 64-bit MMIO register operations are not supported, then ASSERT().
2194 If Address is not aligned on a 64-bit boundary, then ASSERT().
2195 If StartBit is greater than 63, then ASSERT().
2196 If EndBit is greater than 63, then ASSERT().
2197 If EndBit is less than StartBit, then ASSERT().
2198 If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2200 @param Address The MMIO register to write.
2201 @param StartBit The ordinal of the least significant bit in the bit field.
2203 @param EndBit The ordinal of the most significant bit in the bit field.
2205 @param Value The new value of the bit field.
2207 @return The value written back to the MMIO register.
2212 MmioBitFieldWrite64 (
2219 return MmioWrite64 (
2221 BitFieldWrite64 (MmioRead64 (Address
), StartBit
, EndBit
, Value
)
2226 Reads a bit field in a 64-bit MMIO register, performs a bitwise OR, and
2227 writes the result back to the bit field in the 64-bit MMIO register.
2229 Reads the 64-bit MMIO register specified by Address, performs a bitwise
2230 OR between the read result and the value specified by OrData, and
2231 writes the result to the 64-bit MMIO register specified by Address. The value
2232 written to the MMIO register is returned. This function must guarantee that
2233 all MMIO read and write operations are serialized. Extra left bits in OrData
2236 If 64-bit MMIO register operations are not supported, then ASSERT().
2237 If Address is not aligned on a 64-bit boundary, then ASSERT().
2238 If StartBit is greater than 63, then ASSERT().
2239 If EndBit is greater than 63, then ASSERT().
2240 If EndBit is less than StartBit, then ASSERT().
2241 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2243 @param Address MMIO register to write.
2244 @param StartBit The ordinal of the least significant bit in the bit field.
2246 @param EndBit The ordinal of the most significant bit in the bit field.
2248 @param OrData The value to OR with read value from the MMIO register.
2250 @return The value written back to the MMIO register.
2262 return MmioWrite64 (
2264 BitFieldOr64 (MmioRead64 (Address
), StartBit
, EndBit
, OrData
)
2269 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND, and
2270 writes the result back to the bit field in the 64-bit MMIO register.
2272 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2273 between the read result and the value specified by AndData, and writes the
2274 result to the 64-bit MMIO register specified by Address. The value written to
2275 the MMIO register is returned. This function must guarantee that all MMIO
2276 read and write operations are serialized. Extra left bits in AndData are
2279 If 64-bit MMIO register operations are not supported, then ASSERT().
2280 If Address is not aligned on a 64-bit boundary, then ASSERT().
2281 If StartBit is greater than 63, then ASSERT().
2282 If EndBit is greater than 63, then ASSERT().
2283 If EndBit is less than StartBit, then ASSERT().
2284 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2286 @param Address MMIO register to write.
2287 @param StartBit The ordinal of the least significant bit in the bit field.
2289 @param EndBit The ordinal of the most significant bit in the bit field.
2291 @param AndData The value to AND with read value from the MMIO register.
2293 @return The value written back to the MMIO register.
2305 return MmioWrite64 (
2307 BitFieldAnd64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
)
2312 Reads a bit field in a 64-bit MMIO register, performs a bitwise AND followed
2313 by a bitwise OR, and writes the result back to the bit field in the
2314 64-bit MMIO register.
2316 Reads the 64-bit MMIO register specified by Address, performs a bitwise AND
2317 followed by a bitwise OR between the read result and the value
2318 specified by AndData, and writes the result to the 64-bit MMIO register
2319 specified by Address. The value written to the MMIO register is returned.
2320 This function must guarantee that all MMIO read and write operations are
2321 serialized. Extra left bits in both AndData and OrData are stripped.
2323 If 64-bit MMIO register operations are not supported, then ASSERT().
2324 If Address is not aligned on a 64-bit boundary, then ASSERT().
2325 If StartBit is greater than 63, then ASSERT().
2326 If EndBit is greater than 63, then ASSERT().
2327 If EndBit is less than StartBit, then ASSERT().
2328 If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2329 If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
2331 @param Address The MMIO register to write.
2332 @param StartBit The ordinal of the least significant bit in the bit field.
2334 @param EndBit The ordinal of the most significant bit in the bit field.
2336 @param AndData The value to AND with read value from the MMIO register.
2337 @param OrData The value to OR with the result of the AND operation.
2339 @return The value written back to the MMIO register.
2344 MmioBitFieldAndThenOr64 (
2352 return MmioWrite64 (
2354 BitFieldAndThenOr64 (MmioRead64 (Address
), StartBit
, EndBit
, AndData
, OrData
)