From 6454fc5ee6f30a98202f1595c458f32b26393f70 Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Tue, 14 Jan 2014 18:58:57 -0600 Subject: HBRT: Support full targeting in Sapphire. Change-Id: Ib8119e3c11cfa1171b76f2260871d2de5e99d502 RTC: 87716 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/8145 Tested-by: Jenkins Server Reviewed-by: Douglas R. Gilbert Reviewed-by: Daniel M. Crowell Reviewed-by: A. Patrick Williams III --- src/usr/targeting/attrrp.C | 49 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 7 deletions(-) (limited to 'src/usr/targeting/attrrp.C') diff --git a/src/usr/targeting/attrrp.C b/src/usr/targeting/attrrp.C index bb1f82eee..d51dcc422 100644 --- a/src/usr/targeting/attrrp.C +++ b/src/usr/targeting/attrrp.C @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2013 */ +/* COPYRIGHT International Business Machines Corp. 2011,2014 */ /* */ /* p1 */ /* */ @@ -51,12 +51,6 @@ using namespace ERRORLOG; namespace TARGETING { - void AttrRP::init(errlHndl_t &io_taskRetErrl) - { - // Call startup on singleton instance. - Singleton::instance().startup(io_taskRetErrl); - } - void* AttrRP::getBaseAddress(const NODE_ID i_nodeIdUnused) { return reinterpret_cast(VMM_VADDR_ATTR_RP); @@ -478,4 +472,45 @@ namespace TARGETING return l_errl; } + void* AttrRP::save(uint64_t& io_addr) + { + // Call save on singleton instance. + return Singleton::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); + + // Find total size of the sections. + uint64_t l_size = 0; + for(size_t i = 0; i < iv_sectionCount; ++i) + { + l_size += ALIGN_PAGE(iv_sections[i].size); + } + + // Determine bottom of the address region. + io_addr = io_addr - l_size; + + + // Map in region. + void* region = mm_block_map(reinterpret_cast(io_addr), + l_size); + uint8_t* pointer = reinterpret_cast(region); + + // Copy content. + for (size_t i = 0; i < iv_sectionCount; ++i) + { + memcpy(pointer, + reinterpret_cast(iv_sections[i].vmmAddress), + iv_sections[i].size); + + pointer = &pointer[ALIGN_PAGE(iv_sections[i].size)]; + } + + TRACFCOMP(g_trac_targeting, "AttrRP::save: bottom @ 0x%lx", io_addr); + return region; + } + }; -- cgit v1.2.1