blob: 773a9db220d26a503e9f4d243e9ab42464b92ed6 [file] [log] [blame]
Stephen Cprek27a90a82015-07-13 10:50:33 -05001From 7c592db2c42b8dbef0f31a8daebb97ff0ed6a3ac Mon Sep 17 00:00:00 2001
2From: Stephen Cprek <smcprek@us.ibm.com>
3Date: Tue, 30 Jun 2015 16:49:22 -0500
4Subject: [PATCH] Shutdown when deconfig outside of reconfig loop on BMC
5 systems
6
7Change-Id: I1faf0ab0d831a41c332993f555231a8dbecf53ef
8CQ:SW312075
9---
10 src/include/usr/initservice/initsvcreasoncodes.H | 4 +-
11 .../initservice/istepdispatcher/istepdispatcher.C | 120 ++++++++++++++++-----
12 2 files changed, 98 insertions(+), 26 deletions(-)
13
14diff --git a/src/include/usr/initservice/initsvcreasoncodes.H b/src/include/usr/initservice/initsvcreasoncodes.H
15index d11824e..e174564 100644
16--- a/src/include/usr/initservice/initsvcreasoncodes.H
17+++ b/src/include/usr/initservice/initsvcreasoncodes.H
18@@ -5,7 +5,7 @@
19 /* */
20 /* OpenPOWER HostBoot Project */
21 /* */
22-/* Contributors Listed Below - COPYRIGHT 2011,2014 */
23+/* Contributors Listed Below - COPYRIGHT 2011,2015 */
24 /* [+] International Business Machines Corp. */
25 /* */
26 /* */
27@@ -74,6 +74,8 @@ enum InitServiceReasonCode
28 //termination_rc
29 SBE_EXTRACT_RC_REQUEST_REIPL = INITSVC_COMP_ID | 0x0e,
30 RECONFIG_LOOP_TEST_RC = INITSVC_COMP_ID | 0x0f,
31+ //termination_rc
32+ SHUTDOWN_NOT_RECONFIG_LOOP = INITSVC_COMP_ID | 0x10,
33 };
34
35 enum InitServiceUserDetailDataSubSection
36diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C
37index d3581e9..7f3c0b7 100644
38--- a/src/usr/initservice/istepdispatcher/istepdispatcher.C
39+++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C
40@@ -96,6 +96,10 @@ const uint8_t OUTER_STOP_STEP = 14;
41 const uint8_t OUTER_STOP_SUBSTEP = 5;
42 const uint8_t HB_START_ISTEP = 6;
43
44+// @todo RTC 124679 - Remove Once BMC Monitors Shutdown Attention
45+// Set Watchdog Timer To 15 seconds before calling doShutdown()
46+const uint16_t SET_WD_TIMER_IN_SECS = 15;
47+
48 /**
49 * _start() task entry procedure using the macro in taskargs.H
50 */
51@@ -506,14 +510,58 @@ errlHndl_t IStepDispatcher::executeAllISteps()
52 }
53 else
54 {
55- // Reconfig loop required, but the istep is either outside
56- // of the reconfig loop, too many reconfigs have been
57- // attempted, in manufacturing mode, or in MPIPL.
58- // Return an error to cause termination
59+
60 if (!err)
61 {
62- err = failedDueToDeconfig(istep, substep,
63- newIstep, newSubstep);
64+ // Reconfig loop required, but the istep is either outside
65+ // of the reconfig loop, too many reconfigs have been
66+ // attempted, in manufacturing mode, or in MPIPL.
67+ // Return an error to cause termination on FSP systems
68+ if (iv_spBaseServicesEnabled)
69+ {
70+ err = failedDueToDeconfig(istep, substep,
71+ newIstep, newSubstep);
72+ }
73+ // Otherwise increment the reboot count and shutdown
74+ #ifdef CONFIG_BMC_IPMI
75+ else
76+ {
77+ uint16_t l_count = 0;
78+ SENSOR::RebootCountSensor l_sensor;
79+
80+ // Read reboot count sensor
81+ err = l_sensor.getRebootCount(l_count);
82+ if (err)
83+ {
84+ TRACFCOMP(g_trac_initsvc, ERR_MRK"executeAllISteps: getRebootCount failed");
85+ break;
86+ }
87+ // Increment reboot count
88+ l_count++;
89+ err = l_sensor.setRebootCount(l_count);
90+ if (err)
91+ {
92+ TRACFCOMP(g_trac_initsvc, ERR_MRK"executeAllISteps: setRebootCount to %d failed", l_count);
93+ break;
94+ }
95+
96+ // @TODO RTC:124679 - Remove Once BMC Monitors
97+ // Shutdown Attention
98+ // Set Watchdog Timer before calling doShutdown()
99+ TRACFCOMP( g_trac_initsvc,"executeAllISteps: "
100+ "Set Watch Dog Timer To %d Seconds",
101+ SET_WD_TIMER_IN_SECS);
102+
103+ err = IPMIWATCHDOG::setWatchDogTimer(
104+ SET_WD_TIMER_IN_SECS, // new time
105+ static_cast<uint8_t>
106+ (IPMIWATCHDOG::DO_NOT_STOP |
107+ IPMIWATCHDOG::BIOS_FRB2), // default
108+ IPMIWATCHDOG::TIMEOUT_HARD_RESET);
109+
110+ shutdownDuringIpl();
111+ }
112+ #endif
113 }
114 // else return the error from doIstep
115 }
116@@ -1260,27 +1308,49 @@ void IStepDispatcher::shutdownDuringIpl()
117 {
118 TRACFCOMP(g_trac_initsvc, ENTER_MRK"IStepDispatcher::shutdownDuringIpl");
119
120- // Create and commit error log for FFDC
121-
122- /*@
123- * @errortype
124- * @reasoncode SHUTDOWN_REQUESTED_BY_FSP
125- * @severity ERRORLOG::ERRL_SEV_INFORMATIONAL
126- * @moduleid ISTEP_INITSVC_MOD_ID
127- * @userdata1 Current IStep
128- * @userdata2 Current SubStep
129- * @devdesc Received shutdown request from FSP
130- */
131- errlHndl_t err = new ERRORLOG::ErrlEntry(
132- ERRORLOG::ERRL_SEV_INFORMATIONAL,
133- ISTEP_INITSVC_MOD_ID,
134- SHUTDOWN_REQUESTED_BY_FSP,
135- this->iv_curIStep, this->iv_curSubStep);
136+ // Create and commit error log for FFDC and call doShutdown with the RC
137+ // to initiate a TI
138+ if (iv_spBaseServicesEnabled)
139+ {
140+ /*@
141+ * @errortype
142+ * @reasoncode SHUTDOWN_REQUESTED_BY_FSP
143+ * @severity ERRORLOG::ERRL_SEV_INFORMATIONAL
144+ * @moduleid ISTEP_INITSVC_MOD_ID
145+ * @userdata1 Current IStep
146+ * @userdata2 Current SubStep
147+ * @devdesc Received shutdown request from FSP
148+ */
149+ errlHndl_t err = new ERRORLOG::ErrlEntry(
150+ ERRORLOG::ERRL_SEV_INFORMATIONAL,
151+ ISTEP_INITSVC_MOD_ID,
152+ SHUTDOWN_REQUESTED_BY_FSP,
153+ this->iv_curIStep, this->iv_curSubStep);
154
155- errlCommit(err, INITSVC_COMP_ID);
156+ errlCommit(err, INITSVC_COMP_ID);
157+ INITSERVICE::doShutdown(SHUTDOWN_REQUESTED_BY_FSP);
158+ }
159+ else
160+ {
161+ /*@
162+ * @errortype
163+ * @reasoncode SHUTDOWN_NOT_RECONFIG_LOOP
164+ * @severity ERRORLOG::ERRL_SEV_INFORMATIONAL
165+ * @moduleid ISTEP_INITSVC_MOD_ID
166+ * @userdata1 Current IStep
167+ * @userdata2 Current SubStep
168+ * @devdesc Received shutdown request due to deconfigure
169+ * outside of reconfig loop
170+ */
171+ errlHndl_t err = new ERRORLOG::ErrlEntry(
172+ ERRORLOG::ERRL_SEV_INFORMATIONAL,
173+ ISTEP_INITSVC_MOD_ID,
174+ SHUTDOWN_NOT_RECONFIG_LOOP,
175+ this->iv_curIStep, this->iv_curSubStep);
176
177- // Call doShutdown with the RC to initiate a TI
178- INITSERVICE::doShutdown(SHUTDOWN_REQUESTED_BY_FSP);
179+ errlCommit(err, INITSVC_COMP_ID);
180+ INITSERVICE::doShutdown(SHUTDOWN_NOT_RECONFIG_LOOP);
181+ }
182
183 }
184
185--
1861.8.2.2
187