]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseIoLibIntrinsic/IoLibIcc.c
2 I/O Library. This file has compiler specifics for ICC as there
3 is no ANSI C standard for doing IO.
5 Copyright (c) 2006 - 2007, Intel Corporation<BR> All rights
6 reserved. This program and the accompanying materials are
7 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.
17 // Include common header file for this module.
19 #include "BaseIoLibIntrinsicInternal.h"
22 Reads an 8-bit MMIO register.
24 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
25 returned. This function must guarantee that all MMIO read and write
26 operations are serialized.
28 If 8-bit MMIO register operations are not supported, then ASSERT().
30 @param Address The MMIO register to read.
32 @return The value read.
41 return *(volatile UINT8
*)Address
;
45 Writes an 8-bit MMIO register.
47 Writes the 8-bit MMIO register specified by Address with the value specified
48 by Value and returns Value. This function must guarantee that all MMIO read
49 and write operations are serialized.
51 If 8-bit MMIO register operations are not supported, then ASSERT().
53 @param Address The MMIO register to write.
54 @param Value The value to write to the MMIO register.
64 return *(volatile UINT8
*)Address
= Value
;
68 Reads a 16-bit MMIO register.
70 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
71 returned. This function must guarantee that all MMIO read and write
72 operations are serialized.
74 If 16-bit MMIO register operations are not supported, then ASSERT().
76 @param Address The MMIO register to read.
78 @return The value read.
87 ASSERT ((Address
& 1) == 0);
88 return *(volatile UINT16
*)Address
;
92 Writes a 16-bit MMIO register.
94 Writes the 16-bit MMIO register specified by Address with the value specified
95 by Value and returns Value. This function must guarantee that all MMIO read
96 and write operations are serialized.
98 If 16-bit MMIO register operations are not supported, then ASSERT().
100 @param Address The MMIO register to write.
101 @param Value The value to write to the MMIO register.
111 ASSERT ((Address
& 1) == 0);
112 return *(volatile UINT16
*)Address
= Value
;
116 Reads a 32-bit MMIO register.
118 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
119 returned. This function must guarantee that all MMIO read and write
120 operations are serialized.
122 If 32-bit MMIO register operations are not supported, then ASSERT().
124 @param Address The MMIO register to read.
126 @return The value read.
135 ASSERT ((Address
& 3) == 0);
136 return *(volatile UINT32
*)Address
;
140 Writes a 32-bit MMIO register.
142 Writes the 32-bit MMIO register specified by Address with the value specified
143 by Value and returns Value. This function must guarantee that all MMIO read
144 and write operations are serialized.
146 If 32-bit MMIO register operations are not supported, then ASSERT().
148 @param Address The MMIO register to write.
149 @param Value The value to write to the MMIO register.
159 ASSERT ((Address
& 3) == 0);
160 return *(volatile UINT32
*)Address
= Value
;
164 Reads a 64-bit MMIO register.
166 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
167 returned. This function must guarantee that all MMIO read and write
168 operations are serialized.
170 If 64-bit MMIO register operations are not supported, then ASSERT().
172 @param Address The MMIO register to read.
174 @return The value read.
183 ASSERT ((Address
& 7) == 0);
184 return *(volatile UINT64
*)Address
;
188 Writes a 64-bit MMIO register.
190 Writes the 64-bit MMIO register specified by Address with the value specified
191 by Value and returns Value. This function must guarantee that all MMIO read
192 and write operations are serialized.
194 If 64-bit MMIO register operations are not supported, then ASSERT().
196 @param Address The MMIO register to write.
197 @param Value The value to write to the MMIO register.
207 ASSERT ((Address
& 7) == 0);
208 return *(volatile UINT64
*)Address
= Value
;
214 Reads an 8-bit I/O port.
216 Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
217 This function must guarantee that all I/O read and write operations are
220 If 8-bit I/O port operations are not supported, then ASSERT().
222 @param Port The I/O port to read.
224 @return The value read.
236 mov dx
, word ptr
[Port
]
245 Writes an 8-bit I/O port.
247 Writes the 8-bit I/O port specified by Port with the value specified by Value
248 and returns Value. This function must guarantee that all I/O read and write
249 operations are serialized.
251 If 8-bit I/O port operations are not supported, then ASSERT().
253 @param Port The I/O port to write.
254 @param Value The value to write to the I/O port.
256 @return The value written the I/O port.
267 mov al
, byte ptr
[Value
]
268 mov dx
, word ptr
[Port
]
275 Reads a 16-bit I/O port.
277 Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
278 This function must guarantee that all I/O read and write operations are
281 If 16-bit I/O port operations are not supported, then ASSERT().
283 @param Port The I/O port to read.
285 @return The value read.
296 ASSERT ((Port
& 1) == 0);
299 mov dx
, word ptr
[Port
]
301 mov word ptr
[Data
], ax
308 Writes a 16-bit I/O port.
310 Writes the 16-bit I/O port specified by Port with the value specified by Value
311 and returns Value. This function must guarantee that all I/O read and write
312 operations are serialized.
314 If 16-bit I/O port operations are not supported, then ASSERT().
316 @param Port The I/O port to write.
317 @param Value The value to write to the I/O port.
319 @return The value written the I/O port.
329 ASSERT ((Port
& 1) == 0);
332 mov ax
, word ptr
[Value
]
333 mov dx
, word ptr
[Port
]
338 // Never reached return statement.
344 Reads a 32-bit I/O port.
346 Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
347 This function must guarantee that all I/O read and write operations are
350 If 32-bit I/O port operations are not supported, then ASSERT().
352 @param Port The I/O port to read.
354 @return The value read.
365 ASSERT ((Port
& 3) == 0);
368 mov dx
, word ptr
[Port
]
370 mov dword ptr
[Data
], eax
377 Writes a 32-bit I/O port.
379 Writes the 32-bit I/O port specified by Port with the value specified by Value
380 and returns Value. This function must guarantee that all I/O read and write
381 operations are serialized.
383 If 32-bit I/O port operations are not supported, then ASSERT().
385 @param Port The I/O port to write.
386 @param Value The value to write to the I/O port.
388 @return The value written the I/O port.
398 ASSERT ((Port
& 3) == 0);
401 mov eax
, dword ptr
[Value
]
402 mov dx
, word ptr
[Port
]