]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseIoLibIntrinsic/IoLibArmVirt.c
ArmVirtPkg: unify HttpLib resolutions in "ArmVirt.dsc.inc"
[mirror_edk2.git] / MdePkg / Library / BaseIoLibIntrinsic / IoLibArmVirt.c
CommitLineData
4134f2bd
AB
1/** @file\r
2 I/O Library for ARM.\r
3\r
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 Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>\r
7 Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>\r
8\r
9 This program and the accompanying materials are licensed and made available\r
10 under the terms and conditions of the BSD License which accompanies this\r
11 distribution. The full text of the license may be found at\r
12 http://opensource.org/licenses/bsd-license.php.\r
13\r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
16\r
17**/\r
18\r
19#include "BaseIoLibIntrinsicInternal.h"\r
20\r
21/**\r
22 Reads an 8-bit MMIO register.\r
23\r
24 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is\r
25 returned. This function must guarantee that all MMIO read and write\r
26 operations are serialized.\r
27\r
28 @param Address The MMIO register to read.\r
29\r
30 @return The value read.\r
31\r
32**/\r
33UINT8\r
34EFIAPI\r
35MmioRead8Internal (\r
36 IN UINTN Address\r
37 );\r
38\r
39/**\r
40 Writes an 8-bit MMIO register.\r
41\r
42 Writes the 8-bit MMIO register specified by Address with the value specified\r
43 by Value and returns Value. This function must guarantee that all MMIO read\r
44 and write operations are serialized.\r
45\r
46 @param Address The MMIO register to write.\r
47 @param Value The value to write to the MMIO register.\r
48\r
49**/\r
50VOID\r
51EFIAPI\r
52MmioWrite8Internal (\r
53 IN UINTN Address,\r
54 IN UINT8 Value\r
55 );\r
56\r
57/**\r
58 Reads a 16-bit MMIO register.\r
59\r
60 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is\r
61 returned. This function must guarantee that all MMIO read and write\r
62 operations are serialized.\r
63\r
64 @param Address The MMIO register to read.\r
65\r
66 @return The value read.\r
67\r
68**/\r
69UINT16\r
70EFIAPI\r
71MmioRead16Internal (\r
72 IN UINTN Address\r
73 );\r
74\r
75/**\r
76 Writes a 16-bit MMIO register.\r
77\r
78 Writes the 16-bit MMIO register specified by Address with the value specified\r
79 by Value and returns Value. This function must guarantee that all MMIO read\r
80 and write operations are serialized.\r
81\r
82 @param Address The MMIO register to write.\r
83 @param Value The value to write to the MMIO register.\r
84\r
85**/\r
86VOID\r
87EFIAPI\r
88MmioWrite16Internal (\r
89 IN UINTN Address,\r
90 IN UINT16 Value\r
91 );\r
92\r
93/**\r
94 Reads a 32-bit MMIO register.\r
95\r
96 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is\r
97 returned. This function must guarantee that all MMIO read and write\r
98 operations are serialized.\r
99\r
100 @param Address The MMIO register to read.\r
101\r
102 @return The value read.\r
103\r
104**/\r
105UINT32\r
106EFIAPI\r
107MmioRead32Internal (\r
108 IN UINTN Address\r
109 );\r
110\r
111/**\r
112 Writes a 32-bit MMIO register.\r
113\r
114 Writes the 32-bit MMIO register specified by Address with the value specified\r
115 by Value and returns Value. This function must guarantee that all MMIO read\r
116 and write operations are serialized.\r
117\r
118 @param Address The MMIO register to write.\r
119 @param Value The value to write to the MMIO register.\r
120\r
121**/\r
122VOID\r
123EFIAPI\r
124MmioWrite32Internal (\r
125 IN UINTN Address,\r
126 IN UINT32 Value\r
127 );\r
128\r
129/**\r
130 Reads a 64-bit MMIO register.\r
131\r
132 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is\r
133 returned. This function must guarantee that all MMIO read and write\r
134 operations are serialized.\r
135\r
136 @param Address The MMIO register to read.\r
137\r
138 @return The value read.\r
139\r
140**/\r
141UINT64\r
142EFIAPI\r
143MmioRead64Internal (\r
144 IN UINTN Address\r
145 );\r
146\r
147/**\r
148 Writes a 64-bit MMIO register.\r
149\r
150 Writes the 64-bit MMIO register specified by Address with the value specified\r
151 by Value and returns Value. This function must guarantee that all MMIO read\r
152 and write operations are serialized.\r
153\r
154 @param Address The MMIO register to write.\r
155 @param Value The value to write to the MMIO register.\r
156\r
157**/\r
158VOID\r
159EFIAPI\r
160MmioWrite64Internal (\r
161 IN UINTN Address,\r
162 IN UINT64 Value\r
163 );\r
164\r
165/**\r
166 Reads an 8-bit I/O port.\r
167\r
168 Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.\r
169 This function must guarantee that all I/O read and write operations are\r
170 serialized.\r
171\r
172 If 8-bit I/O port operations are not supported, then ASSERT().\r
173\r
174 @param Port The I/O port to read.\r
175\r
176 @return The value read.\r
177\r
178**/\r
179UINT8\r
180EFIAPI\r
181IoRead8 (\r
182 IN UINTN Port\r
183 )\r
184{\r
185 ASSERT (FALSE);\r
186 return 0;\r
187}\r
188\r
189/**\r
190 Writes an 8-bit I/O port.\r
191\r
192 Writes the 8-bit I/O port specified by Port with the value specified by Value\r
193 and returns Value. This function must guarantee that all I/O read and write\r
194 operations are serialized.\r
195\r
196 If 8-bit I/O port operations are not supported, then ASSERT().\r
197\r
198 @param Port The I/O port to write.\r
199 @param Value The value to write to the I/O port.\r
200\r
201 @return The value written the I/O port.\r
202\r
203**/\r
204UINT8\r
205EFIAPI\r
206IoWrite8 (\r
207 IN UINTN Port,\r
208 IN UINT8 Value\r
209 )\r
210{\r
211 ASSERT (FALSE);\r
212 return Value;\r
213}\r
214\r
215/**\r
216 Reads a 16-bit I/O port.\r
217\r
218 Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.\r
219 This function must guarantee that all I/O read and write operations are\r
220 serialized.\r
221\r
222 If 16-bit I/O port operations are not supported, then ASSERT().\r
223\r
224 @param Port The I/O port to read.\r
225\r
226 @return The value read.\r
227\r
228**/\r
229UINT16\r
230EFIAPI\r
231IoRead16 (\r
232 IN UINTN Port\r
233 )\r
234{\r
235 ASSERT (FALSE);\r
236 return 0;\r
237}\r
238\r
239/**\r
240 Writes a 16-bit I/O port.\r
241\r
242 Writes the 16-bit I/O port specified by Port with the value specified by Value\r
243 and returns Value. This function must guarantee that all I/O read and write\r
244 operations are serialized.\r
245\r
246 If 16-bit I/O port operations are not supported, then ASSERT().\r
247\r
248 @param Port The I/O port to write.\r
249 @param Value The value to write to the I/O port.\r
250\r
251 @return The value written the I/O port.\r
252\r
253**/\r
254UINT16\r
255EFIAPI\r
256IoWrite16 (\r
257 IN UINTN Port,\r
258 IN UINT16 Value\r
259 )\r
260{\r
261 ASSERT (FALSE);\r
262 return Value;\r
263}\r
264\r
265/**\r
266 Reads a 32-bit I/O port.\r
267\r
268 Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.\r
269 This function must guarantee that all I/O read and write operations are\r
270 serialized.\r
271\r
272 If 32-bit I/O port operations are not supported, then ASSERT().\r
273\r
274 @param Port The I/O port to read.\r
275\r
276 @return The value read.\r
277\r
278**/\r
279UINT32\r
280EFIAPI\r
281IoRead32 (\r
282 IN UINTN Port\r
283 )\r
284{\r
285 ASSERT (FALSE);\r
286 return 0;\r
287}\r
288\r
289/**\r
290 Writes a 32-bit I/O port.\r
291\r
292 Writes the 32-bit I/O port specified by Port with the value specified by Value\r
293 and returns Value. This function must guarantee that all I/O read and write\r
294 operations are serialized.\r
295\r
296 If 32-bit I/O port operations are not supported, then ASSERT().\r
297\r
298 @param Port The I/O port to write.\r
299 @param Value The value to write to the I/O port.\r
300\r
301 @return The value written the I/O port.\r
302\r
303**/\r
304UINT32\r
305EFIAPI\r
306IoWrite32 (\r
307 IN UINTN Port,\r
308 IN UINT32 Value\r
309 )\r
310{\r
311 ASSERT (FALSE);\r
312 return Value;\r
313}\r
314\r
315/**\r
316 Reads a 64-bit I/O port.\r
317\r
318 Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.\r
319 This function must guarantee that all I/O read and write operations are\r
320 serialized.\r
321\r
322 If 64-bit I/O port operations are not supported, then ASSERT().\r
323 If Port is not aligned on a 64-bit boundary, then ASSERT().\r
324\r
325 @param Port The I/O port to read.\r
326\r
327 @return The value read.\r
328\r
329**/\r
330UINT64\r
331EFIAPI\r
332IoRead64 (\r
333 IN UINTN Port\r
334 )\r
335{\r
336 ASSERT (FALSE);\r
337 return 0;\r
338}\r
339\r
340/**\r
341 Writes a 64-bit I/O port.\r
342\r
343 Writes the 64-bit I/O port specified by Port with the value specified by Value\r
344 and returns Value. This function must guarantee that all I/O read and write\r
345 operations are serialized.\r
346\r
347 If 64-bit I/O port operations are not supported, then ASSERT().\r
348 If Port is not aligned on a 64-bit boundary, then ASSERT().\r
349\r
350 @param Port The I/O port to write.\r
351 @param Value The value to write to the I/O port.\r
352\r
353 @return The value written to the I/O port.\r
354\r
355**/\r
356UINT64\r
357EFIAPI\r
358IoWrite64 (\r
359 IN UINTN Port,\r
360 IN UINT64 Value\r
361 )\r
362{\r
363 ASSERT (FALSE);\r
364 return 0;\r
365}\r
366\r
367/**\r
368 Reads an 8-bit I/O port fifo into a block of memory.\r
369\r
370 Reads the 8-bit I/O fifo port specified by Port.\r
371 The port is read Count times, and the read data is\r
372 stored in the provided Buffer.\r
373\r
374 This function must guarantee that all I/O read and write operations are\r
375 serialized.\r
376\r
377 If 8-bit I/O port operations are not supported, then ASSERT().\r
378\r
379 @param Port The I/O port to read.\r
380 @param Count The number of times to read I/O port.\r
381 @param Buffer The buffer to store the read data into.\r
382\r
383**/\r
384VOID\r
385EFIAPI\r
386IoReadFifo8 (\r
387 IN UINTN Port,\r
388 IN UINTN Count,\r
389 OUT VOID *Buffer\r
390 )\r
391{\r
392 ASSERT (FALSE);\r
393}\r
394\r
395/**\r
396 Writes a block of memory into an 8-bit I/O port fifo.\r
397\r
398 Writes the 8-bit I/O fifo port specified by Port.\r
399 The port is written Count times, and the write data is\r
400 retrieved from the provided Buffer.\r
401\r
402 This function must guarantee that all I/O write and write operations are\r
403 serialized.\r
404\r
405 If 8-bit I/O port operations are not supported, then ASSERT().\r
406\r
407 @param Port The I/O port to write.\r
408 @param Count The number of times to write I/O port.\r
409 @param Buffer The buffer to retrieve the write data from.\r
410\r
411**/\r
412VOID\r
413EFIAPI\r
414IoWriteFifo8 (\r
415 IN UINTN Port,\r
416 IN UINTN Count,\r
417 IN VOID *Buffer\r
418 )\r
419{\r
420 ASSERT (FALSE);\r
421}\r
422\r
423/**\r
424 Reads a 16-bit I/O port fifo into a block of memory.\r
425\r
426 Reads the 16-bit I/O fifo port specified by Port.\r
427 The port is read Count times, and the read data is\r
428 stored in the provided Buffer.\r
429\r
430 This function must guarantee that all I/O read and write operations are\r
431 serialized.\r
432\r
433 If 16-bit I/O port operations are not supported, then ASSERT().\r
434\r
435 @param Port The I/O port to read.\r
436 @param Count The number of times to read I/O port.\r
437 @param Buffer The buffer to store the read data into.\r
438\r
439**/\r
440VOID\r
441EFIAPI\r
442IoReadFifo16 (\r
443 IN UINTN Port,\r
444 IN UINTN Count,\r
445 OUT VOID *Buffer\r
446 )\r
447{\r
448 ASSERT (FALSE);\r
449}\r
450\r
451/**\r
452 Writes a block of memory into a 16-bit I/O port fifo.\r
453\r
454 Writes the 16-bit I/O fifo port specified by Port.\r
455 The port is written Count times, and the write data is\r
456 retrieved from the provided Buffer.\r
457\r
458 This function must guarantee that all I/O write and write operations are\r
459 serialized.\r
460\r
461 If 16-bit I/O port operations are not supported, then ASSERT().\r
462\r
463 @param Port The I/O port to write.\r
464 @param Count The number of times to write I/O port.\r
465 @param Buffer The buffer to retrieve the write data from.\r
466\r
467**/\r
468VOID\r
469EFIAPI\r
470IoWriteFifo16 (\r
471 IN UINTN Port,\r
472 IN UINTN Count,\r
473 IN VOID *Buffer\r
474 )\r
475{\r
476 ASSERT (FALSE);\r
477}\r
478\r
479/**\r
480 Reads a 32-bit I/O port fifo into a block of memory.\r
481\r
482 Reads the 32-bit I/O fifo port specified by Port.\r
483 The port is read Count times, and the read data is\r
484 stored in the provided Buffer.\r
485\r
486 This function must guarantee that all I/O read and write operations are\r
487 serialized.\r
488\r
489 If 32-bit I/O port operations are not supported, then ASSERT().\r
490\r
491 @param Port The I/O port to read.\r
492 @param Count The number of times to read I/O port.\r
493 @param Buffer The buffer to store the read data into.\r
494\r
495**/\r
496VOID\r
497EFIAPI\r
498IoReadFifo32 (\r
499 IN UINTN Port,\r
500 IN UINTN Count,\r
501 OUT VOID *Buffer\r
502 )\r
503{\r
504 ASSERT (FALSE);\r
505}\r
506\r
507/**\r
508 Writes a block of memory into a 32-bit I/O port fifo.\r
509\r
510 Writes the 32-bit I/O fifo port specified by Port.\r
511 The port is written Count times, and the write data is\r
512 retrieved from the provided Buffer.\r
513\r
514 This function must guarantee that all I/O write and write operations are\r
515 serialized.\r
516\r
517 If 32-bit I/O port operations are not supported, then ASSERT().\r
518\r
519 @param Port The I/O port to write.\r
520 @param Count The number of times to write I/O port.\r
521 @param Buffer The buffer to retrieve the write data from.\r
522\r
523**/\r
524VOID\r
525EFIAPI\r
526IoWriteFifo32 (\r
527 IN UINTN Port,\r
528 IN UINTN Count,\r
529 IN VOID *Buffer\r
530 )\r
531{\r
532 ASSERT (FALSE);\r
533}\r
534\r
535/**\r
536 Reads an 8-bit MMIO register.\r
537\r
538 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is\r
539 returned. This function must guarantee that all MMIO read and write\r
540 operations are serialized.\r
541\r
542 If 8-bit MMIO register operations are not supported, then ASSERT().\r
543\r
544 @param Address The MMIO register to read.\r
545\r
546 @return The value read.\r
547\r
548**/\r
549UINT8\r
550EFIAPI\r
551MmioRead8 (\r
552 IN UINTN Address\r
553 )\r
554{\r
555 return MmioRead8Internal (Address);\r
556}\r
557\r
558/**\r
559 Writes an 8-bit MMIO register.\r
560\r
561 Writes the 8-bit MMIO register specified by Address with the value specified\r
562 by Value and returns Value. This function must guarantee that all MMIO read\r
563 and write operations are serialized.\r
564\r
565 If 8-bit MMIO register operations are not supported, then ASSERT().\r
566\r
567 @param Address The MMIO register to write.\r
568 @param Value The value to write to the MMIO register.\r
569\r
570**/\r
571UINT8\r
572EFIAPI\r
573MmioWrite8 (\r
574 IN UINTN Address,\r
575 IN UINT8 Value\r
576 )\r
577{\r
578 MmioWrite8Internal (Address, Value);\r
579 return Value;\r
580}\r
581\r
582/**\r
583 Reads a 16-bit MMIO register.\r
584\r
585 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is\r
586 returned. This function must guarantee that all MMIO read and write\r
587 operations are serialized.\r
588\r
589 If 16-bit MMIO register operations are not supported, then ASSERT().\r
590\r
591 @param Address The MMIO register to read.\r
592\r
593 @return The value read.\r
594\r
595**/\r
596UINT16\r
597EFIAPI\r
598MmioRead16 (\r
599 IN UINTN Address\r
600 )\r
601{\r
602 ASSERT ((Address & 1) == 0);\r
603\r
604 return MmioRead16Internal (Address);\r
605}\r
606\r
607/**\r
608 Writes a 16-bit MMIO register.\r
609\r
610 Writes the 16-bit MMIO register specified by Address with the value specified\r
611 by Value and returns Value. This function must guarantee that all MMIO read\r
612 and write operations are serialized.\r
613\r
614 If 16-bit MMIO register operations are not supported, then ASSERT().\r
615\r
616 @param Address The MMIO register to write.\r
617 @param Value The value to write to the MMIO register.\r
618\r
619**/\r
620UINT16\r
621EFIAPI\r
622MmioWrite16 (\r
623 IN UINTN Address,\r
624 IN UINT16 Value\r
625 )\r
626{\r
627 ASSERT ((Address & 1) == 0);\r
628\r
629 MmioWrite16Internal (Address, Value);\r
630 return Value;\r
631}\r
632\r
633/**\r
634 Reads a 32-bit MMIO register.\r
635\r
636 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is\r
637 returned. This function must guarantee that all MMIO read and write\r
638 operations are serialized.\r
639\r
640 If 32-bit MMIO register operations are not supported, then ASSERT().\r
641\r
642 @param Address The MMIO register to read.\r
643\r
644 @return The value read.\r
645\r
646**/\r
647UINT32\r
648EFIAPI\r
649MmioRead32 (\r
650 IN UINTN Address\r
651 )\r
652{\r
653 ASSERT ((Address & 3) == 0);\r
654\r
655 return MmioRead32Internal (Address);\r
656}\r
657\r
658/**\r
659 Writes a 32-bit MMIO register.\r
660\r
661 Writes the 32-bit MMIO register specified by Address with the value specified\r
662 by Value and returns Value. This function must guarantee that all MMIO read\r
663 and write operations are serialized.\r
664\r
665 If 32-bit MMIO register operations are not supported, then ASSERT().\r
666\r
667 @param Address The MMIO register to write.\r
668 @param Value The value to write to the MMIO register.\r
669\r
670**/\r
671UINT32\r
672EFIAPI\r
673MmioWrite32 (\r
674 IN UINTN Address,\r
675 IN UINT32 Value\r
676 )\r
677{\r
678 ASSERT ((Address & 3) == 0);\r
679\r
680 MmioWrite32Internal (Address, Value);\r
681 return Value;\r
682}\r
683\r
684/**\r
685 Reads a 64-bit MMIO register.\r
686\r
687 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is\r
688 returned. This function must guarantee that all MMIO read and write\r
689 operations are serialized.\r
690\r
691 If 64-bit MMIO register operations are not supported, then ASSERT().\r
692\r
693 @param Address The MMIO register to read.\r
694\r
695 @return The value read.\r
696\r
697**/\r
698UINT64\r
699EFIAPI\r
700MmioRead64 (\r
701 IN UINTN Address\r
702 )\r
703{\r
704 ASSERT ((Address & 7) == 0);\r
705\r
706 return MmioRead64Internal (Address);\r
707}\r
708\r
709/**\r
710 Writes a 64-bit MMIO register.\r
711\r
712 Writes the 64-bit MMIO register specified by Address with the value specified\r
713 by Value and returns Value. This function must guarantee that all MMIO read\r
714 and write operations are serialized.\r
715\r
716 If 64-bit MMIO register operations are not supported, then ASSERT().\r
717\r
718 @param Address The MMIO register to write.\r
719 @param Value The value to write to the MMIO register.\r
720\r
721**/\r
722UINT64\r
723EFIAPI\r
724MmioWrite64 (\r
725 IN UINTN Address,\r
726 IN UINT64 Value\r
727 )\r
728{\r
729 ASSERT ((Address & 7) == 0);\r
730\r
731 MmioWrite64Internal (Address, Value);\r
732 return Value;\r
733}\r