Home | History | Annotate | Download | only in PeiSmbusLibSmbus2Ppi
      1 /** @file
      2 Internal header file for Smbus library.
      3 
      4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
      5 This program and the accompanying materials
      6 are licensed and made available under the terms and conditions of the BSD License
      7 which accompanies this distribution.  The full text of the license may be found at
      8 http://opensource.org/licenses/bsd-license.php
      9 
     10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     12 
     13 
     14 **/
     15 
     16 #ifndef __INTERNAL_SMBUS_LIB_H_
     17 #define __INTERNAL_SMBUS_LIB_H_
     18 
     19 
     20 #include <PiPei.h>
     21 
     22 #include <Ppi/Smbus2.h>
     23 
     24 #include <Library/SmbusLib.h>
     25 #include <Library/DebugLib.h>
     26 #include <Library/PeiServicesLib.h>
     27 #include <Library/BaseMemoryLib.h>
     28 
     29 //
     30 // Declaration for internal functions
     31 //
     32 
     33 /**
     34   Gets Smbus PPIs.
     35 
     36   This internal function retrieves Smbus PPI from PPI database.
     37 
     38   @param  VOID
     39 
     40   @return The pointer to Smbus PPI.
     41 
     42 **/
     43 EFI_PEI_SMBUS2_PPI *
     44 InternalGetSmbusPpi (
     45   VOID
     46   );
     47 
     48 /**
     49   Executes an SMBus operation to an SMBus controller.
     50 
     51   This function provides a standard way to execute Smbus script
     52   as defined in the SmBus Specification. The data can either be of
     53   the Length byte, word, or a block of data.
     54 
     55   @param  SmbusOperation  Signifies which particular SMBus hardware protocol
     56                           instance that it will use to execute the SMBus transactions.
     57   @param  SmBusAddress    The address that encodes the SMBUS Slave Address,
     58                           SMBUS Command, SMBUS Data Length, and PEC.
     59   @param  Length          Signifies the number of bytes that this operation will
     60                           do. The maximum number of bytes can be revision specific
     61                           and operation specific.
     62   @param  Buffer          Contains the value of data to execute to the SMBus slave
     63                           device. Not all operations require this argument. The
     64                           length of this buffer is identified by Length.
     65   @param  Status          Return status for the executed command.
     66                           This is an optional parameter and may be NULL.
     67 
     68   @return The actual number of bytes that are executed for this operation.
     69 
     70 **/
     71 UINTN
     72 InternalSmBusExec (
     73   IN     EFI_SMBUS_OPERATION        SmbusOperation,
     74   IN     UINTN                      SmBusAddress,
     75   IN     UINTN                      Length,
     76   IN OUT VOID                       *Buffer,
     77      OUT RETURN_STATUS              *Status        OPTIONAL
     78   );
     79 
     80 #endif
     81