Skip to content

Conversation

Alpana07
Copy link

@Alpana07 Alpana07 commented Sep 2, 2025

vpd-manager: Add module VPD sanity check

Added new dbus API to perform the santity check for all the vpds.
It takes one eeprom path at a time and checks for it's header, TOC
and all it's records.

Test:
        busctl introspect com.ibm.VPD.Manager /com/ibm/VPD/Manager com.ibm.VPD.Manager
        NAME                             TYPE      SIGNATURE RESULT/VALUE FLAGS
        .CollectFRUVPD                   method    o         -            -
        .GetExpandedLocationCode         method    sq        s            -
        .GetFRUsByExpandedLocationCode   method    s         ao           -
        .GetFRUsByUnexpandedLocationCode method    sq        ao           -
        .GetHardwarePath                 method    o         s            -
        .PerformVPDRecollection          method    -         -            -
        .ReadKeyword                     method    sv        v            -
        .UpdateKeyword                   method    sv        i            -
        .WriteKeyword                    method    ossay     i            -
        .WriteKeywordOnHardware          method    sv        i            -
        .deleteFRUVPD                    method    o         -            -
        .performVpdSanityCheck          method    s         -            -
        .CollectionStatus                property  s         "Completed"  emits-change writable

        busctl  call com.ibm.VPD.Manager /com/ibm/VPD/Manager com.ibm.VPD.Manager performVpdSanityCheck  s "/sys/bus/spi/drivers/at25/spi12.0/eeprom"

        Journal-
        vpd-manager[1078]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/ipz_parser.cpp, Line: 1011 Performing sanity check for file path: /sys/bus/spi/drivers/at25/spi12.0/eeprom
        vpd-manager[1078]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/ipz_parser.cpp, Line: 206 DBG: test purpose:checkHeader done
        vpd-manager[1078]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/ipz_parser.cpp, Line: 246 DBG: test purpose:readTOC done
        vpd-manager[1078]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/ipz_parser.cpp, Line: 297 DBG: test purpose:readPT done
        vpd-manager[1078]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/ipz_parser.cpp, Line: 1023 SUCCESS

@Alpana07 Alpana07 force-pushed the vpd-tool_moduleVPD branch 5 times, most recently from 05e6490 to 18f651e Compare September 3, 2025 08:24
@Alpana07 Alpana07 force-pushed the vpd-tool_moduleVPD branch 2 times, most recently from ae32363 to cf8e46d Compare September 4, 2025 18:55
* @throw Data Exception
* @throw ECC Exception
*/
void vpdSanityCheck();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can keep API name as performVpdSanityCheck or checkVpdSanity.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use this term very frequently "sanityCheck" , so i have given this name.
1st level of function is named as performVpdSanityCheck , so can't use it again.

@Alpana07 Alpana07 force-pushed the vpd-tool_moduleVPD branch 2 times, most recently from bb9077b to f25f592 Compare September 17, 2025 07:08
@branupama
Copy link

why ~ file is being added ?

ParserFactory::getParser(m_vpdVector, l_eachPath,
m_vpdStartOffset);

auto rc1 = l_parser->sanityChecker();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can avoid this variable by using rc variable.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have used 2 rcs here .
I need both of them here.

  • internal rc1 will collect immidiate return code for each eerpom call.
  • Outer rc will be updated based on condition-
    rc = success, rc1 = success, rc2 = success
    rc = Failure, rc1 = Failure, rc2 = Failure
    rc = Failure, rc1 = success, rc2 = Failure
    rc = Failure, rc1 = Failure, rc2 = success

{
try
{
logging::logMessage(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep necessary logs only. This log is not required.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are not sure, it ran for 1 or more eeproms( redundant), in that case this log will be a proof.

Added new dbus API to perform the santity check for all the vpds.
It takes one eeprom path at a time and checks for it's redundant paths.
For each of them it checks for header, TOC and all it's records and
their respective ECC.

Test:
	busctl introspect com.ibm.VPD.Manager /com/ibm/VPD/Manager com.ibm.VPD.Manager
	NAME                             TYPE      SIGNATURE RESULT/VALUE FLAGS
	.CollectFRUVPD                   method    o         -            -
	.GetExpandedLocationCode         method    sq        s            -
	.GetFRUsByExpandedLocationCode   method    s         ao           -
	.GetFRUsByUnexpandedLocationCode method    sq        ao           -
	.GetHardwarePath                 method    o         s            -
	.PerformVPDRecollection          method    -         -            -
	.ReadKeyword                     method    sv        v            -
	.UpdateKeyword                   method    sv        i            -
	.WriteKeyword                    method    ossay     i            -
	.WriteKeywordOnHardware          method    sv        i            -
	.deleteFRUVPD                    method    o         -            -
        .performVpdSanityCheck          method    s         -            -
	.CollectionStatus                property  s         "Completed"  emits-change writable

$ busctl  call com.ibm.VPD.Manager /com/ibm/VPD/Manager com.ibm.VPD.Manager performVpdSanityCheck  s "/sys/bus/spi/drivers/at25/spi12.0/eeprom"

$vpd-tool --sanityCheck -P "/sys/bus/spi/drivers/at25/spi22.0/eeprom"
DBG: validating eeprom - /sys/bus/spi/drivers/at25/spi22.0/eeprom
DBG: Calling DBUS API for - /sys/bus/spi/drivers/at25/spi22.0/eeprom
DBG: returned from DBUS API, return code - 0
VPD validation Successful.

journal-
Sep 10 21:09:53 p10bmc vpd-manager[1094]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/ipz_parser.cpp, Line: 1006 Performing sanity check for file path: /sys/bus/spi/drivers/at25/spi22.0/eeprom
Sep 10 21:09:53 p10bmc vpd-manager[1094]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/ipz_parser.cpp, Line: 1019 SUCCESS
Sep 10 21:09:53 p10bmc vpd-manager[1094]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/parser.cpp, Line: 386 Sanity checker Passed for /sys/bus/spi/drivers/at25/spi22.0/eeprom
Sep 10 21:09:54 p10bmc vpd-manager[1094]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/ipz_parser.cpp, Line: 1006 Performing sanity check for file path: /sys/bus/spi/drivers/at25/spi23.0/eeprom
Sep 10 21:09:54 p10bmc vpd-manager[1094]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/ipz_parser.cpp, Line: 1019 SUCCESS
Sep 10 21:09:54 p10bmc vpd-manager[1094]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/parser.cpp, Line: 386 Sanity checker Passed for /sys/bus/spi/drivers/at25/spi23.0/eeprom
Sep 10 21:11:10 p10bmc vpd-manager[1094]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/ipz_parser.cpp, Line: 1006 Performing sanity check for file path: /sys/bus/spi/drivers/at25/spi22.0/eeprom
Sep 10 21:11:10 p10bmc vpd-manager[1094]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/ipz_parser.cpp, Line: 1019 SUCCESS
Sep 10 21:11:10 p10bmc vpd-manager[1094]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/parser.cpp, Line: 386 Sanity checker Passed for /sys/bus/spi/drivers/at25/spi22.0/eeprom
Sep 10 21:11:11 p10bmc vpd-manager[1094]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/ipz_parser.cpp, Line: 1006 Performing sanity check for file path: /sys/bus/spi/drivers/at25/spi23.0/eeprom
Sep 10 21:11:11 p10bmc vpd-manager[1094]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/ipz_parser.cpp, Line: 1019 SUCCESS
Sep 10 21:11:11 p10bmc vpd-manager[1094]: FileName: /usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/parser.cpp, Line: 386 Sanity checker Passed for /sys/bus/spi/drivers/at25/spi23.0/eeprom

Error case-
$busctl  call com.ibm.VPD.Manager /com/ibm/VPD/Manager com.ibm.VPD.Manager performVpdSanityCheck  s ""

   "0x50003D0E": {
        "SRC":                  "BD554000",
        "Message":              "An EEPROM path access error occurred.",
        "PLID":                 "0x50003D0E",
        "CreatorID":            "BMC",
        "Subsystem":            "CEC Hardware - VPD Interface",
        "Commit Time":          "09/05/2025 09:10:03",
        "Sev":                  "Informational Event",
        "CompID":               "bmc vpd"

Signed-off-by: Alpana Kumari <[email protected]>
void clearVpdDumpDir() const noexcept;

/**
* @brief It validates the record and ECC of FRU path.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: API validates record against the ECC for that record.

* @brief It validates the record and ECC of FRU path.
*
* This API calls dbus API to verify the record and ECC of user provided
* EEPROM path. That dbus API internally checks for- is there a redundant
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That dbus API

Which D-Bus API? Can be more specific?

*
* This API calls dbus API to verify the record and ECC of user provided
* EEPROM path. That dbus API internally checks for- is there a redundant
* EEPROM for this FRU. If found , it verifies the same for redundant one
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checks for- is

What is the "-" for?

Could you please rephrase the additional description.

* EEPROM path. That dbus API internally checks for- is there a redundant
* EEPROM for this FRU. If found , it verifies the same for redundant one
* also.
* @param[in] eepromPath - EEPROM path to perform sanity check
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any "eepromPath" as input to the API.

#include <tuple>
namespace vpd
{

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not required?

const types::WriteVpdParams& i_paramsToWriteData);

/*
* @brief API to perform sanity check on the EEPROM
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you say "the" EEPROM. Which EEPROM should I assume. I don't see any in the parameter list or reference to any EEPROM here.


int Parser::vpdSanityCheck() noexcept
{
std::vector<types::Path> l_fruPaths{m_vpdFilePath};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need another data structure for this? Can we check it in place? I see Unnecessary string copies.

for (const auto& l_eachPath : l_fruPaths)
{
// Read the VPD data into a vector.
vpdSpecificUtility::getVpdDataInVector(l_eachPath, m_vpdVector,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of two calls can we use "getVpdParserInstance"? Will that help?

}

/**
* @brief Virtual API to perform sanity check on EEPROM.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@branupama When we say "the" it needs to be definite. Here I don't see reference to the any specific EEPROM in the API , hence I don't agree with "the EEPROM"

Having said that, to explain which EEPROM this API will perform action upon, @Alpana07 you will have to give some reference, like
API to perform sanity check on EEPROM passed via constructor of parser class.

// Verify the ECC for this Record
if (!recordEccCheck(itrToPT))
{
logging::logMessage(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already maintain a list of invalid records, can that be used here instead of logging one at a time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants