]>
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 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 // Include common header file for this module.
20 #include "BaseIoLibIntrinsicInternal.h"
23 Reads an 8-bit I/O port.
25 Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
26 This function must guarantee that all I/O read and write operations are
29 If 8-bit I/O port operations are not supported, then ASSERT().
31 @param Port The I/O port to read.
33 @return The value read.
47 Writes an 8-bit I/O port.
49 Writes the 8-bit I/O port specified by Port with the value specified by Value
50 and returns Value. This function must guarantee that all I/O read and write
51 operations are serialized.
53 If 8-bit I/O port operations are not supported, then ASSERT().
55 @param Port The I/O port to write.
56 @param Value The value to write to the I/O port.
58 @return The value written the I/O port.
73 Reads a 16-bit I/O port.
75 Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
76 This function must guarantee that all I/O read and write operations are
79 If 16-bit I/O port operations are not supported, then ASSERT().
81 @param Port The I/O port to read.
83 @return The value read.
97 Writes a 16-bit I/O port.
99 Writes the 16-bit I/O port specified by Port with the value specified by Value
100 and returns Value. This function must guarantee that all I/O read and write
101 operations are serialized.
103 If 16-bit I/O port operations are not supported, then ASSERT().
105 @param Port The I/O port to write.
106 @param Value The value to write to the I/O port.
108 @return The value written the I/O port.
123 Reads a 32-bit I/O port.
125 Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
126 This function must guarantee that all I/O read and write operations are
129 If 32-bit I/O port operations are not supported, then ASSERT().
131 @param Port The I/O port to read.
133 @return The value read.
147 Writes a 32-bit I/O port.
149 Writes the 32-bit I/O port specified by Port with the value specified by Value
150 and returns Value. This function must guarantee that all I/O read and write
151 operations are serialized.
153 If 32-bit I/O port operations are not supported, then ASSERT().
155 @param Port The I/O port to write.
156 @param Value The value to write to the I/O port.
158 @return The value written the I/O port.
173 Reads a 64-bit I/O port.
175 Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
176 This function must guarantee that all I/O read and write operations are
179 If 64-bit I/O port operations are not supported, then ASSERT().
180 If Port is not aligned on a 64-bit boundary, then ASSERT().
182 @param Port The I/O port to read.
184 @return The value read.
198 Writes a 64-bit I/O port.
200 Writes the 64-bit I/O port specified by Port with the value specified by Value
201 and returns Value. This function must guarantee that all I/O read and write
202 operations are serialized.
204 If 64-bit I/O port operations are not supported, then ASSERT().
205 If Port is not aligned on a 64-bit boundary, then ASSERT().
207 @param Port The I/O port to write.
208 @param Value The value to write to the I/O port.
210 @return The value written to the I/O port.
226 Reads an 8-bit MMIO register.
228 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
229 returned. This function must guarantee that all MMIO read and write
230 operations are serialized.
232 If 8-bit MMIO register operations are not supported, then ASSERT().
234 @param Address The MMIO register to read.
236 @return The value read.
247 Value
= *(volatile UINT8
*)Address
;
252 Writes an 8-bit MMIO register.
254 Writes the 8-bit MMIO register specified by Address with the value specified
255 by Value and returns Value. This function must guarantee that all MMIO read
256 and write operations are serialized.
258 If 8-bit MMIO register operations are not supported, then ASSERT().
260 @param Address The MMIO register to write.
261 @param Value The value to write to the MMIO register.
271 *(volatile UINT8
*)Address
= Value
;
276 Reads a 16-bit MMIO register.
278 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
279 returned. This function must guarantee that all MMIO read and write
280 operations are serialized.
282 If 16-bit MMIO register operations are not supported, then ASSERT().
284 @param Address The MMIO register to read.
286 @return The value read.
297 ASSERT ((Address
& 1) == 0);
298 Value
= *(volatile UINT16
*)Address
;
303 Writes a 16-bit MMIO register.
305 Writes the 16-bit MMIO register specified by Address with the value specified
306 by Value and returns Value. This function must guarantee that all MMIO read
307 and write operations are serialized.
309 If 16-bit MMIO register operations are not supported, then ASSERT().
311 @param Address The MMIO register to write.
312 @param Value The value to write to the MMIO register.
322 ASSERT ((Address
& 1) == 0);
323 *(volatile UINT16
*)Address
= Value
;
328 Reads a 32-bit MMIO register.
330 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
331 returned. This function must guarantee that all MMIO read and write
332 operations are serialized.
334 If 32-bit MMIO register operations are not supported, then ASSERT().
336 @param Address The MMIO register to read.
338 @return The value read.
349 ASSERT ((Address
& 3) == 0);
350 Value
= *(volatile UINT32
*)Address
;
355 Writes a 32-bit MMIO register.
357 Writes the 32-bit MMIO register specified by Address with the value specified
358 by Value and returns Value. This function must guarantee that all MMIO read
359 and write operations are serialized.
361 If 32-bit MMIO register operations are not supported, then ASSERT().
363 @param Address The MMIO register to write.
364 @param Value The value to write to the MMIO register.
374 ASSERT ((Address
& 3) == 0);
375 *(volatile UINT32
*)Address
= Value
;
380 Reads a 64-bit MMIO register.
382 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
383 returned. This function must guarantee that all MMIO read and write
384 operations are serialized.
386 If 64-bit MMIO register operations are not supported, then ASSERT().
388 @param Address The MMIO register to read.
390 @return The value read.
401 ASSERT ((Address
& 7) == 0);
402 Value
= *(volatile UINT64
*)Address
;
407 Writes a 64-bit MMIO register.
409 Writes the 64-bit MMIO register specified by Address with the value specified
410 by Value and returns Value. This function must guarantee that all MMIO read
411 and write operations are serialized.
413 If 64-bit MMIO register operations are not supported, then ASSERT().
415 @param Address The MMIO register to write.
416 @param Value The value to write to the MMIO register.
426 ASSERT ((Address
& 7) == 0);
427 *(volatile UINT64
*)Address
= Value
;