diff options
author | crgeddes <crgeddes@us.ibm.com> | 2016-11-04 10:47:33 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2016-11-14 11:43:54 -0500 |
commit | 5eeea6b14a4b2e0d1d908f238d02699e1e0e86fa (patch) | |
tree | 58cd5bf2bf7fd28534ef3fd41ced66bb537a9e72 /src/usr/runtime | |
parent | 79365796a27a6de1d7b55cd41201480b3dd45194 (diff) | |
download | talos-hostboot-5eeea6b14a4b2e0d1d908f238d02699e1e0e86fa.tar.gz talos-hostboot-5eeea6b14a4b2e0d1d908f238d02699e1e0e86fa.zip |
Save Attribute Data in real memory in case of MPIPL
As an initial step towards our goal of booting from previous attr
data and not re-finding out targeting/attr data from PNOR, this commit
saves the targ/attr data that we put into HDAT to a memory address
that HB owns (phyp shouldn't ever touch) so that we can use the info
on the MPIPL path. Ideally this info would be coming from RT but that
is the next step. This just proves that it can be done and outlines
how we should do it.
Change-Id: I664a8742eb35bcef011b6c274bf44e71ebf84d5d
RTC: 157652
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/32259
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/runtime')
-rw-r--r-- | src/usr/runtime/hdatservice.C | 16 | ||||
-rw-r--r-- | src/usr/runtime/populate_hbruntime.C | 66 |
2 files changed, 73 insertions, 9 deletions
diff --git a/src/usr/runtime/hdatservice.C b/src/usr/runtime/hdatservice.C index 7df89c269..88475e0c4 100644 --- a/src/usr/runtime/hdatservice.C +++ b/src/usr/runtime/hdatservice.C @@ -269,13 +269,13 @@ errlHndl_t hdatService::get_standalone_section( if( RUNTIME::HSVC_SYSTEM_DATA == i_section ) { o_dataAddr = reinterpret_cast<uint64_t>(iv_mem_regions[0].virt_addr); - o_dataSize = HSVC_TEST_SYSDATA_SIZE; + o_dataSize = MPIPL_SYSDATA_SIZE; } else if( RUNTIME::HSVC_NODE_DATA == i_section ) { o_dataAddr = reinterpret_cast<uint64_t>(iv_mem_regions[0].virt_addr) - + HSVC_TEST_SYSDATA_SIZE; - o_dataSize = HSVC_TEST_NODEDATA_SIZE; + + MPIPL_SYSDATA_SIZE; + o_dataSize = MPIPL_NODEDATA_SIZE; } else if( RUNTIME::MS_DUMP_SRC_TBL == i_section ) { @@ -514,12 +514,12 @@ errlHndl_t hdatService::loadHostData(void) FakePayload::load(); // Map in some arbitrary memory for the HostServices code to use - TRACFCOMP( g_trac_runtime, "load_host_data> STANDALONE: Mapping in 0x%X-0x%X (%d MB)", HSVC_TEST_MEMORY_ADDR, - HSVC_TEST_MEMORY_ADDR+HSVC_TEST_MEMORY_SIZE, - HSVC_TEST_MEMORY_SIZE); + TRACFCOMP( g_trac_runtime, "load_host_data> STANDALONE: Mapping in 0x%X-0x%X (%d MB)", MPIPL_ATTR_DATA_ADDR, + MPIPL_ATTR_DATA_ADDR+MPIPL_ATTR_DATA_SIZE, + MPIPL_ATTR_DATA_SIZE); - errhdl = mapRegion(HSVC_TEST_MEMORY_ADDR, - HSVC_TEST_MEMORY_SIZE, l_dummy); + errhdl = mapRegion(MPIPL_ATTR_DATA_ADDR, + MPIPL_ATTR_DATA_SIZE, l_dummy); if(errhdl) { break; diff --git a/src/usr/runtime/populate_hbruntime.C b/src/usr/runtime/populate_hbruntime.C index 715ce1e4d..828ca0572 100644 --- a/src/usr/runtime/populate_hbruntime.C +++ b/src/usr/runtime/populate_hbruntime.C @@ -47,7 +47,8 @@ #include <sys/internode.h> #include <vpd/vpd_if.H> #include <targeting/attrrp.H> - +#include <sys/mm.h> +#include <util/align.H> namespace RUNTIME { @@ -151,6 +152,69 @@ errlHndl_t populate_RtDataByNode(uint64_t iNodeId) // Get ATTRIBUTE data 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 + uint64_t l_attrCopyVmemAddr = + reinterpret_cast<uint64_t>(mm_block_map( + reinterpret_cast<void*>(MPIPL_ATTR_DATA_ADDR), + MPIPL_ATTR_VMM_SIZE )); + + //Make sure the address returned from the block map call is not NULL + if(l_attrCopyVmemAddr != 0) + { + //Save the memory map + TARGETING::AttrRP::save(l_attrCopyVmemAddr); + + //Make sure to 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*>(MPIPL_ATTR_DATA_ADDR), + 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, + MPIPL_ATTR_DATA_ADDR, + l_attrCopyVmemAddr, + true); + } + } + else + { + TRACFCOMP( g_trac_runtime, + "populate_RtDataByNode fail to map physical addr %p, size %lx", + reinterpret_cast<void*>(MPIPL_ATTR_DATA_ADDR), + MPIPL_ATTR_VMM_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, + MPIPL_ATTR_DATA_ADDR, + MPIPL_ATTR_VMM_SIZE, + true); + } } while(0); |