From b2e82859d8551ef4ee4c6e270794b2fd2d5ad3a4 Mon Sep 17 00:00:00 2001 From: Corey Swenson Date: Tue, 22 Nov 2016 09:59:07 -0600 Subject: Start PM Complex during IPL for OPAL - load/start PM complex in istep21 - make some rt_pm functions common - load/start PM by default in HB standalone - load OCC image into PNOR - fix bug in UtilLidMgr - add patch for p9n.act bug Change-Id: I6c41934cf1614018da7dcad67573c3edc2d081b6 RTC:159931 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/32918 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Reviewed-by: Martin Gloff Tested-by: FSP CI Jenkins Reviewed-by: Christian R. Geddes Reviewed-by: Daniel M. Crowell --- src/build/buildpnor/defaultPnorLayout.xml | 8 + src/build/citest/etc/patches/p9n.patch | 23 ++ src/build/citest/etc/patches/patchlist.txt | 7 +- src/build/citest/etc/workarounds.postsimsetup | 4 + src/build/configs/fsprelease.config | 4 + src/build/mkrules/hbfw/img/makefile | 6 +- src/include/usr/isteps/istep21list.H | 1 + src/include/usr/isteps/pm/pm_common_ext.H | 40 +++ src/include/usr/runtime/runtime_reasoncodes.H | 3 + src/usr/isteps/HBconfig | 2 +- src/usr/isteps/istep21/call_host_runtime_setup.C | 30 +- src/usr/isteps/pm/pm_common.C | 379 +++++++++++++++++++---- src/usr/isteps/pm/pm_common.H | 37 ++- src/usr/isteps/pm/runtime/rt_pm.C | 177 +++++------ src/usr/util/test/testlidmgr.H | 2 +- src/usr/util/utillidmgr.C | 64 ++-- src/usr/util/utillidpnor.H | 8 +- 17 files changed, 570 insertions(+), 225 deletions(-) create mode 100644 src/build/citest/etc/patches/p9n.patch diff --git a/src/build/buildpnor/defaultPnorLayout.xml b/src/build/buildpnor/defaultPnorLayout.xml index 587fc85a2..4b4f994dc 100644 --- a/src/build/buildpnor/defaultPnorLayout.xml +++ b/src/build/buildpnor/defaultPnorLayout.xml @@ -246,4 +246,12 @@ Layout Description sideless +
+ OCC Lid (1.125M) + OCC + 0x2AD3000 + 0x120000 + sideless + +
diff --git a/src/build/citest/etc/patches/p9n.patch b/src/build/citest/etc/patches/p9n.patch new file mode 100644 index 000000000..4599d9c33 --- /dev/null +++ b/src/build/citest/etc/patches/p9n.patch @@ -0,0 +1,23 @@ +--- p9n.act 2016-12-06 12:33:46.152910353 -0600 ++++ p9n.act.whole.patch 2016-12-06 12:44:56.720440479 -0600 +@@ -231,13 +231,13 @@ + } + + # Indicate purge complete whenever a purge operation is requested +-CAUSE_EFFECT CHIPLETS cache{ +- LABEL=[L3_0 PURGE REGISTER] +- WATCH=[REG(MYCHIPLET,0x0012413)] +- +- CAUSE: TARGET=[REG(MYCHIPLET,0x0012413)] OP=[BIT,ON] BIT=[0] +- EFFECT: TARGET=[REG(MYCHIPLET,0x0012413] OP=[BIT,OFF] BIT=[0] +-} ++#CAUSE_EFFECT CHIPLETS cache{ ++# LABEL=[L3_0 PURGE REGISTER] ++# WATCH=[REG(MYCHIPLET,0x0012413)] ++# ++# CAUSE: TARGET=[REG(MYCHIPLET,0x0012413)] OP=[BIT,ON] BIT=[0] ++# EFFECT: TARGET=[REG(MYCHIPLET,0x0012413] OP=[BIT,OFF] BIT=[0] ++#} + + # Don't let the chipid get overwritten + CAUSE_EFFECT { diff --git a/src/build/citest/etc/patches/patchlist.txt b/src/build/citest/etc/patches/patchlist.txt index 439f88f9f..936a3d741 100644 --- a/src/build/citest/etc/patches/patchlist.txt +++ b/src/build/citest/etc/patches/patchlist.txt @@ -3,4 +3,9 @@ Brief description of the problem or reason for patch -RTC: Task/Story used to remove this patch -CMVC: Defect/Req for checking the changes into fips810 -Files: list of files --Coreq: list of associated changes, e.g. workarounds.presimsetup \ No newline at end of file +-Coreq: list of associated changes, e.g. workarounds.presimsetup + +L3_0 PURGE REGISTER action in p9n.act uses the wrong register number +-RTC: 165868 +-Files: p9n.act +-Coreq: workarounds.postsimsetup \ No newline at end of file diff --git a/src/build/citest/etc/workarounds.postsimsetup b/src/build/citest/etc/workarounds.postsimsetup index 96c59db69..55439ad32 100755 --- a/src/build/citest/etc/workarounds.postsimsetup +++ b/src/build/citest/etc/workarounds.postsimsetup @@ -37,3 +37,7 @@ ## Need SIMIC action file changes for Ia5b6fb14cdfcb8a04f49846d346ced8e2ba4719e echo "Applying additional action file changes" sbex -r fips910 -t 1012603 +echo "+++ Removing L3_0 PURGE REGISTER from p9n.act" +mkdir -p $sb/simu/data/cec-chip/ +cp $BACKING_BUILD/src/simu/data/cec-chip/p9n.act $sb/simu/data/cec-chip +patch -p0 $sb/simu/data/cec-chip/p9n.act $PROJECT_ROOT/src/build/citest/etc/patches/p9n.patch diff --git a/src/build/configs/fsprelease.config b/src/build/configs/fsprelease.config index 899d5f719..5ac8099c4 100644 --- a/src/build/configs/fsprelease.config +++ b/src/build/configs/fsprelease.config @@ -25,5 +25,9 @@ config ENABLE_HDAT_IN_HOSTBOOT help Enable Initialization of Hypervisor Memory Space +config START_OCC_DURING_BOOT + default n + help + Activates all the OCCs during IPL set NO_SBE_UPDATES diff --git a/src/build/mkrules/hbfw/img/makefile b/src/build/mkrules/hbfw/img/makefile index 3d2c1baae..553b76f2f 100755 --- a/src/build/mkrules/hbfw/img/makefile +++ b/src/build/mkrules/hbfw/img/makefile @@ -209,6 +209,7 @@ NIMBUS = NIMBUS NIMBUS_HBD_IMG = simics_${NIMBUS}_targeting.bin NIMBUS_HCODE_IMG = ${ENGD_SRCPATH:Fp9n.hw_ref_image.bin} NIMBUS_SBE_IMG = p9nSbePartition.bin +NIMBUS_OCC_IMG = ${bb}/images/ppc/lab/fs/p9le/rootfs/opt/extucode/81e00430.lid SBEC_IMG = centSbePartition.bin # Input fake images @@ -218,6 +219,7 @@ NIMBUS_VPO_HBD_IMG = vbu_${NIMBUS}_targeting.bin NIMBUS_HBD_FINAL_IMG = ${NIMBUS}.HBD.bin NIMBUS_HCODE_FINAL_IMG = ${NIMBUS}.HCODE.bin NIMBUS_SBE_FINAL_IMG = ${NIMBUS}.SBE.bin +NIMBUS_OCC_FINAL_IMG = ${NIMBUS}.OCC.bin SBEC_FINAL_IMG = SBEC.bin TEMP_IMG = temp.bin @@ -225,7 +227,7 @@ TEMP_IMG = temp.bin .if(${FAKEPNOR} == "") # Paramemters passed into GEN_PNOR_IMAGE_SCRIPT. #@TODO securebootp9 - Put `HBD=${${NIMBUS_HBD_IMG}:P},` back into genPnorImage parameters - GEN_NIMBUS_BIN_FILES = ${NIMBUS}:SBE=${${NIMBUS_SBE_IMG}:P},HCODE=${${NIMBUS_HCODE_IMG}:P} + GEN_NIMBUS_BIN_FILES = ${NIMBUS}:SBE=${${NIMBUS_SBE_IMG}:P},HCODE=${${NIMBUS_HCODE_IMG}:P},OCC=${${NIMBUS_OCC_IMG}:P} #@TODO RTC:163810 - Put SBEC back "--systemBinFile SBEC=${${SBEC_IMG}:P}" SYSTEM_SPECIFIC_PARAMS = ${TARGET_TEST:b--test} ${CONFIG_SECUREBOOT:b--secureboot} \ --pnorLayout ${DEFAULT_PNOR_LAYOUT} ${CORRUPT_PARAMS} \ @@ -254,7 +256,7 @@ gen_system_specific_images: build_sbe_partitions HOSTBOOT_DEFAULT_SECTIONS = HBBL=${HBBL_FINAL_IMG},HBB=${HBB_FINAL_IMG},HBI=${HBI_FINAL_IMG},HBRT=${HBRT_FINAL_IMG},TEST=${TEST_FINAL_IMG},TESTRO=${TESTRO_FINAL_IMG},HBEL=${HBEL_FINAL_IMG},GUARD=${GUARD_FINAL_IMG},GLOBAL=${GLOBAL_FINAL_IMG},PAYLOAD=${PAYLOAD_FINAL_IMG},CVPD=${CVPD_FINAL_IMG},MVPD=${MVPD_FINAL_IMG},DJVPD=${DJVPD_FINAL_IMG},RINGOVD=${RINGOVD_FINAL_IMG},SBKT=${SBKT_FINAL_IMG} #@TODO RTC:163810 - Put SBEC back "SBEC=${SBEC_FINAL_IMG}," -NIMBUS_SECT = HBD=${NIMBUS_HBD_FINAL_IMG},SBE=${NIMBUS_SBE_FINAL_IMG},HCODE=${NIMBUS_HCODE_FINAL_IMG} +NIMBUS_SECT = HBD=${NIMBUS_HBD_FINAL_IMG},SBE=${NIMBUS_SBE_FINAL_IMG},HCODE=${NIMBUS_HCODE_FINAL_IMG},OCC=${NIMBUS_OCC_FINAL_IMG} PNOR_IMG_INFO = \ nimbus.pnor:${DEFAULT_PNOR_LAYOUT}:${NIMBUS_SECT},${HOSTBOOT_DEFAULT_SECTIONS} \ ${FIPS_PNOR_INFO} diff --git a/src/include/usr/isteps/istep21list.H b/src/include/usr/isteps/istep21list.H index de8dfd99d..0132fc358 100644 --- a/src/include/usr/isteps/istep21list.H +++ b/src/include/usr/isteps/istep21list.H @@ -123,6 +123,7 @@ const DepModInfo g_istep21Dependancies = { DEP_LIB(libdevtree.so), DEP_LIB(libruntime.so), DEP_LIB(libp9_cpuWkup.so), + DEP_LIB(libpm.so), NULL } }; diff --git a/src/include/usr/isteps/pm/pm_common_ext.H b/src/include/usr/isteps/pm/pm_common_ext.H index bd8e87633..be7e9e9b0 100644 --- a/src/include/usr/isteps/pm/pm_common_ext.H +++ b/src/include/usr/isteps/pm/pm_common_ext.H @@ -29,6 +29,23 @@ namespace HBPM { + /** + * @brief Enumeration of the load PM complex mode + * LOAD == i_mode + * - Call pm_reset first + * - Load OCC lid, write OCC config data, build Pstate + * Parameter Blocks, and load Hcode reference image lid + * RELOAD == i_mode + * - Reload OCC lid, rewrite OCC config data, build Pstate + * Parameter Blocks, and rebuild Hcode + */ + enum loadPmMode + { + PM_LOAD = 0x0, + PM_RELOAD = 0x1, + PM_UNKNOWN = 0xFF, + }; + /** * @brief Convert HOMER physical address space to a vitual address * @param[in] i_proc_target Processsor target @@ -38,6 +55,29 @@ namespace HBPM void *convertHomerPhysToVirt( TARGETING::Target* i_proc_target, uint64_t i_phys_addr); + /** + * @brief Load PM Complex for all proc targets. + * + * @param[in] i_mode Load / Reload + * + * @return errlHndl_t Error log of loadPMAll failed + */ + errlHndl_t loadPMAll(loadPmMode i_mode); + + /** + * @brief Start PM Complex for all proc targets. + * + * @return errlHndl_t Error log if startPMAll failed + */ + errlHndl_t startPMAll(); + + /** + * @brief Reset PM Complex for all proc targets. + * + * @return errlHndl_t Error log if resetPMAll failed + */ + errlHndl_t resetPMAll(); + } //namespace HBPM ends #endif diff --git a/src/include/usr/runtime/runtime_reasoncodes.H b/src/include/usr/runtime/runtime_reasoncodes.H index ab75d4bfd..afff1c07b 100644 --- a/src/include/usr/runtime/runtime_reasoncodes.H +++ b/src/include/usr/runtime/runtime_reasoncodes.H @@ -54,6 +54,8 @@ namespace RUNTIME MOD_CUST_COMP_NON_PHYP_RT_TARGET = 0x12, MOD_CUST_CONF_HBRT_HYP_IDS = 0x13, MOD_POPULATE_RTDATABYNODE = 0x14, /**< populate_hbruntime.C */ + + MOD_PM_RT_LOAD_PM_COMPLEX = 0x15, /**< rt_pm.C */ }; enum RuntimeReasonCode @@ -87,6 +89,7 @@ namespace RUNTIME RT_TARGET_TYPE_NOT_SUPPORTED = RUNTIME_COMP_ID | 0x1A, RT_NO_PROC_TARGET = RUNTIME_COMP_ID | 0x1B, RC_UNMAP_FAIL = RUNTIME_COMP_ID | 0x1C, + RC_PM_RT_UNKNOWN_MODE = RUNTIME_COMP_ID | 0x1D, }; enum UserDetailsTypes diff --git a/src/usr/isteps/HBconfig b/src/usr/isteps/HBconfig index 7f6468287..ce6573a2e 100644 --- a/src/usr/isteps/HBconfig +++ b/src/usr/isteps/HBconfig @@ -10,7 +10,7 @@ config SET_NOMINAL_PSTATE Set the PState to Nominal just before starting the payload. config START_OCC_DURING_BOOT - default n + default y help Activates all the OCCs during IPL diff --git a/src/usr/isteps/istep21/call_host_runtime_setup.C b/src/usr/isteps/istep21/call_host_runtime_setup.C index d2ab535d4..46fcd78e0 100644 --- a/src/usr/isteps/istep21/call_host_runtime_setup.C +++ b/src/usr/isteps/istep21/call_host_runtime_setup.C @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -144,23 +145,32 @@ void* call_host_runtime_setup (void *io_pArgs) } // end if phyp load - - bool l_activateOCC = TARGETING::is_avp_load(); - #ifdef CONFIG_START_OCC_DURING_BOOT - l_activateOCC = true; + bool l_activatePM = true; +#else + bool l_activatePM = !(TARGETING::is_phyp_load()); #endif - if(l_activateOCC) + + if(l_activatePM) { -#if 0 //@TODO-RTC:159931-Start OCC during boot - l_err = HBOCC::activateOCCs(); + l_err = HBPM::loadPMAll(HBPM::PM_LOAD); if (l_err) { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - "activateOCCs failed"); - break; + "loadPMAll failed"); + + // Commit the error and continue with the istep + errlCommit(l_err, ISTEP_COMP_ID); + } + l_err = HBPM::startPMAll(); + if (l_err) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "startPMAll failed"); + + // Commit the error and continue with the istep + errlCommit(l_err, ISTEP_COMP_ID); } -#endif } #if 0 //@TODO-RTC:164022-Support max pstate without OCC diff --git a/src/usr/isteps/pm/pm_common.C b/src/usr/isteps/pm/pm_common.C index afeaddfbc..bf1320914 100644 --- a/src/usr/isteps/pm/pm_common.C +++ b/src/usr/isteps/pm/pm_common.C @@ -26,7 +26,6 @@ #include #include -#include #include #include @@ -110,9 +109,9 @@ namespace HBPM (i_proc_target->getAttr()); if((i_proc_target->getAttr() != i_phys_addr) || - (NULL == l_virt_addr)) + (nullptr == l_virt_addr)) { - if(NULL != l_virt_addr) + if(nullptr != l_virt_addr) { rc = HBPM_UNMAP(l_virt_addr); @@ -123,7 +122,7 @@ namespace HBPM "unmap_phys_mem failed, rc=0x%0X", rc); - l_virt_addr = NULL; + l_virt_addr = nullptr; } } @@ -152,10 +151,10 @@ namespace HBPM void* i_homer) { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - ENTER_MRK"pstateParameterBuild(%p)", + ENTER_MRK"pstateParameterBuild(HOMER:%p)", i_homer); - errlHndl_t l_errl = NULL; + errlHndl_t l_errl = nullptr; // cast OUR type of target to a FAPI type of target. // figure out homer offsets @@ -195,61 +194,59 @@ namespace HBPM void* i_occHostDataVirtAddr) { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - ENTER_MRK"loadHostDataToHomer(%p)", - i_occHostDataVirtAddr); + ENTER_MRK"loadHostDataToHomer(OccHostDataV:%p)", + i_occHostDataVirtAddr ); - errlHndl_t l_errl = NULL; + errlHndl_t l_errl = nullptr; //Treat virtual address as starting pointer //for config struct - HBPM::occHostConfigDataArea_t * config_data = - reinterpret_cast + occHostConfigDataArea_t * l_config_data = + reinterpret_cast (i_occHostDataVirtAddr); // Get top level system target TARGETING::TargetService & tS = TARGETING::targetService(); - TARGETING::Target * sysTarget = NULL; + TARGETING::Target * sysTarget = nullptr; tS.getTopLevelTarget( sysTarget ); - assert( sysTarget != NULL ); + assert( sysTarget != nullptr ); - uint32_t nestFreq = sysTarget->getAttr(); - - config_data->version = HBPM::OccHostDataVersion; - config_data->nestFrequency = nestFreq; + l_config_data->version = OccHostDataVersion; + l_config_data->nestFrequency = sysTarget->getAttr(); // Figure out the interrupt type if( INITSERVICE::spBaseServicesEnabled() ) { - config_data->interruptType = USE_FSI2HOST_MAILBOX; + l_config_data->interruptType = USE_FSI2HOST_MAILBOX; } else { - config_data->interruptType = USE_PSIHB_COMPLEX; + l_config_data->interruptType = USE_PSIHB_COMPLEX; } #ifdef CONFIG_ENABLE_CHECKSTOP_ANALYSIS // Figure out the FIR master - TARGETING::Target* masterproc = NULL; + TARGETING::Target* masterproc = nullptr; tS.masterProcChipTargetHandle( masterproc ); if( masterproc == i_proc ) { - config_data->firMaster = IS_FIR_MASTER; + l_config_data->firMaster = IS_FIR_MASTER; // TODO: RTC 124683 The ability to write the HOMER data // is currently not available at runtime. #ifndef __HOSTBOOT_RUNTIME - l_errl = PRDF::writeHomerFirData( config_data->firdataConfig, + l_errl = PRDF::writeHomerFirData( l_config_data->firdataConfig, sizeof(config_data->firdataConfig) ); #endif } else { - config_data->firMaster = NOT_FIR_MASTER; + l_config_data->firMaster = NOT_FIR_MASTER; } #else - config_data->firMaster = 0; + l_config_data->firMaster = 0; #endif TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, @@ -264,15 +261,14 @@ namespace HBPM */ errlHndl_t loadHcode( TARGETING::Target* i_target, void* i_pImageOut, - uint32_t i_mode ) + loadPmMode i_mode ) { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - ENTER_MRK"loadHcode(0x%08X, %p, %d)", - get_huid(i_target), - i_pImageOut, - i_mode); + ENTER_MRK"loadHcode(HUID:0x%08X, Image:%p, Mode:%s)", + get_huid(i_target), i_pImageOut, + (PM_LOAD == i_mode) ? "LOAD" : "RELOAD" ); - errlHndl_t l_errl = NULL; + errlHndl_t l_errl = nullptr; // cast OUR type of target to a FAPI type of target. // figure out homer offsets @@ -293,13 +289,13 @@ namespace HBPM g_pHcodeLidMgr = std::shared_ptr (new UtilLidMgr(l_lidId)); } - void* l_pImageIn = NULL; + void* l_pImageIn = nullptr; size_t l_lidImageSize = 0; // NOTE: Ideally, there would also be a check to determine if LID // manager already got the new LID, but the currently // available information does not make it possible to do that. - if(HBRT_PM_RELOAD == i_mode) + if(PM_RELOAD == i_mode) { // When reloading, release LID image so any update is used l_errl = g_pHcodeLidMgr->releaseLidImage(); @@ -347,8 +343,8 @@ namespace HBPM l_fapiTarg, l_pImageIn, //reference image i_pImageOut, //homer image buffer - NULL, //default is no ring overrides - (HBRT_PM_LOAD == i_mode) + nullptr, //default is no ring overrides + (PM_LOAD == i_mode) ? PHASE_IPL : PHASE_REBUILD, l_imgType, l_buffer0, @@ -462,11 +458,13 @@ namespace HBPM uint64_t i_occImgVaddr, // dest uint64_t i_commonPhysAddr) { - errlHndl_t l_errl = NULL; - TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - ENTER_MRK"loadOCCSetup(0x%08X, 0x%08X, 0x%08X)", - i_occImgPaddr, i_occImgVaddr, i_commonPhysAddr); + ENTER_MRK"loadOCCSetup" + "(OccP:0x%08X, OccV:0x%08X, CommonP:0x%08X)", + i_occImgPaddr, i_occImgVaddr, i_commonPhysAddr ); + + errlHndl_t l_errl = nullptr; + do{ // cast OUR type of target to a FAPI type of target. const fapi2::Target @@ -509,7 +507,7 @@ namespace HBPM // BAR2 is the OCC Common Area // Bar size is in MB - TARGETING::Target* sys = NULL; + TARGETING::Target* sys = nullptr; TARGETING::targetService().getTopLevelTarget(sys); sys->setAttr(i_commonPhysAddr); @@ -554,40 +552,41 @@ namespace HBPM errlHndl_t loadOCCImageToHomer(TARGETING::Target* i_target, uint64_t i_occImgPaddr, uint64_t i_occImgVaddr, // dest - uint32_t i_mode) + loadPmMode i_mode) { - errlHndl_t l_errl = NULL; - TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - ENTER_MRK"loadOCCImageToHomer(0x%08X, 0x%08X)", + ENTER_MRK"loadOCCImageToHomer(OccP:0x%08X, OccV:0x%08X)", i_occImgPaddr, i_occImgVaddr); + + errlHndl_t l_errl = nullptr; + do{ if(g_pOccLidMgr.get() == nullptr) { g_pOccLidMgr = std::shared_ptr (new UtilLidMgr(Util::OCC_LIDID)); } - void* l_pLidImage = NULL; + void* l_pLidImage = nullptr; size_t l_lidImageSize = 0; // NOTE: Ideally, there would also be a check to determine if LID // manager already got the new LID, but the currently // available information does not make it possible to do that. - if(HBRT_PM_RELOAD == i_mode) + if(PM_RELOAD == i_mode) { // When reloading, release LID image so any update is used l_errl = g_pOccLidMgr->releaseLidImage(); - } - if (l_errl) - { - TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - ERR_MRK"loadOCCImageToHomer: " - "release stored LID image failed!"); - l_errl->collectTrace("ISTEPS_TRACE",256); - l_errl->collectTrace(FAPI_TRACE_NAME,256); - l_errl->collectTrace(FAPI_IMP_TRACE_NAME,256); - break; + if (l_errl) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ERR_MRK"loadOCCImageToHomer: " + "release stored LID image failed!"); + l_errl->collectTrace("ISTEPS_TRACE",256); + l_errl->collectTrace(FAPI_TRACE_NAME,256); + l_errl->collectTrace(FAPI_IMP_TRACE_NAME,256); + break; + } } l_errl = g_pOccLidMgr->getStoredLidImage(l_pLidImage, @@ -603,10 +602,10 @@ namespace HBPM break; } - void* occVirt = reinterpret_cast(i_occImgVaddr); + void* l_occVirt = reinterpret_cast(i_occImgVaddr); // copy LID to Homer - memcpy(occVirt, l_pLidImage, l_lidImageSize); + memcpy(l_occVirt, l_pLidImage, l_lidImageSize); }while(0); TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, @@ -616,14 +615,144 @@ namespace HBPM } // loadOCCImageToHomer + /** + * @brief Load OCC/HCODE images into mainstore + */ + errlHndl_t loadPMComplex(TARGETING::Target * i_target, + uint64_t i_homerPhysAddr, + uint64_t i_commonPhysAddr, + loadPmMode i_mode) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ENTER_MRK"loadPMComplex: %s", + (PM_LOAD == i_mode) ? "LOAD" : "RELOAD" ); + + errlHndl_t l_errl = nullptr; + + do + { + // Reset the PM complex for LOAD only + if( PM_LOAD == i_mode) + { + l_errl = resetPMComplex(i_target); + if( l_errl ) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ERR_MRK"loadPMComplex: " + "reset PM complex failed!" ); + break; + } + } + + void* l_homerVAddr = convertHomerPhysToVirt(i_target, + i_homerPhysAddr); + if(nullptr == l_homerVAddr) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ERR_MRK"loadPMComplex: " + "convertHomerPhysToVirt failed! " + "HOMER_Phys=0x%08X", i_homerPhysAddr ); + break; + } + + uint64_t l_occImgPaddr = i_homerPhysAddr + + HOMER_OFFSET_TO_OCC_IMG; + uint64_t l_occImgVaddr = reinterpret_cast (l_homerVAddr) + + HOMER_OFFSET_TO_OCC_IMG; + + l_errl = loadOCCSetup(i_target, + l_occImgPaddr, + l_occImgVaddr, + i_commonPhysAddr); + if(l_errl) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ERR_MRK"loadPMComplex: " + "loadOCCSetup failed! " + "HUID=0x%08X OCC_Phys=0x%08X " + "OCC_Virt=0x%08X Common_Phys=0x%08X", + get_huid(i_target), l_occImgPaddr, + l_occImgVaddr, i_commonPhysAddr ); + break; + } + + l_errl = loadOCCImageToHomer(i_target, + l_occImgPaddr, + l_occImgVaddr, + i_mode); + if(l_errl) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ERR_MRK"loadPMComplex: " + "loading OCC failed! " + "HUID=0x08X OCC_Phys=0x%08X " + "OCC_Virt=0x%08X Mode=%s", + get_huid(i_target), l_occImgPaddr, l_occImgVaddr, + (PM_LOAD == i_mode) ? "LOAD" : "RELOAD" ); + break; + } + + void* l_occDataVaddr = reinterpret_cast (l_occImgVaddr + + HOMER_OFFSET_TO_OCC_HOST_DATA); + + l_errl = loadHostDataToHomer(i_target, + l_occDataVaddr); + if(l_errl) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ERR_MRK"loadPMComplex: " + "loading Host Data Area failed! " + "HUID=0x08X OCC_Host_Data_Virt=0x%08X", + get_huid(i_target), l_occDataVaddr ); + break; + } + + // @TODO RTC:153885 verify parameters on call + l_errl = pstateParameterBuild(i_target, + l_homerVAddr); + if(l_errl) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ERR_MRK"loadPMComplex: " + "pstateParameterBuild failed! " + "HUID=0x08X OCC_Virt=0x%08X", + get_huid(i_target), l_occImgVaddr ); + break; + } + + l_errl = loadHcode(i_target, + l_homerVAddr, + i_mode); + if(l_errl) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ERR_MRK"loadPMComplex: " + "loadHcode failed! " + "HUID=0x08X HOMER_Virt=0x%08X Mode=%s", + get_huid(i_target), l_occImgVaddr, + (PM_LOAD == i_mode) ? "LOAD" : "RELOAD" ); + break; + } + + } while(0); + + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + EXIT_MRK"loadPMComplex: RC=0x%X, PLID=0x%lX", + ERRL_GETRC_SAFE(l_errl), ERRL_GETPLID_SAFE(l_errl) ); + + return l_errl; + } + + /** * @brief Start PM Complex. */ - errlHndl_t startPMComplex (Target* i_target) + errlHndl_t startPMComplex(Target* i_target) { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, ENTER_MRK"startPMComplex"); - errlHndl_t l_errl = NULL; + + errlHndl_t l_errl = nullptr; // cast OUR type of target to a FAPI type of target. // figure out homer offsets @@ -638,10 +767,12 @@ namespace HBPM l_fapiTarg, p9pm::PM_INIT ); - if ( l_errl != NULL ) + if ( l_errl != nullptr ) { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - ERR_MRK"startPMComplex: p9_pm_init, init failed!" ); + ERR_MRK"startPMComplex: " + "p9_pm_init(PM_INIT) failed! " + "HUID=0x08X", get_huid(i_target) ); l_errl->collectTrace("ISTEPS_TRACE",256); break; @@ -663,7 +794,8 @@ namespace HBPM { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, ENTER_MRK"resetPMComplex"); - errlHndl_t l_errl = NULL; + + errlHndl_t l_errl = nullptr; // cast OUR type of target to a FAPI type of target. // figure out homer offsets @@ -682,7 +814,9 @@ namespace HBPM if (l_errl) { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - ERR_MRK"resetPMComplex:p9_pm_init, reset failed!" ); + ERR_MRK"resetPMComplex: " + "p9_pm_init(PM_RESET) failed! " + "HUID=0x08X", get_huid(i_target) ); l_errl->collectTrace("ISTEPS_TRACE",256); break; @@ -696,5 +830,124 @@ namespace HBPM return l_errl; } // resetPMComplex + + /** + * @brief Load PM complex for all chips + */ + errlHndl_t loadPMAll(loadPmMode i_mode) + { + errlHndl_t l_errl = nullptr; + + TargetHandleList l_procChips; + getAllChips(l_procChips, TYPE_PROC, true); + + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "loadPMAll: %s %d proc(s) found", + (PM_LOAD == i_mode) ? "LOAD" : "RELOAD", + l_procChips.size() ); + + uint64_t l_homerPhysAddr = 0x0; + uint64_t l_commonPhysAddr = 0x0; + + for (const auto & l_procChip: l_procChips) + { + // This attr was set during istep15 HCODE build + l_homerPhysAddr = + l_procChip->getAttr(); + l_commonPhysAddr = l_homerPhysAddr + VMM_HOMER_REGION_SIZE; + + l_errl = loadPMComplex(l_procChip, + l_homerPhysAddr, + l_commonPhysAddr, + i_mode); + if( l_errl ) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ERR_MRK"loadPMAll: " + "load PM complex failed!" ); + break; + } + } + + return l_errl; + } // loadPMAll + + + /** + * @brief Start PM complex for all chips + */ + errlHndl_t startPMAll() + { + errlHndl_t l_errl = nullptr; + + TargetHandleList l_procChips; + getAllChips(l_procChips, TYPE_PROC, true); + + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "startPMAll: %d proc(s) found", + l_procChips.size()); + + for (const auto & l_procChip: l_procChips) + { + l_errl = startPMComplex(l_procChip); + if( l_errl ) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ERR_MRK"startPMAll: " + "start PM complex failed!" ); + break; + } + + // RTC 165644 Enable this when readSRAM is available + // Add constants for addr/act/exp values + /* + // OCC checkpoint + l_errl = readSRAM(l_procChip,0xfffbf000,l_buffer); + if(((l_buffer.getWord(0)) & 0xFFF) == 0xEFF) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "startPMALL: OCC checkpoint detected" ); + } + else + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "startPMALL: OCC checkpoint not detected" ); + } + */ + } + + return l_errl; + } // startPMAll + + + /** + * @brief Reset PM complex for all chips + */ + errlHndl_t resetPMAll() + { + errlHndl_t l_errl = nullptr; + + TargetHandleList l_procChips; + getAllChips(l_procChips, TYPE_PROC, true); + + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "resetPMAll: %d proc(s) found", + l_procChips.size()); + + for (const auto & l_procChip: l_procChips) + { + l_errl = resetPMComplex(l_procChip); + if( l_errl ) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ERR_MRK"resetPMAll: " + "reset PM complex failed!" ); + break; + } + } + + return l_errl; + } // resetPMAll + } // end HBPM namespace diff --git a/src/usr/isteps/pm/pm_common.H b/src/usr/isteps/pm/pm_common.H index 567152dce..48f887b01 100644 --- a/src/usr/isteps/pm/pm_common.H +++ b/src/usr/isteps/pm/pm_common.H @@ -29,6 +29,7 @@ #include #include #include +#include namespace HBPM { @@ -105,12 +106,12 @@ namespace HBPM * * @param[in] i_target: Target processor * @param[in] i_pImageOut: Pointer to HOMER image buffer - * @param[in] i_mode Selects initial load vs concurrent reloads + * @param[in] i_mode Selects initial load vs concurrent reload * @return errlHndl_t Error log if loadHcode failed */ errlHndl_t loadHcode( TARGETING::Target* i_target, void* i_pImageOut, - uint32_t i_mode ); + loadPmMode i_mode ); /** * @brief Execute procedures and steps required to setup for loading @@ -139,29 +140,51 @@ namespace HBPM * proc's OCC image in the homer * @param[in] i_occImgVaddr: Virtual address of current * proc's OCC image in the homer - * @param[in] i_mode Selects initial load vs concurrent reloads + * @param[in] i_mode Selects initial load vs concurrent reload * @return errlHndl_t Error log if loadOCCImageToHomer failed */ errlHndl_t loadOCCImageToHomer(TARGETING::Target* i_target, uint64_t i_occImgPaddr, uint64_t i_occImgVaddr, - uint32_t i_mode); + loadPmMode i_mode); + + /** + * @brief Load PM Complex. + * + * @param[in] i_target: Target of processor + * @param[in] i_homerPhysAddr: Homer physical address + * @param[in] i_commonPhysAddr: OCC common area physical address + * @param[in] i_mode: Load / Reload + * LOAD == i_mode + * - Call pm_reset first + * - Load OCC lid, write OCC config data, build Pstate + * Parameter Blocks, and load Hcode reference image lid + * RELOAD == i_mode + * - Reload OCC lid, rewrite OCC config data, build Pstate + * Parameter Blocks, and rebuild Hcode + * + * @return errlHndl_t Error log if loadPMComplex failed + */ + errlHndl_t loadPMComplex(TARGETING::Target * i_target, + uint64_t i_homerPhysAddr, + uint64_t i_commonPhysAddr, + loadPmMode i_mode); /** * @brief Start PM Complex. * * @param[in] i_target: target of processor * - * @return errlHndl_t Error log of startPMComplex failed + * @return errlHndl_t Error log if startPMComplex failed */ - errlHndl_t startPMComplex (TARGETING::Target* i_target); + errlHndl_t startPMComplex(TARGETING::Target* i_target); /** * @brief Reset PM Complex. * * @param[in] i_target: target of processor * - * @return errlHndl_t Error log of resetPMComplex failed + * @return errlHndl_t Error log if resetPMComplex failed */ errlHndl_t resetPMComplex(TARGETING::Target * i_target); diff --git a/src/usr/isteps/pm/runtime/rt_pm.C b/src/usr/isteps/pm/runtime/rt_pm.C index 88a35c8f4..5d17836d4 100644 --- a/src/usr/isteps/pm/runtime/rt_pm.C +++ b/src/usr/isteps/pm/runtime/rt_pm.C @@ -36,6 +36,7 @@ #include #include +#include #include @@ -44,11 +45,12 @@ #include using namespace TARGETING; +using namespace RUNTIME; namespace ISTEPS_TRACE { // declare storage for isteps_trace! - trace_desc_t * g_trac_isteps_trace = NULL; + trace_desc_t * g_trac_isteps_trace = nullptr; TRAC_INIT(&ISTEPS_TRACE::g_trac_isteps_trace, "ISTEPS_TRACE", 2*KILOBYTE); } @@ -75,22 +77,19 @@ namespace RTPM /** * @brief Load OCC/HCODE images into mainstore + * @param[in] i_chip Processor Chip ID + * @param[in] i_homer_addr Homer physical address + * @param[in] i_occ_common_addr OCC common area physical address + * @param[in] i_mode PM load / reload + * @return Return Code */ int load_pm_complex( uint64_t i_chip, uint64_t i_homer_addr, uint64_t i_occ_common_addr, uint32_t i_mode ) { - // LOAD == i_mode - // - Call pm_reset first - // - HBRT loads OCC lid, writes OCC config data, builds Pstate - // Parameter Blocks, and loads Hcode reference image lid - // RELOAD == i_mode - // - HBRT reloads OCC lid, rewrites OCC config data, builds Pstate - // Parameter Blocks, and rebuilds Hcode - - Target* proc_target = NULL; - errlHndl_t err = NULL; + Target* proc_target = nullptr; + errlHndl_t l_err = nullptr; int rc = 0; TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, @@ -104,8 +103,8 @@ namespace RTPM do { // Utility to convert i_chip to Target - err = RT_TARG::getHbTarget(i_chip, proc_target); - if(err) + l_err = RT_TARG::getHbTarget(i_chip, proc_target); + if(l_err) { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, ERR_MRK"load_pm_complex: " @@ -121,91 +120,58 @@ namespace RTPM get_huid(proc_target)); } - err = HBPM::resetPMComplex(proc_target); - if( err ) + HBPM::loadPmMode l_hb_mode = HBPM::PM_UNKNOWN; + switch (i_mode) { - TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - ERR_MRK"load_pm_complex: " - "reset PM complex failed!" ); - break; + case HBRT_PM_LOAD: + l_hb_mode = HBPM::PM_LOAD; + break; + case HBRT_PM_RELOAD: + l_hb_mode = HBPM::PM_RELOAD; + break; + default: + /*@ + * @errortype + * @moduleid MOD_PM_RT_LOAD_PM_COMPLEX + * @reasoncode RC_PM_RT_UNKNOWN_MODE + * @userdata1 HBRT PM Mode + * @userdata2 HUID + * @devdesc PM load complex unknown mode + */ + l_err = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_INFORMATIONAL, + MOD_PM_RT_LOAD_PM_COMPLEX, + RC_PM_RT_UNKNOWN_MODE, + i_mode, + get_huid(proc_target)); + break; } - - void* occVirt = HBPM::convertHomerPhysToVirt(proc_target, - i_homer_addr); - if(NULL == occVirt) + if( l_err ) { - TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - ERR_MRK"load_pm_complex: " - "converting physical address to virtual failed!"); - break; - } - - uint64_t l_homer_addr_va = reinterpret_cast (occVirt); - - err = HBPM::loadOCCSetup(proc_target, - i_homer_addr, - l_homer_addr_va, - i_occ_common_addr); - if(err) - { - TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - ERR_MRK"load_pm_complex: " - "setting up OCC load failed!" ); - break; - } - - err = HBPM::loadOCCImageToHomer(proc_target, - i_homer_addr, - l_homer_addr_va, - i_mode); - if(err) - { - TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - ERR_MRK"load_pm_complex: " - "loading OCC failed!" ); + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + ERR_MRK"load_pm_complex: " + "Unknown Mode 0x%X for HUID=0x%08X", + i_mode, get_huid(proc_target)); break; } - void* occHostVirt = reinterpret_cast (l_homer_addr_va + - HOMER_OFFSET_TO_OCC_HOST_DATA); - - err = HBPM::loadHostDataToHomer(proc_target, - occHostVirt); - if(err) + l_err = HBPM::loadPMComplex(proc_target, + i_homer_addr, + i_occ_common_addr, + l_hb_mode); + if( l_err ) { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, ERR_MRK"load_pm_complex: " - "loading Host Data Area failed!" ); - break; - } - - // @TODO RTC:153885 verify parameters on call - err = HBPM::pstateParameterBuild(proc_target, - occVirt); - if(err) - { - TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, - ERR_MRK"load_pm_complex: " - "building Pstate Parameter Block failed!"); + "load PM complex failed!" ); break; } - err = HBPM::loadHcode(proc_target, - occVirt, - i_mode); - if(err) - { - TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, - ERR_MRK"load_pm_complex: " - "loadHcode, %s failed!", - (HBRT_PM_LOAD == i_mode) ? "LOAD" : "RELOAD"); - break; - } } while(0); - if (err) + if (l_err) { - pm_complex_error(err, + pm_complex_error(l_err, rc); } @@ -215,13 +181,13 @@ namespace RTPM /** * @brief Start OCC/HCODE on the specified chip + * @param[in] i_chip Processor Chip ID + * @return Return Code */ int start_pm_complex( uint64_t i_chip ) { - // HBRT executes p9_pm_init(INIT) - - Target* proc_target = NULL; - errlHndl_t err = NULL; + Target* proc_target = nullptr; + errlHndl_t l_err = nullptr; int rc = 0; TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, @@ -230,8 +196,8 @@ namespace RTPM do { // Utility to convert i_chip to Target - err = RT_TARG::getHbTarget(i_chip, proc_target); - if( err ) + l_err = RT_TARG::getHbTarget(i_chip, proc_target); + if( l_err ) { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, ERR_MRK"start_pm_complex: " @@ -247,19 +213,20 @@ namespace RTPM get_huid(proc_target)); } - err = HBPM::startPMComplex(proc_target); - if( err ) + l_err = HBPM::startPMComplex(proc_target); + if( l_err ) { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, ERR_MRK"start_pm_complex: " - "starting OCC failed!" ); + "start PM complex failed!" ); break; } + } while(0); - if ( err ) + if ( l_err ) { - pm_complex_error(err, + pm_complex_error(l_err, rc); } @@ -269,13 +236,13 @@ namespace RTPM /** * @brief Reset OCC/HCODE on the specified chip + * @param[in] i_chip Processor Chip ID + * @return Return Code */ int reset_pm_complex( uint64_t i_chip ) { - // HBRT executes p9_pm_init(RESET) - - Target* proc_target = NULL; - errlHndl_t err = NULL; + Target* proc_target = nullptr; + errlHndl_t l_err = nullptr; int rc = 0; TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, @@ -284,8 +251,8 @@ namespace RTPM do { // Utility to convert i_chip to Target - err = RT_TARG::getHbTarget(i_chip, proc_target); - if( err ) + l_err = RT_TARG::getHbTarget(i_chip, proc_target); + if( l_err ) { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, ERR_MRK"reset_pm_complex: " @@ -301,19 +268,19 @@ namespace RTPM get_huid(proc_target)); } - err = HBPM::resetPMComplex(proc_target); - if( err ) + l_err = HBPM::resetPMComplex(proc_target); + if( l_err ) { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, ERR_MRK"reset_pm_complex: " - "stopping OCC failed!" ); + "reset PM complex failed!" ); break; } } while(0); - if ( err ) + if ( l_err ) { - pm_complex_error(err, + pm_complex_error(l_err, rc); } diff --git a/src/usr/util/test/testlidmgr.H b/src/usr/util/test/testlidmgr.H index 37cc3d7b9..e9c3b4cf3 100644 --- a/src/usr/util/test/testlidmgr.H +++ b/src/usr/util/test/testlidmgr.H @@ -77,7 +77,7 @@ public: } PNOR::SectionInfo_t l_lidPnorInfo; - l_errl = PNOR::getSectionInfo(PNOR::TEST, l_lidPnorInfo); + l_errl = PNOR::getSectionInfo(PNOR::TESTRO, l_lidPnorInfo); if(l_errl) { errlCommit(l_errl,UTIL_COMP_ID); diff --git a/src/usr/util/utillidmgr.C b/src/usr/util/utillidmgr.C index 8d081bb9f..4a358b3b1 100644 --- a/src/usr/util/utillidmgr.C +++ b/src/usr/util/utillidmgr.C @@ -43,8 +43,8 @@ mutex_t UtilLidMgr::cv_mutex = MUTEX_INITIALIZER; UtilLidMgr::UtilLidMgr(uint32_t i_lidId) : iv_needUnlock(false) ,iv_queueRegistered(false) -,iv_HbMsgQ(NULL) -,iv_pLidImage(NULL) +,iv_HbMsgQ(nullptr) +,iv_pLidImage(nullptr) ,iv_lidImageSize(0) ,iv_lidSize(0) { @@ -56,7 +56,7 @@ UtilLidMgr::UtilLidMgr(uint32_t i_lidId) /////////////////////////////////////////////////////////// UtilLidMgr::~UtilLidMgr() { - errlHndl_t l_err = NULL; + errlHndl_t l_err = nullptr; l_err = cleanup(); if(l_err) @@ -70,7 +70,7 @@ UtilLidMgr::~UtilLidMgr() /////////////////////////////////////////////////////////// errlHndl_t UtilLidMgr::getLidSize(size_t& o_lidSize) { - errlHndl_t errl = NULL; + errlHndl_t errl = nullptr; o_lidSize = 0; bool img_in_pnor = false; do{ @@ -141,7 +141,7 @@ errlHndl_t UtilLidMgr::getLidSize(size_t& o_lidSize) HWAS::SRCI_PRIORITY_MED); // for a syncronous message we need to free the message msg_free( l_pMsg ); - l_pMsg = NULL; + l_pMsg = nullptr; break; } @@ -152,7 +152,7 @@ errlHndl_t UtilLidMgr::getLidSize(size_t& o_lidSize) // for a syncronous message we need to free the message msg_free( l_pMsg ); - l_pMsg = NULL; + l_pMsg = nullptr; } }while(0); @@ -164,8 +164,8 @@ errlHndl_t UtilLidMgr::getLidSize(size_t& o_lidSize) /////////////////////////////////////////////////////////// errlHndl_t UtilLidMgr::getLidSizePnor(size_t& o_lidSize, bool& o_imgInPnor) { - errlHndl_t errl = NULL; - const char * lidAddr = NULL; + errlHndl_t errl = nullptr; + const char * lidAddr = nullptr; o_lidSize = 0; o_imgInPnor = false; @@ -184,7 +184,7 @@ errlHndl_t UtilLidMgr::getLidSizePnor(size_t& o_lidSize, bool& o_imgInPnor) { //Lid not in extended image delete errl; - errl = NULL; + errl = nullptr; break; } @@ -216,8 +216,8 @@ errlHndl_t UtilLidMgr::getLidPnor(void* i_dest, size_t i_destSize, bool& o_imgInPnor) { - errlHndl_t errl = NULL; - const char * lidAddr = NULL; + errlHndl_t errl = nullptr; + const char * lidAddr = nullptr; size_t lidSize = 0; o_imgInPnor = false; //assume not found to start. @@ -240,7 +240,7 @@ errlHndl_t UtilLidMgr::getLidPnor(void* i_dest, { //Lid not in extended image delete errl; - errl = NULL; + errl = nullptr; break; } } @@ -327,13 +327,13 @@ errlHndl_t UtilLidMgr::getLidPnor(void* i_dest, /////////////////////////////////////////////////////////// errlHndl_t UtilLidMgr::getLid(void* i_dest, size_t i_destSize) { - errlHndl_t errl = NULL; + errlHndl_t errl = nullptr; uint32_t curLid = 0; uint16_t pageNumber = 0; size_t dataSize = 0; size_t transferred_data = 0; - uint8_t* dataPtr = NULL; - void* copyOffset = NULL; + uint8_t* dataPtr = nullptr; + void* copyOffset = nullptr; bool img_in_pnor = false; do{ @@ -406,7 +406,7 @@ errlHndl_t UtilLidMgr::getLid(void* i_dest, size_t i_destSize) // for a syncronous message we need to free the message msg_free( l_pMsg ); - l_pMsg = NULL; + l_pMsg = nullptr; break; } @@ -427,7 +427,7 @@ errlHndl_t UtilLidMgr::getLid(void* i_dest, size_t i_destSize) dataPtr = reinterpret_cast (l_pMsg->extra_data); if((curLid != iv_lidId) || - (NULL == dataPtr)) + (nullptr == dataPtr)) { UTIL_FT(ERR_MRK"getLid: rc 0x%x received from FSP for Sync to HB request", return_code ); @@ -447,7 +447,7 @@ errlHndl_t UtilLidMgr::getLid(void* i_dest, size_t i_destSize) TWO_UINT32_TO_UINT64(curLid, iv_lidId), TWO_UINT32_TO_UINT64( - NULL != dataPtr ? *(dataPtr) : 0, + nullptr != dataPtr?*(dataPtr):0, 0) ); @@ -455,7 +455,7 @@ errlHndl_t UtilLidMgr::getLid(void* i_dest, size_t i_destSize) HWAS::SRCI_PRIORITY_HIGH); free(l_pMsg->extra_data); - l_pMsg->extra_data = NULL; + l_pMsg->extra_data = nullptr; break; } @@ -488,7 +488,7 @@ errlHndl_t UtilLidMgr::getLid(void* i_dest, size_t i_destSize) ); free(l_pMsg->extra_data); - l_pMsg->extra_data = NULL; + l_pMsg->extra_data = nullptr; break; } @@ -500,7 +500,7 @@ errlHndl_t UtilLidMgr::getLid(void* i_dest, size_t i_destSize) transferred_data+=dataSize; free(l_pMsg->extra_data); - l_pMsg->extra_data = NULL; + l_pMsg->extra_data = nullptr; } //if UTILLID::PAGE_TO_HB @@ -549,9 +549,9 @@ errlHndl_t UtilLidMgr::getLid(void* i_dest, size_t i_destSize) errlHndl_t UtilLidMgr::getStoredLidImage(void*& o_pLidImage, size_t& o_lidImageSize) { - errlHndl_t errl = NULL; + errlHndl_t errl = nullptr; - if((iv_pLidImage != NULL) && (iv_lidImageSize != 0)) + if((iv_pLidImage != nullptr) && (iv_lidImageSize != 0)) { o_pLidImage = iv_pLidImage; o_lidImageSize = iv_lidImageSize; @@ -563,9 +563,9 @@ errlHndl_t UtilLidMgr::getStoredLidImage(void*& o_pLidImage, errl = getLidSize(iv_lidImageSize); } - if(errl != NULL) + if(errl == nullptr) { - if(iv_pLidImage != NULL) + if(iv_pLidImage != nullptr) { free(iv_pLidImage); } @@ -601,7 +601,7 @@ errlHndl_t UtilLidMgr::releaseLidImage(void) errlHndl_t UtilLidMgr::sendMboxMessage( MBOX_MSG_TYPE type, msg_t * i_msg ) { - errlHndl_t errl = NULL; + errlHndl_t errl = nullptr; UTIL_DT("type: 0x%04x", i_msg->type ); UTIL_DT("data0: 0x%016llx",i_msg->data[0] ); @@ -628,7 +628,7 @@ errlHndl_t UtilLidMgr::sendMboxMessage( MBOX_MSG_TYPE type, // if the send failed and the message is still valid, check // and free the extra data if it exists. - if( i_msg != NULL && i_msg->extra_data != NULL ) + if( i_msg != nullptr && i_msg->extra_data != nullptr ) { free( i_msg->extra_data ); } @@ -642,7 +642,7 @@ errlHndl_t UtilLidMgr::sendMboxMessage( MBOX_MSG_TYPE type, /////////////////////////////////////////////////////////// errlHndl_t UtilLidMgr::createMsgQueue() { - errlHndl_t errl = NULL; + errlHndl_t errl = nullptr; mutex_lock(&cv_mutex); iv_needUnlock = true; @@ -689,7 +689,7 @@ void UtilLidMgr::unregisterMsgQueue() /////////////////////////////////////////////////////////// errlHndl_t UtilLidMgr::cleanup() { - errlHndl_t l_err = NULL; + errlHndl_t l_err = nullptr; iv_lidSize = 0; @@ -737,10 +737,10 @@ errlHndl_t UtilLidMgr::cleanup() } } - if(iv_pLidImage != NULL) + if(iv_pLidImage != nullptr) { free(iv_pLidImage); - iv_pLidImage = NULL; + iv_pLidImage = nullptr; } iv_lidImageSize = 0; @@ -752,7 +752,7 @@ errlHndl_t UtilLidMgr::cleanup() /////////////////////////////////////////////////////////// errlHndl_t UtilLidMgr::setLidId(uint32_t i_lidId) { - errlHndl_t l_err = NULL; + errlHndl_t l_err = nullptr; //must call cleanup before updateLid l_err = cleanup(); diff --git a/src/usr/util/utillidpnor.H b/src/usr/util/utillidpnor.H index 91749caab..267703f81 100644 --- a/src/usr/util/utillidpnor.H +++ b/src/usr/util/utillidpnor.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014 */ +/* Contributors Listed Below - COPYRIGHT 2014,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -57,8 +57,10 @@ bool cmpLidToPnor (const std::pair p1, const std::pair lidToPnor[] = { - std::make_pair(Util::TEST_LIDID, PNOR::TEST), // TEST_LIDID = 0x00000111 - std::make_pair(Util::OCC_LIDID, PNOR::OCC) // OCC_LIDID = 0x81e00430 + std::make_pair(Util::TEST_LIDID, PNOR::TESTRO), // 0x00000111 + std::make_pair(Util::OCC_LIDID, PNOR::OCC), // 0x81e00430 + std::make_pair(Util::NIMBUS_HCODE_LIDID, PNOR::HCODE), // 0x81e00602 + std::make_pair(Util::CUMULUS_HCODE_LIDID, PNOR::HCODE) // 0x81e00603 }; // Size of lidToPnor[] -- cgit v1.2.1