]>
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 - 2008, Intel Corporation. All rights reserved.<BR>
6 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.
16 #include "BaseIoLibIntrinsicInternal.h"
19 Reads an 8-bit I/O port.
21 Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
22 This function must guarantee that all I/O read and write operations are
25 If 8-bit I/O port operations are not supported, then ASSERT().
27 @param Port The I/O port to read.
29 @return The value read.
41 mov dx
, word ptr
[Port
]
50 Writes an 8-bit I/O port.
52 Writes the 8-bit I/O port specified by Port with the value specified by Value
53 and returns Value. This function must guarantee that all I/O read and write
54 operations are serialized.
56 If 8-bit I/O port operations are not supported, then ASSERT().
58 @param Port The I/O port to write.
59 @param Value The value to write to the I/O port.
61 @return The value written the I/O port.
72 mov al
, byte ptr
[Value
]
73 mov dx
, word ptr
[Port
]
80 Reads a 16-bit I/O port.
82 Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
83 This function must guarantee that all I/O read and write operations are
86 If 16-bit I/O port operations are not supported, then ASSERT().
87 If Port is not aligned on a 16-bit boundary, then ASSERT().
89 @param Port The I/O port to read.
91 @return The value read.
102 ASSERT ((Port
& 1) == 0);
105 mov dx
, word ptr
[Port
]
107 mov word ptr
[Data
], ax
114 Writes a 16-bit I/O port.
116 Writes the 16-bit I/O port specified by Port with the value specified by Value
117 and returns Value. This function must guarantee that all I/O read and write
118 operations are serialized.
120 If 16-bit I/O port operations are not supported, then ASSERT().
121 If Port is not aligned on a 16-bit boundary, then ASSERT().
123 @param Port The I/O port to write.
124 @param Value The value to write to the I/O port.
126 @return The value written the I/O port.
136 ASSERT ((Port
& 1) == 0);
139 mov ax
, word ptr
[Value
]
140 mov dx
, word ptr
[Port
]
148 Reads a 32-bit I/O port.
150 Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
151 This function must guarantee that all I/O read and write operations are
154 If 32-bit I/O port operations are not supported, then ASSERT().
155 If Port is not aligned on a 32-bit boundary, then ASSERT().
157 @param Port The I/O port to read.
159 @return The value read.
170 ASSERT ((Port
& 3) == 0);
173 mov dx
, word ptr
[Port
]
175 mov dword ptr
[Data
], eax
182 Writes a 32-bit I/O port.
184 Writes the 32-bit I/O port specified by Port with the value specified by Value
185 and returns Value. This function must guarantee that all I/O read and write
186 operations are serialized.
188 If 32-bit I/O port operations are not supported, then ASSERT().
189 If Port is not aligned on a 32-bit boundary, then ASSERT().
191 @param Port The I/O port to write.
192 @param Value The value to write to the I/O port.
194 @return The value written the I/O port.
204 ASSERT ((Port
& 3) == 0);
207 mov eax
, dword ptr
[Value
]
208 mov dx
, word ptr
[Port
]