summaryrefslogtreecommitdiffstats
path: root/src/usr/targeting
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2014-01-14 18:58:57 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-02-06 17:40:11 -0600
commit6454fc5ee6f30a98202f1595c458f32b26393f70 (patch)
tree1453ff26f498b46009e44baf5103ec365a2988ed /src/usr/targeting
parent6155c62ab8eae064a0160bf8c042953637113d66 (diff)
downloadtalos-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')
-rw-r--r--src/usr/targeting/attrrp.C49
-rw-r--r--src/usr/targeting/attrrp_common.C8
-rw-r--r--src/usr/targeting/common/targetservice.C4
-rw-r--r--src/usr/targeting/runtime/attrrp_rt.C118
-rw-r--r--src/usr/targeting/runtime/start_rt.C13
-rw-r--r--src/usr/targeting/targplatutil.C4
6 files changed, 177 insertions, 19 deletions
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<AttrRP>::instance().startup(io_taskRetErrl);
- }
-
void* AttrRP::getBaseAddress(const NODE_ID i_nodeIdUnused)
{
return reinterpret_cast<void*>(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<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);
+
+ // 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<void*>(io_addr),
+ l_size);
+ uint8_t* pointer = reinterpret_cast<uint8_t*>(region);
+
+ // Copy content.
+ for (size_t i = 0; i < iv_sectionCount; ++i)
+ {
+ memcpy(pointer,
+ reinterpret_cast<void*>(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;
+ }
+
};
diff --git a/src/usr/targeting/attrrp_common.C b/src/usr/targeting/attrrp_common.C
index 84f864b10..3d013005b 100644
--- a/src/usr/targeting/attrrp_common.C
+++ b/src/usr/targeting/attrrp_common.C
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013 */
+/* COPYRIGHT International Business Machines Corp. 2013,2014 */
/* */
/* p1 */
/* */
@@ -57,6 +57,12 @@ namespace TARGETING
TARG_ASSERT(false);
}
+ void AttrRP::init(errlHndl_t &io_taskRetErrl)
+ {
+ // Call startup on singleton instance.
+ Singleton<AttrRP>::instance().startup(io_taskRetErrl);
+ }
+
bool AttrRP::writeSectionData(
const std::vector<TARGETING::sectionRefData>& i_pages) const
{
diff --git a/src/usr/targeting/common/targetservice.C b/src/usr/targeting/common/targetservice.C
index b6b94be1e..487536c07 100644
--- a/src/usr/targeting/common/targetservice.C
+++ b/src/usr/targeting/common/targetservice.C
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2013 */
+/* COPYRIGHT International Business Machines Corp. 2011,2014 */
/* */
/* p1 */
/* */
@@ -634,9 +634,7 @@ void TargetService::masterProcChipTargetHandle(
{
/* Error is already traced w.r.t api called, not repeating here*/
TARG_ERR("Not able to find the Master Proc Chip Target Handle");
-#ifndef __HOSTBOOT_RUNTIME // TODO: RTC 87716
delete pError;
-#endif
pError = NULL;
o_masterProcChipTargetHandle = NULL;
}
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();
diff --git a/src/usr/targeting/targplatutil.C b/src/usr/targeting/targplatutil.C
index 677da78bb..f619c5e91 100644
--- a/src/usr/targeting/targplatutil.C
+++ b/src/usr/targeting/targplatutil.C
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013 */
+/* COPYRIGHT International Business Machines Corp. 2013,2014 */
/* */
/* p1 */
/* */
@@ -62,7 +62,6 @@ void createTracingError(
const uint32_t i_userData4,
errlHndl_t& io_pError)
{
-#ifndef __HOSTBOOT_RUNTIME // TODO: RTC 87716
errlHndl_t pNewError = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_INFORMATIONAL,
i_modId,
@@ -82,7 +81,6 @@ void createTracingError(
io_pError = pNewError;
pNewError = NULL;
}
-#endif
return;
}
OpenPOWER on IntegriCloud