]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c
4 Copyright (c) 2006 - 2018, 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>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
14 // Include common header file for this module.
16 #include "BaseIoLibIntrinsicInternal.h"
19 Reads an 8-bit I/O port.
21 Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
22 This function must guarantee that all I/O read and write operations are
25 If 8-bit I/O port operations are not supported, then ASSERT().
27 @param Port The I/O port to read.
29 @return The value read.
43 Writes an 8-bit I/O port.
45 Writes the 8-bit I/O port specified by Port with the value specified by Value
46 and returns Value. This function must guarantee that all I/O read and write
47 operations are serialized.
49 If 8-bit I/O port operations are not supported, then ASSERT().
51 @param Port The I/O port to write.
52 @param Value The value to write to the I/O port.
54 @return The value written the I/O port.
69 Reads a 16-bit I/O port.
71 Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
72 This function must guarantee that all I/O read and write operations are
75 If 16-bit I/O port operations are not supported, then ASSERT().
77 @param Port The I/O port to read.
79 @return The value read.
93 Writes a 16-bit I/O port.
95 Writes the 16-bit I/O port specified by Port with the value specified by Value
96 and returns Value. This function must guarantee that all I/O read and write
97 operations are serialized.
99 If 16-bit I/O port operations are not supported, then ASSERT().
101 @param Port The I/O port to write.
102 @param Value The value to write to the I/O port.
104 @return The value written the I/O port.
119 Reads a 32-bit I/O port.
121 Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
122 This function must guarantee that all I/O read and write operations are
125 If 32-bit I/O port operations are not supported, then ASSERT().
127 @param Port The I/O port to read.
129 @return The value read.
143 Writes a 32-bit I/O port.
145 Writes the 32-bit I/O port specified by Port with the value specified by Value
146 and returns Value. This function must guarantee that all I/O read and write
147 operations are serialized.
149 If 32-bit I/O port operations are not supported, then ASSERT().
151 @param Port The I/O port to write.
152 @param Value The value to write to the I/O port.
154 @return The value written the I/O port.
169 Reads a 64-bit I/O port.
171 Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
172 This function must guarantee that all I/O read and write operations are
175 If 64-bit I/O port operations are not supported, then ASSERT().
176 If Port is not aligned on a 64-bit boundary, then ASSERT().
178 @param Port The I/O port to read.
180 @return The value read.
194 Writes a 64-bit I/O port.
196 Writes the 64-bit I/O port specified by Port with the value specified by Value
197 and returns Value. This function must guarantee that all I/O read and write
198 operations are serialized.
200 If 64-bit I/O port operations are not supported, then ASSERT().
201 If Port is not aligned on a 64-bit boundary, then ASSERT().
203 @param Port The I/O port to write.
204 @param Value The value to write to the I/O port.
206 @return The value written to the I/O port.
221 Reads an 8-bit I/O port fifo into a block of memory.
223 Reads the 8-bit I/O fifo port specified by Port.
224 The port is read Count times, and the read data is
225 stored in the provided Buffer.
227 This function must guarantee that all I/O read and write operations are
230 If 8-bit I/O port operations are not supported, then ASSERT().
232 @param Port The I/O port to read.
233 @param Count The number of times to read I/O port.
234 @param Buffer The buffer to store the read data into.
249 Writes a block of memory into an 8-bit I/O port fifo.
251 Writes the 8-bit I/O fifo port specified by Port.
252 The port is written Count times, and the write data is
253 retrieved from the provided Buffer.
255 This function must guarantee that all I/O write and write operations are
258 If 8-bit I/O port operations are not supported, then ASSERT().
260 @param Port The I/O port to write.
261 @param Count The number of times to write I/O port.
262 @param Buffer The buffer to retrieve the write data from.
277 Reads a 16-bit I/O port fifo into a block of memory.
279 Reads the 16-bit I/O fifo port specified by Port.
280 The port is read Count times, and the read data is
281 stored in the provided Buffer.
283 This function must guarantee that all I/O read and write operations are
286 If 16-bit I/O port operations are not supported, then ASSERT().
288 @param Port The I/O port to read.
289 @param Count The number of times to read I/O port.
290 @param Buffer The buffer to store the read data into.
305 Writes a block of memory into a 16-bit I/O port fifo.
307 Writes the 16-bit I/O fifo port specified by Port.
308 The port is written Count times, and the write data is
309 retrieved from the provided Buffer.
311 This function must guarantee that all I/O write and write operations are
314 If 16-bit I/O port operations are not supported, then ASSERT().
316 @param Port The I/O port to write.
317 @param Count The number of times to write I/O port.
318 @param Buffer The buffer to retrieve the write data from.
333 Reads a 32-bit I/O port fifo into a block of memory.
335 Reads the 32-bit I/O fifo port specified by Port.
336 The port is read Count times, and the read data is
337 stored in the provided Buffer.
339 This function must guarantee that all I/O read and write operations are
342 If 32-bit I/O port operations are not supported, then ASSERT().
344 @param Port The I/O port to read.
345 @param Count The number of times to read I/O port.
346 @param Buffer The buffer to store the read data into.
361 Writes a block of memory into a 32-bit I/O port fifo.
363 Writes the 32-bit I/O fifo port specified by Port.
364 The port is written Count times, and the write data is
365 retrieved from the provided Buffer.
367 This function must guarantee that all I/O write and write operations are
370 If 32-bit I/O port operations are not supported, then ASSERT().
372 @param Port The I/O port to write.
373 @param Count The number of times to write I/O port.
374 @param Buffer The buffer to retrieve the write data from.
389 Reads an 8-bit MMIO register.
391 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
392 returned. This function must guarantee that all MMIO read and write
393 operations are serialized.
395 If 8-bit MMIO register operations are not supported, then ASSERT().
397 @param Address The MMIO register to read.
399 @return The value read.
410 Value
= *(volatile UINT8
*)Address
;
415 Writes an 8-bit MMIO register.
417 Writes the 8-bit MMIO register specified by Address with the value specified
418 by Value and returns Value. This function must guarantee that all MMIO read
419 and write operations are serialized.
421 If 8-bit MMIO register operations are not supported, then ASSERT().
423 @param Address The MMIO register to write.
424 @param Value The value to write to the MMIO register.
434 *(volatile UINT8
*)Address
= Value
;
439 Reads a 16-bit MMIO register.
441 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
442 returned. This function must guarantee that all MMIO read and write
443 operations are serialized.
445 If 16-bit MMIO register operations are not supported, then ASSERT().
447 @param Address The MMIO register to read.
449 @return The value read.
460 ASSERT ((Address
& 1) == 0);
461 Value
= *(volatile UINT16
*)Address
;
466 Writes a 16-bit MMIO register.
468 Writes the 16-bit MMIO register specified by Address with the value specified
469 by Value and returns Value. This function must guarantee that all MMIO read
470 and write operations are serialized.
472 If 16-bit MMIO register operations are not supported, then ASSERT().
474 @param Address The MMIO register to write.
475 @param Value The value to write to the MMIO register.
485 ASSERT ((Address
& 1) == 0);
486 *(volatile UINT16
*)Address
= Value
;
491 Reads a 32-bit MMIO register.
493 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
494 returned. This function must guarantee that all MMIO read and write
495 operations are serialized.
497 If 32-bit MMIO register operations are not supported, then ASSERT().
499 @param Address The MMIO register to read.
501 @return The value read.
512 ASSERT ((Address
& 3) == 0);
513 Value
= *(volatile UINT32
*)Address
;
518 Writes a 32-bit MMIO register.
520 Writes the 32-bit MMIO register specified by Address with the value specified
521 by Value and returns Value. This function must guarantee that all MMIO read
522 and write operations are serialized.
524 If 32-bit MMIO register operations are not supported, then ASSERT().
526 @param Address The MMIO register to write.
527 @param Value The value to write to the MMIO register.
537 ASSERT ((Address
& 3) == 0);
538 *(volatile UINT32
*)Address
= Value
;
543 Reads a 64-bit MMIO register.
545 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
546 returned. This function must guarantee that all MMIO read and write
547 operations are serialized.
549 If 64-bit MMIO register operations are not supported, then ASSERT().
551 @param Address The MMIO register to read.
553 @return The value read.
564 ASSERT ((Address
& 7) == 0);
565 Value
= *(volatile UINT64
*)Address
;
570 Writes a 64-bit MMIO register.
572 Writes the 64-bit MMIO register specified by Address with the value specified
573 by Value and returns Value. This function must guarantee that all MMIO read
574 and write operations are serialized.
576 If 64-bit MMIO register operations are not supported, then ASSERT().
578 @param Address The MMIO register to write.
579 @param Value The value to write to the MMIO register.
589 ASSERT ((Address
& 7) == 0);
590 *(volatile UINT64
*)Address
= Value
;