diff options
author | Brian Stegmiller <bjs@us.ibm.com> | 2016-02-22 16:20:20 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2016-06-23 16:21:46 -0400 |
commit | e860d319c4e54ca061283fcd2342e4deb38c467d (patch) | |
tree | a7bf5319f8ce1d6cd70a27e233501c8007cd43db | |
parent | 49eae5fb8adc7df4decb59ad0e788330ba2bff16 (diff) | |
download | talos-hostboot-e860d319c4e54ca061283fcd2342e4deb38c467d.tar.gz talos-hostboot-e860d319c4e54ca061283fcd2342e4deb38c467d.zip |
Support HB runtime data for adjunct partition
Change-Id: I7249f2b195dd02a0ab5a88b53d63cc4a1663cf9d
RTC: 138638
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/25373
Tested-by: Jenkins Server
Tested-by: FSP CI Jenkins
Reviewed-by: Elizabeth K. Liner <eliner@us.ibm.com>
Reviewed-by: Brian J. Stegmiller <bjs@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r-- | src/include/usr/runtime/runtime.H | 34 | ||||
-rw-r--r-- | src/include/usr/targeting/attrrp.H | 14 | ||||
-rw-r--r-- | src/usr/isteps/istep16/call_host_ipl_complete.C | 36 | ||||
-rw-r--r-- | src/usr/isteps/istep21/call_host_runtime_setup.C | 20 | ||||
-rw-r--r-- | src/usr/runtime/hdatservice.C | 186 | ||||
-rw-r--r-- | src/usr/runtime/hdatstructs.H | 22 | ||||
-rw-r--r-- | src/usr/runtime/makefile | 1 | ||||
-rw-r--r-- | src/usr/runtime/populate_attributes.C | 2 | ||||
-rw-r--r-- | src/usr/runtime/populate_hbruntime.C | 231 | ||||
-rwxr-xr-x | src/usr/targeting/attrrp.C | 47 | ||||
-rw-r--r-- | src/usr/targeting/runtime/attrPlatOverride_rt.C | 9 | ||||
-rw-r--r-- | src/usr/vpd/rtvpd_load.C | 33 |
12 files changed, 445 insertions, 190 deletions
diff --git a/src/include/usr/runtime/runtime.H b/src/include/usr/runtime/runtime.H index 73633cb00..286e649e5 100644 --- a/src/include/usr/runtime/runtime.H +++ b/src/include/usr/runtime/runtime.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ +/* Contributors Listed Below - COPYRIGHT 2012,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -62,6 +62,28 @@ errlHndl_t populate_node_attributes( uint64_t i_nodeNum ); errlHndl_t load_host_data( void ); /** + * @brief Populate HB runtime data in mainstore + * + * @return errlHndl_t NULL on Success + */ +errlHndl_t populate_hbRuntimeData( void ); + +/** + * @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 +// sections defined by above literal +#define HBRT_VPD_SECTION 0 +#define HBRT_ATTRIB_SECTION 1 + +/** * HDAT Sections */ enum SectionId @@ -77,7 +99,9 @@ enum SectionId SPIRA_H, //< SPIRA-H SPIRA_L, //< Legacy SPIRA NACA, //< NACA - LAST_SECTION = NACA //< Placeholder for arrays + HBRT, //< Hostboot Runtime + HBRT_DATA, //< Hostboot Runtime Data + LAST_SECTION = HBRT_DATA //< Placeholder for arrays }; /** @@ -85,7 +109,7 @@ enum SectionId * the host data memory. * * @description The returned pointer will not include any header hdat header - * information. + * information. * * @param[in] i_section Chunk of data to find * @param[in] i_instance Instance of section when there are multiple entries @@ -101,7 +125,7 @@ errlHndl_t get_host_data_section( SectionId i_section, const size_t DATA_SIZE_UNKNOWN = 0xFFFFFFFFFFFFFFFF; /** - * @brief Store the actual count of a section in local memory. + * @brief Store the actual count of a section in local memory. * * @param[in] i_section Chunk of data to update * @param[in] i_count Actual number of entries @@ -145,4 +169,4 @@ void rediscover_hdat( void ); } -#endif +#endif diff --git a/src/include/usr/targeting/attrrp.H b/src/include/usr/targeting/attrrp.H index cdbb79319..99b9800ff 100644 --- a/src/include/usr/targeting/attrrp.H +++ b/src/include/usr/targeting/attrrp.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2016 */ +/* [+] 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. */ @@ -169,6 +171,16 @@ class AttrRP * @return Virtual address to the region. */ static void* save(uint64_t& io_addr); + + /** + * @brief Returns size needed to save all attributes + * + * HDAT requires up front knowledge of largest section + * + * + * @return Size of all attribute sections + */ + static uint64_t maxSize( ); #endif protected: diff --git a/src/usr/isteps/istep16/call_host_ipl_complete.C b/src/usr/isteps/istep16/call_host_ipl_complete.C index cb6da0f71..9c25e00a5 100644 --- a/src/usr/isteps/istep16/call_host_ipl_complete.C +++ b/src/usr/isteps/istep16/call_host_ipl_complete.C @@ -41,6 +41,9 @@ #include <p9_switch_rec_attn.H> #include <p9_switch_cfsim.H> +#include <targeting/attrrp.H> +#include <sys/internode.h> +#include <runtime/runtime.H> using namespace ERRORLOG; using namespace TARGETING; @@ -60,6 +63,39 @@ void* call_host_ipl_complete (void *io_pArgs) "call_host_ipl_complete entry" ); do { + // Initialize the RUNTIME DATA attributes + // that HDAT needs to allocate memory for us. + // ----------------------------------------- + TARGETING::Target * sys = NULL; + TARGETING::targetService().getTopLevelTarget( sys ); + assert(sys != NULL); + + // Set number of pointer pairs for HDAT + //@TODO RTC:142908 Support multiple nodes in HBRT + const uint32_t NUM_NODES = 1; + uint32_t l_numSections = NUM_NODES * HBRT_NUM_PTRS; + sys->setAttr<ATTR_HDAT_HBRT_NUM_SECTIONS>(l_numSections); + + uint64_t l_maxSecSize = VMM_RT_VPD_SIZE; + + // Set max size of a section for HDAT + TARGETING::ATTR_HDAT_HBRT_SECTION_SIZE_type l_secSize = {0}; + uint64_t *l_p_secSize = + reinterpret_cast<uint64_t *>(&l_secSize); + + uint32_t l_attrArraySize = + sizeof(ATTR_HDAT_HBRT_SECTION_SIZE_type) / sizeof(l_secSize[0]); + assert(l_numSections <= l_attrArraySize); + + uint64_t l_attrSize = AttrRP::maxSize(); + l_maxSecSize = (l_attrSize > l_maxSecSize) ? l_attrSize : l_maxSecSize; + + for (uint32_t l_sect=0; (l_sect < l_numSections); l_sect++) + { + l_p_secSize[l_sect] = l_maxSecSize; + } + sys->setAttr<ATTR_HDAT_HBRT_SECTION_SIZE>(l_secSize); + //@TODO RTC:150266 HWPs for Centuar+Cumulus // Need cen_switch_rec_attn for mem_chips diff --git a/src/usr/isteps/istep21/call_host_runtime_setup.C b/src/usr/isteps/istep21/call_host_runtime_setup.C index 55ec5c659..7ec5f883e 100644 --- a/src/usr/isteps/istep21/call_host_runtime_setup.C +++ b/src/usr/isteps/istep21/call_host_runtime_setup.C @@ -34,6 +34,9 @@ #include <runtime/runtime.H> #include <devtree/devtreeif.H> #include <runtime/customize_attrs_for_payload.H> +#include <targeting/common/util.H> + + #include <hbotcompid.H> using namespace ERRORLOG; @@ -86,6 +89,23 @@ void* call_host_runtime_setup (void *io_pArgs) break; } + // Fill in Hostboot runtime data for all nodes + // (adjunct partition) + if( TARGETING::is_phyp_load() ) + { + // Write the HB runtime data into mainstore + l_err = RUNTIME::populate_hbRuntimeData(); + if ( l_err ) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "Failed hbRuntimeData setup" ); + // break from do loop if error occured + break; + } + + } // end if phyp load + + //@TODO RTC:133848 /* bool l_activateOCC = is_avp_load(); diff --git a/src/usr/runtime/hdatservice.C b/src/usr/runtime/hdatservice.C index 4f3a94fb7..7df89c269 100644 --- a/src/usr/runtime/hdatservice.C +++ b/src/usr/runtime/hdatservice.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ +/* Contributors Listed Below - COPYRIGHT 2012,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -52,15 +52,9 @@ namespace RUNTIME /******************** Local Constants used for sanity checks ********************/ -const hdatHeaderExp_t HSVC_NODE_DATA_HEADER = { - 0xD1F0, // id - "HS KID", // name - 0x0020 //version -}; - -const hdatHeaderExp_t HSVC_DATA_HEADER = { +const hdatHeaderExp_t HBRT_DATA_HEADER = { 0xD1F0, //id - "HOSTSR", //name + "HBRT ", //name 0x0010 //version }; @@ -79,7 +73,7 @@ const hdatHeaderExp_t SPIRAH_HEADER = { const hdatHeaderExp_t SPIRAS_HEADER = { 0xD1F0, //id "SPIRAS", //name - 0x0040 //version + 0x0050 //version }; //big enough to hold all of PHYP @@ -679,21 +673,24 @@ errlHndl_t hdatService::getHostDataSection( SectionId i_section, o_dataSize = 0; } } - // Host Services System Data - else if( RUNTIME::HSVC_SYSTEM_DATA == i_section ) + // HB Runtime Data + else if ( (RUNTIME::HBRT == i_section) || + (RUNTIME::HBRT_DATA == i_section) ) { + // Data section requires drilling to dataBlob + bool l_needBlob = (RUNTIME::HBRT_DATA == i_section); // Find the right tuple and verify it makes sense hdat5Tuple_t* tuple = NULL; if( iv_spiraS ) { - tuple = &(iv_spiraS->hdatDataArea[SPIRAS_HSVC_DATA]); + tuple = &(iv_spiraS->hdatDataArea[SPIRAS_HBRT_DATA]); } else if( unlikely(iv_spiraL != NULL) ) { - tuple = &(iv_spiraL->hdatDataArea[SPIRAL_HSVC_DATA]); + tuple = &(iv_spiraL->hdatDataArea[SPIRAL_HBRT_DATA]); } - TRACUCOMP( g_trac_runtime, "HSVC_SYSTEM_DATA tuple=%p", tuple ); + TRACUCOMP(g_trac_runtime, "HBRT_DATA tuple=%p", tuple); errhdl = check_tuple( i_section, tuple ); if( errhdl ) { break; } @@ -702,159 +699,38 @@ errlHndl_t hdatService::getHostDataSection( SectionId i_section, errhdl = getSpiraTupleVA(tuple, base_addr); if( errhdl ) { break; } - hdatHDIF_t* hsvc_header = + hdatHDIF_t* hbrt_header = reinterpret_cast<hdatHDIF_t*>(base_addr); - TRACUCOMP( g_trac_runtime, "hsvc_header=%p", hsvc_header ); + TRACUCOMP( g_trac_runtime, "hbrt_header=%p", hbrt_header ); // Check the headers and version info - errhdl = check_header( hsvc_header, - HSVC_DATA_HEADER ); + errhdl = check_header( hbrt_header, + HBRT_DATA_HEADER ); if( errhdl ) { break; } - hdatHDIFDataHdr_t* sys_header = + hdatHDIFDataHdr_t* hbrt_data_header = reinterpret_cast<hdatHDIFDataHdr_t*> - (hsvc_header->hdatDataPtrOffset + base_addr); - TRACUCOMP( g_trac_runtime, "sys_header=%p", sys_header ); + (hbrt_header->hdatDataPtrOffset + base_addr); + + TRACUCOMP( g_trac_runtime, "hbrt_data_header=%p", hbrt_data_header ); // Make sure the Data Header is pointing somewhere valid - errhdl = verify_hdat_address( sys_header, + errhdl = verify_hdat_address( (hbrt_data_header + i_instance), sizeof(hdatHDIFDataHdr_t) ); if( errhdl ) { break; } - o_dataAddr = sys_header->hdatOffset + base_addr; - o_dataSize = sys_header->hdatSize; - } - // Host Services Node Data - else if( RUNTIME::HSVC_NODE_DATA == i_section ) - { - // Find the right tuple and verify it makes sense - hdat5Tuple_t* tuple = NULL; - if( iv_spiraS ) - { - tuple = &(iv_spiraS->hdatDataArea[SPIRAS_HSVC_DATA]); - } - else if( unlikely(iv_spiraL != NULL) ) - { - tuple = &(iv_spiraL->hdatDataArea[SPIRAL_HSVC_DATA]); - } - TRACUCOMP( g_trac_runtime, "HSVC_NODE_DATA tuple=%p", tuple ); - errhdl = check_tuple( i_section, - tuple ); - if( errhdl ) { break; } - + o_dataAddr = hbrt_data_header[i_instance].hdatOffset + base_addr; + o_dataSize = hbrt_data_header[i_instance].hdatSize; - uint64_t base_addr; - errhdl = getSpiraTupleVA(tuple, base_addr); - if( errhdl ) { break; } - - hdatHDIF_t* hsvc_header = - reinterpret_cast<hdatHDIF_t*>(base_addr); - TRACUCOMP( g_trac_runtime, "hsvc_header=%p", hsvc_header ); - - // Check the headers and version info - errhdl = check_header( hsvc_header, - HSVC_DATA_HEADER ); - if( errhdl ) { break; } - - hdatHDIFChildHdr_t* node_header = - reinterpret_cast<hdatHDIFChildHdr_t*> - (hsvc_header->hdatChildStrOffset + base_addr); - uint64_t first_node_header = - mm_virt_to_phys(reinterpret_cast<void*>(node_header)); - TRACUCOMP( g_trac_runtime, "first node_header=%X->%p", first_node_header, node_header ); - - // Make sure the Child Header is pointing somewhere valid - errhdl = verify_hdat_address( node_header, - sizeof(hdatHDIFChildHdr_t) ); - if( errhdl ) { break; } - - hdatHDIF_t* node_data_header = - reinterpret_cast<hdatHDIF_t*> - (node_header->hdatOffset + base_addr); - - // Loop around all instances because the data - // could be sparsely populated - TRACUCOMP( g_trac_runtime, "nodecount=%d", node_header->hdatCnt ); - bool foundit = false; - uint32_t found_instances = 0; - for( uint8_t index = 0; index < node_header->hdatCnt; index++ ) - { - // Make sure the headers are all in a valid range - errhdl = verify_hdat_address( node_data_header, - sizeof(hdatHDIF_t) ); - if( errhdl ) { break; } - - uint64_t phys_addr = - mm_virt_to_phys(reinterpret_cast<void*>(node_data_header)); - TRACFCOMP( g_trac_runtime, "index=%d, header=%p->%X", index, node_data_header, phys_addr ); - // Check the headers and version info - errhdl = check_header( node_data_header, - HSVC_NODE_DATA_HEADER ); - if( errhdl ) { break; } - - TRACFCOMP( g_trac_runtime, "%d> hdatInstance=%d, hdatSize=%d", index, node_data_header->hdatInstance, node_data_header->hdatSize ); - if( node_data_header->hdatInstance != i_instance ) - { - found_instances |= - (0x80000000 >> node_data_header->hdatInstance); - //increment to the next child section - node_data_header = - reinterpret_cast<hdatHDIF_t*> - (reinterpret_cast<uint64_t>(node_data_header) - + node_data_header->hdatSize); - continue; - } - foundit = true; - - uint64_t node_base_addr = - reinterpret_cast<uint64_t>(node_data_header); - - hdatHDIFDataHdr_t* local_node_header = - reinterpret_cast<hdatHDIFDataHdr_t*> - (node_data_header->hdatDataPtrOffset + node_base_addr); - TRACUCOMP( g_trac_runtime, "local_node_header=%p", local_node_header ); - // Make sure the header is pointing somewhere valid - errhdl = verify_hdat_address( local_node_header, - sizeof(hdatHDIFDataHdr_t) ); - if( errhdl ) { break; } - - o_dataAddr = local_node_header->hdatOffset + node_base_addr; - o_dataSize = local_node_header->hdatSize; - - break; // found it, stop the loop - } - if( errhdl ) { break; } - - // Make sure we found something - if( !foundit ) + if (l_needBlob) { - TRACFCOMP( g_trac_runtime, "getHostDataSection> HSVC_NODE_DATA instance %d of section %d is unallocated", i_instance, i_section ); - - /*@ - * @errortype - * @moduleid RUNTIME::MOD_HDATSERVICE_GETHOSTDATASECTION - * @reasoncode RUNTIME::RC_NO_HSVC_NODE_DATA_FOUND - * @userdata1 Mainstore address of first node_data_header - * @userdata2[0:31] Requested Instance - * @userdata2[32:63] Bitmask of discovered instances - * @devdesc Requested instance of HSVC_NODE_DATA is - * unallocated - */ - errhdl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, - RUNTIME::MOD_HDATSERVICE_GETHOSTDATASECTION, - RUNTIME::RC_NO_HSVC_NODE_DATA_FOUND, - first_node_header, - TWO_UINT32_TO_UINT64(i_instance, - found_instances)); - errhdl->addProcedureCallout( HWAS::EPUB_PRC_HB_CODE, - HWAS::SRCI_PRIORITY_MED ); - errhdl->addProcedureCallout( HWAS::EPUB_PRC_SP_CODE, - HWAS::SRCI_PRIORITY_MED ); - errhdl->collectTrace(RUNTIME_COMP_NAME,KILOBYTE); - break; - } - + // For accessing pointer to various RT data + hdatHBRT_t* l_hbrtPtr = + reinterpret_cast<hdatHBRT_t *>(o_dataAddr); + o_dataAddr = l_hbrtPtr->hdatDataBlob.hdatOffset + base_addr; + o_dataSize = l_hbrtPtr->hdatDataBlob.hdatSize; + } // end if getting dataBlob } + // IPL Parameters : System Parameters else if( RUNTIME::IPLPARMS_SYSTEM == i_section ) { diff --git a/src/usr/runtime/hdatstructs.H b/src/usr/runtime/hdatstructs.H index f1b02aa8f..1eb2bc70f 100644 --- a/src/usr/runtime/hdatstructs.H +++ b/src/usr/runtime/hdatstructs.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2016 */ +/* [+] 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. */ @@ -98,6 +100,7 @@ enum hdatSpiraLegacyDataAreas SPIRAL_PCIA = 21, // PCIA (Core information area) SPIRAL_PCRD = 22, // PCRD (Chip related data area) SPIRAL_HSVC_DATA = 23, // Host Services Data + SPIRAL_HBRT_DATA = 24, // Hostboot Runtime Data SPIRAL_LAST = 24 }; @@ -138,7 +141,8 @@ enum hdatSpiraSDataAreas SPIRAS_PCIA = 12, // PCIA (Core information area) SPIRAS_PCRD = 13, // PCRD (Chip related data area) SPIRAS_HSVC_DATA = 14, // Host Services Data - SPIRAS_LAST = 14 + SPIRAS_HBRT_DATA = 15, // Hostboot Runtime Data + SPIRAS_LAST = 15 }; @@ -278,4 +282,18 @@ struct hdatHeaderExp_t return retval; }; }; + + +/** + * @brief Structure for HBRT Data -- PHYP adjunct partition + */ +struct hdatHBRT_t +{ + char hdatStringName[24]; // offset 0x0000 + uint32_t hdatInstance; // offset 0x0018 + hdatHDIFDataHdr_t hdatDataBlob; // offset 0x001C + uint8_t hdatReservedHbrt[12]; // offset 0x0024 +} __attribute__ ((packed)); + + #endif diff --git a/src/usr/runtime/makefile b/src/usr/runtime/makefile index 86e2e8e80..8306eae03 100644 --- a/src/usr/runtime/makefile +++ b/src/usr/runtime/makefile @@ -34,6 +34,7 @@ MODULE = runtime #@TODO RTC:132750 #OBJS += populate_attributes.o +OBJS += populate_hbruntime.o OBJS += hdatservice.o OBJS += fakepayload.o OBJS += tce.o diff --git a/src/usr/runtime/populate_attributes.C b/src/usr/runtime/populate_attributes.C index 820dfc62a..a1594481c 100644 --- a/src/usr/runtime/populate_attributes.C +++ b/src/usr/runtime/populate_attributes.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ +/* Contributors Listed Below - COPYRIGHT 2012,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ diff --git a/src/usr/runtime/populate_hbruntime.C b/src/usr/runtime/populate_hbruntime.C new file mode 100644 index 000000000..715ce1e4d --- /dev/null +++ b/src/usr/runtime/populate_hbruntime.C @@ -0,0 +1,231 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/runtime/populate_hbruntime.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* [+] 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 */ + +/** + * @file populate_runtime.C + * + * @brief Populate HDAT Area for Host runtime data + */ + + +#include <sys/misc.h> +#include <trace/interface.H> +#include <errl/errlentry.H> +#include <targeting/common/target.H> +#include <targeting/common/targetservice.H> +#include <targeting/common/utilFilter.H> +#include <targeting/common/entitypath.H> +#include <runtime/runtime_reasoncodes.H> +#include <runtime/runtime.H> +#include "hdatstructs.H" +#include <mbox/ipc_msg_types.H> +#include <sys/task.h> +#include <intr/interrupt.H> +#include <errl/errlmanager.H> +#include <sys/internode.h> +#include <vpd/vpd_if.H> +#include <targeting/attrrp.H> + + +namespace RUNTIME +{ + +trace_desc_t *g_trac_runtime = NULL; +TRAC_INIT(&g_trac_runtime, RUNTIME_COMP_NAME, KILOBYTE); + +errlHndl_t populate_RtDataByNode(uint64_t iNodeId) +{ + errlHndl_t l_elog = NULL; + const char* l_stringLabels[] = + { "ibm,hbrt-vpd-image" , + "ibm,hbrt-target-image" }; + + 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 != NULL) + { + 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 != NULL) + { + 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 != NULL) + { + 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 != NULL) + { + 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 != NULL) + { + TRACFCOMP( g_trac_runtime, + "populate_RtDataByNode fail getHostDataSection ATTRIB data" ); + break; + } + + // Get ATTRIBUTE data + TARGETING::AttrRP::save(l_hbrtDataAddr); + + } while(0); + + + return(l_elog); +} // end populate_RtDataByNode + + +errlHndl_t populate_hbRuntimeData( void ) +{ + errlHndl_t l_elog = NULL; + + do { + TRACFCOMP(g_trac_runtime, "Running populate_hbRuntimeData"); + + TARGETING::Target * sys = NULL; + TARGETING::targetService().getTopLevelTarget( sys ); + assert(sys != NULL); + + TARGETING::ATTR_HB_EXISTING_IMAGE_type hb_images = + sys->getAttr<TARGETING::ATTR_HB_EXISTING_IMAGE>(); + + // Figure out which node we are running on + TARGETING::Target* mproc = NULL; + TARGETING::targetService().masterProcChipTargetHandle(mproc); + + TARGETING::EntityPath epath = + mproc->getAttr<TARGETING::ATTR_PHYS_PATH>(); + + const TARGETING::EntityPath::PathElement pe = + epath.pathElementOfType(TARGETING::TYPE_NODE); + + uint64_t nodeid = pe.instance; + + // ATTR_HB_EXISTING_IMAGE only gets set on a multi-drawer system. + // Currently set up in host_sys_fab_iovalid_processing() which only + // gets called if there are multiple physical nodes. It eventually + // needs to be setup by a hb routine that snoops for multiple nodes. + if (0 == hb_images) //Single-node + { + // Single node system, call inline and pass in our node number + l_elog = populate_RtDataByNode(nodeid); + if(l_elog != NULL) + { + TRACFCOMP( g_trac_runtime, "populate_RtDataByNode failed" ); + } + break; + } + + // continue only for multi-node system + + // loop thru rest of NODES -- sending msg to each + TARGETING::ATTR_HB_EXISTING_IMAGE_type mask = 0x1 << + ((sizeof(TARGETING::ATTR_HB_EXISTING_IMAGE_type) * 8) -1); + + for (uint64_t l_node=0; (l_node < MAX_NODES_PER_SYS); l_node++ ) + { + if( 0 != ((mask >> l_node) & hb_images ) ) + { + // @TODO RTC 142908 + + // Need to send message to the node (l_node) + // When NODE receives the msg it should + // call populate_RtDataByNode(itsNodeId) + TRACFCOMP( g_trac_runtime, "MsgToNode %d for HBRT Data", + l_node ); + + } // end if node to process + } // end for loop on nodes + + } while(0); + + + return(l_elog); + +} // end populate_hbRuntimeData + +} //namespace RUNTIME + diff --git a/src/usr/targeting/attrrp.C b/src/usr/targeting/attrrp.C index 780de9568..86cd1b748 100755 --- a/src/usr/targeting/attrrp.C +++ b/src/usr/targeting/attrrp.C @@ -496,29 +496,50 @@ namespace TARGETING return Singleton<AttrRP>::instance()._save(io_addr); } - void* AttrRP::_save(uint64_t& io_addr) - { - TRACDCOMP(g_trac_targeting, "AttrRP::save: top @ 0x%lx", io_addr); - io_addr = ALIGN_PAGE_DOWN(io_addr); + uint64_t AttrRP::maxSize( ) + { // Find total size of the sections. uint64_t l_size = 0; - for(size_t i = 0; i < iv_sectionCount; ++i) + for( size_t i = 0; + i < Singleton<AttrRP>::instance().iv_sectionCount; + ++i) { - l_size += ALIGN_PAGE(iv_sections[i].size); + l_size += ALIGN_PAGE(Singleton<AttrRP>:: + instance().iv_sections[i].size); } - // Determine bottom of the address region. - io_addr = io_addr - l_size; - // Align to 64KB for Opal - io_addr = ALIGN_DOWN_X(io_addr,64*KILOBYTE); + return(l_size); + } // end maxSize - // Map in region. - void* region = mm_block_map(reinterpret_cast<void*>(io_addr), - l_size); + + void* AttrRP::_save(uint64_t& io_addr) + { + TRACDCOMP(g_trac_targeting, "AttrRP::save: top @ 0x%lx", io_addr); + + // Find total size of the sections. + uint64_t l_size = maxSize(); + + void* region = reinterpret_cast<void*>(io_addr); uint8_t* pointer = reinterpret_cast<uint8_t*>(region); + // For PHYP adjunct partition, use HDAT ptr as is + bool l_isPhyp = TARGETING::is_phyp_load(); + if (!l_isPhyp) + { + io_addr = ALIGN_PAGE_DOWN(io_addr); + // Determine bottom of the address region. + io_addr = io_addr - l_size; + // Align to 64KB for Opal + io_addr = ALIGN_DOWN_X(io_addr,64*KILOBYTE); + + // Map in region. + region = mm_block_map(reinterpret_cast<void*>(io_addr),l_size); + pointer = reinterpret_cast<uint8_t*>(region); + + } // end if NOT PHYP + // Copy content. for (size_t i = 0; i < iv_sectionCount; ++i) { diff --git a/src/usr/targeting/runtime/attrPlatOverride_rt.C b/src/usr/targeting/runtime/attrPlatOverride_rt.C index 9a5498111..537e36464 100644 --- a/src/usr/targeting/runtime/attrPlatOverride_rt.C +++ b/src/usr/targeting/runtime/attrPlatOverride_rt.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* Contributors Listed Below - COPYRIGHT 2014,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -31,6 +31,7 @@ //#include <hwpf/plat/fapiPlatAttrOverrideSync.H> #include <targeting/common/trace.H> #include <errl/errlmanager.H> +#include <initservice/initserviceif.H> using namespace TARGETING; @@ -92,6 +93,12 @@ int apply_attr_override(uint8_t* i_data, void applyTempOverrides() { + // With FSP, we can not access PNOR, just return + if(INITSERVICE::spBaseServicesEnabled()) + { + return; + } + TRACFCOMP(g_trac_targeting, ENTER_MRK"applyTempOverrides"); errlHndl_t l_err = NULL; PNOR::SectionInfo_t l_info; diff --git a/src/usr/vpd/rtvpd_load.C b/src/usr/vpd/rtvpd_load.C index b9fbf2fef..633b918ca 100644 --- a/src/usr/vpd/rtvpd_load.C +++ b/src/usr/vpd/rtvpd_load.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2015 */ +/* Contributors Listed Below - COPYRIGHT 2013,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -108,22 +108,28 @@ errlHndl_t VPD::vpd_load_rt_image(uint64_t & o_vpd_addr) do { - uint64_t vpd_addr = TARGETING::get_top_mem_addr(); + void* vptr = reinterpret_cast<void*>(o_vpd_addr); + uint8_t* vpd_ptr = reinterpret_cast<uint8_t*>(vptr); - assert (vpd_addr != 0, - "bld_devtree: Top of memory was 0!"); - - vpd_addr -= VMM_RT_VPD_OFFSET; + // OPAL builds everything at top of memory. + // PHYP adjunct partition will use HDAT memory ptrs + bool l_isPhyp = TARGETING::is_phyp_load(); + if (!l_isPhyp) + { + o_vpd_addr = TARGETING::get_top_mem_addr(); + assert (o_vpd_addr != 0, + "bld_devtree: Top of memory was 0!"); - o_vpd_addr = vpd_addr; + o_vpd_addr -= VMM_RT_VPD_OFFSET; - uint8_t * vpd_ptr = reinterpret_cast<uint8_t*>(vpd_addr); + vptr = mm_block_map(reinterpret_cast<void*>(o_vpd_addr), + VMM_RT_VPD_SIZE); + vpd_ptr = reinterpret_cast<uint8_t*>(vptr); - void * vptr = mm_block_map(vpd_ptr, VMM_RT_VPD_SIZE); + assert(vptr != NULL,"bld_devtree: Could not map VPD memory"); + } // if NOT phyp - assert(vptr != NULL,"bld_devtree: Could not map VPD memory"); - vpd_ptr = static_cast<uint8_t*>(vptr); err = bld_vpd_image(PNOR::DIMM_JEDEC_VPD, vpd_ptr, VMM_DIMM_JEDEC_VPD_SIZE); @@ -150,7 +156,10 @@ errlHndl_t VPD::vpd_load_rt_image(uint64_t & o_vpd_addr) break; } - mm_block_unmap(vptr); + if (!l_isPhyp) + { + mm_block_unmap(vptr); + } } while( 0 ); |