diff options
| author | Meng Li <shlimeng@cn.ibm.com> | 2018-04-24 21:21:07 +0800 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-05-19 17:09:16 -0400 |
| commit | fd23ae8d50f307a1aca530d5a204d67261b58fea (patch) | |
| tree | 61f2c614ef320538de97d46ead72cab829d56a90 /src/usr/vpd | |
| parent | 42327316097c17cb3a0ef2ba212c2722121af861 (diff) | |
| download | talos-hostboot-fd23ae8d50f307a1aca530d5a204d67261b58fea.tar.gz talos-hostboot-fd23ae8d50f307a1aca530d5a204d67261b58fea.zip | |
Get SN from BMC and update into PVPD EEPROM
Resolves #135
Change-Id: I46b5c2208ed28822c6001a955f4056d976e79339
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/58010
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/vpd')
| -rw-r--r-- | src/usr/vpd/HBconfig | 7 | ||||
| -rw-r--r-- | src/usr/vpd/pvpd.C | 3 | ||||
| -rwxr-xr-x | src/usr/vpd/vpd.C | 62 | ||||
| -rw-r--r-- | src/usr/vpd/vpd.H | 3 |
4 files changed, 72 insertions, 3 deletions
diff --git a/src/usr/vpd/HBconfig b/src/usr/vpd/HBconfig index 70c533dd2..0d321192c 100644 --- a/src/usr/vpd/HBconfig +++ b/src/usr/vpd/HBconfig @@ -136,3 +136,10 @@ config PALMETTO_PASS1 default n help Palmetto pass1 specific changes + +config UPDATE_SN_FROM_BMC + default n + depends on BMC_IPMI + help + Read Planar serial number from BMC + via IPMI FRU Record 0 diff --git a/src/usr/vpd/pvpd.C b/src/usr/vpd/pvpd.C index f58e795cd..371a87deb 100644 --- a/src/usr/vpd/pvpd.C +++ b/src/usr/vpd/pvpd.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2017 */ +/* Contributors Listed Below - COPYRIGHT 2013,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -274,6 +274,7 @@ errlHndl_t nodePresenceDetect(DeviceFW::OperationType i_opType, pvpd_present = true; //node PVDP always returns present } #endif + VPD::updateSerialNumberFromBMC( i_target ); //Fsp sets PN/SN so if there is none, do it here if(!INITSERVICE::spBaseServicesEnabled()) diff --git a/src/usr/vpd/vpd.C b/src/usr/vpd/vpd.C index e50b673f5..585c168fa 100755 --- a/src/usr/vpd/vpd.C +++ b/src/usr/vpd/vpd.C @@ -40,6 +40,10 @@ #include "ipvpd.H" #include "dvpd.H" #include <map> +#include <console/consoleif.H> +#include <initservice/istepdispatcherif.H> +#include <ipmi/ipmifruinv.H> + // ---------------------------------------------- // Trace - defined in vpd_common @@ -465,7 +469,63 @@ void setPartAndSerialNumberAttributes( TARGETING::Target * i_target ) } - +// ------------------------------------------------------------------ +// setPartAndSerialNumberAttributes +// ------------------------------------------------------------------ +void updateSerialNumberFromBMC( TARGETING::Target * i_nodetarget ) +{ +#ifdef CONFIG_UPDATE_SN_FROM_BMC + errlHndl_t l_errl = NULL; + size_t l_vpdSize = 0; + + //Get Product Serial Number from Backplane + char* l_sn_prod = NULL; + l_sn_prod = IPMIFRUINV::getProductSN(0); + if (l_sn_prod != NULL) + { + TRACFCOMP(g_trac_vpd, "Got system serial number from BMC."); + TRACFCOMP(g_trac_vpd, "SN from BMC is: %s", l_sn_prod); + + l_errl = deviceRead(i_nodetarget, NULL, l_vpdSize, + DEVICE_PVPD_ADDRESS( PVPD::OSYS, PVPD::SS )); + + if(l_errl == NULL) + { + uint8_t l_vpddata[l_vpdSize]; + + l_errl = deviceRead(i_nodetarget, l_vpddata, l_vpdSize, + DEVICE_PVPD_ADDRESS( PVPD::OSYS, PVPD::SS )); + + if(l_errl == NULL) + { + TRACFCOMP(g_trac_vpd, "SN in PVPD::OSYS:SS: %s, size: %d", l_vpddata, l_vpdSize); + + if (strncmp(l_sn_prod, l_vpddata, l_vpdSize) != 0) + { + l_errl = deviceWrite(i_nodetarget, l_sn_prod, l_vpdSize, + DEVICE_PVPD_ADDRESS( PVPD::OSYS, PVPD::SS )); + CONSOLE::displayf(NULL, "updated SN from BMC into PVPD."); + CONSOLE::flush(); + CONSOLE::displayf(NULL, "Need a reboot."); + CONSOLE::flush(); + INITSERVICE::requestReboot(); + } + } + } + + if(l_errl) + { + ERRORLOG::errlCommit(l_errl,VPD_COMP_ID); + } + + //getProductSN requires the caller to delete the char array + delete[] l_sn_prod; + l_sn_prod = NULL; + + TRACFCOMP(g_trac_vpd, "End updateSerialNumberFromBMC."); + } +#endif +} // ------------------------------------------------------------------ // getPnAndSnRecordAndKeywords diff --git a/src/usr/vpd/vpd.H b/src/usr/vpd/vpd.H index 22dd062fc..2753a476d 100644 --- a/src/usr/vpd/vpd.H +++ b/src/usr/vpd/vpd.H @@ -258,6 +258,7 @@ errlHndl_t getPnAndSnRecordAndKeywords( TARGETING::Target * i_target, vpdKeyword & io_partKeyword, vpdKeyword & io_serialKeyword); -}; //end VPD namespace +void updateSerialNumberFromBMC( TARGETING::Target * i_nodetarget ); +}; //end VPD namespace #endif |

