summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorBill Hoffa <wghoffa@us.ibm.com>2017-01-05 15:25:59 -0600
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2017-01-14 20:05:00 -0500
commitb4c9eaa651a2be4e4bc714e47e0a9380d4685a80 (patch)
treea0b1d36544ad30a4993bf344b559b602e33047a8 /src/usr
parent549b531ac0e9d39e56d5bc8544661f6e296f3499 (diff)
downloadtalos-hostboot-b4c9eaa651a2be4e4bc714e47e0a9380d4685a80.tar.gz
talos-hostboot-b4c9eaa651a2be4e4bc714e47e0a9380d4685a80.zip
Basic TOD Support for 2 procs
Change-Id: Ife07abfd9e0377a50f1f8cbfe98b7e0027c82799 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/34447 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Dean Sanner <dsanner@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/isteps/istep18/makefile43
-rw-r--r--src/usr/isteps/istep18/tod_init.C209
-rw-r--r--src/usr/isteps/istep18/tod_init.H10
3 files changed, 215 insertions, 47 deletions
diff --git a/src/usr/isteps/istep18/makefile b/src/usr/isteps/istep18/makefile
index 1cc52fb48..005e67640 100644
--- a/src/usr/isteps/istep18/makefile
+++ b/src/usr/isteps/istep18/makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2016
+# Contributors Listed Below - COPYRIGHT 2016,2017
# [+] International Business Machines Corp.
#
#
@@ -27,31 +27,34 @@ ROOTPATH = ../../../..
MODULE = istep18
PROCEDURES_PATH = ${ROOTPATH}/src/import/chips/p9/procedures
+NEST_HWP_PATH += ${PROCEDURES_PATH}/hwp/nest
+
+
+VPATH += ${NEST_HWP_PATH}
+
+#Add all the objs for istep 18
+OBJS += tod_init.o
+
+#Add all the extra include paths
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/fapi2
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/common/include
+EXTRAINCDIR += ${NEST_HWP_PATH}
+EXTRAINCDIR += ${ROOTPATH}/src/import/hwpf/fapi2/include
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/utils/imageProcs/
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/isteps
+
## support for Targeting and fapi
EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer
EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/tod_init
EXTRAINCDIR += ${PROCEDURES_PATH}
-EXTRAINCDIR += ${ROOTPATH}/src/include/usr/isteps
-## pointer to common HWP files
+#Required include before all the procedure.mk are included
+include ${ROOTPATH}/procedure.rules.mk
-#@TODO-RTC:149253-Add TOD support
-OBJS += tod_init.o
-#OBJS += TodControls.o
-#OBJS += TodDrawer.o
-#OBJS += TodProc.o
-#OBJS += TodSvc.o
-#OBJS += TodSvcUtil.o
-#OBJS += TodHwpIntf.o
-#OBJS += TodTopologyManager.o
-
-#OBJS += proc_tod_setup.o
-#OBJS += proc_tod_save_config.o
-#OBJS += proc_tod_init.o
-#OBJS += proc_tod_utils.o
-#OBJS += call_tod_setup.o
-#OBJS += call_tod_init.o
+#Include all the procedure makefiles
+include $(NEST_HWP_PATH)/p9_tod_utils.mk
+include $(NEST_HWP_PATH)/p9_tod_setup.mk
+include $(NEST_HWP_PATH)/p9_tod_init.mk
-include ${ROOTPATH}/procedure.rules.mk
include ${ROOTPATH}/config.mk
diff --git a/src/usr/isteps/istep18/tod_init.C b/src/usr/isteps/istep18/tod_init.C
index ba2b0c8b8..7a63c961f 100644
--- a/src/usr/isteps/istep18/tod_init.C
+++ b/src/usr/isteps/istep18/tod_init.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016 */
+/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -40,10 +40,24 @@
#include <targeting/common/targetservice.H>
#include <initservice/initserviceif.H>
+#include <isteps/hwpisteperror.H>
+#include <initservice/isteps_trace.H>
+
+#include <targeting/common/commontargeting.H>
+#include <targeting/common/util.H>
+#include <targeting/common/utilFilter.H>
+#include <targeting/common/target.H>
+
+#include <fapi2.H>
+#include <fapi2/plat_hwp_invoker.H>
+
+
+#include <p9_tod_setup.H>
+#include <p9_tod_init.H>
+
#include "TodTrace.H"
-// @TODO RTC:149253
-//#include "tod_init.H"
-//#include "TodSvc.H"
+#include "tod_init.H"
+
namespace ISTEP_18
{
@@ -53,17 +67,28 @@ void * call_tod_setup(void *dummy)
errlHndl_t l_errl = NULL;
TOD_ENTER("call_tod_setup");
-// //@TODO RTC:149253 uncomment
-// if (!INITSERVICE::spBaseServicesEnabled())
-// {
-// l_errl = TOD::TodSvc::getTheInstance().todSetup();
-//
-// if (l_errl)
-// {
-// TOD_ERR("todSetup() return errl handle %p", l_errl);
-// errlCommit( l_errl, TOD_COMP_ID );
-// }
-// }
+
+ //Hack job to get things going while waiting for true
+ //TOD support
+ //@TODO RTC:149253 replace with full content
+ if (!INITSERVICE::spBaseServicesEnabled())
+ {
+ //Initialize the iv_tod_node_data structure
+ tod_topology_node l_tod_node;
+ build_proc_topology(l_tod_node);
+
+ FAPI_INVOKE_HWP( l_errl, p9_tod_setup,
+ &l_tod_node,
+ TOD_PRIMARY,
+ TOD_OSC_0 );
+
+ if (l_errl)
+ {
+ TOD_ERR("todSetup() return errl handle %p", l_errl);
+ errlCommit( l_errl, TOD_COMP_ID );
+ }
+ delete_proc_topology(l_tod_node);
+ }
return l_errl; // //@TODO RTC:149253 update later
}
@@ -73,19 +98,151 @@ void * call_tod_init(void *dummy)
errlHndl_t l_errl = NULL;
TOD_ENTER("call_init");
-// // @TODO RTC:149253
-// if (!INITSERVICE::spBaseServicesEnabled())
-// {
-// l_errl = TOD::TodSvc::getTheInstance().todInit();
-//
-// if (l_errl)
-// {
-// TOD_ERR("todInit() return errl handle %p", l_errl);
-// errlCommit( l_errl, TOD_COMP_ID );
-// }
-// }
+
+ // @TODO RTC:149253 - Replace below with full functionality
+ if (!INITSERVICE::spBaseServicesEnabled())
+ {
+ TARGETING::Target* l_masterproc = nullptr;
+ TARGETING::targetService().masterProcChipTargetHandle(l_masterproc);
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>
+ l_fapi2_proc_target (l_masterproc);
+
+ //Initialize the iv_tod_node_data structure
+ tod_topology_node l_tod_node;
+ build_proc_topology(l_tod_node);
+
+ FAPI_INVOKE_HWP( l_errl, p9_tod_init,
+ &l_tod_node,
+ NULL);
+
+ if (l_errl)
+ {
+ TOD_ERR("todInit() return errl handle %p", l_errl);
+ errlCommit( l_errl, TOD_COMP_ID );
+ }
+
+ //Clear up TOD data
+ delete_proc_topology(l_tod_node);
+ }
return l_errl; //@TODO RTC:149253 update later
}
+
+void build_proc_topology(tod_topology_node &i_tod_node)
+{
+
+ // @TODO RTC:149253
+ if (!INITSERVICE::spBaseServicesEnabled())
+ {
+ //Get top level target
+ TARGETING::Target* pSys;
+ TARGETING::targetService().getTopLevelTarget(pSys);
+
+ //Create predicate to find Functional Procs
+ TARGETING::PredicateCTM l_procFilter(TARGETING::CLASS_CHIP,
+ TARGETING::TYPE_PROC);
+ TARGETING::PredicateHwas l_funcPred;
+ l_funcPred.functional(true);
+ TARGETING::PredicatePostfixExpr l_funcProcPostfixExpr;
+ l_funcProcPostfixExpr.push(&l_procFilter).push(&l_funcPred).And();
+
+ //Get the procs in a list
+ TARGETING::TargetHandleList l_procs;
+ TARGETING::targetService().getAssociated(l_procs,
+ pSys,
+ TARGETING::TargetService::CHILD,
+ TARGETING::TargetService::ALL,
+ &l_funcProcPostfixExpr);
+
+ TARGETING::Target* l_masterproc = nullptr;
+ TARGETING::targetService().masterProcChipTargetHandle(l_masterproc);
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>* l_fapi2_proc_target =
+ new fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>(l_masterproc);
+
+ i_tod_node.i_target = l_fapi2_proc_target;
+ i_tod_node.i_tod_master = true;
+ i_tod_node.i_drawer_master = true;
+ i_tod_node.i_bus_rx = NONE;
+ i_tod_node.i_bus_tx = NONE;
+ i_tod_node.i_children.clear();
+
+ //Iterate through functional procs setting base TOD information
+ for (auto l_proc : l_procs)
+ {
+ //Add children to TOD Structure of master proc
+ if (l_proc != l_masterproc)
+ {
+ TOD_INF("Found non-master proc, adding to TOD topology");
+
+ tod_topology_node * l_tod_proc = new tod_topology_node;
+
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>*
+ l_fapi2_proc_target=
+ new fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>(l_proc);
+
+ l_tod_proc->i_target = l_fapi2_proc_target;
+ l_tod_proc->i_tod_master = false;
+ l_tod_proc->i_drawer_master = true;
+
+ auto l_xbus_targets =
+ l_fapi2_proc_target->getChildren<fapi2::TARGET_TYPE_XBUS>();
+
+ for (auto l_xbus : l_xbus_targets)
+ {
+ if (l_xbus.isFunctional())
+ {
+ const TARGETING::Target * l_xTarget =
+ static_cast<TARGETING::Target*>(l_xbus);
+ switch (l_xTarget->getAttr<TARGETING::ATTR_REL_POS>())
+ {
+ case 0 : l_tod_proc->i_bus_rx = XBUS0;
+ l_tod_proc->i_bus_tx = XBUS0;
+ TOD_DTRAC("XBUS 0 Functional");
+ break;
+ case 1 : l_tod_proc->i_bus_rx = XBUS1;
+ l_tod_proc->i_bus_tx = XBUS1;
+ TOD_DTRAC("XBUS 1 Functional");
+ break;
+ case 2 : l_tod_proc->i_bus_rx = XBUS2;
+ l_tod_proc->i_bus_tx = XBUS2;
+ TOD_DTRAC("XBUS 2 Functional");
+ break;
+ }
+ }
+ }
+
+ //Child proc should have no children
+ l_tod_proc->i_children.clear();
+
+ //Add non-master proc as child of master proc in the
+ // TOD topology
+ i_tod_node.i_children.push_back(l_tod_proc);
+ }
+ }
+ }
+
+ return;
+}
+
+void delete_proc_topology(tod_topology_node &i_tod_node)
+{
+ if (i_tod_node.i_target != NULL)
+ {
+ delete i_tod_node.i_target;
+ i_tod_node.i_target = NULL;
+ }
+
+ for (auto l_child_node : i_tod_node.i_children)
+ {
+ if (l_child_node->i_target != NULL)
+ {
+ delete l_child_node->i_target;
+ l_child_node->i_target = NULL;
+ }
+
+ delete l_child_node;
+ }
+}
+
}; // end namespace
diff --git a/src/usr/isteps/istep18/tod_init.H b/src/usr/isteps/istep18/tod_init.H
index 02936616d..79e0de560 100644
--- a/src/usr/isteps/istep18/tod_init.H
+++ b/src/usr/isteps/istep18/tod_init.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016 */
+/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -25,4 +25,12 @@
#ifndef TOD_INIT_H
#define TOD_INIT_H
+namespace ISTEP_18
+{
+
+ void build_proc_topology(tod_topology_node &i_tod_node);
+ void delete_proc_topology(tod_topology_node &i_tod_node);
+
+};
+
#endif
OpenPOWER on IntegriCloud