diff options
author | Matt Derksen <mderkse1@us.ibm.com> | 2019-01-14 16:34:04 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2019-01-21 08:50:48 -0600 |
commit | ad1c30eb712f64b0cb826b9592090d4a218b2a81 (patch) | |
tree | 88cd798ead90906e5ef5d280e240fd6cef43f91d | |
parent | 868b68df85eb7aeed7eba3392303fa3be854e2a6 (diff) | |
download | talos-hostboot-ad1c30eb712f64b0cb826b9592090d4a218b2a81.tar.gz talos-hostboot-ad1c30eb712f64b0cb826b9592090d4a218b2a81.zip |
Move NVDIMM operations under NVDIMM modules
Makes it easier to find and include NVDIMM operations.
Also makes it easier to exclude from non-nvdimm supported systems.
Change-Id: I870c2246e1bb9201e6e8032f1868e6e4e6a2b91a
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/70489
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Roland Veloz <rveloz@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
26 files changed, 579 insertions, 224 deletions
diff --git a/src/build/mkrules/dist.targets.mk b/src/build/mkrules/dist.targets.mk index d2302f3ba..dacc94f05 100755 --- a/src/build/mkrules/dist.targets.mk +++ b/src/build/mkrules/dist.targets.mk @@ -194,7 +194,7 @@ COPY_RENAME_FILES = \ hbplugins/prdf/p9_hcd_memmap_base.H:src/import/chips/p9/procedures/hwp/lib/p9_hcd_memmap_base.H:errltool \ hbplugins/prdf/p9_hcd_header_defs.H:src/import/chips/p9/procedures/hwp/lib/p9_hcd_header_defs.H:errltool \ hbplugins/prdf/p9_ppe_defs.H:src/import/chips/p9/procedures/hwp/lib/p9_ppe_defs.H:errltool - + # # Symbolic links created in the target. # @@ -363,6 +363,8 @@ fsp.tar_CONTENTS = \ $(call ROOTPATH_WILDCARD,src/usr/*/plugins/*)) \ $(addsuffix :plugins/,\ $(call ROOTPATH_WILDCARD,src/usr/secureboot/common/plugins/*)) \ + $(addsuffix :plugins/,\ + $(call ROOTPATH_WILDCARD,src/usr/isteps/nvdimm/plugins/*)) \ src/build/debug/fsp-memdump.sh:src/build/debug/ \ obj/genfiles/hbfw_term_rc.H \ obj/genfiles/srcListing \ diff --git a/src/include/usr/i2c/i2cif.H b/src/include/usr/i2c/i2cif.H index c33c83e32..4d9aa2ef0 100644 --- a/src/include/usr/i2c/i2cif.H +++ b/src/include/usr/i2c/i2cif.H @@ -26,6 +26,11 @@ #define __I2CIF_H #include <list> +// Handy macros to check i2c ranges +// Pass in an instance of a TARGETING::ATTR_I2C_BUS_SPEED_ARRAY_type +#define I2C_BUS_MAX_ENGINE(var) (sizeof(var)/sizeof(var[0])) +#define I2C_BUS_MAX_PORT(var) (sizeof(var[0])/sizeof(var[0][0])) + namespace I2C { diff --git a/src/include/usr/i2c/nvdimmif.H b/src/include/usr/isteps/nvdimm/nvdimmif.H index 2b60ac4de..4ddfcf970 100644 --- a/src/include/usr/i2c/nvdimmif.H +++ b/src/include/usr/isteps/nvdimm/nvdimmif.H @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/include/usr/i2c/nvdimmif.H $ */ +/* $Source: src/include/usr/isteps/nvdimm/nvdimmif.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2018 */ +/* Contributors Listed Below - COPYRIGHT 2013,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -26,7 +26,7 @@ #define __NVDIMMIF_H #include <list> -#include "eepromif.H" +#include <i2c/eepromif.H> namespace NVDIMM { diff --git a/src/include/usr/i2c/nvdimmddreasoncodes.H b/src/include/usr/isteps/nvdimm/nvdimmreasoncodes.H index 509d19d25..bde22b942 100644 --- a/src/include/usr/i2c/nvdimmddreasoncodes.H +++ b/src/include/usr/isteps/nvdimm/nvdimmreasoncodes.H @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/include/usr/i2c/nvdimmddreasoncodes.H $ */ +/* $Source: src/include/usr/isteps/nvdimm/nvdimmreasoncodes.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2018 */ +/* Contributors Listed Below - COPYRIGHT 2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -23,13 +23,13 @@ /* */ /* IBM_PROLOG_END_TAG */ /** - * @file nvdimmddreasoncodes.H + * @file nvdimmreasoncodes.H * - * @brief Reason codes and module ids for the NVDIMM device driver + * @brief Reason codes and module ids for the NVDIMM * */ -#ifndef __NVDIMMDDREASONCODES_H -#define __NVDIMMDDREASONCODES_H +#ifndef __NVDIMMREASONCODES_H +#define __NVDIMMREASONCODES_H // ----------------------------------------------- // Includes // ----------------------------------------------- diff --git a/src/makefile b/src/makefile index 347ce3116..ffb0f7806 100644 --- a/src/makefile +++ b/src/makefile @@ -305,6 +305,7 @@ RUNTIME_MODULES += sbeio_rt RUNTIME_MODULES += tod_rt RUNTIME_MODULES += nestmemutils RUNTIME_MODULES += imageprocs_rt +RUNTIME_MODULES += $(if $(CONFIG_NVDIMM),nvdimm_rt) RUNTIME_DATA_MODULES += RUNTIME_TESTCASE_MODULES += cxxtest_rt diff --git a/src/usr/i2c/HBconfig b/src/usr/i2c/HBconfig index 91579f80d..dc68e5cfb 100644 --- a/src/usr/i2c/HBconfig +++ b/src/usr/i2c/HBconfig @@ -8,8 +8,3 @@ config TPM_NUVOTON default y help Enable Nuvoton TPM I2C driver - -config NVDIMM - default n - help - Enable NVDIMM I2C support diff --git a/src/usr/i2c/eepromdd.C b/src/usr/i2c/eepromdd.C index 8f94e0c3b..797c6b6bb 100755 --- a/src/usr/i2c/eepromdd.C +++ b/src/usr/i2c/eepromdd.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2018 */ +/* Contributors Listed Below - COPYRIGHT 2011,2019 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -51,7 +51,6 @@ #include <i2c/i2cif.H> #include "eepromdd.H" #include "errlud_i2c.H" -#include <i2c/nvdimmif.H> // ---------------------------------------------- // Globals diff --git a/src/usr/i2c/errlud_i2c.C b/src/usr/i2c/errlud_i2c.C index 1e33d6ea6..7c3e00f12 100644 --- a/src/usr/i2c/errlud_i2c.C +++ b/src/usr/i2c/errlud_i2c.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2018 */ +/* Contributors Listed Below - COPYRIGHT 2014,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -23,19 +23,17 @@ /* */ /* IBM_PROLOG_END_TAG */ /** - * @file errlud_fsi.C + * @file errlud_i2c.C * - * @brief Implementation of classes to log FSI FFDC + * @brief Implementation of classes to log i2c FFDC */ #include <string.h> // strlen #include "errlud_i2c.H" #include <i2c/i2creasoncodes.H> #include <i2c/eepromddreasoncodes.H> -#include <i2c/nvdimmddreasoncodes.H> #include <devicefw/driverif.H> #include "eepromdd.H" #include "i2c.H" -#include "nvdimmdd.H" namespace I2C { @@ -325,137 +323,3 @@ UdEepromParms::~UdEepromParms() } } // end EEPROM namespace - -namespace NVDIMM -{ - -//------------------------------------------------------------------------------ -// NVDIMM User Details -//------------------------------------------------------------------------------ -UdNvdimmParms::UdNvdimmParms( uint8_t i_opType, - TARGETING::Target * i_target, - uint64_t i_buflen, - nvdimm_addr_t &i_i2cInfo ) -{ - // Set up Ud instance variables - iv_CompId = NVDIMM_COMP_ID; - iv_Version = 3; - iv_SubSection = NVDIMM_UDT_PARAMETERS; - - //***** Memory Layout ***** - // 1 byte : Op Type Description - // 1 byte : Op Type (DeviceFW::OperationType) - // 4 bytes : Target HUID - // 8 bytes : Length of In/Out Buffer - // 8 bytes : Offset - // 8 bytes : Port - // 8 bytes : Engine - // 8 bytes : Device Address - // 1 byte : Address Size - // 8 bytes : Write Page Size - // 8 bytes : Device Size (in KB) - // 8 bytes : Chip Count - // 8 bytes : Write Cycle Time - // 1 byte : I2C MUX Bus Selector - // N bytes : I2C MUX path in string form - - // Cache the MUX path in string form for reference and easy access - char *l_muxPath = i_i2cInfo.i2cMuxPath.toString(); - - char * l_pBuf = reinterpret_cast<char *>( - reallocUsrBuf(sizeof(uint8_t)*2 - +sizeof(uint32_t) - +sizeof(uint64_t)*5 - +sizeof(uint8_t) - +sizeof(uint64_t)*4 - +sizeof(uint8_t) - +(strlen(l_muxPath) +1) ) ); - - uint64_t tmp64 = 0; - uint32_t tmp32 = 0; - uint8_t tmp8 = 0; - - if( i_opType == DeviceFW::READ ) - { - tmp8 = 0; - } - else if( i_opType == DeviceFW::WRITE ) - { - tmp8 = 1; - } - else - { - tmp8 = 2; - } - memcpy(l_pBuf, &tmp8, sizeof(tmp8)); - l_pBuf += sizeof(tmp8); - - tmp8 = i_opType; - memcpy(l_pBuf, &tmp8, sizeof(tmp8)); - l_pBuf += sizeof(tmp8); - - tmp32 = TARGETING::get_huid(i_target); - memcpy(l_pBuf, &tmp32, sizeof(tmp32)); - l_pBuf += sizeof(tmp32); - - tmp64 = i_buflen; - memcpy(l_pBuf, &tmp64, sizeof(tmp64)); - l_pBuf += sizeof(tmp64); - - tmp64 = i_i2cInfo.offset; - memcpy(l_pBuf, &tmp64, sizeof(tmp64)); - l_pBuf += sizeof(tmp64); - - tmp64 = i_i2cInfo.port; - memcpy(l_pBuf, &tmp64, sizeof(tmp64)); - l_pBuf += sizeof(tmp64); - - tmp64 = i_i2cInfo.engine; - memcpy(l_pBuf, &tmp64, sizeof(tmp64)); - l_pBuf += sizeof(tmp64); - - tmp64 = i_i2cInfo.devAddr; - memcpy(l_pBuf, &tmp64, sizeof(tmp64)); - l_pBuf += sizeof(tmp64); - - tmp8 = static_cast<uint8_t>(i_i2cInfo.addrSize); - memcpy(l_pBuf, &tmp8, sizeof(tmp8)); - l_pBuf += sizeof(tmp8); - - tmp64 = i_i2cInfo.writePageSize; - memcpy(l_pBuf, &tmp64, sizeof(tmp64)); - l_pBuf += sizeof(tmp64); - - tmp64 = i_i2cInfo.devSize_KB; - memcpy(l_pBuf, &tmp64, sizeof(tmp64)); - l_pBuf += sizeof(tmp64); - - tmp64 = i_i2cInfo.chipCount; - memcpy(l_pBuf, &tmp64, sizeof(tmp64)); - l_pBuf += sizeof(tmp64); - - tmp64 = i_i2cInfo.writeCycleTime; - memcpy(l_pBuf, &tmp64, sizeof(tmp64)); - l_pBuf += sizeof(tmp64); - - // Begin Version 3 Data - tmp8 = i_i2cInfo.i2cMuxBusSelector; - memcpy(l_pBuf, &tmp8, sizeof(tmp8)); - l_pBuf += sizeof(tmp8); - - memcpy(l_pBuf, l_muxPath, strlen(l_muxPath)); - l_pBuf += strlen(l_muxPath); - l_pBuf = '\0'; // add a terminator for ease of parsing - ++l_pBuf; - - free(l_muxPath); - l_muxPath = nullptr; -} - -//------------------------------------------------------------------------------ -UdNvdimmParms::~UdNvdimmParms() -{ - -} - -} // end NVDIMM namespace diff --git a/src/usr/i2c/errlud_i2c.H b/src/usr/i2c/errlud_i2c.H index bd11a1be2..28e8c230d 100644 --- a/src/usr/i2c/errlud_i2c.H +++ b/src/usr/i2c/errlud_i2c.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2018 */ +/* Contributors Listed Below - COPYRIGHT 2014,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -35,7 +35,7 @@ #include <devicefw/driverif.H> #include "i2c_common.H" #include "eepromdd.H" -#include "nvdimmdd.H" + namespace I2C { @@ -112,40 +112,4 @@ class UdEepromParms : public ERRORLOG::ErrlUserDetails } // end EEPROM namespace -namespace NVDIMM -{ -/** - * @class UdNvdimmParms - * - * Adds NVDIMM information to an error log as user detail data - */ -class UdNvdimmParms : public ERRORLOG::ErrlUserDetails -{ - public: - /** - * @brief Constructor - * - * @param i_opType Operation Type - * @param i_target Chip being detected/acted upon - * @param i_buflen Length of In/Out Buffer - * @param i_i2cInfo Miscellaneous Parameters - */ - UdNvdimmParms( uint8_t i_opType, - TARGETING::Target * i_target, - uint64_t i_buflen, - nvdimm_addr_t &i_i2cInfo ); - - /** - * @brief Destructor - */ - virtual ~UdNvdimmParms(); - - private: - // Disabled - UdNvdimmParms(UdNvdimmParms &); - UdNvdimmParms & operator=(UdNvdimmParms &); -}; - -} // end NVDIMM namespace - #endif diff --git a/src/usr/i2c/i2c.C b/src/usr/i2c/i2c.C index bba2910c0..ba87667e2 100755 --- a/src/usr/i2c/i2c.C +++ b/src/usr/i2c/i2c.C @@ -57,9 +57,12 @@ #include <secureboot/service.H> #include <i2c/eepromif.H> #include <i2c/tpmddif.H> -#include <i2c/nvdimmif.H> #include <hwas/common/hwas.H> // HwasState +#ifdef CONFIG_NVDIMM +#include <isteps/nvdimm/nvdimmif.H> +#endif + // ---------------------------------------------- // Globals // ---------------------------------------------- diff --git a/src/usr/i2c/i2c.mk b/src/usr/i2c/i2c.mk index 822f1d948..33d2accda 100644 --- a/src/usr/i2c/i2c.mk +++ b/src/usr/i2c/i2c.mk @@ -25,4 +25,3 @@ # common objects with runtime OBJS += eepromdd.o OBJS += errlud_i2c.o -OBJS += $(if $(CONFIG_NVDIMM),nvdimmdd.o,) diff --git a/src/usr/i2c/i2c_common.H b/src/usr/i2c/i2c_common.H index fdb6029bb..61c5472c9 100644 --- a/src/usr/i2c/i2c_common.H +++ b/src/usr/i2c/i2c_common.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2018 */ +/* Contributors Listed Below - COPYRIGHT 2011,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -25,10 +25,6 @@ #ifndef __I2C_COMMON_H #define __I2C_COMMON_H -// Handy macros to check i2c ranges -// Pass in an instance of a TARGETING::ATTR_I2C_BUS_SPEED_ARRAY_type -#define I2C_BUS_MAX_ENGINE(var) (sizeof(var)/sizeof(var[0])) -#define I2C_BUS_MAX_PORT(var) (sizeof(var[0])/sizeof(var[0][0])) /** * @file i2c_common.H diff --git a/src/usr/isteps/nvdimm/HBconfig b/src/usr/isteps/nvdimm/HBconfig new file mode 100644 index 000000000..b03b380ab --- /dev/null +++ b/src/usr/isteps/nvdimm/HBconfig @@ -0,0 +1,4 @@ +config NVDIMM + default n + help + Enable NVDIMM support diff --git a/src/usr/isteps/nvdimm/errlud_nvdimm.C b/src/usr/isteps/nvdimm/errlud_nvdimm.C new file mode 100644 index 000000000..3a87789ce --- /dev/null +++ b/src/usr/isteps/nvdimm/errlud_nvdimm.C @@ -0,0 +1,166 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/nvdimm/errlud_nvdimm.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2019 */ +/* [+] 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 */ +/** + * @file errlud_nvdimm.C + * + * @brief Implementation of classes to log nvdimm FFDC + */ +#include <isteps/nvdimm/nvdimmreasoncodes.H> +#include "nvdimmdd.H" +#include "errlud_nvdimm.H" + +namespace NVDIMM +{ + +//------------------------------------------------------------------------------ +// NVDIMM User Details +//------------------------------------------------------------------------------ +UdNvdimmParms::UdNvdimmParms( uint8_t i_opType, + TARGETING::Target * i_target, + uint64_t i_buflen, + nvdimm_addr_t &i_i2cInfo ) +{ + // Set up Ud instance variables + iv_CompId = NVDIMM_COMP_ID; + iv_Version = 3; + iv_SubSection = NVDIMM_UDT_PARAMETERS; + + //***** Memory Layout ***** + // 1 byte : Op Type Description + // 1 byte : Op Type (DeviceFW::OperationType) + // 4 bytes : Target HUID + // 8 bytes : Length of In/Out Buffer + // 8 bytes : Offset + // 8 bytes : Port + // 8 bytes : Engine + // 8 bytes : Device Address + // 1 byte : Address Size + // 8 bytes : Write Page Size + // 8 bytes : Device Size (in KB) + // 8 bytes : Chip Count + // 8 bytes : Write Cycle Time + // 1 byte : I2C MUX Bus Selector + // N bytes : I2C MUX path in string form + + // Cache the MUX path in string form for reference and easy access + char *l_muxPath = i_i2cInfo.i2cMuxPath.toString(); + + char * l_pBuf = reinterpret_cast<char *>( + reallocUsrBuf(sizeof(uint8_t)*2 + +sizeof(uint32_t) + +sizeof(uint64_t)*5 + +sizeof(uint8_t) + +sizeof(uint64_t)*4 + +sizeof(uint8_t) + +(strlen(l_muxPath) +1) ) ); + + uint64_t tmp64 = 0; + uint32_t tmp32 = 0; + uint8_t tmp8 = 0; + + if( i_opType == DeviceFW::READ ) + { + tmp8 = 0; + } + else if( i_opType == DeviceFW::WRITE ) + { + tmp8 = 1; + } + else + { + tmp8 = 2; + } + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + tmp8 = i_opType; + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + tmp32 = TARGETING::get_huid(i_target); + memcpy(l_pBuf, &tmp32, sizeof(tmp32)); + l_pBuf += sizeof(tmp32); + + tmp64 = i_buflen; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_i2cInfo.offset; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_i2cInfo.port; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_i2cInfo.engine; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_i2cInfo.devAddr; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp8 = static_cast<uint8_t>(i_i2cInfo.addrSize); + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + tmp64 = i_i2cInfo.writePageSize; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_i2cInfo.devSize_KB; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_i2cInfo.chipCount; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_i2cInfo.writeCycleTime; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + // Begin Version 3 Data + tmp8 = i_i2cInfo.i2cMuxBusSelector; + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + memcpy(l_pBuf, l_muxPath, strlen(l_muxPath)); + l_pBuf += strlen(l_muxPath); + l_pBuf = '\0'; // add a terminator for ease of parsing + ++l_pBuf; + + free(l_muxPath); + l_muxPath = nullptr; +} + +//------------------------------------------------------------------------------ +UdNvdimmParms::~UdNvdimmParms() +{ + +} + +} // end NVDIMM namespace diff --git a/src/usr/isteps/nvdimm/errlud_nvdimm.H b/src/usr/isteps/nvdimm/errlud_nvdimm.H new file mode 100644 index 000000000..55b5f9b20 --- /dev/null +++ b/src/usr/isteps/nvdimm/errlud_nvdimm.H @@ -0,0 +1,72 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/nvdimm/errlud_nvdimm.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2019 */ +/* [+] 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 */ +/** + * @file errlud_nvdimm.H + * + * @brief Defines the class that logs and parses NVDIMM data + */ +#ifndef ERRL_UD_NVDIMM_H +#define ERRL_UD_NVDIMM_H + +#include <errl/errluserdetails.H> +#include "nvdimmdd.H" + +namespace NVDIMM +{ +/** + * @class UdNvdimmParms + * + * Adds NVDIMM information to an error log as user detail data + */ +class UdNvdimmParms : public ERRORLOG::ErrlUserDetails +{ + public: + /** + * @brief Constructor + * + * @param i_opType Operation Type + * @param i_target Chip being detected/acted upon + * @param i_buflen Length of In/Out Buffer + * @param i_i2cInfo Miscellaneous Parameters + */ + UdNvdimmParms( uint8_t i_opType, + TARGETING::Target * i_target, + uint64_t i_buflen, + nvdimm_addr_t &i_i2cInfo ); + + /** + * @brief Destructor + */ + virtual ~UdNvdimmParms(); + + private: + // Disabled + UdNvdimmParms(UdNvdimmParms &); + UdNvdimmParms & operator=(UdNvdimmParms &); +}; + +} // end NVDIMM namespace + +#endif diff --git a/src/usr/isteps/nvdimm/makefile b/src/usr/isteps/nvdimm/makefile index ae3cae843..d68ae1173 100644 --- a/src/usr/isteps/nvdimm/makefile +++ b/src/usr/isteps/nvdimm/makefile @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2012,2018 +# Contributors Listed Below - COPYRIGHT 2012,2019 # [+] International Business Machines Corp. # # @@ -26,5 +26,7 @@ ROOTPATH = ../../../.. MODULE = nvdimm +SUBDIRS+=runtime.d + include nvdimm.mk include ${ROOTPATH}/config.mk diff --git a/src/usr/isteps/nvdimm/nvdimm.C b/src/usr/isteps/nvdimm/nvdimm.C index 13ecf0af5..9d5b668c0 100644 --- a/src/usr/isteps/nvdimm/nvdimm.C +++ b/src/usr/isteps/nvdimm/nvdimm.C @@ -28,7 +28,6 @@ #include <errl/errlentry.H> #include <errl/errlmanager.H> #include <errl/errludtarget.H> -#include <i2c/nvdimmddreasoncodes.H> #include <targeting/common/commontargeting.H> #include <targeting/common/util.H> #include <targeting/common/utilFilter.H> @@ -38,6 +37,7 @@ #include <fapi2/plat_hwp_invoker.H> #include <lib/dimm/ddr4/nvdimm_utils.H> #include <lib/mc/port.H> +#include <isteps/nvdimm/nvdimmreasoncodes.H> #include <isteps/nvdimm/nvdimm.H> using namespace TARGETING; diff --git a/src/usr/isteps/nvdimm/nvdimm.H b/src/usr/isteps/nvdimm/nvdimm.H index b365c405b..f4d9e0dac 100644 --- a/src/usr/isteps/nvdimm/nvdimm.H +++ b/src/usr/isteps/nvdimm/nvdimm.H @@ -35,6 +35,9 @@ using namespace EEPROM; +// Trace definition +extern trace_desc_t* g_trac_nvdimm; + namespace NVDIMM { @@ -75,7 +78,7 @@ enum page : uint8_t // Enums for inputs/expected output to/from the i2c registers enum i2c_in_values : uint8_t { - ARM_RESETN_AND_ATOMIC_SAVE_AND_ERASE = 0x84, + ARM_RESETN_AND_ATOMIC_SAVE_AND_ERASE = 0x84, ARM_RESETN = 0x04, ES_DEV_MANAGE = 0x01, //0x01 for device manage ERASE_IMAGE = 0x08, diff --git a/src/usr/isteps/nvdimm/nvdimm.mk b/src/usr/isteps/nvdimm/nvdimm.mk index 0c09584d5..cf5ec4fe6 100644 --- a/src/usr/isteps/nvdimm/nvdimm.mk +++ b/src/usr/isteps/nvdimm/nvdimm.mk @@ -42,5 +42,7 @@ EXTRAINCDIR += ${PROCEDURE_PATH}/hwp/memory/ EXTRAINCDIR += ${PROCEDURE_PATH}/hwp/ffdc/ OBJS += nvdimm.o +OBJS += nvdimmdd.o +OBJS += errlud_nvdimm.o VPATH += ${PROCEDURE_PATH}/hwp/memory/lib/dimm/ddr4/ diff --git a/src/usr/i2c/nvdimmdd.C b/src/usr/isteps/nvdimm/nvdimmdd.C index b70fd0915..94bce8cc1 100755 --- a/src/usr/i2c/nvdimmdd.C +++ b/src/usr/isteps/nvdimm/nvdimmdd.C @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/i2c/nvdimmdd.C $ */ +/* $Source: src/usr/isteps/nvdimm/nvdimmdd.C $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2018 */ +/* Contributors Listed Below - COPYRIGHT 2011,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -45,13 +45,14 @@ #include <targeting/common/utilFilter.H> #include <targeting/common/util.H> #include <devicefw/driverif.H> -#include <i2c/nvdimmddreasoncodes.H> -#include <i2c/nvdimmif.H> #include <i2c/eepromif.H> #include <i2c/i2creasoncodes.H> #include <i2c/i2cif.H> +#include <isteps/nvdimm/nvdimmreasoncodes.H> +#include <isteps/nvdimm/nvdimmif.H> #include "nvdimmdd.H" -#include "errlud_i2c.H" +#include "nvdimm.H" +#include "errlud_nvdimm.H" // ---------------------------------------------- // Globals @@ -61,12 +62,10 @@ mutex_t g_nvdimmMutex = MUTEX_INITIALIZER; // ---------------------------------------------- // Trace definitions // ---------------------------------------------- -trace_desc_t* g_trac_nvdimm = nullptr; -TRAC_INIT( & g_trac_nvdimm, NVDIMM_COMP_NAME, KILOBYTE ); - trace_desc_t* g_trac_nvdimmr = nullptr; TRAC_INIT( & g_trac_nvdimmr, "NVDIMMR", KILOBYTE ); + // Easy macro replace for unit testing #define TRACUCOMP(args...) TRACFCOMP(args) //#define TRACUCOMP(args...) diff --git a/src/usr/i2c/nvdimmdd.H b/src/usr/isteps/nvdimm/nvdimmdd.H index e88dbd483..4d599b38a 100755 --- a/src/usr/i2c/nvdimmdd.H +++ b/src/usr/isteps/nvdimm/nvdimmdd.H @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/i2c/nvdimmdd.H $ */ +/* $Source: src/usr/isteps/nvdimm/nvdimmdd.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2018 */ +/* Contributors Listed Below - COPYRIGHT 2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -22,8 +22,8 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ -#ifndef __NVDIMM_H -#define __NVDIMM_H +#ifndef __NVDIMMDD_H +#define __NVDIMMDD_H /** * @file nvdimmdd.H @@ -36,6 +36,7 @@ // Includes // ---------------------------------------------- #include <errl/errlentry.H> +#include <usr/devicefw/driverif.H> // I2C_MUX::NOT_APPLICABLE namespace NVDIMM { @@ -320,4 +321,4 @@ errlHndl_t nvdimmGetI2CMasterTarget ( TARGETING::Target * i_target, }; // end NVDIMM namespace -#endif // __NVDIMM_H +#endif // __NVDIMMDD_H diff --git a/src/usr/isteps/nvdimm/plugins/NVDIMM_COMP_ID_Parse.C b/src/usr/isteps/nvdimm/plugins/NVDIMM_COMP_ID_Parse.C new file mode 100644 index 000000000..6881d2952 --- /dev/null +++ b/src/usr/isteps/nvdimm/plugins/NVDIMM_COMP_ID_Parse.C @@ -0,0 +1,29 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/nvdimm/plugins/NVDIMM_COMP_ID_Parse.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,2019 */ +/* [+] 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 "errludparser.H" +#include "nvdimmUdParserFactory.H" + +ERRL_MAKE_UD_PARSER(NVDIMM::UserDetailsParserFactory, hbfw::NVDIMM_COMP_ID) + diff --git a/src/usr/isteps/nvdimm/plugins/errludP_nvdimm.H b/src/usr/isteps/nvdimm/plugins/errludP_nvdimm.H new file mode 100644 index 000000000..460add6f3 --- /dev/null +++ b/src/usr/isteps/nvdimm/plugins/errludP_nvdimm.H @@ -0,0 +1,169 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/nvdimm/plugins/errludP_nvdimm.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,2019 */ +/* [+] 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 ERRL_UDP_NVDIMM_H +#define ERRL_UDP_NVDIMM_H + +/** + * @file errludP_nvdimm.H + * + * Defines the ErrlUserDetailsParser classes that parse NVDIMM FFDC + */ + +#include "errluserdetails.H" +#include <string.h> + +/** + * Some macros to manipulate data types cleanly + */ +#define TO_UINT8(ptr) (*(reinterpret_cast<uint8_t*>(ptr))) +#define TO_UINT16(ptr) (ntohs(*(reinterpret_cast<uint16_t*>(ptr)))) +#define TO_UINT32(ptr) (ntohl(*(reinterpret_cast<uint32_t*>(ptr)))) +#define TO_UINT64(ptr) (ntohll(*(reinterpret_cast<uint64_t*>(ptr)))) + +namespace NVDIMM +{ + +/** + * @class UdParserNvdimmParms + * + * Parses UdNvdimmParms + */ +class UdParserNvdimmParms : public ERRORLOG::ErrlUserDetailsParser +{ +public: + /** + * @brief Constructor + */ + UdParserNvdimmParms() {} + + /** + * @brief Destructor + */ + virtual ~UdParserNvdimmParms() {} + + /** + * @brief Parses string user detail data from an error log + * + * @param i_version Version of the data + * @param i_parse ErrlUsrParser object for outputting information + * @param i_pBuffer Pointer to buffer containing detail data + * @param i_buflen Length of the buffer + */ + virtual void parse(errlver_t i_version, + ErrlUsrParser & i_parser, + void * i_pBuffer, + const uint32_t i_buflen) const + { + char* l_databuf = static_cast<char*>(i_pBuffer); + i_parser.PrintHeading("NVDIMM I2C Parameters"); + + //***** Memory Layout ***** + // 1 byte : Op Type Description + // 1 byte : Op Type (DeviceFW::OperationType) + // 4 bytes : Target HUID + // 8 bytes : Length of In/Out Buffer + // 8 bytes : Access Type (DeviceFW::AccessType) + // 1 byte : Port + // 1 byte : Engine + // 8 bytes : Device Address + // 1 byte : Flag: skip_mode_setup; + // 1 byte : Flag: with_stop; + // 1 byte : Flag: read_not_write; + // 8 bytes : Bus Speed (kbits/sec) + // 2 bytes : Bit Rate Divisor + // 8 bytes : Polling Interval in ns + // 8 bytes : Timeout Count; + // 1 byte : I2C MUX Bus Selector + // N bytes : I2C MUX path in string form + + uint8_t op = TO_UINT8(l_databuf); + l_databuf += sizeof(uint8_t); + + if( op == 0 ) + { + i_parser.PrintHeading("I2C Read"); + } + else if( op == 1 ) + { + i_parser.PrintHeading("I2C Write"); + } + else + { + i_parser.PrintHeading("Unknown I2C Operation"); + } + + i_parser.PrintNumber("Op Type Value","%.2lX",TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + i_parser.PrintNumber("Target HUID","%.8lX",TO_UINT32(l_databuf)); + l_databuf += sizeof(uint32_t); + i_parser.PrintNumber("Length I/O Buff","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Access Type","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Port","%.2lX",TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + i_parser.PrintNumber("Engine","%.2lX",TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + i_parser.PrintNumber("Device Address","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Flag: skip_mode_setup","%.2lX", + TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + i_parser.PrintNumber("Flag: with_stop","%.2lX",TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + i_parser.PrintNumber("Flag: read_not_write","%.2lX", + TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + i_parser.PrintNumber("Bus Speed (kbits/sec)","%.16lX", + TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Bit Rate Divisor","%.4lX",TO_UINT16(l_databuf)); + l_databuf += sizeof(uint16_t); + i_parser.PrintNumber("Polling Interval (ns)","%.16lX", + TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Timeout Count","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + + if (i_version >= 2 ) + { + i_parser.PrintNumber("I2C Mux Selector","%.2lX",TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + i_parser.PrintString("I2C Mux Path", l_databuf); + // Increment past the NULL terminated string + 1 (null terminator) + l_databuf += strlen(l_databuf) + 1; + + } + } + +private: + // Disabled + UdParserNvdimmParms(const UdParserNvdimmParms&); + UdParserNvdimmParms & operator=(const UdParserNvdimmParms&); +}; + +} // end NVDIMM namespace + +#endif diff --git a/src/usr/isteps/nvdimm/plugins/nvdimmUdParserFactory.H b/src/usr/isteps/nvdimm/plugins/nvdimmUdParserFactory.H new file mode 100644 index 000000000..b27774b13 --- /dev/null +++ b/src/usr/isteps/nvdimm/plugins/nvdimmUdParserFactory.H @@ -0,0 +1,52 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/nvdimm/plugins/nvdimmUdParserFactory.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,2019 */ +/* [+] 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 */ +#if !defined(_NVDIMMUDPARSERFACTORY_H) +#define _NVDIMMUDPARSERFACTORY_H + +#include "errludparserfactory.H" +#include "errludP_nvdimm.H" + +namespace NVDIMM +{ + class UserDetailsParserFactory + : public ERRORLOG::ErrlUserDetailsParserFactory + { + public: + UserDetailsParserFactory() + { + registerParser<NVDIMM::UdParserNvdimmParms> + (NVDIMM_UDT_PARAMETERS); + } + + private: + + UserDetailsParserFactory(const UserDetailsParserFactory &); + UserDetailsParserFactory & operator= + (const UserDetailsParserFactory &); + }; +}; + +#endif + diff --git a/src/usr/isteps/nvdimm/runtime/makefile b/src/usr/isteps/nvdimm/runtime/makefile new file mode 100644 index 000000000..85433ea66 --- /dev/null +++ b/src/usr/isteps/nvdimm/runtime/makefile @@ -0,0 +1,34 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/isteps/nvdimm/runtime/makefile $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2019 +# [+] 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 +HOSTBOOT_RUNTIME = 1 + +ROOTPATH = ../../../../.. + +VPATH += ../ + +MODULE = nvdimm_rt + +include ../nvdimm.mk +include ${ROOTPATH}/config.mk diff --git a/src/usr/isteps/pm/runtime/makefile b/src/usr/isteps/pm/runtime/makefile index c3be1b818..287fe61a1 100644 --- a/src/usr/isteps/pm/runtime/makefile +++ b/src/usr/isteps/pm/runtime/makefile @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2016,2018 +# Contributors Listed Below - COPYRIGHT 2016,2019 # [+] International Business Machines Corp. # # @@ -31,17 +31,11 @@ VPATH += ../ MODULE = pm_rt -EXTRAINCDIR += ${ROOTPATH}/src/usr/isteps/nvdimm - ## Objects unique to HBRT OBJS += rt_pm.o -## Dependencies for nvdimm.mk -VPATH += ${ROOTPATH}/src/usr/isteps/nvdimm - SUBDIRS += test.d ## Objects common to HBRT and HB IPL include ../pm.mk -include ${ROOTPATH}/src/usr/isteps/nvdimm/nvdimm.mk include ${ROOTPATH}/config.mk |