summaryrefslogtreecommitdiff
path: root/ChvRefCodePkg
diff options
context:
space:
mode:
authorGuo Mang <mang.guo@intel.com>2016-06-02 13:55:52 +0800
committerHao Wu <hao.a.wu@intel.com>2016-06-07 09:55:40 +0800
commite3395bffc8853ca23fd8485efe0e83e7b6d4e5e3 (patch)
tree2b583aec0a6bea6dcc62fd3e8203ff48b679379c /ChvRefCodePkg
parent002944e3a94e9bc1cd80726a8eeb4841bb426742 (diff)
downloadedk2-platforms-e3395bffc8853ca23fd8485efe0e83e7b6d4e5e3.tar.xz
ChvRefCodePkg: Add PchSmbusLib.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang <mang.guo@intel.com>
Diffstat (limited to 'ChvRefCodePkg')
-rw-r--r--ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Common/PchSmbusLib.c49
-rw-r--r--ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Dxe/PchSmbusLib.h20
-rw-r--r--ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Dxe/PchSmbusLibDxe.inf41
-rw-r--r--ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Pei/PchSmbusLib.h20
-rw-r--r--ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Pei/PchSmbusLibPei.inf41
5 files changed, 171 insertions, 0 deletions
diff --git a/ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Common/PchSmbusLib.c b/ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Common/PchSmbusLib.c
new file mode 100644
index 0000000000..109fdb70a8
--- /dev/null
+++ b/ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Common/PchSmbusLib.c
@@ -0,0 +1,49 @@
+/** @file
+ This file contains routines that support PCH SMBUS FUNCTION
+
+ Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
+
+ 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.
+
+**/
+
+#include "PchSmbusLib.h"
+
+/**
+ This function provides a standard way to execute Smbus sequential
+ I2C Read. This function allows the PCH to perform block reads to
+ certain I2C devices, such as serial E2PROMs. Typically these data
+ bytes correspond to an offset (address) within the serial memory
+ chips.
+
+ @param[in] SmBusAddress Address that encodes the SMBUS Slave Address,
+ SMBUS Command, SMBUS Data Length, and PEC.
+ @param[out] Buffer Pointer to the buffer to store the bytes read
+ from the SMBUS
+ @param[out] Status eturn status for the executed command.
+
+ @retval UINTN The number of bytes read
+**/
+UINTN
+EFIAPI
+SmBusSeqI2CRead (
+ IN UINTN SmBusAddress,
+ OUT VOID *Buffer,
+ OUT RETURN_STATUS * Status OPTIONAL
+ )
+{
+ UINTN Length;
+
+ ASSERT (Buffer != NULL);
+ ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) >= 1);
+ ASSERT (SMBUS_LIB_RESEARVED (SmBusAddress) == 0);
+
+ Length = SMBUS_LIB_LENGTH (SmBusAddress);
+ return InternalSmBusExec (EfiSmbusReadByte, SmBusAddress, Length, Buffer, Status);
+}
diff --git a/ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Dxe/PchSmbusLib.h b/ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Dxe/PchSmbusLib.h
new file mode 100644
index 0000000000..45c1567649
--- /dev/null
+++ b/ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Dxe/PchSmbusLib.h
@@ -0,0 +1,20 @@
+/** @file
+ Header file for PCH Smbus DXE Lib implementation.
+
+ Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
+
+ 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.
+
+**/
+
+#ifndef _PCH_SMBUS_DXE_LIBRARY_IMPLEMENTATION_H_
+
+#include <Library/DxeSmBusLib/InternalSmbusLib.h>
+
+#endif
diff --git a/ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Dxe/PchSmbusLibDxe.inf b/ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Dxe/PchSmbusLibDxe.inf
new file mode 100644
index 0000000000..0f169972cd
--- /dev/null
+++ b/ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Dxe/PchSmbusLibDxe.inf
@@ -0,0 +1,41 @@
+## @file
+# DXE PCH Smbus Lib
+#
+# This function provides a standard way to execute Smbus sequential
+# I2C Read. This function allows the PCH to perform block reads to
+# certain I2C devices, such as serial E2PROMs. Typically these data
+# bytes correspond to an offset (address) within the serial memory
+# chips.
+#
+# Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.<BR>
+#
+# 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.
+#
+##
+
+[defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = PchSmbusLibDxe
+ FILE_GUID = D0388F40-9669-4fae-A995-C2B835B47089
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = PchSmbusLibDxe
+
+[sources.common]
+ ..\Common\PchSmbusLib.c
+ PchSmbusLib.h
+
+[Packages]
+ MdePkg/MdePkg.dec
+ ChvRefCodePkg/ChvRefCodePkg.dec
+
+[LibraryClasses]
+ DebugLib
+ IoLib
+
diff --git a/ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Pei/PchSmbusLib.h b/ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Pei/PchSmbusLib.h
new file mode 100644
index 0000000000..da3865c045
--- /dev/null
+++ b/ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Pei/PchSmbusLib.h
@@ -0,0 +1,20 @@
+/** @file
+ Header file for PCH Smbus PEI Lib implementation.
+
+ Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
+
+ 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.
+
+**/
+
+#ifndef _PCH_SMBUS_PEI_LIBRARY_IMPLEMENTATION_H_
+
+#include <Library/PeiSmbusLibSmbus2Ppi/InternalSmbusLib.h>
+
+#endif
diff --git a/ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Pei/PchSmbusLibPei.inf b/ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Pei/PchSmbusLibPei.inf
new file mode 100644
index 0000000000..08493b76a1
--- /dev/null
+++ b/ChvRefCodePkg/CherryViewSoc/SouthCluster/Library/PchSmbusLib/Pei/PchSmbusLibPei.inf
@@ -0,0 +1,41 @@
+## @file
+# PEI PCH Smbus Lib
+#
+# This function provides a standard way to execute Smbus sequential
+# I2C Read. This function allows the PCH to perform block reads to
+# certain I2C devices, such as serial E2PROMs. Typically these data
+# bytes correspond to an offset (address) within the serial memory
+# chips.
+#
+# Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.<BR>
+#
+# 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.
+#
+##
+
+[defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = PchSmbusLibPei
+ FILE_GUID = 500CE7F5-0A83-4094-9182-9C52762AC101
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = PchSmbusLibPei
+
+[sources.common]
+ ..\Common\PchSmbusLib.c
+ PchSmbusLib.h
+
+[Packages]
+ MdePkg/MdePkg.dec
+ ChvRefCodePkg/ChvRefCodePkg.dec
+
+[LibraryClasses]
+ DebugLib
+ IoLib
+