diff options
Diffstat (limited to 'src/usr/isteps')
19 files changed, 2805 insertions, 0 deletions
diff --git a/src/usr/isteps/istep13/call_host_disable_vddr.C b/src/usr/isteps/istep13/call_host_disable_vddr.C new file mode 100644 index 000000000..565aab658 --- /dev/null +++ b/src/usr/isteps/istep13/call_host_disable_vddr.C @@ -0,0 +1,67 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/call_host_disable_vddr.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] 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 <errl/errlentry.H> +#include <errl/errlmanager.H> +#include <isteps/hwpisteperror.H> +#include <initservice/isteps_trace.H> +#include "platform_vddr.H" + +using namespace ERRORLOG; +using namespace ISTEP; +using namespace ISTEP_ERROR; + +namespace ISTEP_13 +{ + +void* call_host_disable_vddr (void *io_pArgs) +{ + errlHndl_t l_err = NULL; + IStepError l_StepError; + + TRACDCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + ENTER_MRK"call_host_disable_vddr"); + + // This function has Compile-time binding for desired platform + l_err = platform_disable_vddr(); + + if(l_err) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%.8X: call_host_disable_vddr returns error", + l_err->reasonCode()); + // Create IStep error log and cross reference to error that occurred + l_StepError.addErrorDetails( l_err ); + + errlCommit( l_err, HWPF_COMP_ID ); + + } + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + EXIT_MRK"call_host_disable_vddr"); + + return l_StepError.getErrorHandle(); +} + +}; diff --git a/src/usr/isteps/istep13/call_host_enable_vddr.C b/src/usr/isteps/istep13/call_host_enable_vddr.C new file mode 100644 index 000000000..91f05d0df --- /dev/null +++ b/src/usr/isteps/istep13/call_host_enable_vddr.C @@ -0,0 +1,76 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/call_host_enable_vddr.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] 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 <errl/errlentry.H> +#include <errl/errlmanager.H> +#include <errl/errludtarget.H> +#include <isteps/hwpisteperror.H> +#include <initservice/isteps_trace.H> + +// targeting support +#include <targeting/common/commontargeting.H> +#include <targeting/common/util.H> +#include <targeting/common/utilFilter.H> + +#include "platform_vddr.H" +using namespace ERRORLOG; +using namespace ISTEP; +using namespace ISTEP_ERROR; +using namespace TARGETING; + +namespace ISTEP_13 +{ +void* call_host_enable_vddr (void *io_pArgs) +{ + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ENTER_MRK"call_host_enable_vddr" ); + + errlHndl_t l_err = NULL; + IStepError l_StepError; + + // This fuction has compile-time binding for different platforms + l_err = platform_enable_vddr(); + + if( l_err ) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%.8X: call_host_enable_vddr returns error", + l_err->reasonCode()); + + l_StepError.addErrorDetails( l_err ); + + // Create IStep error log and cross reference to error that occurred + l_StepError.addErrorDetails( l_err ); + + // Commit Error + errlCommit( l_err, HWPF_COMP_ID ); + } + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + EXIT_MRK"call_host_enable_vddr" ); + + return l_StepError.getErrorHandle(); +} + +}; diff --git a/src/usr/isteps/istep13/call_mem_pll_initf.C b/src/usr/isteps/istep13/call_mem_pll_initf.C new file mode 100644 index 000000000..2217ec42b --- /dev/null +++ b/src/usr/isteps/istep13/call_mem_pll_initf.C @@ -0,0 +1,101 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/call_mem_pll_initf.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] 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 <errl/errlentry.H> +#include <errl/errlmanager.H> +#include <errl/errludtarget.H> +#include <isteps/hwpisteperror.H> +#include <initservice/isteps_trace.H> + +// targeting support +#include <targeting/common/commontargeting.H> +#include <targeting/common/util.H> +#include <targeting/common/utilFilter.H> + +using namespace ERRORLOG; +using namespace ISTEP; +using namespace ISTEP_ERROR; +using namespace TARGETING; +namespace ISTEP_13 +{ +void* call_mem_pll_initf (void *io_pArgs) +{ + errlHndl_t l_err = NULL; + + IStepError l_StepError; + + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mem_pll_initf entry" ); + + // Get all Centaur targets + TARGETING::TargetHandleList l_membufTargetList; + getAllChips(l_membufTargetList, TYPE_MEMBUF); + + for (TargetHandleList::const_iterator + l_membuf_iter = l_membufTargetList.begin(); + l_membuf_iter != l_membufTargetList.end(); + ++l_membuf_iter) + { + // make a local copy of the target for ease of use + const TARGETING::Target* l_pCentaur = *l_membuf_iter; + + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "Running cen_mem_pll_initf HWP on " + "target HUID %.8X", TARGETING::get_huid(l_pCentaur)); + + //@TODO RTC:133831 use fapi2 targets + // Cast to a FAPI type of target. + //const fapi::Target l_fapi_centaur( TARGET_TYPE_MEMBUF_CHIP, + // (const_cast<TARGETING::Target*>(l_pCentaur))); + + //call cen_mem_pll_initf to do pll init + //FAPI_INVOKE_HWP(l_err, cen_mem_pll_initf, l_fapi_centaur); + + if (l_err) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%.8X: cen_mem_pll_initf HWP returns error", + l_err->reasonCode()); + + // capture the target data in the elog + ErrlUserDetailsTarget(l_pCentaur).addToLog(l_err ); + + //Create IStep error log and cross reference to error that occurred + l_StepError.addErrorDetails(l_err); + + // Commit Error + errlCommit(l_err, HWPF_COMP_ID); + } + else + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "SUCCESS: cen_mem_pll_initf HWP( )" ); + } + } + + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mem_pll_initf exit" ); + + return l_StepError.getErrorHandle(); +} + +}; diff --git a/src/usr/isteps/istep13/call_mem_pll_setup.C b/src/usr/isteps/istep13/call_mem_pll_setup.C new file mode 100644 index 000000000..9ddddcabd --- /dev/null +++ b/src/usr/isteps/istep13/call_mem_pll_setup.C @@ -0,0 +1,101 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/call_mem_pll_setup.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] 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 <errl/errlentry.H> +#include <errl/errlmanager.H> +#include <errl/errludtarget.H> +#include <isteps/hwpisteperror.H> +#include <initservice/isteps_trace.H> + +// targeting support +#include <targeting/common/commontargeting.H> +#include <targeting/common/util.H> +#include <targeting/common/utilFilter.H> + +using namespace ERRORLOG; +using namespace ISTEP; +using namespace ISTEP_ERROR; +using namespace TARGETING; + +namespace ISTEP_13 +{ +void* call_mem_pll_setup (void *io_pArgs) +{ + errlHndl_t l_err = NULL; + + IStepError l_StepError; + + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mem_pll_setup entry" ); + + // Get all Centaur targets + TARGETING::TargetHandleList l_membufTargetList; + getAllChips(l_membufTargetList, TYPE_MEMBUF); + + for (TargetHandleList::const_iterator + l_membuf_iter = l_membufTargetList.begin(); + l_membuf_iter != l_membufTargetList.end(); + ++l_membuf_iter) + { + // make a local copy of the target for ease of use + const TARGETING::Target* l_pCentaur = *l_membuf_iter; + + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "Running mem_pll_setup HWP on " + "target HUID %.8X", TARGETING::get_huid(l_pCentaur)); + + //@TODO RTC:133831 Cast to a FAPI type of target. + //const fapi::Target l_fapi_centaur( TARGET_TYPE_MEMBUF_CHIP, + // (const_cast<TARGETING::Target*>(l_pCentaur))); + + //call cen_mem_pll_setup to verify lock + //FAPI_INVOKE_HWP(l_err, cen_mem_pll_setup, l_fapi_centaur); + + if (l_err) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%.8X: mem_pll_setup HWP returns error", + l_err->reasonCode()); + + // capture the target data in the elog + ErrlUserDetailsTarget(l_pCentaur).addToLog(l_err); + + //Create IStep error log and cross reference to error that occurred + l_StepError.addErrorDetails(l_err); + + // Commit Error + errlCommit(l_err, HWPF_COMP_ID); + } + else + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "SUCCESS: mem_pll_setup HWP( )" ); + } + } + + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mem_pll_setup exit" ); + + return l_StepError.getErrorHandle(); +} + +}; diff --git a/src/usr/isteps/istep13/call_mem_startclocks.C b/src/usr/isteps/istep13/call_mem_startclocks.C new file mode 100644 index 000000000..47ed80a6a --- /dev/null +++ b/src/usr/isteps/istep13/call_mem_startclocks.C @@ -0,0 +1,104 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/call_mem_startclocks.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] 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 <errl/errlentry.H> +#include <errl/errlmanager.H> +#include <errl/errludtarget.H> +#include <isteps/hwpisteperror.H> +#include <initservice/isteps_trace.H> + +// targeting support +#include <targeting/common/commontargeting.H> +#include <targeting/common/util.H> +#include <targeting/common/utilFilter.H> + +using namespace ERRORLOG; +using namespace ISTEP; +using namespace ISTEP_ERROR; +using namespace TARGETING; + +namespace ISTEP_13 +{ +void* call_mem_startclocks (void *io_pArgs) +{ + errlHndl_t l_err = NULL; + + IStepError l_StepError; + + TRACDCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"call_mem_startclocks entry" ); + + // Get all Centaur targets + TARGETING::TargetHandleList l_membufTargetList; + getAllChips(l_membufTargetList, TYPE_MEMBUF); + + for (TargetHandleList::const_iterator + l_membuf_iter = l_membufTargetList.begin(); + l_membuf_iter != l_membufTargetList.end(); + ++l_membuf_iter) + { + // make a local copy of the target for ease of use + const TARGETING::Target* l_pCentaur = *l_membuf_iter; + + // Dump current run on target + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "Running cen_mem_startclocks HWP on " + "target HUID %.8X", TARGETING::get_huid(l_pCentaur)); + + //@TODO RTC:133831 Cast to a FAPI type of target. + //const fapi::Target l_fapi_centaur( TARGET_TYPE_MEMBUF_CHIP, + // (const_cast<TARGETING::Target*>(l_pCentaur)) ); + + // call the HWP with each fapi::Target + //FAPI_INVOKE_HWP(l_err, cen_mem_startclocks, l_fapi_centaur); + + if (l_err) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%.8X: cen_mem_startclocks HWP returns error", + l_err->reasonCode()); + + // capture the target data in the elog + ErrlUserDetailsTarget(l_pCentaur).addToLog(l_err); + + //Create IStep error log and cross reference to error that occurred + l_StepError.addErrorDetails( l_err ); + + // Commit Error + errlCommit( l_err, HWPF_COMP_ID ); + + } + else + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "SUCCESS : cen_mem_startclocks HWP( )" ); + } + } + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "call_mem_startclocks exit" ); + + return l_StepError.getErrorHandle(); +} + +}; diff --git a/src/usr/isteps/istep13/call_mss_ddr_phy_reset.C b/src/usr/isteps/istep13/call_mss_ddr_phy_reset.C new file mode 100644 index 000000000..27084aa4d --- /dev/null +++ b/src/usr/isteps/istep13/call_mss_ddr_phy_reset.C @@ -0,0 +1,110 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/call_mss_ddr_phy_reset.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] 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 <errl/errlentry.H> +#include <errl/errlmanager.H> +#include <errl/errludtarget.H> +#include <isteps/hwpisteperror.H> +#include <initservice/isteps_trace.H> + +// targeting support +#include <targeting/common/commontargeting.H> +#include <targeting/common/util.H> +#include <targeting/common/utilFilter.H> + +#include "istep13consts.H" + +using namespace ERRORLOG; +using namespace ISTEP; +using namespace ISTEP_ERROR; +using namespace TARGETING; + +namespace ISTEP_13 +{ +void* call_mss_ddr_phy_reset (void *io_pArgs) +{ + errlHndl_t l_err = NULL; + + IStepError l_stepError; + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "call_mss_ddr_phy_reset entry" ); + + // Get all MBA targets + TARGETING::TargetHandleList l_mbaTargetList; + getAllChiplets(l_mbaTargetList, TYPE_MBA); + + // Limit the number of MBAs to run in VPO environment to save time. + uint8_t l_mbaLimit = l_mbaTargetList.size(); + if (TARGETING::is_vpo() && (VPO_NUM_OF_MBAS_TO_RUN < l_mbaLimit)) + { + l_mbaLimit = VPO_NUM_OF_MBAS_TO_RUN; + } + + for ( uint8_t l_mbaNum=0; l_mbaNum < l_mbaLimit; l_mbaNum++ ) + { + // make a local copy of the target for ease of use + const TARGETING::Target* l_mba_target = l_mbaTargetList[l_mbaNum]; + + // Dump current run on target + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "Running call_mss_ddr_phy_reset HWP on " + "target HUID %.8X", TARGETING::get_huid(l_mba_target)); + + //@TODO RTC:133831 Cast to a FAPI type of target. + //const fapi::Target l_fapi_mba_target( TARGET_TYPE_MBA_CHIPLET, + // (const_cast<TARGETING::Target*>(l_mba_target)) ); + + // call the HWP with each fapi::Target + //FAPI_INVOKE_HWP(l_err, mss_ddr_phy_reset, l_fapi_mba_target); + + if (l_err) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%.8X: mss_ddr_phy_reset HWP returns error", + l_err->reasonCode()); + + // capture the target data in the elog + ErrlUserDetailsTarget(l_mba_target).addToLog( l_err ); + + // Create IStep error log and cross reference to error that occurred + l_stepError.addErrorDetails( l_err ); + + // Commit Error + errlCommit( l_err, HWPF_COMP_ID ); + } + else + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "SUCCESS : call_mss_ddr_phy_reset HWP( )" ); + } + } // end l_mbaNum loop + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "call_mss_ddr_phy_reset exit" ); + + return l_stepError.getErrorHandle(); +} + +}; diff --git a/src/usr/isteps/istep13/call_mss_draminit.C b/src/usr/isteps/istep13/call_mss_draminit.C new file mode 100644 index 000000000..fa5485739 --- /dev/null +++ b/src/usr/isteps/istep13/call_mss_draminit.C @@ -0,0 +1,186 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/call_mss_draminit.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] 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 <errl/errlentry.H> +#include <errl/errlmanager.H> +#include <errl/errludtarget.H> +#include <isteps/hwpisteperror.H> +#include <initservice/isteps_trace.H> +#include <initservice/initserviceif.H> + +// targeting support +#include <targeting/common/commontargeting.H> +#include <targeting/common/util.H> +#include <targeting/common/utilFilter.H> +#include "istep13consts.H" +#include "platform_vddr.H" + +using namespace ERRORLOG; +using namespace ISTEP; +using namespace ISTEP_ERROR; +using namespace TARGETING; + +namespace ISTEP_13 +{ + +void mss_post_draminit( IStepError & l_stepError ) +{ + errlHndl_t l_err = NULL; + bool rerun_vddr = false; + + do { + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "mss_post_draminit entry" ); + + //@TODO RTC: 133831. The helper function is currently commented out because + //some of the attributes don't exist. uncomment it once attribute support is + //in place +// set_eff_config_attrs_helper(ISTEP_07::POST_DRAM_INIT, rerun_vddr); + + if ( rerun_vddr == false ) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "mss_post_draminit: nothing to do" ); + break; + } + + // Call mss_volt_vddr_offset to recalculate VDDR voltage + // @TODO RTC: 133831 Uncomment once attribute support is in place + /* + l_err = ISTEP_07::setMemoryVoltageDomainOffsetVoltage< + TARGETING::ATTR_MSS_VOLT_VDDR_OFFSET_DISABLE, + TARGETING::ATTR_MEM_VDDR_OFFSET_MILLIVOLTS, + TARGETING::ATTR_VMEM_ID>(); + */ + if(l_err) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "mss_post_draminit: " + "ERROR 0x%08X: setMemoryVoltageDomainOffsetVoltage for VDDR domain", + l_err->reasonCode()); + l_stepError.addErrorDetails(l_err); + errlCommit(l_err,HWPF_COMP_ID); + break; + } + else + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "mss_post_draminit: mss_volt_vddr_offset(): SUCCESS"); + } + + // Call HWSV to call POWR code + // This fuction has compile-time binding for different platforms + l_err = platform_adjust_vddr_post_dram_init(); + + if( l_err ) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%.8X: mss_post_draminit: " + "platform_adjust_vddr_post_dram_init() returns error", + l_err->reasonCode()); + + // Create IStep error log and cross reference to error that occurred + l_stepError.addErrorDetails( l_err ); + + // Commit Error + errlCommit( l_err, HWPF_COMP_ID ); + } + + } while(0); + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "mss_post_draminit exit" ); + return; +} + +void* call_mss_draminit (void *io_pArgs) +{ + errlHndl_t l_err = NULL; + + IStepError l_stepError; + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_draminit entry" ); + + // Get all MBA targets + TARGETING::TargetHandleList l_mbaTargetList; + getAllChiplets(l_mbaTargetList, TYPE_MBA); + + // Limit the number of MBAs to run in VPO environment to save time. + uint8_t l_mbaLimit = l_mbaTargetList.size(); + if (TARGETING::is_vpo() && (VPO_NUM_OF_MBAS_TO_RUN < l_mbaLimit)) + { + l_mbaLimit = VPO_NUM_OF_MBAS_TO_RUN; + } + + for ( uint8_t l_mbaNum=0; l_mbaNum < l_mbaLimit; l_mbaNum++ ) + { + // Make a local copy of the target for ease of use + const TARGETING::Target* l_mba_target = l_mbaTargetList[l_mbaNum]; + + // Dump current run on target + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "Running mss_draminit HWP on " + "target HUID %.8X", TARGETING::get_huid(l_mba_target)); + + //@TODO RTC:133831 Cast to a FAPI type of target. + //const fapi::Target l_fapi_mba_target( TARGET_TYPE_MBA_CHIPLET, + // (const_cast<TARGETING::Target*>(l_mba_target)) ); + + // call the HWP with each fapi::Target + //FAPI_INVOKE_HWP(l_err, mss_draminit, l_fapi_mba_target); + + if (l_err) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%.8X : mss_draminit HWP returns error", + l_err->reasonCode()); + + // capture the target data in the elog + ErrlUserDetailsTarget(l_mba_target).addToLog(l_err); + + // Create IStep error log and cross reference to error that occurred + l_stepError.addErrorDetails( l_err ); + + // Commit Error + errlCommit( l_err, HWPF_COMP_ID ); + } + else + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "SUCCESS : mss_draminit HWP( )" ); + } + + } // endfor mba's + + // call POST_DRAM_INIT function + if(INITSERVICE::spBaseServicesEnabled()) + { + mss_post_draminit(l_stepError); + } + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_draminit exit" ); + + return l_stepError.getErrorHandle(); +} + +}; diff --git a/src/usr/isteps/istep13/call_mss_draminit_mc.C b/src/usr/isteps/istep13/call_mss_draminit_mc.C new file mode 100644 index 000000000..68d6efd6c --- /dev/null +++ b/src/usr/isteps/istep13/call_mss_draminit_mc.C @@ -0,0 +1,107 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/call_mss_draminit_mc.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] 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 <errl/errlentry.H> +#include <errl/errlmanager.H> +#include <errl/errludtarget.H> +#include <isteps/hwpisteperror.H> +#include <initservice/isteps_trace.H> + +// targeting support +#include <targeting/common/commontargeting.H> +#include <targeting/common/util.H> +#include <targeting/common/utilFilter.H> +#include "istep13consts.H" + +using namespace ERRORLOG; +using namespace ISTEP; +using namespace ISTEP_ERROR; +using namespace TARGETING; + +namespace ISTEP_13 +{ +void* call_mss_draminit_mc (void *io_pArgs) +{ + errlHndl_t l_err = NULL; + + IStepError l_stepError; + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,"call_mss_draminit_mc entry" ); + + // Get all centaur targets + TARGETING::TargetHandleList l_mBufTargetList; + getAllChips(l_mBufTargetList, TYPE_MEMBUF); + + // Limit the number of MBAs to run in VPO environment to save time. + uint8_t l_memBufLimit = l_mBufTargetList.size(); + if (TARGETING::is_vpo() && (VPO_NUM_OF_MEMBUF_TO_RUN < l_memBufLimit)) + { + l_memBufLimit = VPO_NUM_OF_MEMBUF_TO_RUN; + } + + for ( uint8_t l_mBufNum=0; l_mBufNum < l_memBufLimit; l_mBufNum++ ) + { + const TARGETING::Target* l_membuf_target = l_mBufTargetList[l_mBufNum]; + + // Dump current run on target + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "Running mss_draminit_mc HWP on " + "target HUID %.8X", TARGETING::get_huid(l_membuf_target)); + + //@TODO RTC:133831 Cast to a fapi target + //fapi::Target l_fapi_membuf_target( TARGET_TYPE_MEMBUF_CHIP, + // (const_cast<TARGETING::Target*>(l_membuf_target)) ); + + // call the HWP with each fapi::Target + //FAPI_INVOKE_HWP(l_err, mss_draminit_mc, l_fapi_membuf_target); + + if (l_err) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%.8X : mss_draminit_mc HWP returns error", + l_err->reasonCode()); + + // capture the target data in the elog + ErrlUserDetailsTarget(l_membuf_target).addToLog( l_err ); + + // Create IStep error log and cross reference to error that occurred + l_stepError.addErrorDetails( l_err ); + + // Commit Error + errlCommit( l_err, HWPF_COMP_ID ); + } + else + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "SUCCESS : mss_draminit_mc HWP( )" ); + } + + } // End; memBuf loop + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_draminit_mc exit" ); + + return l_stepError.getErrorHandle(); +} + +}; diff --git a/src/usr/isteps/istep13/call_mss_draminit_trainadv.C b/src/usr/isteps/istep13/call_mss_draminit_trainadv.C new file mode 100644 index 000000000..611e49e18 --- /dev/null +++ b/src/usr/isteps/istep13/call_mss_draminit_trainadv.C @@ -0,0 +1,107 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/call_mss_draminit_trainadv.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] 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 <errl/errlentry.H> +#include <errl/errlmanager.H> +#include <errl/errludtarget.H> +#include <isteps/hwpisteperror.H> +#include <initservice/isteps_trace.H> + +// targeting support +#include <targeting/common/commontargeting.H> +#include <targeting/common/util.H> +#include <targeting/common/utilFilter.H> +#include "istep13consts.H" + +using namespace ERRORLOG; +using namespace ISTEP; +using namespace ISTEP_ERROR; +using namespace TARGETING; + +namespace ISTEP_13 +{ +void* call_mss_draminit_trainadv (void *io_pArgs) +{ + errlHndl_t l_err = NULL; + IStepError l_stepError; + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "call_mss_draminit_trainadv entry" ); + + // Get all MBA targets + TARGETING::TargetHandleList l_mbaTargetList; + getAllChiplets(l_mbaTargetList, TYPE_MBA); + + // Limit the number of MBAs to run in VPO environment to save time. + uint8_t l_mbaLimit = l_mbaTargetList.size(); + if (TARGETING::is_vpo() && (VPO_NUM_OF_MBAS_TO_RUN < l_mbaLimit)) + { + l_mbaLimit = VPO_NUM_OF_MBAS_TO_RUN; + } + + for ( uint8_t l_mbaNum=0; l_mbaNum < l_mbaLimit; l_mbaNum++ ) + { + // make a local copy of the target for ease of use + const TARGETING::Target* l_mba_target = l_mbaTargetList[l_mbaNum]; + + // Dump current run on target + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "Running mss_draminit_training_advanced HWP on " + "target HUID %.8X", TARGETING::get_huid(l_mba_target)); + + //@TODO RTC:133831 Cast to a FAPI type of target. + //const fapi::Target l_fapi_mba_target( TARGET_TYPE_MBA_CHIPLET, + // (const_cast<TARGETING::Target*>(l_mba_target)) ); + + // call the HWP with each fapi::Target + //FAPI_INVOKE_HWP(l_err, mss_draminit_training_advanced, + // l_fapi_mba_target); + + if (l_err) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%.8X : mss_draminit_training_advanced HWP returns error", + l_err->reasonCode()); + + // capture the target data in the elog + ErrlUserDetailsTarget(l_mba_target).addToLog( l_err ); + + // Create IStep error log and cross reference to error that occurred + l_stepError.addErrorDetails( l_err ); + + // Commit Error + errlCommit( l_err, HWPF_COMP_ID ); + } + + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "SUCCESS : mss_draminit_training_advanced HWP( )" ); + } + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "call_mss_draminit_trainadv exit" ); + + return l_stepError.getErrorHandle(); +} + +}; diff --git a/src/usr/isteps/istep13/call_mss_draminit_training.C b/src/usr/isteps/istep13/call_mss_draminit_training.C new file mode 100644 index 000000000..28f0a879d --- /dev/null +++ b/src/usr/isteps/istep13/call_mss_draminit_training.C @@ -0,0 +1,111 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/call_mss_draminit_training.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] 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 <errl/errlentry.H> +#include <errl/errlmanager.H> +#include <errl/errludtarget.H> +#include <isteps/hwpisteperror.H> +#include <initservice/isteps_trace.H> + +// targeting support +#include <targeting/common/commontargeting.H> +#include <targeting/common/util.H> +#include <targeting/common/utilFilter.H> +#include "istep13consts.H" + +using namespace ERRORLOG; +using namespace ISTEP; +using namespace ISTEP_ERROR; +using namespace TARGETING; + +namespace ISTEP_13 +{ +void* call_mss_draminit_training (void *io_pArgs) +{ + errlHndl_t l_err = NULL; + + IStepError l_stepError; + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "call_mss_draminit_training entry" ); + + // Get all MBA targets + TARGETING::TargetHandleList l_mbaTargetList; + getAllChiplets(l_mbaTargetList, TYPE_MBA); + + // Limit the number of MBAs to run in VPO environment to save time. + uint8_t l_mbaLimit = l_mbaTargetList.size(); + if (TARGETING::is_vpo() && (VPO_NUM_OF_MBAS_TO_RUN < l_mbaLimit)) + { + l_mbaLimit = VPO_NUM_OF_MBAS_TO_RUN; + } + + for ( uint8_t l_mbaNum=0; l_mbaNum < l_mbaLimit; l_mbaNum++ ) + { + // make a local copy of the target for ease of use + const TARGETING::Target* l_mba_target = l_mbaTargetList[l_mbaNum]; + + // Dump current run on target + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "Running mss_draminit_training HWP on " + "target HUID %.8X", TARGETING::get_huid(l_mba_target)); + + //@TODO RTC:133831 Cast to a FAPI type of target. + //const fapi::Target l_fapi_mba_target( TARGET_TYPE_MBA_CHIPLET, + // (const_cast<TARGETING::Target*>(l_mba_target)) ); + + + // call the HWP with each fapi::Target + //FAPI_INVOKE_HWP(l_err, mss_draminit_training, l_fapi_mba_target); + + if (l_err) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%.8X : mss_draminit_training HWP returns error", + l_err->reasonCode()); + + // capture the target data in the elog + ErrlUserDetailsTarget(l_mba_target).addToLog( l_err ); + + // Create IStep error log and cross reference to error that occurred + l_stepError.addErrorDetails( l_err ); + + // Commit Error + errlCommit( l_err, HWPF_COMP_ID ); + } + else + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "SUCCESS : mss_draminit_training HWP( )" ); + } + + } + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "call_mss_draminit_training exit" ); + + return l_stepError.getErrorHandle(); +} + +}; diff --git a/src/usr/isteps/istep13/call_mss_scominit.C b/src/usr/isteps/istep13/call_mss_scominit.C new file mode 100644 index 000000000..c6eaae3da --- /dev/null +++ b/src/usr/isteps/istep13/call_mss_scominit.C @@ -0,0 +1,156 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/call_mss_scominit.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] 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 <errl/errlentry.H> +#include <errl/errlmanager.H> +#include <errl/errludtarget.H> +#include <isteps/hwpisteperror.H> +#include <initservice/isteps_trace.H> + +// targeting support +#include <targeting/common/commontargeting.H> +#include <targeting/common/util.H> +#include <targeting/common/utilFilter.H> + +using namespace ERRORLOG; +using namespace ISTEP; +using namespace ISTEP_ERROR; +using namespace TARGETING; + +namespace ISTEP_13 +{ +void* call_mss_scominit (void *io_pArgs) +{ + errlHndl_t l_err = NULL; + + IStepError l_stepError; + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_scominit entry" ); + + do + { + // Get all Centaur targets + TARGETING::TargetHandleList l_membufTargetList; + getAllChips(l_membufTargetList, TYPE_MEMBUF); + + for (TargetHandleList::const_iterator + l_membuf_iter = l_membufTargetList.begin(); + l_membuf_iter != l_membufTargetList.end(); + ++l_membuf_iter) + { + // make a local copy of the target for ease of use + const TARGETING::Target* l_pCentaur = *l_membuf_iter; + + // Dump current run on target + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "Running mss_scominit HWP on " + "target HUID %.8X", TARGETING::get_huid(l_pCentaur)); + + //@TODO RTC:133831 Cast to a FAPI type of target. + //const fapi::Target l_fapi_centaur( TARGET_TYPE_MEMBUF_CHIP, + // (const_cast<TARGETING::Target*>(l_pCentaur)) ); + + // call the HWP with each fapi::Target + //FAPI_INVOKE_HWP(l_err, mss_scominit, l_fapi_centaur); + + if (l_err) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%.8X: mss_scominit HWP returns error", + l_err->reasonCode()); + + // capture the target data in the elog + ErrlUserDetailsTarget(l_pCentaur).addToLog(l_err); + + // Create IStep error log and cross reference to error that + // occurred + l_stepError.addErrorDetails( l_err ); + + // Commit Error + errlCommit( l_err, HWPF_COMP_ID ); + } + else + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "SUCCESS : mss_scominit HWP( )" ); + } + } + if (!l_stepError.isNull()) + { + break; + } + + // Run proc throttle sync + // Get all functional proc chip targets + TARGETING::TargetHandleList l_cpuTargetList; + getAllChips(l_cpuTargetList, TYPE_PROC); + + for (TARGETING::TargetHandleList::const_iterator + l_cpuIter = l_cpuTargetList.begin(); + l_cpuIter != l_cpuTargetList.end(); + ++l_cpuIter) + { + const TARGETING::Target* l_pTarget = *l_cpuIter; + //@TODO RTC:133831 + //fapi::Target l_fapiproc_target( TARGET_TYPE_PROC_CHIP, + // (const_cast<TARGETING::Target*>(l_pTarget))); + + //TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + // "Running proc_throttle_sync HWP on " + // "target HUID %.8X", TARGETING::get_huid(l_pTarget)); + + // Call proc_throttle_sync + //FAPI_INVOKE_HWP( l_err, proc_throttle_sync, l_fapiproc_target ); + + if (l_err) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%.8X: proc_throttle_sync HWP returns error", + l_err->reasonCode()); + + // Capture the target data in the elog + ErrlUserDetailsTarget(l_pTarget).addToLog(l_err); + + // Create IStep error log and cross reference + // to error that occurred + l_stepError.addErrorDetails( l_err ); + + // Commit Error + errlCommit( l_err, HWPF_COMP_ID ); + } + else + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "SUCCESS : proc_throttle_sync HWP( )" ); + } + } + + } while (0); + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_scominit exit" ); + + return l_stepError.getErrorHandle(); +} + +}; diff --git a/src/usr/isteps/istep13/call_proc_mcs_skewadjust.C b/src/usr/isteps/istep13/call_proc_mcs_skewadjust.C new file mode 100644 index 000000000..3f99ffbb8 --- /dev/null +++ b/src/usr/isteps/istep13/call_proc_mcs_skewadjust.C @@ -0,0 +1,38 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/call_proc_mcs_skewadjust.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] 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 <errl/errlentry.H> + +using namespace ERRORLOG; + +namespace ISTEP_13 +{ +void* call_proc_mcs_skewadjust (void *io_pArgs) +{ + errlHndl_t l_err = NULL; + //@TODO RTC:133831 call p9_mem_skewadjust.C HWP + return l_err; +} + +}; diff --git a/src/usr/isteps/istep13/hbVddrMsg.C b/src/usr/isteps/istep13/hbVddrMsg.C new file mode 100644 index 000000000..0c253f9a5 --- /dev/null +++ b/src/usr/isteps/istep13/hbVddrMsg.C @@ -0,0 +1,733 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/hbVddrMsg.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2012,2015 */ +/* [+] 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 <sys/task.h> +#include <stdlib.h> +#include <string.h> +#include <sys/msg.h> +#include <sys/mm.h> +#include <errl/errlentry.H> +#include <errl/errlmanager.H> +#include <trace/interface.H> +#include <trace/trace.H> +#include <mbox/mbox_queues.H> +#include <mbox/mboxif.H> + +#include "hbVddrMsg.H" +#include <initservice/initserviceif.H> +#include <pnor/pnorif.H> +#include "platform_vddr.H" + + +using namespace ERRORLOG; +using namespace TARGETING; + +// Trace definition +trace_desc_t* g_trac_volt = NULL; +TRAC_INIT(&g_trac_volt, "HB_VDDR", 1024); + +/////////////////////////////////////////////////////////////////////////////// +// HBVddrMsg::HBVddrMsg() +/////////////////////////////////////////////////////////////////////////////// +HBVddrMsg::HBVddrMsg() +{ + TRACDCOMP( g_trac_volt, ENTER_MRK "HBVddrMsg::HBVddrMsg()" ); + TRACDCOMP( g_trac_volt, EXIT_MRK "HBVddrMsg::HBVddrMsg()" ); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// HBVddrMsg::~HBVddrMsg() +/////////////////////////////////////////////////////////////////////////////// +HBVddrMsg::~HBVddrMsg() +{ + TRACDCOMP( g_trac_volt, ENTER_MRK "HBVddrMsg::~HBVddrMsg()" ); + TRACDCOMP( g_trac_volt, EXIT_MRK "HBVddrMsg::~HBVddrMsg()" ); +}; + + +/////////////////////////////////////////////////////////////////////////////// +// compareVids +/////////////////////////////////////////////////////////////////////////////// + +bool compareVids( + HBVddrMsg::hwsvPowrMemVoltDomainRequest_t i_lhs, + HBVddrMsg::hwsvPowrMemVoltDomainRequest_t i_rhs) +{ + bool lhsLogicallyBeforeRhs = (i_lhs.domain < i_rhs.domain); + + if (i_lhs.domain == i_rhs.domain) + { + lhsLogicallyBeforeRhs = ( static_cast<uint16_t>(i_lhs.domainId) + < static_cast<uint16_t>(i_rhs.domainId) ); + } + + return lhsLogicallyBeforeRhs; +} + +/////////////////////////////////////////////////////////////////////////////// +// areVidsEqual +/////////////////////////////////////////////////////////////////////////////// + +bool areVidsEqual( + HBVddrMsg::hwsvPowrMemVoltDomainRequest_t i_lhs, + HBVddrMsg::hwsvPowrMemVoltDomainRequest_t i_rhs) +{ + return( ( i_lhs.domain + == i_rhs.domain) + && ( static_cast<uint16_t>(i_lhs.domainId) + == static_cast<uint16_t>(i_rhs.domainId)) ); +} + +/////////////////////////////////////////////////////////////////////////////// +// isUnusedVoltageDomain +/////////////////////////////////////////////////////////////////////////////// + +bool isUnusedVoltageDomain( + HBVddrMsg::hwsvPowrMemVoltDomainRequest_t i_vid) +{ + return (!i_vid.voltageMillivolts); +} + +//****************************************************************************** +// addMemoryVoltageDomains (templated) +//****************************************************************************** + +template< + const ATTRIBUTE_ID OFFSET_DISABLEMENT_ATTR, + const ATTRIBUTE_ID VOLTAGE_ATTR_WHEN_OFFSET_ENABLED, + const ATTRIBUTE_ID VOLTAGE_ATTR_WHEN_OFFSET_DISABLED, + const ATTRIBUTE_ID VOLTAGE_DOMAIN_ID_ATTR > +void HBVddrMsg::addMemoryVoltageDomains( + const TARGETING::Target* const i_pMembuf, + HBVddrMsg::RequestContainer& io_domains) const +{ + assert( + (i_pMembuf != NULL), + "HBVddrMsg::addMemoryVoltageDomains: Code bug! Caller passed NULL " + "memory buffer target handle."); + + assert( + ( ( i_pMembuf->getAttr<TARGETING::ATTR_CLASS>() + == TARGETING::CLASS_CHIP) + && ( i_pMembuf->getAttr<TARGETING::ATTR_TYPE>() + == TARGETING::TYPE_MEMBUF)), + "HBVddrMsg::addMemoryVoltageDomains: Code bug! Caller passed non-" + "memory buffer target handle of class = 0x%08X and type of 0x%08X.", + i_pMembuf->getAttr<TARGETING::ATTR_CLASS>(), + i_pMembuf->getAttr<TARGETING::ATTR_TYPE>()); + + TARGETING::Target* pSysTarget = NULL; + TARGETING::targetService().getTopLevelTarget(pSysTarget); + + assert( + (pSysTarget != NULL), + "HBVddrMsg::addMemoryVoltageDomains: Code bug! System target was " + "NULL."); + + typename AttributeTraits< OFFSET_DISABLEMENT_ATTR >::Type + disableOffsetVoltage = + pSysTarget->getAttr< OFFSET_DISABLEMENT_ATTR >(); + + assert( + (disableOffsetVoltage <= true), + "HBVddrMsg::addMemoryVoltageDomains: Code Bug! Unsupported " + "value of 0x%02X for attribute ID of 0x%08X.", + disableOffsetVoltage, + OFFSET_DISABLEMENT_ATTR); + + // Initialized by constructor to invalid defaults + HBVddrMsg::hwsvPowrMemVoltDomainRequest_t entry; + + switch(VOLTAGE_DOMAIN_ID_ATTR) + { + case TARGETING::ATTR_VMEM_ID: + entry.domain = MEM_VOLTAGE_DOMAIN_VDDR; + break; + case TARGETING::ATTR_VCS_ID: + entry.domain = MEM_VOLTAGE_DOMAIN_VCS; + break; + case TARGETING::ATTR_VPP_ID: + entry.domain = MEM_VOLTAGE_DOMAIN_VPP; + break; + case TARGETING::ATTR_AVDD_ID: + entry.domain = MEM_VOLTAGE_DOMAIN_AVDD; + break; + case TARGETING::ATTR_VDD_ID: + entry.domain = MEM_VOLTAGE_DOMAIN_VDD; + break; + default: + assert( + 0, + "HBVddrMsg::addMemoryVoltageDomains: Code Bug! Unsupported " + "voltage domain of 0x%08X.", + VOLTAGE_DOMAIN_ID_ATTR); + break; + } + + // There is no reasonable check to validate if a voltage ID we're reading + // is valid so it has to be assumed good + entry.domainId = i_pMembuf->getAttr< VOLTAGE_DOMAIN_ID_ATTR >(); + + // There is no reasonable check to validate if a voltage we're + // reading is valid so it has to be assumed good for the cases below + if(!disableOffsetVoltage) + { + typename + TARGETING::AttributeTraits< VOLTAGE_ATTR_WHEN_OFFSET_ENABLED >::Type + voltageMillivolts + = i_pMembuf->getAttr< VOLTAGE_ATTR_WHEN_OFFSET_ENABLED >(); + + entry.voltageMillivolts = static_cast<uint32_t>(voltageMillivolts); + io_domains.push_back(entry); + } + else if( VOLTAGE_ATTR_WHEN_OFFSET_DISABLED + != VOLTAGE_ATTR_WHEN_OFFSET_ENABLED) + { + typename + TARGETING::AttributeTraits< VOLTAGE_ATTR_WHEN_OFFSET_DISABLED >::Type + voltageMillivolts + = i_pMembuf->getAttr< VOLTAGE_ATTR_WHEN_OFFSET_DISABLED >(); + + entry.voltageMillivolts = static_cast<uint32_t>(voltageMillivolts); + io_domains.push_back(entry); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// HBVddrMsg::createVddrData +/////////////////////////////////////////////////////////////////////////////// + +void HBVddrMsg::createVddrData( + VDDR_MSG_TYPE i_requestType, + RequestContainer& io_request) const +{ + TRACFCOMP( g_trac_volt, ENTER_MRK "HBVddrMsg::createVddrData" ); + + // Go through all the memory buffers and gather their domains, domain + // specific IDs, and domain specific voltages + io_request.clear(); + + do{ + + TARGETING::TargetHandleList membufTargetList; + //When request is a disable command, disable all present Centaurs + // in case we go through a reconfigure loop + if(i_requestType == HB_VDDR_DISABLE) + { + getChipResources( membufTargetList, TYPE_MEMBUF, + UTIL_FILTER_PRESENT ); + } + //When the request is an enable command, enable only functional + // centaurs. + else + { + getAllChips(membufTargetList, TYPE_MEMBUF); + } + + TARGETING::Target* pMembuf =NULL; + for (TARGETING::TargetHandleList::const_iterator + ppMembuf = membufTargetList.begin(); + ppMembuf != membufTargetList.end(); + ++ppMembuf) + { + pMembuf = *ppMembuf; + + if(i_requestType == HB_VDDR_ENABLE) + { + (void)addMemoryVoltageDomains< + TARGETING::ATTR_MSS_CENT_VDD_OFFSET_DISABLE, + TARGETING::ATTR_MEM_VDD_OFFSET_MILLIVOLTS, + TARGETING::ATTR_MEM_VDD_OFFSET_MILLIVOLTS, + TARGETING::ATTR_VDD_ID>( + pMembuf, + io_request); + + (void)addMemoryVoltageDomains< + TARGETING::ATTR_MSS_CENT_AVDD_OFFSET_DISABLE, + TARGETING::ATTR_MEM_AVDD_OFFSET_MILLIVOLTS, + TARGETING::ATTR_MEM_AVDD_OFFSET_MILLIVOLTS, + TARGETING::ATTR_AVDD_ID>( + pMembuf, + io_request); + + (void)addMemoryVoltageDomains< + TARGETING::ATTR_MSS_CENT_VCS_OFFSET_DISABLE, + TARGETING::ATTR_MEM_VCS_OFFSET_MILLIVOLTS, + TARGETING::ATTR_MEM_VCS_OFFSET_MILLIVOLTS, + TARGETING::ATTR_VCS_ID>( + pMembuf, + io_request); + + (void)addMemoryVoltageDomains< + TARGETING::ATTR_MSS_VOLT_VPP_OFFSET_DISABLE, + TARGETING::ATTR_MEM_VPP_OFFSET_MILLIVOLTS, + TARGETING::ATTR_VPP_BASE, + TARGETING::ATTR_VPP_ID>( + pMembuf, + io_request); + } + + (void)addMemoryVoltageDomains< + TARGETING::ATTR_MSS_VOLT_VDDR_OFFSET_DISABLE, + TARGETING::ATTR_MEM_VDDR_OFFSET_MILLIVOLTS, + TARGETING::ATTR_MSS_VOLT, + TARGETING::ATTR_VMEM_ID>( + pMembuf, + io_request); + } + + if (membufTargetList.size() > 1) + { + // Take out the duplicate records in io_request by first + // sorting and then removing the duplicates + std::sort(io_request.begin(), io_request.end(), compareVids); + std::vector<hwsvPowrMemVoltDomainRequest_t>::iterator + pInvalidEntries = std::unique( + io_request.begin(), + io_request.end(), + areVidsEqual); + io_request.erase(pInvalidEntries,io_request.end()); + } + + if( ( (i_requestType == HB_VDDR_ENABLE) || + (i_requestType == HB_VDDR_POST_DRAM_INIT_ENABLE) ) + && (!membufTargetList.empty()) ) + { + // Inhibit sending any request to turn on a domain with no voltage. + // When disabling we don't need to do this because the voltage is + // ignored. + io_request.erase( + std::remove_if(io_request.begin(), io_request.end(), + isUnusedVoltageDomain),io_request.end()); + } + + } while(0); + + TRACFCOMP( g_trac_volt, EXIT_MRK "HBVddrMsg::createVddrData" ); + return; +} + +/////////////////////////////////////////////////////////////////////////////// +// HBVddrMsg::sendMsg +/////////////////////////////////////////////////////////////////////////////// +errlHndl_t HBVddrMsg::sendMsg(VDDR_MSG_TYPE i_msgType) const +{ + errlHndl_t l_err = NULL; + + TRACFCOMP(g_trac_volt, ENTER_MRK + "hbVddrMsg::sendMsg msg_type =0x%08X",i_msgType); + + do + { + RequestContainer l_request; + + if ( ! ( (i_msgType == HB_VDDR_ENABLE) || + (i_msgType == HB_VDDR_DISABLE) || + (i_msgType == HB_VDDR_POST_DRAM_INIT_ENABLE) ) ) + { + TRACFCOMP(g_trac_volt, ERR_MRK "hbVddrMsg::send msg with non-" + "valid msg type%08X",i_msgType); + /*@ + * @errortype + * @moduleid fapi::MOD_VDDR_SEND_MSG + * @reasoncode fapi::RC_INCORRECT_MSG_TYPE + * @userdata1 i_msgType + * @userdata2 0 + * + * @devdesc HB got an incorrect type message. HB did not + * provide the correct message type in the istep. + * Userdata1 shows the message type passed in + */ + createErrLog(l_err, fapi::MOD_VDDR_SEND_MSG, + fapi::RC_INCORRECT_MSG_TYPE, i_msgType); + break; + } + createVddrData(i_msgType, l_request); + + + size_t l_dataCount = l_request.size(); + + // Only send a message if there is data to send + if (l_dataCount) + { + uint32_t l_msgSize = l_dataCount * + sizeof(hwsvPowrMemVoltDomainRequest_t); + + // Create the message to send to HWSV + msg_t* l_msg = msg_allocate(); + l_msg->type = i_msgType; + l_msg->data[0] = 0; + l_msg->data[1] = l_msgSize; + + TRACFCOMP(g_trac_volt, INFO_MRK "hbVddrMsg::l_dataCount=%d, " + "l_msgSize=%d", + l_dataCount, l_msgSize); + void* l_data = malloc(l_msgSize); + + hwsvPowrMemVoltDomainRequest_t* l_ptr = + reinterpret_cast<hwsvPowrMemVoltDomainRequest_t*>(l_data); + + for (size_t j =0; j<l_dataCount; ++j) + { + l_ptr->domain=l_request.at(j).domain; + l_ptr->domainId=l_request.at(j).domainId; + l_ptr->voltageMillivolts=l_request.at(j).voltageMillivolts; + + TRACFCOMP(g_trac_volt, ENTER_MRK "hbVddrMsg::sendMsg " + "Voltage domain type = 0x%08X, " + "Voltage domain ID = 0x%04X, " + "Voltage (mV) = %d, index = %d", + l_ptr->domain, + l_ptr->domainId, l_ptr->voltageMillivolts,j); + l_ptr++; + } + + l_msg->extra_data = l_data; + + TRACFBIN(g_trac_volt, "l_data", l_data, l_msgSize); + l_err = MBOX::sendrecv( MBOX::FSP_VDDR_MSGQ, l_msg ); + if (l_err) + { + TRACFCOMP(g_trac_volt, + ERR_MRK "Failed sending VDDR message to FSP"); + } + else + { + l_err=processMsg(l_msg); + } + + // If sendrecv returns error then it may not have freed the + // extra_data, else need to free the response message extra_data + free(l_msg->extra_data); + l_msg->extra_data = NULL; + + msg_free(l_msg); + l_msg = NULL; + } + } while(0); + + TRACFCOMP(g_trac_volt, EXIT_MRK "hbEnableVddr::sendMsg"); + return l_err; +} + + +/////////////////////////////////////////////////////////////////////////////// +// HBVddrMsg::processVDDRmsg +/////////////////////////////////////////////////////////////////////////////// +errlHndl_t HBVddrMsg::processVDDRmsg(msg_t* i_recvMsg) const +{ + TRACFCOMP(g_trac_volt, ENTER_MRK "HBVddrMsg::processVDDRmsg"); + errlHndl_t l_errLog = NULL; + //check to see if an error occurred from the powr Enable/Disable functions + //and is inside the message + + uint32_t l_msgSize = i_recvMsg->data[1]; + uint16_t l_elementCount = l_msgSize/sizeof(hwsvPowrMemVoltDomainReply_t); + const uint8_t* l_extraData = NULL; + l_extraData=static_cast<uint8_t*>(i_recvMsg->extra_data); + + do{ + if (l_extraData==NULL) + { + //an error occred in obtaining the extra data from the response msg + TRACFCOMP( g_trac_volt, ERR_MRK + "HBVddrMsg::processVDDRmsg: l_extraData = NULL"); + //create an errorlog + /*@ + * @errortype + * @moduleid fapi::MOD_VDDR_PROC_VDDR_MSG + * @reasoncode fapi::RC_VDDR_EMPTY_MSG + * @userdata1 0 + * @userdata2 0 + * + * @devdesc The hwsv returned a message where the extra data + * was null. This should not happen so need to + * tell HostBoot to stop the ipl + */ + createErrLog(l_errLog, fapi::MOD_VDDR_PROC_VDDR_MSG, + fapi::RC_VDDR_EMPTY_MSG); + break; + } + + MEM_VOLTAGE_DOMAIN domain = MEM_VOLTAGE_DOMAIN_UNKNOWN; + TARGETING::ATTR_VMEM_ID_type l_domainId =0x0; + uint32_t l_errPlid =0x0; + + TRACFCOMP( g_trac_volt, INFO_MRK "HBVddrMsg::processVDDRmsg: " + "l_elementCount=%d, l_msgSize =%d", + l_elementCount, l_msgSize); + const hwsvPowrMemVoltDomainReply_t* l_ptr= + reinterpret_cast<const hwsvPowrMemVoltDomainReply_t*>(l_extraData); + + for (size_t i=0; i<l_elementCount; ++i) + { + domain = l_ptr->domain; + l_domainId = l_ptr->domainId; + l_errPlid = l_ptr->plid; + + TRACFCOMP( g_trac_volt, INFO_MRK "HBVddrMsg::processVDDRmsg: " + "domain = 0x%08X, l_domainId=0x%08X, l_errPlid=0x%08X", + domain,l_domainId,l_errPlid); + if (l_errPlid ==0x0) + { + TRACFCOMP( g_trac_volt, INFO_MRK "HBVddrMsg::processVDDRmsg: " + "no plid error found for domain = 0x%08X, " + "l_domainId=0x%08X", domain, l_domainId); + } + else + { + //error occured so break out of the loop and indicate + //an error was present + TRACFCOMP( g_trac_volt, ERR_MRK + "HBVddrMsg::processVDDRmsg: error occured " + "on the powr function called in hwsv"); + //create an errorlog + /*@ + * @errortype + * @moduleid fapi::MOD_VDDR_PROC_VDDR_MSG + * @reasoncode fapi::RC_VDDR_POWR_ERR + * @userdata1 l_errPlid + * @userdata2 0 + * + * @devdesc The hwsv returned a message where there was + * an error when the powr function was called. + * userdata1 contains the errorlog plid from + * hwsv generated by the powr function + */ + createErrLog(l_errLog, fapi::MOD_VDDR_PROC_VDDR_MSG, + fapi::RC_VDDR_POWR_ERR, l_errPlid); + l_errLog->plid(l_errPlid); + break; + } + + l_ptr++; + } + }while(0); + TRACFCOMP(g_trac_volt, EXIT_MRK "HBVddrMsg::processVDDRmsg"); + return l_errLog; +} + +/////////////////////////////////////////////////////////////////////////////// +// HBVddrMsg::processMsg +/////////////////////////////////////////////////////////////////////////////// +errlHndl_t HBVddrMsg::processMsg(msg_t* i_Msg) const +{ + TRACFCOMP(g_trac_volt, ENTER_MRK "HBVddrMsg::processMsg"); + errlHndl_t l_errLog = NULL; + + do + { + //check to see if the data[0] =0 or contains a value. + //A value of 0 means its a response to a request and a value not equal + //to zero means that its an error coming back + + uint16_t l_value1=i_Msg->data[0]; + if (l_value1 ==0) + { + //process a response to a request + + uint32_t l_msgType =i_Msg->type; + TRACFCOMP( g_trac_volt, INFO_MRK + "HBVddrMsg::processMsg l_msgType=x%08X",l_msgType ); + if ( (l_msgType == HB_VDDR_ENABLE) || + (l_msgType == HB_VDDR_DISABLE)|| + (l_msgType == HB_VDDR_POST_DRAM_INIT_ENABLE) ) + { + //process a VDDR message + l_errLog=processVDDRmsg(i_Msg); + if (l_errLog) + { + break; + } + + } + else + { + TRACFCOMP( g_trac_volt, ERR_MRK + "HBVddrMsg::processMsg recv'd a non valid type"); + //generate errorLog; + /*@ + * @errortype + * @moduleid fapi::MOD_VDDR_PROC_MSG + * @reasoncode fapi::RC_INCORRECT_MSG_TYPE + * @userdata1 0 + * @userdata2 0 + * + * @devdesc HB got an incorrect type message. + * HWSV did not populate the message correctly + * or mbox corrupted the message + */ + createErrLog(l_errLog, fapi::MOD_VDDR_PROC_MSG, + fapi::RC_INCORRECT_MSG_TYPE); + } + } + else + { + //an error occurred so should stop the IPL + TRACFCOMP( g_trac_volt, ERR_MRK + "HBVddrMsg::RecvMsgHndlr recv'd an error message" ); + //generate an errorlog + /*@ + * @errortype + * @moduleid fapi::MOD_VDDR_PROC_MSG + * @reasoncode fapi::RC_VDDR_ERROR_MSG + * @userdata1 error PLID from hwsv + * @userdata2 0 + * + * @devdesc The hwsv found an error while processing the + * message so it sent an error message back to + * indicate to HostBoot to stop the IPL. + * Userdata1 will have the error PLID from hwsv's + * errorlog + */ + createErrLog(l_errLog, fapi::MOD_VDDR_PROC_MSG, + fapi::RC_VDDR_ERROR_MSG, i_Msg->data[1]); + l_errLog->plid(i_Msg->data[1]); + } + + }while(0); + + TRACFCOMP(g_trac_volt, EXIT_MRK "HBVddrMsg::processMsg"); + return l_errLog; +} + +/////////////////////////////////////////////////////////////////////////////// +// HBVddrMsg::createErrLog +/////////////////////////////////////////////////////////////////////////////// +void HBVddrMsg::createErrLog(errlHndl_t& io_err, + fapi::hwpfModuleId i_mod, + fapi::hwpfReasonCode i_rc, + uint32_t i_userData1) const +{ + if (io_err == NULL) + { + io_err = new ErrlEntry(ERRL_SEV_UNRECOVERABLE, + i_mod, + i_rc, + i_userData1, + 0); + + } + return; +} + +// External interfaces + +errlHndl_t platform_enable_vspd() +{ + // noop on FSP based system + return NULL; +} + +errlHndl_t platform_enable_vddr() +{ + errlHndl_t l_err = NULL; + if(INITSERVICE::spBaseServicesEnabled()) + { + HBVddrMsg l_hbVddr; + + l_err = l_hbVddr.sendMsg(HBVddrMsg::HB_VDDR_ENABLE); + if (l_err) + { + TRACFCOMP(g_trac_volt, + "ERROR 0x%.8X: call_host_enable_vddr to sendMsg" + " returns error", + l_err->reasonCode()); + } + else + { + TRACFCOMP( g_trac_volt, + "SUCCESS : host_enable_vddr()" ); + } + } + else // no FSP/mbox services available + { + TRACFCOMP(g_trac_volt,"call_host_enable_vddr" + "no-op because mbox not available"); + } + + return l_err; +} + +errlHndl_t platform_disable_vddr() +{ + errlHndl_t l_err = NULL; + if(INITSERVICE::spBaseServicesEnabled()) + { + HBVddrMsg l_hbVddr; + + l_err = l_hbVddr.sendMsg(HBVddrMsg::HB_VDDR_DISABLE); + if (l_err) + { + TRACFCOMP(g_trac_volt, + "ERROR 0x%.8X: call_host_disable_vddr to sendMsg" + " returns error", + l_err->reasonCode()); + } + else + { + TRACFCOMP( g_trac_volt, + "SUCCESS : host_disable_vddr()" ); + } + } + else // no FSP/mbox services available + { + TRACFCOMP(g_trac_volt,"call_host_disable_vddr" + "no-op because mbox not available"); + } + + return l_err; +} + +errlHndl_t platform_adjust_vddr_post_dram_init() +{ + errlHndl_t l_err = NULL; + if(INITSERVICE::spBaseServicesEnabled()) + { + HBVddrMsg l_hbVddr; + + l_err = l_hbVddr.sendMsg(HBVddrMsg::HB_VDDR_POST_DRAM_INIT_ENABLE); + if (l_err) + { + TRACFCOMP(g_trac_volt, + "ERROR 0x%.8X: call_host_adjust_vddr_post_dram_init to " + "sendMsg returns error", + l_err->reasonCode()); + } + else + { + TRACFCOMP( g_trac_volt, + "SUCCESS : host_adjust_vddr_post_dram_init()" ); + } + } + else // no FSP/mbox services available + { + TRACFCOMP(g_trac_volt,"call_host_adjust_vddr_post_dram_init()" + "no-op because mbox not available"); + } + + return l_err; +} + diff --git a/src/usr/isteps/istep13/hbVddrMsg.H b/src/usr/isteps/istep13/hbVddrMsg.H new file mode 100644 index 000000000..2b14c0c00 --- /dev/null +++ b/src/usr/isteps/istep13/hbVddrMsg.H @@ -0,0 +1,311 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/hbVddrMsg.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2012,2015 */ +/* [+] 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 __HB_VDDR_MSG_H +#define __HB_VDDR_MSG_H + +/*****************************************************************************/ +// I n c l u d e s +/*****************************************************************************/ +#include <sys/task.h> +#include <stdlib.h> +#include <string.h> +#include <sys/mm.h> +#include <sys/msg.h> +#include <sys/sync.h> +#include <stdint.h> + +#include <util/singleton.H> +#include <errl/errlentry.H> +#include <kernel/timemgr.H> +#include <hbotcompid.H> +#include <hwas/common/hwasCallout.H> +#include <mbox/mbox_queues.H> +#include <mbox/mboxif.H> +#include <targeting/common/targetservice.H> +#include <targeting/common/utilFilter.H> +#include <hwpf/hwpf_reasoncodes.H> +#include <attributeenums.H> + +/*****************************************************************************/ +// Forward class declarations +/*****************************************************************************/ +class HBVddrMsg; + +/** + * @brief HBVddrMsg + * This class provides interfaces to send and process messages to and from + * hwsv with respect to powr. It also indicates when to stop the IPL via + * errorlogs + */ +class HBVddrMsg +{ + +public: + + /** + * @brief Enum specifying a memory voltage domain type + */ + enum MEM_VOLTAGE_DOMAIN + { + // For unknown / uninitialized values + MEM_VOLTAGE_DOMAIN_UNKNOWN = 0x00, + + // Valid values + MEM_VOLTAGE_DOMAIN_VDD = 0x01, + MEM_VOLTAGE_DOMAIN_AVDD = 0x02, + MEM_VOLTAGE_DOMAIN_VCS = 0x03, + MEM_VOLTAGE_DOMAIN_VPP = 0x04, + MEM_VOLTAGE_DOMAIN_VDDR = 0x05, + + // Good range markers - Need to be adjusted if the above change + MEM_VOLTAGE_DOMAIN_MIN_VALUE = MEM_VOLTAGE_DOMAIN_VDD, + MEM_VOLTAGE_DOMAIN_MAX_VALUE = MEM_VOLTAGE_DOMAIN_VDDR, + }; + + /** + * @struct hwsvPowrMemVoltDomainRequest_t + * + * @brief Structure containing a memory voltage domain type, ID, and + * voltage in mV + */ + struct hwsvPowrMemVoltDomainRequest_t + { + MEM_VOLTAGE_DOMAIN domain; + TARGETING::ATTR_VMEM_ID_type domainId; + TARGETING::ATTR_MSS_VOLT_type voltageMillivolts; + + hwsvPowrMemVoltDomainRequest_t() + : domain(MEM_VOLTAGE_DOMAIN_UNKNOWN), + domainId(0x0000), + voltageMillivolts(0x00000000) + { + } + + } __attribute__ ((packed)); + + /** + * @struct hwsvPowrMemVoltDomainReply_t + * + * @brief Structure containing a memory voltage domain type, ID, and error + * log PLID as returned by the FSP POWR function when it tried to set + * the implied voltage regulator to the specified voltage. + */ + struct hwsvPowrMemVoltDomainReply_t + { + MEM_VOLTAGE_DOMAIN domain; + TARGETING::ATTR_VMEM_ID_type domainId; + uint32_t plid; + + hwsvPowrMemVoltDomainReply_t() + : domain(MEM_VOLTAGE_DOMAIN_UNKNOWN), + domainId(0x0000), + plid(0x00000000) + { + } + + } __attribute__ ((packed)); + + /** + * @enum VDDR_MSG_TYPE + * + * @brief Message enum to determine how the msg should be processed + * + */ + enum VDDR_MSG_TYPE + { + HB_VDDR_ENABLE = 0x40000041, + HB_VDDR_DISABLE = 0x40000042, + HB_VDDR_POST_DRAM_INIT_ENABLE = 0x40000043, + }; + + /** + * @brief typedefs for containers for structures + */ + typedef std::vector<hwsvPowrMemVoltDomainReply_t> ResponseContainer; + typedef std::vector<hwsvPowrMemVoltDomainRequest_t> RequestContainer; + + /** + * @brief Default constructor + */ + HBVddrMsg(); + + /** + * @brief Destructor + * + * Releases all resources owned by the handle. + * + * @return None + * + */ + ~HBVddrMsg(); + + /** + * @brief Accumulates memory voltage domain type/ID/voltage records and + * appends them to the provided container + * + * @par Detailed Description: + * This function will accumulates memory voltage domain type/ID/voltage + * records and appends them to the provided container. If an "enable" + * request, adds records from all memory voltage domains. If a + * "disable" message, only adds records from the VDDR (a.k.a. VMEM) + * voltage domain. + * + * @param[in] i_requestType + * Type of data accumulation request + * + * @param[in/out] io_request + * On input, a container to hold the memory voltage domain programming + * records. On output, the container holds the relevant records. + * + * @return N/A + */ + void createVddrData( + VDDR_MSG_TYPE i_requestType, + RequestContainer& io_request) const; + + /** + * @brief Uses the internal mailbox to send a message to the FSP + * + * + * @par Detailed Description: + * This function will call into mailbox FSP code using the + * FSP_VDDR_MSGQ as the message queue.. + * + * @param[in] i_msgType + * HBVddrMsg::VDDR_MSG_TYPE passed in to define the + * message policy. + * + * @return errlHndl_t + * return errl == NULL -> success + * return errl != NULL -> failure + */ + errlHndl_t sendMsg(VDDR_MSG_TYPE i_msgType) const; + +private: + + /** + * @brief For a given memory buffer and memory voltage domain, adds a + * voltage programming request record to the input list + * + * @tparam OFFSET_DISABLEMENT_ATTR + * ID of the attribute to read to determine if a given memory voltage + * domain offset voltage should be applied or not. Should be one of + * the TARGETING::ATTR_*_ID attribute IDs, where * = VMEM, VPP, VCS, + * VDD, or AVDD. + * + * @tparam VOLTAGE_ATTR_WHEN_OFFSET_ENABLED + * ID of the attribute which should be read to obtain the given memory + * voltage domain's offset voltage to program. In this case the offset + * voltage acts as the actual voltage. Should be one of the + * TARGETING::ATTR_MEM_*_OFFSET_MILLIVOLTS attribute IDs, where + * * = VMEM, VPP, VCS, VDD, or AVDD. Only used when the memory voltage + * domain's offset voltage is enabled. Otherwise the parameter, below, + * controls how the voltage, if any, is programmed. + * + * @tparam VOLTAGE_ATTR_WHEN_OFFSET_DISABLED + * ID of the attribute which should be read to obtain the given memory + * voltage domain's voltage to program. Only applied if the memory + * voltage domain's offset voltage is disabled -AND- the attribute ID + * is different than the one given by + * VOLTAGE_ATTR_WHEN_OFFSET_ENABLED. Should be one of + * TARGETING::ATTR_VPP_BASE, TARGETING::ATTR_MSS_VOLT, or + * TARGETING::ATTR_MEM_*_OFFSET_MILLIVOLTS where * = VPP, AVDD, or + * VCS. + * + * @note: This function does not ensure that all permutations of the above + * template parameters are valid. + * + * @param[in] i_pMembuf + * Handle to a memory buffer target. Function will assert if NULL or + * not a memory buffer target. + * + * @param[in,out] io_domains + * On input, an existing list of 0 or more voltage domain records. On + * output, that same list with up to 1 additional voltage domain + * record. + * + * @return N/A + */ + template< + const TARGETING::ATTRIBUTE_ID OFFSET_DISABLEMENT_ATTR, + const TARGETING::ATTRIBUTE_ID VOLTAGE_ATTR_WHEN_OFFSET_ENABLED, + const TARGETING::ATTRIBUTE_ID VOLTAGE_ATTR_WHEN_OFFSET_DISABLED, + const TARGETING::ATTRIBUTE_ID VOLTAGE_DOMAIN_ID_ATTR > + void addMemoryVoltageDomains( + const TARGETING::Target* const i_pMembuf, + HBVddrMsg::RequestContainer& io_domains) const; + +protected: + + /** + * @brief function to process a generic message recieved from the FSP + * + * @param[in] i_recvMsg The message from the message queue. + * It contains the response data from the FSP + * + * @return errlHndl_t + * return errl == NULL -> success + * return errl != NULL -> failure + */ + errlHndl_t processMsg(msg_t* i_recvMsg) const; + + /** + * @brief function to process a power Vmem message recieved from the FSP + * + * @param[in] i_recvMsg The message from the message queue. + * It contains the response data from the FSP + * + * @param[out] i_passed indicates if powr function succeeded or failed on + * the FSP. + * + * @return errlHndl_t + * return errl == NULL -> success + * return errl != NULL -> failure + */ + errlHndl_t processVDDRmsg(msg_t* i_recvMsg)const; + + /** + * @brief function to create error logs for errors that occured in FSP side + * + * @param[in/out] io_err. Error log to generate indicating that an error + * has has occured on HB or in the powr messages. This error + * should stop the IPL from processing further. + * + * @param[in] i_mod. The module where the error occured + * + * @param[in] i_rc. The return code for the error that occured + * + * @return None + */ + void createErrLog(errlHndl_t& io_err, + fapi::hwpfModuleId i_mod, + fapi::hwpfReasonCode i_rc, + uint32_t i_userData1=0x0) const; + +}; + + +#endif diff --git a/src/usr/isteps/istep13/istep13consts.H b/src/usr/isteps/istep13/istep13consts.H new file mode 100644 index 000000000..0b01a2082 --- /dev/null +++ b/src/usr/isteps/istep13/istep13consts.H @@ -0,0 +1,33 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/istep13consts.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] 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 _ISTEP13CONSTS_H_ +#define _ISTEP13CONSTS_H_ +// Run on all Centaurs/MBAs, but needs to keep this one handy in case we +// want to limit them in VPO +const uint8_t UNLIMITED_RUN = 0xFF; +const uint8_t VPO_NUM_OF_MBAS_TO_RUN = UNLIMITED_RUN; +const uint8_t VPO_NUM_OF_MEMBUF_TO_RUN = UNLIMITED_RUN; + +#endif diff --git a/src/usr/isteps/istep13/makefile b/src/usr/isteps/istep13/makefile new file mode 100644 index 000000000..8752ac179 --- /dev/null +++ b/src/usr/isteps/istep13/makefile @@ -0,0 +1,43 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/isteps/istep13/makefile $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2015 +# [+] International Business Machines Corp. +# +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. See the License for the specific language governing +# permissions and limitations under the License. +# +# IBM_PROLOG_END_TAG +ROOTPATH = ../../../.. +MODULE = istep13 + +OBJS += call_host_disable_vddr.o +OBJS += call_mem_pll_initf.o +OBJS += call_mem_pll_setup.o +OBJS += call_proc_mcs_skewadjust.o +OBJS += call_mem_startclocks.o +OBJS += call_host_enable_vddr.o +OBJS += call_mss_scominit.o +OBJS += call_mss_ddr_phy_reset.o +OBJS += call_mss_draminit.o +OBJS += call_mss_draminit_training.o +OBJS += call_mss_draminit_trainadv.o +OBJS += call_mss_draminit_mc.o + +OBJS += $(if $(CONFIG_PALMETTO_VDDR),palmetto_vddr.o,hbVddrMsg.o) + +include ${ROOTPATH}/config.mk diff --git a/src/usr/isteps/istep13/palmetto_vddr.C b/src/usr/isteps/istep13/palmetto_vddr.C new file mode 100644 index 000000000..d67d753a8 --- /dev/null +++ b/src/usr/isteps/istep13/palmetto_vddr.C @@ -0,0 +1,364 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/palmetto_vddr.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +// Rhesus board-specific VDDR support. +// VDDR is enabled/disabled via a GPIO on the hammock card. +// A separate GPIO selects between 1.35V and 1.25V output from the VR. + +#include "platform_vddr.H" + +#include <string.h> + +#include <hwpf/hwpf_reasoncodes.H> +#include <errl/errlentry.H> +#include <errl/errlmanager.H> + +#include <targeting/common/commontargeting.H> +#include <targeting/common/util.H> +#include <targeting/common/utilFilter.H> + +#include <kernel/timemgr.H> + +#include <usr/devicefw/driverif.H> +#include <usr/gpio/gpioif.H> + +using namespace TARGETING; +using namespace DeviceFW; + +trace_desc_t* g_trac_vddr = NULL; +TRAC_INIT(&g_trac_vddr, "HB_VDDR", KILOBYTE); + +// PCA95X internal register addresses +enum +{ + PCA95X_GPIO_REG_INPUT = 0x0, + PCA95X_GPIO_REG_OUTPUT = 0x2, + PCA95X_GPIO_REG_POLARITY = 0x4, + PCA95X_GPIO_POLARITY_NORMAL = 0, + PCA95X_GPIO_POLARITY_INVERTED = 1, + PCA95X_GPIO_REG_CONFIG = 0x6, +}; + +#define PCA95X_GPIO_CONFIG_OUTPUT false +#define PCA95X_GPIO_CONFIG_INPUT true + +// GPIO bit numbers (0-7) => port addr 0 pin(0-7) +// GPIO bit numbers (8-15) => port addr 1 pin(0-7) +#define GPIO_TO_PORT(gpio) (gpio / 8) +#define GPIO_TO_BIT(gpio) (gpio % 8) + +// Helper function to call provided function pointer on each functional +// centaur Target. + +//****************************************************************************** +// compareTargetsGpioInfos +//****************************************************************************** + +bool compareTargetsGpioInfos( + TARGETING::TargetHandle_t i_pLhs, + TARGETING::TargetHandle_t i_pRhs) +{ + + TARGETING::ATTR_GPIO_INFO_type lhsGpioInfo = + i_pLhs->getAttr<TARGETING::ATTR_GPIO_INFO>(); + TARGETING::ATTR_GPIO_INFO_type rhsGpioInfo = + i_pRhs->getAttr<TARGETING::ATTR_GPIO_INFO>(); + + // Code logically compares left hand side (lhs) target to right hand side + // (rhs) target with respect to GPIO info and returns true if the left hand + // side is logically before the right hand side. To make the computation, + // compare first GPIO info field for each object. If values are not + // logically equal, return whether the left hand side value was less than + // the right hand side value. Otherwise break the tie by comparing the + // next GPIO field in similar fashion. Continue breaking ties until the + // last field, in which case a tie returns false. + bool lhsLogicallyBeforeRhs = + lhsGpioInfo.i2cMasterPath < rhsGpioInfo.i2cMasterPath; + if(lhsGpioInfo.i2cMasterPath == rhsGpioInfo.i2cMasterPath) + { + lhsLogicallyBeforeRhs = lhsGpioInfo.port < rhsGpioInfo.port; + if(lhsGpioInfo.port == rhsGpioInfo.port) + { + lhsLogicallyBeforeRhs = lhsGpioInfo.engine < rhsGpioInfo.engine; + if(lhsGpioInfo.engine == rhsGpioInfo.engine) + { + lhsLogicallyBeforeRhs + = lhsGpioInfo.devAddr < rhsGpioInfo.devAddr; + if(lhsGpioInfo.devAddr == rhsGpioInfo.devAddr) + { + lhsLogicallyBeforeRhs = + lhsGpioInfo.vddrPin < rhsGpioInfo.vddrPin; + } + } + } + } + + return lhsLogicallyBeforeRhs; +} + +//****************************************************************************** +// areTargetsGpioInfoEqual +//****************************************************************************** + +bool areTargetsGpioInfoEqual( + TARGETING::TargetHandle_t i_pLhs, + TARGETING::TargetHandle_t i_pRhs) +{ + + TARGETING::ATTR_GPIO_INFO_type lhsGpioInfo = + i_pLhs->getAttr<TARGETING::ATTR_GPIO_INFO>(); + TARGETING::ATTR_GPIO_INFO_type rhsGpioInfo = + i_pRhs->getAttr<TARGETING::ATTR_GPIO_INFO>(); + + return( ( lhsGpioInfo.i2cMasterPath + == rhsGpioInfo.i2cMasterPath) + && ( lhsGpioInfo.port + == rhsGpioInfo.port) + && ( lhsGpioInfo.engine + == rhsGpioInfo.engine) + && ( lhsGpioInfo.devAddr + == rhsGpioInfo.devAddr) + && ( lhsGpioInfo.vddrPin + == rhsGpioInfo.vddrPin) ); +} + +static errlHndl_t for_each_vddr_domain_with_functional_memory( + errlHndl_t (*func)(Target *)) +{ + // Get all functional Centaur targets + TargetHandleList l_membufTargetList; + getAllChips(l_membufTargetList, TYPE_MEMBUF); + + errlHndl_t l_err = NULL; + + // Sort chips in order of GPIO info + std::sort(l_membufTargetList.begin(), l_membufTargetList.end(), + compareTargetsGpioInfos); + + // Prune out targets with non-unique GPIO info + std::vector<TARGETING::TargetHandle_t>::iterator + pInvalidEntries = std::unique( + l_membufTargetList.begin(), + l_membufTargetList.end(), + areTargetsGpioInfoEqual); + l_membufTargetList.erase(pInvalidEntries,l_membufTargetList.end()); + + // Invoke callback for one Centaur per unique VDDR domain + for (TargetHandleList::iterator + l_membuf_iter = l_membufTargetList.begin(); + l_membuf_iter != l_membufTargetList.end(); + ++l_membuf_iter) + { + Target* l_pCentaur = *l_membuf_iter; + + l_err = (*func)(l_pCentaur); + + if( l_err ) + { + break; + } + } + + return l_err; +} + +static errlHndl_t pca95xGpioSetBit(TARGETING::Target * i_target, + uint8_t i_reg, + uint8_t i_gpio, + bool i_val) +{ + errlHndl_t err = NULL; + do + { + + uint64_t cmd = i_reg + GPIO_TO_PORT(i_gpio); + uint8_t data = 0; + size_t dataLen = sizeof(data); + + // Might want to make this an attribute; + // However, This is already a palmetto only object + uint64_t deviceType = GPIO::PCA95X_GPIO; + + err = DeviceFW::deviceOp + ( DeviceFW::READ, + i_target, + &data, + dataLen, + DEVICE_GPIO_ADDRESS(deviceType, cmd) + ); + + if( err ) + { + break; + } + + uint8_t new_reg_val = data; + if( i_val ) + { + new_reg_val |= 1 << GPIO_TO_BIT(i_gpio); + } + else + { + new_reg_val &= ~(1 << GPIO_TO_BIT(i_gpio)); + } + + // Do the write only if actually changing value. + if( new_reg_val != data ) + { + data = new_reg_val; + cmd = i_reg + GPIO_TO_PORT(i_gpio); + + err = DeviceFW::deviceOp + ( DeviceFW::WRITE, + i_target, + &data, + dataLen, + DEVICE_GPIO_ADDRESS(deviceType, cmd) + ); + + if( err ) + { + break; + } + } + + } while(0); + + return err; +} + + +static errlHndl_t pca95xGpioWriteBit(TARGETING::Target * i_target, + uint8_t i_gpio_pin, + bool i_val) +{ + assert( i_gpio_pin >= 0 && i_gpio_pin < 16 ); + errlHndl_t err = NULL; + + err = pca95xGpioSetBit(i_target, + PCA95X_GPIO_REG_OUTPUT, + i_gpio_pin, + i_val); + + // Configure gpio bit as output (if necessary). + if(!err) + { + err = pca95xGpioSetBit(i_target, + PCA95X_GPIO_REG_CONFIG, + i_gpio_pin, + PCA95X_GPIO_CONFIG_OUTPUT); + } + + return err; +} + +static errlHndl_t enableVddrViaGpioPinStrategy(Target *centaur) +{ + errlHndl_t l_err = NULL; + + do + { + // Enable the DIMM power. + TARGETING::ATTR_GPIO_INFO_type gpioInfo = + centaur->getAttr<TARGETING::ATTR_GPIO_INFO>(); + + l_err = pca95xGpioWriteBit(centaur, gpioInfo.vddrPin, true); + if(l_err) + { + TRACFCOMP(g_trac_vddr,ERR_MRK " " + "Failed to assert pca95x GPIO for Centaur HUID = 0x%08x " + "and pin %d.", + TARGETING::get_huid(centaur),gpioInfo.vddrPin); + break; + } + + TRACFCOMP(g_trac_vddr,INFO_MRK " " + "Enabled VDDR for Centaur HUID = 0x%08x (asserted pca95x GPIO " + "pin %d).", + TARGETING::get_huid(centaur), + gpioInfo.vddrPin); + + } while(0); + + return l_err; +} + +static errlHndl_t disableVddrViaGpioPinStrategy(Target *centaur) +{ + errlHndl_t l_err = NULL; + + do + { + // Disable the DIMM power. + TARGETING::ATTR_GPIO_INFO_type gpioInfo = + centaur->getAttr<TARGETING::ATTR_GPIO_INFO>(); + + l_err = pca95xGpioWriteBit(centaur,gpioInfo.vddrPin, false); + if(l_err) + { + TRACFCOMP(g_trac_vddr,ERR_MRK " " + "Failed to deassert pca95x GPIO for Centaur HUID = 0x%08x " + "and pin %d.", + TARGETING::get_huid(centaur),gpioInfo.vddrPin); + break; + } + + TRACFCOMP(g_trac_vddr,INFO_MRK " " + "Disabled VDDR for Centaur HUID = 0x%08x (deasserted pca95x GPIO " + "pin %d).", + TARGETING::get_huid(centaur), + gpioInfo.vddrPin); + + } while(0); + + return l_err; +} + +// External interfaces + +errlHndl_t platform_enable_vspd() +{ + // GPIO pin not implemented on palmetto + // VSPD voltage hardwired. + return NULL; +} + +errlHndl_t platform_enable_vddr() +{ + return for_each_vddr_domain_with_functional_memory( + enableVddrViaGpioPinStrategy); +} + +errlHndl_t platform_disable_vddr() +{ + return for_each_vddr_domain_with_functional_memory( + disableVddrViaGpioPinStrategy); +} + +errlHndl_t platform_adjust_vddr_post_dram_init() +{ + // Not supported on palmetto + return NULL; +} + diff --git a/src/usr/isteps/istep13/platform_vddr.H b/src/usr/isteps/istep13/platform_vddr.H new file mode 100644 index 000000000..0ec49a869 --- /dev/null +++ b/src/usr/isteps/istep13/platform_vddr.H @@ -0,0 +1,56 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep13/platform_vddr.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +// platform specific VDDR support. + +#ifndef PLATFORM_VDDR_H__ +#define PLATFORM_VDDR_H__ + +#include <usr/errl/errlentry.H> + +/** + * @brief Enable vspd on DIMMS + * @return NULL | error handle on error + */ +errlHndl_t platform_enable_vspd(); + +/** + * @brief Enable vddr on DIMMS + * @return NULL | error handle on error + */ +errlHndl_t platform_enable_vddr(); + +/** + * @brief Adjust vddr on DIMMS with POST DRAM INITs + * @return NULL | error handle on error + */ +errlHndl_t platform_adjust_vddr_post_dram_init(); + +/** + * @brief Disable vddr on DIMMS + * @return NULL | error handle on error + */ +errlHndl_t platform_disable_vddr(); + +#endif // PLATFORM_VDDR_H__ diff --git a/src/usr/isteps/makefile b/src/usr/isteps/makefile index 8e0d560b9..c52bda4a0 100644 --- a/src/usr/isteps/makefile +++ b/src/usr/isteps/makefile @@ -32,6 +32,7 @@ SUBDIRS+=istep09.d SUBDIRS+=istep10.d SUBDIRS+=istep11.d SUBDIRS+=istep12.d +SUBDIRS+=istep13.d OBJS += hwpisteperror.o OBJS += hwpistepud.o |