]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkPkg/Include/Ppi/Smbus.h
Minor code enhancement.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Ppi / Smbus.h
index 49997e45690ff4f236f8f90b0e788116eb0fb622..8834bd2a7d6f1f02a6878f3e3d327c7b05e61df5 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
-  This file declares Smbus PPI which provides the basic I/O interfaces that a PEIM \r
+  This file declares the Smbus PPI, which provides the basic I/O interfaces that a PEIM \r
   uses to access its SMBus controller and the slave devices attached to it.\r
 \r
-  Copyright (c) 2007, Intel Corporation\r
+  Copyright (c) 2007 - 2009, Intel Corporation\r
   All rights reserved. This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-  Module Name:  Smbus.h\r
-\r
   @par Revision Reference:\r
   This PPI is defined in Framework of EFI SmBus PPI spec.\r
   Version 0.9\r
 \r
 **/\r
 \r
-#ifndef _PEI_SMBUS_PPI_H\r
-#define _PEI_SMBUS_PPI_H\r
+#ifndef _PEI_SMBUS_PPI_H_\r
+#define _PEI_SMBUS_PPI_H_\r
 \r
-#include <PiPei.h>\r
 #include <Ppi/Smbus2.h>\r
 \r
 #define EFI_PEI_SMBUS_PPI_GUID \\r
@@ -35,31 +32,31 @@ typedef struct _EFI_PEI_SMBUS_PPI EFI_PEI_SMBUS_PPI;
 /**\r
   Executes an SMBus operation to an SMBus controller.\r
 \r
-  @param  PeiServices    A pointer to the system PEI Services Table.\r
-  @param  This           A pointer to the EFI_PEI_SMBUS_PPI instance.\r
-  @param  SlaveAddress   The SMBUS hardware address to which the SMBUS\r
-                         device is preassigned or allocated.\r
-  @param  Command        This command is transmitted by the SMBus host\r
-                         controller to the SMBus slave device and the interpretation is\r
-                         SMBus slave device specific.\r
-  @param  Operation      Signifies which particular SMBus hardware protocol\r
-                         instance that it will use to execute the SMBus transactions.\r
-  @param  PecCheck       Defines if Packet Error Code (PEC) checking is required\r
-                         for this operation.\r
-  @param  Length         Signifies the number of bytes that this operation will do.\r
-  @param  Buffer         Contains the value of data to execute to the SMBus slave device.\r
+  @param[in]      PeiServices   A pointer to the system PEI Services Table.\r
+  @param[in]      This          A pointer to the EFI_PEI_SMBUS_PPI instance.\r
+  @param[in]      SlaveAddress  The SMBUS hardware address to which the SMBUS\r
+                                device is preassigned or allocated.\r
+  @param[in]      Command       This command is transmitted by the SMBus host\r
+                                controller to the SMBus slave device and the interpretation is\r
+                                SMBus slave device specific.\r
+  @param[in]      Operation     Signifies which particular SMBus hardware protocol\r
+                                instance to use to execute the SMBus transactions.\r
+  @param[in]      PecCheck      Defines if Packet Error Code (PEC) checking is required\r
+                                for this operation.\r
+  @param[in, out] Length        The number of bytes for this operation\r
+  @param[in, out] Buffer        Contains the value of data to execute to the SMBus slave device.\r
 \r
   @retval EFI_SUCCESS           The last data that was returned from the access\r
                                 matched the poll exit criteria.\r
-  @retval EFI_CRC_ERROR         The checksum is not correct (PEC is incorrect)\r
+  @retval EFI_CRC_ERROR         The checksum is not correct (PEC is incorrect).\r
   @retval EFI_TIMEOUT           Timeout expired before the operation was completed.\r
                                 Timeout is determined by the SMBus host controller device.\r
   @retval EFI_OUT_OF_RESOURCES  The request could not be completed\r
                                 due to a lack of resources.\r
   @retval EFI_DEVICE_ERROR      The request was not completed because\r
-                                a failure reflected in the Host Status Register bit.\r
+                                a failure was recorded in the Host Status Register bit.\r
   @retval EFI_INVALID_PARAMETER Operation is not defined in EFI_SMBUS_OPERATION.\r
-                                Or Length/Buffer is NULL for operations except for EfiSmbusQuickRead and\r
+  @retval EFI_INVALID_PARAMETER Length/Buffer is NULL for operations except for EfiSmbusQuickRead and\r
                                 EfiSmbusQuickWrite. Length is outside the range of valid values.\r
   @retval EFI_UNSUPPORTED       The SMBus operation or PEC is not supported.\r
   @retval EFI_BUFFER_TOO_SMALL  Buffer is not sufficient for this operation.\r
@@ -69,7 +66,7 @@ typedef
 EFI_STATUS\r
 (EFIAPI *EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION)(\r
   IN      EFI_PEI_SERVICES          **PeiServices,\r
-  IN EFI_PEI_SMBUS_PPI              *This,\r
+  IN      EFI_PEI_SMBUS_PPI         *This,\r
   IN      EFI_SMBUS_DEVICE_ADDRESS  SlaveAddress,\r
   IN      EFI_SMBUS_DEVICE_COMMAND  Command,\r
   IN      EFI_SMBUS_OPERATION       Operation,\r
@@ -79,42 +76,43 @@ EFI_STATUS
   );\r
 \r
 /**\r
-  CallBack function can be registered in EFI_PEI_SMBUS_PPI_NOTIFY.\r
+  This function is user-defined, and is called when the SlaveAddress/Data pair happens.\r
 \r
-  @param  PeiServices    A pointer to the system PEI Services Table.\r
-  @param  This           A pointer to the EFI_PEI_SMBUS_PPI instance.\r
-  @param  SlaveAddress   The SMBUS hardware address to which the SMBUS\r
-                         device is preassigned or allocated.\r
-  @param  Data           Data of the SMBus host notify command that\r
-                         the caller wants to be called.\r
+  @param[in]  PeiServices    A pointer to the system PEI Services Table.\r
+  @param[in]  This           A pointer to the EFI_PEI_SMBUS_PPI instance.\r
+  @param[in]  SlaveAddress   The SMBUS hardware address to which the SMBUS\r
+                             device is preassigned or allocated.\r
+  @param[in]  Data           Data of the SMBus host notify command, which denotes that\r
+                             the caller wants to be called.\r
 \r
-  @return Status Code\r
+  @return Status Code returned by callback function.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
 (EFIAPI *EFI_PEI_SMBUS_NOTIFY_FUNCTION)(\r
   IN      EFI_PEI_SERVICES              **PeiServices,\r
-  IN EFI_PEI_SMBUS_PPI                  *SmbusPpi,\r
+  IN      EFI_PEI_SMBUS_PPI             *SmbusPpi,\r
   IN      EFI_SMBUS_DEVICE_ADDRESS      SlaveAddress,\r
   IN      UINTN                         Data\r
   );\r
 \r
 /**\r
-  The ArpDevice() function enumerates the entire bus or enumerates a specific\r
-  device that is identified by SmbusUdid.\r
-\r
-  @param  PeiServices    A pointer to the system PEI Services Table.\r
-  @param  This           A pointer to the EFI_PEI_SMBUS_PPI instance.\r
-  @param  ArpAll         A Boolean expression that indicates if the host drivers need\r
-                         to enumerate all the devices or enumerate only the device that is identified\r
-                         by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional.\r
-                         If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address\r
-                         will be at SlaveAddress.\r
-  @param  SmbusUdid      The targeted SMBus Unique Device Identifier (UDID).\r
-                         The UDID may not exist for SMBus devices with fixed addresses.\r
-  @param  SlaveAddress   The new SMBus address for the slave device for\r
-                         which the operation is targeted.\r
+  The ArpDevice() function enumerates either the entire bus or a specific\r
+  device identified by SmbusUdid.\r
+\r
+  @param[in]      PeiServices   A pointer to the system PEI Services Table.\r
+  @param[in]      This          A pointer to the EFI_PEI_SMBUS_PPI instance.\r
+  @param[in]      ArpAll        A Boolean expression that indicates if the host drivers need\r
+                                to enumerate all the devices or enumerate only the device that is identified\r
+                                by SmbusUdid. If ArpAll is TRUE, SmbusUdid and SlaveAddress are optional and ignored if entered.\r
+                                If ArpAll is FALSE, ArpDevice will enumerate SmbusUdid and the address\r
+                                will be at SlaveAddress.\r
+  @param[in]      SmbusUdid     The targeted SMBus Unique Device Identifier (UDID).\r
+                                The UDID may not exist for SMBus devices with fixed addresses.\r
+  @param[in, out] SlaveAddress  The new SMBus address for the slave device for\r
+                                which the operation is targeted.\r
+                                This address may be NULL.\r
 \r
   @retval EFI_SUCCESS           The SMBus slave device address was set.\r
   @retval EFI_INVALID_PARAMETER SlaveAddress is NULL.\r
@@ -122,13 +120,16 @@ EFI_STATUS
                                 due to a lack of resources.\r
   @retval EFI_TIMEOUT           The SMBus slave device did not respond.\r
   @retval EFI_DEVICE_ERROR      The request was not completed because the transaction failed.\r
+  @retval EFI_UNSUPPORTED       ArpDevice() is not implemented by this PEIM. \r
+                                This return value is not defined in Framwork Specification.\r
+                                This return value was introduced in the PI Specification.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
 (EFIAPI *EFI_PEI_SMBUS_PPI_ARP_DEVICE)(\r
   IN      EFI_PEI_SERVICES          **PeiServices,\r
-  IN EFI_PEI_SMBUS_PPI              *This,\r
+  IN      EFI_PEI_SMBUS_PPI         *This,\r
   IN      BOOLEAN                   ArpAll,\r
   IN      EFI_SMBUS_UDID            *SmbusUdid, OPTIONAL\r
   IN OUT  EFI_SMBUS_DEVICE_ADDRESS  *SlaveAddress OPTIONAL\r
@@ -138,74 +139,86 @@ EFI_STATUS
   The GetArpMap() function returns the mapping of all the SMBus devices\r
   that are enumerated by the SMBus host driver.\r
 \r
-  @param  PeiServices    A pointer to the system PEI Services Table.\r
-  @param  This           A pointer to the EFI_PEI_SMBUS_PPI instance.\r
-  @param  Length         Size of the buffer that contains the SMBus device map.\r
-  @param  SmbusDeviceMap The pointer to the device map as enumerated\r
-                         by the SMBus controller driver.\r
+  @param[in]      PeiServices    A pointer to the system PEI Services Table.\r
+  @param[in]      This           A pointer to the EFI_PEI_SMBUS_PPI instance.\r
+  @param[in, out] Length         Size of the buffer that contains the SMBus device map.\r
+  @param[in, out] SmbusDeviceMap The pointer to the device map as enumerated\r
+                                 by the SMBus controller driver.\r
 \r
-  @retval EFI_SUCCESS           The device map was returned correctly in the buffer.\r
+  @retval EFI_SUCCESS       The device map was returned correctly in the buffer.\r
+  @retval EFI_UNSUPPORTED   GetArpMap() are not implemented by this PEIM. \r
+                            This return value was not defined in Framwork Specification.\r
+                            This return value was introduced in the PI Specification.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
 (EFIAPI *EFI_PEI_SMBUS_PPI_GET_ARP_MAP)(\r
   IN      EFI_PEI_SERVICES          **PeiServices,\r
-  IN EFI_PEI_SMBUS_PPI              *This,\r
+  IN      EFI_PEI_SMBUS_PPI         *This,\r
   IN OUT  UINTN                     *Length,\r
   IN OUT  EFI_SMBUS_DEVICE_MAP      **SmbusDeviceMap\r
   );\r
 \r
 /**\r
+  Allows a device driver to register for a callback when the bus driver detects a state that it needs to \r
+  propagate to other PEIMs that are registered for a callback.\r
+\r
   The Notify() function registers all the callback functions to allow the\r
   bus driver to call these functions when the SlaveAddress/Data pair happens.\r
-\r
-  @param  PeiServices    A pointer to the system PEI Services Table.\r
-  @param  This           A pointer to the EFI_PEI_SMBUS_PPI instance.\r
-  @param  SlaveAddress   Address that the host controller detects as\r
-                         sending a message and calls all the registered functions.\r
-  @param  Data           Data that the host controller detects as sending a message\r
-                         and calls all the registered functions.\r
-  @param  NotifyFunction The function to call when the bus driver\r
-                         detects the SlaveAddress and Data pair.\r
-\r
-  @retval EFI_SUCCESS           NotifyFunction has been registered.\r
+  All functions to be registered with EFI_PEI_SMBUS_PPI_NOTIFY must be of type\r
+  EFI_PEI_SMBUS_NOTIFY_FUNCTION.\r
+\r
+  @param[in] PeiServices    A pointer to the system PEI Services Table.\r
+  @param[in] This           A pointer to the EFI_PEI_SMBUS_PPI instance.\r
+  @param[in] SlaveAddress   Address that the host controller detects as\r
+                            sending a message and triggers all the registered functions.\r
+  @param[in] Data           Data that the host controller detects as sending a message\r
+                            and triggers all the registered functions.\r
+  @param[in] NotifyFunction The function to call when the bus driver\r
+                            detects the SlaveAddress and Data pair.\r
+\r
+  @retval EFI_SUCCESS       NotifyFunction has been registered.\r
+  @retval EFI_UNSUPPORTED   Notify() are not implemented by this PEIM. \r
+                            This return value is not defined in Framwork Specification.\r
+                            This return value was introduced in the PI Specification.\r
 \r
 **/\r
 typedef\r
 EFI_STATUS\r
 (EFIAPI *EFI_PEI_SMBUS_PPI_NOTIFY)(\r
-  IN      EFI_PEI_SERVICES          **PeiServices,\r
-  IN EFI_PEI_SMBUS_PPI              *This,\r
-  IN      EFI_SMBUS_DEVICE_ADDRESS  SlaveAddress,\r
-  IN      UINTN                     Data,\r
-  IN  EFI_PEI_SMBUS_NOTIFY_FUNCTION NotifyFunction\r
+  IN      EFI_PEI_SERVICES              **PeiServices,\r
+  IN      EFI_PEI_SMBUS_PPI             *This,\r
+  IN      EFI_SMBUS_DEVICE_ADDRESS      SlaveAddress,\r
+  IN      UINTN                         Data,\r
+  IN      EFI_PEI_SMBUS_NOTIFY_FUNCTION NotifyFunction\r
   );\r
 \r
-/**\r
-  @par Ppi Description:\r
-  Provides the basic I/O interfaces that a PEIM uses to access\r
-  its SMBus controller and the slave devices attached to it.\r
-\r
-  @param Execute\r
-  Executes the SMBus operation to an SMBus slave device.\r
-\r
-  @param ArpDevice\r
-  Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)\r
-\r
-  @param GetArpMap\r
-  Allows a PEIM to retrieve the address that was allocated by the SMBus\r
-  host controller during enumeration/ARP.\r
-\r
-  @param Notify\r
-  Allows a driver to register for a callback to the SMBus host\r
-  controller driver when the bus issues a notification to the bus controller PEIM.\r
-\r
-**/\r
+///\r
+/// Provides the basic I/O interfaces that a PEIM uses to access\r
+/// its SMBus controller and the slave devices attached to it.\r
+///\r
 struct _EFI_PEI_SMBUS_PPI {\r
+  ///\r
+  /// Executes the SMBus operation to an SMBus slave device.\r
+  ///\r
   EFI_PEI_SMBUS_PPI_EXECUTE_OPERATION Execute;\r
+  \r
+  ///\r
+  /// Allows an SMBus 2.0 device(s) to be Address Resolution Protocol (ARP)\r
+  ///\r
   EFI_PEI_SMBUS_PPI_ARP_DEVICE        ArpDevice;\r
+  \r
+  ///\r
+  /// Allows a PEIM to retrieve the address that was allocated by the SMBus\r
+  /// host controller during enumeration/ARP.  \r
+  ///\r
   EFI_PEI_SMBUS_PPI_GET_ARP_MAP       GetArpMap;\r
+  \r
+  ///\r
+  /// Allows a driver to register for a callback to the SMBus host\r
+  /// controller driver when the bus issues a notification to the bus controller PEIM.  \r
+  ///\r
   EFI_PEI_SMBUS_PPI_NOTIFY            Notify;\r
 };\r
 \r