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