#ifndef __SMBUS_LIB__\r
#define __SMBUS_LIB__\r
\r
+//\r
+// PEC BIT is bit 21 in SMBUS address\r
+//\r
+#define SMBUS_LIB_PEC_BIT (1 << 21)\r
+\r
/**\r
Macro that converts SMBUS slave address, SMBUS command, SMBUS data length,\r
and PEC to a value that can be passed to the SMBUS Library functions.\r
\r
@param SlaveAddress SMBUS Slave Address. Range 0..127.\r
@param Command SMBUS Command. Range 0..255.\r
- @param Length SMBUS Data Length. Range 0..32.\r
+ @param Length SMBUS Data Length. Range 0..31.\r
@param Pec TRUE if Packet Error Checking is enabled. Otherwise FALSE.\r
\r
**/\r
#define SMBUS_LIB_ADDRESS(SlaveAddress,Command,Length,Pec) \\r
- ( ((Pec) ? MAX_BIT : 0) | \\r
- (((SlaveAddress) & 0x7f) << 1) | \\r
- (((Command) & 0xff) << 8) | \\r
- (((Length) & 0x1f) << 16) \\r
+ ( ((Pec) ? SMBUS_LIB_PEC_BIT: 0) | \\r
+ (((SlaveAddress) & 0x7f) << 1) | \\r
+ (((Command) & 0xff) << 8) | \\r
+ (((Length) & 0x1f) << 16) \\r
)\r
\r
/**\r
This is an optional parameter and may be NULL.\r
\r
**/\r
-BOOLEAN\r
+VOID\r
EFIAPI\r
SmBusQuickWrite (\r
IN UINTN SmBusAddress,\r
EFIAPI\r
SmBusBlockProcessCall (\r
IN UINTN SmBusAddress,\r
- OUT VOID *OutBuffer,\r
+ IN VOID *OutBuffer,\r
OUT VOID *InBuffer,\r
OUT RETURN_STATUS *Status OPTIONAL\r
)\r
;\r
\r
-/**\r
- Enumerates the SMBUS and assigns slave addresses.\r
-\r
- Executes the SMBUS enumeration algorithm and assigns a valid address to all SMBUS slave devices.\r
- The total number of SMBUS slave devices detected is returned.\r
- The status of the executed command is returned.\r
- If Slave Address in SmBusAddress is not zero, then ASSERT().\r
- If Command in SmBusAddress is not zero, then ASSERT().\r
- If Length in SmBusAddress is not zero, then ASSERT().\r
- If PEC in SmBusAddress is set, then ASSERT().\r
- If any reserved bits of SmBusAddress are set, then ASSERT().\r
-\r
- @param SmBusAddress Address that encodes the SMBUS Slave Address,\r
- SMBUS Command, SMBUS Data Length, and PEC.\r
-\r
- @retval RETURN_SUCCESS The SMBUS command was executed.\r
- @retval RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.\r
- @retval RETURN_DEVICE_ERROR The request was not completed because a failure reflected\r
- in the Host Status Register bit.\r
- Device errors are a result of a transaction collision, illegal command field,\r
- unclaimed cycle (host initiated), or bus errors (collisions).\r
-\r
-**/\r
-RETURN_STATUS\r
-EFIAPI\r
-SmBusArpAll (\r
- IN UINTN SmBusAddress\r
- )\r
-;\r
-\r
-/**\r
- Assigns an SMBUS slave addresses.\r
-\r
- Assigns the SMBUS device specified by Uuid the slave address specified by SmBusAddress.\r
- The status of the executed command is returned.\r
- If Command in SmBusAddress is not zero, then ASSERT().\r
- If Length in SmBusAddress is not zero, then ASSERT().\r
- If PEC in SmBusAddress is set, then ASSERT().\r
- If any reserved bits of SmBusAddress are set, then ASSERT().\r
-\r
- @param SmBusAddress Address that encodes the SMBUS Slave Address,\r
- SMBUS Command, SMBUS Data Length, and PEC.\r
- @param Uuid Pointer to the UUID of the device to assign a slave address.\r
-\r
- @retval RETURN_SUCCESS The SMBUS command was executed.\r
- @retval RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.\r
- @retval RETURN_DEVICE_ERROR The request was not completed because a failure reflected\r
- in the Host Status Register bit.\r
- Device errors are a result of a transaction collision, illegal command field,\r
- unclaimed cycle (host initiated), or bus errors (collisions).\r
-\r
-**/\r
-RETURN_STATUS\r
-EFIAPI\r
-SmBusArpDevice (\r
- IN UINTN SmBusAddress,\r
- IN CONST GUID *Uuid\r
- )\r
-;\r
-\r
-/**\r
- Retrieves the UUID associated with an SMBUS slave device.\r
-\r
- Retrieves the UUID associated with the slave address specified\r
- by SmBusAddress and returns the UUID in Uuid.\r
- The status of the executed command is returned.\r
- If Command in SmBusAddress is not zero, then ASSERT().\r
- If Length in SmBusAddress is not zero, then ASSERT().\r
- If PEC in SmBusAddress is set, then ASSERT().\r
- If Uuid is NULL, then ASSERT().\r
- If any reserved bits of SmBusAddress are set, then ASSERT().\r
-\r
- @param SmBusAddress Address that encodes the SMBUS Slave Address,\r
- SMBUS Command, SMBUS Data Length, and PEC.\r
- @param Uuid Pointer to the UUID retrieved from the SMBUS slave device.\r
-\r
- @retval RETURN_SUCCESS The SMBUS command was executed.\r
- @retval RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.\r
- @retval RETURN_DEVICE_ERROR The request was not completed because a failure reflected\r
- in the Host Status Register bit.\r
- Device errors are a result of a transaction collision, illegal command field,\r
- unclaimed cycle (host initiated), or bus errors (collisions).\r
-\r
-**/\r
-RETURN_STATUS\r
-EFIAPI\r
-SmBusGetUuid (\r
- IN UINTN SmBusAddress,\r
- OUT GUID *Uuid\r
- )\r
-;\r
-\r
#endif\r