summaryrefslogtreecommitdiffstats
path: root/src/usr/targeting/attrrp.C
diff options
context:
space:
mode:
authorNick Bofferding <bofferdn@us.ibm.com>2012-04-17 22:30:59 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-04-24 15:48:42 -0500
commit4157b5631a1bbfcc7f9f95480b54e9ade7abce7d (patch)
tree423f4f13a4a0e2d6e76898992a37b4d2db302b3b /src/usr/targeting/attrrp.C
parent5631ede5d2e63fa8585505eb29c6d86f420c9344 (diff)
downloadtalos-hostboot-4157b5631a1bbfcc7f9f95480b54e9ade7abce7d.tar.gz
talos-hostboot-4157b5631a1bbfcc7f9f95480b54e9ade7abce7d.zip
Support targeting code commonality
- Moved common targeting code to own subtrees - Updated many components with header file changes - Implemented abstract pointer class - Implemented Hostboot specific support for targeting commonality - Changed attribute VMM base address to 4 GB (From 3 GB) - Removed tabs, fixed > 80 character lines Change-Id: Ie5a6956670bfa4f262f7691b4f0ce5a20ed289fe RTC: 35569 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/909 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/targeting/attrrp.C')
-rw-r--r--src/usr/targeting/attrrp.C76
1 files changed, 53 insertions, 23 deletions
diff --git a/src/usr/targeting/attrrp.C b/src/usr/targeting/attrrp.C
index 324911778..c250ec4d5 100644
--- a/src/usr/targeting/attrrp.C
+++ b/src/usr/targeting/attrrp.C
@@ -20,6 +20,16 @@
// Origin: 30
//
// IBM_PROLOG_END
+
+/**
+ * @file targeting/attrrp.C
+ *
+ * @brief Attribute resource provider implementation which establishes and
+ * initializes virtual memory ranges for attributes as needed, and works
+ * with other resource providers (such as the PNOR resource provider) to
+ * retrieve attribute data which it connot directly provide.
+ */
+
#include <util/singleton.H>
#include <pnortargeting.H>
#include <pnor/pnorif.H>
@@ -28,10 +38,10 @@
#include <string.h>
#include <algorithm>
#include <vmmconst.h>
-
-#include <targeting/targreasoncodes.H>
-#include "attrrp.H"
-#include "trace.H"
+#include <targeting/adapters/assertadapter.H>
+#include <targeting/common/targreasoncodes.H>
+#include <targeting/attrrp.H>
+#include <targeting/common/trace.H>
#include <initservice/initserviceif.H>
using namespace INITSERVICE;
@@ -44,27 +54,35 @@ namespace TARGETING
*/
struct AttrRP_Section
{
- /** Section type. */
- SECTION_TYPE type;
- /** Desired address in Attribute virtual address space. */
- uint64_t vmmAddress;
- /** Location in PNOR virtual address space. */
- uint64_t pnorAddress;
- /** Section size. */
- uint64_t size;
+ // Section type
+ SECTION_TYPE type;
+
+ // Desired address in Attribute virtual address space
+ uint64_t vmmAddress;
+
+ // Location in PNOR virtual address space
+ uint64_t pnorAddress;
+
+ // Section size
+ uint64_t size;
};
- void AttrRP::init( errlHndl_t &io_taskRetErrl )
+ void AttrRP::init(errlHndl_t &io_taskRetErrl)
{
// Call startup on singleton instance.
- Singleton<AttrRP>::instance().startup( io_taskRetErrl );
+ Singleton<AttrRP>::instance().startup(io_taskRetErrl);
+ }
+
+ void* AttrRP::getBaseAddress()
+ {
+ return reinterpret_cast<void*>(VMM_VADDR_ATTR_RP);
}
- void AttrRP::startMsgServiceTask(void* i_instance)
+ void AttrRP::startMsgServiceTask(void* i_pInstance)
{
// Call msgServiceTask loop on instance.
- assert(i_instance);
- static_cast<AttrRP*>(i_instance)->msgServiceTask();
+ TARG_ASSERT(i_pInstance);
+ static_cast<AttrRP*>(i_pInstance)->msgServiceTask();
}
AttrRP::~AttrRP()
@@ -75,10 +93,10 @@ namespace TARGETING
}
msg_q_destroy(iv_msgQ);
- assert(false);
+ TARG_ASSERT(false);
}
- void AttrRP::startup( errlHndl_t &io_taskRetErrl )
+ void AttrRP::startup(errlHndl_t& io_taskRetErrl)
{
errlHndl_t l_errl = NULL;
@@ -86,11 +104,17 @@ namespace TARGETING
{
// Parse PNOR headers.
l_errl = this->parseAttrSectHeader();
- if (l_errl) break;
+ if (l_errl)
+ {
+ break;
+ }
// Create corresponding VMM blocks for each section.
l_errl = this->createVmmSections();
- if (l_errl) break;
+ if (l_errl)
+ {
+ break;
+ }
// Spawn daemon thread.
task_create(&AttrRP::startMsgServiceTask, this);
@@ -104,7 +128,7 @@ namespace TARGETING
}
// return any errlogs to _start()
- io_taskRetErrl = l_errl;
+ io_taskRetErrl = l_errl;
}
void AttrRP::msgServiceTask() const
@@ -314,8 +338,14 @@ namespace TARGETING
for (size_t i = 0; i < iv_sectionCount; i++, l_section++)
{
iv_sections[i].type = l_section->sectionType;
+
+ // Conversion cast for templated abstract pointer object only
+ // works when casting to pointer of the templated type. Since
+ // cache is of a different type, we first cast to extract the
+ // real pointer, then recast it into the cache
iv_sections[i].vmmAddress =
- reinterpret_cast<uint64_t>(l_header->vmmBaseAddress) +
+ reinterpret_cast<uint64_t>(
+ TARG_TO_PLAT_PTR(l_header->vmmBaseAddress)) +
l_header->vmmSectionOffset*i;
iv_sections[i].pnorAddress = l_pnorSectionInfo.vaddr +
l_section->sectionOffset;
OpenPOWER on IntegriCloud