]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/Io.c
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / RuntimeDxe / EfiRuntimeLib / Io.c
1 /*++
2
3 Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 Io.c
15
16 Abstract:
17
18 Light weight lib functions that wrape IoRead (), IoWrite, MemRead (),
19 and MemWrite ().
20
21 --*/
22
23 #include "Tiano.h"
24 #include "EfiRuntimeLib.h"
25
26 UINT8
27 IoRead8 (
28 IN UINT64 Address
29 )
30 /*++
31
32 Routine Description:
33 Do a one byte IO read
34
35 Arguments:
36 Address - IO address to read
37
38 Returns:
39 Data read
40
41 --*/
42 {
43 UINT8 Buffer;
44
45 EfiIoRead (EfiCpuIoWidthUint8, Address, 1, &Buffer);
46 return Buffer;
47 }
48
49 UINT16
50 IoRead16 (
51 IN UINT64 Address
52 )
53 /*++
54
55 Routine Description:
56 Do a two byte IO read
57
58 Arguments:
59 Address - IO address to read
60
61 Returns:
62 Data read
63
64 --*/
65 {
66 UINT16 Buffer;
67
68 EfiIoRead (EfiCpuIoWidthUint16, Address, 1, &Buffer);
69 return Buffer;
70 }
71
72 UINT32
73 IoRead32 (
74 IN UINT64 Address
75 )
76 /*++
77
78 Routine Description:
79 Do a four byte IO read
80
81 Arguments:
82 Address - IO address to read
83
84 Returns:
85 Data read
86
87 --*/
88 {
89 UINT32 Buffer;
90
91 EfiIoRead (EfiCpuIoWidthUint32, Address, 1, &Buffer);
92 return Buffer;
93 }
94
95 VOID
96 IoWrite8 (
97 IN UINT64 Address,
98 IN UINT8 Data
99 )
100 /*++
101
102 Routine Description:
103 Do a one byte IO write
104
105 Arguments:
106 Address - IO address to write
107 Data - Data to write to Address
108
109 Returns:
110 NONE
111
112 --*/
113 {
114 EfiIoWrite (EfiCpuIoWidthUint8, Address, 1, &Data);
115 }
116
117 VOID
118 IoWrite16 (
119 IN UINT64 Address,
120 IN UINT16 Data
121 )
122 /*++
123
124 Routine Description:
125 Do a two byte IO write
126
127 Arguments:
128 Address - IO address to write
129 Data - Data to write to Address
130
131 Returns:
132 NONE
133
134 --*/
135 {
136 EfiIoWrite (EfiCpuIoWidthUint16, Address, 1, &Data);
137 }
138
139 VOID
140 IoWrite32 (
141 IN UINT64 Address,
142 IN UINT32 Data
143 )
144 /*++
145
146 Routine Description:
147 Do a four byte IO write
148
149 Arguments:
150 Address - IO address to write
151 Data - Data to write to Address
152
153 Returns:
154 NONE
155
156 --*/
157 {
158 EfiIoWrite (EfiCpuIoWidthUint32, Address, 1, &Data);
159 }
160
161 UINT8
162 MemRead8 (
163 IN UINT64 Address
164 )
165 /*++
166
167 Routine Description:
168 Do a one byte Memory mapped IO read
169
170 Arguments:
171 Address - Memory mapped IO address to read
172
173 Returns:
174 Data read
175
176 --*/
177 {
178 UINT8 Buffer;
179
180 EfiMemRead (EfiCpuIoWidthUint8, Address, 1, &Buffer);
181 return Buffer;
182 }
183
184 UINT16
185 MemRead16 (
186 IN UINT64 Address
187 )
188 /*++
189
190 Routine Description:
191 Do a two byte Memory mapped IO read
192
193 Arguments:
194 Address - Memory mapped IO address to read
195
196 Returns:
197 Data read
198
199 --*/
200 {
201 UINT16 Buffer;
202
203 EfiMemRead (EfiCpuIoWidthUint16, Address, 1, &Buffer);
204 return Buffer;
205 }
206
207 UINT32
208 MemRead32 (
209 IN UINT64 Address
210 )
211 /*++
212
213 Routine Description:
214 Do a four byte Memory mapped IO read
215
216 Arguments:
217 Address - Memory mapped IO address to read
218
219 Returns:
220 Data read
221
222 --*/
223 {
224 UINT32 Buffer;
225
226 EfiMemRead (EfiCpuIoWidthUint32, Address, 1, &Buffer);
227 return Buffer;
228 }
229
230 UINT64
231 MemRead64 (
232 IN UINT64 Address
233 )
234 /*++
235
236 Routine Description:
237 Do a eight byte Memory mapped IO read
238
239 Arguments:
240 Address - Memory mapped IO address to read
241
242 Returns:
243 Data read
244
245 --*/
246 {
247 UINT64 Buffer;
248
249 EfiMemRead (EfiCpuIoWidthUint64, Address, 1, &Buffer);
250 return Buffer;
251 }
252
253 VOID
254 MemWrite8 (
255 IN UINT64 Address,
256 IN UINT8 Data
257 )
258 /*++
259
260 Routine Description:
261 Do a one byte Memory mapped IO write
262
263 Arguments:
264 Address - Memory mapped IO address to write
265 Data - Data to write to Address
266
267 Returns:
268 NONE
269
270 --*/
271 {
272 EfiMemWrite (EfiCpuIoWidthUint8, Address, 1, &Data);
273 }
274
275 VOID
276 MemWrite16 (
277 IN UINT64 Address,
278 IN UINT16 Data
279 )
280 /*++
281
282 Routine Description:
283 Do a two byte Memory mapped IO write
284
285 Arguments:
286 Address - Memory mapped IO address to write
287 Data - Data to write to Address
288
289 Returns:
290 NONE
291
292 --*/
293 {
294 EfiMemWrite (EfiCpuIoWidthUint16, Address, 1, &Data);
295 }
296
297 VOID
298 MemWrite32 (
299 IN UINT64 Address,
300 IN UINT32 Data
301 )
302 /*++
303
304 Routine Description:
305 Do a four byte Memory mapped IO write
306
307 Arguments:
308 Address - Memory mapped IO address to write
309 Data - Data to write to Address
310
311 Returns:
312 NONE
313
314 --*/
315 {
316 EfiMemWrite (EfiCpuIoWidthUint32, Address, 1, &Data);
317 }
318
319 VOID
320 MemWrite64 (
321 IN UINT64 Address,
322 IN UINT64 Data
323 )
324 /*++
325
326 Routine Description:
327 Do a eight byte Memory mapped IO write
328
329 Arguments:
330 Address - Memory mapped IO address to write
331 Data - Data to write to Address
332
333 Returns:
334 NONE
335
336 --*/
337 {
338 EfiMemWrite (EfiCpuIoWidthUint64, Address, 1, &Data);
339 }