diff options
Diffstat (limited to 'src/usr/runtime')
| -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 |
5 files changed, 284 insertions, 158 deletions
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 + |

