diff options
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/hwas/common/hwas.C | 10 | ||||
-rw-r--r-- | src/usr/hwas/hwasPlat.C | 29 | ||||
-rw-r--r-- | src/usr/hwas/makefile | 3 | ||||
-rw-r--r-- | src/usr/i2c/i2c.mk | 1 | ||||
-rw-r--r-- | src/usr/i2c/i2cTargetPres.C | 337 | ||||
-rw-r--r-- | src/usr/i2c/makefile | 3 | ||||
-rw-r--r-- | src/usr/i2c/mux_i2c.C | 78 | ||||
-rw-r--r-- | src/usr/i2c/mux_i2c.H | 79 | ||||
-rw-r--r-- | src/usr/targeting/common/xmltohb/simics_AXONE.system.xml | 9 | ||||
-rw-r--r-- | src/usr/targeting/common/xmltohb/target_types.xml | 3 | ||||
-rw-r--r-- | src/usr/vpd/ddimm.C | 311 | ||||
-rw-r--r-- | src/usr/vpd/vpd.H | 6 | ||||
-rw-r--r-- | src/usr/vpd/vpd.mk | 3 |
13 files changed, 389 insertions, 483 deletions
diff --git a/src/usr/hwas/common/hwas.C b/src/usr/hwas/common/hwas.C index d8530ad98..2cb7e9491 100644 --- a/src/usr/hwas/common/hwas.C +++ b/src/usr/hwas/common/hwas.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2018 */ +/* Contributors Listed Below - COPYRIGHT 2012,2019 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -701,9 +701,12 @@ errlHndl_t discoverTargets() PredicateCTM predChip(CLASS_CHIP); PredicateCTM predDimm(CLASS_LOGICAL_CARD, TYPE_DIMM); PredicateCTM predMcs(CLASS_UNIT, TYPE_MCS); + // We can ignore chips of TYPE_I2C_MUX because they + // were already detected above in discoverMuxTargetsAndEnable + PredicateCTM predMux(CLASS_CHIP, TYPE_I2C_MUX); PredicatePostfixExpr checkExpr; checkExpr.push(&predChip).push(&predDimm).Or().push(&predEnc).Or(). - push(&predMcs).Or(); + push(&predMcs).Or().push(&predMux).Not().And(); TargetHandleList pCheckPres; targetService().getAssociated( pCheckPres, pSys, @@ -764,8 +767,7 @@ errlHndl_t discoverTargets() if( (pTarget->getAttr<ATTR_CLASS>() == CLASS_CHIP) && (l_targetType != TYPE_TPM) && (l_targetType != TYPE_SP) && - (l_targetType != TYPE_BMC) && - (l_targetType != TYPE_I2C_MUX) ) + (l_targetType != TYPE_BMC) ) { // read Chip ID/EC data from these physical chips errl = platReadIDEC(pTarget); diff --git a/src/usr/hwas/hwasPlat.C b/src/usr/hwas/hwasPlat.C index cf436b869..35e9588e0 100644 --- a/src/usr/hwas/hwasPlat.C +++ b/src/usr/hwas/hwasPlat.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2018 */ +/* Contributors Listed Below - COPYRIGHT 2012,2019 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -49,6 +49,8 @@ #include <config.h> #include <targeting/common/targetservice.H> +#include <chipids.H> + namespace HWAS { @@ -227,6 +229,31 @@ DEVICE_REGISTER_ROUTE(DeviceFW::WRITE, TARGETING::TYPE_MEMBUF, cfamIDEC); +errlHndl_t ocmbIDEC(DeviceFW::OperationType i_opType, + TARGETING::Target* i_target, + void* io_buffer, + size_t& io_buflen, + int64_t i_accessType, + va_list i_args) +{ + // for now just hardcode the answer to something explicitly invalid + uint8_t l_ec = INVALID__ATTR_EC; + i_target->setAttr<TARGETING::ATTR_EC>(l_ec); + i_target->setAttr<TARGETING::ATTR_HDAT_EC>(l_ec); + + // we can assume this is an Explorer chip though + uint32_t l_id = POWER_CHIPID::EXPLORER_16; + i_target->setAttr<TARGETING::ATTR_CHIP_ID>(l_id); + + return nullptr; +} + +// Register the presence detect function with the device framework +DEVICE_REGISTER_ROUTE(DeviceFW::WRITE, + DeviceFW::IDEC, + TARGETING::TYPE_OCMB_CHIP, + ocmbIDEC); + //****************************************************************************** // platIsMinHwCheckingAllowed function // Description: This function will return false always because when Hostboot diff --git a/src/usr/hwas/makefile b/src/usr/hwas/makefile index 3d9589578..625a9f677 100644 --- a/src/usr/hwas/makefile +++ b/src/usr/hwas/makefile @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2011,2018 +# Contributors Listed Below - COPYRIGHT 2011,2019 # [+] International Business Machines Corp. # # @@ -36,6 +36,7 @@ EXTRAINCDIR += ${ROOTPATH}/src/usr/isteps EXTRAINCDIR += ${ROOTPATH}/src/import/hwpf/fapi2/include/ EXTRAINCDIR += ${ROOTPATH}/src/include/usr/fapi2/ EXTRAINCDIR += ${ROOTPATH}/src/import/chips/common/utils/imageProcs/ +EXTRAINCDIR += ${ROOTPATH}/src/import/chips/common/utils/ EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc VPATH += ${ROOTPATH}/src/usr/hwas/plat diff --git a/src/usr/i2c/i2c.mk b/src/usr/i2c/i2c.mk index ac31ba45f..822f1d948 100644 --- a/src/usr/i2c/i2c.mk +++ b/src/usr/i2c/i2c.mk @@ -25,5 +25,4 @@ # common objects with runtime OBJS += eepromdd.o OBJS += errlud_i2c.o -OBJS += mux_i2c.o OBJS += $(if $(CONFIG_NVDIMM),nvdimmdd.o,) diff --git a/src/usr/i2c/i2cTargetPres.C b/src/usr/i2c/i2cTargetPres.C new file mode 100644 index 000000000..2b28ba76c --- /dev/null +++ b/src/usr/i2c/i2cTargetPres.C @@ -0,0 +1,337 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/i2c/i2cTargetPres.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2018 */ +/* [+] 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 <devicefw/driverif.H> +#include <fsi/fsiif.H> +#include <vpd/vpd_if.H> +#include <i2c/i2cif.H> +#include <i2c/i2creasoncodes.H> +#include <initservice/initserviceif.H> +#include <errl/errlmanager.H> + +extern trace_desc_t* g_trac_i2c; + +//#define TRACSSCOMP(args...) TRACFCOMP(args) +#define TRACSSCOMP(args...) + +namespace I2C +{ + +/** + * @brief Performs a presence detect operation on a Target that has the + * ATTR_FAPI_I2C_CONTROL_INFO and can be detected via that device + * + * Currently used to detect I2C_MUTEX and OCMB_CHIP targets + * + * @param[in] i_target Presence detect target + * @param[in] i_buflen lengh of operation requested + * @param[in] o_present Present = 1, NOT Present = 0 + * @ + * @return errlHndl_t + */ +errlHndl_t genericI2CTargetPresenceDetect(TARGETING::Target* i_target, + size_t i_buflen, + bool & o_present) +{ + errlHndl_t l_errl = nullptr; + bool l_target_present = false; + bool l_i2cMaster_exists = false; + TARGETING::Target * l_i2cMasterTarget = nullptr; + TARGETING::Target* l_masterProcTarget = nullptr; + TARGETING::ATTR_FAPI_I2C_CONTROL_INFO_type l_i2cInfo; + + TRACSSCOMP( g_trac_i2c, ENTER_MRK"genericI2CTargetPresenceDetect() " + "Target HUID 0x%.08X ENTER", TARGETING::get_huid(i_target)); + + do{ + if (unlikely(i_buflen != sizeof(bool))) + { + TRACFCOMP(g_trac_i2c, + ERR_MRK "I2C::ddimmPresenceDetect> Invalid data length: %d", + i_buflen); + /*@ + * @errortype + * @moduleid I2C::I2C_GENERIC_PRES_DETECT + * @reasoncode I2C::I2C_INVALID_LENGTH + * @userdata1 Data Length + * @userdata2 HUID of target being detected + * @devdesc ddimmPresenceDetect> Invalid data length (!= 1 bytes) + * @custdesc Firmware error during boot + */ + l_errl = + new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + I2C::I2C_GENERIC_PRES_DETECT, + I2C::I2C_INVALID_LENGTH, + TO_UINT64(i_buflen), + TARGETING::get_huid(i_target), + ERRORLOG::ErrlEntry::ADD_SW_CALLOUT); + break; + } + + // Get a ptr to the target service which we will use later on + TARGETING::TargetService& l_targetService = TARGETING::targetService(); + + // Read Attributes needed to complete the operation + l_i2cInfo = i_target->getAttr<TARGETING::ATTR_FAPI_I2C_CONTROL_INFO>(); + + // Check if the target set as the i2cMasterPath actually exists + l_targetService.exists(l_i2cInfo.i2cMasterPath, l_i2cMaster_exists); + + // if the i2c master listed doesn't exist then bail out -- this target is not present + if(!l_i2cMaster_exists) + { + TRACFCOMP(g_trac_i2c, + ERR_MRK"I2C::genericI2CTargetPresenceDetect> I2C Master in FAPI_I2C_CONTROL_INFO for Target 0x.08%X does not exist, target not present", + TARGETING::get_huid(i_target)); + + /*@ + * @errortype + * @moduleid I2C::I2C_GENERIC_PRES_DETECT + * @reasoncode VPD::VPD_INVALID_MASTER_I2C_PATH + * @userdata1 HUID of target being detected + * @userdata2 Unused + * @devdesc ocmbPresenceDetect> Invalid master i2c path + * @custdesc Firmware error during boot + */ + l_errl = + new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + I2C::I2C_GENERIC_PRES_DETECT, + I2C::INVALID_MASTER_TARGET, + TARGETING::get_huid(i_target), + 0, + ERRORLOG::ErrlEntry::ADD_SW_CALLOUT); + + break; + } + + // if we think it exists then lookup the master path with the target service + l_i2cMasterTarget = l_targetService.toTarget(l_i2cInfo.i2cMasterPath); + + // if target service returns a null ptr for the path something is wrong and we should + // mark the target not present + if(l_i2cMasterTarget == nullptr) + { + TRACFCOMP(g_trac_i2c, + ERR_MRK"I2C::genericI2CTargetPresenceDetect> I2C Master in FAPI_I2C_CONTROL_INFO for Target 0x.08%X returned a nullptr, target not present", + TARGETING::get_huid(i_target)); + + /*@ + * @errortype + * @moduleid I2C::I2C_GENERIC_PRES_DETECT + * @reasoncode I2C::I2C_NULL_MASTER_TARGET + * @userdata1 HUID of target being detected + * @userdata2 Unused + * @devdesc ocmbPresenceDetect> Master i2c path returned nullptr + * @custdesc Firmware error during boot + */ + l_errl = + new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + I2C::I2C_GENERIC_PRES_DETECT, + I2C::I2C_NULL_MASTER_TARGET, + TARGETING::get_huid(i_target), + 0, + ERRORLOG::ErrlEntry::ADD_SW_CALLOUT); + + break; + } + + TRACSSCOMP( g_trac_i2c, "I2C::genericI2CTargetPresenceDetect> i2c master for target 0x%.08X is HUID 0x%.08X", + TARGETING::get_huid(i_target), TARGETING::get_huid(l_i2cMasterTarget)); + + // Master proc is taken as always present. Validate other targets. + TARGETING::targetService().masterProcChipTargetHandle(l_masterProcTarget ); + + if (l_i2cMasterTarget != l_masterProcTarget) + { + // Use the FSI slave presence detection to see if master i2c can be found + if( ! FSI::isSlavePresent(l_i2cMasterTarget) ) + { + TRACFCOMP( g_trac_i2c, + ERR_MRK"genericI2CTargetPresenceDetect> isSlavePresent returned false for I2C Master Target %.08X", + TARGETING::get_huid(l_i2cMasterTarget)); + break; + } + } + + //*********************************************************************************** + //* If we make it through all of the checks then we have verified master is present * + //*********************************************************************************** + + //Check for the target at the I2C level + l_target_present = I2C::i2cPresence(l_i2cMasterTarget, + l_i2cInfo.port, + l_i2cInfo.engine, + l_i2cInfo.devAddr ); + }while(0); + + o_present = l_target_present; + + TRACSSCOMP( g_trac_i2c, EXIT_MRK"genericI2CTargetPresenceDetect() " + "Target HUID 0x%.08X found to be %s present EXIT", TARGETING::get_huid(i_target), o_present ? "" : "NOT" ); + + return l_errl; +} + +/** + * @brief Performs a presence detect operation on a OCMB Target + * + * @param[in] i_opType Operation type, see DeviceFW::OperationType + * in driverif.H + * @param[in] i_target Presence detect target + * @param[in/out] io_buffer Read: Pointer to output data storage + * Write: Pointer to input data storage + * @param[in/out] io_buflen Input: size of io_buffer (in bytes, always 1) + * Output: Success = 1, Failure = 0 + * @param[in] i_accessType DeviceFW::AccessType enum (userif.H) + * @param[in] i_args This is an argument list for DD framework. + * In this function, there are no arguments. + * @return errlHndl_t + */ +errlHndl_t ocmbI2CPresencePerformOp(DeviceFW::OperationType i_opType, + TARGETING::Target* i_target, + void* io_buffer, + size_t& io_buflen, + int64_t i_accessType, + va_list i_args) +{ + bool l_ocmbPresent = 0; + // Error log which will eventually be returned + errlHndl_t l_returnedError = nullptr; + // Useful if two errors occur, but we still want to return first one + // from this function + errlHndl_t l_invalidateErrl = nullptr; + + l_returnedError = genericI2CTargetPresenceDetect(i_target, + io_buflen, + l_ocmbPresent); + + if (l_returnedError) + { + TRACFCOMP( g_trac_i2c, ERR_MRK"ocmbI2CTargetPresenceDetect() " + "Error detecting OCMB target 0x%.08X, io_buffer will not be set.", + " Invalidating SPD cache for target in pnor. ", + TARGETING::get_huid(i_target)); + } + else + { + // Copy variable describing if target is present or not to i/o buffer param + memcpy(io_buffer, &l_ocmbPresent, sizeof(l_ocmbPresent)); + io_buflen = sizeof(l_ocmbPresent); + } + + // If OCMB was found to not be present, or an error occurred + // while checking presence, invalidate the pnor cache of this + // SPD data + if(!l_ocmbPresent || l_returnedError) + { + // Invalidate the SPD in PNOR + l_invalidateErrl = VPD::invalidatePnorCache(i_target); + + if (l_invalidateErrl) + { + TRACFCOMP( g_trac_i2c, ERR_MRK"ocmbI2CTargetPresenceDetect() " + "Error invalidating SPD in PNOR for target 0x%.08X", + TARGETING::get_huid(i_target)); + // If there was an error found while running genericI2CTargetPresenceDetect + // then we want return that error and just link the error we found from + // invalidatePnorCache and commit it right away. If this is the first error + // we encounter then we will just return the error from invalidatePnorCache + if(l_returnedError) + { + l_invalidateErrl->plid(l_returnedError->plid()); + errlCommit(l_invalidateErrl, I2C_COMP_ID); + } + else + { + l_returnedError = l_invalidateErrl; + l_invalidateErrl = nullptr; + } + } + } + + return l_returnedError; +} + +/** + * @brief Performs a presence detect operation on a Target that has the + * ATTR_FAPI_I2C_CONTROL_INFO and can be detected via that device + * + * Currently used to detect I2C_MUTEX targets + * + * @param[in] i_opType Operation type, see DeviceFW::OperationType + * in driverif.H + * @param[in] i_target Presence detect target + * @param[in/out] io_buffer Read: Pointer to output data storage + * Write: Pointer to input data storage + * @param[in/out] io_buflen Input: size of io_buffer (in bytes, always 1) + * Output: Success = 1, Failure = 0 + * @param[in] i_accessType DeviceFW::AccessType enum (userif.H) + * @param[in] i_args This is an argument list for DD framework. + * In this function, there are no arguments. + * @return errlHndl_t + */ +errlHndl_t basicI2CPresencePerformOp(DeviceFW::OperationType i_opType, + TARGETING::Target* i_target, + void* io_buffer, + size_t& io_buflen, + int64_t i_accessType, + va_list i_args) +{ + bool l_muxPresent = 0; + errlHndl_t l_returnedError = nullptr; + + l_returnedError = genericI2CTargetPresenceDetect(i_target, + io_buflen, + l_muxPresent); + + if (l_returnedError) + { + TRACFCOMP( g_trac_i2c, ERR_MRK"basicI2CTargetPresenceDetect() " + "Error detecting target 0x%.08X, io_buffer will not be set", + TARGETING::get_huid(i_target)); + } + else + { + // Copy variable describing if target is present or not to i/o buffer param + memcpy(io_buffer, &l_muxPresent, sizeof(l_muxPresent)); + io_buflen = sizeof(l_muxPresent); + } + + return l_returnedError; +} + +// Register the ocmb presence detect function with the device framework +DEVICE_REGISTER_ROUTE(DeviceFW::READ, + DeviceFW::PRESENT, + TARGETING::TYPE_OCMB_CHIP, + ocmbI2CPresencePerformOp); + +// Register the i2c mux presence detect function with the device framework +DEVICE_REGISTER_ROUTE( DeviceFW::READ, + DeviceFW::PRESENT, + TARGETING::TYPE_I2C_MUX, + basicI2CPresencePerformOp ); + +} diff --git a/src/usr/i2c/makefile b/src/usr/i2c/makefile index baefb1bed..535484752 100644 --- a/src/usr/i2c/makefile +++ b/src/usr/i2c/makefile @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2011,2018 +# Contributors Listed Below - COPYRIGHT 2011,2019 # [+] International Business Machines Corp. # # @@ -32,6 +32,7 @@ include i2c.mk OBJS += i2c.o OBJS += $(if $(CONFIG_TPMDD),tpmdd.o,) OBJS += fapi_i2c_dd.o +OBJS += i2cTargetPres.o SUBDIRS += test.d SUBDIRS += runtime.d diff --git a/src/usr/i2c/mux_i2c.C b/src/usr/i2c/mux_i2c.C deleted file mode 100644 index 39447a14c..000000000 --- a/src/usr/i2c/mux_i2c.C +++ /dev/null @@ -1,78 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/i2c/mux_i2c.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2011,2018 */ -/* [+] 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 mux_i2c.C - * - * @brief I2C MUX utility functions - * - */ - -// ----------------------------------------------------------------------------- -// Includes -// ----------------------------------------------------------------------------- -#include "mux_i2c.H" - -// ----------------------------------------------------------------------------- -// Trace definitions -// ----------------------------------------------------------------------------- -extern trace_desc_t* g_trac_i2c; - -namespace MUX_I2C -{ - -using namespace TARGETING; - -// Register the presence detect for the I2C MUX -DEVICE_REGISTER_ROUTE( DeviceFW::READ, - DeviceFW::PRESENT, - TARGETING::TYPE_I2C_MUX, - i2cMuxPresenceDetect ); - - -// ------------------------------------------------------------------ -// i2cMuxPresenceDetect -// ------------------------------------------------------------------ -errlHndl_t i2cMuxPresenceDetect(DeviceFW::OperationType i_opType, - TargetHandle_t i_target, - void* io_isPresentBuffer, - size_t& io_isPresentBufferSize, - int64_t i_accessType, - va_list i_args) -{ - TRACDCOMP(g_trac_i2c, ENTER_MRK"i2cMuxPresenceDetect()"); - - // Always return true - bool l_present = true; - memcpy(io_isPresentBuffer, &l_present, sizeof(l_present)); - io_isPresentBufferSize = sizeof(l_present); - - TRACDCOMP(g_trac_i2c, EXIT_MRK"i2cMuxPresenceDetect()"); - - return nullptr; -} - - -} // namespace MUX_I2C diff --git a/src/usr/i2c/mux_i2c.H b/src/usr/i2c/mux_i2c.H deleted file mode 100644 index ed39e000a..000000000 --- a/src/usr/i2c/mux_i2c.H +++ /dev/null @@ -1,79 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/i2c/mux_i2c.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ -/* [+] 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 __MUX_I2C_H -#define __MUX_I2C_H - -/** - * @file mux_i2c.H - * - * @brief I2C MUX utility functions API - * - */ - -// ----------------------------------------------------------------------------- -// Includes -// ----------------------------------------------------------------------------- -// Integral support -#include <stdint.h> // uint64_t - -// Error handling support -#include <errl/errlentry.H> // errlHndl_t - -// Targeting support -#include <targeting/common/target.H> // TARGETING::TargetHandle_t - -// Driver support -#include <devicefw/driverif.H> // DeviceFW::OperationType - -namespace MUX_I2C -{ - -/** - * @brief Performs a presence detect operation on an I2C MUX. - * This is used during the target discovery (hwas.C::discoverTargets) phase - * - * @note As of current needs/requirements this always returns true (present). - * - * @param[in] i_opType Operation type, see DeviceFW::OperationType - * in driverif.H - * @param[in] i_target I2C MUX target - * @param[out] o_isPresentBuffer Pointer to output data storage - * Output: is present = 1, is not present = 0 - * @param[out] o_isPresentBufferSize Size of o_isPresentBuffer - * (in bytes, always 1) - * @param[in] i_accessType DeviceFW::AccessType enum (userif.H) - * @param[in] i_args In this function, there are no arguments. - * @return errlHndl_t Returns a pointer to an ErrlEntry if error, - * else nullptr if no error - */ - errlHndl_t i2cMuxPresenceDetect(DeviceFW::OperationType i_opType, - TARGETING::TargetHandle_t i_target, - void* o_isPresentBuffer, - size_t& o_isPresentBufferSize, - int64_t i_accessType, - va_list i_args); -} // namespace MUX_I2C - -#endif diff --git a/src/usr/targeting/common/xmltohb/simics_AXONE.system.xml b/src/usr/targeting/common/xmltohb/simics_AXONE.system.xml index d6920ad53..662e283ea 100644 --- a/src/usr/targeting/common/xmltohb/simics_AXONE.system.xml +++ b/src/usr/targeting/common/xmltohb/simics_AXONE.system.xml @@ -13306,6 +13306,15 @@ <field><id>engine</id><value>3</value></field> </default> </attribute> + <attribute> + <id>FAPI_I2C_CONTROL_INFO</id> + <default> + <field><id>i2cMasterPath</id><value>physical:sys-0/node-0/proc-0</value></field> + <field><id>port</id><value>0</value></field> + <field><id>devAddr</id><value>0xE0</value></field> + <field><id>engine</id><value>3</value></field> + </default> + </attribute> </targetInstance> </attributes> diff --git a/src/usr/targeting/common/xmltohb/target_types.xml b/src/usr/targeting/common/xmltohb/target_types.xml index 201d56846..5fc610519 100644 --- a/src/usr/targeting/common/xmltohb/target_types.xml +++ b/src/usr/targeting/common/xmltohb/target_types.xml @@ -970,6 +970,9 @@ <id>i2c_mux_pca9847</id> <parent>chip</parent> <attribute> + <id>FAPI_I2C_CONTROL_INFO</id> + </attribute> + <attribute> <id>I2C_MUX_INFO</id> </attribute> <attribute> diff --git a/src/usr/vpd/ddimm.C b/src/usr/vpd/ddimm.C deleted file mode 100644 index 343a49b1e..000000000 --- a/src/usr/vpd/ddimm.C +++ /dev/null @@ -1,311 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/vpd/ddimm.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ -/* [+] 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 */ -/** - * Provides functionality related to the DDIMM package - */ - - -#include <targeting/common/attributes.H> -#include <targeting/common/predicates/predicatectm.H> -#include <devicefw/driverif.H> -#include <fsi/fsiif.H> -#include <i2c/i2cif.H> -#include <initservice/initserviceif.H> -#include <vpd/vpd_if.H> -#include <vpd/vpdreasoncodes.H> -#include <errl/errlmanager.H> -#include <hwas/common/hwasCallout.H> -#include <config.h> -#include "spd.H" -#include <chipids.H> - -extern trace_desc_t* g_trac_vpd; - -//#define TRACSSCOMP(args...) TRACFCOMP(args) -#define TRACSSCOMP(args...) - -namespace VPD -{ - -#ifndef __HOSTBOOT_RUNTIME // No presence detection in HBRT - -/** - * @brief Performs a presence detect operation on a OCMB Chip. - * - * There is no way to access the OCMB until later in the IPL so we will - * use the existence of VPD as the only indication.. - * - * @param[in] i_opType Operation type, see DeviceFW::OperationType - * in driverif.H - * @param[in] i_target Presence detect target - * @param[in/out] io_buffer Read: Pointer to output data storage - * Write: Pointer to input data storage - * @param[in/out] io_buflen Input: size of io_buffer (in bytes, always 1) - * Output: Success = 1, Failure = 0 - * @param[in] i_accessType DeviceFW::AccessType enum (userif.H) - * @param[in] i_args This is an argument list for DD framework. - * In this function, there are no arguments. - * @return errlHndl_t - */ -errlHndl_t ocmbPresenceDetect(DeviceFW::OperationType i_opType, - TARGETING::Target* i_target, - void* io_buffer, - size_t& io_buflen, - int64_t i_accessType, - va_list i_args) -{ - errlHndl_t l_errl = nullptr; - bool l_ocmb_present = false; - bool l_i2cMaster_exists = false; - TARGETING::Target * l_i2cMasterTarget = nullptr; - TARGETING::Target* l_masterProcTarget = nullptr; - TARGETING::ATTR_FAPI_I2C_CONTROL_INFO_type l_i2cInfo; - uint32_t l_commonPlid = 0; - - TRACSSCOMP( g_trac_vpd, ENTER_MRK"ocmbPresenceDetect() " - "OCMB HUID 0x%.08X ENTER", TARGETING::get_huid(i_target)); - - do{ - - if (unlikely(io_buflen != sizeof(bool))) - { - TRACFCOMP(g_trac_vpd, - ERR_MRK "VPD::ocmbPresenceDetect> Invalid data length: %d", - io_buflen); - /*@ - * @errortype - * @moduleid VPD::MOD_OCMBPRESENCEDETECT - * @reasoncode VPD::VPD_INVALID_LENGTH - * @userdata1 Data Length - * @userdata2 HUID of target being detected - * @devdesc ocmbPresenceDetect> Invalid data length (!= 1 bytes) - * @custdesc Firmware error during boot - */ - l_errl = - new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, - VPD::MOD_OCMBPRESENCEDETECT, - VPD::VPD_INVALID_LENGTH, - TO_UINT64(io_buflen), - TARGETING::get_huid(i_target), - ERRORLOG::ErrlEntry::ADD_SW_CALLOUT); - break; - } - - // Get a ptr to the target service which we will use later on - TARGETING::TargetService& l_targetService = TARGETING::targetService(); - - // Read Attributes needed to complete the operation - l_i2cInfo = i_target->getAttr<TARGETING::ATTR_FAPI_I2C_CONTROL_INFO>(); - - // Check if the target set as the i2cMasterPath actually exists - l_targetService.exists(l_i2cInfo.i2cMasterPath, l_i2cMaster_exists); - - // if the i2c master listed doesn't exist then bail out -- this OCMB is not present - if(!l_i2cMaster_exists) - { - TRACFCOMP(g_trac_vpd, - ERR_MRK"VPD::ocmbPresenceDetect> I2C Master in FAPI_I2C_CONTROL_INFO for OCMB 0x.08%X does not exist, target not present", - TARGETING::get_huid(i_target)); - - /*@ - * @errortype - * @moduleid VPD::MOD_OCMBPRESENCEDETECT - * @reasoncode VPD::VPD_INVALID_MASTER_I2C_PATH - * @userdata1 HUID of target being detected - * @userdata2 Unused - * @devdesc ocmbPresenceDetect> Invalid master i2c path - * @custdesc Firmware error during boot - */ - l_errl = - new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, - VPD::MOD_OCMBPRESENCEDETECT, - VPD::VPD_INVALID_MASTER_I2C_PATH, - TARGETING::get_huid(i_target), - 0, - ERRORLOG::ErrlEntry::ADD_SW_CALLOUT); - - break; - } - - // if we think it exists then lookup the master path with the target service - l_i2cMasterTarget = l_targetService.toTarget(l_i2cInfo.i2cMasterPath); - - // if target service returns a null ptr for the path something is wrong and we should - // mark the OCMB not present - if(l_i2cMasterTarget == nullptr) - { - TRACFCOMP(g_trac_vpd, - ERR_MRK"VPD::ocmbPresenceDetect> I2C Master in FAPI_I2C_CONTROL_INFO for OCMB 0x.08%X returned a nullptr, target not present", - TARGETING::get_huid(i_target)); - - /*@ - * @errortype - * @moduleid VPD::MOD_OCMBPRESENCEDETECT - * @reasoncode VPD::VPD_NULL_I2C_MASTER - * @userdata1 HUID of target being detected - * @userdata2 Unused - * @devdesc ocmbPresenceDetect> Master i2c path returned nullptr - * @custdesc Firmware error during boot - */ - l_errl = - new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, - VPD::MOD_OCMBPRESENCEDETECT, - VPD::VPD_NULL_I2C_MASTER, - TARGETING::get_huid(i_target), - 0, - ERRORLOG::ErrlEntry::ADD_SW_CALLOUT); - - break; - } - - TRACSSCOMP( g_trac_vpd, "VPD::ocmbPresenceDetect> i2c master for OCMB 0x%.08X is HUID 0x%.08X", - TARGETING::get_huid(i_target), TARGETING::get_huid(l_i2cMasterTarget)); - - // Master proc is taken as always present. Validate other targets. - TARGETING::targetService().masterProcChipTargetHandle(l_masterProcTarget ); - - if (l_i2cMasterTarget != l_masterProcTarget) - { - // Use the FSI slave presence detection to see if master i2c can be found - if( ! FSI::isSlavePresent(l_i2cMasterTarget) ) - { - TRACFCOMP( g_trac_vpd, - ERR_MRK"ocmbPresenceDetect> isSlavePresent returned false for I2C Master Target 0x%.08X. " - "This implies 0x%.08X is also NOT present", - TARGETING::get_huid(l_i2cMasterTarget), TARGETING::get_huid(i_target)); - break; - } - } - - //*********************************************************************************** - //* If we make it through all of the checks then we have verified master is present * - //*********************************************************************************** - - //Check for the target at the I2C level - l_ocmb_present = I2C::i2cPresence(l_i2cMasterTarget, - l_i2cInfo.port, - l_i2cInfo.engine, - l_i2cInfo.devAddr ); - - if(l_ocmb_present ) - { -#if defined(CONFIG_MEMVPD_READ_FROM_HW) && defined(CONFIG_MEMVPD_READ_FROM_PNOR) - // Check if the VPD data in the PNOR matches the SEEPROM - l_errl = VPD::ensureCacheIsInSync( i_target ); - if( l_errl ) - { - // Save this plid to use later - l_commonPlid = l_errl->plid(); - l_ocmb_present = false; - - TRACFCOMP(g_trac_vpd,ERR_MRK "VPD::ocmbPresenceDetect> Error during ensureCacheIsInSync (DDIMM)" ); - errlCommit( l_errl, VPD_COMP_ID ); - l_errl = nullptr; - } -#endif - //Fsp sets PN/SN so if there is none, do it here - if(!INITSERVICE::spBaseServicesEnabled()) - { - // set part and serial number attributes for current target - SPD::setPartAndSerialNumberAttributes( i_target ); - } - } - else - { - TRACFCOMP(g_trac_vpd, - ERR_MRK"VPD::ocmbPresenceDetect> i2cPresence returned false! OCMB chip 0x%.08X is NOT Present!", - TARGETING::get_huid(i_target)); - } - }while(0); - - if(!l_ocmb_present) - { - // Invalidate the SPD in PNOR - l_errl = VPD::invalidatePnorCache(i_target); - if (l_errl) - { - // Link the logs if there was an existing log - if(l_commonPlid) - { - l_errl->plid(l_commonPlid); - } - - TRACFCOMP( g_trac_vpd, ERR_MRK"dimmPresenceDetect() " - "Error invalidating SPD in PNOR for target 0x%.08X", - TARGETING::get_huid(i_target)); - } - } - - // Copy variable describing if ocmb is present or not to i/o buffer param - memcpy(io_buffer, &l_ocmb_present, sizeof(l_ocmb_present)); - io_buflen = sizeof(l_ocmb_present); - - TRACSSCOMP( g_trac_vpd, EXIT_MRK"ocmbPresenceDetect() " - "OCMB HUID 0x%.08X EXIT", TARGETING::get_huid(i_target)); - - return l_errl; -} - -// Register the presence detect function with the device framework -DEVICE_REGISTER_ROUTE(DeviceFW::READ, - DeviceFW::PRESENT, - TARGETING::TYPE_OCMB_CHIP, - ocmbPresenceDetect); - - -//@fixme - RTC:201996 - Collect IDEC later in the boot -errlHndl_t ocmbIDEC(DeviceFW::OperationType i_opType, - TARGETING::Target* i_target, - void* io_buffer, - size_t& io_buflen, - int64_t i_accessType, - va_list i_args) -{ - // for now just hardcode the answer to something explicitly invalid - uint8_t l_ec = INVALID__ATTR_EC; - i_target->setAttr<TARGETING::ATTR_EC>(l_ec); - i_target->setAttr<TARGETING::ATTR_HDAT_EC>(l_ec); - - // we can assume this is an Explorer chip though - uint32_t l_id = POWER_CHIPID::EXPLORER_16; - i_target->setAttr<TARGETING::ATTR_CHIP_ID>(l_id); - - return nullptr; -} - -// Register the presence detect function with the device framework -DEVICE_REGISTER_ROUTE(DeviceFW::WRITE, - DeviceFW::IDEC, - TARGETING::TYPE_OCMB_CHIP, - ocmbIDEC); - - -#endif // !__HOSTBOOT_RUNTIME - - -//Other DDIMM functions go here - - -}; //namespace VPD diff --git a/src/usr/vpd/vpd.H b/src/usr/vpd/vpd.H index 28582d0d9..83f4ce755 100644 --- a/src/usr/vpd/vpd.H +++ b/src/usr/vpd/vpd.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2018 */ +/* Contributors Listed Below - COPYRIGHT 2013,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -301,9 +301,5 @@ void updateSerialNumberFromBMC( TARGETING::Target * i_nodetarget ); // default invalid value for ATTR_VPD_REC_NUM constexpr TARGETING::ATTR_VPD_REC_NUM_type INVALID__ATTR_VPD_REC_NUM = 0xFFFF; -// default unknown EC level -constexpr TARGETING::ATTR_EC_type INVALID__ATTR_EC = 0xFF; - - }; //end VPD namespace #endif diff --git a/src/usr/vpd/vpd.mk b/src/usr/vpd/vpd.mk index 25daaa933..d5717e653 100644 --- a/src/usr/vpd/vpd.mk +++ b/src/usr/vpd/vpd.mk @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2013,2018 +# Contributors Listed Below - COPYRIGHT 2013,2019 # [+] International Business Machines Corp. # # @@ -35,4 +35,3 @@ OBJS += pvpd.o OBJS += dvpd.o OBJS += spd.o OBJS += errlud_vpd.o -OBJS += ddimm.o |