From ae6df59506b64974d5fb330d2800370a3e93c0b0 Mon Sep 17 00:00:00 2001 From: "Sunil.Kumar" Date: Tue, 26 Jul 2016 08:36:33 -0500 Subject: RTC 128326 SBE : SBE ChipOps : Generic Messages : Get SBE FFDC Change-Id: I034a43f67244a6f5e50c54b10f8bd4e013c6076a Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/27610 Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Reviewed-by: RAJA DAS Reviewed-by: Sachin Gupta Reviewed-by: AMIT J. TENDOLKAR --- src/sbefw/sbeFFDC.C | 14 +++++--- src/sbefw/sbeFFDC.H | 8 ++++- src/sbefw/sbeFifoMsgUtils.C | 2 +- src/sbefw/sbecmdgeneric.C | 54 +++++++++++++++++++++++++++++++ src/sbefw/sbecmdgeneric.H | 9 ++++++ src/sbefw/sbecmdparser.C | 6 ++++ src/test/testcases/testGeneric.xml | 5 +++ src/test/testcases/testGetCapabilities.py | 3 +- src/test/testcases/testSbeDump.py | 26 +++++++-------- 9 files changed, 106 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/sbefw/sbeFFDC.C b/src/sbefw/sbeFFDC.C index 88bee00d..3a8e24e7 100644 --- a/src/sbefw/sbeFFDC.C +++ b/src/sbefw/sbeFFDC.C @@ -6,6 +6,7 @@ /* OpenPOWER sbe Project */ /* */ /* Contributors Listed Below - COPYRIGHT 2016 */ +/* [+] International Business Machines Corp. */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -36,17 +37,20 @@ * @param[in] i_secStatus - Secondary status of Chip op * @param[in] i_fieldsConfig - bitmap indicating the field * to be sent in FFDC - * * @param[out] o_bytesSent -number of bytes sent * + * @param[in] i_skipffdcBitCheck - Boolean to indicate whether + * ffdc bit should be checked or not. + * By default it is false. * @return - SBE secondary RC */ uint32_t SbeFFDCPackage::sendOverFIFO(uint32_t i_primStatus, uint32_t i_secStatus, uint32_t i_fieldsConfig, - uint32_t &o_bytesSent) + uint32_t &o_bytesSent, + bool i_skipffdcBitCheck) { - #define SBE_FUNC "sbeSendFFDCPackageFIFO " + #define SBE_FUNC "sendOverFIFO" SBE_ENTER(SBE_FUNC); uint32_t rc = SBE_SEC_OPERATION_SUCCESSFUL; uint32_t length = 0; @@ -57,7 +61,9 @@ uint32_t SbeFFDCPackage::sendOverFIFO(uint32_t i_primStatus, o_bytesSent = 0; //check if SBE internal FFDC should be generated - if(SbeRegAccess::theSbeRegAccess().isSendInternalFFDCSet() == false) + if(!i_skipffdcBitCheck && + (SbeRegAccess::theSbeRegAccess().isSendInternalFFDCSet() + == false)) { SBE_INFO(SBE_FUNC" isSendInternalFFDCSet()=false, " "not generating SBE InternalFFDC"); diff --git a/src/sbefw/sbeFFDC.H b/src/sbefw/sbeFFDC.H index 514b9caf..995840a8 100644 --- a/src/sbefw/sbeFFDC.H +++ b/src/sbefw/sbeFFDC.H @@ -6,6 +6,7 @@ /* OpenPOWER sbe Project */ /* */ /* Contributors Listed Below - COPYRIGHT 2016 */ +/* [+] International Business Machines Corp. */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -95,12 +96,17 @@ public: * * @param[out] o_bytesSent -number of bytes sent * + * @param[in] i_skipffdciBitCheck + * - boolean to indicate whether + * ffdc bit should be checked or not. + * By Default it is false. * @return - SBE secondary RC */ uint32_t sendOverFIFO(uint32_t i_primStatus, uint32_t i_secStatus, uint32_t i_fieldsConfig, - uint32_t &o_bytesSent); + uint32_t &o_bytesSent, + bool i_skipffdcBitCheck = false); /* TODO via RTC:150786 * @brief sendOverHOST - method to pack and send SBE internal FFDC diff --git a/src/sbefw/sbeFifoMsgUtils.C b/src/sbefw/sbeFifoMsgUtils.C index 6edc341e..4525d20f 100644 --- a/src/sbefw/sbeFifoMsgUtils.C +++ b/src/sbefw/sbeFifoMsgUtils.C @@ -338,7 +338,7 @@ uint32_t sbeDsSendRespHdr(const sbeRespGenHdr_t &i_hdr, distance += len; // If no ffdc , exit; - if( (i_ffdc != NULL) && i_ffdc->getRc() ) + if( (i_ffdc != NULL) && (i_ffdc->getRc() != FAPI2_RC_SUCCESS)) { // making sure ffdc length is multiples of uint32_t assert((g_FfdcData.ffdcLength % sizeof(uint32_t)) == 0); diff --git a/src/sbefw/sbecmdgeneric.C b/src/sbefw/sbecmdgeneric.C index 88e79d01..31165e50 100644 --- a/src/sbefw/sbecmdgeneric.C +++ b/src/sbefw/sbecmdgeneric.C @@ -6,6 +6,7 @@ /* OpenPOWER sbe Project */ /* */ /* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* [+] International Business Machines Corp. */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -34,6 +35,7 @@ #include "sbe_sp_intf.H" #include "sbe_build_info.H" #include "sbeFifoMsgUtils.H" +#include "sbeFFDC.H" // Forward declaration sbeCapabilityRespMsg::sbeCapabilityRespMsg() @@ -47,6 +49,8 @@ sbeCapabilityRespMsg::sbeCapabilityRespMsg() { capability[idx] = 0; } + // @TODO via RTC : 160602 + // Update Capability flags based on lastes spec. capability[IPL_CAPABILITY_START_IDX] = EXECUTE_ISTEP_SUPPPORTED; @@ -57,6 +61,7 @@ sbeCapabilityRespMsg::sbeCapabilityRespMsg() PUT_SCOM_UNDER_MASK_SUPPPORTED ; capability[GENERIC_CHIPOP_CAPABILITY_START_IDX] = + GET_SBE_FFDC_SUPPPORTED | GET_SBE_CAPABILITIES_SUPPPORTED; capability[MEMORY_CAPABILITY_START_IDX] = @@ -115,3 +120,52 @@ uint32_t sbeGetCapabilities (uint8_t *i_pArg) return rc; #undef SBE_FUNC } + + +// Functions +//---------------------------------------------------------------------------- +uint32_t sbeGetFfdc (uint8_t *i_pArg) +{ + #define SBE_FUNC "sbeGetFfdc " + SBE_DEBUG(SBE_FUNC); + uint32_t rc = SBE_SEC_OPERATION_SUCCESSFUL; + uint32_t len = 0; + sbeRespGenHdr_t respHdr; + respHdr.init(); + + do + { + // Dequeue the EOT entry as no more data is expected. + rc = sbeUpFifoDeq_mult (len, NULL); + + if ( rc != SBE_SEC_OPERATION_SUCCESSFUL ) + { + // Let command processor routine to handle the RC + break; + } + + SbeFFDCPackage sbeFfdcPack; + len = 0; + //Send the FFDC data over FIFO. + // @TODO via RTC : 149074 + // primary and secondary status should be picked + // from the globals. + rc = sbeFfdcPack.sendOverFIFO(respHdr.primaryStatus, + respHdr.secondaryStatus, + SBE_FFDC_ALL_DUMP,len, + true); + if (rc) + { + break; + } + rc = sbeDsSendRespHdr(respHdr); + + }while(0); + + if( rc ) + { + SBE_ERROR( SBE_FUNC"Failed. rc[0x%X]", rc); + } + return rc; + #undef SBE_FUNC +} diff --git a/src/sbefw/sbecmdgeneric.H b/src/sbefw/sbecmdgeneric.H index 3fa174ad..451731ab 100644 --- a/src/sbefw/sbecmdgeneric.H +++ b/src/sbefw/sbecmdgeneric.H @@ -6,6 +6,7 @@ /* OpenPOWER sbe Project */ /* */ /* Contributors Listed Below - COPYRIGHT 2016 */ +/* [+] International Business Machines Corp. */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -33,6 +34,14 @@ #include +/** + * @brief retrieve SBE FFDC on request from FSP. (0xA801) + * + * @param[in] i_pArg Buffer to be passed to the function (not used as of now) + * + * @return Rc from the FIFO access utility + */ +uint32_t sbeGetFfdc(uint8_t *i_pArg); /** * @brief SBE Generic capabilities (0xA802) diff --git a/src/sbefw/sbecmdparser.C b/src/sbefw/sbecmdparser.C index c22e67c7..b3398f40 100644 --- a/src/sbefw/sbecmdparser.C +++ b/src/sbefw/sbecmdparser.C @@ -6,6 +6,7 @@ /* OpenPOWER sbe Project */ /* */ /* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* [+] International Business Machines Corp. */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -114,6 +115,11 @@ static sbeCmdStruct_t g_sbeGenericCmdArray [] = SBE_STATE_FFDC_COLLECT, // Fence in FFDC Collect State, since it might over-write traces }, + + {sbeGetFfdc, + SBE_CMD_GET_SBE_FFDC, + SBE_NO_FENCE, + }, }; ////////////////////////////////////////////////////////////// diff --git a/src/test/testcases/testGeneric.xml b/src/test/testcases/testGeneric.xml index 85ce990a..7609f707 100755 --- a/src/test/testcases/testGeneric.xml +++ b/src/test/testcases/testGeneric.xml @@ -6,6 +6,7 @@ + @@ -28,3 +29,7 @@ run-python-file targets/p9_nimbus/sbeTest/testGetCapabilities.py yes + + run-python-file targets/p9_nimbus/sbeTest/testSbeDump.py + yes + diff --git a/src/test/testcases/testGetCapabilities.py b/src/test/testcases/testGetCapabilities.py index 4a61d761..006d17c2 100755 --- a/src/test/testcases/testGetCapabilities.py +++ b/src/test/testcases/testGetCapabilities.py @@ -6,6 +6,7 @@ # OpenPOWER sbe Project # # Contributors Listed Below - COPYRIGHT 2015,2016 +# [+] International Business Machines Corp. # # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -47,7 +48,7 @@ EXPDATA2 = [0xa4,0x0,0x0,0x0f, #GetMemPba/PutMemPba/GetSramOcc/PutSramOcc 0xa7,0x0,0x0,0x1, # control Instruction 0x00,0x0,0x0,0x0]; -EXPDATA3 = [0xa8,0x0,0x0,0x02, #getcapability +EXPDATA3 = [0xa8,0x0,0x0,0x03, #getcapability/getSbeFFDC 0x0,0x0,0x0,0x0, 0xc0,0xde,0xa8,0x02, 0x0,0x0,0x0,0x0, diff --git a/src/test/testcases/testSbeDump.py b/src/test/testcases/testSbeDump.py index 7d7a7d77..184a70e8 100644 --- a/src/test/testcases/testSbeDump.py +++ b/src/test/testcases/testSbeDump.py @@ -6,6 +6,7 @@ # OpenPOWER sbe Project # # Contributors Listed Below - COPYRIGHT 2016 +# [+] International Business Machines Corp. # # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,11 +28,12 @@ import testUtil err = False #from testWrite import * -TESTDATA = [0, 0, 0, 3, - 0, 0, 0xA1, 0x01, - 0, 0x02, 0x00, 0x2] +TESTDATA = [0, 0, 0, 2, + 0, 0, 0xA8, 0x01] -EXPDATA = [0xc0, 0xde, 0xa1, 0x01] +EXPDATA = [0xc0, 0xde, 0xa8, 0x01, + 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x3] # MAIN Test Run Starts Here... #------------------------------------------------- @@ -39,15 +41,7 @@ def main(): testUtil.runCycles(10000000) testUtil.writeUsFifo(TESTDATA) testUtil.writeEot() - testUtil.readDsFifo(EXPDATA) - #flush out primary and secondary status - data = testUtil.readDsEntryReturnVal() - - #flush hwp ffdc - data = testUtil.readDsEntryReturnVal() - data = testUtil.readDsEntryReturnVal() - #start processing sbe ffdc data = testUtil.readDsEntryReturnVal() magicBytes = ((data[0] << 8) | data[1]) if (magicBytes == 0xFFDC) : @@ -94,8 +88,12 @@ def main(): myBin.write(bytearray(data)) print("write to a file Done") myBin.close() - #flush out distance - data = testUtil.readDsEntryReturnVal() + + #Read the Exp data + print ("Read the Expected data") + testUtil.readDsFifo( EXPDATA ) + testUtil.readEot( ) + #------------------------------------------------- # Calling all test code #------------------------------------------------- -- cgit v1.2.1