2 Common I/O Library routines.
4 Copyright (c) 2006, Intel Corporation<BR>
5 All rights reserved. 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.
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().
26 @param Port The I/O port to read.
28 @return The value read.
42 Writes a 64-bit I/O port.
44 Writes the 64-bit I/O port specified by Port with the value specified by Value
45 and returns Value. This function must guarantee that all I/O read and write
46 operations are serialized.
48 If 64-bit I/O port operations are not supported, then ASSERT().
50 @param Port The I/O port to write.
51 @param Value The value to write to the I/O port.
53 @return The value written the I/O port.
68 Reads an 8-bit MMIO register.
70 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
71 returned. This function must guarantee that all MMIO read and write
72 operations are serialized.
74 If 8-bit MMIO register operations are not supported, then ASSERT().
76 @param Address The MMIO register to read.
78 @return The value read.
87 return *(volatile UINT8
*)Address
;
91 Writes an 8-bit MMIO register.
93 Writes the 8-bit MMIO register specified by Address with the value specified
94 by Value and returns Value. This function must guarantee that all MMIO read
95 and write operations are serialized.
97 If 8-bit MMIO register operations are not supported, then ASSERT().
99 @param Address The MMIO register to write.
100 @param Value The value to write to the MMIO register.
110 return *(volatile UINT8
*)Address
= Value
;
114 Reads a 16-bit MMIO register.
116 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
117 returned. This function must guarantee that all MMIO read and write
118 operations are serialized.
120 If 16-bit MMIO register operations are not supported, then ASSERT().
122 @param Address The MMIO register to read.
124 @return The value read.
133 ASSERT ((Address
& 1) == 0);
134 return *(volatile UINT16
*)Address
;
138 Writes a 16-bit MMIO register.
140 Writes the 16-bit MMIO register specified by Address with the value specified
141 by Value and returns Value. This function must guarantee that all MMIO read
142 and write operations are serialized.
144 If 16-bit MMIO register operations are not supported, then ASSERT().
146 @param Address The MMIO register to write.
147 @param Value The value to write to the MMIO register.
157 ASSERT ((Address
& 1) == 0);
158 return *(volatile UINT16
*)Address
= Value
;
162 Reads a 32-bit MMIO register.
164 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
165 returned. This function must guarantee that all MMIO read and write
166 operations are serialized.
168 If 32-bit MMIO register operations are not supported, then ASSERT().
170 @param Address The MMIO register to read.
172 @return The value read.
181 ASSERT ((Address
& 3) == 0);
182 return *(volatile UINT32
*)Address
;
186 Writes a 32-bit MMIO register.
188 Writes the 32-bit MMIO register specified by Address with the value specified
189 by Value and returns Value. This function must guarantee that all MMIO read
190 and write operations are serialized.
192 If 32-bit MMIO register operations are not supported, then ASSERT().
194 @param Address The MMIO register to write.
195 @param Value The value to write to the MMIO register.
205 ASSERT ((Address
& 3) == 0);
206 return *(volatile UINT32
*)Address
= Value
;
210 Reads a 64-bit MMIO register.
212 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
213 returned. This function must guarantee that all MMIO read and write
214 operations are serialized.
216 If 64-bit MMIO register operations are not supported, then ASSERT().
218 @param Address The MMIO register to read.
220 @return The value read.
229 ASSERT ((Address
& 7) == 0);
230 return *(volatile UINT64
*)Address
;
234 Writes a 64-bit MMIO register.
236 Writes the 64-bit MMIO register specified by Address with the value specified
237 by Value and returns Value. This function must guarantee that all MMIO read
238 and write operations are serialized.
240 If 64-bit MMIO register operations are not supported, then ASSERT().
242 @param Address The MMIO register to write.
243 @param Value The value to write to the MMIO register.
253 ASSERT ((Address
& 7) == 0);
254 return *(volatile UINT64
*)Address
= Value
;