summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/plat
diff options
context:
space:
mode:
authorMike Jones <mjjones@us.ibm.com>2012-02-21 07:29:40 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-02-22 16:08:39 -0600
commitb455fb2ff154b9ff42598d96240123804659fc25 (patch)
treec404c0e1d747c7f89586b7b565dda664f6886b91 /src/usr/hwpf/plat
parent15713df3152439e6f3083442ce25e5d94b131c39 (diff)
downloadtalos-hostboot-b455fb2ff154b9ff42598d96240123804659fc25.tar.gz
talos-hostboot-b455fb2ff154b9ff42598d96240123804659fc25.zip
HWPF Attribute Support: Memory/MirrorMemory base addresses
Change-Id: I7ddf2ffb36b453ccf37dc6d3138752c1c8c4079d Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/682 Tested-by: Jenkins Server Reviewed-by: Brian H. Horton <brianh@linux.ibm.com> Reviewed-by: CAMVAN T. NGUYEN <ctnguyen@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/plat')
-rw-r--r--src/usr/hwpf/plat/fapiPlatAttributeService.C161
1 files changed, 160 insertions, 1 deletions
diff --git a/src/usr/hwpf/plat/fapiPlatAttributeService.C b/src/usr/hwpf/plat/fapiPlatAttributeService.C
index 916e11b5e..95aeb8c2c 100644
--- a/src/usr/hwpf/plat/fapiPlatAttributeService.C
+++ b/src/usr/hwpf/plat/fapiPlatAttributeService.C
@@ -26,7 +26,6 @@
*
* @brief Implements HWP attribute -> HB attribute bridging functions
*
- * Note that platform code must provide the implementation.
*/
//******************************************************************************
@@ -195,6 +194,166 @@ fapi::ReturnCode fapiPlatGetSpdAttr(const fapi::Target * i_target,
}
+//******************************************************************************
+// fapiPlatBaseAddrCheckMcsGetTargets
+//
+// Local function used by fapiPlatGetMemoryBaseAddr / fapiPlatGetMirrorBaseAddr
+// to check that the input component is an MCS chiplet and that the parent chip
+// Hostboot target can be found
+//******************************************************************************
+fapi::ReturnCode fapiPlatBaseAddrCheckMcsGetChip(
+ const fapi::Target* i_pMcsTarget,
+ TARGETING::Target* & o_pMcsTarget,
+ TARGETING::Target* & o_pChipTarget)
+{
+ fapi::ReturnCode l_rc;
+ bool l_error = false;
+
+ // Check that the FAPI Target pointer is not NULL
+ if (i_pMcsTarget == NULL)
+ {
+ FAPI_ERR("fapiPlatBaseAddrCheckMcsGetChip. NULL FAPI Target passed");
+ l_error = true;
+ }
+ else
+ {
+ // Extract the MCS Hostboot Target pointer
+ o_pMcsTarget =
+ reinterpret_cast<TARGETING::Target*>(i_pMcsTarget->get());
+
+ // Check that the MCS Hostboot Target pointer is not NULL
+ if (o_pMcsTarget == NULL)
+ {
+ FAPI_ERR("fapiPlatBaseAddrCheckMcsGetChip. NULL HB Target passed");
+ l_error = true;
+ }
+ else
+ {
+ // Check that the Target is an MCS chiplet
+ if (o_pMcsTarget->getAttr<TARGETING::ATTR_TYPE>() !=
+ TARGETING::TYPE_MCS)
+ {
+ FAPI_ERR("fapiPlatBaseAddrCheckMcsGetChip. Not an MCS (0x%x)",
+ o_pMcsTarget->getAttr<TARGETING::ATTR_TYPE>());
+ l_error = true;
+ }
+ else
+ {
+ // Get the parent chip
+ TARGETING::TargetHandleList l_parentList;
+ TARGETING::targetService().getAssociated(
+ l_parentList,
+ o_pMcsTarget,
+ TARGETING::TargetService::PARENT,
+ TARGETING::TargetService::IMMEDIATE);
+
+ if (l_parentList.size() != 1)
+ {
+ FAPI_ERR("fapiPlatBaseAddrCheckMcsGetChip. Did not find single parent chip (%d)",
+ l_parentList.size());
+ l_error = true;
+ }
+ else
+ {
+ o_pChipTarget = l_parentList[0];
+ }
+ }
+ }
+ }
+
+ if (l_error)
+ {
+ /*@
+ * @errortype
+ * @moduleid MOD_ATTR_BASE_ADDR_GET
+ * @reasoncode RC_ATTR_BASE_BAD_PARAM
+ * @devdesc Failed to get MCS base address attribute due to
+ * bad target parameter.
+ */
+ errlHndl_t l_pError = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_INFORMATIONAL,
+ fapi::MOD_ATTR_BASE_ADDR_GET,
+ fapi::RC_ATTR_BASE_BAD_PARAM);
+ l_rc.setPlatError(reinterpret_cast<void *> (l_pError));
+ }
+
+ return l_rc;
+}
+
+//******************************************************************************
+// fapiPlatGetMemoryBaseAddr function.
+//******************************************************************************
+fapi::ReturnCode fapiPlatGetMemoryBaseAddr(const fapi::Target * i_pMcsTarget,
+ uint64_t & o_addr)
+{
+ fapi::ReturnCode l_rc;
+
+ // TODO
+ // The memory base address will depend on the PHYP System Memory Map
+ // Until that is finalized, here is how it will be calculated
+ // ProcChip0:MCS0: 0TB
+ // ProcChip0:MCS1: 8TB (8TB increment for each MCS chiplet)
+ // ProcChip0:MCS7: 56TB
+ // ProcChip1:MCS0: 64Tb (64TB increment for each proc chip)
+
+ // Check params and get the Hostboot Target pointers
+ TARGETING::Target* l_pMcsTarget;
+ TARGETING::Target* l_pChipTarget;
+
+ l_rc = fapiPlatBaseAddrCheckMcsGetChip(i_pMcsTarget, l_pMcsTarget,
+ l_pChipTarget);
+
+ if (!l_rc)
+ {
+ uint64_t l_chipPos = l_pChipTarget->getAttr<TARGETING::ATTR_POSITION>();
+ uint64_t l_mcsPos = l_pMcsTarget->getAttr<TARGETING::ATTR_CHIP_UNIT>();
+
+ // (ChipPos * 64TB) + (McsPos * 8 TB)
+ o_addr = ((l_chipPos * 64 * 1024 * 1024 * 1024 * 1024) +
+ (l_mcsPos * 8 * 1024 * 1024 * 1024 * 1024));
+ }
+
+ return l_rc;
+}
+
+//******************************************************************************
+// fapiPlatGetMirrorBaseAddr function.
+//******************************************************************************
+fapi::ReturnCode fapiPlatGetMirrorBaseAddr(const fapi::Target * i_pMcsTarget,
+ uint64_t & o_addr)
+{
+ fapi::ReturnCode l_rc;
+
+ // TODO
+ // The mirrored memory base address will depend on the PHYP System Memory Map
+ // Until that is finalized, here is how it will be calculated
+ // ProcChip0:MCS0: 512TB
+ // ProcChip0:MCS1: 516TB (4TB increment for each MCS chiplet)
+ // ProcChip0:MCS7: 540TB
+ // ProcChip1:MCS0: 544Tb (32TB increment for each proc chip)
+
+ // Check params and get the Hostboot Target pointers
+ TARGETING::Target* l_pMcsTarget;
+ TARGETING::Target* l_pChipTarget;
+
+ l_rc = fapiPlatBaseAddrCheckMcsGetChip(i_pMcsTarget, l_pMcsTarget,
+ l_pChipTarget);
+
+ if (!l_rc)
+ {
+ uint64_t l_chipPos = l_pChipTarget->getAttr<TARGETING::ATTR_POSITION>();
+ uint64_t l_mcsPos = l_pMcsTarget->getAttr<TARGETING::ATTR_CHIP_UNIT>();
+
+ // 512TB + (ChipPos * 32TB) + (McsPos * 4 TB)
+ o_addr = ((static_cast<uint64_t>(512) * 1024 * 1024 * 1024 * 1024) +
+ (l_chipPos * 32 * 1024 * 1024 * 1024 * 1024) +
+ (l_mcsPos * 4 * 1024 * 1024 * 1024 * 1024));
+ }
+
+ return l_rc;
+}
+
+
} // End platAttrSvc namespace
} // End fapi namespace
OpenPOWER on IntegriCloud