]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.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>
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php.
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 // Include common header file for this module.
22 #include "BaseIoLibIntrinsicInternal.h"
25 Reads an 8-bit I/O port.
27 Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
28 This function must guarantee that all I/O read and write operations are
31 If 8-bit I/O port operations are not supported, then ASSERT().
33 @param Port The I/O port to read.
35 @return The value read.
49 Writes an 8-bit I/O port.
51 Writes the 8-bit I/O port specified by Port with the value specified by Value
52 and returns Value. This function must guarantee that all I/O read and write
53 operations are serialized.
55 If 8-bit I/O port operations are not supported, then ASSERT().
57 @param Port The I/O port to write.
58 @param Value The value to write to the I/O port.
60 @return The value written the I/O port.
75 Reads a 16-bit I/O port.
77 Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
78 This function must guarantee that all I/O read and write operations are
81 If 16-bit I/O port operations are not supported, then ASSERT().
83 @param Port The I/O port to read.
85 @return The value read.
99 Writes a 16-bit I/O port.
101 Writes the 16-bit I/O port specified by Port with the value specified by Value
102 and returns Value. This function must guarantee that all I/O read and write
103 operations are serialized.
105 If 16-bit I/O port operations are not supported, then ASSERT().
107 @param Port The I/O port to write.
108 @param Value The value to write to the I/O port.
110 @return The value written the I/O port.
125 Reads a 32-bit I/O port.
127 Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
128 This function must guarantee that all I/O read and write operations are
131 If 32-bit I/O port operations are not supported, then ASSERT().
133 @param Port The I/O port to read.
135 @return The value read.
149 Writes a 32-bit I/O port.
151 Writes the 32-bit I/O port specified by Port with the value specified by Value
152 and returns Value. This function must guarantee that all I/O read and write
153 operations are serialized.
155 If 32-bit I/O port operations are not supported, then ASSERT().
157 @param Port The I/O port to write.
158 @param Value The value to write to the I/O port.
160 @return The value written the I/O port.
175 Reads a 64-bit I/O port.
177 Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
178 This function must guarantee that all I/O read and write operations are
181 If 64-bit I/O port operations are not supported, then ASSERT().
182 If Port is not aligned on a 64-bit boundary, then ASSERT().
184 @param Port The I/O port to read.
186 @return The value read.
200 Writes a 64-bit I/O port.
202 Writes the 64-bit I/O port specified by Port with the value specified by Value
203 and returns Value. This function must guarantee that all I/O read and write
204 operations are serialized.
206 If 64-bit I/O port operations are not supported, then ASSERT().
207 If Port is not aligned on a 64-bit boundary, then ASSERT().
209 @param Port The I/O port to write.
210 @param Value The value to write to the I/O port.
212 @return The value written to the I/O port.
227 Reads an 8-bit I/O port fifo into a block of memory.
229 Reads the 8-bit I/O fifo port specified by Port.
230 The port is read Count times, and the read data is
231 stored in the provided Buffer.
233 This function must guarantee that all I/O read and write operations are
236 If 8-bit I/O port operations are not supported, then ASSERT().
238 @param Port The I/O port to read.
239 @param Count The number of times to read I/O port.
240 @param Buffer The buffer to store the read data into.
255 Writes a block of memory into an 8-bit I/O port fifo.
257 Writes the 8-bit I/O fifo port specified by Port.
258 The port is written Count times, and the write data is
259 retrieved from the provided Buffer.
261 This function must guarantee that all I/O write and write operations are
264 If 8-bit I/O port operations are not supported, then ASSERT().
266 @param Port The I/O port to write.
267 @param Count The number of times to write I/O port.
268 @param Buffer The buffer to retrieve the write data from.
283 Reads a 16-bit I/O port fifo into a block of memory.
285 Reads the 16-bit I/O fifo port specified by Port.
286 The port is read Count times, and the read data is
287 stored in the provided Buffer.
289 This function must guarantee that all I/O read and write operations are
292 If 16-bit I/O port operations are not supported, then ASSERT().
294 @param Port The I/O port to read.
295 @param Count The number of times to read I/O port.
296 @param Buffer The buffer to store the read data into.
311 Writes a block of memory into a 16-bit I/O port fifo.
313 Writes the 16-bit I/O fifo port specified by Port.
314 The port is written Count times, and the write data is
315 retrieved from the provided Buffer.
317 This function must guarantee that all I/O write and write operations are
320 If 16-bit I/O port operations are not supported, then ASSERT().
322 @param Port The I/O port to write.
323 @param Count The number of times to write I/O port.
324 @param Buffer The buffer to retrieve the write data from.
339 Reads a 32-bit I/O port fifo into a block of memory.
341 Reads the 32-bit I/O fifo port specified by Port.
342 The port is read Count times, and the read data is
343 stored in the provided Buffer.
345 This function must guarantee that all I/O read and write operations are
348 If 32-bit I/O port operations are not supported, then ASSERT().
350 @param Port The I/O port to read.
351 @param Count The number of times to read I/O port.
352 @param Buffer The buffer to store the read data into.
367 Writes a block of memory into a 32-bit I/O port fifo.
369 Writes the 32-bit I/O fifo port specified by Port.
370 The port is written Count times, and the write data is
371 retrieved from the provided Buffer.
373 This function must guarantee that all I/O write and write operations are
376 If 32-bit I/O port operations are not supported, then ASSERT().
378 @param Port The I/O port to write.
379 @param Count The number of times to write I/O port.
380 @param Buffer The buffer to retrieve the write data from.
395 Reads an 8-bit MMIO register.
397 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
398 returned. This function must guarantee that all MMIO read and write
399 operations are serialized.
401 If 8-bit MMIO register operations are not supported, then ASSERT().
403 @param Address The MMIO register to read.
405 @return The value read.
416 Value
= *(volatile UINT8
*)Address
;
421 Writes an 8-bit MMIO register.
423 Writes the 8-bit MMIO register specified by Address with the value specified
424 by Value and returns Value. This function must guarantee that all MMIO read
425 and write operations are serialized.
427 If 8-bit MMIO register operations are not supported, then ASSERT().
429 @param Address The MMIO register to write.
430 @param Value The value to write to the MMIO register.
440 *(volatile UINT8
*)Address
= Value
;
445 Reads a 16-bit MMIO register.
447 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
448 returned. This function must guarantee that all MMIO read and write
449 operations are serialized.
451 If 16-bit MMIO register operations are not supported, then ASSERT().
453 @param Address The MMIO register to read.
455 @return The value read.
466 ASSERT ((Address
& 1) == 0);
467 Value
= *(volatile UINT16
*)Address
;
472 Writes a 16-bit MMIO register.
474 Writes the 16-bit MMIO register specified by Address with the value specified
475 by Value and returns Value. This function must guarantee that all MMIO read
476 and write operations are serialized.
478 If 16-bit MMIO register operations are not supported, then ASSERT().
480 @param Address The MMIO register to write.
481 @param Value The value to write to the MMIO register.
491 ASSERT ((Address
& 1) == 0);
492 *(volatile UINT16
*)Address
= Value
;
497 Reads a 32-bit MMIO register.
499 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
500 returned. This function must guarantee that all MMIO read and write
501 operations are serialized.
503 If 32-bit MMIO register operations are not supported, then ASSERT().
505 @param Address The MMIO register to read.
507 @return The value read.
518 ASSERT ((Address
& 3) == 0);
519 Value
= *(volatile UINT32
*)Address
;
524 Writes a 32-bit MMIO register.
526 Writes the 32-bit MMIO register specified by Address with the value specified
527 by Value and returns Value. This function must guarantee that all MMIO read
528 and write operations are serialized.
530 If 32-bit MMIO register operations are not supported, then ASSERT().
532 @param Address The MMIO register to write.
533 @param Value The value to write to the MMIO register.
543 ASSERT ((Address
& 3) == 0);
544 *(volatile UINT32
*)Address
= Value
;
549 Reads a 64-bit MMIO register.
551 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
552 returned. This function must guarantee that all MMIO read and write
553 operations are serialized.
555 If 64-bit MMIO register operations are not supported, then ASSERT().
557 @param Address The MMIO register to read.
559 @return The value read.
570 ASSERT ((Address
& 7) == 0);
571 Value
= *(volatile UINT64
*)Address
;
576 Writes a 64-bit MMIO register.
578 Writes the 64-bit MMIO register specified by Address with the value specified
579 by Value and returns Value. This function must guarantee that all MMIO read
580 and write operations are serialized.
582 If 64-bit MMIO register operations are not supported, then ASSERT().
584 @param Address The MMIO register to write.
585 @param Value The value to write to the MMIO register.
595 ASSERT ((Address
& 7) == 0);
596 *(volatile UINT64
*)Address
= Value
;