4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/** @file
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync I/O Library. The implementations are based on EFI_PEI_SERVICE->CpuIo interface.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This program and the accompanying materials
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync are licensed and made available under the terms and conditions of the BSD License
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync which accompanies this distribution. The full text of the license may be found at
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync http://opensource.org/licenses/bsd-license.php.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <PiPei.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Library/IoLib.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Library/DebugLib.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Library/BaseLib.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync#include <Library/PeiServicesTablePointerLib.h>
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Reads an 8-bit I/O port.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This function must guarantee that all I/O read and write operations are
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync serialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If 8-bit I/O port operations are not supported, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Port The I/O port to read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The value read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT8
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncIoRead8 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN Port
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync )
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CONST EFI_PEI_SERVICES **PeiServices;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_PEI_CPU_IO_PPI *CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PeiServices = GetPeiServicesTablePointer ();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo = (*PeiServices)->CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT (CpuIo != NULL);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return CpuIo->IoRead8 (PeiServices, CpuIo, (UINT64) Port);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Writes an 8-bit I/O port.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Writes the 8-bit I/O port specified by Port with the value specified by Value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and returns Value. This function must guarantee that all I/O read and write
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync operations are serialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If 8-bit I/O port operations are not supported, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Port The I/O port to write.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Value The value to write to the I/O port.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The value written the I/O port.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT8
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncIoWrite8 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN Port,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINT8 Value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync )
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CONST EFI_PEI_SERVICES **PeiServices;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_PEI_CPU_IO_PPI *CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PeiServices = GetPeiServicesTablePointer ();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo = (*PeiServices)->CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT (CpuIo != NULL);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo->IoWrite8 (PeiServices, CpuIo, (UINT64) Port, Value);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return Value;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Reads a 16-bit I/O port.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This function must guarantee that all I/O read and write operations are
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync serialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If 16-bit I/O port operations are not supported, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Port is not aligned on a 16-bit boundary, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Port The I/O port to read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The value read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT16
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncIoRead16 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN Port
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync )
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CONST EFI_PEI_SERVICES **PeiServices;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_PEI_CPU_IO_PPI *CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PeiServices = GetPeiServicesTablePointer ();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo = (*PeiServices)->CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT (CpuIo != NULL);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Make sure Port is aligned on a 16-bit boundary.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT ((Port & 1) == 0);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return CpuIo->IoRead16 (PeiServices, CpuIo, (UINT64) Port);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Writes a 16-bit I/O port.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Writes the 16-bit I/O port specified by Port with the value specified by Value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and returns Value. This function must guarantee that all I/O read and write
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync operations are serialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If 16-bit I/O port operations are not supported, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Port is not aligned on a 16-bit boundary, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Port The I/O port to write.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Value The value to write to the I/O port.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The value written the I/O port.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT16
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncIoWrite16 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN Port,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINT16 Value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync )
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CONST EFI_PEI_SERVICES **PeiServices;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_PEI_CPU_IO_PPI *CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PeiServices = GetPeiServicesTablePointer ();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo = (*PeiServices)->CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT (CpuIo != NULL);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Make sure Port is aligned on a 16-bit boundary.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT ((Port & 1) == 0);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo->IoWrite16 (PeiServices, CpuIo, (UINT64) Port, Value);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return Value;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Reads a 32-bit I/O port.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This function must guarantee that all I/O read and write operations are
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync serialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If 32-bit I/O port operations are not supported, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Port is not aligned on a 32-bit boundary, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Port The I/O port to read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The value read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT32
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncIoRead32 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN Port
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync )
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CONST EFI_PEI_SERVICES **PeiServices;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_PEI_CPU_IO_PPI *CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PeiServices = GetPeiServicesTablePointer ();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo = (*PeiServices)->CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT (CpuIo != NULL);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Make sure Port is aligned on a 32-bit boundary.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT ((Port & 3) == 0);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return CpuIo->IoRead32 (PeiServices, CpuIo, (UINT64) Port);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Writes a 32-bit I/O port.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Writes the 32-bit I/O port specified by Port with the value specified by Value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and returns Value. This function must guarantee that all I/O read and write
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync operations are serialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If 32-bit I/O port operations are not supported, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Port is not aligned on a 32-bit boundary, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Port The I/O port to write.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Value The value to write to the I/O port.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The value written the I/O port.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT32
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncIoWrite32 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN Port,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINT32 Value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync )
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CONST EFI_PEI_SERVICES **PeiServices;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_PEI_CPU_IO_PPI *CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PeiServices = GetPeiServicesTablePointer ();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo = (*PeiServices)->CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT (CpuIo != NULL);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Make sure Port is aligned on a 32-bit boundary.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT ((Port & 3) == 0);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo->IoWrite32 (PeiServices, CpuIo, (UINT64) Port, Value);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return Value;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Reads a 64-bit I/O port.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync This function must guarantee that all I/O read and write operations are
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync serialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If 64-bit I/O port operations are not supported, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Port is not aligned on a 64-bit boundary, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Port The I/O port to read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The value read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT64
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncIoRead64 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN Port
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync )
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CONST EFI_PEI_SERVICES **PeiServices;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_PEI_CPU_IO_PPI *CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PeiServices = GetPeiServicesTablePointer ();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo = (*PeiServices)->CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT (CpuIo != NULL);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Make sure Port is aligned on a 64-bit boundary.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT ((Port & 7) == 0);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return CpuIo->IoRead64 (PeiServices, CpuIo, (UINT64) Port);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Writes a 64-bit I/O port.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Writes the 64-bit I/O port specified by Port with the value specified by Value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and returns Value. This function must guarantee that all I/O read and write
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync operations are serialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If 64-bit I/O port operations are not supported, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Port is not aligned on a 64-bit boundary, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Port The I/O port to write.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Value The value to write to the I/O port.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The value written the I/O port.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT64
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncIoWrite64 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN Port,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINT64 Value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync )
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CONST EFI_PEI_SERVICES **PeiServices;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_PEI_CPU_IO_PPI *CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PeiServices = GetPeiServicesTablePointer ();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo = (*PeiServices)->CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT (CpuIo != NULL);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Make sure Port is aligned on a 64-bit boundary.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT ((Port & 7) == 0);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo->IoWrite64 (PeiServices, CpuIo, (UINT64) Port, Value);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return Value;;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Reads an 8-bit MMIO register.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync returned. This function must guarantee that all MMIO read and write
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync operations are serialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If 8-bit MMIO register operations are not supported, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Address The MMIO register to read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The value read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT8
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncMmioRead8 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN Address
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync )
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CONST EFI_PEI_SERVICES **PeiServices;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_PEI_CPU_IO_PPI *CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PeiServices = GetPeiServicesTablePointer ();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo = (*PeiServices)->CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT (CpuIo != NULL);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return CpuIo->MemRead8 (PeiServices, CpuIo, (UINT64) Address);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Writes an 8-bit MMIO register.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Writes the 8-bit MMIO register specified by Address with the value specified
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync by Value and returns Value. This function must guarantee that all MMIO read
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and write operations are serialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If 8-bit MMIO register operations are not supported, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Address The MMIO register to write.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Value The value to write to the MMIO register.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return Value.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT8
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncMmioWrite8 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN Address,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINT8 Value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync )
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CONST EFI_PEI_SERVICES **PeiServices;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_PEI_CPU_IO_PPI *CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PeiServices = GetPeiServicesTablePointer ();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo = (*PeiServices)->CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT (CpuIo != NULL);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo->MemWrite8 (PeiServices, CpuIo, (UINT64) Address, Value);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return Value;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Reads a 16-bit MMIO register.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync returned. This function must guarantee that all MMIO read and write
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync operations are serialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If 16-bit MMIO register operations are not supported, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Address is not aligned on a 16-bit boundary, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Address The MMIO register to read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The value read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT16
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncMmioRead16 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN Address
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync )
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CONST EFI_PEI_SERVICES **PeiServices;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_PEI_CPU_IO_PPI *CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PeiServices = GetPeiServicesTablePointer ();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo = (*PeiServices)->CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT (CpuIo != NULL);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Make sure Address is aligned on a 16-bit boundary.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT ((Address & 1) == 0);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return CpuIo->MemRead16 (PeiServices, CpuIo, (UINT64) Address);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Writes a 16-bit MMIO register.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Writes the 16-bit MMIO register specified by Address with the value specified
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync by Value and returns Value. This function must guarantee that all MMIO read
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and write operations are serialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If 16-bit MMIO register operations are not supported, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Address is not aligned on a 16-bit boundary, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Address The MMIO register to write.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Value The value to write to the MMIO register.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return Value.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT16
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncMmioWrite16 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN Address,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINT16 Value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync )
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CONST EFI_PEI_SERVICES **PeiServices;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_PEI_CPU_IO_PPI *CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PeiServices = GetPeiServicesTablePointer ();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo = (*PeiServices)->CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT (CpuIo != NULL);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Make sure Address is aligned on a 16-bit boundary.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT ((Address & 1) == 0);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo->MemWrite16 (PeiServices, CpuIo, (UINT64) Address, Value);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return Value;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Reads a 32-bit MMIO register.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync returned. This function must guarantee that all MMIO read and write
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync operations are serialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If 32-bit MMIO register operations are not supported, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Address is not aligned on a 32-bit boundary, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Address The MMIO register to read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The value read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT32
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncMmioRead32 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN Address
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync )
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CONST EFI_PEI_SERVICES **PeiServices;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_PEI_CPU_IO_PPI *CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PeiServices = GetPeiServicesTablePointer ();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo = (*PeiServices)->CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT (CpuIo != NULL);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Make sure Address is aligned on a 32-bit boundary.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT ((Address & 3) == 0);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return CpuIo->MemRead32 (PeiServices, CpuIo, (UINT64) Address);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Writes a 32-bit MMIO register.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Writes the 32-bit MMIO register specified by Address with the value specified
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync by Value and returns Value. This function must guarantee that all MMIO read
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and write operations are serialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If 32-bit MMIO register operations are not supported, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Address is not aligned on a 32-bit boundary, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Address The MMIO register to write.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Value The value to write to the MMIO register.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return Value.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT32
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncMmioWrite32 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN Address,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINT32 Value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync )
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CONST EFI_PEI_SERVICES **PeiServices;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_PEI_CPU_IO_PPI *CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PeiServices = GetPeiServicesTablePointer ();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo = (*PeiServices)->CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT (CpuIo != NULL);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Make sure Address is aligned on a 32-bit boundary.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT ((Address & 3) == 0);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo->MemWrite32 (PeiServices, CpuIo, (UINT64) Address, Value);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return Value;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Reads a 64-bit MMIO register.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync returned. This function must guarantee that all MMIO read and write
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync operations are serialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If 64-bit MMIO register operations are not supported, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Address is not aligned on a 64-bit boundary, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Address The MMIO register to read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @return The value read.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT64
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncMmioRead64 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN Address
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync )
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CONST EFI_PEI_SERVICES **PeiServices;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_PEI_CPU_IO_PPI *CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PeiServices = GetPeiServicesTablePointer ();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo = (*PeiServices)->CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT (CpuIo != NULL);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Make sure Address is aligned on a 64-bit boundary.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT ((Address & (sizeof (UINT64) - 1)) == 0);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return CpuIo->MemRead64 (PeiServices, CpuIo, (UINT64) Address);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/**
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Writes a 64-bit MMIO register.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync Writes the 64-bit MMIO register specified by Address with the value specified
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync by Value and returns Value. This function must guarantee that all MMIO read
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync and write operations are serialized.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If 64-bit MMIO register operations are not supported, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync If Address is not aligned on a 64-bit boundary, then ASSERT().
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Address The MMIO register to write.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync @param Value The value to write to the MMIO register.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync**/
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncUINT64
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncEFIAPI
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncMmioWrite64 (
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINTN Address,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync IN UINT64 Value
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync )
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync{
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CONST EFI_PEI_SERVICES **PeiServices;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync EFI_PEI_CPU_IO_PPI *CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync PeiServices = GetPeiServicesTablePointer ();
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo = (*PeiServices)->CpuIo;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT (CpuIo != NULL);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync // Make sure Address is aligned on a 64-bit boundary.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync //
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ASSERT ((Address & 7) == 0);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync CpuIo->MemWrite64 (PeiServices, CpuIo, (UINT64) Address, Value);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync return Value;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync}