diff options
Diffstat (limited to 'src/usr/secureboot/common')
| -rw-r--r-- | src/usr/secureboot/common/errlud_secure.C | 76 | ||||
| -rw-r--r-- | src/usr/secureboot/common/errlud_secure.H | 50 | ||||
| -rw-r--r-- | src/usr/secureboot/common/plugins/errludP_secure.H | 102 | ||||
| -rw-r--r-- | src/usr/secureboot/common/plugins/secureUdParserFactory.H | 3 |
4 files changed, 231 insertions, 0 deletions
diff --git a/src/usr/secureboot/common/errlud_secure.C b/src/usr/secureboot/common/errlud_secure.C index a6b9b3d1d..c40172609 100644 --- a/src/usr/secureboot/common/errlud_secure.C +++ b/src/usr/secureboot/common/errlud_secure.C @@ -34,6 +34,8 @@ #include <securerom/ROM.H> #include <errl/errlentry.H> #include <errl/errlmanager.H> +#include <devicefw/driverif.H> +#include <secureboot/nodecommif.H> namespace SECUREBOOT { @@ -43,6 +45,7 @@ namespace SECUREBOOT //------------------------------------------------------------------------------ enum { PARSER_SIZEOF_SHA512_t = 64, + PARSER_SIZEOF_UINT64_t = 8, PARSER_SIZEOF_UINT32_t = 4, PARSER_SIZEOF_UINT8_t = 1, PARSER_SIZEOF_TARGET_HKH_SECTION = 69, @@ -219,5 +222,78 @@ UdVerifyInfo::UdVerifyInfo(const char* i_compId, l_pBuf+=PARSER_SIZEOF_SHA512_t; } + +//------------------------------------------------------------------------------ +// SECURE Node Communications Info User Details +//------------------------------------------------------------------------------ +UdNodeCommInfo::UdNodeCommInfo(const uint8_t i_opType, + const uint64_t i_buflen, + const int64_t i_accessType, + const NODECOMM::node_comm_args_t i_args ) + +{ + // Set up Ud instance variables + iv_CompId = SECURE_COMP_ID; + iv_Version = SECURE_UDT_VERSION_1; + iv_SubSection = SECURE_UDT_NODECOMM_INFO; + + //***** Node Comm SECURE_UDT_VERSION_1 Memory Layout ***** + // 4 bytes : Target HUID + // 8 bytes : Length of In/Out Buffer + // 8 bytes : Access Type (DeviceFW::AccessType) + // 1 byte : Op Type (DeviceFW::OperationType) + // 1 byte : Mode (XBUS or ABUS) + // 1 byte : LinkId + // 1 byte : MboxId + + static_assert(sizeof(uint64_t)==PARSER_SIZEOF_UINT64_t, + "Expected sizeof(uint64_t) is 8"); + + // These are necessary to keep the parsing in errludP_secure.H correct + static_assert(DeviceFW::READ==0, "Expected opType READ == 0"); + static_assert(DeviceFW::WRITE==1, "Expected opType WRITE == 1"); + static_assert(SECUREBOOT::NODECOMM::NCDD_MODE_XBUS==0, + "Expected NCDD_MODE_XBUS==0"); + static_assert(SECUREBOOT::NODECOMM::NCDD_MODE_ABUS==1, + "Expected NCDD_MODE_ABUS==1"); + + char * l_pBuf = reinterpret_cast<char *>( + reallocUsrBuf(sizeof(uint32_t) + +sizeof(uint64_t)*2 + +sizeof(uint8_t)*4 ) ); + uint64_t tmp64 = 0; + uint32_t tmp32 = 0; + uint8_t tmp8 = 0; + + tmp32 = i_args.tgt_huid; + memcpy(l_pBuf, &tmp32, sizeof(tmp32)); + l_pBuf += sizeof(tmp32); + + tmp64 = i_buflen; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp64 = i_accessType; + memcpy(l_pBuf, &tmp64, sizeof(tmp64)); + l_pBuf += sizeof(tmp64); + + tmp8 = i_opType; + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + tmp8 = i_args.mode; + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + tmp8 = i_args.linkId; + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + + tmp8 = i_args.mboxId; + memcpy(l_pBuf, &tmp8, sizeof(tmp8)); + l_pBuf += sizeof(tmp8); + +}; + } // end SECUREBOOT namespace diff --git a/src/usr/secureboot/common/errlud_secure.H b/src/usr/secureboot/common/errlud_secure.H index 1e05399b1..86c03fb08 100644 --- a/src/usr/secureboot/common/errlud_secure.H +++ b/src/usr/secureboot/common/errlud_secure.H @@ -33,6 +33,8 @@ #include <secureboot/service.H> #include <errl/errluserdetails.H> +#include <devicefw/driverif.H> +#include "../node_comm/node_comm_dd.H" namespace SECUREBOOT { @@ -223,6 +225,54 @@ class UdVerifyInfo : public ERRORLOG::ErrlUserDetails UdVerifyInfo& operator = (UdVerifyInfo&&) = delete; }; +/** + * @class UdNodeCommInfo + * + * Adds information about the Node Communications Operation to an + * error log as user detail data + */ +class UdNodeCommInfo : public ERRORLOG::ErrlUserDetails +{ + public: + /** + * @brief Constructor + * + * @param i_opType Operation Type + * @param i_buflen Length of In/Out Buffer + * @param i_accessType Access Type + * @param i_args Miscellaneous Parameters + */ + UdNodeCommInfo(const uint8_t i_opType, + const uint64_t i_buflen, + const int64_t i_accessType, + const NODECOMM::node_comm_args_t i_args ); + + /** + * @brief Destructor + */ + virtual ~UdNodeCommInfo() {} + + /** + * Delete Copy Constructor + */ + UdNodeCommInfo(const UdNodeCommInfo&) = delete; + + /** + * Delete Copy Assignment + */ + UdNodeCommInfo& operator= (const UdNodeCommInfo&) = delete; + + /** + * Delete Move Constructor + */ + UdNodeCommInfo (UdNodeCommInfo&&) = delete; + + /** + * Delete Move Assignment + */ + UdNodeCommInfo& operator = (UdNodeCommInfo&&) = delete; +}; + } // end SECUREBOOT namespace #endif diff --git a/src/usr/secureboot/common/plugins/errludP_secure.H b/src/usr/secureboot/common/plugins/errludP_secure.H index 817967bbf..acdf3032e 100644 --- a/src/usr/secureboot/common/plugins/errludP_secure.H +++ b/src/usr/secureboot/common/plugins/errludP_secure.H @@ -334,6 +334,108 @@ class UdParserVerifyInfo : public ERRORLOG::ErrlUserDetailsParser UdParserVerifyInfo & operator=(const UdParserVerifyInfo&); }; +/** + * @class UdParserNodeCommInfo + * + * Parses UdSecureNodeCommInfo + */ +class UdParserNodeCommInfo : public ERRORLOG::ErrlUserDetailsParser +{ + public: + /** + * @brief Constructor + */ + UdParserNodeCommInfo() {} + + /** + * @brief Destructor + */ + virtual ~UdParserNodeCommInfo() {} + + /** + * @brief Parses information from Node Communications operation + * 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 + { + + //***** Node Comm SECURE_UDT_VERSION_1 Memory Layout ***** + // 4 bytes : Target HUID + // 8 bytes : Length of In/Out Buffer + // 8 bytes : Access Type (DeviceFW::AccessType) + // 1 byte : Op Type (DeviceFW::OperationType) + // 1 byte : Mode (XBUS or ABUS) + // 1 byte : LinkId + // 1 byte : MboxId + + char* l_databuf = static_cast<char*>(i_pBuffer); + bool l_parseError = false; + + do + { + i_parser.PrintHeading("Secure Node Comm Info"); + + i_parser.PrintNumber("Target HUID 0x","%.8lX",TO_UINT32(l_databuf)); + l_databuf += sizeof(uint32_t); + i_parser.PrintNumber("Length I/O Buff 0x","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + i_parser.PrintNumber("Access Type 0x","%.16lX",TO_UINT64(l_databuf)); + l_databuf += sizeof(uint64_t); + + uint8_t op = TO_UINT8(l_databuf); + if( op == 0 ) + { + i_parser.PrintHeading("Node Comm Read"); + } + else if( op == 1 ) + { + i_parser.PrintHeading("Node Comm Write"); + } + else + { + i_parser.PrintHeading("Unknown Node Comm Operation"); + } + i_parser.PrintNumber("Op Type Value 0x","%.2lX",TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + + + op = TO_UINT8(l_databuf); + if( op == 0 ) + { + i_parser.PrintHeading("Node Comm Mode: XBUS"); + } + else if( op == 1 ) + { + i_parser.PrintHeading("Node Comm Mode: ABUS"); + } + else + { + i_parser.PrintHeading("INVALID Node Comm Mode"); + } + i_parser.PrintNumber("MODE 0x","%.2lX",TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + + i_parser.PrintNumber("LinkId 0x","%.2lX",TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + i_parser.PrintNumber("MboxId 0x","%.2lX",TO_UINT8(l_databuf)); + l_databuf += sizeof(uint8_t); + + } while(0); + } + + private: + // Disabled + UdParserNodeCommInfo(const UdParserNodeCommInfo&); + UdParserNodeCommInfo & operator=(const UdParserNodeCommInfo&); +}; } // end SECUREBOOT namespace diff --git a/src/usr/secureboot/common/plugins/secureUdParserFactory.H b/src/usr/secureboot/common/plugins/secureUdParserFactory.H index d720c1ce1..de03ab83a 100644 --- a/src/usr/secureboot/common/plugins/secureUdParserFactory.H +++ b/src/usr/secureboot/common/plugins/secureUdParserFactory.H @@ -47,6 +47,9 @@ namespace SECUREBOOT registerParser<SECUREBOOT::UdParserVerifyInfo> (SECURE_UDT_VERIFY_INFO); + + registerParser<SECUREBOOT::UdParserNodeCommInfo> + (SECURE_UDT_NODECOMM_INFO); } private: |

