Skip to content

Commit

Permalink
Enable PEL for Bios Handler Class
Browse files Browse the repository at this point in the history
This commit adds code to log PEL in BiosHandler class, in case of
exceptions occurred while updating the the BIOS attribute values.

output:
'''
root@p10bmc:/tmp# peltool -i 0x5000254B
{
"Private Header": {
    "Section Version":          "1",
    "Sub-section type":         "0",
    "Created by":               "bmc vpd",
    "Created at":               "01/15/2025 09:12:41",
    "Committed at":             "01/15/2025 09:12:41",
    "Creator Subsystem":        "BMC",
    "CSSVER":                   "",
    "Platform Log Id":          "0x5000254B",
    "Entry Id":                 "0x5000254B",
    "BMC Event Log Id":         "15"
},
"User Header": {
    "Section Version":          "1",
    "Sub-section type":         "0",
    "Log Committed by":         "bmc error logging",
    "Subsystem":                "CEC Hardware - VPD Interface",
    "Event Scope":              "Entire Platform",
    "Event Severity":           "Informational Event",
    "Event Type":               "Miscellaneous, Informational Only",
    "Action Flags": [
                                "Event not customer viewable",
                                "Report Externally"
    ],
    "Host Transmission":        "Not Sent",
    "HMC Transmission":         "Not Sent"
},
"Primary SRC": {
    "Section Version":          "1",
    "Sub-section type":         "1",
    "Created by":               "bmc vpd",
    "SRC Version":              "0x02",
    "SRC Format":               "0x55",
    "Virtual Progress SRC":     "False",
    "I5/OS Service Event Bit":  "False",
    "Hypervisor Dump Initiated":"False",
    "Backplane CCIN":           "2E2D",
    "Terminate FW Error":       "False",
    "Deconfigured":             "False",
    "Guarded":                  "False",
    "Error Details": {
        "Message":              "A Dbus internal error occurred."
    },
    "Valid Word Count":         "0x09",
    "Reference Code":           "BD554005",
    "Hex Word 2":               "00000055",
    "Hex Word 3":               "2E2D0010",
    "Hex Word 4":               "00000000",
    "Hex Word 5":               "00000000",
    "Hex Word 6":               "00000000",
    "Hex Word 7":               "00000000",
    "Hex Word 8":               "00000000",
    "Hex Word 9":               "00000000",
    "Callout Section": {
        "Callout Count":        "1",
        "Callouts": [{
            "FRU Type":         "Maintenance Procedure Required",
            "Priority":         "Mandatory, replace all with this type as a unit",
            "Procedure":        "BMC0001"
        }]
    }
},
"Extended User Header": {
    "Section Version":          "1",
    "Sub-section type":         "0",
    "Created by":               "bmc error logging",
    "Reporting Machine Type":   "        ",
    "Reporting Serial Number":  "       ",
    "FW Released Ver":          "RB1110_025",
    "FW SubSys Version":        "fw1110.00-3.53",
    "Common Ref Time":          "00/00/0000 00:00:00",
    "Symptom Id Len":           "20",
    "Symptom Id":               "BD554005_2E2D0010"
},
"Failing MTMS": {
    "Section Version":          "1",
    "Sub-section type":         "0",
    "Created by":               "bmc error logging",
    "Machine Type Model":       "        ",
    "Serial Number":            "       "
},
"User Data 0": {
    "Section Version": "1",
    "Sub-section type": "1",
    "Created by": "bmc error logging",
    "BMCLoad": "1.62 1.17 0.89",
    "BMCState": "Ready",
    "BMCUptime": "0y 0d 0h 56m 29s",
    "BootState": "Unspecified",
    "ChassisState": "Off",
    "FW Version ID": "fw1110.00-3.53-1110.2503.20250109a (RB1110_025)",
    "HostState": "Off",
    "System IM": "50001001"
},
"User Data 1": {
    "Section Version": "1",
    "Sub-section type": "1",
    "Created by": "bmc error logging",
    "DESCRIPTION": "DBus call to update NVRAM value in pending attribute failed. Test Error",
    "FileName": "/usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/bios_handler.cpp",
    "FunctionName": "saveClearNvramToBios",
    "InteranlRc": "0",
    "UserData1": "",
    "UserData2": ""
}
}

'''

Signed-off-by: RekhaAparna01 <vrekhaaparna@ibm.com>
  • Loading branch information
RekhaAparna01 committed Jan 17, 2025
1 parent 6a8e56f commit 59195f4
Showing 1 changed file with 36 additions and 17 deletions.
53 changes: 36 additions & 17 deletions vpd-manager/src/bios_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "bios_handler.hpp"

#include "constants.hpp"
#include "event_logger.hpp"
#include "logger.hpp"

#include <sdbusplus/bus/match.hpp>
Expand Down Expand Up @@ -145,8 +146,11 @@ void IbmBiosHandler::biosAttributesCallback(sdbusplus::message_t& i_msg)
}
else
{
// TODO: log a predicitive PEL.
logging::logMessage("Invalid typre received from BIOS table.");
EventLogger::createSyncPel(
types::ErrorType::DbusFailure, types::SeverityType::Warning,
__FILE__, __FUNCTION__, 0,
"Invalid type received from BIOS table.", std::nullopt,
std::nullopt, std::nullopt, std::nullopt);
break;
}
}
Expand Down Expand Up @@ -299,10 +303,12 @@ void IbmBiosHandler::saveFcoToBios(const types::BinaryVector& i_fcoVal)
}
catch (const std::exception& l_ex)
{
// TODO: Should we log informational PEL here as well?
logging::logMessage(
EventLogger::createSyncPel(
types::ErrorType::DbusFailure, types::SeverityType::Informational,
__FILE__, __FUNCTION__, 0,
"DBus call to update FCO value in pending attribute failed. " +
std::string(l_ex.what()));
std::string(l_ex.what()),
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
}
}

Expand Down Expand Up @@ -346,9 +352,11 @@ void IbmBiosHandler::saveAmmToVpd(const std::string& i_memoryMirrorMode)
}
else
{
// TODO: Add PEL
logging::logMessage(
"Invalid type read for memory mirror mode value from DBus. Skip writing to VPD");
EventLogger::createSyncPel(
types::ErrorType::DbusFailure, types::SeverityType::Informational,
__FILE__, __FUNCTION__, 0,
"Invalid type read for memory mirror mode value from DBus. Skip writing to VPD",
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
}
}

Expand Down Expand Up @@ -379,10 +387,12 @@ void IbmBiosHandler::saveAmmToBios(const std::string& i_ammVal)
}
catch (const std::exception& l_ex)
{
// TODO: Should we log informational PEL here as well?
logging::logMessage(
EventLogger::createSyncPel(
types::ErrorType::DbusFailure, types::SeverityType::Informational,
__FILE__, __FUNCTION__, 0,
"DBus call to update AMM value in pending attribute failed. " +
std::string(l_ex.what()));
std::string(l_ex.what()),
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
}
}

Expand Down Expand Up @@ -514,9 +524,12 @@ void IbmBiosHandler::saveCreateDefaultLparToBios(
}
catch (const std::exception& l_ex)
{
logging::logMessage(
EventLogger::createSyncPel(
types::ErrorType::DbusFailure, types::SeverityType::Informational,
__FILE__, __FUNCTION__, 0,
"DBus call to update lpar value in pending attribute failed. " +
std::string(l_ex.what()));
std::string(l_ex.what()),
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
}

return;
Expand Down Expand Up @@ -630,9 +643,12 @@ void IbmBiosHandler::saveClearNvramToBios(const std::string& i_clearNvramVal)
}
catch (const std::exception& l_ex)
{
logging::logMessage(
EventLogger::createSyncPel(
types::ErrorType::DbusFailure, types::SeverityType::Informational,
__FILE__, __FUNCTION__, 0,
"DBus call to update NVRAM value in pending attribute failed. " +
std::string(l_ex.what()));
std::string(l_ex.what()),
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
}
}

Expand Down Expand Up @@ -741,9 +757,12 @@ void IbmBiosHandler::saveKeepAndClearToBios(
}
catch (const std::exception& l_ex)
{
logging::logMessage(
EventLogger::createSyncPel(
types::ErrorType::DbusFailure, types::SeverityType::Informational,
__FILE__, __FUNCTION__, 0,
"DBus call to update keep and clear value in pending attribute failed. " +
std::string(l_ex.what()));
std::string(l_ex.what()),
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
}
}

Expand Down

0 comments on commit 59195f4

Please sign in to comment.