]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseIoLibIntrinsic/IoLib.c
2 Common I/O Library routines.
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include "BaseIoLibIntrinsicInternal.h"
12 Reads a 64-bit I/O port.
14 Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
15 This function must guarantee that all I/O read and write operations are
18 If 64-bit I/O port operations are not supported, then ASSERT().
19 If Port is not aligned on a 64-bit boundary, then ASSERT().
21 @param Port The I/O port to read.
23 @return The value read.
37 Writes a 64-bit I/O port.
39 Writes the 64-bit I/O port specified by Port with the value specified by Value
40 and returns Value. This function must guarantee that all I/O read and write
41 operations are serialized.
43 If 64-bit I/O port operations are not supported, then ASSERT().
44 If Port is not aligned on a 64-bit boundary, then ASSERT().
46 @param Port The I/O port to write.
47 @param Value The value to write to the I/O port.
49 @return The value written the I/O port.
65 Reads an 8-bit MMIO register.
67 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
68 returned. This function must guarantee that all MMIO read and write
69 operations are serialized.
71 If 8-bit MMIO register operations are not supported, then ASSERT().
73 @param Address The MMIO register to read.
75 @return The value read.
87 Value
= *(volatile UINT8
*)Address
;
94 Writes an 8-bit MMIO register.
96 Writes the 8-bit MMIO register specified by Address with the value specified
97 by Value and returns Value. This function must guarantee that all MMIO read
98 and write operations are serialized.
100 If 8-bit MMIO register operations are not supported, then ASSERT().
102 @param Address The MMIO register to write.
103 @param Value The value to write to the MMIO register.
116 *(volatile UINT8
*)Address
= Value
;
123 Reads a 16-bit MMIO register.
125 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
126 returned. This function must guarantee that all MMIO read and write
127 operations are serialized.
129 If 16-bit MMIO register operations are not supported, then ASSERT().
130 If Address is not aligned on a 16-bit boundary, then ASSERT().
132 @param Address The MMIO register to read.
134 @return The value read.
145 ASSERT ((Address
& 1) == 0);
148 Value
= *(volatile UINT16
*)Address
;
155 Writes a 16-bit MMIO register.
157 Writes the 16-bit MMIO register specified by Address with the value specified
158 by Value and returns Value. This function must guarantee that all MMIO read
159 and write operations are serialized.
161 If 16-bit MMIO register operations are not supported, then ASSERT().
162 If Address is not aligned on a 16-bit boundary, then ASSERT().
164 @param Address The MMIO register to write.
165 @param Value The value to write to the MMIO register.
177 ASSERT ((Address
& 1) == 0);
180 *(volatile UINT16
*)Address
= Value
;
187 Reads a 32-bit MMIO register.
189 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
190 returned. This function must guarantee that all MMIO read and write
191 operations are serialized.
193 If 32-bit MMIO register operations are not supported, then ASSERT().
194 If Address is not aligned on a 32-bit boundary, then ASSERT().
196 @param Address The MMIO register to read.
198 @return The value read.
209 ASSERT ((Address
& 3) == 0);
212 Value
= *(volatile UINT32
*)Address
;
219 Writes a 32-bit MMIO register.
221 Writes the 32-bit MMIO register specified by Address with the value specified
222 by Value and returns Value. This function must guarantee that all MMIO read
223 and write operations are serialized.
225 If 32-bit MMIO register operations are not supported, then ASSERT().
226 If Address is not aligned on a 32-bit boundary, then ASSERT().
228 @param Address The MMIO register to write.
229 @param Value The value to write to the MMIO register.
241 ASSERT ((Address
& 3) == 0);
244 *(volatile UINT32
*)Address
= Value
;
251 Reads a 64-bit MMIO register.
253 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
254 returned. This function must guarantee that all MMIO read and write
255 operations are serialized.
257 If 64-bit MMIO register operations are not supported, then ASSERT().
258 If Address is not aligned on a 64-bit boundary, then ASSERT().
260 @param Address The MMIO register to read.
262 @return The value read.
273 ASSERT ((Address
& 7) == 0);
276 Value
= *(volatile UINT64
*)Address
;
283 Writes a 64-bit MMIO register.
285 Writes the 64-bit MMIO register specified by Address with the value specified
286 by Value and returns Value. This function must guarantee that all MMIO read
287 and write operations are serialized.
289 If 64-bit MMIO register operations are not supported, then ASSERT().
290 If Address is not aligned on a 64-bit boundary, then ASSERT().
292 @param Address The MMIO register to write.
293 @param Value The value to write to the MMIO register.
303 ASSERT ((Address
& 7) == 0);
306 *(volatile UINT64
*)Address
= Value
;