Skip to content

Commit

Permalink
Enable OCC on ZZ with Opal
Browse files Browse the repository at this point in the history
Change-Id: I656c47d2468c8c31509b80492709b0f651b85b42
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/47008
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Reviewed-by: Stephen M. Cprek <smcprek@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
  • Loading branch information
dcrowell77 authored and wghoffa committed Oct 20, 2017
1 parent 3b73246 commit 691a96a
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 31 deletions.
16 changes: 15 additions & 1 deletion src/include/usr/pnor/pnor_const.H
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,21 @@ enum PnorMode_t {
// Size and layout of this structure must be maintained for debug framework.
struct SectionInfo_t
{
SectionInfo_t(): id(INVALID_SECTION), secure(false) {}
SectionInfo_t():
id(INVALID_SECTION),
name("INVALID_SECTION"),
vaddr(0),
flashAddr(0),
size(0),
eccProtected(false),
sha512Version(false),
sha512perEC(false),
readOnly(false),
reprovision(false),
Volatile(false),
secure(false),
clearOnEccErr(false)
{}
SectionId id; /**< Identifier for this section */
const char* name; /**< Name of the section */
uint64_t vaddr; /**< Virtual address of the start of the section */
Expand Down
1 change: 0 additions & 1 deletion src/include/usr/pnor/pnorif.H
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ errlHndl_t readHeaderMagic(
size_t i_size,
void* o_pData);

// @TODO CQ:SW400352 remove function
/**
* @brief Determine if a PNOR section is empty by checking if first PAGE
* is all 0xFF's or 0x00's depending on ECC or not.
Expand Down
3 changes: 3 additions & 0 deletions src/usr/isteps/pm/pm_common.C
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,9 @@ namespace HBPM
void* l_occVirt = reinterpret_cast<void *>(i_occImgVaddr);

// copy LID to Homer
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
"Copying %p to %p for %d bytes",
l_occVirt, l_pLidImage, l_lidImageSize );
memcpy(l_occVirt, l_pLidImage, l_lidImageSize);
}while(0);

Expand Down
1 change: 0 additions & 1 deletion src/usr/pnor/pnor_common.C
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,6 @@ errlHndl_t PNOR::hasKnownHeader(
return pError;
}

// @TODO CQ:SW400352 remove function
bool PNOR::isSectionEmpty(const PNOR::SectionId i_section)
{
errlHndl_t l_errhdl = nullptr;
Expand Down
12 changes: 4 additions & 8 deletions src/usr/runtime/populate_hbruntime.C
Original file line number Diff line number Diff line change
Expand Up @@ -1178,15 +1178,11 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId)
// -- HCODE
// -- Non-verified Images
/// -- RINGOVD
// @TODO CQ:SW400352 add OCC PNOR support for fsp back
if (!INITSERVICE::spBaseServicesEnabled())
l_elog = hbResvLoadSecureSection(PNOR::OCC, i_nodeId,
l_prevDataAddr, l_prevDataSize);
if (l_elog)
{
l_elog = hbResvLoadSecureSection(PNOR::OCC, i_nodeId,
l_prevDataAddr, l_prevDataSize);
if (l_elog)
{
break;
}
break;
}
l_elog = hbResvLoadSecureSection(PNOR::WOFDATA, i_nodeId,
l_prevDataAddr, l_prevDataSize);
Expand Down
24 changes: 15 additions & 9 deletions src/usr/util/runtime/utillidmgr_rt.C
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <secureboot/containerheader.H>
#include <trace/interface.H>
#include "../utilbase.H"
#include <util/utillidpnor.H>

UtilLidMgr::UtilLidMgr(uint32_t i_lidId) :
iv_isLidInPnor(false), iv_lidBuffer(nullptr), iv_lidSize(0),
Expand Down Expand Up @@ -131,6 +132,7 @@ errlHndl_t UtilLidMgr::releaseLidImage(void)
errlHndl_t UtilLidMgr::loadLid()
{
if (nullptr != iv_lidBuffer) return nullptr;
UTIL_FT("UtilLidMgr::loadLid");

const char* l_addr = nullptr;
size_t l_size = 0;
Expand All @@ -140,8 +142,13 @@ errlHndl_t UtilLidMgr::loadLid()
{
if(iv_isLidInHbResvMem)
{
UTIL_FT("UtilLidMgr::loadLid> iv_isLidInHbResvMem=true");
iv_lidBuffer = reinterpret_cast<void*>(g_hostInterfaces->
get_reserved_mem(PNOR::SectionIdToString(iv_lidPnorInfo.id),0));
get_reserved_mem(
PNOR::SectionIdToString(
Util::getLidPnorSection(
static_cast<Util::LidId>(iv_lidId))),
0));

// If nullptr returned, set size to 0 to indicate we could not find
// the lid in HB resv memory
Expand Down Expand Up @@ -172,6 +179,7 @@ errlHndl_t UtilLidMgr::loadLid()
{
// If no secure header, just use PNOR size
iv_lidSize = iv_lidPnorInfo.size;
UTIL_FT("UtilLidMgr::loadLid - iv_lidSize=%d", iv_lidSize );

// Need to increment past header if one exists
if (iv_lidPnorInfo.sha512Version)
Expand All @@ -181,12 +189,15 @@ errlHndl_t UtilLidMgr::loadLid()
iv_lidBuffer = static_cast<uint8_t*>(iv_lidBuffer) +
PAGESIZE;
iv_lidSize -= PAGESIZE;
UTIL_FT("UtilLidMgr::loadLid - iv_lidSize=%d",
iv_lidSize );
}
}
}
}
else if(iv_isLidInVFS)
{
UTIL_FT("UtilLidMgr::loadLid> iv_isLidInVFS=true");
l_errl = VFS::module_address(iv_lidFileName, l_addr, l_size);
if (l_errl)
{
Expand All @@ -198,12 +209,14 @@ errlHndl_t UtilLidMgr::loadLid()
}
else if (iv_isLidInPnor)
{
UTIL_FT("UtilLidMgr::loadLid> iv_isLidInPnor=true");
iv_lidSize = iv_lidPnorInfo.size;
iv_lidBuffer = reinterpret_cast<char *>(iv_lidPnorInfo.vaddr);
}
else if( g_hostInterfaces->lid_load
&& iv_spBaseServicesEnabled )
{
UTIL_FT("UtilLidMgr::loadLid> Calling lid_load(0x%.8X)", iv_lidId);
int rc = g_hostInterfaces->lid_load(iv_lidId, &iv_lidBuffer,
&iv_lidSize);
if (0 != rc)
Expand Down Expand Up @@ -284,6 +297,7 @@ errlHndl_t UtilLidMgr::cleanup()

void UtilLidMgr::updateLid(uint32_t i_lidId)
{
UTIL_FT("UtilLidMgr::updateLid - i_lidId=0x%.8X", i_lidId);
iv_lidId = i_lidId;

// First check if lid is already in hostboot reserved memory
Expand Down Expand Up @@ -330,14 +344,6 @@ const uint32_t * UtilLidMgr::getLidList(size_t * o_num)

bool UtilLidMgr::lidInHbResvMem(const uint32_t i_lidId) const
{
// @TODO CQ:SW400352 Remove this when fsp adds in PNOR support
// hostboot could not verify it from pnor, so it is not in hb resv meomory
if (iv_spBaseServicesEnabled &&
(i_lidId == Util::OCC_LIDID || i_lidId == Util::OCC_CONTAINER_LIDID))
{
return false;
}

return i_lidId == Util::OCC_LIDID ||
i_lidId == Util::OCC_CONTAINER_LIDID ||
i_lidId == Util::WOF_LIDID ||
Expand Down
18 changes: 7 additions & 11 deletions src/usr/util/utillidpnor.C
Original file line number Diff line number Diff line change
Expand Up @@ -157,22 +157,18 @@ bool UtilLidMgr::getLidPnorSectionInfo(uint32_t i_lidId,
}
#endif
#endif
// @TODO CQ:SW400352 remove this check
if ((l_secId == PNOR::OCC)
#ifndef __HOSTBOOT_RUNTIME
&& PNOR::isSectionEmpty(l_secId)
#else
//use this check for HBRT due to secure lid load setting vaddr
//to zero -- which causes isSectionEmpty to segfault
&& !o_lidPnorInfo.vaddr
#endif
)

#ifdef __HOSTBOOT_RUNTIME
//use this check for HBRT due to secure lid load setting vaddr
//to zero -- which causes isSectionEmpty to segfault
if( !o_lidPnorInfo.vaddr )
{
UTIL_FT("UtilLidMgr::getLidPnorSection PNOR section %s is empty get data from LID transfer",
UTIL_FT("UtilLidMgr::getLidPnorSection PNOR section %s is empty or secure",
PNOR::SectionIdToString(l_secId));
l_lidInPnor = false;
break;
}
#endif
}
}
} while(0);
Expand Down

0 comments on commit 691a96a

Please sign in to comment.