diff options
author | Dzuy Nguyen <dzuy@us.ibm.com> | 2017-04-19 09:43:12 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-05-07 22:26:57 -0400 |
commit | 05404541b9c109750d1d9d43da72360a2741ef7a (patch) | |
tree | f81fabdafe6fa8362c48f268e20086dc71d9b54c /src | |
parent | 7cc792339c253a71c7eeadc0b56fcc4eeb88f41c (diff) | |
download | blackbird-hostboot-05404541b9c109750d1d9d43da72360a2741ef7a.tar.gz blackbird-hostboot-05404541b9c109750d1d9d43da72360a2741ef7a.zip |
SBE FIFO FFDC parser plugin
RTC: 168620
Change-Id: If1e099411f5b5b12be1a3832ad818c2019f4dadb
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/39432
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Martin Gloff <mgloff@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/include/usr/sbeio/sbe_ffdc_parser.H | 6 | ||||
-rw-r--r-- | src/include/usr/sbeio/sbeioreasoncodes.H | 7 | ||||
-rw-r--r-- | src/usr/isteps/istep08/call_proc_check_slave_sbe_seeprom_complete.C | 2 | ||||
-rw-r--r-- | src/usr/sbeio/plugins/SBEIO_COMP_ID_Parse.C | 28 | ||||
-rw-r--r-- | src/usr/sbeio/plugins/sbeIoErrlUd.H | 346 | ||||
-rw-r--r-- | src/usr/sbeio/plugins/sbeIoFfdcType.H | 102 | ||||
-rw-r--r-- | src/usr/sbeio/plugins/sbeIoUdParserFactory.H | 52 | ||||
-rw-r--r-- | src/usr/sbeio/sbe_ffdc_parser.C | 18 | ||||
-rw-r--r-- | src/usr/sbeio/sbe_fifodd.C | 66 |
9 files changed, 598 insertions, 29 deletions
diff --git a/src/include/usr/sbeio/sbe_ffdc_parser.H b/src/include/usr/sbeio/sbe_ffdc_parser.H index ce81f25ee..5ca5dbcc8 100644 --- a/src/include/usr/sbeio/sbe_ffdc_parser.H +++ b/src/include/usr/sbeio/sbe_ffdc_parser.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2016 */ +/* Contributors Listed Below - COPYRIGHT 2012,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -92,7 +92,7 @@ class SbeFFDCParser * @retval: length of data stored * @param[in] i_index index number */ - uint8_t getPackageLength(uint8_t i_index); + uint32_t getPackageLength(uint8_t i_index); private: @@ -117,7 +117,7 @@ class SbeFFDCParser */ void addFFDCPackage(void * i_ffdcPackage, uint32_t i_rc, - uint8_t i_packageLen); + uint32_t i_packageLen); }; diff --git a/src/include/usr/sbeio/sbeioreasoncodes.H b/src/include/usr/sbeio/sbeioreasoncodes.H index 4064ce594..9b845096f 100644 --- a/src/include/usr/sbeio/sbeioreasoncodes.H +++ b/src/include/usr/sbeio/sbeioreasoncodes.H @@ -101,6 +101,13 @@ enum sbeioReasonCode SBEIO_HWSV_COLLECT_SBE_RC = SBEIO_COMP_ID | 0xFF, }; +enum UserDetailsTypes +{ + SBEIO_UDT_NO_FORMAT = 0x0, + SBEIO_UDT_PARAMETERS = 0x1, +}; + + }; // end SBE #endif diff --git a/src/usr/isteps/istep08/call_proc_check_slave_sbe_seeprom_complete.C b/src/usr/isteps/istep08/call_proc_check_slave_sbe_seeprom_complete.C index c73b76bee..30e5fcca7 100644 --- a/src/usr/isteps/istep08/call_proc_check_slave_sbe_seeprom_complete.C +++ b/src/usr/isteps/istep08/call_proc_check_slave_sbe_seeprom_complete.C @@ -338,8 +338,8 @@ void* call_proc_check_slave_sbe_seeprom_complete( void *io_pArgs ) l_cpu_target->setAttr<TARGETING::ATTR_HDAT_EC>(l_newHdatEC); } } - } // end of going through all processors + } // end of going through all processors TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, "call_proc_check_slave_sbe_seeprom_complete exit"); diff --git a/src/usr/sbeio/plugins/SBEIO_COMP_ID_Parse.C b/src/usr/sbeio/plugins/SBEIO_COMP_ID_Parse.C new file mode 100644 index 000000000..fe90044ad --- /dev/null +++ b/src/usr/sbeio/plugins/SBEIO_COMP_ID_Parse.C @@ -0,0 +1,28 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/sbeio/plugins/SBEIO_COMP_ID_Parse.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016,2017 */ +/* [+] 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. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +#include "errludparser.H" +#include "sbeIoUdParserFactory.H" + +ERRL_MAKE_UD_PARSER(SBEIO::UserDetailsParserFactory, hbfw::SBEIO_COMP_ID) diff --git a/src/usr/sbeio/plugins/sbeIoErrlUd.H b/src/usr/sbeio/plugins/sbeIoErrlUd.H new file mode 100644 index 000000000..2ff677890 --- /dev/null +++ b/src/usr/sbeio/plugins/sbeIoErrlUd.H @@ -0,0 +1,346 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/sbeio/plugins/sbeIoErrlUd.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,2017 */ +/* [+] 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. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef SBEIO_ERRL_UDP_H +#define SBEIO_ERRL_UDP_H + +/** + * @file sbeIoErrlUd.H + * + * Defines the ErrlUserDetailsParser classes that parse SBEIO FFDC + */ + +#include <utilmem.H> +#include "sbeIoFfdcType.H" +#include "errluserdetails.H" + +#include <sys/stat.h> +#include <errno.h> + +#include <cstdlib> +#include <cstring> +#include <sstream> + +#include <utilfile.H> +#include <utilmem.H> + +#define SBE_TEMP_DUMP_FILE "/tmp/trace_dump.bin" +#define SBE_TRACE_BIN "/tmp/sbe_trace.bin" +#define PPE2FSP_TOOL "ppe2fsp" +#define P9_XIP_TOOL "p9_xip_tool" +#define SBE_TRACE_CMD "fsp-trace -s" +#define SBE_TRACE_HEADLINE "SBE Traces" +#define SBE_ATTR_DUMP_HEADLINE "SBE Attributes Dump" +#define P9_XIP_ATTR_CMD "-ifs attrdump" +#define SBE_STRING_FILE "sbeStringFile" +#define SBE_SEEPROM_BIN "sbe_seeprom.bin" + +#define SBE_PARSER_PRINT_DELIMITER {std::cout << \ +"*****************************************************************************"\ +<< std::endl;} +#define SBE_PARSER_PRINT_HEADING(x) { SBE_PARSER_PRINT_DELIMITER \ +std::cout << \ +" "x<< std::endl;\ +SBE_PARSER_PRINT_DELIMITER } + + +#define SBEIO_PARSER_MAX_LOCAL_BUFFER 8192 + +namespace SBEIO +{ + +/** + * @class SbeIoFfdcErrlParser + * + */ +class SbeIoFfdcErrlParser : public ERRORLOG::ErrlUserDetailsParser +{ +public: + /** + * @brief Constructor + */ + SbeIoFfdcErrlParser() {} + + /** + * @brief Destructor + */ + virtual ~SbeIoFfdcErrlParser() {} + + /** + * @brief Parses string user detail data from an error log + * + * @param i_version Version of the data + * @param i_parse ErrlUsrParser object for outputting information + * @param i_pBuffer Pointer to buffer containing detail data + * @param i_buflen Length of the buffer + */ + + virtual void parse(errlver_t i_version, + ErrlUsrParser & i_parser, + void * i_pBuffer, + const uint32_t i_buflen) const + { + int l_rc = 0; + uint32_t fapiRc = 0; + sbeIoFfdcDataHeader_t l_pData = {0}; + char l_buffer[SBEIO_PARSER_MAX_LOCAL_BUFFER] = {0}; + char *l_pBuffer = (char*)i_pBuffer; + uint32_t l_buflen = i_buflen; + + do + { + if(i_pBuffer == NULL) + { + l_rc = -1; + break; + } + //seek l_mem to the binary blob of FFDC package + UtilMem l_mem(const_cast<void*>(i_pBuffer),i_buflen); + + // The data is a buffer of SBEIO FFDC data + i_parser.PrintHeading("SBEIO FFDC Parser"); + + if(l_buflen < sizeof(fapiRc)) + { + i_parser.PrintHexDump(l_pBuffer, l_buflen); + break; + } + l_buflen -= sizeof(fapiRc); + l_pBuffer += sizeof(fapiRc); + l_mem >> fapiRc; + + i_parser.PrintNumber("FAPI RC ", "0x%08X", fapiRc); + + if(l_buflen < sizeof(l_pData)) + { + i_parser.PrintHexDump(l_pBuffer, l_buflen); + break; + } + l_buflen -= sizeof(l_pData); + l_pBuffer += sizeof(l_pData); + l_mem >> l_pData; + + i_parser.PrintNumber("Primary Status ", "0x%04X", + (uint16_t)l_pData.primaryStatus); + i_parser.PrintNumber("Secondary Status ", "0x%04X", + (uint16_t)l_pData.secondaryStatus); + i_parser.PrintNumber("FW Commit ID ", "0x%08X", + (uint32_t)l_pData.fwCommitID); + + //loop through the number of fields configured + uint32_t l_dumpFields = l_pData.dumpFields.get(); + while(l_dumpFields && !l_rc) + { + if(l_dumpFields & 0x0001) + { + if(l_buflen < sizeof(uint32_t)) + { + //Complete this loop and let the tools print as much data + //as possible but break from next loop + l_rc = -1; + } + sbeIoFfdcUserDataIdentifier_t l_ffdcUserDataId = {0}; + l_buflen -= sizeof(uint32_t); //l_ffdcUserDataId + l_pBuffer += sizeof(uint32_t); //l_ffdcUserDataId + + l_mem >> l_ffdcUserDataId; + + if((l_buflen < l_ffdcUserDataId.fieldLen) && + (l_ffdcUserDataId.fieldId != SBEIO_FFDC_TRACE_DUMP)) + { + i_parser.PrintHexDump(l_pBuffer, l_buflen); + break; + } + + l_buflen -= l_ffdcUserDataId.fieldLen; + l_pBuffer += l_ffdcUserDataId.fieldLen; + + l_mem.read(l_buffer, l_ffdcUserDataId.fieldLen); + std::ostringstream l_strFile; + //Generate temp dump file name + l_strFile << SBE_TEMP_DUMP_FILE; + + //Write dump into the temporary file + UtilFile l_fileObj(l_strFile.str().c_str()); + errlHndl_t l_errlHndl = l_fileObj.open("w"); + if ( l_errlHndl ) + { + std::cerr << "Error opening " + << l_strFile.str() << std::endl; + l_errlHndl->commit(HWSV_COMP_ID, ERRL_ACTION_REPORT); + delete l_errlHndl; + l_errlHndl = NULL; + i_parser.PrintHexDump(l_buffer, l_ffdcUserDataId.fieldLen); + return; + } + else + { + l_fileObj.write( l_buffer, l_ffdcUserDataId.fieldLen); + l_fileObj.Close(); + } + + //Specific handling + if(l_ffdcUserDataId.fieldId == SBEIO_FFDC_ATTR_DUMP) + { + SBE_PARSER_PRINT_HEADING(SBE_ATTR_DUMP_HEADLINE) + //command + std::ostringstream l_strCmd1; + // p9_xip_tool <sbe seeprom bin file> + // -ifs attrdump <attr dump file> 2>&1 + l_strCmd1 << findSbeFile(P9_XIP_TOOL) + << " " + << findSbeFile(SBE_SEEPROM_BIN) + << " " + << P9_XIP_ATTR_CMD + << " " + << l_strFile.str().c_str() + << " " + << "2>&1"; + + //Call out the command + sbeParserSysCall( l_strCmd1.str().c_str() ); + } + else if(l_ffdcUserDataId.fieldId == SBEIO_FFDC_TRACE_DUMP) + { + SBE_PARSER_PRINT_HEADING(SBE_TRACE_HEADLINE) + //command + std::ostringstream l_strCmd1, l_strCmd2; + // ppe2fsp <trace dump file> <trace bin file> 2>&1 + l_strCmd1 << findSbeFile(PPE2FSP_TOOL) + << " " + << l_strFile.str().c_str() + << " " + << SBE_TRACE_BIN + << " " + << "2>&1"; + + // fsp-trace -s <sbe string file> <trace bin file> 2>&1 + l_strCmd2 << SBE_TRACE_CMD + << " " + << findSbeFile(SBE_STRING_FILE) + << " " + << SBE_TRACE_BIN + << " " + << "2>&1"; + + //Call out the commands + sbeParserSysCall( l_strCmd1.str().c_str() ); + sbeParserSysCall( l_strCmd2.str().c_str() ); + } + + //Delete the temp file + l_fileObj.Remove(); + } + l_dumpFields >>= 1; + if(l_rc != 0) + { + break; + } + } + } while(false); + + } + +private: + // Disabled + SbeIoFfdcErrlParser(const SbeIoFfdcErrlParser&); + SbeIoFfdcErrlParser & operator=(const SbeIoFfdcErrlParser&); + + std::string findSbeFile(const char *name) const + { + #ifdef CONTEXT_x86_nfp + std::string tmp = getenv("bb"); + tmp += "obj/x86.nfp/sbei/sbfw/img/"; + std::string file = tmp + name; + + struct stat l_stat; + if(stat(file.c_str(), &l_stat) < 0) + { + //Can't find the file + } + + return file; + #endif + #ifdef CONTEXT_ppc + std::string tmp = getenv("PATH"); + tmp += ":/nfs:/maint"; + + char *path = strdup(tmp.c_str()); + char *dir = NULL; + + std::string file; + + struct stat l_stat; + + for(dir = strtok( path, ":" ); dir; dir = strtok(NULL, ":")) + { + file = file + dir + "/" + name; + + if(stat(file.c_str(), &l_stat) < 0) + { + // String file not found, go to next one + file.clear(); + } + else + { + // update where trexStringFile is + break; + } + } + + free(path); + path = NULL; //sm05c + + return file; + #endif + } + + void sbeParserSysCall(const char *cmd) const + { + FILE *stream; + char buffer[256]; + + stream = popen(cmd, "r" ); + if(stream) + { + while(!feof(stream)) + { + if(fgets(buffer, 256, stream) != NULL) + { + std::cout << buffer; + } + } + } + else + { + std::cout << "command failed :[" << cmd << "]" << std::endl; + std::cout << "errno [" << errno << "]" << std::endl; + } + } + +}; + +} // end namespace + +#endif diff --git a/src/usr/sbeio/plugins/sbeIoFfdcType.H b/src/usr/sbeio/plugins/sbeIoFfdcType.H new file mode 100644 index 000000000..149420d30 --- /dev/null +++ b/src/usr/sbeio/plugins/sbeIoFfdcType.H @@ -0,0 +1,102 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/sbeio/plugins/sbeIoFfdcType.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016,2017 */ +/* [+] 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. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef __SBEIO_FFDC_TYPE_H +#define __SBEIO_FFDC_TYPE_H + +//Bit mapped identifiers +#define SBEIO_FFDC_ATTR_DUMP 0x0001 +#define SBEIO_FFDC_TRACE_DUMP 0x0002 +#define SBEIO_FFDC_ALL_DUMP 0xFFFF + +/* Structure indicating the contents of FFDC package + * value 'true' - field present;value 'false' - field not present + * bit_0 - attribute dump + * bit_1 - trace buffer dump + * bit 2-31 - reserved + */ +typedef struct +{ + uint32_t attrField:1; + uint32_t traceField:1; + uint32_t reserved:30; + /* @breif - set dump fields + * + * @param[in] - uint32_t value to be updated + */ + void set(uint32_t val) + { + if(val & SBEIO_FFDC_ATTR_DUMP) + { + attrField = true; + } + if(val & SBEIO_FFDC_TRACE_DUMP) + { + traceField = true; + } + } + /* @brief - get dump fields as uint32_t + * + * @return - uint32_t value + */ + uint32_t get() + { + uint32_t l_val = 0; + if(attrField) + { + l_val |= SBEIO_FFDC_ATTR_DUMP; + } + if(traceField) + { + l_val |= SBEIO_FFDC_TRACE_DUMP; + } + return l_val; + } +} sbeIoFfdcDumpFields_t; + +//Sturcture indicating the type of ffdc user data blob +//and its length in bytes +typedef struct +{ + uint32_t fieldId:16; + uint32_t fieldLen:16; +} sbeIoFfdcUserDataIdentifier_t; + +//Structure of ffdc user data blob +typedef struct +{ + sbeIoFfdcUserDataIdentifier_t userDataId; + const void *userDataPtr; +} sbeIoFfdcUserData_t; + +//keep it packed to 4byte boundary to avoid packing bytes +typedef struct +{ + uint32_t primaryStatus:16;//Chip Op Primary status + uint32_t secondaryStatus:16;//Chip Op Secondary status + uint32_t fwCommitID;// FW commit ID + sbeIoFfdcDumpFields_t dumpFields;//bitmapped dumpFields +} sbeIoFfdcDataHeader_t; + +#endif //__SBEIO_FFDC_TYPE_H diff --git a/src/usr/sbeio/plugins/sbeIoUdParserFactory.H b/src/usr/sbeio/plugins/sbeIoUdParserFactory.H new file mode 100644 index 000000000..f03ab344a --- /dev/null +++ b/src/usr/sbeio/plugins/sbeIoUdParserFactory.H @@ -0,0 +1,52 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/sbeio/plugins/sbeIoUdParserFactory.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,2017 */ +/* [+] 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. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +#if !defined(_SBEIOUDPARSERFACTORY_H) +#define _SBEIOUDPARSERFACTORY_H + +#include "errludparserfactory.H" +#include "sbeIoErrlUd.H" + +namespace SBEIO +{ + class UserDetailsParserFactory + : public ERRORLOG::ErrlUserDetailsParserFactory + { + public: + UserDetailsParserFactory() + { + registerParser<SBEIO::SbeIoFfdcErrlParser> + (SBEIO_UDT_PARAMETERS); + } + + private: + + UserDetailsParserFactory(const UserDetailsParserFactory &); + UserDetailsParserFactory & operator= + (const UserDetailsParserFactory &); + }; +}; + +#endif + diff --git a/src/usr/sbeio/sbe_ffdc_parser.C b/src/usr/sbeio/sbe_ffdc_parser.C index 57a174e72..08cbc5feb 100644 --- a/src/usr/sbeio/sbe_ffdc_parser.C +++ b/src/usr/sbeio/sbe_ffdc_parser.C @@ -118,12 +118,11 @@ void SbeFFDCParser::parseFFDCData(void * i_ffdcPackageBuffer) * Get the size of the ffdc package = the entire package length * minus the header (2 words), and the rc (1 word) */ - uint8_t l_bufLenInBytes = iv_ffdcWordLen * l_packageLengthInWords - - iv_headerWordInBytes - sizeof(l_rc); + uint32_t l_bufLenInBytes = iv_ffdcWordLen * l_packageLengthInWords - + iv_headerWordInBytes; // Check to see if what we're copying is beyond the buffer size - uint8_t l_bufferMarker = i + iv_headerWordInBytes + - sizeof(l_rc) + l_bufLenInBytes; + uint32_t l_bufferMarker = i + iv_headerWordInBytes + l_bufLenInBytes; if(l_bufferMarker > PAGESIZE * iv_ffdcPackageSize) { SBE_TRACF(ERR_MRK"parseFFDCData: FFDC Package buffer overflow detected."); @@ -161,7 +160,7 @@ void SbeFFDCParser::parseFFDCData(void * i_ffdcPackageBuffer) // starting at 12 byte from current pointer memcpy(l_wordBuffer, static_cast<char *>(i_ffdcPackageBuffer) + - i + iv_headerWordInBytes + sizeof(l_rc), + i + iv_headerWordInBytes, l_bufLenInBytes); addFFDCPackage(l_wordBuffer, l_rc, l_bufLenInBytes); @@ -195,9 +194,9 @@ uint8_t SbeFFDCParser::getTotalPackages() /* * @brief returns the size (bytes) of the FFDC package */ -uint8_t SbeFFDCParser::getPackageLength(uint8_t i_index) +uint32_t SbeFFDCParser::getPackageLength(uint8_t i_index) { - uint8_t l_retLen = 0; + uint32_t l_retLen = 0; uint8_t l_size = getTotalPackages(); if((i_index >= 0) && (i_index <= l_size)) { @@ -216,7 +215,8 @@ void * SbeFFDCParser::getFFDCPackage(uint8_t i_index) uint8_t l_size = getTotalPackages(); if((i_index >= 0) && (i_index <= l_size)) { - l_retPtr = iv_ffdcPackages.at(i_index); + ffdc_package *l_ffdcPkg = iv_ffdcPackages.at(i_index); + l_retPtr = l_ffdcPkg->ffdcPtr; } return l_retPtr; } @@ -241,7 +241,7 @@ uint32_t SbeFFDCParser::getPackageRC(uint8_t i_index) * and push it to the list */ void SbeFFDCParser::addFFDCPackage(void * i_ffdcPackage, - uint32_t i_rc, uint8_t i_packageLen) + uint32_t i_rc, uint32_t i_packageLen) { ffdc_package * l_ffdcPkg = new ffdc_package(); l_ffdcPkg->rc = i_rc; diff --git a/src/usr/sbeio/sbe_fifodd.C b/src/usr/sbeio/sbe_fifodd.C index 1337bb2f2..722457653 100644 --- a/src/usr/sbeio/sbe_fifodd.C +++ b/src/usr/sbeio/sbe_fifodd.C @@ -59,6 +59,7 @@ extern trace_desc_t* g_trac_sbeio; #define SBE_TRACU(printf_string,args...) \ TRACFCOMP(g_trac_sbeio,"fifodd: " printf_string,##args) */ +#define READ_BUFFER_SIZE 2048 using namespace ERRORLOG; @@ -91,7 +92,7 @@ SbeFifo::~SbeFifo() } /** - * @brief perform SBE PSU chip-op + * @brief perform SBE FIFO chip-op */ errlHndl_t SbeFifo::performFifoChipOp(TARGETING::Target * i_target, uint32_t * i_pFifoRequest, @@ -123,7 +124,7 @@ errlHndl_t SbeFifo::performFifoChipOp(TARGETING::Target * i_target, mutex_unlock(&l_fifoOpMux); - if( errl && (SBE_COMP_ID == errl->moduleId()) ) + if( errl && (SBEIO_COMP_ID == errl->moduleId()) ) { SBE_TRACF( "Forcing shutdown for FSP to collect FFDC" ); @@ -131,7 +132,7 @@ errlHndl_t SbeFifo::performFifoChipOp(TARGETING::Target * i_target, uint32_t orig_plid = errl->plid(); uint32_t orig_rc = errl->reasonCode(); uint32_t orig_mod = errl->moduleId(); - ERRORLOG::errlCommit( errl, SBE_COMP_ID ); + ERRORLOG::errlCommit( errl, SBEIO_COMP_ID ); /*@ * @errortype * @moduleid SBEIO_FIFO @@ -312,6 +313,7 @@ errlHndl_t SbeFifo::readResponse(TARGETING::Target * i_target, uint32_t i_responseSize) { errlHndl_t errl = NULL; + uint32_t l_readBuffer[READ_BUFFER_SIZE]; SBE_TRACD(ENTER_MRK "readResponse"); @@ -335,6 +337,8 @@ errlHndl_t SbeFifo::readResponse(TARGETING::Target * i_target, // status header including the final // distance word. // receive words until EOT, but do not exceed response buffer size + bool l_overRun = false; + do { // Wait for data to be ready to receive (download) or if the EOT @@ -348,27 +352,41 @@ errlHndl_t SbeFifo::readResponse(TARGETING::Target * i_target, // ignore EOT dummy word if (l_recWords >= (sizeof(statusHeader)/sizeof(uint32_t)) ) { - l_pReceived--; - l_recWords--; - l_last = o_pFifoResponse[l_recWords-1]; + if(l_overRun == false) { + l_pReceived--; + l_recWords--; + l_last = o_pFifoResponse[l_recWords-1]; + } else { + l_last = (uint32_t) l_readBuffer[l_recWords-2]; + } } break; } - // Make sure response buffer not over run. + // When error occurs, SBE will write more than l_maxWords + // we have to keep reading 1 word at a time until we get EOT + // or more than READ_BUFFER_SIZE. Save what we read in the buffer if (l_recWords >= l_maxWords) { - break; //ran out of receive buffer before EOT + l_overRun = true; } // read next word errl = readFsi(i_target,SBE_FIFO_DNFIFO_DATA_OUT,&l_last); if (errl) break; - *l_pReceived = l_last; //copy to returned output buffer - l_pReceived++; //advance to next position + l_readBuffer[l_recWords] = l_last; + + if(l_overRun == false) { + *l_pReceived = l_last; //copy to returned output buffer + l_pReceived++; //advance to next position + } l_recWords++; //count word received SBE_TRACD("Read a byte from data reg: 0x%.8X",l_last); + if(l_recWords > READ_BUFFER_SIZE) { + SBE_TRACF(ERR_MRK "readResponse: data overflow without EOT"); + break; + } } while (1); // exit check in middle of loop if (errl) break; @@ -377,7 +395,6 @@ errlHndl_t SbeFifo::readResponse(TARGETING::Target * i_target, // l_recWords of words received. // l_pReceived points to 1 word past last word received. // l_last has last word received, which is "distance" to status - // EOT is expected before running out of response buffer if (!l_EOT) { @@ -424,7 +441,7 @@ errlHndl_t SbeFifo::readResponse(TARGETING::Target * i_target, { SBE_TRACF(ERR_MRK "readResponse: invalid status distance " "cmd=0x%08x distance=%d allocated response size=%d " - "recieved word size=%d" , + "received word size=%d" , i_pFifoRequest[1], l_last, i_responseSize, @@ -466,7 +483,10 @@ errlHndl_t SbeFifo::readResponse(TARGETING::Target * i_target, // Check status for success. // l_pReceived points one word past last word received. // l_last has number of words to status header including self. - uint32_t * l_pStatusTmp = l_pReceived - l_last; //do word ptr math + + uint32_t * l_pStatusTmp = (l_overRun == false) ? + l_pReceived - l_last : //do word ptr math + &l_readBuffer[l_recWords - 1]; statusHeader * l_pStatusHeader = (statusHeader *)l_pStatusTmp; if ((FIFO_STATUS_MAGIC != l_pStatusHeader->magic) || (SBE_PRI_OPERATION_SUCCESSFUL != l_pStatusHeader->primaryStatus) || @@ -507,8 +527,16 @@ errlHndl_t SbeFifo::readResponse(TARGETING::Target * i_target, * Size of the FFDC package should be l_maxWords - l_recWords */ - writeFFDCBuffer(l_pReceived, + if(l_overRun == false) { + writeFFDCBuffer(l_pReceived, sizeof(uint32_t) * (l_maxWords - l_recWords - 1)); + } else { + // If Overrun, FFDC should be + // l_recWords (words read) - l_last (distance to status) + 1 + // in l_readBuffer + writeFFDCBuffer(&l_readBuffer[l_recWords - l_last + 1], + sizeof(uint32_t) * (l_last + 1)); + } SbeFFDCParser * l_ffdc_parser = new SbeFFDCParser(); l_ffdc_parser->parseFFDCData(iv_ffdcPackageBuffer); @@ -520,11 +548,11 @@ errlHndl_t SbeFifo::readResponse(TARGETING::Target * i_target, // If fapiRC, add data to errorlog if(l_rc == fapi2::FAPI2_RC_PLAT_ERR_SEE_DATA) { - errl->addFFDC( SBE_COMP_ID, + errl->addFFDC( SBEIO_COMP_ID, l_ffdc_parser->getFFDCPackage(i), l_ffdc_parser->getPackageLength(i), 0, - ERRORLOG::ERRL_UDT_NOFORMAT, + SBEIO_UDT_PARAMETERS, false ); } else @@ -546,6 +574,12 @@ errlHndl_t SbeFifo::readResponse(TARGETING::Target * i_target, l_rc, l_ffdcBuf, i_target->getAttr<TARGETING::ATTR_FAPI_POS>()); + + errlHndl_t sbe_errl = fapi2::rcToErrl(l_fapiRC); + if( sbe_errl ) + { + ERRORLOG::errlCommit( sbe_errl, SBEIO_COMP_ID ); + } } } |