From d83e0f05717dc06edc537dcab1deb1758ba7dcf5 Mon Sep 17 00:00:00 2001 From: Doug Gilbert Date: Wed, 19 Feb 2014 16:33:26 -0600 Subject: HB runtime OCC support for Sapphire Change-Id: Ie730f0676fa3e35b030d88da8ce666ee61c413a3 RTC: 76683 Backport: release-fips810 CMVC-Prereq: 922520 CQ: SW256269 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/9187 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell Reviewed-by: A. Patrick Williams III --- .../hwp/build_winkle_images/build_winkle_images.mk | 77 +++ src/usr/hwpf/hwp/build_winkle_images/makefile | 57 +-- .../hwpf/hwp/build_winkle_images/runtime/makefile | 36 ++ src/usr/hwpf/hwp/occ/makefile | 58 +-- src/usr/hwpf/hwp/occ/occ.C | 50 +- src/usr/hwpf/hwp/occ/occ.mk | 78 +++ src/usr/hwpf/hwp/occ/runtime/makefile | 37 ++ src/usr/hwpf/hwp/occ/runtime/rt_occ.C | 556 +++++++++++++++++++++ src/usr/hwpf/hwp/start_payload/start_payload.C | 4 +- 9 files changed, 810 insertions(+), 143 deletions(-) create mode 100644 src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.mk create mode 100644 src/usr/hwpf/hwp/build_winkle_images/runtime/makefile create mode 100644 src/usr/hwpf/hwp/occ/occ.mk create mode 100644 src/usr/hwpf/hwp/occ/runtime/makefile create mode 100644 src/usr/hwpf/hwp/occ/runtime/rt_occ.C (limited to 'src/usr/hwpf/hwp') diff --git a/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.mk b/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.mk new file mode 100644 index 000000000..8c82a329b --- /dev/null +++ b/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.mk @@ -0,0 +1,77 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.mk $ +# +# IBM CONFIDENTIAL +# +# COPYRIGHT International Business Machines Corp. 2014 +# +# p1 +# +# Object Code Only (OCO) source materials +# Licensed Internal Code Source Materials +# IBM HostBoot Licensed Internal Code +# +# The source code for this program is not published or otherwise +# divested of its trade secrets, irrespective of what has been +# deposited with the U.S. Copyright Office. +# +# Origin: 30 +# +# IBM_PROLOG_END_TAG +## support for Targeting and fapi +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp + +## pointer to common HWP files +EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/include + +## NOTE: add the base istep dir here. +EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images +EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/mvpd_accessors + +## Include sub dirs +## NOTE: add a new EXTRAINCDIR when you add a new HWP +## EXAMPLE: +## EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/ +EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build +EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_set_pore_bar +EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/occ/occ_procedures +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp/utility_procedures +EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_block_wakeup_intr +EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/proc_mailbox_utils + +CFLAGS += -D __FAPI + +## NOTE: add new object files when you add a new HWP +OBJS += \ + p8_image_help.o \ + p8_scan_compression.o \ + pore_inline_assembler.o \ + p8_pba_bar_config.o \ + sbe_xip_image.o \ + p8_pore_table_static_data.o \ + p8_pore_table_gen_api_fixed.o \ + p8_pmc_deconfig_setup.o \ + p8_poreslw_init.o \ + p8_set_pore_bar.o \ + p8_xip_customize.o \ + p8_ring_identification.o \ + p8_slw_build_fixed.o \ + p8_image_help_base.o \ + p8_pfet_init.o \ + p8_pfet_control.o \ + p8_block_wakeup_intr.o \ + p8_mailbox_utils.o + +## NOTE: add a new directory onto the vpaths when you add a new HWP +## EXAMPLE: +# VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/ +VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build +VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_set_pore_bar +VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_block_wakeup_intr +VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/proc_mailbox_utils + diff --git a/src/usr/hwpf/hwp/build_winkle_images/makefile b/src/usr/hwpf/hwp/build_winkle_images/makefile index 778151d15..4d3693c06 100644 --- a/src/usr/hwpf/hwp/build_winkle_images/makefile +++ b/src/usr/hwpf/hwp/build_winkle_images/makefile @@ -24,61 +24,14 @@ ROOTPATH = ../../../../.. MODULE = build_winkle_images -## support for Targeting and fapi -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp +SUBDIRS = runtime.d -## pointer to common HWP files -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/include +# objects unique to HB IPL +OBJS = build_winkle_images.o -## NOTE: add the base istep dir here. -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/mvpd_accessors +# include objs common to HBRT and HB IPL +include build_winkle_images.mk -## Include sub dirs -## NOTE: add a new EXTRAINCDIR when you add a new HWP -## EXAMPLE: -## EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/ -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_set_pore_bar -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/occ/occ_procedures -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp/utility_procedures -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_block_wakeup_intr -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/proc_mailbox_utils - -CFLAGS += -D __FAPI - - -## NOTE: add new object files when you add a new HWP -OBJS = build_winkle_images.o \ - p8_image_help.o \ - p8_scan_compression.o \ - pore_inline_assembler.o \ - p8_pba_bar_config.o \ - sbe_xip_image.o \ - p8_pore_table_static_data.o \ - p8_pore_table_gen_api_fixed.o \ - p8_pmc_deconfig_setup.o \ - p8_poreslw_init.o \ - p8_set_pore_bar.o \ - p8_xip_customize.o \ - p8_ring_identification.o \ - p8_slw_build_fixed.o \ - p8_image_help_base.o \ - p8_pfet_init.o \ - p8_pfet_control.o \ - p8_block_wakeup_intr.o \ - p8_mailbox_utils.o - -## NOTE: add a new directory onto the vpaths when you add a new HWP -## EXAMPLE: -# VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/ -VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build -VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_set_pore_bar -VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_block_wakeup_intr -VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/proc_mailbox_utils include ${ROOTPATH}/config.mk diff --git a/src/usr/hwpf/hwp/build_winkle_images/runtime/makefile b/src/usr/hwpf/hwp/build_winkle_images/runtime/makefile new file mode 100644 index 000000000..b52011db7 --- /dev/null +++ b/src/usr/hwpf/hwp/build_winkle_images/runtime/makefile @@ -0,0 +1,36 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/hwpf/hwp/build_winkle_images/runtime/makefile $ +# +# IBM CONFIDENTIAL +# +# COPYRIGHT International Business Machines Corp. 2012,2014 +# +# p1 +# +# Object Code Only (OCO) source materials +# Licensed Internal Code Source Materials +# IBM HostBoot Licensed Internal Code +# +# The source code for this program is not published or otherwise +# divested of its trade secrets, irrespective of what has been +# deposited with the U.S. Copyright Office. +# +# Origin: 30 +# +# IBM_PROLOG_END_TAG +ROOTPATH = ../../../../../.. + +HOSTBOOT_RUNTIME = 1 + +MODULE = build_winkle_images_rt + +# objects unique to HBRT - currently none +# OBJS = + +# include objs common to HBRT and HB IPL +include ../build_winkle_images.mk + +include ${ROOTPATH}/config.mk + diff --git a/src/usr/hwpf/hwp/occ/makefile b/src/usr/hwpf/hwp/occ/makefile index c8c9178ea..5b96dff7e 100644 --- a/src/usr/hwpf/hwp/occ/makefile +++ b/src/usr/hwpf/hwp/occ/makefile @@ -24,60 +24,14 @@ ROOTPATH = ../../../../.. MODULE = occ -## support for Targeting and fapi -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp +SUBDIRS = runtime.d -## pointer to common HWP files -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/include +include occ.mk -## pointer to already consumed procedures. -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_set_pore_bar -EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp/utility_procedures - -## NOTE: add the base istep dir here. -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/occ - -## Include sub dirs -## NOTE: add a new EXTRAINCDIR when you add a new HWP -## EXAMPLE: -## EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/occ/ -EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/occ/occ_procedures - - -## NOTE: add new object files when you add a new HWP -OBJS = occ.o \ - p8_pba_init.o \ - p8_pm_init.o \ - p8_pcbs_init.o \ - p8_pmc_init.o \ - p8_poregpe_init.o \ - p8_oha_init.o \ - p8_ocb_init.o \ - p8_pss_init.o \ - p8_occ_control.o \ - p8_occ_sram_init.o \ - p8_pm_firinit.o \ - p8_pm_oha_firinit.o \ - p8_pm_pcbs_firinit.o \ - p8_pm_occ_firinit.o \ - p8_pm_pba_firinit.o \ - p8_pm_pmc_firinit.o \ - p8_pm_utils.o - -#These procedures are included per Stradale's request so -#they can implement OCC Reset. -OBJS+= p8_pm_prep_for_reset.o \ - p8_pmc_force_vsafe.o \ - p8_ocb_indir_access.o \ - p8_ocb_indir_setup_linear.o - -## NOTE: add a new directory onto the vpaths when you add a new HWP -## EXAMPLE: -# VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/occ/ -VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/occ/occ_procedures +## Objects unique to HB IPL +OBJS = occ.o +## Objects common to HB IPL and HBRT +include occ.mk include ${ROOTPATH}/config.mk diff --git a/src/usr/hwpf/hwp/occ/occ.C b/src/usr/hwpf/hwp/occ/occ.C index e39d1e73f..19a33de88 100644 --- a/src/usr/hwpf/hwp/occ/occ.C +++ b/src/usr/hwpf/hwp/occ/occ.C @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2013 */ +/* COPYRIGHT International Business Machines Corp. 2013,2014 */ /* */ /* p1 */ /* */ @@ -23,6 +23,7 @@ #include +#include #include #include @@ -62,26 +63,6 @@ extern trace_desc_t* g_fapiTd; using namespace TARGETING; -const uint32_t g_OCCLIDID = 0x81e00430; -const uint64_t OCC_IBSCOM_RANGE_IN_MB = 0x100000; /*128*1024*8*/ - -/////////////////////////////////////////////////////////////////////////////// -// compareNodeId -/////////////////////////////////////////////////////////////////////////////// -bool compareNodeId( Target* t0, - Target* t1) -{ - uint8_t nodeId0 = t0->getAttr(); - uint8_t nodeId1 = t1->getAttr(); - - if (nodeId0 == nodeId1) - { - return t0 < t1; - } - return nodeId0 < nodeId1; -} - - namespace HBOCC { @@ -104,14 +85,14 @@ namespace HBOCC errlHndl_t l_errl = NULL; size_t lidSize = 0; do { - UtilLidMgr lidMgr(g_OCCLIDID); + UtilLidMgr lidMgr(OCC_LIDID); l_errl = lidMgr.getLidSize(lidSize); if(l_errl) { TRACFCOMP( g_fapiImpTd, ERR_MRK"loadOCCImageToHomer: Error getting lid size. lidId=0x%.8x", - g_OCCLIDID); + OCC_LIDID); break; } @@ -120,7 +101,7 @@ namespace HBOCC { TRACFCOMP( g_fapiImpTd, ERR_MRK"loadOCCImageToHomer: Error getting lid.. lidId=0x%.8x", - g_OCCLIDID); + OCC_LIDID); break; } @@ -149,18 +130,11 @@ namespace HBOCC errlHndl_t l_errl = NULL; - struct occHostConfigDataArea_t - { - uint32_t version; - uint32_t nestFrequency; - }; - - enum { OccHostDataVersion = 1 }; - //Treat virtual address as starting pointer //for config struct - occHostConfigDataArea_t * config_data = - reinterpret_cast(i_occHostDataVirtAddr); + HBOCC::occHostConfigDataArea_t * config_data = + reinterpret_cast + (i_occHostDataVirtAddr); // Get top level system target TARGETING::TargetService & tS = TARGETING::targetService(); @@ -170,7 +144,7 @@ namespace HBOCC uint32_t nestFreq = sysTarget->getAttr(); - config_data->version = OccHostDataVersion; + config_data->version = HBOCC::OccHostDataVersion; config_data->nestFrequency = nestFreq; TRACUCOMP( g_fapiTd, @@ -271,7 +245,7 @@ namespace HBOCC l_fapiTarg, 1, //i_index centaur_addr, //i_pba_bar_addr - OCC_IBSCOM_RANGE_IN_MB, //i_pba_bar_size + (uint64_t)OCC_IBSCOM_RANGE_IN_MB, //i_pba_bar_size PBA_CMD_SCOPE_NODAL ); //i_pba_cmd_scope if ( l_errl != NULL ) @@ -602,7 +576,9 @@ namespace HBOCC TRACUCOMP( g_fapiTd, INFO_MRK"loadnStartAllOccs: Following DCM Path"); - std::sort(procChips.begin(), procChips.end(), compareNodeId); + std::sort(procChips.begin(), + procChips.end(), + orderByNodeAndPosition); TRACUCOMP( g_fapiTd, INFO_MRK"loadnStartAllOccs: procChips list sorted"); diff --git a/src/usr/hwpf/hwp/occ/occ.mk b/src/usr/hwpf/hwp/occ/occ.mk new file mode 100644 index 000000000..79e93a4d7 --- /dev/null +++ b/src/usr/hwpf/hwp/occ/occ.mk @@ -0,0 +1,78 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/hwpf/hwp/occ/occ.mk $ +# +# IBM CONFIDENTIAL +# +# COPYRIGHT International Business Machines Corp. 2014 +# +# p1 +# +# Object Code Only (OCO) source materials +# Licensed Internal Code Source Materials +# IBM HostBoot Licensed Internal Code +# +# The source code for this program is not published or otherwise +# divested of its trade secrets, irrespective of what has been +# deposited with the U.S. Copyright Office. +# +# Origin: 30 +# +# IBM_PROLOG_END_TAG +## support for Targeting and fapi +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp + +## pointer to common HWP files +EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/include + +## pointer to already consumed procedures. +EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_set_pore_bar + +## NOTE: add the base istep dir here. +EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/occ + +## Include sub dirs +## NOTE: add a new EXTRAINCDIR when you add a new HWP +## EXAMPLE: +## EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/occ/ +EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/occ/occ_procedures +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp/utility_procedures + +## NOTE: add new object files when you add a new HWP +OBJS += \ + p8_pba_init.o \ + p8_pm_init.o \ + p8_pcbs_init.o \ + p8_pmc_init.o \ + p8_poregpe_init.o \ + p8_oha_init.o \ + p8_ocb_init.o \ + p8_pss_init.o \ + p8_occ_control.o \ + p8_occ_sram_init.o \ + p8_pm_firinit.o \ + p8_pm_oha_firinit.o \ + p8_pm_pcbs_firinit.o \ + p8_pm_occ_firinit.o \ + p8_pm_pba_firinit.o \ + p8_pm_pmc_firinit.o \ + p8_pm_utils.o + + +#These procedures are included per Stradale's request so +#they can implement OCC Reset. +OBJS+= p8_pm_prep_for_reset.o \ + p8_pmc_force_vsafe.o \ + p8_ocb_indir_access.o \ + p8_ocb_indir_setup_linear.o + +## NOTE: add a new directory onto the vpaths when you add a new HWP +## EXAMPLE: +# VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/occ/ +VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/occ/occ_procedures + + diff --git a/src/usr/hwpf/hwp/occ/runtime/makefile b/src/usr/hwpf/hwp/occ/runtime/makefile new file mode 100644 index 000000000..1d1e7ce06 --- /dev/null +++ b/src/usr/hwpf/hwp/occ/runtime/makefile @@ -0,0 +1,37 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/hwpf/hwp/occ/runtime/makefile $ +# +# IBM CONFIDENTIAL +# +# COPYRIGHT International Business Machines Corp. 2014 +# +# p1 +# +# Object Code Only (OCO) source materials +# Licensed Internal Code Source Materials +# IBM HostBoot Licensed Internal Code +# +# The source code for this program is not published or otherwise +# divested of its trade secrets, irrespective of what has been +# deposited with the U.S. Copyright Office. +# +# Origin: 30 +# +# IBM_PROLOG_END_TAG + +HOSTBOOT_RUNTIME = 1 + +ROOTPATH = ../../../../../.. +VPATH += ../ + +MODULE = occ_rt + +## Objects unique to HBRT +OBJS = rt_occ.o + +## Objects common to HBRT and HB IPL +include ../occ.mk + +include ${ROOTPATH}/config.mk diff --git a/src/usr/hwpf/hwp/occ/runtime/rt_occ.C b/src/usr/hwpf/hwp/occ/runtime/rt_occ.C new file mode 100644 index 000000000..98faec0a2 --- /dev/null +++ b/src/usr/hwpf/hwp/occ/runtime/rt_occ.C @@ -0,0 +1,556 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/occ/runteim/rt_occ.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// targeting support +#include +#include +#include +#include +#include + +#include + +// fapi support +#include +#include +#include +#include + +// Procedures +#include +#include +#include +#include + +using namespace TARGETING; +// Trace + +extern trace_desc_t* g_fapiTd; // defined in rt_fapiPlatUtil.C + +// @TODO RTC 98547 +// There is potential to share more code with src/hwpf/hwp/occ/occ.C, +// but would require refactoring the HB occ code and modifying the order and +// sequence of some events. + +namespace RT_OCC +{ + typedef std::vector target_list_t; + + //------------------------------------------------------------------------ + + errlHndl_t addHostData(uint64_t i_hostdata_addr) + { + errlHndl_t err = NULL; + //Treat virtual address as starting pointer + //for config struct + HBOCC::occHostConfigDataArea_t * config_data = + reinterpret_cast + (i_hostdata_addr); + + // Get top level system target + TARGETING::TargetService & tS = TARGETING::targetService(); + TARGETING::Target * sysTarget = NULL; + tS.getTopLevelTarget( sysTarget ); + assert( sysTarget != NULL ); + + uint32_t nestFreq = sysTarget->getAttr(); + + config_data->version = HBOCC::OccHostDataVersion; + config_data->nestFrequency = nestFreq; + + return err; + } + + //------------------------------------------------------------------------ + + int executeLoadOCC(uint64_t i_homer_addr_phys, + uint64_t i_homer_addr_va, + uint64_t i_common_addr_phys, + uint64_t i_common_addr_va, + uint64_t i_proc_chip) + { + errlHndl_t err = NULL; + int rc = 0; + + TRACFCOMP( g_fapiTd, + "LoadOCC: homer paddr=%016llx vaddr=%016llx. " + " common paddr=%016lx vaddr=%016llx. RtProcChip=%llx", + i_homer_addr_phys, + i_homer_addr_va, + i_common_addr_phys, + i_common_addr_va, + i_proc_chip); + + do + { + // Utility to convert i_proc_chip to Target + TARGETING::Target* proc_target = NULL; + err = RT_TARG::getHbTarget(i_proc_chip, proc_target); + if(err) + { + rc = EINVAL; + break; + } + + // Convert to fapi Target + fapi::Target fapiTarg( fapi::TARGET_TYPE_PROC_CHIP, + (const_cast(proc_target) + )); + + TRACFCOMP( g_fapiTd, "FapiTarget: %s",fapiTarg.toEcmdString()); + + // BAR0 is the Entire HOMER, Bar size is in MB + FAPI_INVOKE_HWP( err, + p8_pba_bar_config, + fapiTarg, + 0, //BAR0 + i_homer_addr_phys, + VMM_HOMER_INSTANCE_SIZE_IN_MB, + PBA_CMD_SCOPE_NODAL ); + + if ( err ) + { + TRACFCOMP( g_fapiTd, + ERR_MRK"Bar0 config failed!" ); + err->collectTrace(FAPI_TRACE_NAME,256); + err->collectTrace(FAPI_IMP_TRACE_NAME,256); + + break; + } + + // BAR1 is what OCC uses to talk to the Centaur. Bar size is in MB + uint64_t centaur_addr = + proc_target->getAttr(); + + FAPI_INVOKE_HWP( err, + p8_pba_bar_config, + fapiTarg, + 1, //BAR1 + centaur_addr, //i_pba_bar_addr + //i_pba_bar_size + (uint64_t)HBOCC::OCC_IBSCOM_RANGE_IN_MB, + PBA_CMD_SCOPE_NODAL ); //i_pba_cmd_scope + + if ( err != NULL ) + { + TRACFCOMP( g_fapiTd, + ERR_MRK"Bar1 config failed!" ); + err->collectTrace(FAPI_TRACE_NAME,256); + err->collectTrace(FAPI_IMP_TRACE_NAME,256); + + break; + } + + // BAR3 is the OCC Common Area + // Bar size is in MB, obtained value of 8MB from Tim Hallett + FAPI_INVOKE_HWP( err, + p8_pba_bar_config, + fapiTarg, + 3, //BAR3 + i_common_addr_phys, + VMM_OCC_COMMON_SIZE_IN_MB, + PBA_CMD_SCOPE_NODAL ); + + if ( err ) + { + TRACFCOMP( g_fapiTd, + ERR_MRK"Bar3 config failed!" ); + err->collectTrace(FAPI_TRACE_NAME,256); + err->collectTrace(FAPI_IMP_TRACE_NAME,256); + + break; + } + + // Load HOMER image + UtilLidMgr lidmgr(HBOCC::OCC_LIDID); + + size_t lidSize = 0; + err = lidmgr.getLidSize(lidSize); + if( err ) + { + break; + } + + err = lidmgr.getLid(reinterpret_cast(i_homer_addr_va), + lidSize); + if( err ) + { + break; + } + + TRACFCOMP( g_fapiTd, + "OCC lid loaded. ID:%x size:%d", + HBOCC::OCC_LIDID, + lidSize); + + // Setup Host Data area of HOMER + err = addHostData(i_homer_addr_va+HOMER_OFFSET_TO_OCC_HOST_DATA); + if( err ) + { + break; + } + + } while(0); + + if ( err ) + { + errlCommit( err, HWPF_COMP_ID ); + if(rc == 0) + { + rc = -1; + } + } + return rc; + } + + //------------------------------------------------------------------------ + + errlHndl_t start_occ(TARGETING::Target * i_target0, + TARGETING::Target * i_target1) + { + errlHndl_t err = NULL; + do + { + const fapi::Target + l_fapiTarg0(fapi::TARGET_TYPE_PROC_CHIP, + (const_cast(i_target0))); + + fapi::Target l_fapiTarg1; + if(i_target1) + { + l_fapiTarg1.setType(fapi::TARGET_TYPE_PROC_CHIP); + l_fapiTarg1.set(const_cast(i_target1)); + + } + else + { + l_fapiTarg1.setType(fapi::TARGET_TYPE_NONE); + } + + FAPI_INVOKE_HWP( err, + p8_pm_init, + l_fapiTarg0, + l_fapiTarg1, + PM_CONFIG ); + + if ( err != NULL ) + { + TRACFCOMP( g_fapiTd, + ERR_MRK"p8_pm_init, config failed!" ); + err->collectTrace(FAPI_TRACE_NAME,256); + err->collectTrace(FAPI_IMP_TRACE_NAME,256); + + break; + } + + // Init path + // p8_pm_init.C enum: PM_INIT + FAPI_INVOKE_HWP( err, + p8_pm_init, + l_fapiTarg0, + l_fapiTarg1, + PM_INIT ); + + if ( err != NULL ) + { + TRACFCOMP( g_fapiTd, + ERR_MRK"p8_pm_init, init failed!" ); + err->collectTrace(FAPI_TRACE_NAME,256); + err->collectTrace(FAPI_IMP_TRACE_NAME,256); + + break; + } + TRACFCOMP( g_fapiTd, + INFO_MRK"OCC Finished: p8_pm_init.C enum: PM_INIT" ); + + + //============================== + //Start the OCC on primary chip of DCM + //============================== + FAPI_INVOKE_HWP( err, + p8_occ_control, + l_fapiTarg0, + PPC405_RESET_OFF, + PPC405_BOOT_MEM ); + + if ( err != NULL ) + { + TRACFCOMP( g_fapiTd, + ERR_MRK"occ_control failed!" ); + err->collectTrace(FAPI_TRACE_NAME,256); + err->collectTrace(FAPI_IMP_TRACE_NAME,256); + + break; + } + + //============================== + // Start the OCC on slave chip of DCM + //============================== + if ( l_fapiTarg1.getType() != fapi::TARGET_TYPE_NONE ) + { + FAPI_INVOKE_HWP( err, + p8_occ_control, + l_fapiTarg1, + PPC405_RESET_OFF, + PPC405_BOOT_MEM ); + + if ( err != NULL ) + { + TRACFCOMP( g_fapiTd, + ERR_MRK"occ_control failed!" ); + err->collectTrace(FAPI_TRACE_NAME,256); + err->collectTrace(FAPI_IMP_TRACE_NAME,256); + + break; + } + } + } while(0); + + return err; + } + + //------------------------------------------------------------------------ + + errlHndl_t stop_occ(TARGETING::Target * i_target0, + TARGETING::Target * i_target1) + { + errlHndl_t err = NULL; + do + { + const fapi::Target + l_fapiTarg0(fapi::TARGET_TYPE_PROC_CHIP, + (const_cast(i_target0))); + + fapi::Target l_fapiTarg1; + if(i_target1) + { + l_fapiTarg1.setType(fapi::TARGET_TYPE_PROC_CHIP); + l_fapiTarg1.set(const_cast(i_target1)); + + } + else + { + l_fapiTarg1.setType(fapi::TARGET_TYPE_NONE); + } + + FAPI_INVOKE_HWP( err, + p8_pm_prep_for_reset, + l_fapiTarg0, + l_fapiTarg1, + PM_RESET ); + + if ( err != NULL ) + { + TRACFCOMP( g_fapiTd, + ERR_MRK"p8_pm_prep_for_reset failed!" ); + err->collectTrace(FAPI_TRACE_NAME,256); + err->collectTrace(FAPI_IMP_TRACE_NAME,256); + + break; + } + + } while(0); + + return err; + } + + //------------------------------------------------------------------------ + + int executeOnDcms(HBOCC::occAction_t i_action, + uint64_t * i_proc_chip, + size_t i_num_chips) + { + errlHndl_t err = NULL; + int rc = 0; + + TRACFCOMP( g_fapiTd, + "Action=%d, number of procs = %d ", + i_action, + i_num_chips); + + for(size_t i = 0; i < i_num_chips; ++i) + { + TRACFCOMP( g_fapiTd, "\tRtProcChip %llx", i_proc_chip[i]); + } + + do + { + if(i_num_chips < 1 || i_proc_chip == NULL) + { + rc = EINVAL; + break; + } + + // Convert chipIds to HB targets + target_list_t targets; + targets.reserve(i_num_chips); + + for(size_t i = 0; i < i_num_chips; ++i) + { + TARGETING::Target* proc_target = NULL; + err = RT_TARG::getHbTarget(i_proc_chip[i], proc_target); + if( err ) + { + rc = EINVAL; + break; + } + targets.push_back(proc_target); + } + if (err) + { + break; + } + + // If there are no DCMs INSTALLED the do on each proc + target_list_t::iterator itarg = targets.begin(); + if (0 == (*itarg)->getAttr()) + { + for(itarg = targets.begin(); + itarg != targets.end(); + ++itarg) + { + if(i_action == HBOCC::OCC_START) + { + err = start_occ(*itarg, NULL); + } + else if(i_action == HBOCC::OCC_STOP) + { + err = stop_occ(*itarg, NULL); + } + + // TODO RTC 101156 + // error handling still being designed + // Need new interface from Sapphire? + if( err ) + { + errlCommit( err, HWPF_COMP_ID ); + err = NULL; + rc = -1; + // keep going + } + } + break; // done + } + + // continue here only if have DCMs + // Sort the target list by node then pos + std::sort(targets.begin(), + targets.end(), + orderByNodeAndPosition); + + for(itarg = targets.begin(); + itarg != targets.end(); + ++itarg) + { + TARGETING::Target* t0 = *itarg; + TARGETING::Target* t1 = NULL; + if((itarg+1) != targets.end()) + { + if((t0->getAttr()) == + ((*(itarg+1))->getAttr())) + { + ++itarg; + t1 = *itarg; + } + } + if(i_action == HBOCC::OCC_START) + { + err = start_occ(t0,t1); + } + else if(i_action == HBOCC::OCC_STOP) + { + err = stop_occ(t0,t1); + } + + // TODO RTC 101156 Error handling still being designed + // Need new interface from Sapphire? + if( err ) + { + errlCommit( err, HWPF_COMP_ID ); + err = NULL; + rc = -1; + // keep going + } + } + if( err ) + { + break; + } + + } while(0); + + + if( err ) + { + errlCommit( err, HWPF_COMP_ID ); + if(rc == 0) + { + rc = -1; + } + } + + return rc; + } + + int executeStartOCCs(uint64_t* i_proc_chip, + size_t i_num_chips) + { + return executeOnDcms(HBOCC::OCC_START, + i_proc_chip, + i_num_chips); + } + + int executeStopOCCs(uint64_t* i_proc_chip, + size_t i_num_chips) + { + return executeOnDcms(HBOCC::OCC_STOP, + i_proc_chip, + i_num_chips); + } + + //------------------------------------------------------------------------ + + struct registerOcc + { + registerOcc() + { + runtimeInterfaces_t * rt_intf = getRuntimeInterfaces(); + rt_intf->get_lid_list = &UtilLidMgr::getLidList; + rt_intf->loadOCC = &executeLoadOCC; + rt_intf->startOCCs = &executeStartOCCs; + rt_intf->stopOCCs = &executeStopOCCs; + } + }; + + registerOcc g_registerOcc; +} + diff --git a/src/usr/hwpf/hwp/start_payload/start_payload.C b/src/usr/hwpf/hwp/start_payload/start_payload.C index 182bfd6d5..5bf0943a7 100644 --- a/src/usr/hwpf/hwp/start_payload/start_payload.C +++ b/src/usr/hwpf/hwp/start_payload/start_payload.C @@ -241,8 +241,8 @@ void* call_host_runtime_setup( void *io_pArgs ) break; } - //Start OCC in AVP (or Sapphire mode for now) - if( is_avp_load() || is_sapphire_load() ) + //Start OCC in AVP + if( is_avp_load() ) { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "Starting OCC" ); -- cgit v1.2.1