Skip to content

Commit

Permalink
Add HCODE scom update interface to HBRT
Browse files Browse the repository at this point in the history
Change-Id: I8d6a8aa2330ec95e1ce612979c9fa037a633d07d
RTC:150219
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/33702
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Reviewed-by: Martin Gloff <mgloff@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
cvswen authored and dcrowell77 committed Feb 3, 2017
1 parent 135b23e commit da3675d
Show file tree
Hide file tree
Showing 9 changed files with 298 additions and 104 deletions.
5 changes: 3 additions & 2 deletions src/include/runtime/interface.h
Expand Up @@ -407,7 +407,8 @@ typedef struct hostInterfaces
* @pre HBRT is responsible for enabling special wakeup on the
* associated core(s) before calling this interface
*
* @param i_homer start address of the homer image
* @param i_chipId processor chip ID
plus ID type, always proc (0x0)
* @param i_section runtime section to update
* (passthru to pore_gen_scom)
* @param i_operation type of operation to perform
Expand All @@ -419,7 +420,7 @@ typedef struct hostInterfaces
* Any value other than 0 on failure.
* @platform FSP, OpenPOWER
*/
int (*hcode_scom_update)( uint64_t i_homer,
int (*hcode_scom_update)( uint64_t i_chipId,
uint32_t i_section,
uint32_t i_operation,
uint64_t i_scomAddr,
Expand Down
25 changes: 23 additions & 2 deletions src/include/usr/isteps/pm/pm_common_ext.H
Expand Up @@ -31,13 +31,15 @@ namespace HBPM
{
/**
* @brief Enumeration of the load PM complex mode
* LOAD == i_mode
* LOAD
* - 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
* - Reload OCC lid, rewrite OCC config data, build Pstate
* Parameter Blocks, and rebuild Hcode
* UNKNOWN
* - Unknown PM load type, do not load OCC/HCODE
*/
enum loadPmMode
{
Expand Down Expand Up @@ -88,6 +90,25 @@ namespace HBPM
*/
errlHndl_t getRingOvd(void*& io_overrideImg);

#if __HOSTBOOT_RUNTIME
/**
* @brief Modify the SCOM restore section of the HCODE image with the
* given register data
* @param i_section Runtime section to update
* (passthru to pore_gen_scom)
* @param i_operation Type of operation to perform
* (passthru to pore_gen_scom)
* @param i_target Target owning the scom address
* @param i_rel_scom_addr Fully qualified scom address
* @param i_scom_data Data for operation
* @return errlHndl_t
*/
errlHndl_t hcode_update( uint32_t i_section,
uint32_t i_operation,
TARGETING::Target* i_target,
uint64_t i_rel_scom_addr,
uint64_t i_scom_data );
#endif
} //namespace HBPM ends

#endif
5 changes: 4 additions & 1 deletion src/include/usr/runtime/runtime_reasoncodes.H
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2012,2016 */
/* Contributors Listed Below - COPYRIGHT 2012,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -56,6 +56,7 @@ namespace RUNTIME
MOD_POPULATE_RTDATABYNODE = 0x14, /**< populate_hbruntime.C */

MOD_PM_RT_LOAD_PM_COMPLEX = 0x15, /**< rt_pm.C */
MOD_PM_RT_HCODE_UPDATE = 0x16, /**< rt_pm.C */
};

enum RuntimeReasonCode
Expand Down Expand Up @@ -90,6 +91,8 @@ namespace RUNTIME
RT_NO_PROC_TARGET = RUNTIME_COMP_ID | 0x1B,
RC_UNMAP_FAIL = RUNTIME_COMP_ID | 0x1C,
RC_PM_RT_UNKNOWN_MODE = RUNTIME_COMP_ID | 0x1D,
RC_PM_RT_INTERFACE_ERR = RUNTIME_COMP_ID | 0x1E,
RC_PM_RT_HCODE_UPDATE_ERR = RUNTIME_COMP_ID | 0x1F,
};

enum UserDetailsTypes
Expand Down
49 changes: 49 additions & 0 deletions src/include/usr/scom/scomif.H
@@ -0,0 +1,49 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/include/usr/scom/scomif.H $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] 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 __SCOMIF_H
#define __SCOMIF_H

namespace SCOM
{

/**
* @brief This function translates a relative scom address
* to an absolute scom address
*
* @param[in] i_target SCom target
* @param[in|out] io_addr SCom address
* @param[out] o_needsWakeup Enable SW before scom
* @param[in] i_opMode Defaults to 0 (Standard)
* @return errlHndl_t
*/
errlHndl_t scomTranslate(TARGETING::Target * &i_target,
uint64_t & io_addr,
bool & o_needsWakeup,
uint64_t i_opMode = 0);


}; // end namespace SCOM

#endif // end __SCOMIF_H
5 changes: 4 additions & 1 deletion src/usr/isteps/pm/runtime/makefile
Expand Up @@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2016
# Contributors Listed Below - COPYRIGHT 2016,2017
# [+] International Business Machines Corp.
#
#
Expand All @@ -26,10 +26,13 @@
HOSTBOOT_RUNTIME = 1

ROOTPATH = ../../../../..

VPATH += ../

MODULE = pm_rt

EXTRAINCDIR += ${ROOTPATH}/src/usr/scom/runtime

## Objects unique to HBRT
OBJS += rt_pm.o

Expand Down
129 changes: 128 additions & 1 deletion src/usr/isteps/pm/runtime/rt_pm.C
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016 */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -44,6 +44,9 @@
#include <targeting/common/utilFilter.H>
#include <targeting/common/targetservice.H>

#include <scom/scomif.H>
#include "handleSpecialWakeup.H"

using namespace TARGETING;
using namespace RUNTIME;

Expand Down Expand Up @@ -287,6 +290,130 @@ namespace RTPM
return rc;
}


/**
* @brief HCODE update operation
*/
errlHndl_t hcode_update( uint32_t i_section,
uint32_t i_operation,
Target* i_target,
uint64_t i_rel_scom_addr,
uint64_t i_scom_data )
{
errlHndl_t l_err = NULL;
int rc = 0;

do {
if( g_hostInterfaces == NULL ||
g_hostInterfaces->hcode_scom_update == NULL )
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
ERR_MRK"hcode_update: "
"Hypervisor hcode_scom_update interface not linked");
/*@
* @errortype
* @moduleid MOD_PM_RT_HCODE_UPDATE
* @reasoncode RC_PM_RT_INTERFACE_ERR
* @userdata1[0:31] Target HUID
* @userdata1[32:63] SCOM restore section
* @userdata2 SCOM address
* @devdesc HCODE scom update runtime interface not linked.
*/
l_err= new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_INFORMATIONAL,
MOD_PM_RT_HCODE_UPDATE,
RC_PM_RT_INTERFACE_ERR,
TWO_UINT32_TO_UINT64(
TARGETING::get_huid(i_target),
i_section),
i_rel_scom_addr);
break;
}

// Enable special wakeup
l_err = handleSpecialWakeup(i_target,true);
if(l_err)
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
ERR_MRK"hcode_update: "
"handleSpecialWakeup enable ERROR" );
break;
}

// Get the Proc Chip Id
const TARGETING::Target * l_pChipTarget =
getParentChip(const_cast<TARGETING::Target *>(i_target));
RT_TARG::rtChipId_t l_chipId = 0;

l_err = RT_TARG::getRtTarget(l_pChipTarget, l_chipId);
if(l_err)
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
ERR_MRK"hcode_update: getRtTarget ERROR" );
break;
}

// Translate the scom address
uint64_t l_scomAddr = i_rel_scom_addr;
bool l_needsWakeup = false; // Ignored - SW already enabled

l_err = SCOM::scomTranslate(i_target,
l_scomAddr,
l_needsWakeup);
if(l_err)
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
ERR_MRK"hcode_update: scomTranslate ERROR" );
break;
}

rc = g_hostInterfaces->hcode_scom_update(l_chipId,
i_section,
i_operation,
l_scomAddr,
i_scom_data);
if(rc)
{
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
ERR_MRK"hcode_update: "
"HCODE scom update failed. "
"rc 0x%X target 0x%llX chipId 0x%llX section 0x%X "
"operation 0x%X scomAddr 0x%llX scomData 0x%llX",
rc, get_huid(i_target), l_chipId, i_section,
i_operation, l_scomAddr, i_scom_data);

// convert rc to error log
/*@
* @errortype
* @moduleid MOD_PM_RT_HCODE_UPDATE
* @reasoncode RC_PM_RT_HCODE_UPDATE_ERR
* @userdata1 Hypervisor return code
* @userdata2 SCOM address
* @devdesc HCODE SCOM update error
*/
l_err=new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_INFORMATIONAL,
MOD_PM_RT_HCODE_UPDATE,
RC_PM_RT_HCODE_UPDATE_ERR,
rc,
l_scomAddr);
break;
}

// Disable special wakeup
l_err = handleSpecialWakeup(i_target,false);
if(l_err)
{
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
ERR_MRK"hcode_update: "
"handleSpecialWakeup disable ERROR" );
break;
}

} while (0);

return l_err;
}


//------------------------------------------------------------------------

struct registerPm
Expand Down

0 comments on commit da3675d

Please sign in to comment.