Home | History | Annotate | Download | only in SmmIoLibSmmCpuIo2
      1 /** @file
      2   Internal include file of SMM CPU IO Library.
      3   It includes all necessary protocol/library class's header file
      4   for implementation of IoLib library instance. It is included
      5   all source code of this library instance.
      6 
      7   Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
      8   This program and the accompanying materials
      9   are licensed and made available under the terms and conditions of the BSD License
     10   which accompanies this distribution.  The full text of the license may be found at
     11   http://opensource.org/licenses/bsd-license.php.
     12 
     13   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     14   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     15 
     16 **/
     17 
     18 #ifndef _SMM_CPUIO_LIB_INTERNAL_H_
     19 #define _SMM_CPUIO_LIB_INTERNAL_H_
     20 
     21 #include <PiSmm.h>
     22 #include <Protocol/SmmCpuIo2.h>
     23 #include <Protocol/SmmPciRootBridgeIo.h>
     24 #include <Library/IoLib.h>
     25 #include <Library/DebugLib.h>
     26 #include <Library/BaseLib.h>
     27 #include <Library/SmmServicesTableLib.h>
     28 
     29 
     30 /**
     31   Reads registers in the EFI CPU I/O space.
     32 
     33   Reads the I/O port specified by Port with registers width specified by Width.
     34   The read value is returned. If such operations are not supported, then ASSERT().
     35   This function must guarantee that all I/O read and write operations are serialized.
     36 
     37   @param  Port          The base address of the I/O operation.
     38                         The caller is responsible for aligning the Address if required.
     39   @param  Width         The width of the I/O operation.
     40 
     41   @return Data read from registers in the EFI CPU I/O space.
     42 
     43 **/
     44 UINT64
     45 EFIAPI
     46 IoReadWorker (
     47   IN      UINTN                     Port,
     48   IN      EFI_SMM_IO_WIDTH          Width
     49   );
     50 
     51 /**
     52   Writes registers in the EFI CPU I/O space.
     53 
     54   Writes the I/O port specified by Port with registers width and value specified by Width
     55   and Data respectively.  Data is returned. If such operations are not supported, then ASSERT().
     56   This function must guarantee that all I/O read and write operations are serialized.
     57 
     58   @param  Port          The base address of the I/O operation.
     59                         The caller is responsible for aligning the Address if required.
     60   @param  Width         The width of the I/O operation.
     61   @param  Data          The value to write to the I/O port.
     62 
     63   @return The paramter of Data.
     64 
     65 **/
     66 UINT64
     67 EFIAPI
     68 IoWriteWorker (
     69   IN      UINTN                     Port,
     70   IN      EFI_SMM_IO_WIDTH          Width,
     71   IN      UINT64                    Data
     72   );
     73 
     74 /**
     75   Reads memory-mapped registers in the EFI system memory space.
     76 
     77   Reads the MMIO registers specified by Address with registers width specified by Width.
     78   The read value is returned. If such operations are not supported, then ASSERT().
     79   This function must guarantee that all MMIO read and write operations are serialized.
     80 
     81   @param  Address       The MMIO register to read.
     82                         The caller is responsible for aligning the Address if required.
     83   @param  Width         The width of the I/O operation.
     84 
     85   @return Data read from registers in the EFI system memory space.
     86 
     87 **/
     88 UINT64
     89 EFIAPI
     90 MmioReadWorker (
     91   IN      UINTN                     Address,
     92   IN      EFI_SMM_IO_WIDTH          Width
     93   );
     94 
     95 /**
     96   Writes memory-mapped registers in the EFI system memory space.
     97 
     98   Writes the MMIO registers specified by Address with registers width and value specified by Width
     99   and Data respectively. Data is returned. If such operations are not supported, then ASSERT().
    100   This function must guarantee that all MMIO read and write operations are serialized.
    101 
    102   @param  Address       The MMIO register to read.
    103                         The caller is responsible for aligning the Address if required.
    104   @param  Width         The width of the I/O operation.
    105   @param  Data          The value to write to the I/O port.
    106 
    107   @return Data read from registers in the EFI system memory space.
    108 
    109 **/
    110 UINT64
    111 EFIAPI
    112 MmioWriteWorker (
    113   IN      UINTN                     Address,
    114   IN      EFI_SMM_IO_WIDTH          Width,
    115   IN      UINT64                    Data
    116   );
    117 
    118 #endif
    119