summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDoug Gilbert <dgilbert@us.ibm.com>2014-05-16 15:16:15 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-06-30 20:08:27 -0500
commit11d47db77ef4d118c75e9e23ad8c4ca9663d0fff (patch)
treedc0e09e93de108dc2cf44ef69d2688f7ab40944c /src
parent61a956f980a4be2f19d33067236018e7efd074e7 (diff)
downloadtalos-hostboot-11d47db77ef4d118c75e9e23ad8c4ca9663d0fff.tar.gz
talos-hostboot-11d47db77ef4d118c75e9e23ad8c4ca9663d0fff.zip
Merge GPIO commits from Stradale code base
Change-Id: Ibadeb72f563d86aa933734c7db20a50b19485ac7 RTC: 97490 Origin: Google Shared Technology Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/11501 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/build/tools/listdeps.pl6
-rw-r--r--src/include/usr/devicefw/userif.H16
-rw-r--r--src/include/usr/gpio/gpioddreasoncodes.H57
-rw-r--r--src/include/usr/gpio/gpioif.H42
-rw-r--r--src/include/usr/hbotcompid.H11
-rw-r--r--src/include/usr/hwpf/hwpf_reasoncodes.H8
-rw-r--r--src/include/usr/isteps/istep12list.H5
-rw-r--r--src/include/usr/isteps/istep13list.H5
-rw-r--r--src/makefile6
-rw-r--r--src/usr/gpio/HBconfig4
-rw-r--r--src/usr/gpio/gpiodd.C324
-rw-r--r--src/usr/gpio/gpiodd.H109
-rw-r--r--src/usr/gpio/makefile34
-rw-r--r--src/usr/hwpf/hwp/dram_training/HBconfig4
-rw-r--r--src/usr/hwpf/hwp/dram_training/dram_training.C127
-rw-r--r--src/usr/hwpf/hwp/dram_training/hbVddrMsg.C119
-rw-r--r--src/usr/hwpf/hwp/dram_training/makefile10
-rw-r--r--src/usr/hwpf/hwp/dram_training/palmetto_vddr.C231
-rw-r--r--src/usr/hwpf/hwp/dram_training/platform_vddr.H51
-rw-r--r--src/usr/initservice/extinitsvc/extinitsvctasks.H20
-rw-r--r--src/usr/makefile6
-rw-r--r--src/usr/targeting/common/xmltohb/attribute_types_hb.xml43
-rw-r--r--src/usr/targeting/common/xmltohb/target_types_hb.xml8
23 files changed, 1133 insertions, 113 deletions
diff --git a/src/build/tools/listdeps.pl b/src/build/tools/listdeps.pl
index 4c7998ef0..1b880cfe6 100755
--- a/src/build/tools/listdeps.pl
+++ b/src/build/tools/listdeps.pl
@@ -6,7 +6,10 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2013,2014
+# Contributors Listed Below - COPYRIGHT 2013,2014
+# [+] Google Inc.
+# [+] International Business Machines Corp.
+#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -205,6 +208,7 @@ my %resident_modules = (
"libfsiscom.so" => '1',
"libfsi.so" => '1',
"libscan.so" => '1',
+ "libgpio.so" => '1',
);
diff --git a/src/include/usr/devicefw/userif.H b/src/include/usr/devicefw/userif.H
index df66190d1..0e2497e48 100644
--- a/src/include/usr/devicefw/userif.H
+++ b/src/include/usr/devicefw/userif.H
@@ -5,7 +5,10 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* [+] Google Inc. */
+/* [+] International Business Machines Corp. */
+/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
@@ -54,7 +57,7 @@ namespace DeviceFW
CVPD,
SCAN,
EEPROM,
-
+ GPIO,
LAST_ACCESS_TYPE,
};
@@ -149,6 +152,15 @@ namespace DeviceFW
static_cast<uint64_t>(( i_offset ))
/**
+ * Construct the device addressing paramters for the GPIO port extender ops
+ * @param[in] i_gpio_num - The port extender device type.
+ * @param[in] i_gpio_pin = The GPIO port address
+ */
+ #define DEVICE_GPIO_ADDRESS( i_device_type , i_gpio_portAddr) \
+ DeviceFW::GPIO, static_cast<uint64_t>(( i_device_type )),\
+ static_cast<uint64_t>(( i_gpio_portAddr ))
+
+ /**
* @brief Perform a hardware read operation.
*
* @param[in] i_target Device target to operate on.
diff --git a/src/include/usr/gpio/gpioddreasoncodes.H b/src/include/usr/gpio/gpioddreasoncodes.H
new file mode 100644
index 000000000..20ad10002
--- /dev/null
+++ b/src/include/usr/gpio/gpioddreasoncodes.H
@@ -0,0 +1,57 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/gpio/gpioddreasoncodes.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2014 */
+/* [+] Google Inc. */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __GPIODDREASONCODES_H
+#define __GPIODDREASONCODES_H
+
+#include <hbotcompid.H>
+namespace GPIO
+{
+ /**
+ * @enum gpioModuleid
+ *
+ * @brief Module Ids used in creating errorlogs.
+ */
+ enum gpioModuleId
+ {
+ GPIO_PERFORM_OP = 0x00,
+ GPIO_READ = 0x01,
+ GPIO_WRITE = 0x02,
+ GPIO_READATTRIBUTES = 0x03,
+ };
+
+ /**
+ * @enum grioReasonCode
+ */
+ enum gpioReasonCode
+ {
+ GPIO_INVALID_DEVICE_TYPE = GPIO_COMP_ID | 0x00,
+ GPIO_ATTR_INFO_NOT_FOUND = GPIO_COMP_ID | 0x01,
+ GPIO_I2C_TARGET_NOT_FOUND = GPIO_COMP_ID | 0x02,
+ GPIO_INVALID_OP = GPIO_COMP_ID | 0x03,
+ };
+
+};
+#endif
diff --git a/src/include/usr/gpio/gpioif.H b/src/include/usr/gpio/gpioif.H
new file mode 100644
index 000000000..03a5a9a89
--- /dev/null
+++ b/src/include/usr/gpio/gpioif.H
@@ -0,0 +1,42 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/gpio/gpioif.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2014 */
+/* [+] Google Inc. */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __GPIOIF_H
+#define __GPIOIF_H
+
+namespace GPIO
+{
+/**
+ * @brief Devices to be accessed
+ */
+enum gpioDevice_t
+{
+ PCA95X_GPIO = 0,
+ INVALID_GPIO,
+};
+
+
+}; // GPIO NAMESPACE
+#endif
diff --git a/src/include/usr/hbotcompid.H b/src/include/usr/hbotcompid.H
index ec9b3836f..7b610e99c 100644
--- a/src/include/usr/hbotcompid.H
+++ b/src/include/usr/hbotcompid.H
@@ -5,7 +5,10 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* [+] Google Inc. */
+/* [+] International Business Machines Corp. */
+/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
@@ -315,6 +318,12 @@ const compId_t SBE_COMP_ID = 0x2200;
const char SBE_COMP_NAME[] = "sbe";
//@}
+/** @name GPIO
+ * General Purpose IO device
+ */
+const compId_t GPIO_COMP_ID = 0x2300;
+const char GPIO_COMP_NAME[] = "gpio";
+//@}
/** @name RESERVED
* Reserved component ID. x3100 is the component ID
diff --git a/src/include/usr/hwpf/hwpf_reasoncodes.H b/src/include/usr/hwpf/hwpf_reasoncodes.H
index 8533dab0a..d700cf857 100644
--- a/src/include/usr/hwpf/hwpf_reasoncodes.H
+++ b/src/include/usr/hwpf/hwpf_reasoncodes.H
@@ -5,7 +5,10 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013,2014 */
+/* Contributors Listed Below - COPYRIGHT 2013,2014 */
+/* [+] Google Inc. */
+/* [+] International Business Machines Corp. */
+/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
@@ -67,6 +70,7 @@ namespace fapi
MOD_HOST_COALESCE_HOST = 0x1C,
MOD_ATTR_OVERRIDE = 0x1D,
MOD_PLAT_SPECIAL_WAKEUP = 0x1E,
+ MOD_PLAT_EN_VDDR = 0x1F,
};
@@ -120,6 +124,8 @@ namespace fapi
RC_RT_WAKEUP_FAILED = HWPF_COMP_ID | 0x2D,
RC_NO_MIRRORED_MEMORY = HWPF_COMP_ID | 0x2E,
+ RC_VDDR_INVALID_VOLTAGE = HWPF_COMP_ID | 0x2F,
+ RC_TIMEOUT_EN_VDDR = HWPF_COMP_ID | 0x30,
};
/**
diff --git a/src/include/usr/isteps/istep12list.H b/src/include/usr/isteps/istep12list.H
index 3d4efe9f7..7ba93a505 100644
--- a/src/include/usr/isteps/istep12list.H
+++ b/src/include/usr/isteps/istep12list.H
@@ -5,7 +5,10 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2012,2014 */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] Google Inc. */
+/* [+] International Business Machines Corp. */
+/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
diff --git a/src/include/usr/isteps/istep13list.H b/src/include/usr/isteps/istep13list.H
index 45557d9cd..842ac6c5e 100644
--- a/src/include/usr/isteps/istep13list.H
+++ b/src/include/usr/isteps/istep13list.H
@@ -5,7 +5,10 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2012,2014 */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] Google Inc. */
+/* [+] International Business Machines Corp. */
+/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
diff --git a/src/makefile b/src/makefile
index b4bdb0305..1ce230359 100644
--- a/src/makefile
+++ b/src/makefile
@@ -5,7 +5,10 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2010,2014
+# Contributors Listed Below - COPYRIGHT 2010,2014
+# [+] Google Inc.
+# [+] International Business Machines Corp.
+#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -156,6 +159,7 @@ EXTENDED_MODULES += secureboot_ext
EXTENDED_MODULES += devtree
EXTENDED_MODULES += sbe
EXTENDED_MODULES += proc_hwreconfig
+EXTENDED_MODULES += $(if $(CONFIG_GPIODD),gpio,)
TESTCASE_MODULES += cxxtest
TESTCASE_MODULES += testtrace
diff --git a/src/usr/gpio/HBconfig b/src/usr/gpio/HBconfig
new file mode 100644
index 000000000..e5f650eb9
--- /dev/null
+++ b/src/usr/gpio/HBconfig
@@ -0,0 +1,4 @@
+config GPIODD
+ default n
+ help
+ Enable GPIO device driver support
diff --git a/src/usr/gpio/gpiodd.C b/src/usr/gpio/gpiodd.C
new file mode 100644
index 000000000..4dc94650e
--- /dev/null
+++ b/src/usr/gpio/gpiodd.C
@@ -0,0 +1,324 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/gpio/gpiodd.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2014 */
+/* [+] Google Inc. */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#include <trace/interface.H>
+#include <errl/errlentry.H>
+#include <errl/errlmanager.H>
+#include <errl/errludtarget.H>
+#include <errl/errludstring.H>
+#include <targeting/common/targetservice.H>
+#include <targeting/common/commontargeting.H>
+#include <devicefw/driverif.H>
+#include "gpiodd.H"
+#include <gpio/gpioddreasoncodes.H>
+
+
+trace_desc_t * g_trac_gpio = NULL;
+TRAC_INIT( & g_trac_gpio, GPIO_COMP_NAME, KILOBYTE );
+
+using namespace DeviceFW;
+
+namespace GPIO
+{
+
+enum
+{
+ // Asserting that a GPIO Port Extender will never have more than an 8-bit
+ // address as these devices never have more than a handful of control
+ // registers.
+ GPIO_ADDR_SIZE = 1,
+};
+
+// Link to device driver interface
+DEVICE_REGISTER_ROUTE( DeviceFW::WILDCARD,
+ DeviceFW::GPIO,
+ TARGETING::TYPE_MEMBUF,
+ gpioPerformOp);
+
+errlHndl_t gpioPerformOp(DeviceFW::OperationType i_opType,
+ TARGETING::Target * i_target,
+ void * io_buffer,
+ size_t & i_buflen,
+ int64_t i_accessType,
+ va_list i_args)
+{
+ errlHndl_t err = NULL;
+ gpioAddr_t gpioInfo;
+
+ gpioInfo.deviceType = va_arg( i_args, uint64_t );
+ gpioInfo.portAddr = va_arg( i_args, uint64_t );
+
+ TRACDCOMP(g_trac_gpio, ENTER_MRK"gpioPerformOp(): "
+ "optype %d deviceType %d portAddr %d",
+ i_opType, gpioInfo.deviceType, gpioInfo.portAddr);
+
+ do
+ {
+ err = gpioReadAttributes (i_target, gpioInfo);
+ if( err )
+ {
+ break;
+ }
+
+ TARGETING::TargetService& ts = TARGETING::targetService();
+ TARGETING::Target * i2c_master = ts.toTarget(gpioInfo.i2cMasterPath);
+
+ if( i2c_master == NULL )
+ {
+ TRACFCOMP( g_trac_gpio,ERR_MRK"gpioPerformOp() - "
+ "I2C Target not found. Device type %d.",
+ gpioInfo.deviceType );
+ /*@
+ * @errortype
+ * @reasoncode GPIO_I2C_TARGET_NOT_FOUND
+ * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @moduleid GPIO_PERFORM_OP
+ * @userdata1 Device type
+ * @userdata2 HUID of target
+ * @devdesc Invalid GPIO device type
+ * @custdesc A problem occurred during the IPL
+ * of the system.
+ */
+ err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ GPIO::GPIO_PERFORM_OP,
+ GPIO::GPIO_I2C_TARGET_NOT_FOUND,
+ gpioInfo.deviceType,
+ TARGETING::get_huid(i_target),
+ true /*Add HB SW Callout*/ );
+
+ err->collectTrace( GPIO_COMP_NAME );
+ break;
+ }
+
+ if( i_opType == DeviceFW::READ )
+ {
+ err = gpioRead(i2c_master,
+ io_buffer,
+ i_buflen,
+ gpioInfo);
+
+ if( err )
+ {
+ break;
+ }
+ }
+ else if (i_opType == DeviceFW::WRITE )
+ {
+ err = gpioWrite(i2c_master,
+ io_buffer,
+ i_buflen,
+ gpioInfo);
+
+ if( err )
+ {
+ break;
+ }
+ }
+ else
+ {
+ TRACFCOMP( g_trac_gpio,ERR_MRK"gpioPerformOp() - "
+ "Invalid OP type %d.",
+ i_opType );
+ /*@
+ * @errortype
+ * @reasoncode GPIO_INVALID_OP
+ * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @moduleid GPIO_PERFORM_OP
+ * @userdata1 OP type
+ * @userdata2 HUID of target
+ * @devdesc Invalid GPIO device type
+ * @custdesc A problem occurred during the IPL
+ * of the system.
+ */
+ err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ GPIO::GPIO_PERFORM_OP,
+ GPIO::GPIO_INVALID_OP,
+ i_opType,
+ TARGETING::get_huid(i_target),
+ true /*Add HB SW Callout*/ );
+
+ err->collectTrace( GPIO_COMP_NAME );
+ break;
+ }
+
+ } while (0);
+
+ return err;
+}
+
+errlHndl_t gpioRead( TARGETING::Target * i_target,
+ void * o_buffer,
+ size_t & io_buflen,
+ gpioAddr_t & i_gpioInfo)
+{
+ errlHndl_t err = NULL;
+
+ // This i2c interface writes the gpio portAddr to the device
+ // then reads the value of the port w/o a stop bit in between ops
+ err = deviceOp( DeviceFW::READ,
+ i_target,
+ o_buffer,
+ io_buflen,
+ DEVICE_I2C_ADDRESS_OFFSET
+ ( i_gpioInfo.i2cPort,
+ i_gpioInfo.engine,
+ i_gpioInfo.i2cDeviceAddr,
+ GPIO_ADDR_SIZE,
+ reinterpret_cast<uint8_t*>(&(i_gpioInfo.portAddr))
+ )
+ );
+ if(err)
+ {
+ err->collectTrace( GPIO_COMP_NAME );
+ }
+
+ return err;
+}
+
+errlHndl_t gpioWrite ( TARGETING::Target * i_target,
+ void * i_buffer,
+ size_t i_buflen,
+ gpioAddr_t & i_gpioInfo)
+{
+ errlHndl_t err = NULL;
+
+ size_t cmdlen = GPIO_ADDR_SIZE + i_buflen;
+ uint8_t cmd[cmdlen];
+ cmd[0] = i_gpioInfo.portAddr;
+ memcpy(&(cmd[GPIO_ADDR_SIZE]), i_buffer, i_buflen);
+
+ err = deviceOp( DeviceFW::WRITE,
+ i_target,
+ &cmd,
+ cmdlen,
+ DEVICE_I2C_ADDRESS
+ ( i_gpioInfo.i2cPort,
+ i_gpioInfo.engine,
+ i_gpioInfo.i2cDeviceAddr
+ )
+ );
+ if(err)
+ {
+ err->collectTrace( GPIO_COMP_NAME );
+ }
+
+ return err;
+}
+
+
+errlHndl_t gpioReadAttributes ( TARGETING::Target * i_target,
+ gpioAddr_t & io_gpioInfo)
+{
+ errlHndl_t err = NULL;
+
+ TARGETING::GpioInfo gpioData;
+
+ bool attrReadErr = false;
+
+
+ switch(io_gpioInfo.deviceType)
+ {
+ case PCA95X_GPIO:
+ if( !( i_target->
+ tryGetAttr<TARGETING::ATTR_GPIO_INFO>( gpioData ) ) )
+ {
+ attrReadErr = true;
+ }
+ break;
+ default:
+
+ TRACFCOMP( g_trac_gpio,ERR_MRK"gpioReadAttributes() - "
+ "Invalid device type (%d) to read attributes from!",
+ io_gpioInfo.deviceType );
+ /*@
+ * @errortype
+ * @reasoncode GPIO_INVALID_DEVICE_TYPE
+ * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @moduleid GPIO_READATTRIBUTES
+ * @userdata1 Device type
+ * @userdata2 HUID of target
+ * @devdesc Invalid GPIO device type
+ * @custdesc A problem occurred during the IPL
+ * of the system.
+ */
+ err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ GPIO::GPIO_READATTRIBUTES,
+ GPIO::GPIO_INVALID_DEVICE_TYPE,
+ io_gpioInfo.deviceType,
+ TARGETING::get_huid(i_target),
+ true /*Add HB SW Callout*/ );
+
+ err->collectTrace( GPIO_COMP_NAME );
+
+ break;
+ }
+
+ if(attrReadErr)
+ {
+ TRACFCOMP( g_trac_gpio,
+ ERR_MRK"gpioReadAttributes() - ERROR reading "
+ "attributes for device type %d!",
+ io_gpioInfo.deviceType );
+
+ /*@
+ * @errortype
+ * @reasoncode GPIO_ATTR_INFO_NOT_FOUND
+ * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
+ * @moduleid GPIO_READATTRIBUTES
+ * @userdata1 HUID of target
+ * @userdata2 GPIO device type
+ * @devdesc GPIO device attribute was not found
+ * @custdesc A problem occurred during the IPL
+ * of the system.
+ */
+ err = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ GPIO::GPIO_READATTRIBUTES,
+ GPIO::GPIO_ATTR_INFO_NOT_FOUND,
+ TARGETING::get_huid(i_target),
+ io_gpioInfo.deviceType,
+ true /*Add HB SW Callout*/);
+
+
+ err->collectTrace( GPIO_COMP_NAME );
+ }
+
+ if( !err )
+ {
+ //TODO - RTC 109570 until the the Palmetto attribute file is setup
+ io_gpioInfo.i2cMasterPath =
+ i_target->getAttr<TARGETING::ATTR_PHYS_PATH>();
+ //io_gpioInfo.i2cMasterPath = gpioData.i2cMasterPath;
+ io_gpioInfo.engine = gpioData.engine;
+ io_gpioInfo.i2cPort = gpioData.port;
+ io_gpioInfo.i2cDeviceAddr = gpioData.devAddr;
+ }
+
+ return err;
+}
+
+}; // end namespace GPIO
+
diff --git a/src/usr/gpio/gpiodd.H b/src/usr/gpio/gpiodd.H
new file mode 100644
index 000000000..9431e832c
--- /dev/null
+++ b/src/usr/gpio/gpiodd.H
@@ -0,0 +1,109 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/gpio/gpiodd.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2014 */
+/* [+] Google Inc. */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __GPIODD_H
+#define __GPIODD_H
+
+#include <errl/errlentry.H>
+#include <gpio/gpioif.H>
+
+
+namespace GPIO
+{
+ struct gpioAddr_t
+ {
+ TARGETING::EntityPath i2cMasterPath;
+ uint8_t deviceType; //!< device type
+ uint8_t portAddr;
+ uint8_t i2cPort;
+ uint8_t engine;
+ uint8_t i2cDeviceAddr;
+ };
+
+ /**
+ * @brief Perform a GPIO operation
+ *
+ * @param[in] i_optype - Operation Type - @see devicefw/userif.H
+ * @param[in] i_target - Target device
+ * @param[in/out] io_buffer - Ptr to data buffer to be written/read into
+ * @param[in/out] io_buflen - Length of the data buffer
+ * @param[in] i_accessType @see devicefw/userif.H
+ * @param[in] i_args Device arguement list. Gpio Device type,
+ * Gpio port address
+ *
+ * @return errlHndl_t NULL on success or error handle on error.
+ */
+ errlHndl_t gpioPerformOp(DeviceFW::OperationType i_opType,
+ TARGETING::Target * i_target,
+ void * io_buffer,
+ size_t & io_buflen,
+ int64_t i_accessType,
+ va_list i_args);
+
+ /**
+ * @brief Read from a gpio device and port
+ *
+ * @param[in] i_target - Target of the i2c master for this gpio device
+ * @param[out] o_buffer - Buffer to contain the value of the gpio port
+ * @param[in/out] io_buflen - in: Size of the buffer, out: bytes actually
+ * read
+ * @param[in] gpioInfo - gpio addressing information @see gpioAddr_t
+ *
+ * @return errlHndl_t - Null on Success or error handle on error
+ */
+ errlHndl_t gpioRead( TARGETING::Target * i_target,
+ void * o_buffer,
+ size_t & io_buflen,
+ gpioAddr_t & i_gpioInfo);
+
+ /**
+ * @brief Write to a gpio device and port
+ *
+ * @param[in] i_target - Target of the i2c master for this gpio device
+ * @param[in] i_buffer - Buffer containing the value to write
+ * @param[in] i_buflen - Number of bytes to write
+ * @param[in] gpioInfo - gpio addressing information @see gpioAddr_t
+ *
+ * @return errlHndl_t - NULL on Success or error handle on error
+ */
+ errlHndl_t gpioWrite( TARGETING::Target * i_target,
+ void * i_buffer,
+ size_t i_buflen,
+ gpioAddr_t & i_gpioInfo);
+
+
+ /**
+ * @brief Read the GPIO attributes
+ *
+ * @param[in] i_target - Target that contains the attritutes for the device
+ * @param[in/out] gpioAddr_t GPIO address information. @see gpioAddr_t
+ *
+ * @return errlHndl_t - NULL on Sucess or error handle on error
+ */
+ errlHndl_t gpioReadAttributes ( TARGETING::Target * i_target,
+ gpioAddr_t & io_gpioInfo);
+};
+
+#endif
diff --git a/src/usr/gpio/makefile b/src/usr/gpio/makefile
new file mode 100644
index 000000000..d40eaa130
--- /dev/null
+++ b/src/usr/gpio/makefile
@@ -0,0 +1,34 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/gpio/makefile $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2014
+# [+] Google Inc.
+# [+] International Business Machines Corp.
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+# IBM_PROLOG_END_TAG
+ROOTPATH = ../../..
+MODULE = gpio
+
+OBJS += $(if $(CONFIG_GPIODD),gpiodd.o,)
+
+# no way to test this at the moment TODO RTC 111415
+#SUBDIRS = test.d
+
+include ${ROOTPATH}/config.mk
diff --git a/src/usr/hwpf/hwp/dram_training/HBconfig b/src/usr/hwpf/hwp/dram_training/HBconfig
new file mode 100644
index 000000000..7bfb8abad
--- /dev/null
+++ b/src/usr/hwpf/hwp/dram_training/HBconfig
@@ -0,0 +1,4 @@
+config PALMETTO_VDDR
+ default n
+ help
+ Enable the Hostboot DRAM VDDR function for Palmetto
diff --git a/src/usr/hwpf/hwp/dram_training/dram_training.C b/src/usr/hwpf/hwp/dram_training/dram_training.C
index e3686c284..0c88ac5d5 100644
--- a/src/usr/hwpf/hwp/dram_training/dram_training.C
+++ b/src/usr/hwpf/hwp/dram_training/dram_training.C
@@ -5,7 +5,10 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2012,2014 */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] Google Inc. */
+/* [+] International Business Machines Corp. */
+/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
@@ -54,7 +57,7 @@
#include <fapiPlatHwpInvoker.H>
//hb vddr support
-#include <hbVddrMsg.H>
+#include "platform_vddr.H"
#include <initservice/initserviceif.H>
// Run on all Centaurs/MBAs, but needs to keep this one handy in case we
@@ -93,53 +96,33 @@ using namespace fapi;
void* call_host_disable_vddr( void *io_pArgs )
{
errlHndl_t l_err = NULL;
+ IStepError l_StepError;
- TRACDCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"call_host_disable_vddr entry");
-
- if(INITSERVICE::spBaseServicesEnabled())
- {
- IStepError l_StepError;
+ TRACDCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
+ ENTER_MRK"call_host_disable_vddr");
- HBVddrMsg l_hbVddr;
+ // This function has Compile-time binding for desired platform
+ l_err = platform_disable_vddr();
- l_err = l_hbVddr.sendMsg(HBVddrMsg::HB_VDDR_DISABLE);
- if (l_err)
- {
- TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
- "ERROR 0x%.8X: call_host_disable_vddr to sendMsg returns error",
- l_err->reasonCode());
-
- // Create IStep error log and cross reference to error that occurred
- l_StepError.addErrorDetails( l_err );
+ if(l_err)
+ {
+ TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
+ "ERROR 0x%.8X: call_host_disable_vddr returns error",
+ l_err->reasonCode());
+ // Create IStep error log and cross reference to error that occurred
+ l_StepError.addErrorDetails( l_err );
- // Commit Error
- errlCommit( l_err, HWPF_COMP_ID );
- }
- else
- {
- TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
- "SUCCESS : host_disable_vddr()" );
- }
- TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_disable_vddr"
- "when a fsp present exit" );
+ errlCommit( l_err, HWPF_COMP_ID );
- return l_StepError.getErrorHandle();
- }
- else
- {
- //This is a fsp less system. Right now the istep
- //only works when a FSP is present. May add code in the future for
- //Stradale which is a FSP-less system
- TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"call_host_disable_vddr"
- "no-op because fsp-less");
- TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_disable_vddr "
- "for an fsp less system exit" );
-
- return l_err;
}
+ TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
+ EXIT_MRK"call_host_disable_vddr");
+
+ return l_StepError.getErrorHandle();
}
+
//
// Wrapper function to call mem_pll_initf
//
@@ -183,7 +166,7 @@ void* call_mem_pll_initf( void *io_pArgs )
// capture the target data in the elog
ErrlUserDetailsTarget(l_pCentaur).addToLog(l_err );
- // Create IStep error log and cross reference to error that occurred
+ //Create IStep error log and cross reference to error that occurred
l_StepError.addErrorDetails(l_err);
// Commit Error
@@ -245,7 +228,7 @@ void* call_mem_pll_setup( void *io_pArgs )
// capture the target data in the elog
ErrlUserDetailsTarget(l_pCentaur).addToLog(l_err);
- // Create IStep error log and cross reference to error that occurred
+ //Create IStep error log and cross reference to error that occurred
l_StepError.addErrorDetails(l_err);
// Commit Error
@@ -272,7 +255,7 @@ void* call_mem_startclocks( void *io_pArgs )
IStepError l_StepError;
- TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,"call_mem_startclocks entry" );
+ TRACDCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"call_mem_startclocks entry" );
// Get all Centaur targets
TARGETING::TargetHandleList l_membufTargetList;
@@ -307,7 +290,7 @@ void* call_mem_startclocks( void *io_pArgs )
// capture the target data in the elog
ErrlUserDetailsTarget(l_pCentaur).addToLog(l_err);
- // Create IStep error log and cross reference to error that occurred
+ //Create IStep error log and cross reference to error that occurred
l_StepError.addErrorDetails( l_err );
// Commit Error
@@ -321,7 +304,8 @@ void* call_mem_startclocks( void *io_pArgs )
}
}
- TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mem_startclocks exit" );
+ TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
+ "call_mem_startclocks exit" );
return l_StepError.getErrorHandle();
}
@@ -334,52 +318,33 @@ void* call_mem_startclocks( void *io_pArgs )
void* call_host_enable_vddr( void *io_pArgs )
{
TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
- "call_host_enable_vddr entry" );
+ ENTER_MRK"call_host_enable_vddr" );
errlHndl_t l_err = NULL;
+ IStepError l_StepError;
- if(INITSERVICE::spBaseServicesEnabled())
- {
- IStepError l_StepError;
-
- HBVddrMsg l_hbVddr;
+ // This fuction has compile-time binding for different platforms
+ l_err = platform_enable_vddr();
- l_err = l_hbVddr.sendMsg(HBVddrMsg::HB_VDDR_ENABLE);
- if (l_err)
- {
- TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
- "ERROR 0x%.8X: call_host_enable_vddr to sendMsg returns error",
- l_err->reasonCode());
+ if( l_err )
+ {
+ TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
+ "ERROR 0x%.8X: call_host_enable_vddr returns error",
+ l_err->reasonCode());
- // Create IStep error log and cross reference to error that occurred
- l_StepError.addErrorDetails( l_err );
+ l_StepError.addErrorDetails( l_err );
- // Commit Error
- errlCommit( l_err, HWPF_COMP_ID );
- }
- else
- {
- TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
- "SUCCESS : host_enable_vddr()" );
- }
- TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
- "call_host_enable_vddr exit" );
+ // Create IStep error log and cross reference to error that occurred
+ l_StepError.addErrorDetails( l_err );
- return l_StepError.getErrorHandle();
+ // Commit Error
+ errlCommit( l_err, HWPF_COMP_ID );
}
- else
- {
- //This is a fsp less system. Right now the istep
- //only works when a FSP is present. May add code in the future for
- //Stradale which is a FSP-less system
- TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"call_host_enable_vddr"
- "no-op because fsp-less");
- TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_enable_vddr "
- "for an fsp less system exit" );
- return l_err;
+ TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
+ EXIT_MRK"call_host_enable_vddr" );
- }
+ return l_StepError.getErrorHandle();
}
diff --git a/src/usr/hwpf/hwp/dram_training/hbVddrMsg.C b/src/usr/hwpf/hwp/dram_training/hbVddrMsg.C
index 3e4fa82ac..f585de1a2 100644
--- a/src/usr/hwpf/hwp/dram_training/hbVddrMsg.C
+++ b/src/usr/hwpf/hwp/dram_training/hbVddrMsg.C
@@ -5,7 +5,10 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2012,2014 */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] Google Inc. */
+/* [+] International Business Machines Corp. */
+/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
@@ -36,6 +39,7 @@
#include <initservice/initserviceif.H>
#include <pnor/pnorif.H>
#include <fapi.H>
+#include "platform_vddr.H"
using namespace ERRORLOG;
@@ -303,7 +307,8 @@ errlHndl_t HBVddrMsg::sendMsg(uint32_t i_msgType) const
{
errlHndl_t l_err = NULL;
- TRACFCOMP(g_trac_volt, ENTER_MRK "hbVddrMsg::sendMsg msg_type =0x%08X",i_msgType);
+ TRACFCOMP(g_trac_volt, ENTER_MRK
+ "hbVddrMsg::sendMsg msg_type =0x%08X",i_msgType);
do
{
@@ -378,7 +383,8 @@ errlHndl_t HBVddrMsg::sendMsg(uint32_t i_msgType) const
l_err = MBOX::sendrecv( MBOX::FSP_VDDR_MSGQ, l_msg );
if (l_err)
{
- TRACFCOMP(g_trac_volt, ERR_MRK "Failed sending VDDR message to FSP");
+ TRACFCOMP(g_trac_volt,
+ ERR_MRK "Failed sending VDDR message to FSP");
}
else
{
@@ -419,7 +425,8 @@ errlHndl_t HBVddrMsg::processVDDRmsg(msg_t* i_recvMsg) const
if (l_extraData==NULL)
{
//an error occred in obtaining the extra data from the response msg
- TRACFCOMP( g_trac_volt, ERR_MRK "HBVddrMsg::processVDDRmsg: l_extraData = NULL");
+ TRACFCOMP( g_trac_volt, ERR_MRK
+ "HBVddrMsg::processVDDRmsg: l_extraData = NULL");
//create an errorlog
/*@
* @errortype
@@ -464,9 +471,11 @@ errlHndl_t HBVddrMsg::processVDDRmsg(msg_t* i_recvMsg) const
}
else
{
- //error occured so break out of the loop and indicate an error was present
- TRACFCOMP( g_trac_volt, ERR_MRK "HBVddrMsg::processVDDRmsg: error occured "
- "on the powr function called in hwsv");
+ //error occured so break out of the loop and indicate
+ //an error was present
+ TRACFCOMP( g_trac_volt, ERR_MRK
+ "HBVddrMsg::processVDDRmsg: error occured "
+ "on the powr function called in hwsv");
//create an errorlog
/*@
* @errortype
@@ -475,9 +484,10 @@ errlHndl_t HBVddrMsg::processVDDRmsg(msg_t* i_recvMsg) const
* @userdata1 l_errPlid
* @userdata2 0
*
- * @devdesc The hwsv returned a message where there was an error
- * when the powr function was called. userdata1 contains
- * the errorlog plid from hwsv generated by the powr function
+ * @devdesc The hwsv returned a message where there was
+ * an error when the powr function was called.
+ * userdata1 contains the errorlog plid from
+ * hwsv generated by the powr function
*/
createErrLog(l_errLog, fapi::MOD_VDDR_PROC_VDDR_MSG,
fapi::RC_VDDR_POWR_ERR, l_errPlid);
@@ -502,8 +512,9 @@ errlHndl_t HBVddrMsg::processMsg(msg_t* i_Msg) const
do
{
- //check to see if the data[0] =0 or contains a value. A value of 0 means its a
- //response to a request and a value not equal to zero means that its an error coming back
+ //check to see if the data[0] =0 or contains a value.
+ //A value of 0 means its a response to a request and a value not equal
+ //to zero means that its an error coming back
uint16_t l_value1=i_Msg->data[0];
if (l_value1 ==0)
@@ -511,8 +522,10 @@ errlHndl_t HBVddrMsg::processMsg(msg_t* i_Msg) const
//process a response to a request
uint32_t l_msgType =i_Msg->type;
- TRACFCOMP( g_trac_volt, INFO_MRK "HBVddrMsg::processMsg l_msgType=x%08X",l_msgType );
- if ( (l_msgType == HB_VDDR_ENABLE) || (l_msgType == HB_VDDR_DISABLE) )
+ TRACFCOMP( g_trac_volt, INFO_MRK
+ "HBVddrMsg::processMsg l_msgType=x%08X",l_msgType );
+ if ( (l_msgType == HB_VDDR_ENABLE) ||
+ (l_msgType == HB_VDDR_DISABLE) )
{
//process a VDDR message
l_errLog=processVDDRmsg(i_Msg);
@@ -524,7 +537,8 @@ errlHndl_t HBVddrMsg::processMsg(msg_t* i_Msg) const
}
else
{
- TRACFCOMP( g_trac_volt, ERR_MRK "HBVddrMsg::processMsg recv'd a non valid type");
+ TRACFCOMP( g_trac_volt, ERR_MRK
+ "HBVddrMsg::processMsg recv'd a non valid type");
//generate errorLog;
/*@
* @errortype
@@ -533,8 +547,9 @@ errlHndl_t HBVddrMsg::processMsg(msg_t* i_Msg) const
* @userdata1 0
* @userdata2 0
*
- * @devdesc HB got an incorrect type message. HWSV did not populate
- * the message correctly or mbox corrupted the message
+ * @devdesc HB got an incorrect type message.
+ * HWSV did not populate the message correctly
+ * or mbox corrupted the message
*/
createErrLog(l_errLog, fapi::MOD_VDDR_PROC_MSG,
fapi::RC_INCORRECT_MSG_TYPE);
@@ -543,7 +558,8 @@ errlHndl_t HBVddrMsg::processMsg(msg_t* i_Msg) const
else
{
//an error occurred so should stop the IPL
- TRACFCOMP( g_trac_volt, ERR_MRK "HBVddrMsg::RecvMsgHndlr recv'd an error message" );
+ TRACFCOMP( g_trac_volt, ERR_MRK
+ "HBVddrMsg::RecvMsgHndlr recv'd an error message" );
//generate an errorlog
/*@
* @errortype
@@ -589,4 +605,71 @@ void HBVddrMsg::createErrLog(errlHndl_t& io_err,
return;
}
+// External interfaces
+
+errlHndl_t platform_enable_vspd()
+{
+ // noop on FSP based system
+ return NULL;
+}
+
+errlHndl_t platform_enable_vddr()
+{
+ errlHndl_t l_err = NULL;
+ if(INITSERVICE::spBaseServicesEnabled())
+ {
+ HBVddrMsg l_hbVddr;
+
+ l_err = l_hbVddr.sendMsg(HBVddrMsg::HB_VDDR_ENABLE);
+ if (l_err)
+ {
+ TRACFCOMP(g_trac_volt,
+ "ERROR 0x%.8X: call_host_enable_vddr to sendMsg"
+ " returns error",
+ l_err->reasonCode());
+ }
+ else
+ {
+ TRACFCOMP( g_trac_volt,
+ "SUCCESS : host_enable_vddr()" );
+ }
+ }
+ else // simics stand-alone TULETTA
+ {
+ TRACFCOMP(g_trac_volt,"call_host_enable_vddr"
+ "no-op because mbox not available");
+ }
+
+ return l_err;
+}
+
+errlHndl_t platform_disable_vddr()
+{
+ errlHndl_t l_err = NULL;
+ if(INITSERVICE::spBaseServicesEnabled())
+ {
+ HBVddrMsg l_hbVddr;
+
+ l_err = l_hbVddr.sendMsg(HBVddrMsg::HB_VDDR_DISABLE);
+ if (l_err)
+ {
+ TRACFCOMP(g_trac_volt,
+ "ERROR 0x%.8X: call_host_disable_vddr to sendMsg"
+ " returns error",
+ l_err->reasonCode());
+ }
+ else
+ {
+ TRACFCOMP( g_trac_volt,
+ "SUCCESS : host_disable_vddr()" );
+ }
+ }
+ else // simics stand-along TULETTA
+ {
+ TRACFCOMP(g_trac_volt,"call_host_disable_vddr"
+ "no-op because mbox not available");
+ }
+
+ return l_err;
+}
diff --git a/src/usr/hwpf/hwp/dram_training/makefile b/src/usr/hwpf/hwp/dram_training/makefile
index a08b9fc05..dee812c3b 100644
--- a/src/usr/hwpf/hwp/dram_training/makefile
+++ b/src/usr/hwpf/hwp/dram_training/makefile
@@ -5,7 +5,10 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2012,2014
+# Contributors Listed Below - COPYRIGHT 2012,2014
+# [+] Google Inc.
+# [+] International Business Machines Corp.
+#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -71,12 +74,15 @@ OBJS += mss_access_delay_reg.o
OBJS += mss_generic_shmoo.o
OBJS += mss_mcbist.o
OBJS += mss_mcbist_common.o
-OBJS += hbVddrMsg.o
OBJS += mss_mcbist_address.o
OBJS += mss_dimm_power_test.o
OBJS += mss_lrdimm_funcs.o
OBJS += cen_stopclocks.o
+
+#
+OBJS += $(if $(CONFIG_PALMETTO_VDDR),palmetto_vddr.o, hbVddrMsg.o)
+
## NOTE: add a new directory onto the vpaths when you add a new HWP
##@ VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/???
VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/dram_training/mss_dimm_power_test
diff --git a/src/usr/hwpf/hwp/dram_training/palmetto_vddr.C b/src/usr/hwpf/hwp/dram_training/palmetto_vddr.C
new file mode 100644
index 000000000..5286d26f6
--- /dev/null
+++ b/src/usr/hwpf/hwp/dram_training/palmetto_vddr.C
@@ -0,0 +1,231 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/hwpf/hwp/dram_training/palmetto_vddr.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2014 */
+/* [+] Google Inc. */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+// Rhesus board-specific VDDR support.
+// VDDR is enabled/disabled via a GPIO on the hammock card.
+// A separate GPIO selects between 1.35V and 1.25V output from the VR.
+
+#include "platform_vddr.H"
+
+#include <hwpf/hwpf_reasoncodes.H>
+#include <errl/errlentry.H>
+#include <errl/errlmanager.H>
+
+#include <targeting/common/commontargeting.H>
+#include <targeting/common/util.H>
+#include <targeting/common/utilFilter.H>
+
+#include <kernel/timemgr.H>
+
+#include <usr/devicefw/driverif.H>
+#include <usr/gpio/gpioif.H>
+
+using namespace TARGETING;
+using namespace DeviceFW;
+
+trace_desc_t* g_trac_vddr = NULL;
+TRAC_INIT(&g_trac_vddr, "HB_VDDR", KILOBYTE);
+
+/**
+ * PCA95X GPIO function assignements
+ */
+enum
+{
+ // Output GPIO to enable VDDR. (GPIO pin 0)
+ GPIO_P1V35_EN = 0,
+
+ // No other GPIO pins are implemented on the Palmetto board
+};
+
+// PCA95X internal register addresses
+enum
+{
+ PCA95X_GPIO_REG_INPUT = 0x0,
+ PCA95X_GPIO_REG_OUTPUT = 0x2,
+ PCA95X_GPIO_REG_POLARITY = 0x4,
+ PCA95X_GPIO_POLARITY_NORMAL = 0,
+ PCA95X_GPIO_POLARITY_INVERTED = 1,
+ PCA95X_GPIO_REG_CONFIG = 0x6,
+};
+
+#define PCA95X_GPIO_CONFIG_OUTPUT false
+#define PCA95X_GPIO_CONFIG_INPUT true
+
+// GPIO bit numbers (0-7) => port addr 0 pin(0-7)
+// GPIO bit numbers (8-15) => port addr 1 pin(0-7)
+#define GPIO_TO_PORT(gpio) (gpio / 8)
+#define GPIO_TO_BIT(gpio) (gpio % 8)
+
+// Helper function to call provided function pointer on each functional
+// centaur Target.
+static errlHndl_t for_each_centaur(errlHndl_t (*func)(Target *))
+{
+ // Get all Centaur targets
+ TargetHandleList l_membufTargetList;
+ getAllChips(l_membufTargetList, TYPE_MEMBUF);
+
+ errlHndl_t l_err = NULL;
+
+ for (TargetHandleList::iterator
+ l_membuf_iter = l_membufTargetList.begin();
+ l_membuf_iter != l_membufTargetList.end();
+ ++l_membuf_iter)
+ {
+ Target* l_pCentaur = *l_membuf_iter;
+
+ l_err = (*func)(l_pCentaur);
+
+ if( l_err )
+ {
+ break;
+ }
+ }
+
+ return l_err;
+}
+
+static errlHndl_t pca95xGpioSetBit(TARGETING::Target * i_target,
+ uint8_t i_reg,
+ uint8_t i_gpio,
+ bool i_val)
+{
+ errlHndl_t err = NULL;
+ do
+ {
+
+ uint64_t cmd = i_reg + GPIO_TO_PORT(i_gpio);
+ uint8_t data = 0;
+ size_t dataLen = sizeof(data);
+
+ // Might want to make this an attribute;
+ // However, This is already a palmetto only object
+ uint64_t deviceType = GPIO::PCA95X_GPIO;
+
+ err = DeviceFW::deviceOp
+ ( DeviceFW::READ,
+ i_target,
+ &data,
+ dataLen,
+ DEVICE_GPIO_ADDRESS(deviceType, cmd)
+ );
+
+ if( err )
+ {
+ break;
+ }
+
+ uint8_t new_reg_val = data;
+ if( i_val )
+ {
+ new_reg_val |= 1 << GPIO_TO_BIT(i_gpio);
+ }
+ else
+ {
+ new_reg_val &= ~(1 << GPIO_TO_BIT(i_gpio));
+ }
+
+ // Do the write only if actually changing value.
+ if( new_reg_val != data )
+ {
+ data = new_reg_val;
+ cmd = i_reg + GPIO_TO_PORT(i_gpio);
+
+ err = DeviceFW::deviceOp
+ ( DeviceFW::WRITE,
+ i_target,
+ &data,
+ dataLen,
+ DEVICE_GPIO_ADDRESS(deviceType, cmd)
+ );
+
+ if( err )
+ {
+ break;
+ }
+ }
+
+ } while(0);
+
+ return err;
+}
+
+
+static errlHndl_t pca95xGpioWriteBit(TARGETING::Target * i_target,
+ uint8_t i_gpio_pin,
+ bool i_val)
+{
+ assert( i_gpio_pin >= 0 && i_gpio_pin < 16 );
+ errlHndl_t err = NULL;
+
+ err = pca95xGpioSetBit(i_target,
+ PCA95X_GPIO_REG_OUTPUT,
+ i_gpio_pin,
+ i_val);
+
+ // Configure gpio bit as output (if necessary).
+ if(!err)
+ {
+ err = pca95xGpioSetBit(i_target,
+ PCA95X_GPIO_REG_CONFIG,
+ i_gpio_pin,
+ PCA95X_GPIO_CONFIG_OUTPUT);
+ }
+
+ return err;
+}
+
+static errlHndl_t palmetto_centaur_enable_vddr(Target *centaur)
+{
+ errlHndl_t l_err = NULL;
+
+ // Enable the DIMM power.
+ l_err = pca95xGpioWriteBit(centaur, GPIO_P1V35_EN, true);
+
+ return l_err;
+}
+
+static errlHndl_t palmetto_centaur_disable_vddr(Target *centaur)
+{
+ return pca95xGpioWriteBit(centaur, GPIO_P1V35_EN, false);
+}
+
+// External interfaces
+
+errlHndl_t platform_enable_vspd()
+{
+ // GPIO pin not implemented on palmetto
+ // VSPD voltage hardwired.
+ return NULL;
+}
+
+errlHndl_t platform_enable_vddr()
+{
+ return for_each_centaur(palmetto_centaur_enable_vddr);
+}
+
+errlHndl_t platform_disable_vddr()
+{
+ return for_each_centaur(palmetto_centaur_disable_vddr);
+}
diff --git a/src/usr/hwpf/hwp/dram_training/platform_vddr.H b/src/usr/hwpf/hwp/dram_training/platform_vddr.H
new file mode 100644
index 000000000..98c013535
--- /dev/null
+++ b/src/usr/hwpf/hwp/dram_training/platform_vddr.H
@@ -0,0 +1,51 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/hwpf/hwp/dram_training/platform_vddr.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2014 */
+/* [+] Google Inc. */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+// platform specific VDDR support.
+
+#ifndef PLATFORM_VDDR_H__
+#define PLATFORM_VDDR_H__
+
+#include <usr/errl/errlentry.H>
+
+/**
+ * @brief Enable vspd on DIMMS
+ * @return NULL | error handle on error
+ */
+errlHndl_t platform_enable_vspd();
+
+/**
+ * @brief Enable vddr on DIMMS
+ * @return NULL | error handle on error
+ */
+errlHndl_t platform_enable_vddr();
+
+/**
+ * @brief Disable vddr on DIMMS
+ * @return NULL | error handle on error
+ */
+errlHndl_t platform_disable_vddr();
+
+#endif // PLATFORM_VDDR_H__
diff --git a/src/usr/initservice/extinitsvc/extinitsvctasks.H b/src/usr/initservice/extinitsvc/extinitsvctasks.H
index 2a4a0968b..e51865af6 100644
--- a/src/usr/initservice/extinitsvc/extinitsvctasks.H
+++ b/src/usr/initservice/extinitsvc/extinitsvctasks.H
@@ -5,7 +5,10 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* [+] Google Inc. */
+/* [+] International Business Machines Corp. */
+/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
@@ -31,6 +34,7 @@
#include <initservice/initsvcreasoncodes.H>
#include "extinitsvc.H"
+#include <config.h>
namespace INITSERVICE
{
@@ -305,6 +309,20 @@ const TaskInfo g_exttaskinfolist[] = {
}
},
+#ifdef CONFIG_GPIODD
+ /**
+ * @brief GPIO code library
+ */
+ {
+ "libgpio.so" , // taskname
+ NULL, // no pointer to fn
+ {
+ INIT_TASK, // task type
+ EXT_IMAGE, // Extended Module
+ }
+ },
+#endif
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// NOTE: libistepdisp.so needs to always be last in this list!!
diff --git a/src/usr/makefile b/src/usr/makefile
index 3c5b24f35..2543ed901 100644
--- a/src/usr/makefile
+++ b/src/usr/makefile
@@ -5,7 +5,10 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2010,2014
+# Contributors Listed Below - COPYRIGHT 2010,2014
+# [+] Google Inc.
+# [+] International Business Machines Corp.
+#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -56,5 +59,6 @@ SUBDIRS += dump.d
SUBDIRS += secureboot.d
SUBDIRS += devtree.d
SUBDIRS += sbe.d
+SUBDIRS += gpio.d
include ${ROOTPATH}/config.mk
diff --git a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
index c31dc09be..75fc294df 100644
--- a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
+++ b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml
@@ -5,7 +5,10 @@
<!-- -->
<!-- OpenPOWER HostBoot Project -->
<!-- -->
-<!-- COPYRIGHT International Business Machines Corp. 2011,2014 -->
+<!-- Contributors Listed Below - COPYRIGHT 2012,2014 -->
+<!-- [+] Google Inc. -->
+<!-- [+] International Business Machines Corp. -->
+<!-- -->
<!-- -->
<!-- Licensed under the Apache License, Version 2.0 (the "License"); -->
<!-- you may not use this file except in compliance with the License. -->
@@ -260,4 +263,42 @@
</hwpfToHbAttrMap>
<hbOnly/>
</attribute>
+<attribute>
+ <id>GPIO_INFO</id>
+ <description>Information needed to address GPIO device</description>
+ <complexType>
+ <description>Structure to define the addessing for an I2C
+ slave device.</description>
+ <field>
+ <name>i2cMasterPath</name>
+ <description>Entity path to the chip that contains the I2C
+ master</description>
+ <type>EntityPath</type>
+ <default>physical:sys-0/node-0/membuf-0</default>
+ </field>
+ <field>
+ <name>port</name>
+ <description>Port from the I2C Master device. This is a 6-bit
+ value.</description>
+ <type>uint8_t</type>
+ <default>1</default>
+ </field>
+ <field>
+ <name>devAddr</name>
+ <description>Device address on the I2C bus. This is a 7-bit value,
+ but then shifted 1 bit left.</description>
+ <type>uint8_t</type>
+ <default>0x40</default>
+ </field>
+ <field>
+ <name>engine</name>
+ <description>I2C master engine. This is a 2-bit
+ value.</description>
+ <type>uint8_t</type>
+ <default>0</default>
+ </field>
+ </complexType>
+ <persistency>non-volatile</persistency>
+ <readable/>
+</attribute>
</attributes>
diff --git a/src/usr/targeting/common/xmltohb/target_types_hb.xml b/src/usr/targeting/common/xmltohb/target_types_hb.xml
index b1840d742..14c1e450f 100644
--- a/src/usr/targeting/common/xmltohb/target_types_hb.xml
+++ b/src/usr/targeting/common/xmltohb/target_types_hb.xml
@@ -5,7 +5,10 @@
<!-- -->
<!-- OpenPOWER HostBoot Project -->
<!-- -->
-<!-- COPYRIGHT International Business Machines Corp. 2011,2014 -->
+<!-- Contributors Listed Below - COPYRIGHT 2012,2014 -->
+<!-- [+] Google Inc. -->
+<!-- [+] International Business Machines Corp. -->
+<!-- -->
<!-- -->
<!-- Licensed under the Apache License, Version 2.0 (the "License"); -->
<!-- you may not use this file except in compliance with the License. -->
@@ -102,6 +105,9 @@
<id>I2C_ENGINE_MUTEX_1</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>GPIO_INFO</id>
+ </attribute>
</targetTypeExtension>
<targetTypeExtension>
OpenPOWER on IntegriCloud