]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseIoLibIntrinsic/IoLib.c
2 Common I/O Library routines.
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #include "BaseIoLibIntrinsicInternal.h"
18 Reads a 64-bit I/O port.
20 Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
21 This function must guarantee that all I/O read and write operations are
24 If 64-bit I/O port operations are not supported, then ASSERT().
25 If Port is not aligned on a 64-bit boundary, then ASSERT().
27 @param Port The I/O port to read.
29 @return The value read.
43 Writes a 64-bit I/O port.
45 Writes the 64-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 64-bit I/O port operations are not supported, then ASSERT().
50 If Port is not aligned on a 64-bit boundary, then ASSERT().
52 @param Port The I/O port to write.
53 @param Value The value to write to the I/O port.
55 @return The value written the I/O port.
71 Reads an 8-bit MMIO register.
73 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
74 returned. This function must guarantee that all MMIO read and write
75 operations are serialized.
77 If 8-bit MMIO register operations are not supported, then ASSERT().
79 @param Address The MMIO register to read.
81 @return The value read.
93 Value
= *(volatile UINT8
*)Address
;
100 Writes an 8-bit MMIO register.
102 Writes the 8-bit MMIO register specified by Address with the value specified
103 by Value and returns Value. This function must guarantee that all MMIO read
104 and write operations are serialized.
106 If 8-bit MMIO register operations are not supported, then ASSERT().
108 @param Address The MMIO register to write.
109 @param Value The value to write to the MMIO register.
122 *(volatile UINT8
*)Address
= Value
;
129 Reads a 16-bit MMIO register.
131 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
132 returned. This function must guarantee that all MMIO read and write
133 operations are serialized.
135 If 16-bit MMIO register operations are not supported, then ASSERT().
136 If Address is not aligned on a 16-bit boundary, then ASSERT().
138 @param Address The MMIO register to read.
140 @return The value read.
151 ASSERT ((Address
& 1) == 0);
154 Value
= *(volatile UINT16
*)Address
;
161 Writes a 16-bit MMIO register.
163 Writes the 16-bit MMIO register specified by Address with the value specified
164 by Value and returns Value. This function must guarantee that all MMIO read
165 and write operations are serialized.
167 If 16-bit MMIO register operations are not supported, then ASSERT().
168 If Address is not aligned on a 16-bit boundary, then ASSERT().
170 @param Address The MMIO register to write.
171 @param Value The value to write to the MMIO register.
183 ASSERT ((Address
& 1) == 0);
186 *(volatile UINT16
*)Address
= Value
;
193 Reads a 32-bit MMIO register.
195 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
196 returned. This function must guarantee that all MMIO read and write
197 operations are serialized.
199 If 32-bit MMIO register operations are not supported, then ASSERT().
200 If Address is not aligned on a 32-bit boundary, then ASSERT().
202 @param Address The MMIO register to read.
204 @return The value read.
215 ASSERT ((Address
& 3) == 0);
218 Value
= *(volatile UINT32
*)Address
;
225 Writes a 32-bit MMIO register.
227 Writes the 32-bit MMIO register specified by Address with the value specified
228 by Value and returns Value. This function must guarantee that all MMIO read
229 and write operations are serialized.
231 If 32-bit MMIO register operations are not supported, then ASSERT().
232 If Address is not aligned on a 32-bit boundary, then ASSERT().
234 @param Address The MMIO register to write.
235 @param Value The value to write to the MMIO register.
247 ASSERT ((Address
& 3) == 0);
250 *(volatile UINT32
*)Address
= Value
;
257 Reads a 64-bit MMIO register.
259 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
260 returned. This function must guarantee that all MMIO read and write
261 operations are serialized.
263 If 64-bit MMIO register operations are not supported, then ASSERT().
264 If Address is not aligned on a 64-bit boundary, then ASSERT().
266 @param Address The MMIO register to read.
268 @return The value read.
279 ASSERT ((Address
& 7) == 0);
282 Value
= *(volatile UINT64
*)Address
;
289 Writes a 64-bit MMIO register.
291 Writes the 64-bit MMIO register specified by Address with the value specified
292 by Value and returns Value. This function must guarantee that all MMIO read
293 and write operations are serialized.
295 If 64-bit MMIO register operations are not supported, then ASSERT().
296 If Address is not aligned on a 64-bit boundary, then ASSERT().
298 @param Address The MMIO register to write.
299 @param Value The value to write to the MMIO register.
309 ASSERT ((Address
& 7) == 0);
312 *(volatile UINT64
*)Address
= Value
;