]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c
ArmVirtPkg/ArmVirtQemu: Install BGRT ACPI table
[mirror_edk2.git] / MdePkg / Library / BaseIoLibIntrinsic / IoLibArm.c
CommitLineData
ebd04fc2 1/** @file\r
2 I/O Library for ARM. \r
3\r
4dd6f840
HT
4 Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
5 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
6 This program and the accompanying materials\r
ebd04fc2 7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
35a17154 9 http://opensource.org/licenses/bsd-license.php.\r
ebd04fc2 10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16\r
17//\r
18// Include common header file for this module.\r
19//\r
20#include "BaseIoLibIntrinsicInternal.h"\r
21\r
22/**\r
23 Reads an 8-bit I/O port.\r
24\r
25 Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.\r
26 This function must guarantee that all I/O read and write operations are\r
27 serialized.\r
28\r
29 If 8-bit I/O port operations are not supported, then ASSERT().\r
30\r
31 @param Port The I/O port to read.\r
32\r
33 @return The value read.\r
34\r
35**/\r
36UINT8\r
37EFIAPI\r
38IoRead8 (\r
39 IN UINTN Port\r
40 )\r
41{\r
42 ASSERT (FALSE);\r
43 return 0;\r
44}\r
45\r
46/**\r
47 Writes an 8-bit I/O port.\r
48\r
49 Writes the 8-bit I/O port specified by Port with the value specified by Value\r
50 and returns Value. This function must guarantee that all I/O read and write\r
51 operations are serialized.\r
52\r
53 If 8-bit I/O port operations are not supported, then ASSERT().\r
54\r
55 @param Port The I/O port to write.\r
56 @param Value The value to write to the I/O port.\r
57\r
58 @return The value written the I/O port.\r
59\r
60**/\r
61UINT8\r
62EFIAPI\r
63IoWrite8 (\r
64 IN UINTN Port,\r
65 IN UINT8 Value\r
66 )\r
67{\r
68 ASSERT (FALSE);\r
69 return Value;\r
70}\r
71\r
72/**\r
73 Reads a 16-bit I/O port.\r
74\r
75 Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.\r
76 This function must guarantee that all I/O read and write operations are\r
77 serialized.\r
78\r
79 If 16-bit I/O port operations are not supported, then ASSERT().\r
80\r
81 @param Port The I/O port to read.\r
82\r
83 @return The value read.\r
84\r
85**/\r
86UINT16\r
87EFIAPI\r
88IoRead16 (\r
89 IN UINTN Port\r
90 )\r
91{\r
92 ASSERT (FALSE);\r
93 return 0;\r
94}\r
95\r
96/**\r
97 Writes a 16-bit I/O port.\r
98\r
99 Writes the 16-bit I/O port specified by Port with the value specified by Value\r
100 and returns Value. This function must guarantee that all I/O read and write\r
101 operations are serialized.\r
102\r
103 If 16-bit I/O port operations are not supported, then ASSERT().\r
104\r
105 @param Port The I/O port to write.\r
106 @param Value The value to write to the I/O port.\r
107\r
108 @return The value written the I/O port.\r
109\r
110**/\r
111UINT16\r
112EFIAPI\r
113IoWrite16 (\r
114 IN UINTN Port,\r
115 IN UINT16 Value\r
116 )\r
117{\r
118 ASSERT (FALSE);\r
119 return Value;\r
120}\r
121\r
122/**\r
123 Reads a 32-bit I/O port.\r
124\r
125 Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.\r
126 This function must guarantee that all I/O read and write operations are\r
127 serialized.\r
128\r
129 If 32-bit I/O port operations are not supported, then ASSERT().\r
130\r
131 @param Port The I/O port to read.\r
132\r
133 @return The value read.\r
134\r
135**/\r
136UINT32\r
137EFIAPI\r
138IoRead32 (\r
139 IN UINTN Port\r
140 )\r
141{\r
142 ASSERT (FALSE);\r
143 return 0;\r
144}\r
145\r
146/**\r
147 Writes a 32-bit I/O port.\r
148\r
149 Writes the 32-bit I/O port specified by Port with the value specified by Value\r
150 and returns Value. This function must guarantee that all I/O read and write\r
151 operations are serialized.\r
152\r
153 If 32-bit I/O port operations are not supported, then ASSERT().\r
154\r
155 @param Port The I/O port to write.\r
156 @param Value The value to write to the I/O port.\r
157\r
158 @return The value written the I/O port.\r
159\r
160**/\r
161UINT32\r
162EFIAPI\r
163IoWrite32 (\r
164 IN UINTN Port,\r
165 IN UINT32 Value\r
166 )\r
167{\r
168 ASSERT (FALSE);\r
169 return Value;\r
170}\r
171\r
172/**\r
173 Reads a 64-bit I/O port.\r
174\r
175 Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.\r
176 This function must guarantee that all I/O read and write operations are\r
177 serialized.\r
178\r
179 If 64-bit I/O port operations are not supported, then ASSERT().\r
180 If Port is not aligned on a 64-bit boundary, then ASSERT().\r
181\r
182 @param Port The I/O port to read.\r
183\r
184 @return The value read.\r
185\r
186**/\r
187UINT64\r
188EFIAPI\r
189IoRead64 (\r
190 IN UINTN Port\r
191 )\r
192{\r
193 ASSERT (FALSE);\r
194 return 0;\r
195}\r
196\r
197/**\r
198 Writes a 64-bit I/O port.\r
199\r
200 Writes the 64-bit I/O port specified by Port with the value specified by Value\r
201 and returns Value. This function must guarantee that all I/O read and write\r
202 operations are serialized.\r
203\r
204 If 64-bit I/O port operations are not supported, then ASSERT().\r
205 If Port is not aligned on a 64-bit boundary, then ASSERT().\r
206\r
207 @param Port The I/O port to write.\r
208 @param Value The value to write to the I/O port.\r
209\r
35a17154 210 @return The value written to the I/O port.\r
ebd04fc2 211\r
212**/\r
213UINT64\r
214EFIAPI\r
215IoWrite64 (\r
216 IN UINTN Port,\r
217 IN UINT64 Value\r
218 )\r
219{\r
220 ASSERT (FALSE);\r
221 return 0;\r
222}\r
223\r
224\r
225/**\r
226 Reads an 8-bit MMIO register.\r
227\r
228 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is\r
229 returned. This function must guarantee that all MMIO read and write\r
230 operations are serialized.\r
231\r
232 If 8-bit MMIO register operations are not supported, then ASSERT().\r
233\r
234 @param Address The MMIO register to read.\r
235\r
236 @return The value read.\r
237\r
238**/\r
239UINT8\r
240EFIAPI\r
241MmioRead8 (\r
242 IN UINTN Address\r
243 )\r
244{\r
245 UINT8 Value;\r
246\r
247 Value = *(volatile UINT8*)Address;\r
248 return Value;\r
249}\r
250\r
251/**\r
252 Writes an 8-bit MMIO register.\r
253\r
254 Writes the 8-bit MMIO register specified by Address with the value specified\r
255 by Value and returns Value. This function must guarantee that all MMIO read\r
256 and write operations are serialized.\r
257\r
258 If 8-bit MMIO register operations are not supported, then ASSERT().\r
259\r
260 @param Address The MMIO register to write.\r
261 @param Value The value to write to the MMIO register.\r
262\r
263**/\r
264UINT8\r
265EFIAPI\r
266MmioWrite8 (\r
267 IN UINTN Address,\r
268 IN UINT8 Value\r
269 )\r
270{\r
271 *(volatile UINT8*)Address = Value;\r
272 return Value;\r
273}\r
274\r
275/**\r
276 Reads a 16-bit MMIO register.\r
277\r
278 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is\r
279 returned. This function must guarantee that all MMIO read and write\r
280 operations are serialized.\r
281\r
282 If 16-bit MMIO register operations are not supported, then ASSERT().\r
283\r
284 @param Address The MMIO register to read.\r
285\r
286 @return The value read.\r
287\r
288**/\r
289UINT16\r
290EFIAPI\r
291MmioRead16 (\r
292 IN UINTN Address\r
293 )\r
294{\r
295 UINT16 Value;\r
296\r
297 ASSERT ((Address & 1) == 0);\r
298 Value = *(volatile UINT16*)Address;\r
299 return Value;\r
300}\r
301\r
302/**\r
303 Writes a 16-bit MMIO register.\r
304\r
305 Writes the 16-bit MMIO register specified by Address with the value specified\r
306 by Value and returns Value. This function must guarantee that all MMIO read\r
307 and write operations are serialized.\r
308\r
309 If 16-bit MMIO register operations are not supported, then ASSERT().\r
310\r
311 @param Address The MMIO register to write.\r
312 @param Value The value to write to the MMIO register.\r
313\r
314**/\r
315UINT16\r
316EFIAPI\r
317MmioWrite16 (\r
318 IN UINTN Address,\r
319 IN UINT16 Value\r
320 )\r
321{\r
322 ASSERT ((Address & 1) == 0);\r
323 *(volatile UINT16*)Address = Value;\r
324 return Value;\r
325}\r
326\r
327/**\r
328 Reads a 32-bit MMIO register.\r
329\r
330 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is\r
331 returned. This function must guarantee that all MMIO read and write\r
332 operations are serialized.\r
333\r
334 If 32-bit MMIO register operations are not supported, then ASSERT().\r
335\r
336 @param Address The MMIO register to read.\r
337\r
338 @return The value read.\r
339\r
340**/\r
341UINT32\r
342EFIAPI\r
343MmioRead32 (\r
344 IN UINTN Address\r
345 )\r
346{\r
347 UINT32 Value;\r
348\r
349 ASSERT ((Address & 3) == 0);\r
350 Value = *(volatile UINT32*)Address;\r
351 return Value;\r
352}\r
353\r
354/**\r
355 Writes a 32-bit MMIO register.\r
356\r
357 Writes the 32-bit MMIO register specified by Address with the value specified\r
358 by Value and returns Value. This function must guarantee that all MMIO read\r
359 and write operations are serialized.\r
360\r
361 If 32-bit MMIO register operations are not supported, then ASSERT().\r
362\r
363 @param Address The MMIO register to write.\r
364 @param Value The value to write to the MMIO register.\r
365\r
366**/\r
367UINT32\r
368EFIAPI\r
369MmioWrite32 (\r
370 IN UINTN Address,\r
371 IN UINT32 Value\r
372 )\r
373{\r
374 ASSERT ((Address & 3) == 0);\r
375 *(volatile UINT32*)Address = Value;\r
376 return Value;\r
377}\r
378\r
379/**\r
380 Reads a 64-bit MMIO register.\r
381\r
382 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is\r
383 returned. This function must guarantee that all MMIO read and write\r
384 operations are serialized.\r
385\r
386 If 64-bit MMIO register operations are not supported, then ASSERT().\r
387\r
388 @param Address The MMIO register to read.\r
389\r
390 @return The value read.\r
391\r
392**/\r
393UINT64\r
394EFIAPI\r
395MmioRead64 (\r
396 IN UINTN Address\r
397 )\r
398{\r
399 UINT64 Value;\r
400\r
401 ASSERT ((Address & 7) == 0);\r
402 Value = *(volatile UINT64*)Address;\r
403 return Value;\r
404}\r
405\r
406/**\r
407 Writes a 64-bit MMIO register.\r
408\r
409 Writes the 64-bit MMIO register specified by Address with the value specified\r
410 by Value and returns Value. This function must guarantee that all MMIO read\r
411 and write operations are serialized.\r
412\r
413 If 64-bit MMIO register operations are not supported, then ASSERT().\r
414\r
415 @param Address The MMIO register to write.\r
416 @param Value The value to write to the MMIO register.\r
417\r
418**/\r
419UINT64\r
420EFIAPI\r
421MmioWrite64 (\r
422 IN UINTN Address,\r
423 IN UINT64 Value\r
424 )\r
425{\r
426 ASSERT ((Address & 7) == 0);\r
427 *(volatile UINT64*)Address = Value;\r
428 return Value;\r
429}\r
430\r