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