1feeea83bSBen Tyner #pragma once 2feeea83bSBen Tyner 3feeea83bSBen Tyner #include "pel_common.hpp" 4feeea83bSBen Tyner #include "pel_section.hpp" 5feeea83bSBen Tyner #include "stream.hpp" 6feeea83bSBen Tyner 7*4efca280SAndrew Geissler #include <array> 8*4efca280SAndrew Geissler 9feeea83bSBen Tyner namespace attn 10feeea83bSBen Tyner { 11feeea83bSBen Tyner namespace pel 12feeea83bSBen Tyner { 13feeea83bSBen Tyner 14feeea83bSBen Tyner constexpr uint8_t extendedUserHeaderVersion = 0x01; 15feeea83bSBen Tyner constexpr size_t firmwareVersionSize = 16; 16feeea83bSBen Tyner 17feeea83bSBen Tyner /** 18feeea83bSBen Tyner * @class ExtendedUserHeader 19feeea83bSBen Tyner * 20feeea83bSBen Tyner * This represents the Extended User Header section in a PEL 21feeea83bSBen Tyner * 22feeea83bSBen Tyner * |----------+---------------------------+-------+-------+-------------------| 23feeea83bSBen Tyner * | length | byte0 | byte1 | byte2 | byte3 | 24feeea83bSBen Tyner * |----------+---------------------------+-------+-------+-------------------| 25feeea83bSBen Tyner * | 8 | Section Header | 26feeea83bSBen Tyner * |----------+---------------------------------------------------------------| 27feeea83bSBen Tyner * | 20 | Machine Type/Model/Serial | 28feeea83bSBen Tyner * |----------+---------------------------------------------------------------| 29feeea83bSBen Tyner * | 16 | FW Released Version | 30feeea83bSBen Tyner * |----------+---------------------------------------------------------------| 31feeea83bSBen Tyner * | 16 | FW Sub-system driver ver. | 32feeea83bSBen Tyner * |----------+---------------------------+-------+-------+-------------------| 33feeea83bSBen Tyner * | 4 | Reserved | rsvd | rsvd | Symptom ID length | 34feeea83bSBen Tyner * |----------+---------------------------+-------+-------+-------------------| 35feeea83bSBen Tyner * | 8 | Event Common Reference Time | 36feeea83bSBen Tyner * |----------+---------------------------------------------------------------| 37feeea83bSBen Tyner * | 4 | Reserved | 38feeea83bSBen Tyner * |----------+---------------------------------------------------------------| 39feeea83bSBen Tyner * | variable | Symptom ID | 40feeea83bSBen Tyner * |----------+---------------------------------------------------------------| 41feeea83bSBen Tyner * 42feeea83bSBen Tyner */ 43feeea83bSBen Tyner class ExtendedUserHeader : public Section 44feeea83bSBen Tyner { 45feeea83bSBen Tyner public: 46feeea83bSBen Tyner ExtendedUserHeader() = delete; 47feeea83bSBen Tyner ~ExtendedUserHeader() = default; 48feeea83bSBen Tyner ExtendedUserHeader(const ExtendedUserHeader&) = default; 49feeea83bSBen Tyner ExtendedUserHeader& operator=(const ExtendedUserHeader&) = default; 50feeea83bSBen Tyner ExtendedUserHeader(ExtendedUserHeader&&) = default; 51feeea83bSBen Tyner ExtendedUserHeader& operator=(ExtendedUserHeader&&) = default; 52feeea83bSBen Tyner 53feeea83bSBen Tyner /** 54feeea83bSBen Tyner * @brief Constructor 55feeea83bSBen Tyner * 56feeea83bSBen Tyner * Fills in this class's data fields from raw data. 57feeea83bSBen Tyner * 58feeea83bSBen Tyner * @param[in] pel - the PEL data stream 59feeea83bSBen Tyner */ 60feeea83bSBen Tyner explicit ExtendedUserHeader(Stream& pel); 61feeea83bSBen Tyner 62feeea83bSBen Tyner /** 63feeea83bSBen Tyner * @brief Flatten the section into the stream 64feeea83bSBen Tyner * 65feeea83bSBen Tyner * @param[in] stream - The stream to write to 66feeea83bSBen Tyner */ 67feeea83bSBen Tyner void flatten(Stream& stream) const override; 68feeea83bSBen Tyner 69feeea83bSBen Tyner /** 70feeea83bSBen Tyner * @brief Fills in the object from the stream data 71feeea83bSBen Tyner * 72feeea83bSBen Tyner * @param[in] stream - The stream to read from 73feeea83bSBen Tyner */ 74feeea83bSBen Tyner void unflatten(Stream& stream); 75feeea83bSBen Tyner 76feeea83bSBen Tyner /** 77feeea83bSBen Tyner * @brief Returns the size of this section when flattened into a PEL 78feeea83bSBen Tyner * 79feeea83bSBen Tyner * @return size_t - the size of the section 80feeea83bSBen Tyner */ flattenedSize()81feeea83bSBen Tyner size_t flattenedSize() 82feeea83bSBen Tyner { 83feeea83bSBen Tyner return Section::flattenedSize() + mtmsSize + _serverFWVersion.size() + 84feeea83bSBen Tyner _subsystemFWVersion.size() + sizeof(_reserved4B) + 85feeea83bSBen Tyner sizeof(_refTime) + sizeof(_reserved1B1) + sizeof(_reserved1B2) + 86feeea83bSBen Tyner sizeof(_reserved1B3) + sizeof(_symptomIdSize) + _symptomIdSize; 87feeea83bSBen Tyner } 88feeea83bSBen Tyner 89feeea83bSBen Tyner /** 90feeea83bSBen Tyner * @brief Set the symptom id field in extended user header 91feeea83bSBen Tyner * 92feeea83bSBen Tyner * @param[in] symptomId - The symptom ID to set 93feeea83bSBen Tyner */ 94feeea83bSBen Tyner void setSymptomId(const std::string& symptomId); 95feeea83bSBen Tyner 96feeea83bSBen Tyner private: 97feeea83bSBen Tyner /** 98feeea83bSBen Tyner * @brief The structure that holds the machine TM and SN fields. 99feeea83bSBen Tyner */ 100feeea83bSBen Tyner uint8_t _mtms[mtmsSize]; 101feeea83bSBen Tyner 102feeea83bSBen Tyner /** 103feeea83bSBen Tyner * @brief The server firmware version 104feeea83bSBen Tyner * 105feeea83bSBen Tyner * NULL terminated. 106feeea83bSBen Tyner * 107feeea83bSBen Tyner * The release version of the full firmware image. 108feeea83bSBen Tyner */ 109feeea83bSBen Tyner std::array<uint8_t, firmwareVersionSize> _serverFWVersion; 110feeea83bSBen Tyner 111feeea83bSBen Tyner /** 112feeea83bSBen Tyner * @brief The subsystem firmware version 113feeea83bSBen Tyner * 114feeea83bSBen Tyner * NULL terminated. 115feeea83bSBen Tyner * 116feeea83bSBen Tyner * On PELs created on the BMC, this will be the BMC code version. 117feeea83bSBen Tyner */ 118feeea83bSBen Tyner std::array<uint8_t, firmwareVersionSize> _subsystemFWVersion; 119feeea83bSBen Tyner 120feeea83bSBen Tyner /** 121feeea83bSBen Tyner * @brief Reserved 122feeea83bSBen Tyner */ 123feeea83bSBen Tyner uint32_t _reserved4B = 0; 124feeea83bSBen Tyner 125feeea83bSBen Tyner /** 126feeea83bSBen Tyner * @brief Event Common Reference Time 127feeea83bSBen Tyner * 128feeea83bSBen Tyner * This is not used by PELs created on the BMC. 129feeea83bSBen Tyner */ 130feeea83bSBen Tyner uint64_t _refTime; 131feeea83bSBen Tyner 132feeea83bSBen Tyner /** 133feeea83bSBen Tyner * @brief Reserved 134feeea83bSBen Tyner */ 135feeea83bSBen Tyner uint8_t _reserved1B1 = 0; 136feeea83bSBen Tyner 137feeea83bSBen Tyner /** 138feeea83bSBen Tyner * @brief Reserved 139feeea83bSBen Tyner */ 140feeea83bSBen Tyner uint8_t _reserved1B2 = 0; 141feeea83bSBen Tyner 142feeea83bSBen Tyner /** 143feeea83bSBen Tyner * @brief Reserved 144feeea83bSBen Tyner */ 145feeea83bSBen Tyner uint8_t _reserved1B3 = 0; 146feeea83bSBen Tyner 147feeea83bSBen Tyner /** 148feeea83bSBen Tyner * @brief The size of the symptom ID field 149feeea83bSBen Tyner */ 150feeea83bSBen Tyner uint8_t _symptomIdSize; 151feeea83bSBen Tyner 152feeea83bSBen Tyner /** 153feeea83bSBen Tyner * @brief The symptom ID field 154feeea83bSBen Tyner * 155feeea83bSBen Tyner * Describes a unique event signature for the log. 156feeea83bSBen Tyner * Required for serviceable events, otherwise optional. 157feeea83bSBen Tyner * When present, must start with the first 8 characters 158feeea83bSBen Tyner * of the ASCII string field from the SRC. 159feeea83bSBen Tyner * 160feeea83bSBen Tyner * NULL terminated. 161feeea83bSBen Tyner */ 162feeea83bSBen Tyner std::vector<uint8_t> _symptomId; 163feeea83bSBen Tyner }; 164feeea83bSBen Tyner 165feeea83bSBen Tyner } // namespace pel 166feeea83bSBen Tyner } // namespace attn 167