]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c
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
);
557 FilterAfterMmIoRead (FilterWidth8
, Address
, &Value
);
563 Writes an 8-bit MMIO register.
565 Writes the 8-bit MMIO register specified by Address with the value specified
566 by Value and returns Value. This function must guarantee that all MMIO read
567 and write operations are serialized.
569 If 8-bit MMIO register operations are not supported, then ASSERT().
571 @param Address The MMIO register to write.
572 @param Value The value to write to the MMIO register.
584 Flag
= FilterBeforeMmIoWrite (FilterWidth8
, Address
, &Value
);
586 MmioWrite8Internal (Address
, Value
);
589 FilterAfterMmIoWrite (FilterWidth8
, Address
, &Value
);
595 Reads a 16-bit MMIO register.
597 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
598 returned. This function must guarantee that all MMIO read and write
599 operations are serialized.
601 If 16-bit MMIO register operations are not supported, then ASSERT().
603 @param Address The MMIO register to read.
605 @return The value read.
617 ASSERT ((Address
& 1) == 0);
619 Flag
= FilterBeforeMmIoRead (FilterWidth16
, Address
, &Value
);
621 Value
= MmioRead16Internal (Address
);
624 FilterAfterMmIoRead (FilterWidth16
, Address
, &Value
);
630 Writes a 16-bit MMIO register.
632 Writes the 16-bit MMIO register specified by Address with the value specified
633 by Value and returns Value. This function must guarantee that all MMIO read
634 and write operations are serialized.
636 If 16-bit MMIO register operations are not supported, then ASSERT().
638 @param Address The MMIO register to write.
639 @param Value The value to write to the MMIO register.
651 ASSERT ((Address
& 1) == 0);
653 Flag
= FilterBeforeMmIoWrite (FilterWidth16
, Address
, &Value
);
655 MmioWrite16Internal (Address
, Value
);
658 FilterAfterMmIoWrite (FilterWidth16
, Address
, &Value
);
664 Reads a 32-bit MMIO register.
666 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
667 returned. This function must guarantee that all MMIO read and write
668 operations are serialized.
670 If 32-bit MMIO register operations are not supported, then ASSERT().
672 @param Address The MMIO register to read.
674 @return The value read.
686 ASSERT ((Address
& 3) == 0);
688 Flag
= FilterBeforeMmIoRead (FilterWidth32
, Address
, &Value
);
690 Value
= MmioRead32Internal (Address
);
693 FilterAfterMmIoRead (FilterWidth32
, Address
, &Value
);
699 Writes a 32-bit MMIO register.
701 Writes the 32-bit MMIO register specified by Address with the value specified
702 by Value and returns Value. This function must guarantee that all MMIO read
703 and write operations are serialized.
705 If 32-bit MMIO register operations are not supported, then ASSERT().
707 @param Address The MMIO register to write.
708 @param Value The value to write to the MMIO register.
720 ASSERT ((Address
& 3) == 0);
722 Flag
= FilterBeforeMmIoWrite (FilterWidth32
, Address
, &Value
);
724 MmioWrite32Internal (Address
, Value
);
727 FilterAfterMmIoWrite (FilterWidth32
, Address
, &Value
);
733 Reads a 64-bit MMIO register.
735 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
736 returned. This function must guarantee that all MMIO read and write
737 operations are serialized.
739 If 64-bit MMIO register operations are not supported, then ASSERT().
741 @param Address The MMIO register to read.
743 @return The value read.
755 ASSERT ((Address
& 7) == 0);
757 Flag
= FilterBeforeMmIoRead (FilterWidth64
, Address
, &Value
);
759 Value
= MmioRead64Internal (Address
);
762 FilterAfterMmIoRead (FilterWidth64
, Address
, &Value
);
768 Writes a 64-bit MMIO register.
770 Writes the 64-bit MMIO register specified by Address with the value specified
771 by Value and returns Value. This function must guarantee that all MMIO read
772 and write operations are serialized.
774 If 64-bit MMIO register operations are not supported, then ASSERT().
776 @param Address The MMIO register to write.
777 @param Value The value to write to the MMIO register.
789 ASSERT ((Address
& 7) == 0);
791 Flag
= FilterBeforeMmIoWrite (FilterWidth64
, Address
, &Value
);
793 MmioWrite64Internal (Address
, Value
);
796 FilterAfterMmIoWrite (FilterWidth64
, Address
, &Value
);