diff options
Diffstat (limited to 'hwpf/plat/src')
-rw-r--r-- | hwpf/plat/src/Makefile | 21 | ||||
-rw-r--r-- | hwpf/plat/src/array.C | 145 | ||||
-rw-r--r-- | hwpf/plat/src/error_info.C | 410 | ||||
-rw-r--r-- | hwpf/plat/src/fapi2ppefiles.mk | 30 | ||||
-rw-r--r-- | hwpf/plat/src/ffdc.C | 57 | ||||
-rw-r--r-- | hwpf/plat/src/plat_utils.C | 212 | ||||
-rw-r--r-- | hwpf/plat/src/target.C | 441 |
7 files changed, 0 insertions, 1316 deletions
diff --git a/hwpf/plat/src/Makefile b/hwpf/plat/src/Makefile deleted file mode 100644 index ed98e93f..00000000 --- a/hwpf/plat/src/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# This Makefile is designed to be invoked with the -I argument set to -# the location of the "pk.mk" for the build - -include img_defs.mk -include fapi2ppefiles.mk - - -OBJS := $(addprefix $(OBJDIR)/, $(FAPI2LIB_OBJECTS)) - -all: $(OBJS) - - -$(OBJS) $(OBJS:.o=.d): | $(OBJDIR) - -$(OBJDIR): - mkdir -p $(OBJDIR) - -ifneq ($(MAKECMDGOALS),clean) -include $(OBJS:.o=.d) -endif - diff --git a/hwpf/plat/src/array.C b/hwpf/plat/src/array.C deleted file mode 100644 index 340d8d2f..00000000 --- a/hwpf/plat/src/array.C +++ /dev/null @@ -1,145 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ -/* [+] 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 array.C - * @brief fapi2 arrays - */ - -#include <stdint.h> -#include <array.H> - -namespace fapi2 -{ - /// @brief Create an array - array::array(const uint32_t i_size, element_type* i_data): - iv_size(i_size), - iv_data(i_data) - { -#ifdef GREG - assert(iv_size <= size_limit); - if (iv_data == nullptr) - { - iv_data = new element_type[iv_size](); - iv_size |= delete_bit; - } -#endif - // If the caller passed in a pointer, leave it be. Don't - // initialize it or anything. That will allow a placement - // operation where generic memory can use fapi2::array - // methods without much overhead. - } - - /// @brief Destroy an array - array::~array(void) - { - if ((iv_size & delete_bit) != 0) - { -#ifdef GREG - delete[] iv_data; -#endif - } - } - - /// @brief operator[] - array::element_type& array::operator[](const uint32_t i_index) - { -#ifdef GREG - assert(i_index < size()); -#endif - return iv_data[i_index]; - } - - /// @brief operator=() - array& array::operator=(const array& i_other) - { -#ifdef GREG - // Check to make sure it'll fit. - assert(i_other.size() <= size()); -#endif - // Our new size will be the other's size. - // Save of whether we should delete our iv_data ... - uint64_t l_our_delete_state = iv_size | delete_bit; - - // ... our new size is the size (minus the delete state) of i_other - iv_size = i_other.size(); - - // ... do the copy ... -#ifdef GREG - memcpy(iv_data, i_other.iv_data, iv_size * sizeof(element_type)); -#else - for(size_t i = 0; i < iv_size * sizeof(element_type); ++i) - { - iv_data[i] = i_other.iv_data[i]; - } -#endif - - // ... and record our old delete state. - iv_size |= l_our_delete_state; - - return *this; - } - - /// @brief move operator=() - array& array::operator=(array&& i_other) - { - iv_size = i_other.iv_size; - - // Make sure to clear the delete bit in the other. We - // don't want our memory to be deleted. - i_other.iv_size = i_other.size(); - - iv_data = std::move(i_other.iv_data); - return *this; - } - - /// @brief operator==() - bool array::operator==(const array& i_other) - { - // If they're not the same size, they're not the same - if (size() != i_other.size()) - { - return false; - } - - // If they're the same size and point to the same memory, they're the same. - if (iv_data == i_other.iv_data) - { - return true; - } - - auto oitr = i_other.begin(); - auto iter = begin(); - - for(; iter != end(); ++iter, ++oitr) - { - if (*iter != *oitr) - { - return false; - } - } - - return true; - } -} diff --git a/hwpf/plat/src/error_info.C b/hwpf/plat/src/error_info.C deleted file mode 100644 index 9d44eb58..00000000 --- a/hwpf/plat/src/error_info.C +++ /dev/null @@ -1,410 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ -/* */ -/* 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 error_info.C - * @brief Implements the error information classes - */ - -#include <stdint.h> -#include <string.h> -#include <plat_trace.H> -#include <error_info.H> -#include <buffer.H> - -namespace fapi2 -{ - /// - /// @brief Constructor - /// - /// @param[in] i_ffdcId FFDC Identifier (used to decode FFDC) - /// @param[in] i_pFfdc Pointer to the FFDC to copy - /// @param[in] i_size Size of the FFDC to copy - /// - ErrorInfoFfdc::ErrorInfoFfdc(const uint32_t i_ffdcId, - const void* i_pFfdc, - const uint32_t i_size): - iv_ffdcId(i_ffdcId), - iv_size(i_size) - { - iv_pFfdc = std::shared_ptr<uint8_t>(new uint8_t[i_size]()); - - // If they passed us a NULL pointer they want to fill - // in the data themselves later. - if (i_pFfdc != nullptr) - { - memcpy(iv_pFfdc.get(), i_pFfdc, i_size); - } - } - - /// - /// @brief Constructor. - /// - /// @param[in] i_hw Hardware to callout - /// @param[in] i_calloutPriority Priority of callout - /// @param[in] i_refTarget Reference to reference target - /// - ErrorInfoHwCallout::ErrorInfoHwCallout( - const HwCallouts::HwCallout i_hw, - const CalloutPriorities::CalloutPriority i_calloutPriority, - const Target<TARGET_TYPE_ALL> & i_refTarget): - iv_hw(i_hw), - iv_calloutPriority(i_calloutPriority), - iv_refTarget(i_refTarget) - {} - - /// - /// @brief Constructor. - /// - /// @param[in] i_procedure Procedure to callout - /// @param[in] i_calloutPriority Priority of callout - /// - ErrorInfoProcedureCallout::ErrorInfoProcedureCallout( - const ProcedureCallouts::ProcedureCallout i_procedure, - const CalloutPriorities::CalloutPriority i_calloutPriority): - iv_procedure(i_procedure), - iv_calloutPriority(i_calloutPriority) - {} - - /// - /// @brief Constructor. - /// - /// @param[in] i_target1 Reference to target on one end of the bus - /// @param[in] i_target2 Reference to target on other end of the bus - /// @param[in] i_calloutPriority Priority of callout - /// - ErrorInfoBusCallout::ErrorInfoBusCallout( - const Target<TARGET_TYPE_ALL> & i_target1, - const Target<TARGET_TYPE_ALL> & i_target2, - const CalloutPriorities::CalloutPriority i_calloutPriority): - iv_target1(i_target1), - iv_target2(i_target2), - iv_calloutPriority(i_calloutPriority) - {} - - /// - /// @brief Constructor. - /// - /// @param[in] i_target Reference to the target to c/d/g - /// @param[in] i_callout True if Target should be called out - /// @param[in] i_deconfigure True if Target should be deconfigured - /// @param[in] i_gard True if Target should be GARDed - /// @param[in] i_priority The priority of any callout - /// - ErrorInfoCDG::ErrorInfoCDG( - const Target<TARGET_TYPE_ALL> & i_target, - const bool i_callout, - const bool i_deconfigure, - const bool i_gard, - const CalloutPriorities::CalloutPriority i_priority): - iv_target(i_target), - iv_callout(i_callout), - iv_calloutPriority(i_priority), - iv_deconfigure(i_deconfigure), - iv_gard(i_gard) - {} - - /// - /// @brief Constructor. - /// - /// @param[in] i_parent Reference to the parent target - /// @oaram[in] i_childType Child target type to c/d/g - /// @param[in] i_callout True if Target should be called out - /// @param[in] i_deconfigure True if Target should be deconfigured - /// @param[in] i_gard True if Target should be GARDed - /// @param[in] i_priority The priority of any callout - /// @param[in] i_childPort Child Port - /// For DIMM children, the MBA port number - /// @param[in] i_childNum Child Number - /// For DIMM children, the dimm socket number - /// For Chip children, the chip position - /// For Chiplet children, the chiplet unit pos - /// - ErrorInfoChildrenCDG::ErrorInfoChildrenCDG( - const Target<TARGET_TYPE_ALL> & i_parentChip, - const TargetType i_childType, - const bool i_callout, - const bool i_deconfigure, - const bool i_gard, - const CalloutPriorities::CalloutPriority i_priority, - const uint8_t i_childPort, const uint8_t i_childNum): - iv_parent(i_parentChip), - iv_childType(i_childType), - iv_callout(i_callout), - iv_calloutPriority(i_priority), - iv_deconfigure(i_deconfigure), - iv_gard(i_gard), - iv_childPort(i_childPort), - iv_childNumber(i_childNum) - {} - - /// - /// @brief Constructor. - /// - /// @param[in] i_trace - /// - ErrorInfoCollectTrace::ErrorInfoCollectTrace( - CollectTraces::CollectTrace i_traceId): - iv_eiTraceId(i_traceId) - {} - - - /// - /// @brief Collect target, buffer or generic FFDC information to this ffdc - /// object - /// @param[in] A pointer to the error info we're collecting - /// @param[in] A pointer to the objects - /// @return void - /// - void ErrorInfoEntryFfdc::addErrorInfo(std::shared_ptr<ErrorInfo> i_info, - const void* const* i_objects) const - { - // "variable buffer ffdc not yet implemented"); - assert(iv_ffdcSize != EI_FFDC_SIZE_VBUF); - - switch(iv_ffdcSize) - { - case EI_FFDC_SIZE_BUF: - { - const buffer<uint64_t>* object = - static_cast<const buffer<uint64_t>*>(i_objects[iv_ffdcObjIndex]); - - i_info->iv_ffdcs.push_back(std::shared_ptr<ErrorInfoFfdc>( - new ErrorInfoFfdc(iv_ffdcId, object, - sizeof(object)))); - - FAPI_DBG("addErrorInfo: Adding buffer id: 0x%x size: %lu buf: 0x%lx", - iv_ffdcId, sizeof(object), uint64_t(*object)); - } - break; - - case EI_FFDC_SIZE_TARGET: - { - Target<TARGET_TYPE_ALL> object = - *(static_cast<const Target<TARGET_TYPE_ALL>*> - (i_objects[iv_ffdcObjIndex])); - - // Allocate an ErrorInfoFfdc but don't copy anything in to it. - // We can copy the target string once if we copy directly into - // the error info - ErrorInfoFfdc* e = - new ErrorInfoFfdc(iv_ffdcId, nullptr, MAX_ECMD_STRING_LEN); - - toString(object, static_cast<char*>(e->getData()), - MAX_ECMD_STRING_LEN); - i_info->iv_ffdcs.push_back(std::shared_ptr<ErrorInfoFfdc>(e)); - - FAPI_DBG("addErrorInfo: Adding target ffdc id: 0x%x %s", - iv_ffdcId, static_cast<char*>(e->getData())); - } - break; - - default: - i_info->iv_ffdcs.push_back(std::shared_ptr<ErrorInfoFfdc>( - new ErrorInfoFfdc( - iv_ffdcId, - i_objects[iv_ffdcObjIndex], - iv_ffdcSize))); - FAPI_DBG("addErrorInfo: Adding ffdc id 0x%x size: %d", - iv_ffdcId, iv_ffdcSize); - break; - - }; - - return; - } - - /// - /// @brief Collect h/w callout FFDC information to this ffdc - /// object - /// @param[in] A pointer to the error info we're collecting - /// @param[in] A pointer to the objects - /// @return void - /// - void ErrorInfoEntryHwCallout::addErrorInfo(std::shared_ptr<ErrorInfo> i_info, - const void* const* i_object) const - { - // If the index is 0xFF, we use an empty target. Otherwise the - // target is taken from the object arrary with the given index. - const fapi2::Target<TARGET_TYPE_ALL> target = - iv_refObjIndex == 0xFF ? - fapi2::Target<TARGET_TYPE_ALL>() : - *(static_cast<const fapi2::Target<TARGET_TYPE_ALL>*> - (i_object[iv_refObjIndex])); - - ErrorInfoHwCallout* ei = new ErrorInfoHwCallout( - static_cast<HwCallouts::HwCallout>(iv_hw), - static_cast<CalloutPriorities::CalloutPriority>(iv_calloutPriority), - target); - - FAPI_DBG("addErrorInfo: Adding hw callout target: 0x%lx hw: %d, pri: %d", - ei->iv_refTarget.get(), ei->iv_hw, ei->iv_calloutPriority); - - i_info->iv_hwCallouts.push_back(std::shared_ptr<ErrorInfoHwCallout>(ei)); - } - - /// - /// @brief Collect proc callout FFDC information to this ffdc - /// object - /// @param[in] A pointer to the error info we're collecting - /// @param[in] A pointer to the objects - /// @return void - /// - void ErrorInfoEntryProcCallout::addErrorInfo( - std::shared_ptr<ErrorInfo> i_info, - const void* const* ) const - { - ErrorInfoProcedureCallout* ei = new ErrorInfoProcedureCallout( - static_cast<ProcedureCallouts::ProcedureCallout>(iv_procedure), - static_cast<CalloutPriorities::CalloutPriority>(iv_calloutPriority)); - - // Add the ErrorInfo - FAPI_DBG("addErrorInfo: Adding proc callout, proc: %d, pri: %d", - ei->iv_procedure, ei->iv_calloutPriority); - - i_info->iv_procedureCallouts.push_back( - std::shared_ptr<ErrorInfoProcedureCallout>(ei)); - } - - /// - /// @brief Collect bus callout FFDC information to this ffdc - /// object - /// @param[in] A pointer to the error info we're collecting - /// @param[in] A pointer to the objects - /// @return void - /// - void ErrorInfoEntryBusCallout::addErrorInfo( - std::shared_ptr<ErrorInfo> i_info, - const void* const* i_object) const - { - // We need to add a procedure callout as well as a bus callout - ErrorInfoEntryProcCallout(ProcedureCallouts::BUS_CALLOUT, - iv_calloutPriority).addErrorInfo(i_info, - i_object); - - // Now add our bus callout, but drop the priority by one. - ErrorInfoBusCallout* ei = new ErrorInfoBusCallout( - // First target - *(static_cast<const fapi2::Target<TARGET_TYPE_ALL>*> - (i_object[iv_endpoint1ObjIndex])), - - // Second target - *(static_cast<const fapi2::Target<TARGET_TYPE_ALL>*> - (i_object[iv_endpoint2ObjIndex])), - - // Priority, one lower. - (iv_calloutPriority == CalloutPriorities::HIGH) ? - CalloutPriorities::MEDIUM : CalloutPriorities::LOW); - - FAPI_DBG("addErrorInfo: Adding bus callout t1: 0x%lx t2: 0x%lx, pri: %d", - ei->iv_target1.get(), ei->iv_target2.get(), - ei->iv_calloutPriority); - - i_info->iv_busCallouts.push_back( - std::shared_ptr<ErrorInfoBusCallout>(ei)); - } - - /// - /// @brief Collect h/w target cdg FFDC information to this ffdc - /// object - /// @param[in] A pointer to the error info we're collecting - /// @param[in] A pointer to the objects - /// @return void - /// - void ErrorInfoEntryTargetCDG::addErrorInfo( - std::shared_ptr<ErrorInfo> i_info, - const void* const* i_object) const - { - ErrorInfoCDG* ei = new - ErrorInfoCDG( - *(static_cast<const fapi2::Target<TARGET_TYPE_ALL>*> - (i_object[iv_targetObjIndex])), - iv_callout, - iv_deconfigure, - iv_gard, - static_cast<CalloutPriorities::CalloutPriority> - (iv_calloutPriority) - ); - - FAPI_DBG("addErrorInfo: Adding target 0x%lx cdg (%d:%d:%d), pri: %d", - ei->iv_target.get(), - ei->iv_callout, ei->iv_deconfigure, - ei->iv_gard, ei->iv_calloutPriority); - - // Add the ErrorInfo - i_info->iv_CDGs.push_back(std::shared_ptr<ErrorInfoCDG>(ei)); - } - - /// - /// @brief Collect h/w children cdg FFDC information to this ffdc - /// object - /// @param[in] A pointer to the error info we're collecting - /// @param[in] A pointer to the objects - /// @return void - /// - void ErrorInfoEntryChildrenCDG::addErrorInfo( - std::shared_ptr<ErrorInfo> i_info, - const void* const* i_object) const - { - ErrorInfoChildrenCDG* ei = new ErrorInfoChildrenCDG( - *(static_cast<const fapi2::Target<TARGET_TYPE_ALL>*> - (i_object[iv_parentObjIndex])), - static_cast<fapi2::TargetType>(iv_childType), - iv_callout, - iv_deconfigure, - iv_gard, - static_cast<CalloutPriorities::CalloutPriority> - (iv_calloutPriority), - iv_childPort, - iv_childNumber); - - FAPI_DBG("addErrorInfo: Adding children cdg (%d:%d:%d), type:" - " 0x%08x, pri: %d", - ei->iv_callout, ei->iv_deconfigure, ei->iv_gard, - ei->iv_childType, ei->iv_calloutPriority); - - // Add the ErrorInfo - i_info->iv_childrenCDGs.push_back( - std::shared_ptr<ErrorInfoChildrenCDG>(ei)); - } - - /// - /// @brief Collect trace information to this ffdc - /// object - /// @param[in] A pointer to the error info we're collecting - /// @param[in] A pointer to the objects - /// @return void - /// - void ErrorInfoEntryCollectTrace::addErrorInfo( - std::shared_ptr<ErrorInfo> i_info, - const void* const* ) const - { - ErrorInfoCollectTrace* ei = new ErrorInfoCollectTrace( - static_cast<CollectTraces::CollectTrace>(iv_eieTraceId)); - - FAPI_DBG("addErrorInfo: Adding trace: 0x%x", ei->iv_eiTraceId); - - // Add the ErrorInfo - i_info->iv_traces.push_back(std::shared_ptr<ErrorInfoCollectTrace>(ei)); - } - -}; diff --git a/hwpf/plat/src/fapi2ppefiles.mk b/hwpf/plat/src/fapi2ppefiles.mk deleted file mode 100644 index f2e72670..00000000 --- a/hwpf/plat/src/fapi2ppefiles.mk +++ /dev/null @@ -1,30 +0,0 @@ -# @file fapi2ppefiles.mk -# -# @brief mk for including fapi2 object files -# -# @page ChangeLogs Change Logs -# @section fapi2ppefiles.mk -# @verbatim -# -# -# Change Log ****************************************************************** -# Flag Defect/Feature User Date Description -# ------ -------------- ---------- ------------ ----------- -# -# @endverbatim -# -########################################################################## -# Object Files -########################################################################## - - -FAPI2-CPP-SOURCES += fapi2PlatAttributeService.C -FAPI2-CPP-SOURCES += target.C -FAPI2-CPP-SOURCES += plat_utils.C - - -FAPI2-S-SOURCES = - -FAPI2LIB_OBJECTS += $(FAPI2-CPP-SOURCES:.C=.o) -FAPI2LIB_OBJECTS += $(FAPI2-S-SOURCES:.S=.o) - diff --git a/hwpf/plat/src/ffdc.C b/hwpf/plat/src/ffdc.C deleted file mode 100644 index efe922ea..00000000 --- a/hwpf/plat/src/ffdc.C +++ /dev/null @@ -1,57 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ -/* */ -/* 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 ffdc.C - * @brief Implements the FirstFailureData class - */ - -#include <plat_trace.H> -#include <ffdc.H> -#include <error_info.H> - -namespace fapi2 -{ - - /// - /// @brief Add error information to this ffdc object - /// @param[in] A pointer to a list of objects - /// @param[in] A pointer to the list of entries - /// @param[in] The count of how many entries there are - /// @return void - /// - template<> - void FirstFailureData<ReturnCode>::addErrorInfo( - const void* const* i_pObjects, - const ErrorInfoEntry* i_pEntries, - const uint8_t i_count) - { - FAPI_DBG("%d entries", i_count); - for (uint32_t i = 0; i < i_count; i++) - { - i_pEntries[i].addErrorInfo(iv_info, i_pObjects); - } - } - - - -}; diff --git a/hwpf/plat/src/plat_utils.C b/hwpf/plat/src/plat_utils.C deleted file mode 100644 index 18aa4444..00000000 --- a/hwpf/plat/src/plat_utils.C +++ /dev/null @@ -1,212 +0,0 @@ - -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ -/* */ -/* 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 plat_utils.C - * @brief Implements fapi2 common utilities - */ - -#include <stdint.h> -#include <plat_trace.H> -#include <return_code.H> - -#ifndef __PPE__ -#include <error_info.H> - -namespace fapi2 -{ - /// - /// @brief Log an error. - /// - void logError( - fapi2::ReturnCode & io_rc, - fapi2::errlSeverity_t i_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE, - bool i_unitTestError = false ) - { - // To keep the compiler from complaing about i_sevbeing unused. - static_cast<void>(i_sev); - static_cast<void>(i_unitTestError); - - FAPI_DBG("logging 0x%lx.", uint64_t(io_rc)); - - // Iterate over the vectors and output what is in them. - const ErrorInfo* ei = io_rc.getErrorInfo(); - - FAPI_DBG("ffdcs: %lu", ei->iv_ffdcs.size()); - for( auto i = ei->iv_ffdcs.begin(); i != ei->iv_ffdcs.end(); ++i ) - { - uint32_t sz; - (*i)->getData(sz); - FAPI_DBG("\tid: 0x%x size %d", (*i)->getFfdcId(), sz); - } - - FAPI_DBG("hwCallouts: %lu", ei->iv_hwCallouts.size()); - for( auto i = ei->iv_hwCallouts.begin(); i != ei->iv_hwCallouts.end(); - ++i ) - { - FAPI_DBG("\thw: %d pri %d target: 0x%lx", - (*i)->iv_hw, (*i)->iv_calloutPriority, - (*i)->iv_refTarget.get()); - } - - FAPI_DBG("procedureCallouts: %lu", ei->iv_procedureCallouts.size()); - for( auto i = ei->iv_procedureCallouts.begin(); - i != ei->iv_procedureCallouts.end(); ++i ) - { - FAPI_DBG("\tprocedure: %d pri %d", - (*i)->iv_procedure, (*i)->iv_calloutPriority); - } - -e FAPI_DBG("busCallouts: %lu", ei->iv_busCallouts.size()); - for( auto i = ei->iv_busCallouts.begin(); i != ei->iv_busCallouts.end(); - ++i ) - { - FAPI_DBG("\tbus: t1: 0x%lx t2: 0x%lx pri: %d", - (*i)->iv_target1.get(), (*i)->iv_target2.get(), - (*i)->iv_calloutPriority); - } - - - FAPI_DBG("cdgs: %lu", ei->iv_CDGs.size()); - for( auto i = ei->iv_CDGs.begin(); i != ei->iv_CDGs.end(); ++i ) - { - FAPI_DBG("\ttarget: 0x%lx co: %d dc: %d gard: %d pri: %d", - (*i)->iv_target.get(), - (*i)->iv_callout, - (*i)->iv_deconfigure, - (*i)->iv_gard, - (*i)->iv_calloutPriority); - - } - - FAPI_DBG("childrenCDGs: %lu", ei->iv_childrenCDGs.size()); - for( auto i = ei->iv_childrenCDGs.begin(); - i != ei->iv_childrenCDGs.end(); ++i ) - { - FAPI_DBG("\tchildren: parent 0x%lx co: %d dc: %d gard: %d pri: %d", - (*i)->iv_parent.get(), - (*i)->iv_callout, - (*i)->iv_deconfigure, - (*i)->iv_gard, - (*i)->iv_calloutPriority); - } - - FAPI_DBG("traces: %lu", ei->iv_traces.size()); - for( auto i = ei->iv_traces.begin(); i != ei->iv_traces.end(); ++i ) - { - FAPI_DBG("\ttraces: 0x%x", (*i)->iv_eiTraceId); - } - - // Release the ffdc information now that we're done with it. - io_rc.forgetData(); - - } - - /// - /// @brief Delay this thread. - /// - ReturnCode delay(uint64_t i_nanoSeconds, uint64_t i_simCycles) - { - // void statements to keep the compiler from complaining - // about unused variables. - static_cast<void>(i_nanoSeconds); - static_cast<void>(i_simCycles); - - // replace with platform specific implementation - return FAPI2_RC_SUCCESS; - } -}; - - -/// Byte-reverse a 16-bit integer if on a little-endian machine - -uint16_t -revle16(uint16_t i_x) -{ - uint16_t rx; - -#ifndef _BIG_ENDIAN - uint8_t *pix = (uint8_t*)(&i_x); - uint8_t *prx = (uint8_t*)(&rx); - - prx[0] = pix[1]; - prx[1] = pix[0]; -#else - rx = i_x; -#endif - - return rx; -} - -#endif - -/// Byte-reverse a 32-bit integer if on a little-endian machine - -uint32_t -revle32(uint32_t i_x) -{ - uint32_t rx; - -#ifndef _BIG_ENDIAN - uint8_t *pix = (uint8_t*)(&i_x); - uint8_t *prx = (uint8_t*)(&rx); - - prx[0] = pix[3]; - prx[1] = pix[2]; - prx[2] = pix[1]; - prx[3] = pix[0]; -#else - rx = i_x; -#endif - - return rx; -} - - -/// Byte-reverse a 64-bit integer if on a little-endian machine - -uint64_t -revle64(const uint64_t i_x) -{ - uint64_t rx; - -#ifndef _BIG_ENDIAN - uint8_t *pix = (uint8_t*)(&i_x); - uint8_t *prx = (uint8_t*)(&rx); - - prx[0] = pix[7]; - prx[1] = pix[6]; - prx[2] = pix[5]; - prx[3] = pix[4]; - prx[4] = pix[3]; - prx[5] = pix[2]; - prx[6] = pix[1]; - prx[7] = pix[0]; -#else - rx = i_x; -#endif - - return rx; -} - - diff --git a/hwpf/plat/src/target.C b/hwpf/plat/src/target.C deleted file mode 100644 index c70fc42c..00000000 --- a/hwpf/plat/src/target.C +++ /dev/null @@ -1,441 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ -/* [+] 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 <fapi2.H> -#include <new> -#include <utility> // For move -#include <plat_target_pg_attributes.H> - -// Global Vector containing ALL targets. This structure is referenced by -// fapi2::getChildren to produce the resultant returned vector from that -// call. -std::vector<fapi2::plat_target_handle_t> G_vec_targets; - -fapi2attr::SystemAttributes_t* G_system_attributes_ptr; -fapi2attr::ProcChipAttributes_t* G_proc_chip_attributes_ptr; -fapi2attr::PervAttributes_t* G_perv_attributes_ptr; -fapi2attr::CoreAttributes_t* G_core_attributes_ptr; -fapi2attr::EQAttributes_t* G_eq_attributes_ptr; -fapi2attr::EXAttributes_t* G_ex_attributes_ptr; - -namespace fapi2 -{ - - #ifndef __noRC__ - ReturnCode current_err; - #endif - - - // Not a fan of the switch technique; I would prefer an array lookup - // but the attritute lookup is done via compile time macros that are - // resolved to attribute Ids (hashes). - fapi2::ReturnCode plat_PervPGTargets(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target, - const fapi2::TargetTypes_t i_chiplet_num, - bool & o_present) - { - - o_present = false; - uint16_t attr_value = 0; - switch (i_chiplet_num) - { - case 0x00: // Nop - break; - case 0x01: - FAPI_ATTR_GET(ATTR_PG_PRV, i_target, *(&attr_value)); - FAPI_DBG("ATTR_PG_PRV value = %x", attr_value); - break; - case 0x02: - FAPI_ATTR_GET(ATTR_PG_N0, i_target, attr_value); - FAPI_DBG("ATTR_PG_N0 value = %x", attr_value); - break; - case 0x03: - FAPI_ATTR_GET(ATTR_PG_N1, i_target, attr_value); - FAPI_DBG("ATTR_PG_N1 value = %x", attr_value); - break; - case 0x04: - FAPI_ATTR_GET(ATTR_PG_N2, i_target, attr_value); - FAPI_DBG("ATTR_PG_N2 value = %x", attr_value); - break; - case 0x05: - FAPI_ATTR_GET(ATTR_PG_N3, i_target, attr_value); - FAPI_DBG("ATTR_PG_N0 value = %x", attr_value); - break; - case 0x06: - FAPI_ATTR_GET(ATTR_PG_XB, i_target, attr_value); - FAPI_DBG("ATTR_PG_XB value = %x", attr_value); - break; - case 0x07: - FAPI_ATTR_GET(ATTR_PG_MC01, i_target, attr_value); - FAPI_DBG("ATTR_PG_MC01 value = %x", attr_value); - break; - case 0x08: - FAPI_ATTR_GET(ATTR_PG_MC23, i_target, attr_value); - FAPI_DBG("ATTR_PG_MC23 value = %x", attr_value); - break; - case 0x09: - FAPI_ATTR_GET(ATTR_PG_OB0, i_target, attr_value); - FAPI_DBG("ATTR_PG_OB0 value = %x", attr_value); - break; - case 0x0A: - FAPI_ATTR_GET(ATTR_PG_OB1, i_target, attr_value); - FAPI_DBG("ATTR_PG_OB1 value = %x", attr_value); - break; - case 0x0B: - FAPI_ATTR_GET(ATTR_PG_OB2, i_target, attr_value); - FAPI_DBG("ATTR_PG_OB2 value = %x", attr_value); - break; - case 0x0C: - FAPI_ATTR_GET(ATTR_PG_OB3, i_target, attr_value); - FAPI_DBG("ATTR_PG_OB3 value = %x", attr_value); - break; - case 0x0D: - FAPI_ATTR_GET(ATTR_PG_PCI0, i_target, attr_value); - FAPI_DBG("ATTR_PG_PCI0 value = %x", attr_value); - break; - case 0x0E: - FAPI_ATTR_GET(ATTR_PG_PCI1, i_target, attr_value); - FAPI_DBG("ATTR_PG_PCI1 value = %x", attr_value); - break; - case 0x0F: - FAPI_ATTR_GET(ATTR_PG_PCI2, i_target, attr_value); - FAPI_DBG("ATTR_PG_PCI2 value = %x", attr_value); - break; - case 0x10: - FAPI_ATTR_GET(ATTR_PG_EQ0, i_target, attr_value); - FAPI_DBG("ATTR_PG_EQ0 value = %x", attr_value); - break; - case 0x11: - FAPI_ATTR_GET(ATTR_PG_EQ1, i_target, attr_value); - FAPI_DBG("ATTR_PG_EQ1 value = %x", attr_value); - break; - case 0x12: - FAPI_ATTR_GET(ATTR_PG_EQ2, i_target, attr_value); - FAPI_DBG("ATTR_PG_EQ2 value = %x", attr_value); - break; - case 0x13: - FAPI_ATTR_GET(ATTR_PG_EQ3, i_target, attr_value); - FAPI_DBG("ATTR_PG_EQ3 value = %x", attr_value); - break; - case 0x14: - FAPI_ATTR_GET(ATTR_PG_EQ4, i_target, attr_value); - FAPI_DBG("ATTR_PG_EQ4 value = %x", attr_value); - break; - case 0x15: - FAPI_ATTR_GET(ATTR_PG_EQ5, i_target, attr_value); - FAPI_DBG("ATTR_PG_EQ5 value = %x", attr_value); - break; - case 0x20: - FAPI_ATTR_GET(ATTR_PG_EC00, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC00 value = %x", attr_value); - break; - case 0x21: - FAPI_ATTR_GET(ATTR_PG_EC01, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC01 value = %x", attr_value); - break; - case 0x22: - FAPI_ATTR_GET(ATTR_PG_EC02, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC02 value = %x", attr_value); - break; - case 0x23: - FAPI_ATTR_GET(ATTR_PG_EC03, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC03 value = %x", attr_value); - break; - case 0x24: - FAPI_ATTR_GET(ATTR_PG_EC04, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC04 value = %x", attr_value); - break; - case 0x25: - FAPI_ATTR_GET(ATTR_PG_EC05, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC05 value = %x", attr_value); - break; - case 0x26: - FAPI_ATTR_GET(ATTR_PG_EC06, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC06 value = %x", attr_value); - break; - case 0x27: - FAPI_ATTR_GET(ATTR_PG_EC07, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC07 value = %x", attr_value); - break; - case 0x28: - FAPI_ATTR_GET(ATTR_PG_EC08, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC08 value = %x", attr_value); - break; - case 0x29: - FAPI_ATTR_GET(ATTR_PG_EC09, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC09 value = %x", attr_value); - break; - case 0x2A: - FAPI_ATTR_GET(ATTR_PG_EC10, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC10 value = %x", attr_value); - break; - case 0x2B: - FAPI_ATTR_GET(ATTR_PG_EC11, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC11 value = %x", attr_value); - break; - case 0x2C: - FAPI_ATTR_GET(ATTR_PG_EC12, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC12 value = %x", attr_value); - break; - case 0x2D: - FAPI_ATTR_GET(ATTR_PG_EC13, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC13 value = %x", attr_value); - break; - case 0x2E: - FAPI_ATTR_GET(ATTR_PG_EC14, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC14 value = %x", attr_value); - break; - case 0x2F: - FAPI_ATTR_GET(ATTR_PG_EC15, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC15 value = %x", attr_value); - break; - case 0x30: - FAPI_ATTR_GET(ATTR_PG_EC16, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC16 value = %x", attr_value); - break; - case 0x31: - FAPI_ATTR_GET(ATTR_PG_EC17, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC17 value = %x", attr_value); - break; - case 0x32: - FAPI_ATTR_GET(ATTR_PG_EC18, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC18 value = %x", attr_value); - break; - case 0x33: - FAPI_ATTR_GET(ATTR_PG_EC19, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC19 value = %x", attr_value); - break; - case 0x34: - FAPI_ATTR_GET(ATTR_PG_EC20, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC20 value = %x", attr_value); - break; - case 0x35: - FAPI_ATTR_GET(ATTR_PG_EC21, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC21 value = %x", attr_value); - break; - case 0x36: - FAPI_ATTR_GET(ATTR_PG_EC22, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC22 value = %x", attr_value); - break; - case 0x37: - FAPI_ATTR_GET(ATTR_PG_EC23, i_target, attr_value); - FAPI_DBG("ATTR_PG_EC23 value = %x", attr_value); - break; - default: - FAPI_ERR("PervPGTargets: invalid chiplet number %u", i_chiplet_num); - } - - if (attr_value & 0xC000) - { - o_present = true; - } - - return fapi2::FAPI2_RC_SUCCESS; - - } - - /// @brief Function to determine if pervsaive target within a chip is - /// present and, thus, considered functional per PG attributes - template<fapi2::TargetType K> - fapi2::ReturnCode - plat_TargetPresent( fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_chip_target, - fapi2::Target<K> & i_chiplet_target, - bool & b_present) - { - - // Find the PERV target number in the partial good initialization - // array - fapi2::ChipletNumber_t chiplet_number = i_chiplet_target.getChipletNumber(); - - FAPI_TRY(plat_PervPGTargets(i_chip_target, chiplet_number, b_present)); - - if (b_present) - { - i_chiplet_target.setPresent(); - i_chiplet_target.setFunctional(); - } - else - { - FAPI_DBG("Perv target NOT present (nor functional): chiplet_number = %d", - chiplet_number); - } - - FAPI_DBG("Target present = %u, Target functional = %u", - i_chiplet_target.getPresent(), - i_chiplet_target.getFunctional()); - -fapi_try_exit: - return fapi2::current_err; - } - - - /// @brief Function to initialize the G_targets vector based on partial good - /// attributes /// this will move to plat_target.H formally - fapi2::ReturnCode plat_TargetsInit() - { - bool b_present = false; - uint32_t c = 0; - - // Initialise global attribute pointers - G_system_attributes_ptr = &G_system_attributes; - G_proc_chip_attributes_ptr = &G_proc_chip_attributes; - G_perv_attributes_ptr = &G_perv_attributes; - G_core_attributes_ptr = &G_core_attributes; - G_eq_attributes_ptr = &G_eq_attributes; - G_ex_attributes_ptr = &G_ex_attributes; - - - std::vector<fapi2::plat_target_handle_t>::iterator tgt_iter; - uint32_t l_beginning_offset; - - FAPI_DBG("Platform target initialization. Target Count = %u", TARGET_COUNT); - /* - * Initialize all entries to NULL - */ - for (uint32_t i = 0; i < TARGET_COUNT; ++i) - { - G_vec_targets.push_back((fapi2::plat_target_handle_t)0x0); - FAPI_DBG("Nulling G_vec_targets[%u] hi value=0x%08X", - i, (uint32_t)(G_vec_targets.at(i)>>32)); - - } - FAPI_DBG("Vector size: %u", G_vec_targets.size()); - - /* - * Chip Target is the first one - */ - FAPI_DBG("Chip Target info: CHIP_TARGET_OFFSET %u CHIP_TARGET_COUNT %u ", - CHIP_TARGET_OFFSET,CHIP_TARGET_COUNT); - - l_beginning_offset = CHIP_TARGET_OFFSET; - - fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> chip_target((fapi2::plat_target_handle_t)0); - G_vec_targets.at(l_beginning_offset) = revle64((fapi2::plat_target_handle_t)(chip_target.get())); - - /* - * Pervasive Targets - */ - FAPI_DBG("Pervasive Target info: PERV_TARGET_OFFSET %u PERV_TARGET_COUNT %u", - PERV_TARGET_OFFSET, PERV_TARGET_COUNT); - - l_beginning_offset = PERV_TARGET_OFFSET; - for (uint32_t i = 0; i < PERV_TARGET_COUNT; ++i) - { - fapi2::Target<fapi2::TARGET_TYPE_PERV> target_name((fapi2::plat_target_handle_t)i+1); - FAPI_DBG("target_name i = %d hi word = 0x%08X", i+1, (uint32_t)(target_name.get()>>32)); - - // Determine if the chiplet is present and, thus, functional - // via partial good attributes - FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present)); - - G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); - FAPI_DBG("G offset = %d", l_beginning_offset+i); - } - - /* - * Cache (EQ) Targets - */ - FAPI_DBG("EQ Target info: EQ_TARGET_OFFSET %u EQ_TARGET_COUNT %u", - EQ_TARGET_OFFSET, EQ_TARGET_COUNT); - l_beginning_offset = EQ_TARGET_OFFSET; - for (uint32_t i = 0; i < EQ_TARGET_COUNT; ++i) - { - fapi2::Target<fapi2::TARGET_TYPE_EQ> target_name((fapi2::plat_target_handle_t)i); - FAPI_DBG("target_name i = %d hi word = 0x%08X", i, (uint32_t)(target_name.get()>>32)); - - // Determine if the chiplet is present and, thus, functional - // via partial good attributes - FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present)); - - G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); - FAPI_DBG("G offset = %d", l_beginning_offset+i); - } - - /* - * Core (EC) Targets - */ - FAPI_DBG("Core Target info: CORE_TARGET_OFFSET %u CORE_TARGET_COUNT %u", - CORE_TARGET_OFFSET, CORE_TARGET_COUNT); - - l_beginning_offset = CORE_TARGET_OFFSET; - FAPI_DBG("Core beginning offset =%u", l_beginning_offset); - for (uint32_t i = 0; i < CORE_TARGET_COUNT; ++i) - { - fapi2::Target<fapi2::TARGET_TYPE_CORE> target_name((fapi2::plat_target_handle_t)i); - FAPI_DBG("target_name i = %d hi word = 0x%08X", i, (uint32_t)(target_name.get()>>32)); - - // Determine if the chiplet is present and, thus, functional - // via partial good attributes - FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present)); - - G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); - FAPI_DBG("G offset = %d", l_beginning_offset+i); - } - - /* - * Memory Controller Synchronous (MCS) Targets - */ - FAPI_DBG("MCS Target info: MCS_TARGET_OFFSET %u MCS_TARGET_COUNT %u", - MCS_TARGET_OFFSET, MCS_TARGET_COUNT); - - l_beginning_offset = MCS_TARGET_OFFSET; - FAPI_DBG("MCS beginning offset =%u", l_beginning_offset); - for (uint32_t i = 0; i < MCS_TARGET_COUNT; ++i) - { - fapi2::Target<fapi2::TARGET_TYPE_MCS> target_name((fapi2::plat_target_handle_t)i); - FAPI_DBG("target_name i = %d hi word = 0x%08X", i, (uint32_t)(target_name.get()>>32)); - - // Determine if the chiplet is present and, thus, functional - // via partial good attributes - FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present)); - - G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get())); - FAPI_DBG("G offset = %d", l_beginning_offset+i); - - } - - // Trace all entries - for (auto tgt_iter : G_vec_targets) - { - FAPI_DBG("Trace hi word G_vec_targets[%u] value=%08X", - c, (uint32_t)(tgt_iter>>32)); - ++c; - } - -fapi_try_exit: - return fapi2::current_err; - } - - /// @brief Function to initialize the G_targets vector based on partial good - /// attributes - fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> plat_getChipTarget() - { - - // Get the chip specific target - return ((fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>)G_vec_targets.at(0)); - } - - -} // fapi2 |