diff options
author | Corey Swenson <cswenson@us.ibm.com> | 2015-08-05 14:43:33 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-08-14 08:45:43 -0500 |
commit | b23def57b3b0acb0265114838c8dfd47cffa543b (patch) | |
tree | 2071be7f2a72d64ca2dc8ddcaccf947525c43853 /src | |
parent | 0c2727ce73f283950bf8e95251c304a903a7d016 (diff) | |
download | blackbird-hostboot-b23def57b3b0acb0265114838c8dfd47cffa543b.tar.gz blackbird-hostboot-b23def57b3b0acb0265114838c8dfd47cffa543b.zip |
Fix to call get_reserved_mem only once in VPD runtime
Change-Id: I9d00b2d2f613dcb090794ecead9ef01184b54f24
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/19577
Tested-by: Jenkins Server
Tested-by: Jenkins OP Build CI
Tested-by: Jenkins OP HW
Reviewed-by: Martin Gloff <mgloff@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/vpd/runtime/rt_vpd.C | 96 |
1 files changed, 53 insertions, 43 deletions
diff --git a/src/usr/vpd/runtime/rt_vpd.C b/src/usr/vpd/runtime/rt_vpd.C index ddf7650cb..e57d6d7d2 100644 --- a/src/usr/vpd/runtime/rt_vpd.C +++ b/src/usr/vpd/runtime/rt_vpd.C @@ -46,6 +46,10 @@ extern trace_desc_t* g_trac_vpd; //#define TRACSSCOMP(args...) TRACFCOMP(args) #define TRACSSCOMP(args...) +// Global variable to store the location of hbrt-vpd-image returned by the +// host interface get_reserved_mem function. We only want to call the +// function once as memory is allocated with every call. +static uint64_t g_reserved_mem_addr = 0; namespace VPD { @@ -88,60 +92,66 @@ errlHndl_t getPnorAddr( pnorInformation & i_pnorInfo, mutex_t * i_mutex ) { errlHndl_t err = NULL; - uint64_t vpd_addr = 0; - if( - g_hostInterfaces != NULL && - g_hostInterfaces->get_reserved_mem) + // Get the reserved_mem_addr only once + if( g_reserved_mem_addr == 0 ) { - vpd_addr = g_hostInterfaces->get_reserved_mem("ibm,hbrt-vpd-image",0); - if(vpd_addr == 0) + if( g_hostInterfaces != NULL && + g_hostInterfaces->get_reserved_mem) { - TRACFCOMP(g_trac_vpd,ERR_MRK"rt_vpd: Failed to get VPD addr. " - "vpd_type: %d", - i_pnorInfo.pnorSection); + g_reserved_mem_addr = + g_hostInterfaces->get_reserved_mem("ibm,hbrt-vpd-image",0); + + if( g_reserved_mem_addr == 0 ) + { + TRACFCOMP(g_trac_vpd,ERR_MRK"rt_vpd: Failed to get VPD addr. " + "vpd_type: %d", + i_pnorInfo.pnorSection); + /*@ + * @errortype + * @moduleid VPD::VPD_RT_GET_ADDR + * @reasoncode VPD::VPD_RT_NULL_VPD_PTR + * @userdata1 VPD type + * @userdata2 0 + * @devdesc Hypervisor returned NULL address for VPD + */ + err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_INFORMATIONAL, + VPD::VPD_RT_GET_ADDR, + VPD::VPD_RT_NULL_VPD_PTR, + i_pnorInfo.pnorSection, + 0); + + err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, + HWAS::SRCI_PRIORITY_HIGH); + + err->collectTrace( "VPD", 256); + } + } + else // interface not set + { + TRACFCOMP(g_trac_vpd,ERR_MRK"Hypervisor vpd interface not linked"); /*@ - * @errortype - * @moduleid VPD::VPD_RT_GET_ADDR - * @reasoncode VPD::VPD_RT_NULL_VPD_PTR - * @userdata1 VPD type - * @userdata2 0 - * @devdesc Hypervisor returned NULL address for VPD - */ + * @errortype + * @moduleid VPD::VPD_RT_GET_ADDR + * @reasoncode VPD::VPD_RT_NOT_INITIALIZED + * @userdata1 VPD type + * @userdata2 0 + * @devdesc Runtime VPD interface not linked. + */ err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_INFORMATIONAL, - VPD::VPD_RT_GET_ADDR, - VPD::VPD_RT_NULL_VPD_PTR, - i_pnorInfo.pnorSection, - 0); + VPD::VPD_RT_GET_ADDR, + VPD::VPD_RT_NOT_INITIALIZED, + i_pnorInfo.pnorSection, + 0); err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, - HWAS::SRCI_PRIORITY_HIGH); + HWAS::SRCI_PRIORITY_HIGH); err->collectTrace( "VPD", 256); } } - else // interface not set - { - TRACFCOMP(g_trac_vpd,ERR_MRK"Hypervisor vpd interface not linked"); - /*@ - * @errortype - * @moduleid VPD::VPD_RT_GET_ADDR - * @reasoncode VPD::VPD_RT_NOT_INITIALIZED - * @userdata1 VPD type - * @userdata2 0 - * @devdesc Runtime VPD interface not linked. - */ - err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_INFORMATIONAL, - VPD::VPD_RT_GET_ADDR, - VPD::VPD_RT_NOT_INITIALIZED, - i_pnorInfo.pnorSection, - 0); - - err->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, - HWAS::SRCI_PRIORITY_HIGH); - - err->collectTrace( "VPD", 256); - } + + uint64_t vpd_addr = g_reserved_mem_addr; if(!err) { |