Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement vpd-tool mfgClean #573

Conversation

souvik1914581
Copy link

his commit implements vpd-tool --mfgClean option.
This API resets specific System VPD keywords to default value.

The specified keyword values are reset on:
- Primary EEPROM path.
- Redundant EEPROM path(if any)
- D-Bus cache.
- Backup path.

@souvik1914581 souvik1914581 marked this pull request as draft January 9, 2025 18:10
@souvik1914581 souvik1914581 force-pushed the sr_vpdToolMfgClean_backupRestoreJson branch 4 times, most recently from 0a0fe28 to 27ab26f Compare January 10, 2025 07:03
souvik1914581 pushed a commit to souvik1914581/openpower-vpd-parser that referenced this pull request Jan 10, 2025
This commit implements vpd-tool --mfgClean option.
This API resets specific System VPD keywords to default value.

The specified keyword values are reset on:
  - Primary EEPROM path.
  - Redundant EEPROM path(if any)
  - D-Bus cache.
  - Backup path.

Test:
```
root@p10bmc:~# ./vpd-tool --mfgClean --yes
Cleaning System VPD...
Hardware path: "/sys/bus/i2c/drivers/at24/8-0050/eeprom"
Data updated successfully
Data updated successfully
Data updated successfully

 The critical keywords from system backplane VPD has been reset
 successfully.

root@p10bmc:~# ./vpd-tool --mfgClean
This option resets some of the system VPD keywords to their default values. Do you really wish to proceed further?[yes/no]:yes
Cleaning System VPD...
Hardware path: "/sys/bus/i2c/drivers/at24/8-0050/eeprom"

 The critical keywords from system backplane VPD has been reset successfully.
```

Change-Id: I55862fc4122a188e3e522dd64ed6bd1fa94335e8
Signed-off-by: Souvik Roy <souvik.roy10@ibm.com>
@souvik1914581 souvik1914581 force-pushed the sr_vpdToolMfgClean_backupRestoreJson branch from 27ab26f to a45585e Compare January 10, 2025 07:05
@souvik1914581 souvik1914581 changed the title Implement vpd-tool mfgClean(using backupRestore JSON) Implement vpd-tool mfgClean Jan 10, 2025
souvik1914581 pushed a commit to souvik1914581/openpower-vpd-parser that referenced this pull request Jan 10, 2025
This commit implements vpd-tool --mfgClean option.
This API resets specific System VPD keywords to default value.
The System VPD keywords are fetched from backup_restore.json.

The specified keyword values are reset on:
  - Primary EEPROM path.
  - Redundant EEPROM path(if any)
  - D-Bus cache.
  - Backup path.

Test:
```
root@p10bmc:~# ./vpd-tool --mfgClean --yes
Cleaning System VPD...
Hardware path: "/sys/bus/i2c/drivers/at24/8-0050/eeprom"
Data updated successfully
Data updated successfully
Data updated successfully

 The critical keywords from system backplane VPD has been reset
 successfully.

root@p10bmc:~# ./vpd-tool --mfgClean
This option resets some of the system VPD keywords to their default values. Do you really wish to proceed further?[yes/no]:yes
Cleaning System VPD...
Hardware path: "/sys/bus/i2c/drivers/at24/8-0050/eeprom"

 The critical keywords from system backplane VPD has been reset successfully.
```

Change-Id: I55862fc4122a188e3e522dd64ed6bd1fa94335e8
Signed-off-by: Souvik Roy <souvik.roy10@ibm.com>
@souvik1914581 souvik1914581 force-pushed the sr_vpdToolMfgClean_backupRestoreJson branch from a45585e to 53ec284 Compare January 10, 2025 07:12
souvik1914581 pushed a commit to souvik1914581/openpower-vpd-parser that referenced this pull request Jan 10, 2025
This commit implements vpd-tool --mfgClean option.
This API resets specific System VPD keywords to default value.
The System VPD keywords are fetched from backup_restore.json.

The specified keyword values are reset on:
  - Primary EEPROM path.
  - Redundant EEPROM path(if any)
  - D-Bus cache.
  - Backup path.

Test:
```
root@p10bmc:~# ./vpd-tool --mfgClean --yes
Cleaning System VPD...
Hardware path: "/sys/bus/i2c/drivers/at24/8-0050/eeprom"
Data updated successfully
Data updated successfully
Data updated successfully

 The critical keywords from system backplane VPD has been reset
 successfully.

root@p10bmc:~# ./vpd-tool --mfgClean
This option resets some of the system VPD keywords to their default values. Do you really wish to proceed further?[yes/no]:yes
Cleaning System VPD...
Hardware path: "/sys/bus/i2c/drivers/at24/8-0050/eeprom"

 The critical keywords from system backplane VPD has been reset successfully.
```

Change-Id: I55862fc4122a188e3e522dd64ed6bd1fa94335e8
Signed-off-by: Souvik Roy <souvik.roy10@ibm.com>
@souvik1914581 souvik1914581 force-pushed the sr_vpdToolMfgClean_backupRestoreJson branch from 53ec284 to 933e808 Compare January 10, 2025 09:37
@souvik1914581 souvik1914581 marked this pull request as ready for review January 10, 2025 09:38
@@ -197,21 +197,128 @@ int VpdTool::cleanSystemVpd() const noexcept
int l_rc{constants::FAILURE};
try
{
// TODO:
// get the keyword map from backup_restore json
// iterate through the keyword map get default value of
// l_keywordName.
// use readKeyword API to read hardware value from hardware.
Copy link
Collaborator

Choose a reason for hiding this comment

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

read is not required, write directly to clear the mfg values

Copy link
Author

Choose a reason for hiding this comment

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

Removed read.

.get<types::BinaryVector>();

// get the value on hardware
const auto& l_keywordValue =
Copy link
Collaborator

Choose a reason for hiding this comment

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

skip the read check and go ahead with the write check

Copy link
Author

Choose a reason for hiding this comment

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

Removed read check.

{
l_rc = constants::SUCCESS;
std::cout
<< "\n The critical keywords from system backplane VPD has "
Copy link
Collaborator

Choose a reason for hiding this comment

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

why system backplane ?

Copy link
Author

Choose a reason for hiding this comment

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

That's the string the old vpd-tool prints out on success.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to fix that now :)

Copy link
Author

Choose a reason for hiding this comment

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

Updated the success/failure message.

souvik1914581 pushed a commit to souvik1914581/openpower-vpd-parser that referenced this pull request Jan 13, 2025
This commit implements vpd-tool --mfgClean option.
This API resets specific System VPD keywords to default value.
The System VPD keywords are fetched from backup_restore.json.

The specified keyword values are reset on:
  - Primary EEPROM path.
  - Redundant EEPROM path(if any)
  - D-Bus cache.
  - Backup path.

Test:
```
root@p10bmc:~# ./vpd-tool --mfgClean --yes
Cleaning System VPD...
Hardware path: "/sys/bus/i2c/drivers/at24/8-0050/eeprom"
Data updated successfully
Data updated successfully
Data updated successfully

 The critical keywords from system backplane VPD has been reset
 successfully.

root@p10bmc:~# ./vpd-tool --mfgClean
This option resets some of the system VPD keywords to their default values. Do you really wish to proceed further?[yes/no]:yes
Cleaning System VPD...
Hardware path: "/sys/bus/i2c/drivers/at24/8-0050/eeprom"

 The critical keywords from system backplane VPD has been reset successfully.
```

Change-Id: I55862fc4122a188e3e522dd64ed6bd1fa94335e8
Signed-off-by: Souvik Roy <souvik.roy10@ibm.com>
@souvik1914581 souvik1914581 force-pushed the sr_vpdToolMfgClean_backupRestoreJson branch from 933e808 to afc67ee Compare January 13, 2025 06:29
souvik1914581 pushed a commit to souvik1914581/openpower-vpd-parser that referenced this pull request Jan 13, 2025
This commit implements vpd-tool --mfgClean option.
This API resets specific System VPD keywords to default value.
The System VPD keywords are fetched from backup_restore.json.

The specified keyword values are reset on:
  - Primary EEPROM path.
  - Redundant EEPROM path(if any)
  - D-Bus cache.
  - Backup path.

Test:
```
root@p10bmc:~# ./vpd-tool --mfgClean --yes
Manufacturing clean is successful

root@p10bmc:~# ./vpd-tool --mfgClean
This option resets some of the system VPD keywords to their default values. Do you really wish to proceed further?[yes/no]:yes
Manufacturing clean is successful

```

Change-Id: I55862fc4122a188e3e522dd64ed6bd1fa94335e8
Signed-off-by: Souvik Roy <souvik.roy10@ibm.com>
@souvik1914581 souvik1914581 force-pushed the sr_vpdToolMfgClean_backupRestoreJson branch from afc67ee to f62f345 Compare January 13, 2025 06:37
souvik1914581 pushed a commit to souvik1914581/openpower-vpd-parser that referenced this pull request Jan 13, 2025
This commit implements vpd-tool --mfgClean option.
This API resets specific System VPD keywords to default value.
The System VPD keywords are fetched from backup_restore.json.

The specified keyword values are reset on:
  - Primary EEPROM path.
  - Redundant EEPROM path(if any)
  - D-Bus cache.
  - Backup path.

Test:
```
root@p10bmc:~# ./vpd-tool --mfgClean --yes
Manufacturing clean is successful

root@p10bmc:~# ./vpd-tool --mfgClean
This option resets some of the system VPD keywords to their default values. Do you really wish to proceed further?[yes/no]:yes
Manufacturing clean is successful

```

Change-Id: I55862fc4122a188e3e522dd64ed6bd1fa94335e8
Signed-off-by: Souvik Roy <souvik.roy10@ibm.com>
@souvik1914581 souvik1914581 force-pushed the sr_vpdToolMfgClean_backupRestoreJson branch from f62f345 to aa4c745 Compare January 13, 2025 07:02
vpd-tool/src/vpd_tool.cpp Show resolved Hide resolved
vpd-tool/src/vpd_tool.cpp Show resolved Hide resolved
else
{
std::cerr
<< "Invalid keyword entry in Backup Restore JSON backup map"
Copy link
Collaborator

Choose a reason for hiding this comment

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

keep this statement generic like below
"Unrecognized Entry Record [l_srcRecordName] Keyword [l_srcKeywordName]"

Copy link
Author

Choose a reason for hiding this comment

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

Done.

getBackupRestoreCfgJsonObj();

// flag to track any failure
bool l_anyFailure{false};
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this even needed ?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, to detemine the status message printed to console
"Manufacturing clean is success" or
"Manufacturing clean has failed"

Copy link
Collaborator

@jinuthomas jinuthomas Jan 13, 2025

Choose a reason for hiding this comment

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

I am still confused on when this will be false on the final print. if I have a single backup map with a single entry and mfgclean is not required what will the end display be ?

Copy link
Author

Choose a reason for hiding this comment

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

Removed the flag.

}
return l_rc;
return constants::SUCCESS; // keeping rc=0 always for consistency with old
// 1060 mfgClean implementation
Copy link
Collaborator

Choose a reason for hiding this comment

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

this comment need not be there

Copy link
Author

Choose a reason for hiding this comment

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

Removed the comment.

souvik1914581 pushed a commit to souvik1914581/openpower-vpd-parser that referenced this pull request Jan 13, 2025
This commit implements vpd-tool --mfgClean option.
This API resets specific System VPD keywords to default value.
The System VPD keywords are fetched from backup_restore.json.

The specified keyword values are reset on:
  - Primary EEPROM path.
  - Redundant EEPROM path(if any)
  - D-Bus cache.
  - Backup path.

Test:
```
root@p10bmc:~# ./vpd-tool --mfgClean --yes
Manufacturing clean is successful

root@p10bmc:~# ./vpd-tool --mfgClean
This option resets some of the system VPD keywords to their default values. Do you really wish to proceed further?[yes/no]:yes
Manufacturing clean is successful

```

Change-Id: I55862fc4122a188e3e522dd64ed6bd1fa94335e8
Signed-off-by: Souvik Roy <souvik.roy10@ibm.com>
@souvik1914581 souvik1914581 force-pushed the sr_vpdToolMfgClean_backupRestoreJson branch from aa4c745 to 5583167 Compare January 13, 2025 08:26
getBackupRestoreCfgJsonObj();

// flag to track any failure
bool l_anyFailure{false};
Copy link
Collaborator

@jinuthomas jinuthomas Jan 13, 2025

Choose a reason for hiding this comment

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

I am still confused on when this will be false on the final print. if I have a single backup map with a single entry and mfgclean is not required what will the end display be ?

vpd-tool/src/vpd_tool.cpp Show resolved Hide resolved
vpd-tool/src/vpd_tool.cpp Show resolved Hide resolved
This commit implements vpd-tool --mfgClean option.
This API resets specific System VPD keywords to default value.
The System VPD keywords are fetched from backup_restore.json.

The specified keyword values are reset on:
  - Primary EEPROM path.
  - Redundant EEPROM path(if any)
  - D-Bus cache.
  - Backup path.

Test:
```
root@p10bmc:~# ./vpd-tool --mfgClean --yes
Manufacturing clean is successful

root@p10bmc:~# ./vpd-tool --mfgClean
This option resets some of the system VPD keywords to their default values. Do you really wish to proceed further?[yes/no]:yes
Manufacturing clean is successful

```

Change-Id: I55862fc4122a188e3e522dd64ed6bd1fa94335e8
Signed-off-by: Souvik Roy <souvik.roy10@ibm.com>
@souvik1914581 souvik1914581 force-pushed the sr_vpdToolMfgClean_backupRestoreJson branch from 5583167 to 2bbb54d Compare January 13, 2025 09:09
@SunnySrivastava1984 SunnySrivastava1984 merged commit aeff541 into ibm-openbmc:1110 Jan 13, 2025
1 check passed
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.

3 participants