IntelFrameworkPkg/DxeIoLibCpuIo: Add new Fifo routines in IoLib class
[mirror_edk2.git] / IntelFrameworkPkg / Library / DxeIoLibCpuIo / IoLib.c
1 /** @file
2 I/O Library.
3 The implementation of I/O operation for this library instance
4 are based on EFI_CPU_IO_PROTOCOL.
5
6 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
7 Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
8
9 This program and the accompanying materials
10 are licensed and made available under the terms and conditions of the BSD License
11 which accompanies this distribution. The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php
13
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16
17 Module Name: IoLib.c
18
19 **/
20
21
22 #include "DxeCpuIoLibInternal.h"
23
24 //
25 // Globle varible to cache pointer to CpuIo protocol.
26 //
27 EFI_CPU_IO_PROTOCOL *mCpuIo = NULL;
28
29 /**
30 The constructor function caches the pointer to CpuIo protocol.
31
32 The constructor function locates CpuIo protocol from protocol database.
33 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.
34
35 @param ImageHandle The firmware allocated handle for the EFI image.
36 @param SystemTable A pointer to the EFI System Table.
37
38 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
39
40 **/
41 EFI_STATUS
42 EFIAPI
43 IoLibConstructor (
44 IN EFI_HANDLE ImageHandle,
45 IN EFI_SYSTEM_TABLE *SystemTable
46 )
47 {
48 EFI_STATUS Status;
49
50 Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &mCpuIo);
51 ASSERT_EFI_ERROR (Status);
52
53 return Status;
54 }
55
56 /**
57 Reads registers in the EFI CPU I/O space.
58
59 Reads the I/O port specified by Port with registers width specified by Width.
60 The read value is returned. If such operations are not supported, then ASSERT().
61 This function must guarantee that all I/O read and write operations are serialized.
62
63 @param Port The base address of the I/O operation.
64 The caller is responsible for aligning the Address if required.
65 @param Width The width of the I/O operation.
66
67 @return Data read from registers in the EFI CPU I/O space.
68
69 **/
70 UINT64
71 EFIAPI
72 IoReadWorker (
73 IN UINTN Port,
74 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
75 )
76 {
77 EFI_STATUS Status;
78 UINT64 Data;
79
80 Status = mCpuIo->Io.Read (mCpuIo, Width, Port, 1, &Data);
81 ASSERT_EFI_ERROR (Status);
82
83 return Data;
84 }
85
86 /**
87 Writes registers in the EFI CPU I/O space.
88
89 Writes the I/O port specified by Port with registers width and value specified by Width
90 and Data respectively. Data is returned. If such operations are not supported, then ASSERT().
91 This function must guarantee that all I/O read and write operations are serialized.
92
93 @param Port The base address of the I/O operation.
94 The caller is responsible for aligning the Address if required.
95 @param Width The width of the I/O operation.
96 @param Data The value to write to the I/O port.
97
98 @return The parameter of Data.
99
100 **/
101 UINT64
102 EFIAPI
103 IoWriteWorker (
104 IN UINTN Port,
105 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
106 IN UINT64 Data
107 )
108 {
109 EFI_STATUS Status;
110
111 Status = mCpuIo->Io.Write (mCpuIo, Width, Port, 1, &Data);
112 ASSERT_EFI_ERROR (Status);
113
114 return Data;
115 }
116
117 /**
118 Reads registers in the EFI CPU I/O space.
119
120 Reads the I/O port specified by Port with registers width specified by Width.
121 The port is read Count times, and the read data is stored in the provided Buffer.
122
123 This function must guarantee that all I/O read and write operations are serialized.
124 If such operations are not supported, then ASSERT().
125
126 @param Port The base address of the I/O operation.
127 The caller is responsible for aligning the Address if required.
128 @param Width The width of the I/O operation.
129 @param Count The number of times to read I/O port.
130 @param Buffer The buffer to store the read data into.
131
132 **/
133 VOID
134 EFIAPI
135 IoReadFifoWorker (
136 IN UINTN Port,
137 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
138 IN UINTN Count,
139 IN VOID *Buffer
140 )
141 {
142 EFI_STATUS Status;
143
144 Status = mCpuIo->Io.Read (mCpuIo, Width, Port, Count, Buffer);
145 ASSERT_EFI_ERROR (Status);
146 }
147
148 /**
149 Writes registers in the EFI CPU I/O space.
150
151 Writes the I/O port specified by Port with registers width specified by Width.
152 The port is written Count times, and the write data is retrieved from the provided Buffer.
153
154 This function must guarantee that all I/O read and write operations are serialized.
155 If such operations are not supported, then ASSERT().
156
157 @param Port The base address of the I/O operation.
158 The caller is responsible for aligning the Address if required.
159 @param Width The width of the I/O operation.
160 @param Count The number of times to write I/O port.
161 @param Buffer The buffer to store the read data into.
162
163 **/
164 VOID
165 EFIAPI
166 IoWriteFifoWorker (
167 IN UINTN Port,
168 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
169 IN UINTN Count,
170 IN VOID *Buffer
171 )
172 {
173 EFI_STATUS Status;
174
175 Status = mCpuIo->Io.Write (mCpuIo, Width, Port, Count, Buffer);
176 ASSERT_EFI_ERROR (Status);
177 }
178
179 /**
180 Reads memory-mapped registers in the EFI system memory space.
181
182 Reads the MMIO registers specified by Address with registers width specified by Width.
183 The read value is returned. If such operations are not supported, then ASSERT().
184 This function must guarantee that all MMIO read and write operations are serialized.
185
186 @param Address The MMIO register to read.
187 The caller is responsible for aligning the Address if required.
188 @param Width The width of the I/O operation.
189
190 @return Data read from registers in the EFI system memory space.
191
192 **/
193 UINT64
194 EFIAPI
195 MmioReadWorker (
196 IN UINTN Address,
197 IN EFI_CPU_IO_PROTOCOL_WIDTH Width
198 )
199 {
200 EFI_STATUS Status;
201 UINT64 Data;
202
203 Status = mCpuIo->Mem.Read (mCpuIo, Width, Address, 1, &Data);
204 ASSERT_EFI_ERROR (Status);
205
206 return Data;
207 }
208
209 /**
210 Writes memory-mapped registers in the EFI system memory space.
211
212 Writes the MMIO registers specified by Address with registers width and value specified by Width
213 and Data respectively. Data is returned. If such operations are not supported, then ASSERT().
214 This function must guarantee that all MMIO read and write operations are serialized.
215
216 @param Address The MMIO register to read.
217 The caller is responsible for aligning the Address if required.
218 @param Width The width of the I/O operation.
219 @param Data The value to write to the I/O port.
220
221 @return Data read from registers in the EFI system memory space.
222
223 **/
224 UINT64
225 EFIAPI
226 MmioWriteWorker (
227 IN UINTN Address,
228 IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
229 IN UINT64 Data
230 )
231 {
232 EFI_STATUS Status;
233
234 Status = mCpuIo->Mem.Write (mCpuIo, Width, Address, 1, &Data);
235 ASSERT_EFI_ERROR (Status);
236
237 return Data;
238 }
239
240 /**
241 Reads an 8-bit I/O port.
242
243 Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
244 This function must guarantee that all I/O read and write operations are
245 serialized.
246
247 If 8-bit I/O port operations are not supported, then ASSERT().
248
249 @param Port The I/O port to read.
250
251 @return The value read.
252
253 **/
254 UINT8
255 EFIAPI
256 IoRead8 (
257 IN UINTN Port
258 )
259 {
260 return (UINT8)IoReadWorker (Port, EfiCpuIoWidthUint8);
261 }
262
263 /**
264 Writes an 8-bit I/O port.
265
266 Writes the 8-bit I/O port specified by Port with the value specified by Value
267 and returns Value. This function must guarantee that all I/O read and write
268 operations are serialized.
269
270 If 8-bit I/O port operations are not supported, then ASSERT().
271
272 @param Port The I/O port to write.
273 @param Value The value to write to the I/O port.
274
275 @return The value written the I/O port.
276
277 **/
278 UINT8
279 EFIAPI
280 IoWrite8 (
281 IN UINTN Port,
282 IN UINT8 Value
283 )
284 {
285 return (UINT8)IoWriteWorker (Port, EfiCpuIoWidthUint8, Value);
286 }
287
288 /**
289 Reads a 16-bit I/O port.
290
291 Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
292 This function must guarantee that all I/O read and write operations are
293 serialized.
294
295 If Port is not aligned on a 16-bit boundary, then ASSERT().
296
297 If 16-bit I/O port operations are not supported, then ASSERT().
298
299 @param Port The I/O port to read.
300
301 @return The value read.
302
303 **/
304 UINT16
305 EFIAPI
306 IoRead16 (
307 IN UINTN Port
308 )
309 {
310 //
311 // Make sure Port is aligned on a 16-bit boundary.
312 //
313 ASSERT ((Port & 1) == 0);
314 return (UINT16)IoReadWorker (Port, EfiCpuIoWidthUint16);
315 }
316
317 /**
318 Writes a 16-bit I/O port.
319
320 Writes the 16-bit I/O port specified by Port with the value specified by Value
321 and returns Value. This function must guarantee that all I/O read and write
322 operations are serialized.
323
324 If Port is not aligned on a 16-bit boundary, then ASSERT().
325
326 If 16-bit I/O port operations are not supported, then ASSERT().
327
328 @param Port The I/O port to write.
329 @param Value The value to write to the I/O port.
330
331 @return The value written the I/O port.
332
333 **/
334 UINT16
335 EFIAPI
336 IoWrite16 (
337 IN UINTN Port,
338 IN UINT16 Value
339 )
340 {
341 //
342 // Make sure Port is aligned on a 16-bit boundary.
343 //
344 ASSERT ((Port & 1) == 0);
345 return (UINT16)IoWriteWorker (Port, EfiCpuIoWidthUint16, Value);
346 }
347
348 /**
349 Reads a 32-bit I/O port.
350
351 Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
352 This function must guarantee that all I/O read and write operations are
353 serialized.
354
355 If Port is not aligned on a 32-bit boundary, then ASSERT().
356
357 If 32-bit I/O port operations are not supported, then ASSERT().
358
359 @param Port The I/O port to read.
360
361 @return The value read.
362
363 **/
364 UINT32
365 EFIAPI
366 IoRead32 (
367 IN UINTN Port
368 )
369 {
370 //
371 // Make sure Port is aligned on a 32-bit boundary.
372 //
373 ASSERT ((Port & 3) == 0);
374 return (UINT32)IoReadWorker (Port, EfiCpuIoWidthUint32);
375 }
376
377 /**
378 Writes a 32-bit I/O port.
379
380 Writes the 32-bit I/O port specified by Port with the value specified by Value
381 and returns Value. This function must guarantee that all I/O read and write
382 operations are serialized.
383
384 If Port is not aligned on a 32-bit boundary, then ASSERT().
385
386 If 32-bit I/O port operations are not supported, then ASSERT().
387
388 @param Port The I/O port to write.
389 @param Value The value to write to the I/O port.
390
391 @return The value written the I/O port.
392
393 **/
394 UINT32
395 EFIAPI
396 IoWrite32 (
397 IN UINTN Port,
398 IN UINT32 Value
399 )
400 {
401 //
402 // Make sure Port is aligned on a 32-bit boundary.
403 //
404 ASSERT ((Port & 3) == 0);
405 return (UINT32)IoWriteWorker (Port, EfiCpuIoWidthUint32, Value);
406 }
407
408 /**
409 Reads a 64-bit I/O port.
410
411 Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
412 This function must guarantee that all I/O read and write operations are
413 serialized.
414
415 If Port is not aligned on a 64-bit boundary, then ASSERT().
416
417 If 64-bit I/O port operations are not supported, then ASSERT().
418
419 @param Port The I/O port to read.
420
421 @return The value read.
422
423 **/
424 UINT64
425 EFIAPI
426 IoRead64 (
427 IN UINTN Port
428 )
429 {
430 //
431 // Make sure Port is aligned on a 64-bit boundary.
432 //
433 ASSERT ((Port & 7) == 0);
434 return IoReadWorker (Port, EfiCpuIoWidthUint64);
435 }
436
437 /**
438 Writes a 64-bit I/O port.
439
440 Writes the 64-bit I/O port specified by Port with the value specified by Value
441 and returns Value. This function must guarantee that all I/O read and write
442 operations are serialized.
443
444 If Port is not aligned on a 64-bit boundary, then ASSERT().
445
446 If 64-bit I/O port operations are not supported, then ASSERT().
447
448 @param Port The I/O port to write.
449 @param Value The value to write to the I/O port.
450
451 @return The value written the I/O port.
452
453 **/
454 UINT64
455 EFIAPI
456 IoWrite64 (
457 IN UINTN Port,
458 IN UINT64 Value
459 )
460 {
461 //
462 // Make sure Port is aligned on a 64-bit boundary.
463 //
464 ASSERT ((Port & 7) == 0);
465 return IoWriteWorker (Port, EfiCpuIoWidthUint64, Value);
466 }
467
468 /**
469 Reads an 8-bit I/O port fifo into a block of memory.
470
471 Reads the 8-bit I/O fifo port specified by Port.
472 The port is read Count times, and the read data is
473 stored in the provided Buffer.
474
475 This function must guarantee that all I/O read and write operations are
476 serialized.
477
478 If 8-bit I/O port operations are not supported, then ASSERT().
479
480 @param Port The I/O port to read.
481 @param Count The number of times to read I/O port.
482 @param Buffer The buffer to store the read data into.
483
484 **/
485 VOID
486 EFIAPI
487 IoReadFifo8 (
488 IN UINTN Port,
489 IN UINTN Count,
490 OUT VOID *Buffer
491 )
492 {
493 IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint8, Count, Buffer);
494 }
495
496 /**
497 Writes a block of memory into an 8-bit I/O port fifo.
498
499 Writes the 8-bit I/O fifo port specified by Port.
500 The port is written Count times, and the write data is
501 retrieved from the provided Buffer.
502
503 This function must guarantee that all I/O write and write operations are
504 serialized.
505
506 If 8-bit I/O port operations are not supported, then ASSERT().
507
508 @param Port The I/O port to write.
509 @param Count The number of times to write I/O port.
510 @param Buffer The buffer to retrieve the write data from.
511
512 **/
513 VOID
514 EFIAPI
515 IoWriteFifo8 (
516 IN UINTN Port,
517 IN UINTN Count,
518 IN VOID *Buffer
519 )
520 {
521 IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint8, Count, Buffer);
522 }
523
524 /**
525 Reads a 16-bit I/O port fifo into a block of memory.
526
527 Reads the 16-bit I/O fifo port specified by Port.
528 The port is read Count times, and the read data is
529 stored in the provided Buffer.
530
531 This function must guarantee that all I/O read and write operations are
532 serialized.
533
534 If 16-bit I/O port operations are not supported, then ASSERT().
535
536 @param Port The I/O port to read.
537 @param Count The number of times to read I/O port.
538 @param Buffer The buffer to store the read data into.
539
540 **/
541 VOID
542 EFIAPI
543 IoReadFifo16 (
544 IN UINTN Port,
545 IN UINTN Count,
546 OUT VOID *Buffer
547 )
548 {
549 //
550 // Make sure Port is aligned on a 16-bit boundary.
551 //
552 ASSERT ((Port & 1) == 0);
553 IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint16, Count, Buffer);
554 }
555
556 /**
557 Writes a block of memory into a 16-bit I/O port fifo.
558
559 Writes the 16-bit I/O fifo port specified by Port.
560 The port is written Count times, and the write data is
561 retrieved from the provided Buffer.
562
563 This function must guarantee that all I/O write and write operations are
564 serialized.
565
566 If 16-bit I/O port operations are not supported, then ASSERT().
567
568 @param Port The I/O port to write.
569 @param Count The number of times to write I/O port.
570 @param Buffer The buffer to retrieve the write data from.
571
572 **/
573 VOID
574 EFIAPI
575 IoWriteFifo16 (
576 IN UINTN Port,
577 IN UINTN Count,
578 IN VOID *Buffer
579 )
580 {
581 //
582 // Make sure Port is aligned on a 16-bit boundary.
583 //
584 ASSERT ((Port & 1) == 0);
585 IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint16, Count, Buffer);
586 }
587
588 /**
589 Reads a 32-bit I/O port fifo into a block of memory.
590
591 Reads the 32-bit I/O fifo port specified by Port.
592 The port is read Count times, and the read data is
593 stored in the provided Buffer.
594
595 This function must guarantee that all I/O read and write operations are
596 serialized.
597
598 If 32-bit I/O port operations are not supported, then ASSERT().
599
600 @param Port The I/O port to read.
601 @param Count The number of times to read I/O port.
602 @param Buffer The buffer to store the read data into.
603
604 **/
605 VOID
606 EFIAPI
607 IoReadFifo32 (
608 IN UINTN Port,
609 IN UINTN Count,
610 OUT VOID *Buffer
611 )
612 {
613 //
614 // Make sure Port is aligned on a 32-bit boundary.
615 //
616 ASSERT ((Port & 3) == 0);
617 IoReadFifoWorker (Port, EfiCpuIoWidthFifoUint32, Count, Buffer);
618 }
619
620 /**
621 Writes a block of memory into a 32-bit I/O port fifo.
622
623 Writes the 32-bit I/O fifo port specified by Port.
624 The port is written Count times, and the write data is
625 retrieved from the provided Buffer.
626
627 This function must guarantee that all I/O write and write operations are
628 serialized.
629
630 If 32-bit I/O port operations are not supported, then ASSERT().
631
632 @param Port The I/O port to write.
633 @param Count The number of times to write I/O port.
634 @param Buffer The buffer to retrieve the write data from.
635
636 **/
637 VOID
638 EFIAPI
639 IoWriteFifo32 (
640 IN UINTN Port,
641 IN UINTN Count,
642 IN VOID *Buffer
643 )
644 {
645 //
646 // Make sure Port is aligned on a 32-bit boundary.
647 //
648 ASSERT ((Port & 3) == 0);
649 IoWriteFifoWorker (Port, EfiCpuIoWidthFifoUint32, Count, Buffer);
650 }
651
652 /**
653 Reads an 8-bit MMIO register.
654
655 Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
656 returned. This function must guarantee that all MMIO read and write
657 operations are serialized.
658
659 If 8-bit MMIO register operations are not supported, then ASSERT().
660
661 @param Address The MMIO register to read.
662
663 @return The value read.
664
665 **/
666 UINT8
667 EFIAPI
668 MmioRead8 (
669 IN UINTN Address
670 )
671 {
672 return (UINT8)MmioReadWorker (Address, EfiCpuIoWidthUint8);
673 }
674
675 /**
676 Writes an 8-bit MMIO register.
677
678 Writes the 8-bit MMIO register specified by Address with the value specified
679 by Value and returns Value. This function must guarantee that all MMIO read
680 and write operations are serialized.
681
682 If 8-bit MMIO register operations are not supported, then ASSERT().
683
684 @param Address The MMIO register to write.
685 @param Value The value to write to the MMIO register.
686
687 **/
688 UINT8
689 EFIAPI
690 MmioWrite8 (
691 IN UINTN Address,
692 IN UINT8 Value
693 )
694 {
695 return (UINT8)MmioWriteWorker (Address, EfiCpuIoWidthUint8, Value);
696 }
697
698 /**
699 Reads a 16-bit MMIO register.
700
701 Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
702 returned. This function must guarantee that all MMIO read and write
703 operations are serialized.
704
705 If Address is not aligned on a 16-bit boundary, then ASSERT().
706
707 If 16-bit MMIO register operations are not supported, then ASSERT().
708
709 @param Address The MMIO register to read.
710
711 @return The value read.
712
713 **/
714 UINT16
715 EFIAPI
716 MmioRead16 (
717 IN UINTN Address
718 )
719 {
720 //
721 // Make sure Address is aligned on a 16-bit boundary.
722 //
723 ASSERT ((Address & 1) == 0);
724 return (UINT16)MmioReadWorker (Address, EfiCpuIoWidthUint16);
725 }
726
727 /**
728 Writes a 16-bit MMIO register.
729
730 Writes the 16-bit MMIO register specified by Address with the value specified
731 by Value and returns Value. This function must guarantee that all MMIO read
732 and write operations are serialized.
733
734 If Address is not aligned on a 16-bit boundary, then ASSERT().
735
736 If 16-bit MMIO register operations are not supported, then ASSERT().
737
738 @param Address The MMIO register to write.
739 @param Value The value to write to the MMIO register.
740
741 **/
742 UINT16
743 EFIAPI
744 MmioWrite16 (
745 IN UINTN Address,
746 IN UINT16 Value
747 )
748 {
749 //
750 // Make sure Address is aligned on a 16-bit boundary.
751 //
752 ASSERT ((Address & 1) == 0);
753 return (UINT16)MmioWriteWorker (Address, EfiCpuIoWidthUint16, Value);
754 }
755
756 /**
757 Reads a 32-bit MMIO register.
758
759 Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
760 returned. This function must guarantee that all MMIO read and write
761 operations are serialized.
762
763 If Address is not aligned on a 32-bit boundary, then ASSERT().
764
765 If 32-bit MMIO register operations are not supported, then ASSERT().
766
767 @param Address The MMIO register to read.
768
769 @return The value read.
770
771 **/
772 UINT32
773 EFIAPI
774 MmioRead32 (
775 IN UINTN Address
776 )
777 {
778 //
779 // Make sure Address is aligned on a 32-bit boundary.
780 //
781 ASSERT ((Address & 3) == 0);
782 return (UINT32)MmioReadWorker (Address, EfiCpuIoWidthUint32);
783 }
784
785 /**
786 Writes a 32-bit MMIO register.
787
788 Writes the 32-bit MMIO register specified by Address with the value specified
789 by Value and returns Value. This function must guarantee that all MMIO read
790 and write operations are serialized.
791
792 If Address is not aligned on a 32-bit boundary, then ASSERT().
793
794 If 32-bit MMIO register operations are not supported, then ASSERT().
795
796 @param Address The MMIO register to write.
797 @param Value The value to write to the MMIO register.
798
799 **/
800 UINT32
801 EFIAPI
802 MmioWrite32 (
803 IN UINTN Address,
804 IN UINT32 Value
805 )
806 {
807 //
808 // Make sure Address is aligned on a 32-bit boundary.
809 //
810 ASSERT ((Address & 3) == 0);
811 return (UINT32)MmioWriteWorker (Address, EfiCpuIoWidthUint32, Value);
812 }
813
814 /**
815 Reads a 64-bit MMIO register.
816
817 Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
818 returned. This function must guarantee that all MMIO read and write
819 operations are serialized.
820
821 If Address is not aligned on a 64-bit boundary, then ASSERT().
822
823 If 64-bit MMIO register operations are not supported, then ASSERT().
824
825 @param Address The MMIO register to read.
826
827 @return The value read.
828
829 **/
830 UINT64
831 EFIAPI
832 MmioRead64 (
833 IN UINTN Address
834 )
835 {
836 //
837 // Make sure Address is aligned on a 64-bit boundary.
838 //
839 ASSERT ((Address & 7) == 0);
840 return (UINT64)MmioReadWorker (Address, EfiCpuIoWidthUint64);
841 }
842
843 /**
844 Writes a 64-bit MMIO register.
845
846 Writes the 64-bit MMIO register specified by Address with the value specified
847 by Value and returns Value. This function must guarantee that all MMIO read
848 and write operations are serialized.
849
850 If Address is not aligned on a 64-bit boundary, then ASSERT().
851
852 If 64-bit MMIO register operations are not supported, then ASSERT().
853
854 @param Address The MMIO register to write.
855 @param Value The value to write to the MMIO register.
856
857 **/
858 UINT64
859 EFIAPI
860 MmioWrite64 (
861 IN UINTN Address,
862 IN UINT64 Value
863 )
864 {
865 //
866 // Make sure Address is aligned on a 64-bit boundary.
867 //
868 ASSERT ((Address & 7) == 0);
869 return (UINT64)MmioWriteWorker (Address, EfiCpuIoWidthUint64, Value);
870 }