diff options
author | Norman James <njames@us.ibm.com> | 2014-10-08 13:32:39 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-02-04 08:49:31 -0600 |
commit | 465c97f5e63126bcec69a8708a23d7d9318eab7a (patch) | |
tree | 24c560caf059c89d62c57ea627cc6178d7347270 /src/usr/hwpf | |
parent | 9a02b48ae586fb4633f369e4ddc406c40643fbbe (diff) | |
download | talos-hostboot-465c97f5e63126bcec69a8708a23d7d9318eab7a.tar.gz talos-hostboot-465c97f5e63126bcec69a8708a23d7d9318eab7a.zip |
Added special callouts to FAPI
examples are SBE, PNOR, LPC slave
Change-Id: Ibd7dc7eab15236cf68501592ebb11b0e05815052
RTC: 116619
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/13888
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf')
-rwxr-xr-x | src/usr/hwpf/fapi/fapiParseErrorInfo.pl | 14 | ||||
-rwxr-xr-x[-rw-r--r--] | src/usr/hwpf/hwp/fapiHwpErrorInfo.xml | 15 | ||||
-rw-r--r-- | src/usr/hwpf/plat/fapiPlatHwpInvoker.C | 69 | ||||
-rwxr-xr-x[-rw-r--r--] | src/usr/hwpf/test/fapiRcTest.C | 145 |
4 files changed, 230 insertions, 13 deletions
diff --git a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl index b08bbeeb7..3cdb26612 100755 --- a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl +++ b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl @@ -6,7 +6,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2011,2014 +# Contributors Listed Below - COPYRIGHT 2011,2015 # [+] International Business Machines Corp. # # @@ -23,7 +23,8 @@ # permissions and limitations under the License. # # IBM_PROLOG_END_TAG -# $Id: fapiParseErrorInfo.pl,v 1.30 2014/07/25 00:36:41 jmcgill Exp $ + +# $Id: fapiParseErrorInfo.pl,v 1.32 2015-02-02 18:57:30 dcrowell Exp $ # Purpose: This perl script will parse HWP Error XML files and create required # FAPI code. # @@ -565,7 +566,14 @@ foreach my $argnum (1 .. $#ARGV) if (($callout->{hw}->{hwid} eq "TOD_CLOCK") || ($callout->{hw}->{hwid} eq "MEM_REF_CLOCK") || ($callout->{hw}->{hwid} eq "PROC_REF_CLOCK") || - ($callout->{hw}->{hwid} eq "PCI_REF_CLOCK")) + ($callout->{hw}->{hwid} eq "PCI_REF_CLOCK") || + ($callout->{hw}->{hwid} eq "FLASH_CONTROLLER_PART") || + ($callout->{hw}->{hwid} eq "PNOR_PART") || + ($callout->{hw}->{hwid} eq "SBE_SEEPROM_PART") || + ($callout->{hw}->{hwid} eq "VPD_PART") || + ($callout->{hw}->{hwid} eq "LPC_SLAVE_PART") || + ($callout->{hw}->{hwid} eq "GPIO_EXPANDER_PART") || + ($callout->{hw}->{hwid} eq "SPIVID_SLAVE_PART")) { if (! exists $callout->{hw}->{refTarget}) { diff --git a/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml b/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml index 2847d7f81..c622508b3 100644..100755 --- a/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml +++ b/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml @@ -5,7 +5,9 @@ <!-- --> <!-- OpenPOWER HostBoot Project --> <!-- --> -<!-- COPYRIGHT International Business Machines Corp. 2011,2014 --> +<!-- Contributors Listed Below - COPYRIGHT 2011,2015 --> +<!-- [+] 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. --> @@ -20,7 +22,7 @@ <!-- permissions and limitations under the License. --> <!-- --> <!-- IBM_PROLOG_END_TAG --> -<!-- $Id: fapiHwpErrorInfo.xml,v 1.16 2014/03/20 20:19:37 mjjones Exp $ --> +<!-- $Id: fapiHwpErrorInfo.xml,v 1.17 2015-02-02 18:40:42 dcrowell Exp $ --> <!-- XML file specifying Test HW Procedure generated errors. --> <hwpErrors> @@ -177,7 +179,14 @@ </hw> <priority>MEDIUM</priority> </callout> - --> + <callout> + <hw> + <hwid>PNOR_PART</hwid> + <refTarget>UNIT_TEST_CHIP_TARGET</refTarget> + </hw> + <priority>MEDIUM</priority> + </callout> +--> </hwpError> <hwpError> diff --git a/src/usr/hwpf/plat/fapiPlatHwpInvoker.C b/src/usr/hwpf/plat/fapiPlatHwpInvoker.C index 7bf801828..952f44982 100644 --- a/src/usr/hwpf/plat/fapiPlatHwpInvoker.C +++ b/src/usr/hwpf/plat/fapiPlatHwpInvoker.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -105,6 +105,54 @@ HWAS::clockTypeEnum xlateClockHwCallout( } /** + * @brief Translates a FAPI Part HW callout to an HWAS part callout + * + * @param[i] i_fapiPart FAPI part HW callout + * + * @return HWAS part HW callout + */ +HWAS::partTypeEnum xlatePartHwCallout( + const fapi::HwCallouts::HwCallout i_fapiPart) +{ + // Use the HwCallout enum value as an index + HWAS::partTypeEnum l_part; + + // clock xlate function above assumes indexes match + // between 2 enums. seems better to do it explicitly + + switch (i_fapiPart) + { + case HwCallouts::FLASH_CONTROLLER_PART: + l_part = HWAS::FLASH_CONTROLLER_PART_TYPE; + break; + case HwCallouts::PNOR_PART: + l_part = HWAS::PNOR_PART_TYPE; + break; + case HwCallouts::SBE_SEEPROM_PART: + l_part = HWAS::SBE_SEEPROM_PART_TYPE; + break; + case HwCallouts::VPD_PART: + l_part = HWAS::VPD_PART_TYPE; + break; + case HwCallouts::LPC_SLAVE_PART: + l_part = HWAS::LPC_SLAVE_PART_TYPE; + break; + case HwCallouts::GPIO_EXPANDER_PART: + l_part = HWAS::GPIO_EXPANDER_PART_TYPE; + break; + case HwCallouts::SPIVID_SLAVE_PART: + l_part = HWAS::SPIVID_SLAVE_PART_TYPE; + break; + + default: + FAPI_ERR("fapi::xlatePartHwCallout: Unknown part", + i_fapiPart); + l_part = HWAS::NO_PART_TYPE; + } + + return l_part; +} +/** * @brief Translates a FAPI procedure callout to an HWAS procedure callout * * @param[i] i_fapiProc FAPI procedure callout @@ -265,9 +313,28 @@ void processEIHwCallouts(const ErrorInfo & i_errInfo, l_clock, l_priority); io_pError->addClockCallout(l_pRefTarget, l_clock, l_priority); } + else if ( (l_hw == HwCallouts::FLASH_CONTROLLER_PART) || + (l_hw == HwCallouts::PNOR_PART) || + (l_hw == HwCallouts::SBE_SEEPROM_PART) || + (l_hw == HwCallouts::VPD_PART) || + (l_hw == HwCallouts::LPC_SLAVE_PART) || + (l_hw == HwCallouts::GPIO_EXPANDER_PART) || + (l_hw == HwCallouts::SPIVID_SLAVE_PART) ) + { + HWAS::partTypeEnum l_part = + xlatePartHwCallout((*l_itr)->iv_hw); + + FAPI_ERR("processEIHwCallouts: Adding part-callout" + " (part:%d, pri:%d)", + l_part, l_priority); + io_pError->addPartCallout(l_pRefTarget, l_part, l_priority); + } else { FAPI_ERR("processEIHwCallouts: Unsupported HW callout (%d)", l_hw); + io_pError->addPartCallout(l_pRefTarget, HWAS::NO_PART_TYPE, + l_priority); + io_pError->addProcedureCallout( HWAS::EPUB_PRC_HB_CODE, l_priority); } } } diff --git a/src/usr/hwpf/test/fapiRcTest.C b/src/usr/hwpf/test/fapiRcTest.C index abed12a5c..d5c291400 100644..100755 --- a/src/usr/hwpf/test/fapiRcTest.C +++ b/src/usr/hwpf/test/fapiRcTest.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -22,8 +22,7 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: fapiRcTest.C,v 1.10 2014/10/27 17:55:42 baiocchi Exp $ -// $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/hwpf/working/fapiTest/fapiRcTest.C,v $ +// $Id: fapiRcTest.C,v 1.15 2015-02-02 19:14:33 dcrowell Exp $ /** * @file fapiTargetTest.C * @@ -41,9 +40,14 @@ * mjjones 08/14/2012 Use new ErrorInfo structures * mjjones 03/28/2013 Added proc-callout tests * mjjones 03/28/2013 Added children-cdg tests + * sangeet2 29/01/2015 Added testcase rcTest18 */ #include <fapi.H> +#include <fapiPlatHwpInvoker.H> +#ifdef fips +#include <srcisrc.H> +#endif namespace fapi { @@ -623,7 +627,7 @@ uint32_t rcTest12() // Add error information to the ReturnCode, the data is the same as that // produced by the fapiParseErrorInfo.pl script in fapiHwpErrorInfo.H const void * l_objects[] = {&l_ffdc, &l_target, &l_target2}; - fapi::ReturnCode::ErrorInfoEntry l_entries[6]; + fapi::ReturnCode::ErrorInfoEntry l_entries[7]; l_entries[0].iv_type = fapi::ReturnCode::EI_TYPE_FFDC; l_entries[0].ffdc.iv_ffdcObjIndex = 0; l_entries[0].ffdc.iv_ffdcId = 0x22334455; @@ -656,7 +660,12 @@ uint32_t rcTest12() l_entries[5].hw_callout.iv_hw = fapi::HwCallouts::MEM_REF_CLOCK; l_entries[5].hw_callout.iv_calloutPriority = fapi::CalloutPriorities::LOW; l_entries[5].hw_callout.iv_refObjIndex = 0xff; - l_rc.addErrorInfo(l_objects, l_entries, 6); + l_entries[6].iv_type = fapi::ReturnCode::EI_TYPE_HW_CALLOUT; + l_entries[6].hw_callout.iv_hw = fapi::HwCallouts::FLASH_CONTROLLER_PART; + l_entries[6].hw_callout.iv_calloutPriority = fapi::CalloutPriorities::LOW; + l_entries[6].hw_callout.iv_refObjIndex = 0xff; + + l_rc.addErrorInfo(l_objects, l_entries, 7); do { @@ -874,7 +883,7 @@ uint32_t rcTest12() break; } - if (l_pErrInfo->iv_hwCallouts.size() != 1) + if (l_pErrInfo->iv_hwCallouts.size() != 2) { FAPI_ERR("rcTest12. %d hw-callouts", l_pErrInfo->iv_hwCallouts.size()); @@ -1615,4 +1624,128 @@ uint32_t rcTest17() return l_result; } +#ifdef fips +uint32_t rcTest18() +{ + uint32_t l_result = 0; + + // Create a FAPI ReturnCode + ReturnCode l_rc(FAPI_RC_INVALID_ATTR_GET); + + // Create Target of functional processor chip + TARGETING::Target *l_proc = NULL; + + // Use PredicateIsFunctional (formerly HwasPredicate) to filter + // only functional chips + TARGETING::PredicateIsFunctional l_isFunctional; + do + { + + // filter for functional Proc Chips + TARGETING::PredicateCTM l_procChipFilter(TARGETING::CLASS_CHIP, + TARGETING::TYPE_PROC ); + + // declare a postfix expression + TARGETING::PredicatePostfixExpr l_functionalAndProcChipFilter; + + // is-a-proc-chip is-functional AND + l_functionalAndProcChipFilter.push(&l_procChipFilter). + push(&l_isFunctional).And(); + + // loop through all the targets, applying the filter, + // and put the results in l_pFuncProc + TARGETING::TargetRangeFilter l_pFuncProcFilter( + TARGETING::targetService().begin(), + TARGETING::targetService().end(), + &l_functionalAndProcChipFilter); + + // Get a pointer to that first function proc + if(!l_pFuncProcFilter) + { + l_result = 1; + FAPI_ERR("rcTest18:No functional processors found"); + break; + } + + l_proc = *l_pFuncProcFilter; + TARGETING::Target* l_pConstTarget = + const_cast<TARGETING::Target*>(l_proc); + + fapi::Target l_fapiTarget(fapi::TARGET_TYPE_PROC_CHIP, + reinterpret_cast<void*>(l_pConstTarget)); + + const void * l_objects[] = { &l_fapiTarget}; + fapi::ReturnCode::ErrorInfoEntry l_entries[1]; + l_entries[0].iv_type = fapi::ReturnCode::EI_TYPE_CDG; + l_entries[0].target_cdg.iv_targetObjIndex = 0; + l_entries[0].target_cdg.iv_callout = 0; + l_entries[0].target_cdg.iv_deconfigure = 0; + l_entries[0].target_cdg.iv_gard = 1; + l_entries[0].target_cdg.iv_calloutPriority = + fapi::CalloutPriorities::LOW; + + + // Add the error info + l_rc.addErrorInfo(l_objects, l_entries, 1); + + // Check that the Error Info can be retrieved + const ErrorInfo * l_pErrInfo = NULL; + l_pErrInfo = l_rc.getErrorInfo(); + + if (l_pErrInfo == NULL) + { + FAPI_ERR("rcTest18:getErrorInfo returned NULL"); + l_result = 2; + break; + } + + // Check the callout/deconfigure/GARD error information + if (l_pErrInfo->iv_CDGs[0]->iv_target != l_fapiTarget) + { + FAPI_ERR("rcTest18:CDG[0] target mismatch"); + l_result = 3; + break; + } + + if (l_pErrInfo->iv_CDGs[0]->iv_gard == false) + { + FAPI_ERR("rcTest18:CDG[0] gard not set"); + l_result = 4; + break; + } + + // fapiRcToErrl is implicitly calling processEICDGs + errlHndl_t pError = fapiRcToErrl(l_rc); + if(pError == NULL) + { + FAPI_ERR("rcTest18:fapiRcToErrl returnd No Errorlog handle"); + l_result = 5; + break; + } + + srciIdx_t l_calloutCnt = 0; + const SrciSrc* pSRC = pError->getSRC(); + pSRC->Callouts(l_calloutCnt); + if(l_calloutCnt < 1) + { + l_result = 6; + FAPI_ERR("Error. No Callout from fapiRcToErrl"); + break; + } + + // TODO RTC 79353 + // Garded Target must be UnGard here. + + FAPI_INF("rcTest18:Deconfig/Gard HWP callout TC success"); + if(pError != NULL) + { + delete pError; + pError = NULL; + } + + }while(0); + return l_result; +} +#endif //fips + } |