X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FLibrary%2FPeiSmbusLibSmbus2Ppi%2FSmbusLib.c;h=d644583ba75d27dfa3856d3da591f7e9928fe4ce;hb=9344f0921518309295da89c221d10cbead8531aa;hp=2d070ec5447356e3f6fba50ac8c685915b00076e;hpb=2fc59a003ed9104f9feebe0e418f2a04a50f3284;p=mirror_edk2.git diff --git a/MdePkg/Library/PeiSmbusLibSmbus2Ppi/SmbusLib.c b/MdePkg/Library/PeiSmbusLibSmbus2Ppi/SmbusLib.c index 2d070ec544..d644583ba7 100644 --- a/MdePkg/Library/PeiSmbusLibSmbus2Ppi/SmbusLib.c +++ b/MdePkg/Library/PeiSmbusLibSmbus2Ppi/SmbusLib.c @@ -1,14 +1,8 @@ /** @file Implementation of SmBusLib class library for PEI phase. -Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -30,13 +24,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. SMBUS Command, SMBUS Data Length, and PEC. @param Status Return status for the executed command. This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle + RETURN_SUCCESS: The SMBUS command was executed. + RETURN_TIMEOUT: A timeout occurred while executing the + SMBUS command. + RETURN_DEVICE_ERROR: The request was not completed because + a failure reflected in the Host Status Register bit. + Device errors are a result of a transaction collision, + illegal command field, unclaimed cycle (host initiated), or bus errors (collisions). - RETURN_UNSUPPORTED The SMBus operation is not supported. + RETURN_UNSUPPORTED: The SMBus operation is not supported. **/ VOID @@ -69,13 +65,15 @@ SmBusQuickRead ( SMBUS Command, SMBUS Data Length, and PEC. @param Status Return status for the executed command. This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_UNSUPPORTED The SMBus operation is not supported. + RETURN_SUCCESS: The SMBUS command was executed. + RETURN_TIMEOUT: A timeout occurred while executing the + SMBUS command. + RETURN_DEVICE_ERROR: The request was not completed because + a failure reflected in the Host Status Register bit. Device + errors are a result of a transaction collision, illegal + command field, unclaimed cycle (host initiated), or bus + errors (collisions). + RETURN_UNSUPPORTED:: The SMBus operation is not supported. **/ VOID @@ -108,14 +106,16 @@ SmBusQuickWrite ( SMBUS Command, SMBUS Data Length, and PEC. @param Status Return status for the executed command. This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. + RETURN_SUCCESS: The SMBUS command was executed. + RETURN_TIMEOUT: A timeout occurred while executing the + SMBUS command. + RETURN_DEVICE_ERROR: The request was not completed because + a failure reflected in the Host Status Register bit. + Device errors are a result of a transaction collision, + illegal command field, unclaimed cycle (host initiated), + or bus errors (collisions). + RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) + RETURN_UNSUPPORTED: The SMBus operation is not supported. @return The byte received from the SMBUS. @@ -154,14 +154,16 @@ SmBusReceiveByte ( @param Value The 8-bit value to send. @param Status Return status for the executed command. This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. + RETURN_SUCCESS: The SMBUS command was executed. + RETURN_TIMEOUT: A timeout occurred while executing the + SMBUS command. + RETURN_DEVICE_ERROR: The request was not completed because + a failure reflected in the Host Status Register bit. Device + errors are a result of a transaction collision, illegal + command field, unclaimed cycle (host initiated), or bus + errors (collisions). + RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) + RETURN_UNSUPPORTED: The SMBus operation is not supported. @return The parameter of Value. @@ -200,14 +202,16 @@ SmBusSendByte ( SMBUS Command, SMBUS Data Length, and PEC. @param Status Return status for the executed command. This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. + RETURN_SUCCESS: The SMBUS command was executed. + RETURN_TIMEOUT: A timeout occurred while executing the + SMBUS command. + RETURN_DEVICE_ERROR: The request was not completed because + a failure reflected in the Host Status Register bit. + Device errors are a result of a transaction collision, + illegal command field, unclaimed cycle (host initiated), + or bus errors (collisions). + RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) + RETURN_UNSUPPORTED: The SMBus operation is not supported. @return The byte read from the SMBUS. @@ -245,14 +249,16 @@ SmBusReadDataByte ( @param Value The 8-bit value to write. @param Status Return status for the executed command. This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. + RETURN_SUCCESS: The SMBUS command was executed. + RETURN_TIMEOUT: A timeout occurred while executing the + SMBUS command. + RETURN_DEVICE_ERROR: The request was not completed because + a failure reflected in the Host Status Register bit. + Device errors are a result of a transaction collision, + illegal command field, unclaimed cycle (host initiated), + or bus errors (collisions). + RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) + RETURN_UNSUPPORTED: The SMBus operation is not supported. @return The parameter of Value. @@ -285,19 +291,21 @@ SmBusWriteDataByte ( If Status is not NULL, then the status of the executed command is returned in Status. If Length in SmBusAddress is not zero, then ASSERT(). If any reserved bits of SmBusAddress are set, then ASSERT(). - + @param SmBusAddress The address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, and PEC. @param Status Return status for the executed command. This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. + RETURN_SUCCESS: The SMBUS command was executed. + RETURN_TIMEOUT: A timeout occurred while executing the + SMBUS command. + RETURN_DEVICE_ERROR: The request was not completed because + a failure reflected in the Host Status Register bit. + Device errors are a result of a transaction collision, + illegal command field, unclaimed cycle (host initiated), + or bus errors (collisions). + RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) + RETURN_UNSUPPORTED: The SMBus operation is not supported. @return The byte read from the SMBUS. @@ -335,14 +343,16 @@ SmBusReadDataWord ( @param Value The 16-bit value to write. @param Status Return status for the executed command. This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. + RETURN_SUCCESS: The SMBUS command was executed. + RETURN_TIMEOUT: A timeout occurred while executing the + SMBUS command. + RETURN_DEVICE_ERROR: The request was not completed because + a failure reflected in the Host Status Register bit. + Device errors are a result of a transaction collision, + illegal command field, unclaimed cycle (host initiated), + or bus errors (collisions). + RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) + RETURN_UNSUPPORTED: The SMBus operation is not supported. @return The parameter of Value. @@ -382,14 +392,16 @@ SmBusWriteDataWord ( @param Value The 16-bit value to write. @param Status Return status for the executed command. This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. + RETURN_SUCCESS: The SMBUS command was executed. + RETURN_TIMEOUT: A timeout occurred while executing the + SMBUS command. + RETURN_DEVICE_ERROR: The request was not completed because + a failure reflected in the Host Status Register bit. + Device errors are a result of a transaction collision, + illegal command field, unclaimed cycle (host initiated), + or bus errors (collisions). + RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) + RETURN_UNSUPPORTED: The SMBus operation is not supported. @return The 16-bit value returned by the process call command. @@ -429,14 +441,16 @@ SmBusProcessCall ( @param Buffer The pointer to the buffer to store the bytes read from the SMBUS. @param Status Return status for the executed command. This is an optional parameter and may be NULL. - RETURN_SUCCESS The SMBUS command was executed. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. + RETURN_SUCCESS: The SMBUS command was executed. + RETURN_TIMEOUT: A timeout occurred while executing the + SMBUS command. + RETURN_DEVICE_ERROR: The request was not completed because + a failure reflected in the Host Status Register bit. + Device errors are a result of a transaction collision, + illegal command field, unclaimed cycle (host initiated), + or bus errors (collisions). + RETURN_CRC_ERROR: The checksum is not correct. (PEC is incorrect.) + RETURN_UNSUPPORTED: The SMBus operation is not supported. @return The number of bytes read. @@ -463,7 +477,7 @@ SmBusReadBlock ( The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required. Bytes are written to the SMBUS from Buffer. The number of bytes written is returned, and will never return a value larger than 32-bytes. - If Status is not NULL, then the status of the executed command is returned in Status. + If Status is not NULL, then the status of the executed command is returned in Status. If Length in SmBusAddress is zero or greater than 32, then ASSERT(). If Buffer is NULL, then ASSERT(). If any reserved bits of SmBusAddress are set, then ASSERT(). @@ -473,13 +487,15 @@ SmBusReadBlock ( @param Buffer The pointer to the buffer to store the bytes read from the SMBUS. @param Status Return status for the executed command. This is an optional parameter and may be NULL. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. + RETURN_TIMEOUT: A timeout occurred while executing the + SMBUS command. + RETURN_DEVICE_ERROR: The request was not completed because + a failure reflected in the Host Status Register bit. + Device errors are a result of a transaction collision, + illegal command field, unclaimed cycle (host initiated), + or bus errors (collisions). + RETURN_CRC_ERROR: The checksum is not correct (PEC is incorrect) + RETURN_UNSUPPORTED: The SMBus operation is not supported. @return The number of bytes written. @@ -523,13 +539,15 @@ SmBusWriteBlock ( @param ReadBuffer The pointer to the buffer of bytes to read from the SMBUS. @param Status Return status for the executed command. This is an optional parameter and may be NULL. - RETURN_TIMEOUT A timeout occurred while executing the SMBUS command. - RETURN_DEVICE_ERROR The request was not completed because a failure - reflected in the Host Status Register bit. Device errors are a result - of a transaction collision, illegal command field, unclaimed cycle - (host initiated), or bus errors (collisions). - RETURN_CRC_ERROR The checksum is not correct (PEC is incorrect) - RETURN_UNSUPPORTED The SMBus operation is not supported. + RETURN_TIMEOUT: A timeout occurred while executing the + SMBUS command. + RETURN_DEVICE_ERROR: The request was not completed because + a failure reflected in the Host Status Register bit. + Device errors are a result of a transaction collision, + illegal command field, unclaimed cycle (host initiated), + or bus errors (collisions). + RETURN_CRC_ERROR The checksum is not correct. (PEC is incorrect.) + RETURN_UNSUPPORTED: The SMBus operation is not supported. @return The number of bytes written.