diff options
| author | Patrick Williams <iawillia@us.ibm.com> | 2014-01-14 18:58:57 -0600 |
|---|---|---|
| committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-02-06 17:40:11 -0600 |
| commit | 6454fc5ee6f30a98202f1595c458f32b26393f70 (patch) | |
| tree | 1453ff26f498b46009e44baf5103ec365a2988ed /src/usr/targeting/runtime | |
| parent | 6155c62ab8eae064a0160bf8c042953637113d66 (diff) | |
| download | talos-hostboot-6454fc5ee6f30a98202f1595c458f32b26393f70.tar.gz talos-hostboot-6454fc5ee6f30a98202f1595c458f32b26393f70.zip | |
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 <dgilbert@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/targeting/runtime')
| -rw-r--r-- | src/usr/targeting/runtime/attrrp_rt.C | 118 | ||||
| -rw-r--r-- | src/usr/targeting/runtime/start_rt.C | 13 |
2 files changed, 126 insertions, 5 deletions
diff --git a/src/usr/targeting/runtime/attrrp_rt.C b/src/usr/targeting/runtime/attrrp_rt.C index 4cf168133..7aa705471 100644 --- a/src/usr/targeting/runtime/attrrp_rt.C +++ b/src/usr/targeting/runtime/attrrp_rt.C @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2013 */ +/* COPYRIGHT International Business Machines Corp. 2013,2014 */ /* */ /* p1 */ /* */ @@ -23,15 +23,129 @@ #include <targeting/attrrp.H> #include <targeting/common/trace.H> #include <util/align.H> +#include <runtime/interface.h> +#include <errl/errlentry.H> +#include <targeting/common/targreasoncodes.H> +#include <targeting/targplatreasoncodes.H> #include "../attrrp_common.C" +using namespace ERRORLOG; namespace TARGETING { + void AttrRP::startup(errlHndl_t& io_taskRetErrl) + { + errlHndl_t l_errl = NULL; + + do + { + TargetingHeader* l_header = reinterpret_cast<TargetingHeader*>( + g_hostInterfaces->get_reserved_mem("ibm,hbrt-target-image")); + + if ((NULL == l_header) || + (l_header->eyeCatcher != PNOR_TARG_EYE_CATCHER)) + { + /*@ + * @errortype + * @moduleid TARG_MOD_ATTRRP_RT + * @reasoncode TARG_RC_BAD_EYECATCH + * @userdata1 Observed Header Eyecatch Value + * @userdata2 Memory address referenced. + * + * @devdesc The eyecatch value observed in memory does not + * match the expected value of + * PNOR_TARG_EYE_CATCHER and therefore the + * contents of the Attribute sections are + * unable to be parsed. + */ + l_errl = new ErrlEntry(ERRL_SEV_UNRECOVERABLE, + TARG_MOD_ATTRRP_RT, + TARG_RC_BAD_EYECATCH, + NULL == l_header ? + 0 : l_header->eyeCatcher, + reinterpret_cast<uint64_t>(l_header)); + break; + } + + // Allocate section structures based on section count in header. + iv_sectionCount = l_header->numSections; + iv_sections = new AttrRP_Section[iv_sectionCount](); + + // Find start to the first section: + // (header address + size of header + offset in header) + TargetingSection* l_section = + reinterpret_cast<TargetingSection*>( + reinterpret_cast<uint64_t>(l_header) + + sizeof(TargetingHeader) + l_header->offsetToSections + ); + + uint64_t l_offset = 0; + + for (size_t i = 0; i < iv_sectionCount; ++i, ++l_section) + { + iv_sections[i].type = l_section->sectionType; + iv_sections[i].size = l_section->sectionSize; + + iv_sections[i].vmmAddress = + static_cast<uint64_t>( + TARG_TO_PLAT_PTR(l_header->vmmBaseAddress)) + + l_header->vmmSectionOffset*i; + iv_sections[i].pnorAddress = + reinterpret_cast<uint64_t>(l_header) + l_offset; + + l_offset += ALIGN_PAGE(iv_sections[i].size); + + TRACFCOMP(g_trac_targeting, + "Decoded Attribute Section: %d, 0x%lx, 0x%lx, 0x%lx", + iv_sections[i].type, + iv_sections[i].vmmAddress, + iv_sections[i].pnorAddress, + iv_sections[i].size); + } + + } while(false); + + if (l_errl) + { + l_errl->setSev(ERRORLOG::ERRL_SEV_UNRECOVERABLE); + } + + io_taskRetErrl = l_errl; + } + void* AttrRP::getBaseAddress(const NODE_ID i_nodeIdUnused) { - return reinterpret_cast<void*>(VMM_VADDR_ATTR_RP); + return reinterpret_cast<void*>(iv_sections[0].pnorAddress); } + void* AttrRP::translateAddr(void* i_pAddress, + const Target* i_pUnused) + { + void* l_address = NULL; + + for (size_t i = 0; i < iv_sectionCount; ++i) + { + if ((iv_sections[i].vmmAddress + iv_sections[i].size) >= + reinterpret_cast<uint64_t>(i_pAddress)) + { + l_address = reinterpret_cast<void*>( + iv_sections[i].pnorAddress + + reinterpret_cast<uint64_t>(i_pAddress) - + iv_sections[i].vmmAddress); + break; + } + } + + TRACDCOMP(g_trac_targeting, "Translated 0x%p to 0x%p", + i_pAddress, l_address); + + return l_address; + } + + void* AttrRP::translateAddr(void* i_pAddress, + const TARGETING::NODE_ID i_unused) + { + return translateAddr(i_pAddress, static_cast<Target*>(NULL)); + } } diff --git a/src/usr/targeting/runtime/start_rt.C b/src/usr/targeting/runtime/start_rt.C index d0cef38a7..5efea7888 100644 --- a/src/usr/targeting/runtime/start_rt.C +++ b/src/usr/targeting/runtime/start_rt.C @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2013 */ +/* COPYRIGHT International Business Machines Corp. 2013,2014 */ /* */ /* p1 */ /* */ @@ -22,14 +22,21 @@ /* IBM_PROLOG_END_TAG */ #include <targeting/common/commontargeting.H> #include <targeting/common/targetservice.H> +#include <targeting/attrrp.H> namespace TARGETING { static void initTargeting() __attribute__((constructor)); static void initTargeting() { - //@TODO: RTC 87716: Init attr RP. - //AttrRP::init(); + errlHndl_t l_errl = NULL; + + AttrRP::init(l_errl); + if (l_errl) + { + errlCommit(l_errl, TARG_COMP_ID); + assert(false); + } TargetService& l_targetService = targetService(); (void)l_targetService.init(); |

