]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add BaseSmbusLibNull instance for SmbusLib. Add check in BootScriptExecutorDxe driver...
authorShumin Qiu <shumin.qiu@intel.com>
Fri, 8 Nov 2013 02:59:05 +0000 (02:59 +0000)
committershenshushi <shenshushi@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 8 Nov 2013 02:59:05 +0000 (02:59 +0000)
Signed-off-by: Shumin Qiu <shumin.qiu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14830 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c
MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.c [new file with mode: 0644]
MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf [new file with mode: 0644]
MdePkg/MdePkg.dsc

index c5eec24e0e3df8317ee27ddbe810b8cd7950ac54..e34ead59fa1a820b96ea43dc93e90a993e0cba55 100644 (file)
@@ -68,6 +68,16 @@ S3BootScriptExecutorEntryFunction (
   // for that parameter.\r
   //\r
   Status = S3BootScriptExecute ();\r
+  \r
+  //\r
+  // If invalid script table or opcode in S3 boot script table.\r
+  //\r
+  ASSERT_EFI_ERROR (Status);\r
+  \r
+  if (EFI_ERROR (Status)) {\r
+    CpuDeadLoop ();\r
+    return Status;\r
+  }\r
 \r
   AsmWbinvd ();\r
 \r
diff --git a/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.c b/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.c
new file mode 100644 (file)
index 0000000..32bead9
--- /dev/null
@@ -0,0 +1,544 @@
+/** @file\r
+Null implementation of SmBusLib class library.\r
+\r
+Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
+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
+http://opensource.org/licenses/bsd-license.php.\r
+\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
+**/\r
+\r
+#include <Base.h>\r
+#include <Library/SmbusLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
+/**\r
+  Executes an SMBUS quick read command.\r
+\r
+  Executes an SMBUS quick read command on the SMBUS device specified by SmBusAddress.\r
+  Only the SMBUS slave address field of SmBusAddress is required.\r
+  If Status is not NULL, then the status of the executed command is returned in Status.\r
+  If PEC is set in SmBusAddress, then ASSERT().\r
+  If Command in SmBusAddress is not zero, then ASSERT().\r
+  If Length in SmBusAddress is not zero, 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  Status        Return status for the executed command.\r
+                        This is an optional parameter and may be NULL.\r
+                        RETURN_SUCCESS  The SMBUS command was executed.\r
+                        RETURN_TIMEOUT  A timeout occurred while executing the SMBUS command.\r
+                        RETURN_DEVICE_ERROR The request was not completed because a failure\r
+                        reflected in the Host Status Register bit.  Device errors are a result\r
+                        of a transaction collision, illegal command field, unclaimed cycle\r
+                        (host initiated), or bus errors (collisions).\r
+                        RETURN_UNSUPPORTED  The SMBus operation is not supported.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+SmBusQuickRead (\r
+  IN  UINTN                     SmBusAddress,\r
+  OUT RETURN_STATUS             *Status       OPTIONAL\r
+  )\r
+{\r
+  ASSERT (!SMBUS_LIB_PEC (SmBusAddress));\r
+  ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0);\r
+  ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);\r
+  ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);\r
+  if (Status != NULL) {\r
+    *Status = RETURN_UNSUPPORTED;\r
+  }\r
+}\r
+\r
+/**\r
+  Executes an SMBUS quick write command.\r
+\r
+  Executes an SMBUS quick write command on the SMBUS device specified by SmBusAddress.\r
+  Only the SMBUS slave address field of SmBusAddress is required.\r
+  If Status is not NULL, then the status of the executed command is returned in Status.\r
+  If PEC is set in SmBusAddress, then ASSERT().\r
+  If Command in SmBusAddress is not zero, then ASSERT().\r
+  If Length in SmBusAddress is not zero, 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  Status        Return status for the executed command.\r
+                        This is an optional parameter and may be NULL.\r
+                        RETURN_SUCCESS The SMBUS command was executed.\r
+                        RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.\r
+                        RETURN_DEVICE_ERROR  The request was not completed because a failure\r
+                        reflected in the Host Status Register bit.  Device errors are a result\r
+                        of a transaction collision, illegal command field, unclaimed cycle\r
+                        (host initiated), or bus errors (collisions).\r
+                        RETURN_UNSUPPORTED  The SMBus operation is not supported.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+SmBusQuickWrite (\r
+  IN  UINTN                     SmBusAddress,\r
+  OUT RETURN_STATUS             *Status       OPTIONAL\r
+  )\r
+{\r
+  ASSERT (!SMBUS_LIB_PEC (SmBusAddress));\r
+  ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0);\r
+  ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);\r
+  ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);\r
+  if (Status != NULL) {\r
+    *Status = RETURN_UNSUPPORTED;\r
+  }\r
+}\r
+\r
+/**\r
+  Executes an SMBUS receive byte command.\r
+\r
+  Executes an SMBUS receive byte command on the SMBUS device specified by SmBusAddress.\r
+  Only the SMBUS slave address field of SmBusAddress is required.\r
+  The byte received from the SMBUS is returned.\r
+  If Status is not NULL, then the status of the executed command is returned in Status.\r
+  If Command in SmBusAddress is not zero, then ASSERT().\r
+  If Length in SmBusAddress is not zero, 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  Status        Return status for the executed command.\r
+                        This is an optional parameter and may be NULL.\r
+                        RETURN_SUCCESS The SMBUS command was executed.\r
+                        RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.\r
+                        RETURN_DEVICE_ERROR  The request was not completed because a failure\r
+                        reflected in the Host Status Register bit.  Device errors are a result\r
+                        of a transaction collision, illegal command field, unclaimed cycle\r
+                        (host initiated), or bus errors (collisions).\r
+                        RETURN_CRC_ERROR  The checksum is not correct (PEC is incorrect)\r
+                        RETURN_UNSUPPORTED  The SMBus operation is not supported.\r
+\r
+  @return The byte received from the SMBUS.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+SmBusReceiveByte (\r
+  IN  UINTN          SmBusAddress,\r
+  OUT RETURN_STATUS  *Status        OPTIONAL\r
+  )\r
+{\r
+  ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0);\r
+  ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);\r
+  ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);\r
+  if (Status != NULL) {\r
+    *Status = RETURN_UNSUPPORTED;\r
+  }\r
+  return 0;\r
+}\r
+\r
+/**\r
+  Executes an SMBUS send byte command.\r
+\r
+  Executes an SMBUS send byte command on the SMBUS device specified by SmBusAddress.\r
+  The byte specified by Value is sent.\r
+  Only the SMBUS slave address field of SmBusAddress is required.  Value is returned.\r
+  If Status is not NULL, then the status of the executed command is returned in Status.\r
+  If Command in SmBusAddress is not zero, then ASSERT().\r
+  If Length in SmBusAddress is not zero, 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  Value         The 8-bit value to send.\r
+  @param  Status        Return status for the executed command.\r
+                        This is an optional parameter and may be NULL.\r
+                        RETURN_SUCCESS The SMBUS command was executed.\r
+                        RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.\r
+                        RETURN_DEVICE_ERROR  The request was not completed because a failure\r
+                        reflected in the Host Status Register bit.  Device errors are a result\r
+                        of a transaction collision, illegal command field, unclaimed cycle\r
+                        (host initiated), or bus errors (collisions).\r
+                        RETURN_CRC_ERROR  The checksum is not correct (PEC is incorrect)\r
+                        RETURN_UNSUPPORTED  The SMBus operation is not supported.\r
+\r
+  @return The parameter of Value.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+SmBusSendByte (\r
+  IN  UINTN          SmBusAddress,\r
+  IN  UINT8          Value,\r
+  OUT RETURN_STATUS  *Status        OPTIONAL\r
+  )\r
+{\r
+  ASSERT (SMBUS_LIB_COMMAND (SmBusAddress) == 0);\r
+  ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);\r
+  ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);\r
+  if (Status != NULL) {\r
+    *Status = RETURN_UNSUPPORTED;\r
+  }\r
+  return 0;\r
+}\r
+\r
+/**\r
+  Executes an SMBUS read data byte command.\r
+\r
+  Executes an SMBUS read data byte command on the SMBUS device specified by SmBusAddress.\r
+  Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.\r
+  The 8-bit value read from the SMBUS is returned.\r
+  If Status is not NULL, then the status of the executed command is returned in Status.\r
+  If Length in SmBusAddress is not zero, 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  Status        Return status for the executed command.\r
+                        This is an optional parameter and may be NULL.\r
+                        RETURN_SUCCESS The SMBUS command was executed.\r
+                        RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.\r
+                        RETURN_DEVICE_ERROR  The request was not completed because a failure\r
+                        reflected in the Host Status Register bit.  Device errors are a result\r
+                        of a transaction collision, illegal command field, unclaimed cycle\r
+                        (host initiated), or bus errors (collisions).\r
+                        RETURN_CRC_ERROR  The checksum is not correct (PEC is incorrect)\r
+                        RETURN_UNSUPPORTED  The SMBus operation is not supported.\r
+\r
+  @return The byte read from the SMBUS.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+SmBusReadDataByte (\r
+  IN  UINTN          SmBusAddress,\r
+  OUT RETURN_STATUS  *Status        OPTIONAL\r
+  )\r
+{\r
+  ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);\r
+  ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);\r
+  if (Status != NULL) {\r
+    *Status = RETURN_UNSUPPORTED;\r
+  }\r
+  return 0;\r
+}\r
+\r
+/**\r
+  Executes an SMBUS write data byte command.\r
+\r
+  Executes an SMBUS write data byte command on the SMBUS device specified by SmBusAddress.\r
+  The 8-bit value specified by Value is written.\r
+  Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.\r
+  Value is returned.\r
+  If Status is not NULL, then the status of the executed command is returned in Status.\r
+  If Length in SmBusAddress is not zero, 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  Value         The 8-bit value to write.\r
+  @param  Status        Return status for the executed command.\r
+                        This is an optional parameter and may be NULL.\r
+                        RETURN_SUCCESS The SMBUS command was executed.\r
+                        RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.\r
+                        RETURN_DEVICE_ERROR  The request was not completed because a failure\r
+                        reflected in the Host Status Register bit.  Device errors are a result\r
+                        of a transaction collision, illegal command field, unclaimed cycle\r
+                        (host initiated), or bus errors (collisions).\r
+                        RETURN_CRC_ERROR  The checksum is not correct (PEC is incorrect)\r
+                        RETURN_UNSUPPORTED  The SMBus operation is not supported.\r
+\r
+  @return The parameter of Value.\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+SmBusWriteDataByte (\r
+  IN  UINTN          SmBusAddress,\r
+  IN  UINT8          Value,\r
+  OUT RETURN_STATUS  *Status        OPTIONAL\r
+  )\r
+{\r
+  ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);\r
+  ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);\r
+  if (Status != NULL) {\r
+    *Status = RETURN_UNSUPPORTED;\r
+  }\r
+  return 0;\r
+}\r
+\r
+/**\r
+  Executes an SMBUS read data word command.\r
+\r
+  Executes an SMBUS read data word command on the SMBUS device specified by SmBusAddress.\r
+  Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.\r
+  The 16-bit value read from the SMBUS is returned.\r
+  If Status is not NULL, then the status of the executed command is returned in Status.\r
+  If Length in SmBusAddress is not zero, 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  Status        Return status for the executed command.\r
+                        This is an optional parameter and may be NULL.\r
+                        RETURN_SUCCESS The SMBUS command was executed.\r
+                        RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.\r
+                        RETURN_DEVICE_ERROR  The request was not completed because a failure\r
+                        reflected in the Host Status Register bit.  Device errors are a result\r
+                        of a transaction collision, illegal command field, unclaimed cycle\r
+                        (host initiated), or bus errors (collisions).\r
+                        RETURN_CRC_ERROR  The checksum is not correct (PEC is incorrect)\r
+                        RETURN_UNSUPPORTED  The SMBus operation is not supported.\r
+\r
+  @return The byte read from the SMBUS.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+SmBusReadDataWord (\r
+  IN  UINTN          SmBusAddress,\r
+  OUT RETURN_STATUS  *Status        OPTIONAL\r
+  )\r
+{\r
+  ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);\r
+  ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);\r
+  if (Status != NULL) {\r
+    *Status = RETURN_UNSUPPORTED;\r
+  }\r
+  return 0;\r
+}\r
+\r
+/**\r
+  Executes an SMBUS write data word command.\r
+\r
+  Executes an SMBUS write data word command on the SMBUS device specified by SmBusAddress.\r
+  The 16-bit value specified by Value is written.\r
+  Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.\r
+  Value is returned.\r
+  If Status is not NULL, then the status of the executed command is returned in Status.\r
+  If Length in SmBusAddress is not zero, 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  Value         The 16-bit value to write.\r
+  @param  Status        Return status for the executed command.\r
+                        This is an optional parameter and may be NULL.\r
+                        RETURN_SUCCESS The SMBUS command was executed.\r
+                        RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.\r
+                        RETURN_DEVICE_ERROR  The request was not completed because a failure\r
+                        reflected in the Host Status Register bit.  Device errors are a result\r
+                        of a transaction collision, illegal command field, unclaimed cycle\r
+                        (host initiated), or bus errors (collisions).\r
+                        RETURN_CRC_ERROR  The checksum is not correct (PEC is incorrect)\r
+                        RETURN_UNSUPPORTED  The SMBus operation is not supported.\r
+\r
+  @return The parameter of Value.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+SmBusWriteDataWord (\r
+  IN  UINTN          SmBusAddress,\r
+  IN  UINT16         Value,\r
+  OUT RETURN_STATUS  *Status        OPTIONAL\r
+  )\r
+{\r
+  ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);\r
+  ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);\r
+  if (Status != NULL) {\r
+    *Status = RETURN_UNSUPPORTED;\r
+  }\r
+  return 0;\r
+}\r
+\r
+/**\r
+  Executes an SMBUS process call command.\r
+\r
+  Executes an SMBUS process call command on the SMBUS device specified by SmBusAddress.\r
+  The 16-bit value specified by Value is written.\r
+  Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.\r
+  The 16-bit value returned by the process call command is returned.\r
+  If Status is not NULL, then the status of the executed command is returned in Status.\r
+  If Length in SmBusAddress is not zero, 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  Value         The 16-bit value to write.\r
+  @param  Status        Return status for the executed command.\r
+                        This is an optional parameter and may be NULL.\r
+                        RETURN_SUCCESS The SMBUS command was executed.\r
+                        RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.\r
+                        RETURN_DEVICE_ERROR  The request was not completed because a failure\r
+                        reflected in the Host Status Register bit.  Device errors are a result\r
+                        of a transaction collision, illegal command field, unclaimed cycle\r
+                        (host initiated), or bus errors (collisions).\r
+                        RETURN_CRC_ERROR  The checksum is not correct (PEC is incorrect)\r
+                        RETURN_UNSUPPORTED  The SMBus operation is not supported.\r
+\r
+  @return The 16-bit value returned by the process call command.\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+SmBusProcessCall (\r
+  IN  UINTN          SmBusAddress,\r
+  IN  UINT16         Value,\r
+  OUT RETURN_STATUS  *Status        OPTIONAL\r
+  )\r
+{\r
+  ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);\r
+  ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);\r
+  if (Status != NULL) {\r
+    *Status = RETURN_UNSUPPORTED;\r
+  }\r
+  return 0;\r
+}\r
+\r
+/**\r
+  Executes an SMBUS read block command.\r
+\r
+  Executes an SMBUS read block command on the SMBUS device specified by SmBusAddress.\r
+  Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required.\r
+  Bytes are read from the SMBUS and stored in Buffer.\r
+  The number of bytes read is returned, and will never return a value larger than 32-bytes.\r
+  If Status is not NULL, then the status of the executed command is returned in Status.\r
+  It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read.\r
+  SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes.\r
+  If Length in SmBusAddress is not zero, then ASSERT().\r
+  If Buffer 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  Buffer        Pointer to the buffer to store the bytes read from the SMBUS.\r
+  @param  Status        Return status for the executed command.\r
+                        This is an optional parameter and may be NULL.\r
+                        RETURN_SUCCESS The SMBUS command was executed.\r
+                        RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.\r
+                        RETURN_DEVICE_ERROR  The request was not completed because a failure\r
+                        reflected in the Host Status Register bit.  Device errors are a result\r
+                        of a transaction collision, illegal command field, unclaimed cycle\r
+                        (host initiated), or bus errors (collisions).\r
+                        RETURN_CRC_ERROR  The checksum is not correct (PEC is incorrect)\r
+                        RETURN_UNSUPPORTED  The SMBus operation is not supported.\r
+\r
+  @return The number of bytes read.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+SmBusReadBlock (\r
+  IN  UINTN          SmBusAddress,\r
+  OUT VOID           *Buffer,\r
+  OUT RETURN_STATUS  *Status        OPTIONAL\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);\r
+  ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);\r
+  if (Status != NULL) {\r
+    *Status = RETURN_UNSUPPORTED;\r
+  }\r
+  return 0;\r
+}\r
+\r
+/**\r
+  Executes an SMBUS write block command.\r
+\r
+  Executes an SMBUS write block command on the SMBUS device specified by SmBusAddress.\r
+  The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required.\r
+  Bytes are written to the SMBUS from Buffer.\r
+  The number of bytes written is returned, and will never return a value larger than 32-bytes.\r
+  If Status is not NULL, then the status of the executed command is returned in Status.  \r
+  If Length in SmBusAddress is zero or greater than 32, then ASSERT().\r
+  If Buffer 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  Buffer        Pointer to the buffer to store the bytes read from the SMBUS.\r
+  @param  Status        Return status for the executed command.\r
+                        This is an optional parameter and may be NULL.\r
+                        RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.\r
+                        RETURN_DEVICE_ERROR  The request was not completed because a failure\r
+                        reflected in the Host Status Register bit.  Device errors are a result\r
+                        of a transaction collision, illegal command field, unclaimed cycle\r
+                        (host initiated), or bus errors (collisions).\r
+                        RETURN_CRC_ERROR  The checksum is not correct (PEC is incorrect)\r
+                        RETURN_UNSUPPORTED  The SMBus operation is not supported.\r
+\r
+  @return The number of bytes written.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+SmBusWriteBlock (\r
+  IN  UINTN          SmBusAddress,\r
+  OUT VOID           *Buffer,\r
+  OUT RETURN_STATUS  *Status        OPTIONAL\r
+  )\r
+{\r
+  ASSERT (Buffer != NULL);\r
+  ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) >= 1);\r
+  ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) <= 32);\r
+  ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);\r
+  if (Status != NULL) {\r
+    *Status = RETURN_UNSUPPORTED;\r
+  }\r
+  return 0;\r
+}\r
+\r
+/**\r
+  Executes an SMBUS block process call command.\r
+\r
+  Executes an SMBUS block process call command on the SMBUS device specified by SmBusAddress.\r
+  The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required.\r
+  Bytes are written to the SMBUS from WriteBuffer.  Bytes are then read from the SMBUS into ReadBuffer.\r
+  If Status is not NULL, then the status of the executed command is returned in Status.\r
+  It is the caller's responsibility to make sure ReadBuffer is large enough for the total number of bytes read.\r
+  SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes.\r
+  If Length in SmBusAddress is zero or greater than 32, then ASSERT().\r
+  If WriteBuffer is NULL, then ASSERT().\r
+  If ReadBuffer 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  WriteBuffer   Pointer to the buffer of bytes to write to the SMBUS.\r
+  @param  ReadBuffer    Pointer to the buffer of bytes to read from the SMBUS.\r
+  @param  Status        Return status for the executed command.\r
+                        This is an optional parameter and may be NULL.\r
+                        RETURN_TIMEOUT A timeout occurred while executing the SMBUS command.\r
+                        RETURN_DEVICE_ERROR  The request was not completed because a failure\r
+                        reflected in the Host Status Register bit.  Device errors are a result\r
+                        of a transaction collision, illegal command field, unclaimed cycle\r
+                        (host initiated), or bus errors (collisions).\r
+                        RETURN_CRC_ERROR  The checksum is not correct (PEC is incorrect)\r
+                        RETURN_UNSUPPORTED  The SMBus operation is not supported.\r
+\r
+  @return The number of bytes written.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+SmBusBlockProcessCall (\r
+  IN  UINTN          SmBusAddress,\r
+  IN  VOID           *WriteBuffer,\r
+  OUT VOID           *ReadBuffer,\r
+  OUT RETURN_STATUS  *Status        OPTIONAL\r
+  )\r
+{\r
+  ASSERT (WriteBuffer != NULL);\r
+  ASSERT (ReadBuffer  != NULL);\r
+  ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) >= 1);\r
+  ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) <= 32);\r
+  ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);\r
+  if (Status != NULL) {\r
+    *Status = RETURN_UNSUPPORTED;\r
+  }\r
+  return 0;\r
+}\r
diff --git a/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf b/MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
new file mode 100644 (file)
index 0000000..c0c0f6b
--- /dev/null
@@ -0,0 +1,34 @@
+## @file\r
+# Null implementation of the SMBUS Library.\r
+#\r
+# Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
+#\r
+#  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
+#  http://opensource.org/licenses/bsd-license.php.\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
+##\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = BaseSmbusLibNull\r
+  FILE_GUID                      = E2ECA273-A1C0-407E-9A5C-F10C55142196\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = SmbusLib\r
+\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources]\r
+  BaseSmbusLibNull.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+\r
+[LibraryClasses]\r
+  DebugLib\r
index fa1e6d71cff700291672162dff305bfbe90bad6a..389c4eb05444a10be8bfda0ff459b5c1e81a2db2 100644 (file)
@@ -79,6 +79,7 @@
   MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf\r
   MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf\r
   MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf\r
+  MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf\r
 \r
   MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf\r
   MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf\r