diff options
author | vanlee <vanlee@us.ibm.com> | 2013-05-14 14:54:27 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2013-06-12 09:27:05 -0500 |
commit | 36a701ad9bcbcb3a997d76d11fe38d7726d1c4e7 (patch) | |
tree | 56c3c21170fe54032aa0cb4ed720f653d5e207a8 /src/usr/hwas/common | |
parent | d2a31c241a1a8221bc3932bdfacfc949fb6ec70c (diff) | |
download | talos-hostboot-36a701ad9bcbcb3a997d76d11fe38d7726d1c4e7.tar.gz talos-hostboot-36a701ad9bcbcb3a997d76d11fe38d7726d1c4e7.zip |
Add interface to do bus callout in Hostboot
Change-Id: If169d997a0aba49a81ef834d7806e1e589dc3bff
RTC: 69459
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/4503
Tested-by: Jenkins Server
Reviewed-by: Brian H. Horton <brianh@linux.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwas/common')
-rw-r--r-- | src/usr/hwas/common/hwasCallout.C | 131 |
1 files changed, 87 insertions, 44 deletions
diff --git a/src/usr/hwas/common/hwasCallout.C b/src/usr/hwas/common/hwasCallout.C index 64cc7b92c..f82130a94 100644 --- a/src/usr/hwas/common/hwasCallout.C +++ b/src/usr/hwas/common/hwasCallout.C @@ -45,6 +45,56 @@ namespace HWAS using namespace HWAS::COMMON; +bool retrieveTarget(uint8_t * & io_uData, + TARGETING::Target * & o_pTarget, errlHndl_t i_errl) +{ + bool l_err = false; + + // data is either a token indicating it's the + // MASTER_PROCESSOR_CHIP_TARGET_SENTINEL + // or it's the EntityPath - getAttr<TARGETING::ATTR_PHYS_PATH>() + if (*io_uData != TARGET_IS_SENTINEL) + { + // convert the EntityPath to a Target pointer + TARGETING::EntityPath ep, *ep_ptr; + uint32_t size; + ep_ptr = (TARGETING::EntityPath *)io_uData; + size = TARGETING::EntityPath::MAX_PATH_ELEMENTS - ep_ptr->size(); + size *= sizeof(TARGETING::EntityPath::PathElement); + size = sizeof(ep) - size; + memcpy(&ep, io_uData, size); + o_pTarget = TARGETING::targetService().toTarget(ep); + io_uData += size; + + if (unlikely(o_pTarget == NULL)) + { // only happen if we have a corrupt errlog or targeting. + HWAS_ERR("HW callout; o_pTarget was NULL!!!"); + + /*@ + * @errortype + * @moduleid HWAS::MOD_PROCESS_CALLOUT + * @reasoncode HWAS::RC_INVALID_TARGET + * @devdesc Invalid Target encountered in + * processing of HW callout + * @userdata1 callout errlog PLID + */ + errlHndl_t errl = hwasError( + ERRL_SEV_INFORMATIONAL, + HWAS::MOD_PROCESS_CALLOUT, + HWAS::RC_INVALID_TARGET, + i_errl->plid()); + errlCommit(errl, HWAS_COMP_ID); + l_err = true; + } + } + else + { // convert this to the real master processor + TARGETING::targetService().masterProcChipTargetHandle(o_pTarget); + io_uData += sizeof(HWAS::TARGET_IS_SENTINEL); + } + return l_err; +} + void processCallout(errlHndl_t i_errl, uint8_t *i_pData, uint64_t i_Size) @@ -58,55 +108,24 @@ void processCallout(errlHndl_t i_errl, { case (HW_CALLOUT): { - TARGETING::Target *pTarget; + TARGETING::Target *pTarget = NULL; + uint8_t * l_uData = (uint8_t *)(pCalloutUD + 1); + bool l_err = retrieveTarget(l_uData, pTarget, i_errl); - // data after the pCalloutUD structure is either a token - // indicating it's the MASTER_PROCESSOR_CHIP_TARGET_SENTINEL - // or it's the EntityPath - getAttr<TARGETING::ATTR_PHYS_PATH>() - if (*((uint8_t *)(pCalloutUD + 1)) != TARGET_IS_SENTINEL) + if (!l_err) { - // convert the EntityPath to a Target pointer - TARGETING::EntityPath ep; - memcpy(&ep, (pCalloutUD + 1), sizeof(ep)); - pTarget = TARGETING::targetService().toTarget(ep); - - if (unlikely(pTarget == NULL)) - { // only happen if we have a corrupt errlog or targeting. - HWAS_ERR("HW callout; pTarget was NULL!!!"); - - /*@ - * @errortype - * @moduleid HWAS::MOD_PROCESS_CALLOUT - * @reasoncode HWAS::RC_INVALID_TARGET - * @devdesc Invalid Target encountered in - * processing of HW callout - * @userdata1 callout errlog PLID - */ - errlHndl_t errl = hwasError( - ERRL_SEV_INFORMATIONAL, - HWAS::MOD_PROCESS_CALLOUT, - HWAS::RC_INVALID_TARGET, - i_errl->plid()); + errlHndl_t errl = platHandleHWCallout( + pTarget, + pCalloutUD->priority, + pCalloutUD->deconfigState, + i_errl, + pCalloutUD->gardErrorType); + if (errl) + { + HWAS_ERR("HW callout: error from platHandlHWCallout"); errlCommit(errl, HWAS_COMP_ID); - break; } } - else - { // convert this to the real master processor - TARGETING::targetService().masterProcChipTargetHandle(pTarget); - } - - errlHndl_t errl = platHandleHWCallout( - pTarget, - pCalloutUD->priority, - pCalloutUD->deconfigState, - i_errl, - pCalloutUD->gardErrorType); - if (errl) - { - HWAS_ERR("HW callout: error from platHandlHWCallout"); - errlCommit(errl, HWAS_COMP_ID); - } break; } // HW_CALLOUT case (PROCEDURE_CALLOUT): @@ -123,6 +142,30 @@ void processCallout(errlHndl_t i_errl, } break; } + case (BUS_CALLOUT): + { + TARGETING::Target *pTarget1 = NULL; + TARGETING::Target *pTarget2 = NULL; + + uint8_t * l_targetData = (uint8_t *)(pCalloutUD + 1); + bool l_err1 = retrieveTarget(l_targetData, pTarget1, i_errl); + bool l_err2 = retrieveTarget(l_targetData, pTarget2, i_errl); + + if (!l_err1 && !l_err2) + { + errlHndl_t errl = platHandleBusCallout( + pTarget1, pTarget2, + pCalloutUD->busType, + pCalloutUD->priority, + i_errl); + if (errl) + { + HWAS_ERR("HW callout: error from platHandlBusCallout"); + errlCommit(errl, HWAS_COMP_ID); + } + } + break; + } // BUS_CALLOUT default: { HWAS_ERR("bad data in Callout UD %x", pCalloutUD->type); |