Skip to content

Commit

Permalink
HTMGT: Update to support new PGPE elog structure
Browse files Browse the repository at this point in the history
Change-Id: I392bead40d5c84d2229a2663325d776a1db5c77a
RTC: 209864
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/81316
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: Sheldon Bailey <baileysh@us.ibm.com>
Reviewed-by: Daniel M Crowell <dcrowell@us.ibm.com>
  • Loading branch information
cjcain authored and dcrowell77 committed Aug 2, 2019
1 parent 119219f commit ceef10b
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 36 deletions.
25 changes: 25 additions & 0 deletions src/usr/htmgt/htmgt_occ.H
Expand Up @@ -99,6 +99,16 @@ namespace HTMGT
} __attribute__ ((__packed__));
typedef struct occErrlCallout occErrlCallout_t;

// PGPE Callout Structure
struct pgpeErrlCallout
{
uint64_t calloutValue;
uint8_t type;
uint8_t priority;
uint8_t reserved[6];
} __attribute__ ((__packed__));
typedef struct pgpeErrlCallout pgpeErrlCallout_t;


/**
* @class Occ
Expand Down Expand Up @@ -381,6 +391,21 @@ namespace HTMGT
uint8_t & io_callout_num);


/**
* @brief Add specified PGEP callout to the error log
*
* @param[in,out] io_errlHndl elog to add callout
* @param[in] i_priority priority for callout
* @param[in] i_callout callout from PGPE
* @param[in,out] io_numCallouts number of callouts in elog,
* incremented if new callout added
* */
bool elogAddPgpeCallout(errlHndl_t & io_errlHndl,
HWAS::callOutPriority & i_priority,
const pgpeErrlCallout_t i_callout,
uint8_t & io_callout_num);


/**
* @brief Update the GPU presence sensors in the system
*/
Expand Down
140 changes: 117 additions & 23 deletions src/usr/htmgt/occError.C
Expand Up @@ -128,11 +128,23 @@ namespace HTMGT
const occErrlEntry_t * l_occElog =
reinterpret_cast<occErrlEntry_t*> (l_buffer.pointer());

TMGT_BIN("OCC ELOG", l_occElog, 256);
TMGT_BIN("OCC ELOG", l_occElog, 320);

// Get user details section
unsigned int l_elog_header_len = OCC_ELOG_HEADER_LENGTH;
unsigned int l_max_callout = l_occElog->occ_data.maxCallouts;
unsigned int l_callout_size = sizeof(occErrlCallout_t);
if (i_source != OCC_ERRSRC_405)
{
// PGPE logs require different memory alignment/structures
l_elog_header_len = PGPE_ELOG_HEADER_LENGTH;
l_max_callout = l_occElog->pgpe_data.maxCallouts;
l_callout_size = sizeof(pgpeErrlCallout_t);
}

// Get user details section (after callouts)
const occErrlUsrDtls_t *l_usrDtls_ptr = (occErrlUsrDtls_t *)
((uint8_t*)l_occElog + sizeof(occErrlEntry_t));
( (uint8_t*)l_occElog +
l_elog_header_len + (l_max_callout * l_callout_size) );

const uint32_t l_occSrc = l_comp_id | l_occElog->reasonCode;
ERRORLOG::errlSeverity_t severity =
Expand Down Expand Up @@ -166,6 +178,16 @@ namespace HTMGT
severity,
l_call_home_event);

uint16_t l_extendedRC = l_usrDtls_ptr->modId << 16;
if (i_source == OCC_ERRSRC_405)
{
l_extendedRC |= l_occElog->occ_data.extendedRC;
}
else
{
l_extendedRC |= l_occElog->pgpe_data.extendedRC;
}

// Create OCC error log
// NOTE: word 4 (used by extended reason code) to save off OCC
// sub component value which is needed to correctly parse
Expand All @@ -178,8 +200,7 @@ namespace HTMGT
l_usrDtls_ptr->userData1,
l_usrDtls_ptr->userData2,
l_usrDtls_ptr->userData3,
(l_usrDtls_ptr->modId << 16 ) |
l_occElog->extendedRC, // extended reason code
l_extendedRC,
severity);

if (l_call_home_event)
Expand All @@ -190,26 +211,36 @@ namespace HTMGT
}

// Add callout information
const uint8_t l_max_callouts = l_occElog->maxCallouts;
bool l_bad_fru_data = false;
uint8_t numCallouts = 0;
uint8_t calloutIndex = 0;
while (calloutIndex < l_max_callouts)
while (calloutIndex < l_max_callout)
{
const occErrlCallout_t callout =
l_occElog->callout[calloutIndex];
if (callout.type != 0)
const occErrlCallout_t *callout = (occErrlCallout_t*)
( (uint8_t*)l_occElog + l_elog_header_len +
(calloutIndex*l_callout_size) );
if (callout->type != 0)
{
HWAS::callOutPriority priority;
bool l_success = true;
l_success = elogXlateSrciPriority(callout.priority,
l_success = elogXlateSrciPriority(callout->priority,
priority);
if (l_success == true)
{
l_success = elogAddCallout(l_errlHndl,
priority,
callout,
numCallouts);
if (i_source == OCC_ERRSRC_405)
{
l_success = elogAddCallout(l_errlHndl,
priority,
*callout,
numCallouts);
}
else
{
l_success = elogAddPgpeCallout(l_errlHndl,
priority,
*((pgpeErrlCallout_t*)callout),
numCallouts);
}
if (l_success == false)
{
l_bad_fru_data = true;
Expand All @@ -220,24 +251,26 @@ namespace HTMGT
l_bad_fru_data = true;
TMGT_ERR("occProcessElog: Priority translate"
" failure (priority = 0x%02X)",
callout.priority);
callout->priority);
}
}
else
{ // make sure all the remaining callout data are zeros,
// otherwise mark bad fru data
const occErrlCallout_t zeros = { 0 };
while (calloutIndex < l_max_callouts)
uint8_t *l_ptr = (uint8_t*)callout;
unsigned int l_len =
(l_max_callout-calloutIndex) * l_callout_size;
while (l_len != 0)
{
if (memcmp(&l_occElog->callout[calloutIndex],
&zeros, sizeof(occErrlCallout_t)))
if (*l_ptr != 0x00)
{
TMGT_ERR("occProcessElog: The remaining"
" callout data should be all zeros");
l_bad_fru_data = true;
break;
}
++calloutIndex;
l_len--;
l_ptr++;
}
break;
}
Expand All @@ -248,8 +281,10 @@ namespace HTMGT
errlHndl_t err2 = nullptr;
if (l_bad_fru_data == true)
{
TMGT_BIN("Callout Data", &l_occElog->callout[0],
sizeof(occErrlCallout)*ERRL_MAX_CALLOUTS);
const uint8_t *callout_ptr = (uint8_t*)l_occElog
+ l_elog_header_len;
TMGT_BIN("Callout Data", callout_ptr,
l_callout_size * ERRL_MAX_CALLOUTS);
/*@
* @errortype
* @refcode LIC_REFCODE
Expand Down Expand Up @@ -516,6 +551,65 @@ namespace HTMGT
} // end Occ::elogAddCallout()


// Add callout to specified elog
bool Occ::elogAddPgpeCallout(errlHndl_t & io_errlHndl,
HWAS::callOutPriority & i_priority,
const pgpeErrlCallout_t i_callout,
uint8_t & io_callout_num)
{
bool l_success = true;

TMGT_INF("elogAddPgpeCallout: Add callout type:0x%02X, value:0x%016llX,"
" priority:0x%02X",
i_callout.type,i_callout.calloutValue, i_priority);

if (i_callout.type == OCC_CALLOUT_TYPE_COMPONENT_ID)
{
tmgtCompxlateType l_compDataType;
uint32_t l_compData = 0;
const uint8_t l_compId = (i_callout.calloutValue & 0xFF);

if (elogGetTranslationData(l_compId, l_compDataType, l_compData))
{
switch(l_compDataType)
{
case TMGT_COMP_DATA_SYMBOLIC_FRU:
TMGT_INF("elogAddPgpeCallout: symbolic callout: 0x%08X",
l_compData);
break;
case TMGT_COMP_DATA_PROCEDURE:
io_errlHndl->addProcedureCallout(
(HWAS::epubProcedureID)l_compData,
i_priority);
io_callout_num++;
break;
case TMGT_COMP_DATA_END_OF_TABLE:
break;
default:
TMGT_ERR("elogAddPgpeCallout: Invalid component id"
" 0x%02X", l_compId);
l_success = false;
}
}
else
{
TMGT_ERR("elogAddPgpeCallout: Component id translate failure"
" (id=0x%02X)", l_compId);
l_success = false;
}
}
else
{
TMGT_ERR("elogAddPgpeCallout: Invalid callout type (type=%d)",
i_callout.type);
l_success = false;
}

return l_success;;

} // end Occ::elogAddPgpeCallout()


void Occ::elogProcessActions(const uint8_t i_actions,
const uint32_t i_src,
uint32_t i_data,
Expand Down
47 changes: 34 additions & 13 deletions src/usr/htmgt/occError.H
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2014,2018 */
/* Contributors Listed Below - COPYRIGHT 2014,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -130,6 +130,8 @@ namespace HTMGT
#define ERRL_MAX_CALLOUTS 6

// OCC Error Log Structure
const unsigned int OCC_ELOG_HEADER_LENGTH = 12;
const unsigned int PGPE_ELOG_HEADER_LENGTH = 16;
struct occErrlEntry
{
// Log CheckSum
Expand All @@ -144,14 +146,30 @@ namespace HTMGT
uint8_t severity;
// Actions to process the errors
uint8_t actions;
// Reserved
uint16_t reserved;
// Extended Reason Code
uint16_t extendedRC;
// Log Callout Number
uint8_t maxCallouts;
// Callouts
occErrlCallout callout[ERRL_MAX_CALLOUTS];

union // PGPE has different alignment requirements, so structure differs
{
struct {
// Max Elog Size
uint16_t maxSize;
// Extended Reason Code
uint16_t extendedRC;
// Log Callout Number
uint8_t maxCallouts;
} occ_data __attribute__((packed));
struct {
// Log Callout Number
uint8_t maxCallouts;
// Extended Reason Code
uint16_t extendedRC;
// Max Elog Size
uint16_t maxSize;
// Reserved
uint16_t reserved[2];
} pgpe_data __attribute__ ((__packed__));
};

// Callouts start
} __attribute__ ((__packed__));
typedef struct occErrlEntry occErrlEntry_t;

Expand Down Expand Up @@ -192,10 +210,13 @@ namespace HTMGT

const tmgtCompXlate_t tmgt_compXlateTable[TMGT_MAX_COMP_IDS] =
{
{ 0x01, TMGT_COMP_DATA_PROCEDURE, HWAS::EPUB_PRC_HB_CODE}, // FW
{ 0x04, TMGT_COMP_DATA_SYMBOLIC_FRU, OVERTMP}, // over temperature
{ 0x05, TMGT_COMP_DATA_SYMBOLIC_FRU, TPMD_OV}, // oversub throttling
{ 0xFF, TMGT_COMP_DATA_END_OF_TABLE, 0}, // none
{ OCC_COMPONENT_ID_FIRMWARE,
TMGT_COMP_DATA_PROCEDURE,HWAS::EPUB_PRC_HB_CODE},
{ OCC_COMPONENT_ID_OVER_TEMPERATURE, TMGT_COMP_DATA_SYMBOLIC_FRU,
OVERTMP},
{ OCC_COMPONENT_ID_OVERSUBSCRIPTION, TMGT_COMP_DATA_SYMBOLIC_FRU,
TPMD_OV},
{ OCC_COMPONENT_ID_NONE, TMGT_COMP_DATA_END_OF_TABLE, 0} // END
};


Expand Down

0 comments on commit ceef10b

Please sign in to comment.