]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c
61408407698fd032b780ea4a5a24fd4ffefea926
4 Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
5 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
6 Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
7 Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>
9 SPDX-License-Identifier: BSD-2-Clause-Patent
13 #include "BaseIoLibIntrinsicInternal.h"
16 Reads an 8-bit MMIO register.
18 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
19 returned. This function must guarantee that all MMIO read and write
20 operations are serialized.
22 @param Address The MMIO register to read.
24 @return The value read.
34 Writes an 8-bit MMIO register.
36 Writes the 8-bit MMIO register specified by Address with the value specified
37 by Value and returns Value. This function must guarantee that all MMIO read
38 and write operations are serialized.
40 @param Address The MMIO register to write.
41 @param Value The value to write to the MMIO register.
52 Reads a 16-bit MMIO register.
54 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
55 returned. This function must guarantee that all MMIO read and write
56 operations are serialized.
58 @param Address The MMIO register to read.
60 @return The value read.
70 Writes a 16-bit MMIO register.
72 Writes the 16-bit MMIO register specified by Address with the value specified
73 by Value and returns Value. This function must guarantee that all MMIO read
74 and write operations are serialized.
76 @param Address The MMIO register to write.
77 @param Value The value to write to the MMIO register.
88 Reads a 32-bit MMIO register.
90 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
91 returned. This function must guarantee that all MMIO read and write
92 operations are serialized.
94 @param Address The MMIO register to read.
96 @return The value read.
106 Writes a 32-bit MMIO register.
108 Writes the 32-bit MMIO register specified by Address with the value specified
109 by Value and returns Value. This function must guarantee that all MMIO read
110 and write operations are serialized.
112 @param Address The MMIO register to write.
113 @param Value The value to write to the MMIO register.
118 MmioWrite32Internal (
124 Reads a 64-bit MMIO register.
126 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
127 returned. This function must guarantee that all MMIO read and write
128 operations are serialized.
130 @param Address The MMIO register to read.
132 @return The value read.
142 Writes a 64-bit MMIO register.
144 Writes the 64-bit MMIO register specified by Address with the value specified
145 by Value and returns Value. This function must guarantee that all MMIO read
146 and write operations are serialized.
148 @param Address The MMIO register to write.
149 @param Value The value to write to the MMIO register.
154 MmioWrite64Internal (
160 Reads an 8-bit I/O port.
162 Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
163 This function must guarantee that all I/O read and write operations are
166 If 8-bit I/O port operations are not supported, then ASSERT().
168 @param Port The I/O port to read.
170 @return The value read.
184 Writes an 8-bit I/O port.
186 Writes the 8-bit I/O port specified by Port with the value specified by Value
187 and returns Value. This function must guarantee that all I/O read and write
188 operations are serialized.
190 If 8-bit I/O port operations are not supported, then ASSERT().
192 @param Port The I/O port to write.
193 @param Value The value to write to the I/O port.
195 @return The value written the I/O port.
210 Reads a 16-bit I/O port.
212 Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
213 This function must guarantee that all I/O read and write operations are
216 If 16-bit I/O port operations are not supported, then ASSERT().
218 @param Port The I/O port to read.
220 @return The value read.
234 Writes a 16-bit I/O port.
236 Writes the 16-bit I/O port specified by Port with the value specified by Value
237 and returns Value. This function must guarantee that all I/O read and write
238 operations are serialized.
240 If 16-bit I/O port operations are not supported, then ASSERT().
242 @param Port The I/O port to write.
243 @param Value The value to write to the I/O port.
245 @return The value written the I/O port.
260 Reads a 32-bit I/O port.
262 Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
263 This function must guarantee that all I/O read and write operations are
266 If 32-bit I/O port operations are not supported, then ASSERT().
268 @param Port The I/O port to read.
270 @return The value read.
284 Writes a 32-bit I/O port.
286 Writes the 32-bit I/O port specified by Port with the value specified by Value
287 and returns Value. This function must guarantee that all I/O read and write
288 operations are serialized.
290 If 32-bit I/O port operations are not supported, then ASSERT().
292 @param Port The I/O port to write.
293 @param Value The value to write to the I/O port.
295 @return The value written the I/O port.
310 Reads a 64-bit I/O port.
312 Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
313 This function must guarantee that all I/O read and write operations are
316 If 64-bit I/O port operations are not supported, then ASSERT().
317 If Port is not aligned on a 64-bit boundary, then ASSERT().
319 @param Port The I/O port to read.
321 @return The value read.
335 Writes a 64-bit I/O port.
337 Writes the 64-bit I/O port specified by Port with the value specified by Value
338 and returns Value. This function must guarantee that all I/O read and write
339 operations are serialized.
341 If 64-bit I/O port operations are not supported, then ASSERT().
342 If Port is not aligned on a 64-bit boundary, then ASSERT().
344 @param Port The I/O port to write.
345 @param Value The value to write to the I/O port.
347 @return The value written to the I/O port.
362 Reads an 8-bit I/O port fifo into a block of memory.
364 Reads the 8-bit I/O fifo port specified by Port.
365 The port is read Count times, and the read data is
366 stored in the provided Buffer.
368 This function must guarantee that all I/O read and write operations are
371 If 8-bit I/O port operations are not supported, then ASSERT().
373 @param Port The I/O port to read.
374 @param Count The number of times to read I/O port.
375 @param Buffer The buffer to store the read data into.
390 Writes a block of memory into an 8-bit I/O port fifo.
392 Writes the 8-bit I/O fifo port specified by Port.
393 The port is written Count times, and the write data is
394 retrieved from the provided Buffer.
396 This function must guarantee that all I/O write and write operations are
399 If 8-bit I/O port operations are not supported, then ASSERT().
401 @param Port The I/O port to write.
402 @param Count The number of times to write I/O port.
403 @param Buffer The buffer to retrieve the write data from.
418 Reads a 16-bit I/O port fifo into a block of memory.
420 Reads the 16-bit I/O fifo port specified by Port.
421 The port is read Count times, and the read data is
422 stored in the provided Buffer.
424 This function must guarantee that all I/O read and write operations are
427 If 16-bit I/O port operations are not supported, then ASSERT().
429 @param Port The I/O port to read.
430 @param Count The number of times to read I/O port.
431 @param Buffer The buffer to store the read data into.
446 Writes a block of memory into a 16-bit I/O port fifo.
448 Writes the 16-bit I/O fifo port specified by Port.
449 The port is written Count times, and the write data is
450 retrieved from the provided Buffer.
452 This function must guarantee that all I/O write and write operations are
455 If 16-bit I/O port operations are not supported, then ASSERT().
457 @param Port The I/O port to write.
458 @param Count The number of times to write I/O port.
459 @param Buffer The buffer to retrieve the write data from.
474 Reads a 32-bit I/O port fifo into a block of memory.
476 Reads the 32-bit I/O fifo port specified by Port.
477 The port is read Count times, and the read data is
478 stored in the provided Buffer.
480 This function must guarantee that all I/O read and write operations are
483 If 32-bit I/O port operations are not supported, then ASSERT().
485 @param Port The I/O port to read.
486 @param Count The number of times to read I/O port.
487 @param Buffer The buffer to store the read data into.
502 Writes a block of memory into a 32-bit I/O port fifo.
504 Writes the 32-bit I/O fifo port specified by Port.
505 The port is written Count times, and the write data is
506 retrieved from the provided Buffer.
508 This function must guarantee that all I/O write and write operations are
511 If 32-bit I/O port operations are not supported, then ASSERT().
513 @param Port The I/O port to write.
514 @param Count The number of times to write I/O port.
515 @param Buffer The buffer to retrieve the write data from.
530 Reads an 8-bit MMIO register.
532 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
533 returned. This function must guarantee that all MMIO read and write
534 operations are serialized.
536 If 8-bit MMIO register operations are not supported, then ASSERT().
538 @param Address The MMIO register to read.
540 @return The value read.
552 Flag
= FilterBeforeMmIoRead (FilterWidth8
, Address
, &Value
);
554 Value
= MmioRead8Internal (Address
);
556 FilterAfterMmIoRead (FilterWidth8
, Address
, &Value
);
562 Writes an 8-bit MMIO register.
564 Writes the 8-bit MMIO register specified by Address with the value specified
565 by Value and returns Value. This function must guarantee that all MMIO read
566 and write operations are serialized.
568 If 8-bit MMIO register operations are not supported, then ASSERT().
570 @param Address The MMIO register to write.
571 @param Value The value to write to the MMIO register.
583 Flag
= FilterBeforeMmIoWrite (FilterWidth8
, Address
, &Value
);
585 MmioWrite8Internal (Address
, Value
);
587 FilterAfterMmIoWrite (FilterWidth8
, Address
, &Value
);
593 Reads a 16-bit MMIO register.
595 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
596 returned. This function must guarantee that all MMIO read and write
597 operations are serialized.
599 If 16-bit MMIO register operations are not supported, then ASSERT().
601 @param Address The MMIO register to read.
603 @return The value read.
615 ASSERT ((Address
& 1) == 0);
617 Flag
= FilterBeforeMmIoRead (FilterWidth16
, Address
, &Value
);
619 Value
= MmioRead16Internal (Address
);
621 FilterAfterMmIoRead (FilterWidth16
, Address
, &Value
);
627 Writes a 16-bit MMIO register.
629 Writes the 16-bit MMIO register specified by Address with the value specified
630 by Value and returns Value. This function must guarantee that all MMIO read
631 and write operations are serialized.
633 If 16-bit MMIO register operations are not supported, then ASSERT().
635 @param Address The MMIO register to write.
636 @param Value The value to write to the MMIO register.
648 ASSERT ((Address
& 1) == 0);
650 Flag
= FilterBeforeMmIoWrite (FilterWidth16
, Address
, &Value
);
652 MmioWrite16Internal (Address
, Value
);
654 FilterAfterMmIoWrite (FilterWidth16
, Address
, &Value
);
660 Reads a 32-bit MMIO register.
662 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
663 returned. This function must guarantee that all MMIO read and write
664 operations are serialized.
666 If 32-bit MMIO register operations are not supported, then ASSERT().
668 @param Address The MMIO register to read.
670 @return The value read.
682 ASSERT ((Address
& 3) == 0);
684 Flag
= FilterBeforeMmIoRead (FilterWidth32
, Address
, &Value
);
686 Value
= MmioRead32Internal (Address
);
688 FilterAfterMmIoRead (FilterWidth32
, Address
, &Value
);
694 Writes a 32-bit MMIO register.
696 Writes the 32-bit MMIO register specified by Address with the value specified
697 by Value and returns Value. This function must guarantee that all MMIO read
698 and write operations are serialized.
700 If 32-bit MMIO register operations are not supported, then ASSERT().
702 @param Address The MMIO register to write.
703 @param Value The value to write to the MMIO register.
715 ASSERT ((Address
& 3) == 0);
717 Flag
= FilterBeforeMmIoWrite (FilterWidth32
, Address
, &Value
);
719 MmioWrite32Internal (Address
, Value
);
721 FilterAfterMmIoWrite (FilterWidth32
, Address
, &Value
);
727 Reads a 64-bit MMIO register.
729 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
730 returned. This function must guarantee that all MMIO read and write
731 operations are serialized.
733 If 64-bit MMIO register operations are not supported, then ASSERT().
735 @param Address The MMIO register to read.
737 @return The value read.
749 ASSERT ((Address
& 7) == 0);
751 Flag
= FilterBeforeMmIoRead (FilterWidth64
, Address
, &Value
);
753 Value
= MmioRead64Internal (Address
);
755 FilterAfterMmIoRead (FilterWidth64
, Address
, &Value
);
761 Writes a 64-bit MMIO register.
763 Writes the 64-bit MMIO register specified by Address with the value specified
764 by Value and returns Value. This function must guarantee that all MMIO read
765 and write operations are serialized.
767 If 64-bit MMIO register operations are not supported, then ASSERT().
769 @param Address The MMIO register to write.
770 @param Value The value to write to the MMIO register.
782 ASSERT ((Address
& 7) == 0);
784 Flag
= FilterBeforeMmIoWrite (FilterWidth64
, Address
, &Value
);
786 MmioWrite64Internal (Address
, Value
);
788 FilterAfterMmIoWrite (FilterWidth64
, Address
, &Value
);