]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c
4 Copyright (c) 2006 - 2009, 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 This program and the accompanying materials are licensed and made available
10 under the terms and conditions of the BSD License which accompanies this
11 distribution. The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php.
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 #include "BaseIoLibIntrinsicInternal.h"
22 Reads an 8-bit MMIO register.
24 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
25 returned. This function must guarantee that all MMIO read and write
26 operations are serialized.
28 @param Address The MMIO register to read.
30 @return The value read.
40 Writes an 8-bit MMIO register.
42 Writes the 8-bit MMIO register specified by Address with the value specified
43 by Value and returns Value. This function must guarantee that all MMIO read
44 and write operations are serialized.
46 @param Address The MMIO register to write.
47 @param Value The value to write to the MMIO register.
58 Reads a 16-bit MMIO register.
60 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
61 returned. This function must guarantee that all MMIO read and write
62 operations are serialized.
64 @param Address The MMIO register to read.
66 @return The value read.
76 Writes a 16-bit MMIO register.
78 Writes the 16-bit MMIO register specified by Address with the value specified
79 by Value and returns Value. This function must guarantee that all MMIO read
80 and write operations are serialized.
82 @param Address The MMIO register to write.
83 @param Value The value to write to the MMIO register.
94 Reads a 32-bit MMIO register.
96 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
97 returned. This function must guarantee that all MMIO read and write
98 operations are serialized.
100 @param Address The MMIO register to read.
102 @return The value read.
112 Writes a 32-bit MMIO register.
114 Writes the 32-bit MMIO register specified by Address with the value specified
115 by Value and returns Value. This function must guarantee that all MMIO read
116 and write operations are serialized.
118 @param Address The MMIO register to write.
119 @param Value The value to write to the MMIO register.
124 MmioWrite32Internal (
130 Reads a 64-bit MMIO register.
132 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
133 returned. This function must guarantee that all MMIO read and write
134 operations are serialized.
136 @param Address The MMIO register to read.
138 @return The value read.
148 Writes a 64-bit MMIO register.
150 Writes the 64-bit MMIO register specified by Address with the value specified
151 by Value and returns Value. This function must guarantee that all MMIO read
152 and write operations are serialized.
154 @param Address The MMIO register to write.
155 @param Value The value to write to the MMIO register.
160 MmioWrite64Internal (
166 Reads an 8-bit I/O port.
168 Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
169 This function must guarantee that all I/O read and write operations are
172 If 8-bit I/O port operations are not supported, then ASSERT().
174 @param Port The I/O port to read.
176 @return The value read.
190 Writes an 8-bit I/O port.
192 Writes the 8-bit I/O port specified by Port with the value specified by Value
193 and returns Value. This function must guarantee that all I/O read and write
194 operations are serialized.
196 If 8-bit I/O port operations are not supported, then ASSERT().
198 @param Port The I/O port to write.
199 @param Value The value to write to the I/O port.
201 @return The value written the I/O port.
216 Reads a 16-bit I/O port.
218 Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
219 This function must guarantee that all I/O read and write operations are
222 If 16-bit I/O port operations are not supported, then ASSERT().
224 @param Port The I/O port to read.
226 @return The value read.
240 Writes a 16-bit I/O port.
242 Writes the 16-bit I/O port specified by Port with the value specified by Value
243 and returns Value. This function must guarantee that all I/O read and write
244 operations are serialized.
246 If 16-bit I/O port operations are not supported, then ASSERT().
248 @param Port The I/O port to write.
249 @param Value The value to write to the I/O port.
251 @return The value written the I/O port.
266 Reads a 32-bit I/O port.
268 Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
269 This function must guarantee that all I/O read and write operations are
272 If 32-bit I/O port operations are not supported, then ASSERT().
274 @param Port The I/O port to read.
276 @return The value read.
290 Writes a 32-bit I/O port.
292 Writes the 32-bit I/O port specified by Port with the value specified by Value
293 and returns Value. This function must guarantee that all I/O read and write
294 operations are serialized.
296 If 32-bit I/O port operations are not supported, then ASSERT().
298 @param Port The I/O port to write.
299 @param Value The value to write to the I/O port.
301 @return The value written the I/O port.
316 Reads a 64-bit I/O port.
318 Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
319 This function must guarantee that all I/O read and write operations are
322 If 64-bit I/O port operations are not supported, then ASSERT().
323 If Port is not aligned on a 64-bit boundary, then ASSERT().
325 @param Port The I/O port to read.
327 @return The value read.
341 Writes a 64-bit I/O port.
343 Writes the 64-bit I/O port specified by Port with the value specified by Value
344 and returns Value. This function must guarantee that all I/O read and write
345 operations are serialized.
347 If 64-bit I/O port operations are not supported, then ASSERT().
348 If Port is not aligned on a 64-bit boundary, then ASSERT().
350 @param Port The I/O port to write.
351 @param Value The value to write to the I/O port.
353 @return The value written to the I/O port.
368 Reads an 8-bit I/O port fifo into a block of memory.
370 Reads the 8-bit I/O fifo port specified by Port.
371 The port is read Count times, and the read data is
372 stored in the provided Buffer.
374 This function must guarantee that all I/O read and write operations are
377 If 8-bit I/O port operations are not supported, then ASSERT().
379 @param Port The I/O port to read.
380 @param Count The number of times to read I/O port.
381 @param Buffer The buffer to store the read data into.
396 Writes a block of memory into an 8-bit I/O port fifo.
398 Writes the 8-bit I/O fifo port specified by Port.
399 The port is written Count times, and the write data is
400 retrieved from the provided Buffer.
402 This function must guarantee that all I/O write and write operations are
405 If 8-bit I/O port operations are not supported, then ASSERT().
407 @param Port The I/O port to write.
408 @param Count The number of times to write I/O port.
409 @param Buffer The buffer to retrieve the write data from.
424 Reads a 16-bit I/O port fifo into a block of memory.
426 Reads the 16-bit I/O fifo port specified by Port.
427 The port is read Count times, and the read data is
428 stored in the provided Buffer.
430 This function must guarantee that all I/O read and write operations are
433 If 16-bit I/O port operations are not supported, then ASSERT().
435 @param Port The I/O port to read.
436 @param Count The number of times to read I/O port.
437 @param Buffer The buffer to store the read data into.
452 Writes a block of memory into a 16-bit I/O port fifo.
454 Writes the 16-bit I/O fifo port specified by Port.
455 The port is written Count times, and the write data is
456 retrieved from the provided Buffer.
458 This function must guarantee that all I/O write and write operations are
461 If 16-bit I/O port operations are not supported, then ASSERT().
463 @param Port The I/O port to write.
464 @param Count The number of times to write I/O port.
465 @param Buffer The buffer to retrieve the write data from.
480 Reads a 32-bit I/O port fifo into a block of memory.
482 Reads the 32-bit I/O fifo port specified by Port.
483 The port is read Count times, and the read data is
484 stored in the provided Buffer.
486 This function must guarantee that all I/O read and write operations are
489 If 32-bit I/O port operations are not supported, then ASSERT().
491 @param Port The I/O port to read.
492 @param Count The number of times to read I/O port.
493 @param Buffer The buffer to store the read data into.
508 Writes a block of memory into a 32-bit I/O port fifo.
510 Writes the 32-bit I/O fifo port specified by Port.
511 The port is written Count times, and the write data is
512 retrieved from the provided Buffer.
514 This function must guarantee that all I/O write and write operations are
517 If 32-bit I/O port operations are not supported, then ASSERT().
519 @param Port The I/O port to write.
520 @param Count The number of times to write I/O port.
521 @param Buffer The buffer to retrieve the write data from.
536 Reads an 8-bit MMIO register.
538 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
539 returned. This function must guarantee that all MMIO read and write
540 operations are serialized.
542 If 8-bit MMIO register operations are not supported, then ASSERT().
544 @param Address The MMIO register to read.
546 @return The value read.
555 return MmioRead8Internal (Address
);
559 Writes an 8-bit MMIO register.
561 Writes the 8-bit MMIO register specified by Address with the value specified
562 by Value and returns Value. This function must guarantee that all MMIO read
563 and write operations are serialized.
565 If 8-bit MMIO register operations are not supported, then ASSERT().
567 @param Address The MMIO register to write.
568 @param Value The value to write to the MMIO register.
578 MmioWrite8Internal (Address
, Value
);
583 Reads a 16-bit MMIO register.
585 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
586 returned. This function must guarantee that all MMIO read and write
587 operations are serialized.
589 If 16-bit MMIO register operations are not supported, then ASSERT().
591 @param Address The MMIO register to read.
593 @return The value read.
602 ASSERT ((Address
& 1) == 0);
604 return MmioRead16Internal (Address
);
608 Writes a 16-bit MMIO register.
610 Writes the 16-bit MMIO register specified by Address with the value specified
611 by Value and returns Value. This function must guarantee that all MMIO read
612 and write operations are serialized.
614 If 16-bit MMIO register operations are not supported, then ASSERT().
616 @param Address The MMIO register to write.
617 @param Value The value to write to the MMIO register.
627 ASSERT ((Address
& 1) == 0);
629 MmioWrite16Internal (Address
, Value
);
634 Reads a 32-bit MMIO register.
636 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
637 returned. This function must guarantee that all MMIO read and write
638 operations are serialized.
640 If 32-bit MMIO register operations are not supported, then ASSERT().
642 @param Address The MMIO register to read.
644 @return The value read.
653 ASSERT ((Address
& 3) == 0);
655 return MmioRead32Internal (Address
);
659 Writes a 32-bit MMIO register.
661 Writes the 32-bit MMIO register specified by Address with the value specified
662 by Value and returns Value. This function must guarantee that all MMIO read
663 and write operations are serialized.
665 If 32-bit MMIO register operations are not supported, then ASSERT().
667 @param Address The MMIO register to write.
668 @param Value The value to write to the MMIO register.
678 ASSERT ((Address
& 3) == 0);
680 MmioWrite32Internal (Address
, Value
);
685 Reads a 64-bit MMIO register.
687 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
688 returned. This function must guarantee that all MMIO read and write
689 operations are serialized.
691 If 64-bit MMIO register operations are not supported, then ASSERT().
693 @param Address The MMIO register to read.
695 @return The value read.
704 ASSERT ((Address
& 7) == 0);
706 return MmioRead64Internal (Address
);
710 Writes a 64-bit MMIO register.
712 Writes the 64-bit MMIO register specified by Address with the value specified
713 by Value and returns Value. This function must guarantee that all MMIO read
714 and write operations are serialized.
716 If 64-bit MMIO register operations are not supported, then ASSERT().
718 @param Address The MMIO register to write.
719 @param Value The value to write to the MMIO register.
729 ASSERT ((Address
& 7) == 0);
731 MmioWrite64Internal (Address
, Value
);