diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/runtime/interface.h | 3 | ||||
-rw-r--r-- | src/include/usr/runtime/runtime.H | 8 | ||||
-rw-r--r-- | src/include/usr/targeting/common/targreasoncodes.H | 1 | ||||
-rw-r--r-- | src/include/usr/util/runtime/util_rt.H | 51 | ||||
-rw-r--r-- | src/include/usr/util/utilrsvdmem.H | 90 | ||||
-rw-r--r-- | src/include/usr/vmmconst.h | 38 | ||||
-rw-r--r-- | src/include/usr/vpd/vpd_if.H | 6 | ||||
-rw-r--r-- | src/usr/runtime/populate_hbruntime.C | 306 | ||||
-rwxr-xr-x | src/usr/targeting/attrrp.C | 96 | ||||
-rw-r--r-- | src/usr/targeting/runtime/attrPlatOverride_rt.C | 2 | ||||
-rw-r--r-- | src/usr/targeting/runtime/attrrp_rt.C | 2 | ||||
-rw-r--r-- | src/usr/testcore/rtloader/loader.H | 13 | ||||
-rw-r--r-- | src/usr/util/makefile | 1 | ||||
-rw-r--r-- | src/usr/util/runtime/makefile | 1 | ||||
-rw-r--r-- | src/usr/util/runtime/util_rt.C | 48 | ||||
-rw-r--r-- | src/usr/util/utilrsvdmem.C | 102 | ||||
-rw-r--r-- | src/usr/vpd/rtvpd_load.C | 26 | ||||
-rw-r--r-- | src/usr/vpd/runtime/rt_vpd.C | 2 |
18 files changed, 345 insertions, 451 deletions
diff --git a/src/include/runtime/interface.h b/src/include/runtime/interface.h index e3231b625..7f2062775 100644 --- a/src/include/runtime/interface.h +++ b/src/include/runtime/interface.h @@ -120,9 +120,6 @@ enum MemoryError_t * Reserved memory labels - used by get_reserved_mem */ #define HBRT_RSVD_MEM__CODE "ibm,hbrt-code-image" -#define HBRT_RSVD_MEM__ATTRIBUTES "ibm,hbrt-target-image" -#define HBRT_RSVD_MEM__VPD_CACHE "ibm,hbrt-vpd-image" -#define HBRT_RSVD_MEM__OVERRIDES "ibm,hbrt-targetoverride-image" #define HBRT_RSVD_MEM__PRIMARY "ibm,hb-rsv-mem" #define HBRT_RSVD_MEM__HOMER "ibm,homer-image" #define HBRT_RSVD_MEM__OCC_COMMON "ibm,occ-common-area" diff --git a/src/include/usr/runtime/runtime.H b/src/include/usr/runtime/runtime.H index e4b4b4121..df22c23e5 100644 --- a/src/include/usr/runtime/runtime.H +++ b/src/include/usr/runtime/runtime.H @@ -99,14 +99,6 @@ errlHndl_t populate_hbTpmInfo( void ); */ errlHndl_t populate_TpmInfoByNode(); -/** - * @brief Fills in HBRT for given NODE - * - * @param[in] iNodeId : Node number from 0 to 7 ..etc... - * - * @return errlHndl_t NULL on Success - */ -errlHndl_t populate_RtDataByNode(uint64_t iNodeId); // How many pointers/sections there are in HB runtime data #define HBRT_NUM_PTRS 2 diff --git a/src/include/usr/targeting/common/targreasoncodes.H b/src/include/usr/targeting/common/targreasoncodes.H index cf88bc1a9..0652c730d 100644 --- a/src/include/usr/targeting/common/targreasoncodes.H +++ b/src/include/usr/targeting/common/targreasoncodes.H @@ -72,6 +72,7 @@ enum TargetingReasonCode TARG_RC_WRITE_ATTR_OVER_NO_TANK_LAYER = TARG_COMP_ID | 0x12, TARG_RC_MM_BLOCK_MAP_FAIL = TARG_COMP_ID | 0x13, TARG_RC_APPLY_ATTR_OVER_NOT_ALLOWED = TARG_COMP_ID | 0x14, + TARG_RC_MM_BLOCK_UNMAP_FAIL = TARG_COMP_ID | 0x15, }; }; // End TARGETING namespace diff --git a/src/include/usr/util/runtime/util_rt.H b/src/include/usr/util/runtime/util_rt.H index 01aebaf1f..7b4065bbc 100644 --- a/src/include/usr/util/runtime/util_rt.H +++ b/src/include/usr/util/runtime/util_rt.H @@ -23,52 +23,7 @@ /* */ /* IBM_PROLOG_END_TAG */ -#include <limits.h> // for KILOBYTE definition - - -/** - * 8-byte ascii entry labels for hbrt TOC - */ -typedef uint64_t hbrt_mem_label_t; - -// Ascii label "VPD " in hex -constexpr hbrt_mem_label_t HBRT_MEM_LABEL_VPD = 0x5650442020202020; - -// Ascii label "ATTR " in hex -constexpr hbrt_mem_label_t HBRT_MEM_LABEL_ATTR = 0x4154545220202020; - -// Ascii label "ATTROVER" in hex -constexpr hbrt_mem_label_t HBRT_MEM_LABEL_ATTROVER = 0x415454524F564552; - -// Ascii label "PADDING " in hex -constexpr hbrt_mem_label_t HBRT_MEM_LABEL_PADDING = 0x50414444494E4720; - -/** @brief A 32 byte table of contents entry */ -struct hbrtTableOfContentsEntry_t -{ - uint64_t label; // ASCII HBRT_LABEL_x constants - uint64_t size; // data entry size in bytes - uint64_t offset; // offset into section - uint64_t reserved; // incase of future change -} __attribute__ ((packed)); - -// MAX ENTRIES = (4 KB - 64 byte header) / 32 bytes per entry = 126 -#define HBRT_TOC_MAX_ENTRIES \ - (((4*KILOBYTE) - 64) / sizeof(hbrtTableOfContentsEntry_t)) - -/** @brief A 4KB Table of Contents */ -struct hbrtTableOfContents_t -{ - char toc_header[32]; // "Hostboot Table of Contents" - uint8_t toc_version; // version - uint16_t total_entries; // Total entries in TOC - uint64_t total_size; // Total data section size (64k aligned) - uint8_t rsvd[21]; // reserved - hbrtTableOfContentsEntry_t entry[HBRT_TOC_MAX_ENTRIES]; -} __attribute__ ((packed)); - -// Versions of table of contents -const uint8_t HBRT_TOC_VERSION_1 = 0x01; +#include <util/utilrsvdmem.H> /** * @brief Get the address of a reserved hostboot memory region by its label @@ -78,7 +33,9 @@ const uint8_t HBRT_TOC_VERSION_1 = 0x01; * @return virtual address of region or 0 * @platform FSP, OpenPOWER **/ -uint64_t hb_get_rt_rsvd_mem( hbrt_mem_label_t i_label, +uint64_t hb_get_rt_rsvd_mem( Util::hbrt_mem_label_t i_label, uint32_t i_instance, uint64_t & o_size ); + + diff --git a/src/include/usr/util/utilrsvdmem.H b/src/include/usr/util/utilrsvdmem.H new file mode 100644 index 000000000..13632ac5b --- /dev/null +++ b/src/include/usr/util/utilrsvdmem.H @@ -0,0 +1,90 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/util/utilrsvdmem.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef UTILRSVDMEM_H +#define UTILRSVDMEM_H + +#include <limits.h> // for KILOBYTE definition + +namespace Util +{ + /** + * 8-byte ascii entry labels for hbrt TOC + */ + typedef uint64_t hbrt_mem_label_t; + + // Ascii label "VPD " in hex + constexpr hbrt_mem_label_t HBRT_MEM_LABEL_VPD = 0x5650442020202020; + + // Ascii label "ATTR " in hex + constexpr hbrt_mem_label_t HBRT_MEM_LABEL_ATTR = 0x4154545220202020; + + // Ascii label "ATTROVER" in hex + constexpr hbrt_mem_label_t HBRT_MEM_LABEL_ATTROVER = 0x415454524F564552; + + // Ascii label "PADDING " in hex + constexpr hbrt_mem_label_t HBRT_MEM_LABEL_PADDING = 0x50414444494E4720; + + /** @brief A 32 byte table of contents entry */ + struct hbrtTableOfContentsEntry_t + { + uint64_t label; // ASCII HBRT_LABEL_x constants + uint64_t size; // data entry size in bytes + uint64_t offset; // offset into section + uint64_t reserved; // incase of future change + } __attribute__ ((packed)); + + // MAX ENTRIES = (4 KB - 64 byte header) / 32 bytes per entry = 126 + #define HBRT_TOC_MAX_ENTRIES \ + (((4*KILOBYTE) - 64) / sizeof(hbrtTableOfContentsEntry_t)) + + /** @brief A 4KB Table of Contents */ + struct hbrtTableOfContents_t + { + char toc_header[32]; // "Hostboot Table of Contents" + uint8_t toc_version; // version + uint16_t total_entries; // Total entries in TOC + uint64_t total_size; // Total data section size (64k aligned) + uint8_t rsvd[21]; // reserved + hbrtTableOfContentsEntry_t entry[HBRT_TOC_MAX_ENTRIES]; + } __attribute__ ((packed)); + + // Versions of table of contents + const uint8_t HBRT_TOC_VERSION_1 = 0x01; + + /** + * @brief Get the address of a label's section based on TOC + * @param[in] i_label - HBRT_MEM_LABEL_... constant + * @param[in] i_hb_data_toc_addr - pointer to the table of contents + * @param[out] o_size - size of returned region in bytes + * @return virtual address of region or 0 + * @platform FSP, OpenPOWER + **/ + uint64_t hb_find_rsvd_mem_label(hbrt_mem_label_t i_label, + hbrtTableOfContents_t * i_hb_data_toc_addr, + uint64_t & o_size); + +}; + +#endif // UTILRSVDMEM_H diff --git a/src/include/usr/vmmconst.h b/src/include/usr/vmmconst.h index 3c57c50f4..233d5fe19 100644 --- a/src/include/usr/vmmconst.h +++ b/src/include/usr/vmmconst.h @@ -168,40 +168,30 @@ enum BlockPriority #define VMM_ALL_HOMER_OCC_MEMORY_SIZE \ (VMM_OCC_COMMON_SIZE + VMM_HOMER_REGION_SIZE) -/** Memory offset for runtime VPD image */ -// Given value is number of bytes BELOW the top of memory to store -// the runtime image(s) Currently below the OCC HOMER IMAGE -#define VMM_RT_VPD_OFFSET (VMM_RT_VPD_SIZE + \ - VMM_ALL_HOMER_OCC_MEMORY_SIZE) - -/** Memory for VPD */ -#define VMM_VPD_START_OFFSET VMM_OCC_COMMON_END_OFFSET -#define VMM_MODULE_VPD_SIZE (512*KILOBYTE) /* must be 64KB aligned */ -#define VMM_CENTAUR_VPD_SIZE (256*KILOBYTE) /* must be 64KB aligned */ -#define VMM_DIMM_JEDEC_VPD_SIZE (256*KILOBYTE) /* must be 64KB aligned */ -#define VMM_RT_VPD_SIZE (VMM_MODULE_VPD_SIZE + \ - VMM_CENTAUR_VPD_SIZE + \ - VMM_DIMM_JEDEC_VPD_SIZE) -/** End of VPD Area = 201MB */ - /** Memory for attribute data */ -#define VMM_ATTR_DATA_START_OFFSET \ - (VMM_VPD_START_OFFSET + VMM_RT_VPD_SIZE) +#define VMM_ATTR_DATA_START_OFFSET VMM_OCC_COMMON_END_OFFSET #define VMM_ATTR_DATA_SIZE (1*MEGABYTE) -/** End of Attr Area = 202MB */ +/** End of Attr Area = 201MB */ /** Chunk of physical memory used for Dump Source Table */ #define DUMP_TEST_MEMORY_ADDR \ - (VMM_ATTR_DATA_START_OFFSET + VMM_ATTR_DATA_SIZE) /* currently 202MB */ + (VMM_ATTR_DATA_START_OFFSET + VMM_ATTR_DATA_SIZE) /* currently 201MB */ #define DUMP_TEST_MEMORY_SIZE (4*MEGABYTE) -/** End of Dump Source Table = 206MB */ +/** End of Dump Source Table = 205MB */ /** Memory for hostboot data Table of Contents */ #define VMM_HB_DATA_TOC_START_OFFSET \ - (DUMP_TEST_MEMORY_ADDR + DUMP_TEST_MEMORY_SIZE) /* currently 206MB */ -#define VMM_HB_DATA_TOC_END_OFFSET (VMM_HB_DATA_TOC_START_OFFSET + (4*KILOBYTE)) -/** End of HB DATA TOC Area = 206MB + 4KB */ + (DUMP_TEST_MEMORY_ADDR + DUMP_TEST_MEMORY_SIZE) /* currently 205MB */ +/** Variable Attribute overrides and Attributes memory here **/ + +/** Memory for VPD (1 MB total) */ +#define VMM_MODULE_VPD_SIZE (512*KILOBYTE) /* must be 64KB aligned */ +#define VMM_CENTAUR_VPD_SIZE (256*KILOBYTE) /* must be 64KB aligned */ +#define VMM_DIMM_JEDEC_VPD_SIZE (256*KILOBYTE) /* must be 64KB aligned */ +#define VMM_RT_VPD_SIZE ( VMM_MODULE_VPD_SIZE + \ + VMM_CENTAUR_VPD_SIZE + \ + VMM_DIMM_JEDEC_VPD_SIZE ) /** Internode communication area outside of the HB image. diff --git a/src/include/usr/vpd/vpd_if.H b/src/include/usr/vpd/vpd_if.H index 4162e48bc..0d8cc4a2d 100644 --- a/src/include/usr/vpd/vpd_if.H +++ b/src/include/usr/vpd/vpd_if.H @@ -49,12 +49,10 @@ namespace VPD /** * @brief Load the runtime VPD image into memory - * @param[in/out] The physical or virtual address of the VPD image - * @param[in] Is the address virtual? + * @param[in] The virtual address of the VPD image * @return error handle if there was an error */ - errlHndl_t vpd_load_rt_image(uint64_t & io_vpd_addr, - bool i_virtualAddr = false); + errlHndl_t vpd_load_rt_image(uint64_t & i_vpd_addr); /** * @brief This function checks to see if the given mvpd target diff --git a/src/usr/runtime/populate_hbruntime.C b/src/usr/runtime/populate_hbruntime.C index d0a43ed1d..4fb289c54 100644 --- a/src/usr/runtime/populate_hbruntime.C +++ b/src/usr/runtime/populate_hbruntime.C @@ -67,7 +67,7 @@ #include <sbeio/sbe_psudd.H> #include <sbeio/runtime/sbe_msg_passing.H> #include <kernel/bltohbdatamgr.H> -#include <util/runtime/util_rt.H> +#include <util/utilrsvdmem.H> namespace RUNTIME @@ -83,236 +83,6 @@ const uint8_t BITS_PER_BYTE = 8; trace_desc_t *g_trac_runtime = nullptr; TRAC_INIT(&g_trac_runtime, RUNTIME_COMP_NAME, KILOBYTE); -/** This is the original function used to load the HDAT data - * It contains support for PHYP payload - * It does not support OPAL payload - * OPAL must use the new function below - populate_HbRsvMem() - * RTC 169478 - remove when new rsv_mem structure is supported in FSP - */ -errlHndl_t populate_RtDataByNode(uint64_t iNodeId) -{ - TRACFCOMP( g_trac_runtime, ENTER_MRK"populate_RtDataByNode" ); - errlHndl_t l_elog = nullptr; - const char* l_stringLabels[] = - { HBRT_RSVD_MEM__VPD_CACHE , - HBRT_RSVD_MEM__ATTRIBUTES }; - - // OPAL not supported - if(TARGETING::is_sapphire_load()) - { - return l_elog; - } - - do { - // Wipe out our cache of the NACA/SPIRA pointers - RUNTIME::rediscover_hdat(); - - // Find pointer for HBRT data structure on given Node - // Each node will have HBRT_NUM_PTRS sections - - // We will update VPD part first - uint64_t l_section = (iNodeId * HBRT_NUM_PTRS) + HBRT_VPD_SECTION; - uint64_t l_hbrtDataAddr = 0; - uint64_t l_hbrtDataSizeMax = 0; - l_elog = RUNTIME::get_host_data_section(RUNTIME::HBRT, - l_section, - l_hbrtDataAddr, - l_hbrtDataSizeMax ); - if(l_elog != nullptr) - { - TRACFCOMP( g_trac_runtime, - "populate_RtDataByNode fail getHostDataSection VPD" ); - break; - } - - // Currently have access to HBRT data pointer - // So start filling in the structure - hdatHBRT_t* l_hbrtPtr = reinterpret_cast<hdatHBRT_t *>(l_hbrtDataAddr); - - memcpy( l_hbrtPtr->hdatStringName, - l_stringLabels[HBRT_VPD_SECTION], - strlen(l_stringLabels[HBRT_VPD_SECTION]) ); - - l_hbrtPtr->hdatInstance = static_cast<uint32_t>(iNodeId); - - // Need to get the blob pointer one level deeper - l_elog = RUNTIME::get_host_data_section(RUNTIME::HBRT_DATA, - l_section, - l_hbrtDataAddr, - l_hbrtDataSizeMax ); - if(l_elog != nullptr) - { - TRACFCOMP( g_trac_runtime, - "populate_RtDataByNode fail getHostDataSection VPD data" ); - break; - } - - // Put VPD data into the structure now - l_elog = VPD::vpd_load_rt_image( l_hbrtDataAddr ); - if(l_elog != nullptr) - { - TRACFCOMP( g_trac_runtime, - "populate_RtDataByNode fail VPD call" ); - break; - } - - // Time to update ATTRIB section now - l_section = (iNodeId * HBRT_NUM_PTRS) + HBRT_ATTRIB_SECTION; - l_elog = RUNTIME::get_host_data_section(RUNTIME::HBRT, - l_section, - l_hbrtDataAddr, - l_hbrtDataSizeMax ); - if(l_elog != nullptr) - { - TRACFCOMP( g_trac_runtime, - "populate_RtDataByNode fail getHostDataSection ATTRIB" ); - break; - } - - // Put in string/instance into HBRT area - l_hbrtPtr = reinterpret_cast<hdatHBRT_t *>(l_hbrtDataAddr); - memcpy( l_hbrtPtr->hdatStringName, - l_stringLabels[HBRT_ATTRIB_SECTION], - strlen(l_stringLabels[HBRT_ATTRIB_SECTION]) ); - - l_hbrtPtr->hdatInstance = static_cast<uint32_t>(iNodeId); - - // Need to get the blob pointer one level deeper - l_elog = RUNTIME::get_host_data_section(RUNTIME::HBRT_DATA, - l_section, - l_hbrtDataAddr, - l_hbrtDataSizeMax ); - if(l_elog != nullptr) - { - TRACFCOMP( g_trac_runtime, - "populate_RtDataByNode fail getHostDataSection ATTRIB data" ); - break; - } - - //@fixme-RTC:169478-Remove this workaround once HDAT+PHYP is ready - // Add the override data into the back-end of the allocated - // attribute data to handle the case where the RHB pointers - // are not yet being used - { - size_t l_attrOverMaxSize = 64*KILOBYTE; - - // Stick the overrides at Attributes+1MB-64KB - uint8_t* l_overridePtr = - reinterpret_cast<uint8_t*>( l_hbrtDataAddr - + 1*MEGABYTE - - l_attrOverMaxSize ); - - // copy overrides into local buffer - uint8_t* l_overrideData = - reinterpret_cast<uint8_t*>(malloc(l_attrOverMaxSize)); - size_t l_actualSize = l_attrOverMaxSize; - l_elog = TARGETING::AttrRP::saveOverrides( l_overrideData, - l_actualSize ); - if( l_elog ) - { - TRACFCOMP( g_trac_runtime, "workaround is busted!!!" ); - break; - } - else if( l_actualSize > 0 ) - { - memcpy( reinterpret_cast<uint8_t*>(l_hbrtDataAddr - +1*MEGABYTE - -l_attrOverMaxSize), - l_overrideData, - l_actualSize ); - TRACFCOMP( g_trac_runtime, "Copied %d bytes of overrides into HDAT", l_actualSize ); - } - else - { - TRACFCOMP( g_trac_runtime, "No overrides" ); - // add a terminator at the end so that the processing - // code in HBRT is happy - TARGETING::AttrOverrideSection* l_term = - reinterpret_cast<TARGETING::AttrOverrideSection*> - (l_overridePtr); - l_term->iv_layer = TARGETING::AttributeTank::TANK_LAYER_TERM; - } - } - - // Load ATTRIBUTE data into HDAT - TARGETING::AttrRP::save(l_hbrtDataAddr); - - //Create a block map of memory so we can save a copy of the attribute - //data incase we need to MPIPL - //Account HRMOR (non 0 base addr) - uint64_t l_attrDataAddr = cpu_spr_value(CPU_SPR_HRMOR) - + VMM_ATTR_DATA_START_OFFSET; - uint64_t l_attrCopyVmemAddr = - reinterpret_cast<uint64_t>(mm_block_map( - reinterpret_cast<void*>(l_attrDataAddr), - VMM_ATTR_DATA_SIZE )); - - //Make sure the address returned from the block map call is not NULL - if(l_attrCopyVmemAddr != 0) - { - //The function save() for AttrRP saves then entire HBD data - // section of PNOR to the provided vmm address - TARGETING::AttrRP::save(l_attrCopyVmemAddr); - - //Make sure to unmap the virtual address - // because we won't need it anymore - int l_rc = - mm_block_unmap(reinterpret_cast<void*>(l_attrCopyVmemAddr)); - - if(l_rc) - { - TRACFCOMP( g_trac_runtime, - "populate_RtDataByNode fail to unmap physical addr %p, virt addr %p", - reinterpret_cast<void*>(l_attrDataAddr), - reinterpret_cast<void*>(l_attrCopyVmemAddr)); - /*@ errorlog tag - * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE - * @moduleid RUNTIME::MOD_POPULATE_RTDATABYNODE - * @reasoncode RUNTIME::RC_UNMAP_FAIL - * @userdata1 Phys address we are trying to unmap - * @userdata2 Virtual address we are trying to unmap - * - * @devdesc Error unmapping a virtual memory map - * @custdesc Kernel failed to unmap memory - */ - l_elog = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, - RUNTIME::MOD_POPULATE_RTDATABYNODE, - RUNTIME::RC_UNMAP_FAIL, - l_attrDataAddr, - l_attrCopyVmemAddr, - true); - } - } - else - { - TRACFCOMP( g_trac_runtime, - "populate_RtDataByNode fail to map physical addr %p, size %lx", - reinterpret_cast<void*>(l_attrDataAddr), - VMM_ATTR_DATA_SIZE ); - /*@ errorlog tag - * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE - * @moduleid RUNTIME::MOD_POPULATE_RTDATABYNODE - * @reasoncode RUNTIME::RC_CANNOT_MAP_MEMORY - * @userdata1 Phys address we are trying to unmap - * @userdata2 Size of memory we are trying to map - * - * @devdesc Error unmapping a virtual memory map - * @custdesc Kernel failed to map memory - */ - l_elog = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, - RUNTIME::MOD_POPULATE_RTDATABYNODE, - RUNTIME::RC_CANNOT_MAP_MEMORY, - l_attrDataAddr, - VMM_ATTR_DATA_SIZE, - true); - } - - } while(0); - - TRACFCOMP( g_trac_runtime, EXIT_MRK"populate_RtDataByNode" ); - return(l_elog); -} // end populate_RtDataByNode - /** * @brief Get a pointer to the next available @@ -548,9 +318,9 @@ errlHndl_t fill_RsvMem_hbData(uint64_t & io_start_address, uint64_t l_prevDataSize = 0; // TOC to be filled in and added to beginning of HB Data section - hbrtTableOfContents_t l_hbTOC; + Util::hbrtTableOfContents_t l_hbTOC; strcpy(l_hbTOC.toc_header, "Hostboot Table of Contents"); - l_hbTOC.toc_version = HBRT_TOC_VERSION_1; + l_hbTOC.toc_version = Util::HBRT_TOC_VERSION_1; l_hbTOC.total_entries = 0; ///////////////////////////////////////////////////////////// @@ -598,7 +368,7 @@ errlHndl_t fill_RsvMem_hbData(uint64_t & io_start_address, if (l_actualSize > 0) { l_hbTOC.entry[l_hbTOC.total_entries].label = - HBRT_MEM_LABEL_ATTROVER; + Util::HBRT_MEM_LABEL_ATTROVER; l_hbTOC.entry[l_hbTOC.total_entries].offset = 0; l_hbTOC.entry[l_hbTOC.total_entries].size = l_actualSize; l_totalSectionSize += ALIGN_PAGE(l_actualSize); @@ -606,7 +376,7 @@ errlHndl_t fill_RsvMem_hbData(uint64_t & io_start_address, } // Now calculate ATTR size - l_hbTOC.entry[l_hbTOC.total_entries].label = HBRT_MEM_LABEL_ATTR; + l_hbTOC.entry[l_hbTOC.total_entries].label = Util::HBRT_MEM_LABEL_ATTR; l_hbTOC.entry[l_hbTOC.total_entries].offset = 0; l_hbTOC.entry[l_hbTOC.total_entries].size = TARGETING::AttrRP::maxSize(); @@ -615,7 +385,7 @@ errlHndl_t fill_RsvMem_hbData(uint64_t & io_start_address, l_hbTOC.total_entries++; // Fill in VPD size - l_hbTOC.entry[l_hbTOC.total_entries].label = HBRT_MEM_LABEL_VPD; + l_hbTOC.entry[l_hbTOC.total_entries].label = Util::HBRT_MEM_LABEL_VPD; l_hbTOC.entry[l_hbTOC.total_entries].offset = 0; l_hbTOC.entry[l_hbTOC.total_entries].size = VMM_RT_VPD_SIZE; l_totalSectionSize += @@ -636,7 +406,8 @@ errlHndl_t fill_RsvMem_hbData(uint64_t & io_start_address, if (l_actualSizeAligned > 0) { // Add padding section - l_hbTOC.entry[l_hbTOC.total_entries].label = HBRT_MEM_LABEL_PADDING; + l_hbTOC.entry[l_hbTOC.total_entries].label = + Util::HBRT_MEM_LABEL_PADDING; l_hbTOC.entry[l_hbTOC.total_entries].offset = 0; l_hbTOC.entry[l_hbTOC.total_entries].size = l_actualSizeAligned; l_hbTOC.total_entries++; @@ -679,7 +450,7 @@ errlHndl_t fill_RsvMem_hbData(uint64_t & io_start_address, // Figure out the start and end addresses if (i_startAddressValid) { - io_end_address = io_start_address + l_totalSizeAligned - 1; + io_end_address = io_start_address + l_totalSizeAligned; } else { @@ -720,14 +491,14 @@ errlHndl_t fill_RsvMem_hbData(uint64_t & io_start_address, switch ( l_hbTOC.entry[i].label ) { - case HBRT_MEM_LABEL_ATTROVER: + case Util::HBRT_MEM_LABEL_ATTROVER: TRACFCOMP( g_trac_runtime, "fill_RsvMem_hbData> ATTROVER address 0x%.16llX, size: %lld", l_prevDataAddr, aligned_size); TRACFCOMP( g_trac_runtime, "fill_RsvMem_hbData> memcpy %d size", actual_size); memcpy( reinterpret_cast<void*>(l_prevDataAddr), l_overrideData, actual_size); break; - case HBRT_MEM_LABEL_ATTR: + case Util::HBRT_MEM_LABEL_ATTR: TRACFCOMP( g_trac_runtime, "fill_RsvMem_hbData> ATTR address 0x%.16llX, size: %lld", l_prevDataAddr, aligned_size); l_elog = TARGETING::AttrRP::save( reinterpret_cast<uint8_t*>(l_prevDataAddr), @@ -740,9 +511,9 @@ errlHndl_t fill_RsvMem_hbData(uint64_t & io_start_address, } TRACFCOMP( g_trac_runtime, "fill_RsvMem_hbData> TARGETING::AttrRP::save(0x%.16llX) done", l_prevDataAddr); break; - case HBRT_MEM_LABEL_VPD: + case Util::HBRT_MEM_LABEL_VPD: TRACFCOMP( g_trac_runtime, "fill_RsvMem_hbData> VPD address 0x%.16llX, size: %lld", l_prevDataAddr, aligned_size); - l_elog = VPD::vpd_load_rt_image(l_prevDataAddr, true); + l_elog = VPD::vpd_load_rt_image(l_prevDataAddr); if(l_elog) { TRACFCOMP( g_trac_runtime, @@ -846,45 +617,9 @@ errlHndl_t populate_HbRsvMem(uint64_t i_nodeId) break; } - //@fixme-RTC:169478-Remove this workaround once HDAT is ready - // Check to see if HDAT has the space we need allocated - // by looking for a 3rd instance - uint64_t l_rsvMemDataAddr = 0; - uint64_t l_rsvMemDataSizeMax = 0; - l_elog = RUNTIME::get_host_data_section( RUNTIME::RESERVED_MEM, - 3, - l_rsvMemDataAddr, - l_rsvMemDataSizeMax ); - if(l_elog != nullptr) - { - TRACFCOMP( g_trac_runtime, "populate_HbRsvMem> HDAT doesn't have RHB allocated, fall back to using old HBRT data" ); - delete l_elog; - l_elog = nullptr; - break; - } - //end workaround } - else if(TARGETING::is_sapphire_load()) { - //@fixme-RTC:169478-Remove this workaround once HDAT is ready - // Check to see if HDAT has the space we need allocated - // by looking for a 3rd instance - uint64_t l_rsvMemDataAddr = 0; - uint64_t l_rsvMemDataSizeMax = 0; - l_elog = RUNTIME::get_host_data_section( RUNTIME::RESERVED_MEM, - 3, - l_rsvMemDataAddr, - l_rsvMemDataSizeMax ); - if(l_elog != nullptr) - { - TRACFCOMP( g_trac_runtime, "populate_HbRsvMem> HDAT doesn't have RHB allocated - HBRT is NOT supported here" ); - delete l_elog; - l_elog = nullptr; - break; - } - //end workaround - // Opal data goes at top_of_mem l_topMemAddr = TARGETING::get_top_mem_addr(); assert (l_topMemAddr != 0, @@ -1967,7 +1702,7 @@ errlHndl_t populate_hbTpmInfo() if(l_elog != nullptr) { TRACFCOMP( g_trac_runtime, "populate_hbTpmInfo: " - "populate_RtDataByNode failed" ); + "populate_TpmInfoByNode failed" ); } break; } @@ -2034,18 +1769,6 @@ errlHndl_t populate_hbRuntimeData( void ) // needs to be setup by a hb routine that snoops for multiple nodes. if (0 == hb_images) //Single-node { - //@fixme-RTC:169478-Remove once all code has switched - if( TARGETING::is_phyp_load() ) - { - // Single node system, call inline and pass in our node number - l_elog = populate_RtDataByNode(0); - if(l_elog != nullptr) - { - TRACFCOMP( g_trac_runtime, "populate_RtDataByNode failed" ); - break; - } - } - if( !TARGETING::is_no_load() ) { l_elog = populate_HbRsvMem(nodeid); @@ -2087,7 +1810,6 @@ errlHndl_t populate_hbRuntimeData( void ) // Need to send message to the node (l_node) // When NODE receives the msg it should - // call populate_RtDataByNode(itsNodeId) // call populate_HbRsvMem(itsNodeId) TRACFCOMP( g_trac_runtime, "MsgToNode %d for HBRT Data", l_node ); diff --git a/src/usr/targeting/attrrp.C b/src/usr/targeting/attrrp.C index da1efdb15..1ab96e6ea 100755 --- a/src/usr/targeting/attrrp.C +++ b/src/usr/targeting/attrrp.C @@ -47,6 +47,7 @@ #include <targeting/common/attributeTank.H> #include <initservice/initserviceif.H> #include <util/align.H> +#include <util/utilrsvdmem.H> #include <sys/misc.h> #include <fapi2/plat_attr_override_sync.H> #include <targeting/attrPlatOverride.H> @@ -320,17 +321,92 @@ namespace TARGETING //Create a block map of the address space we used to store //attribute information on the initial IPL //Account HRMOR (non 0 base addr) - uint64_t l_attr_data_addr = cpu_spr_value(CPU_SPR_HRMOR) - + VMM_ATTR_DATA_START_OFFSET; - l_header = reinterpret_cast<TargetingHeader*>( - mm_block_map(reinterpret_cast<void*>(l_attr_data_addr), - VMM_ATTR_DATA_SIZE)); + + /////////////////////////////////////////////////////////////// + // This should change to get address from SBE. Currently hack + // to the start of ATTR data section on FSP systems + uint64_t l_phys_attr_data_addr = 0; + uint64_t l_attr_data_size = 0; + + // Setup physical TOC address + uint64_t l_toc_addr = cpu_spr_value(CPU_SPR_HRMOR) + + VMM_HB_DATA_TOC_START_OFFSET; + + // Now map the TOC to find the ATTR label address & size + Util::hbrtTableOfContents_t * l_toc_ptr = + reinterpret_cast<Util::hbrtTableOfContents_t *>( + mm_block_map(reinterpret_cast<void*>(l_toc_addr), + sizeof(Util::hbrtTableOfContents_t))); + + if (l_toc_ptr != 0) + { + // read the TOC and look for ATTR data section + uint64_t l_attr_data_addr = Util::hb_find_rsvd_mem_label( + Util::HBRT_MEM_LABEL_ATTR, + l_toc_ptr, + l_attr_data_size); + + // calculate the offset from the start of the TOC + uint64_t l_attr_offset = l_attr_data_addr - + reinterpret_cast<uint64_t>(l_toc_ptr); + + // Setup where the ATTR data can be found + l_phys_attr_data_addr = l_toc_addr + l_attr_offset; + + // Clear the mapped memory for the TOC + int l_rc = mm_block_unmap( + reinterpret_cast<void*>(l_toc_ptr)); + if(l_rc) + { + TRACFCOMP( g_trac_targeting, + "parseAttrSectHeader. fail to unmap virt addr %p, " + " rc = %d", + reinterpret_cast<void*>(l_toc_ptr), l_rc); + //Error mm_block_unmap returned non-zero + /*@ + * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE + * @moduleid TARG_PARSE_ATTR_SECT_HEADER + * @reasoncode TARG_RC_MM_BLOCK_UNMAP_FAIL + * @userdata1 return code + * @userdata2 Unmap virtual address + * + * @devdesc While attempting to unmap a virtual + * addr for our targeting information the + * kernel returned an error + * @custdesc Kernel failed to unblock mapped memory + */ + l_errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE, + TARG_PARSE_ATTR_SECT_HEADER, + TARG_RC_MM_BLOCK_FAIL, + l_rc, + reinterpret_cast<uint64_t> + (l_toc_ptr), + true); + break; + } + + // Now just map the ATTR data section + l_header = reinterpret_cast<TargetingHeader*>( + mm_block_map( + reinterpret_cast<void*>(l_phys_attr_data_addr), + l_attr_data_size)); + } + else + { + TRACFCOMP(g_trac_targeting, + "Failed mapping Table of Contents section"); + l_header = 0; + l_phys_attr_data_addr = l_toc_addr; + l_attr_data_size = sizeof(Util::hbrtTableOfContents_t); + } + /////////////////////////////////////////////////////////////// + if(l_header == 0) { TRACFCOMP(g_trac_targeting, "Failed mapping phys addr: %p for %lx bytes", - l_attr_data_addr, - VMM_ATTR_DATA_SIZE); + l_phys_attr_data_addr, + l_attr_data_size); //Error mm_block_map returned invalid ptr /*@ * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE @@ -347,14 +423,14 @@ namespace TARGETING l_errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE, TARG_PARSE_ATTR_SECT_HEADER, TARG_RC_MM_BLOCK_FAIL, - l_attr_data_addr, - VMM_ATTR_DATA_SIZE, + l_phys_attr_data_addr, + l_attr_data_size, true); break; } TRACFCOMP(g_trac_targeting, "Mapped phys addr: %p to virt addr: %p", - reinterpret_cast<void*>(l_attr_data_addr), + reinterpret_cast<void*>(l_phys_attr_data_addr), l_header); } diff --git a/src/usr/targeting/runtime/attrPlatOverride_rt.C b/src/usr/targeting/runtime/attrPlatOverride_rt.C index a8bf17f94..6b9fc5a8f 100644 --- a/src/usr/targeting/runtime/attrPlatOverride_rt.C +++ b/src/usr/targeting/runtime/attrPlatOverride_rt.C @@ -133,7 +133,7 @@ void applyTempOverrides() // Get a pointer to the reserved memory where HB // saved the overrides during boot uint64_t l_overAttrSize = 0; - uint64_t l_overAddr = hb_get_rt_rsvd_mem(HBRT_MEM_LABEL_ATTROVER, + uint64_t l_overAddr = hb_get_rt_rsvd_mem(Util::HBRT_MEM_LABEL_ATTROVER, 0, l_overAttrSize); diff --git a/src/usr/targeting/runtime/attrrp_rt.C b/src/usr/targeting/runtime/attrrp_rt.C index 857b58fd0..7262c0f5a 100644 --- a/src/usr/targeting/runtime/attrrp_rt.C +++ b/src/usr/targeting/runtime/attrrp_rt.C @@ -47,7 +47,7 @@ namespace TARGETING uint64_t attr_size = 0; TargetingHeader* l_header = reinterpret_cast<TargetingHeader*>( - hb_get_rt_rsvd_mem(HBRT_MEM_LABEL_ATTR,0,attr_size)); + hb_get_rt_rsvd_mem(Util::HBRT_MEM_LABEL_ATTR,0,attr_size)); if ((NULL == l_header) || (l_header->eyeCatcher != PNOR_TARG_EYE_CATCHER)) diff --git a/src/usr/testcore/rtloader/loader.H b/src/usr/testcore/rtloader/loader.H index 4613d1c66..11bbc6f3d 100644 --- a/src/usr/testcore/rtloader/loader.H +++ b/src/usr/testcore/rtloader/loader.H @@ -44,7 +44,7 @@ #include <ipmi/ipmiif.H> #include <targeting/common/attributeTank.H> #include <config.h> -#include <util/runtime/util_rt.H> +#include <util/utilrsvdmem.H> #include <sys/misc.h> @@ -405,12 +405,12 @@ class RuntimeLoaderTest : public CxxTest::TestSuite VMM_HB_DATA_TOC_START_OFFSET; TRACFCOMP(g_trac_hbrt, "rt_get_hb_data: " - "mapping physical address:0x%.1611X", l_physical_addr); + "mapping physical address:0x%.16llX", l_physical_addr); // Map to the virtual address to access data l_vAddr = reinterpret_cast<uint64_t>(mm_block_map( reinterpret_cast<void*>(l_physical_addr), - sizeof(hbrtTableOfContents_t))); + sizeof(Util::hbrtTableOfContents_t))); TRACFCOMP(g_trac_hbrt, "rt_get_hb_data: mapped " "physical address 0x%.16llX -> virtual address 0x%.16llX", @@ -420,8 +420,8 @@ class RuntimeLoaderTest : public CxxTest::TestSuite assert(l_vAddr != 0,"rt_get_hb_data. Could not map HB DATA memory"); // find the total size - hbrtTableOfContents_t * toc_ptr = - reinterpret_cast<hbrtTableOfContents_t *>(l_vAddr); + Util::hbrtTableOfContents_t * toc_ptr = + reinterpret_cast<Util::hbrtTableOfContents_t *>(l_vAddr); l_totalSize = toc_ptr->total_size; TRACFCOMP(g_trac_hbrt, "rt_get_hb_data: " "total_size for HB Data = %lld", l_totalSize); @@ -642,7 +642,8 @@ class RuntimeLoaderTest : public CxxTest::TestSuite assert (cv_comm_phys_addr != 0, "rt_get_comm: Top of memory was 0!"); - cv_comm_phys_addr -= (VMM_RT_VPD_OFFSET + 64*KILOBYTE); + // Just picking 64K inside VMM_ATTR_DATA as it is available for HDAT + cv_comm_phys_addr -= (VMM_ALL_HOMER_OCC_MEMORY_SIZE + 64*KILOBYTE); uint8_t *comm_ptr = reinterpret_cast<uint8_t *>(cv_comm_phys_addr); diff --git a/src/usr/util/makefile b/src/usr/util/makefile index 3c8e04183..6f6623d6f 100644 --- a/src/usr/util/makefile +++ b/src/usr/util/makefile @@ -35,6 +35,7 @@ OBJS += utillidpnor.o OBJS += utilmbox_scratch.o OBJS += utiltcemgr.o OBJS += utilsemipersist.o +OBJS += utilrsvdmem.o SUBDIRS += test.d SUBDIRS += runtime.d diff --git a/src/usr/util/runtime/makefile b/src/usr/util/runtime/makefile index 6512606d2..c9bc4b0ef 100644 --- a/src/usr/util/runtime/makefile +++ b/src/usr/util/runtime/makefile @@ -34,6 +34,7 @@ OBJS += utilfile.o OBJS += utillidpnor.o OBJS += rt_cmds.o OBJS += util_rt.o +OBJS += utilrsvdmem.o SUBDIRS += test.d diff --git a/src/usr/util/runtime/util_rt.C b/src/usr/util/runtime/util_rt.C index 633456248..aee9b4871 100644 --- a/src/usr/util/runtime/util_rt.C +++ b/src/usr/util/runtime/util_rt.C @@ -25,8 +25,10 @@ #include <targeting/common/trace.H> #include <trace/interface.H> #include <runtime/interface.h> +#include <util/utilrsvdmem.H> #include <util/runtime/util_rt.H> + /** * @brief Get the address of a reserved hostboot memory region by its label * @param[in] i_label HBRT_MEM_LABEL_ constant @@ -35,22 +37,22 @@ * @return virtual address of region or 0 * @platform FSP, OpenPOWER **/ -uint64_t hb_get_rt_rsvd_mem(hbrt_mem_label_t i_label, +uint64_t hb_get_rt_rsvd_mem(Util::hbrt_mem_label_t i_label, uint32_t i_instance, uint64_t & o_size) { uint64_t l_label_data_addr = 0; o_size = 0; - TRACFCOMP(TARGETING::g_trac_targeting, ENTER_MRK"hb_get_rt_rsvd_mem(0x%llX, %d, %ld) -> 0x%X", - i_label,i_instance, o_size,l_label_data_addr); + TRACFCOMP(TARGETING::g_trac_targeting, + ENTER_MRK"hb_get_rt_rsvd_mem(0x%llX, %d)", i_label, i_instance); switch(i_label) { - case HBRT_MEM_LABEL_VPD: - case HBRT_MEM_LABEL_ATTR: - case HBRT_MEM_LABEL_ATTROVER: - case HBRT_MEM_LABEL_PADDING: + case Util::HBRT_MEM_LABEL_VPD: + case Util::HBRT_MEM_LABEL_ATTR: + case Util::HBRT_MEM_LABEL_ATTROVER: + case Util::HBRT_MEM_LABEL_PADDING: if( (g_hostInterfaces != NULL) && (g_hostInterfaces->get_reserved_mem) ) { @@ -59,27 +61,12 @@ uint64_t hb_get_rt_rsvd_mem(hbrt_mem_label_t i_label, i_instance); if (0 != hb_data_addr) { - hbrtTableOfContents_t * toc_ptr = - reinterpret_cast<hbrtTableOfContents_t *>(hb_data_addr); - - // Find offset of label section - for (uint16_t i = 0; i < toc_ptr->total_entries; i++) - { - if (toc_ptr->entry[i].label == i_label) - { - l_label_data_addr = hb_data_addr + - toc_ptr->entry[i].offset; - o_size = toc_ptr->entry[i].size; - TRACFCOMP(TARGETING::g_trac_targeting, "hb_get_rt_rsvd_mem: Entry found at 0x%.16llX, size %ld", - l_label_data_addr, o_size); - break; - } - } - - if (0 == o_size) - { - TRACFCOMP(TARGETING::g_trac_targeting, "hb_get_rt_rsvd_mem: Entry %.16llX not found", i_label); - } + Util::hbrtTableOfContents_t * toc_ptr = + reinterpret_cast<Util::hbrtTableOfContents_t *>( + hb_data_addr); + l_label_data_addr = Util::hb_find_rsvd_mem_label(i_label, + toc_ptr, + o_size); } else { @@ -100,8 +87,9 @@ uint64_t hb_get_rt_rsvd_mem(hbrt_mem_label_t i_label, break; } - TRACFCOMP(TARGETING::g_trac_targeting, EXIT_MRK"hb_get_rt_rsvd_mem(0x%X, %d, %ld) -> 0x%X", - i_label,i_instance, o_size,l_label_data_addr); + TRACFCOMP(TARGETING::g_trac_targeting, + EXIT_MRK"hb_get_rt_rsvd_mem(0x%X, %d, %ld) -> 0x%.16llX", + i_label, i_instance, o_size,l_label_data_addr); return l_label_data_addr; } diff --git a/src/usr/util/utilrsvdmem.C b/src/usr/util/utilrsvdmem.C new file mode 100644 index 000000000..6af061280 --- /dev/null +++ b/src/usr/util/utilrsvdmem.C @@ -0,0 +1,102 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/util/utilrsvdmem.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +/*****************************************************************************/ +// I n c l u d e s +/*****************************************************************************/ +#include <targeting/common/trace.H> +#include <trace/interface.H> +#include <util/utilrsvdmem.H> + +namespace Util +{ + /** + * @brief Get the address of a label's section based on table of contents + * + * @param[in] i_label - HBRT_MEM_LABEL_... constant + * @param[in] i_hb_data_toc_addr - pointer to the table of contents + * @param[out] o_size - size of returned region in bytes + * + * @return virtual address of region or 0 + * @platform FSP, OpenPOWER + **/ + uint64_t hb_find_rsvd_mem_label(hbrt_mem_label_t i_label, + hbrtTableOfContents_t * i_hb_data_toc_addr, + uint64_t & o_size) + { + // initialize to not return anything + uint64_t l_label_data_addr = 0; + o_size = 0; + + TRACFCOMP(TARGETING::g_trac_targeting, + ENTER_MRK"hb_find_rsvd_mem_label(0x%llX, %p)", + i_label, i_hb_data_toc_addr); + + hbrtTableOfContents_t * toc_ptr = i_hb_data_toc_addr; + switch(i_label) + { + case HBRT_MEM_LABEL_VPD: + case HBRT_MEM_LABEL_ATTR: + case HBRT_MEM_LABEL_ATTROVER: + case HBRT_MEM_LABEL_PADDING: + // Find offset of label section + for (uint16_t i = 0; i < toc_ptr->total_entries; i++) + { + if (toc_ptr->entry[i].label == i_label) + { + l_label_data_addr = + reinterpret_cast<uint64_t>(i_hb_data_toc_addr) + + toc_ptr->entry[i].offset; + o_size = toc_ptr->entry[i].size; + TRACFCOMP(TARGETING::g_trac_targeting, + "hb_find_rsvd_mem_label: " + "Entry found at offset 0x%.16llX, size %ld", + toc_ptr->entry[i].offset, o_size); + break; + } + } + + if (0 == o_size) + { + TRACFCOMP(TARGETING::g_trac_targeting, + "hb_find_rsvd_mem_label: Entry %.16llX not found", + i_label); + } + break; + default: + // unknown label? + TRACFCOMP(TARGETING::g_trac_targeting, + "hb_find_rsvd_mem_label: unknown label 0x%.16llX", + i_label); + break; + } + + TRACFCOMP(TARGETING::g_trac_targeting, + EXIT_MRK"hb_find_rsvd_mem_label(0x%.16llX, %lld) -> 0x%.16llX", + i_label, o_size, l_label_data_addr); + + return l_label_data_addr; + } + +}; diff --git a/src/usr/vpd/rtvpd_load.C b/src/usr/vpd/rtvpd_load.C index 5fb8948e2..26ad6f031 100644 --- a/src/usr/vpd/rtvpd_load.C +++ b/src/usr/vpd/rtvpd_load.C @@ -102,32 +102,15 @@ errlHndl_t bld_vpd_image(PNOR::SectionId vpd_type, } // External function see vpd_if.H -errlHndl_t VPD::vpd_load_rt_image(uint64_t & io_vpd_addr, bool i_virtualAddr) +errlHndl_t VPD::vpd_load_rt_image(uint64_t & i_vpd_addr) { errlHndl_t err = NULL; do { - void* vptr = reinterpret_cast<void*>(io_vpd_addr); + void* vptr = reinterpret_cast<void*>(i_vpd_addr); uint8_t* vpd_ptr = reinterpret_cast<uint8_t*>(vptr); - bool l_is_no_load = TARGETING::is_no_load(); - if( l_is_no_load && !i_virtualAddr) - { - io_vpd_addr = TARGETING::get_top_mem_addr(); - assert (io_vpd_addr != 0, - "vpd_load_rt_image: Top of memory was 0!"); - - io_vpd_addr -= VMM_RT_VPD_OFFSET; - - vptr = mm_block_map(reinterpret_cast<void*>(io_vpd_addr), - VMM_RT_VPD_SIZE); - - vpd_ptr = reinterpret_cast<uint8_t*>(vptr); - - assert(vptr != NULL,"vpd_load_rt_image: Could not map VPD memory"); - } - err = bld_vpd_image(PNOR::DIMM_JEDEC_VPD, vpd_ptr, VMM_DIMM_JEDEC_VPD_SIZE); @@ -154,11 +137,6 @@ errlHndl_t VPD::vpd_load_rt_image(uint64_t & io_vpd_addr, bool i_virtualAddr) break; } - if ( l_is_no_load && !i_virtualAddr) - { - mm_block_unmap(vptr); - } - } while( 0 ); return err; diff --git a/src/usr/vpd/runtime/rt_vpd.C b/src/usr/vpd/runtime/rt_vpd.C index e83889381..2d07a4fb8 100644 --- a/src/usr/vpd/runtime/rt_vpd.C +++ b/src/usr/vpd/runtime/rt_vpd.C @@ -98,7 +98,7 @@ errlHndl_t getPnorAddr( pnorInformation & i_pnorInfo, if( g_reserved_mem_addr == 0 ) { uint64_t l_vpdSize; - g_reserved_mem_addr = hb_get_rt_rsvd_mem(HBRT_MEM_LABEL_VPD, + g_reserved_mem_addr = hb_get_rt_rsvd_mem(Util::HBRT_MEM_LABEL_VPD, 0, l_vpdSize); |