]>
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 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.
549 return MmioRead8Internal (Address
);
553 Writes an 8-bit MMIO register.
555 Writes the 8-bit MMIO register specified by Address with the value specified
556 by Value and returns Value. This function must guarantee that all MMIO read
557 and write operations are serialized.
559 If 8-bit MMIO register operations are not supported, then ASSERT().
561 @param Address The MMIO register to write.
562 @param Value The value to write to the MMIO register.
572 MmioWrite8Internal (Address
, Value
);
577 Reads a 16-bit MMIO register.
579 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
580 returned. This function must guarantee that all MMIO read and write
581 operations are serialized.
583 If 16-bit MMIO register operations are not supported, then ASSERT().
585 @param Address The MMIO register to read.
587 @return The value read.
596 ASSERT ((Address
& 1) == 0);
598 return MmioRead16Internal (Address
);
602 Writes a 16-bit MMIO register.
604 Writes the 16-bit MMIO register specified by Address with the value specified
605 by Value and returns Value. This function must guarantee that all MMIO read
606 and write operations are serialized.
608 If 16-bit MMIO register operations are not supported, then ASSERT().
610 @param Address The MMIO register to write.
611 @param Value The value to write to the MMIO register.
621 ASSERT ((Address
& 1) == 0);
623 MmioWrite16Internal (Address
, Value
);
628 Reads a 32-bit MMIO register.
630 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
631 returned. This function must guarantee that all MMIO read and write
632 operations are serialized.
634 If 32-bit MMIO register operations are not supported, then ASSERT().
636 @param Address The MMIO register to read.
638 @return The value read.
647 ASSERT ((Address
& 3) == 0);
649 return MmioRead32Internal (Address
);
653 Writes a 32-bit MMIO register.
655 Writes the 32-bit MMIO register specified by Address with the value specified
656 by Value and returns Value. This function must guarantee that all MMIO read
657 and write operations are serialized.
659 If 32-bit MMIO register operations are not supported, then ASSERT().
661 @param Address The MMIO register to write.
662 @param Value The value to write to the MMIO register.
672 ASSERT ((Address
& 3) == 0);
674 MmioWrite32Internal (Address
, Value
);
679 Reads a 64-bit MMIO register.
681 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
682 returned. This function must guarantee that all MMIO read and write
683 operations are serialized.
685 If 64-bit MMIO register operations are not supported, then ASSERT().
687 @param Address The MMIO register to read.
689 @return The value read.
698 ASSERT ((Address
& 7) == 0);
700 return MmioRead64Internal (Address
);
704 Writes a 64-bit MMIO register.
706 Writes the 64-bit MMIO register specified by Address with the value specified
707 by Value and returns Value. This function must guarantee that all MMIO read
708 and write operations are serialized.
710 If 64-bit MMIO register operations are not supported, then ASSERT().
712 @param Address The MMIO register to write.
713 @param Value The value to write to the MMIO register.
723 ASSERT ((Address
& 7) == 0);
725 MmioWrite64Internal (Address
, Value
);