]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseIoLibIntrinsic / IoLibArm.c
... / ...
CommitLineData
1/** @file\r
2 I/O Library for ARM.\r
3\r
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
5 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
6 Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>\r
7\r
8 SPDX-License-Identifier: BSD-2-Clause-Patent\r
9\r
10**/\r
11\r
12\r
13//\r
14// Include common header file for this module.\r
15//\r
16#include "BaseIoLibIntrinsicInternal.h"\r
17\r
18/**\r
19 Reads an 8-bit I/O port.\r
20\r
21 Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.\r
22 This function must guarantee that all I/O read and write operations are\r
23 serialized.\r
24\r
25 If 8-bit I/O port operations are not supported, then ASSERT().\r
26\r
27 @param Port The I/O port to read.\r
28\r
29 @return The value read.\r
30\r
31**/\r
32UINT8\r
33EFIAPI\r
34IoRead8 (\r
35 IN UINTN Port\r
36 )\r
37{\r
38 ASSERT (FALSE);\r
39 return 0;\r
40}\r
41\r
42/**\r
43 Writes an 8-bit I/O port.\r
44\r
45 Writes the 8-bit I/O port specified by Port with the value specified by Value\r
46 and returns Value. This function must guarantee that all I/O read and write\r
47 operations are serialized.\r
48\r
49 If 8-bit I/O port operations are not supported, then ASSERT().\r
50\r
51 @param Port The I/O port to write.\r
52 @param Value The value to write to the I/O port.\r
53\r
54 @return The value written the I/O port.\r
55\r
56**/\r
57UINT8\r
58EFIAPI\r
59IoWrite8 (\r
60 IN UINTN Port,\r
61 IN UINT8 Value\r
62 )\r
63{\r
64 ASSERT (FALSE);\r
65 return Value;\r
66}\r
67\r
68/**\r
69 Reads a 16-bit I/O port.\r
70\r
71 Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.\r
72 This function must guarantee that all I/O read and write operations are\r
73 serialized.\r
74\r
75 If 16-bit I/O port operations are not supported, then ASSERT().\r
76\r
77 @param Port The I/O port to read.\r
78\r
79 @return The value read.\r
80\r
81**/\r
82UINT16\r
83EFIAPI\r
84IoRead16 (\r
85 IN UINTN Port\r
86 )\r
87{\r
88 ASSERT (FALSE);\r
89 return 0;\r
90}\r
91\r
92/**\r
93 Writes a 16-bit I/O port.\r
94\r
95 Writes the 16-bit I/O port specified by Port with the value specified by Value\r
96 and returns Value. This function must guarantee that all I/O read and write\r
97 operations are serialized.\r
98\r
99 If 16-bit I/O port operations are not supported, then ASSERT().\r
100\r
101 @param Port The I/O port to write.\r
102 @param Value The value to write to the I/O port.\r
103\r
104 @return The value written the I/O port.\r
105\r
106**/\r
107UINT16\r
108EFIAPI\r
109IoWrite16 (\r
110 IN UINTN Port,\r
111 IN UINT16 Value\r
112 )\r
113{\r
114 ASSERT (FALSE);\r
115 return Value;\r
116}\r
117\r
118/**\r
119 Reads a 32-bit I/O port.\r
120\r
121 Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.\r
122 This function must guarantee that all I/O read and write operations are\r
123 serialized.\r
124\r
125 If 32-bit I/O port operations are not supported, then ASSERT().\r
126\r
127 @param Port The I/O port to read.\r
128\r
129 @return The value read.\r
130\r
131**/\r
132UINT32\r
133EFIAPI\r
134IoRead32 (\r
135 IN UINTN Port\r
136 )\r
137{\r
138 ASSERT (FALSE);\r
139 return 0;\r
140}\r
141\r
142/**\r
143 Writes a 32-bit I/O port.\r
144\r
145 Writes the 32-bit I/O port specified by Port with the value specified by Value\r
146 and returns Value. This function must guarantee that all I/O read and write\r
147 operations are serialized.\r
148\r
149 If 32-bit I/O port operations are not supported, then ASSERT().\r
150\r
151 @param Port The I/O port to write.\r
152 @param Value The value to write to the I/O port.\r
153\r
154 @return The value written the I/O port.\r
155\r
156**/\r
157UINT32\r
158EFIAPI\r
159IoWrite32 (\r
160 IN UINTN Port,\r
161 IN UINT32 Value\r
162 )\r
163{\r
164 ASSERT (FALSE);\r
165 return Value;\r
166}\r
167\r
168/**\r
169 Reads a 64-bit I/O port.\r
170\r
171 Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.\r
172 This function must guarantee that all I/O read and write operations are\r
173 serialized.\r
174\r
175 If 64-bit I/O port operations are not supported, then ASSERT().\r
176 If Port is not aligned on a 64-bit boundary, then ASSERT().\r
177\r
178 @param Port The I/O port to read.\r
179\r
180 @return The value read.\r
181\r
182**/\r
183UINT64\r
184EFIAPI\r
185IoRead64 (\r
186 IN UINTN Port\r
187 )\r
188{\r
189 ASSERT (FALSE);\r
190 return 0;\r
191}\r
192\r
193/**\r
194 Writes a 64-bit I/O port.\r
195\r
196 Writes the 64-bit I/O port specified by Port with the value specified by Value\r
197 and returns Value. This function must guarantee that all I/O read and write\r
198 operations are serialized.\r
199\r
200 If 64-bit I/O port operations are not supported, then ASSERT().\r
201 If Port is not aligned on a 64-bit boundary, then ASSERT().\r
202\r
203 @param Port The I/O port to write.\r
204 @param Value The value to write to the I/O port.\r
205\r
206 @return The value written to the I/O port.\r
207\r
208**/\r
209UINT64\r
210EFIAPI\r
211IoWrite64 (\r
212 IN UINTN Port,\r
213 IN UINT64 Value\r
214 )\r
215{\r
216 ASSERT (FALSE);\r
217 return 0;\r
218}\r
219\r
220/**\r
221 Reads an 8-bit I/O port fifo into a block of memory.\r
222\r
223 Reads the 8-bit I/O fifo port specified by Port.\r
224 The port is read Count times, and the read data is\r
225 stored in the provided Buffer.\r
226\r
227 This function must guarantee that all I/O read and write operations are\r
228 serialized.\r
229\r
230 If 8-bit I/O port operations are not supported, then ASSERT().\r
231\r
232 @param Port The I/O port to read.\r
233 @param Count The number of times to read I/O port.\r
234 @param Buffer The buffer to store the read data into.\r
235\r
236**/\r
237VOID\r
238EFIAPI\r
239IoReadFifo8 (\r
240 IN UINTN Port,\r
241 IN UINTN Count,\r
242 OUT VOID *Buffer\r
243 )\r
244{\r
245 ASSERT (FALSE);\r
246}\r
247\r
248/**\r
249 Writes a block of memory into an 8-bit I/O port fifo.\r
250\r
251 Writes the 8-bit I/O fifo port specified by Port.\r
252 The port is written Count times, and the write data is\r
253 retrieved from the provided Buffer.\r
254\r
255 This function must guarantee that all I/O write and write operations are\r
256 serialized.\r
257\r
258 If 8-bit I/O port operations are not supported, then ASSERT().\r
259\r
260 @param Port The I/O port to write.\r
261 @param Count The number of times to write I/O port.\r
262 @param Buffer The buffer to retrieve the write data from.\r
263\r
264**/\r
265VOID\r
266EFIAPI\r
267IoWriteFifo8 (\r
268 IN UINTN Port,\r
269 IN UINTN Count,\r
270 IN VOID *Buffer\r
271 )\r
272{\r
273 ASSERT (FALSE);\r
274}\r
275\r
276/**\r
277 Reads a 16-bit I/O port fifo into a block of memory.\r
278\r
279 Reads the 16-bit I/O fifo port specified by Port.\r
280 The port is read Count times, and the read data is\r
281 stored in the provided Buffer.\r
282\r
283 This function must guarantee that all I/O read and write operations are\r
284 serialized.\r
285\r
286 If 16-bit I/O port operations are not supported, then ASSERT().\r
287\r
288 @param Port The I/O port to read.\r
289 @param Count The number of times to read I/O port.\r
290 @param Buffer The buffer to store the read data into.\r
291\r
292**/\r
293VOID\r
294EFIAPI\r
295IoReadFifo16 (\r
296 IN UINTN Port,\r
297 IN UINTN Count,\r
298 OUT VOID *Buffer\r
299 )\r
300{\r
301 ASSERT (FALSE);\r
302}\r
303\r
304/**\r
305 Writes a block of memory into a 16-bit I/O port fifo.\r
306\r
307 Writes the 16-bit I/O fifo port specified by Port.\r
308 The port is written Count times, and the write data is\r
309 retrieved from the provided Buffer.\r
310\r
311 This function must guarantee that all I/O write and write operations are\r
312 serialized.\r
313\r
314 If 16-bit I/O port operations are not supported, then ASSERT().\r
315\r
316 @param Port The I/O port to write.\r
317 @param Count The number of times to write I/O port.\r
318 @param Buffer The buffer to retrieve the write data from.\r
319\r
320**/\r
321VOID\r
322EFIAPI\r
323IoWriteFifo16 (\r
324 IN UINTN Port,\r
325 IN UINTN Count,\r
326 IN VOID *Buffer\r
327 )\r
328{\r
329 ASSERT (FALSE);\r
330}\r
331\r
332/**\r
333 Reads a 32-bit I/O port fifo into a block of memory.\r
334\r
335 Reads the 32-bit I/O fifo port specified by Port.\r
336 The port is read Count times, and the read data is\r
337 stored in the provided Buffer.\r
338\r
339 This function must guarantee that all I/O read and write operations are\r
340 serialized.\r
341\r
342 If 32-bit I/O port operations are not supported, then ASSERT().\r
343\r
344 @param Port The I/O port to read.\r
345 @param Count The number of times to read I/O port.\r
346 @param Buffer The buffer to store the read data into.\r
347\r
348**/\r
349VOID\r
350EFIAPI\r
351IoReadFifo32 (\r
352 IN UINTN Port,\r
353 IN UINTN Count,\r
354 OUT VOID *Buffer\r
355 )\r
356{\r
357 ASSERT (FALSE);\r
358}\r
359\r
360/**\r
361 Writes a block of memory into a 32-bit I/O port fifo.\r
362\r
363 Writes the 32-bit I/O fifo port specified by Port.\r
364 The port is written Count times, and the write data is\r
365 retrieved from the provided Buffer.\r
366\r
367 This function must guarantee that all I/O write and write operations are\r
368 serialized.\r
369\r
370 If 32-bit I/O port operations are not supported, then ASSERT().\r
371\r
372 @param Port The I/O port to write.\r
373 @param Count The number of times to write I/O port.\r
374 @param Buffer The buffer to retrieve the write data from.\r
375\r
376**/\r
377VOID\r
378EFIAPI\r
379IoWriteFifo32 (\r
380 IN UINTN Port,\r
381 IN UINTN Count,\r
382 IN VOID *Buffer\r
383 )\r
384{\r
385 ASSERT (FALSE);\r
386}\r
387\r
388/**\r
389 Reads an 8-bit MMIO register.\r
390\r
391 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is\r
392 returned. This function must guarantee that all MMIO read and write\r
393 operations are serialized.\r
394\r
395 If 8-bit MMIO register operations are not supported, then ASSERT().\r
396\r
397 @param Address The MMIO register to read.\r
398\r
399 @return The value read.\r
400\r
401**/\r
402UINT8\r
403EFIAPI\r
404MmioRead8 (\r
405 IN UINTN Address\r
406 )\r
407{\r
408 UINT8 Value;\r
409\r
410 Value = *(volatile UINT8*)Address;\r
411 return Value;\r
412}\r
413\r
414/**\r
415 Writes an 8-bit MMIO register.\r
416\r
417 Writes the 8-bit MMIO register specified by Address with the value specified\r
418 by Value and returns Value. This function must guarantee that all MMIO read\r
419 and write operations are serialized.\r
420\r
421 If 8-bit MMIO register operations are not supported, then ASSERT().\r
422\r
423 @param Address The MMIO register to write.\r
424 @param Value The value to write to the MMIO register.\r
425\r
426**/\r
427UINT8\r
428EFIAPI\r
429MmioWrite8 (\r
430 IN UINTN Address,\r
431 IN UINT8 Value\r
432 )\r
433{\r
434 *(volatile UINT8*)Address = Value;\r
435 return Value;\r
436}\r
437\r
438/**\r
439 Reads a 16-bit MMIO register.\r
440\r
441 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is\r
442 returned. This function must guarantee that all MMIO read and write\r
443 operations are serialized.\r
444\r
445 If 16-bit MMIO register operations are not supported, then ASSERT().\r
446\r
447 @param Address The MMIO register to read.\r
448\r
449 @return The value read.\r
450\r
451**/\r
452UINT16\r
453EFIAPI\r
454MmioRead16 (\r
455 IN UINTN Address\r
456 )\r
457{\r
458 UINT16 Value;\r
459\r
460 ASSERT ((Address & 1) == 0);\r
461 Value = *(volatile UINT16*)Address;\r
462 return Value;\r
463}\r
464\r
465/**\r
466 Writes a 16-bit MMIO register.\r
467\r
468 Writes the 16-bit MMIO register specified by Address with the value specified\r
469 by Value and returns Value. This function must guarantee that all MMIO read\r
470 and write operations are serialized.\r
471\r
472 If 16-bit MMIO register operations are not supported, then ASSERT().\r
473\r
474 @param Address The MMIO register to write.\r
475 @param Value The value to write to the MMIO register.\r
476\r
477**/\r
478UINT16\r
479EFIAPI\r
480MmioWrite16 (\r
481 IN UINTN Address,\r
482 IN UINT16 Value\r
483 )\r
484{\r
485 ASSERT ((Address & 1) == 0);\r
486 *(volatile UINT16*)Address = Value;\r
487 return Value;\r
488}\r
489\r
490/**\r
491 Reads a 32-bit MMIO register.\r
492\r
493 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is\r
494 returned. This function must guarantee that all MMIO read and write\r
495 operations are serialized.\r
496\r
497 If 32-bit MMIO register operations are not supported, then ASSERT().\r
498\r
499 @param Address The MMIO register to read.\r
500\r
501 @return The value read.\r
502\r
503**/\r
504UINT32\r
505EFIAPI\r
506MmioRead32 (\r
507 IN UINTN Address\r
508 )\r
509{\r
510 UINT32 Value;\r
511\r
512 ASSERT ((Address & 3) == 0);\r
513 Value = *(volatile UINT32*)Address;\r
514 return Value;\r
515}\r
516\r
517/**\r
518 Writes a 32-bit MMIO register.\r
519\r
520 Writes the 32-bit MMIO register specified by Address with the value specified\r
521 by Value and returns Value. This function must guarantee that all MMIO read\r
522 and write operations are serialized.\r
523\r
524 If 32-bit MMIO register operations are not supported, then ASSERT().\r
525\r
526 @param Address The MMIO register to write.\r
527 @param Value The value to write to the MMIO register.\r
528\r
529**/\r
530UINT32\r
531EFIAPI\r
532MmioWrite32 (\r
533 IN UINTN Address,\r
534 IN UINT32 Value\r
535 )\r
536{\r
537 ASSERT ((Address & 3) == 0);\r
538 *(volatile UINT32*)Address = Value;\r
539 return Value;\r
540}\r
541\r
542/**\r
543 Reads a 64-bit MMIO register.\r
544\r
545 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is\r
546 returned. This function must guarantee that all MMIO read and write\r
547 operations are serialized.\r
548\r
549 If 64-bit MMIO register operations are not supported, then ASSERT().\r
550\r
551 @param Address The MMIO register to read.\r
552\r
553 @return The value read.\r
554\r
555**/\r
556UINT64\r
557EFIAPI\r
558MmioRead64 (\r
559 IN UINTN Address\r
560 )\r
561{\r
562 UINT64 Value;\r
563\r
564 ASSERT ((Address & 7) == 0);\r
565 Value = *(volatile UINT64*)Address;\r
566 return Value;\r
567}\r
568\r
569/**\r
570 Writes a 64-bit MMIO register.\r
571\r
572 Writes the 64-bit MMIO register specified by Address with the value specified\r
573 by Value and returns Value. This function must guarantee that all MMIO read\r
574 and write operations are serialized.\r
575\r
576 If 64-bit MMIO register operations are not supported, then ASSERT().\r
577\r
578 @param Address The MMIO register to write.\r
579 @param Value The value to write to the MMIO register.\r
580\r
581**/\r
582UINT64\r
583EFIAPI\r
584MmioWrite64 (\r
585 IN UINTN Address,\r
586 IN UINT64 Value\r
587 )\r
588{\r
589 ASSERT ((Address & 7) == 0);\r
590 *(volatile UINT64*)Address = Value;\r
591 return Value;\r
592}\r
593\r