]>
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 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include "BaseIoLibIntrinsicInternal.h"
13 Reads an 8-bit I/O port.
15 Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
16 This function must guarantee that all I/O read and write operations are
19 If 8-bit I/O port operations are not supported, then ASSERT().
21 @param Port The I/O port to read.
23 @return The value read.
35 mov dx
, word ptr
[Port
]
44 Writes an 8-bit I/O port.
46 Writes the 8-bit I/O port specified by Port with the value specified by Value
47 and returns Value. This function must guarantee that all I/O read and write
48 operations are serialized.
50 If 8-bit I/O port operations are not supported, 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.
66 mov al
, byte ptr
[Value
]
67 mov dx
, word ptr
[Port
]
74 Reads a 16-bit I/O port.
76 Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
77 This function must guarantee that all I/O read and write operations are
80 If 16-bit I/O port operations are not supported, then ASSERT().
81 If Port is not aligned on a 16-bit boundary, then ASSERT().
83 @param Port The I/O port to read.
85 @return The value read.
96 ASSERT ((Port
& 1) == 0);
99 mov dx
, word ptr
[Port
]
101 mov word ptr
[Data
], ax
108 Writes a 16-bit I/O port.
110 Writes the 16-bit I/O port specified by Port with the value specified by Value
111 and returns Value. This function must guarantee that all I/O read and write
112 operations are serialized.
114 If 16-bit I/O port operations are not supported, then ASSERT().
115 If Port is not aligned on a 16-bit boundary, then ASSERT().
117 @param Port The I/O port to write.
118 @param Value The value to write to the I/O port.
120 @return The value written the I/O port.
130 ASSERT ((Port
& 1) == 0);
133 mov ax
, word ptr
[Value
]
134 mov dx
, word ptr
[Port
]
142 Reads a 32-bit I/O port.
144 Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
145 This function must guarantee that all I/O read and write operations are
148 If 32-bit I/O port operations are not supported, then ASSERT().
149 If Port is not aligned on a 32-bit boundary, then ASSERT().
151 @param Port The I/O port to read.
153 @return The value read.
164 ASSERT ((Port
& 3) == 0);
167 mov dx
, word ptr
[Port
]
169 mov dword ptr
[Data
], eax
176 Writes a 32-bit I/O port.
178 Writes the 32-bit I/O port specified by Port with the value specified by Value
179 and returns Value. This function must guarantee that all I/O read and write
180 operations are serialized.
182 If 32-bit I/O port operations are not supported, then ASSERT().
183 If Port is not aligned on a 32-bit boundary, then ASSERT().
185 @param Port The I/O port to write.
186 @param Value The value to write to the I/O port.
188 @return The value written the I/O port.
198 ASSERT ((Port
& 3) == 0);
201 mov eax
, dword ptr
[Value
]
202 mov dx
, word ptr
[Port
]