blob: eae734460184805285fb2e7146a29e75b1d62910 [file] [log] [blame]
Patrick Venture5e6ac712017-10-25 12:16:19 -07001#include "watchdog.hpp"
2
Patrick Venture0b02be92018-08-31 11:55:55 -07003#include "watchdog_service.hpp"
4
William A. Kennington III52575252018-02-09 15:54:56 -08005#include <endian.h>
Patrick Venture0b02be92018-08-31 11:55:55 -07006
Vernon Mauerye08fbff2019-04-03 09:19:34 -07007#include <ipmid/api.hpp>
William A. Kennington III021b4c12018-05-10 11:12:51 -07008#include <phosphor-logging/elog-errors.hpp>
Patrick Venture0b02be92018-08-31 11:55:55 -07009#include <phosphor-logging/elog.hpp>
George Liu05e93872024-07-17 14:48:14 +080010#include <phosphor-logging/lg2.hpp>
William A. Kennington III021b4c12018-05-10 11:12:51 -070011#include <xyz/openbmc_project/Common/error.hpp>
Patrick Venture894571d2017-11-09 14:46:54 -080012
Patrick Williamsfbc6c9d2023-05-10 07:50:16 -050013#include <bitset>
14#include <cstdint>
15#include <string>
16
William A. Kennington IIIbae471c2018-06-15 10:38:01 -070017using phosphor::logging::commit;
William A. Kennington III52575252018-02-09 15:54:56 -080018using phosphor::logging::level;
19using phosphor::logging::log;
Willy Tu523e2d12023-09-05 11:36:48 -070020using sdbusplus::error::xyz::openbmc_project::common::InternalFailure;
Patrick Venture5e6ac712017-10-25 12:16:19 -070021
William A. Kennington IIIbae471c2018-06-15 10:38:01 -070022static bool lastCallSuccessful = false;
23
George Liucc96b422025-07-08 14:18:48 +080024namespace ipmi
25{
26constexpr Cc ccWatchdogNotInit = 0x80;
27
28static inline auto responseWatchdogNotInit()
29{
30 return response(ccWatchdogNotInit);
31}
32} // namespace ipmi
33
William A. Kennington IIIbae471c2018-06-15 10:38:01 -070034void reportError()
35{
36 // We don't want to fill the SEL with errors if the daemon dies and doesn't
37 // come back but the watchdog keeps on ticking. Instead, we only report the
38 // error if we haven't reported one since the last successful call
39 if (!lastCallSuccessful)
40 {
41 return;
42 }
43 lastCallSuccessful = false;
44
45 // TODO: This slow down the end of the IPMI transaction waiting
46 // for the commit to finish. commit<>() can take at least 5 seconds
47 // to complete. 5s is very slow for an IPMI command and ends up
48 // congesting the IPMI channel needlessly, especially if the watchdog
49 // is ticking fairly quickly and we have some transient issues.
50 commit<InternalFailure>();
51}
52
Vernon Mauery11df4f62019-03-25 14:17:54 -070053ipmi::RspType<> ipmiAppResetWatchdogTimer()
Patrick Venture5e6ac712017-10-25 12:16:19 -070054{
William A. Kennington III52575252018-02-09 15:54:56 -080055 try
56 {
George Liu311d8e82025-03-12 08:48:19 +080057 WatchdogService wdService;
William A. Kennington III52575252018-02-09 15:54:56 -080058
William A. Kennington IIIde14a022018-02-09 16:11:18 -080059 // Notify the caller if we haven't initialized our timer yet
60 // so it can configure actions and timeouts
George Liu311d8e82025-03-12 08:48:19 +080061 if (!wdService.getInitialized())
William A. Kennington IIIde14a022018-02-09 16:11:18 -080062 {
William A. Kennington IIIbae471c2018-06-15 10:38:01 -070063 lastCallSuccessful = true;
Vernon Mauery11df4f62019-03-25 14:17:54 -070064
George Liucc96b422025-07-08 14:18:48 +080065 return ipmi::responseWatchdogNotInit();
William A. Kennington IIIde14a022018-02-09 16:11:18 -080066 }
67
William A. Kennington III4b017a92018-04-27 14:31:08 -070068 // The ipmi standard dictates we enable the watchdog during reset
George Liu311d8e82025-03-12 08:48:19 +080069 wdService.resetTimeRemaining(true);
William A. Kennington IIIbae471c2018-06-15 10:38:01 -070070 lastCallSuccessful = true;
Vernon Mauery11df4f62019-03-25 14:17:54 -070071 return ipmi::responseSuccess();
Patrick Venture5e6ac712017-10-25 12:16:19 -070072 }
William A. Kennington III021b4c12018-05-10 11:12:51 -070073 catch (const InternalFailure& e)
74 {
William A. Kennington IIIbae471c2018-06-15 10:38:01 -070075 reportError();
Vernon Mauery11df4f62019-03-25 14:17:54 -070076 return ipmi::responseUnspecifiedError();
William A. Kennington III021b4c12018-05-10 11:12:51 -070077 }
William A. Kennington III52575252018-02-09 15:54:56 -080078 catch (const std::exception& e)
79 {
George Liu05e93872024-07-17 14:48:14 +080080 lg2::error("wd_reset: {ERROR}", "ERROR", e);
Vernon Mauery11df4f62019-03-25 14:17:54 -070081 return ipmi::responseUnspecifiedError();
William A. Kennington III5325f2c2018-01-08 15:17:09 -080082 }
William A. Kennington III52575252018-02-09 15:54:56 -080083 catch (...)
84 {
George Liu05e93872024-07-17 14:48:14 +080085 lg2::error("wd_reset: Unknown Error");
Vernon Mauery11df4f62019-03-25 14:17:54 -070086 return ipmi::responseUnspecifiedError();
William A. Kennington III5325f2c2018-01-08 15:17:09 -080087 }
Patrick Venture5e6ac712017-10-25 12:16:19 -070088}
William A. Kennington III61d5f7b2018-02-09 15:23:53 -080089
George Liu311d8e82025-03-12 08:48:19 +080090static constexpr uint8_t wdTimeoutActionMask = 0x3;
William A. Kennington III52575252018-02-09 15:54:56 -080091
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +000092static constexpr uint8_t wdTimerUseResTimer1 = 0x0;
93static constexpr uint8_t wdTimerUseResTimer2 = 0x6;
94static constexpr uint8_t wdTimerUseResTimer3 = 0x7;
95
Yong Li4dd71af2019-09-29 14:18:07 +080096static constexpr uint8_t wdTimeoutActionMax = 3;
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +000097static constexpr uint8_t wdTimeoutInterruptTimer = 0x04;
Yong Li118907e2019-01-11 17:36:17 +080098
Patrick Venture0b02be92018-08-31 11:55:55 -070099enum class IpmiAction : uint8_t
100{
William A. Kennington III52575252018-02-09 15:54:56 -0800101 None = 0x0,
102 HardReset = 0x1,
103 PowerOff = 0x2,
104 PowerCycle = 0x3,
105};
106
William A. Kennington IIIb638de22018-02-09 16:12:53 -0800107/** @brief Converts an IPMI Watchdog Action to DBUS defined action
George Liu311d8e82025-03-12 08:48:19 +0800108 * @param[in] ipmiAction The IPMI Watchdog Action
109 * @return The Watchdog Action that the ipmiAction maps to
William A. Kennington IIIb638de22018-02-09 16:12:53 -0800110 */
George Liu311d8e82025-03-12 08:48:19 +0800111WatchdogService::Action ipmiActionToWdAction(IpmiAction ipmiAction)
William A. Kennington IIIb638de22018-02-09 16:12:53 -0800112{
George Liu311d8e82025-03-12 08:48:19 +0800113 switch (ipmiAction)
William A. Kennington IIIb638de22018-02-09 16:12:53 -0800114 {
115 case IpmiAction::None:
116 {
117 return WatchdogService::Action::None;
118 }
119 case IpmiAction::HardReset:
120 {
121 return WatchdogService::Action::HardReset;
122 }
123 case IpmiAction::PowerOff:
124 {
125 return WatchdogService::Action::PowerOff;
126 }
127 case IpmiAction::PowerCycle:
128 {
129 return WatchdogService::Action::PowerCycle;
130 }
131 default:
132 {
133 throw std::domain_error("IPMI Action is invalid");
134 }
135 }
136}
137
Yong Li118907e2019-01-11 17:36:17 +0800138enum class IpmiTimerUse : uint8_t
139{
140 Reserved = 0x0,
141 BIOSFRB2 = 0x1,
142 BIOSPOST = 0x2,
143 OSLoad = 0x3,
144 SMSOS = 0x4,
145 OEM = 0x5,
146};
147
148WatchdogService::TimerUse ipmiTimerUseToWdTimerUse(IpmiTimerUse ipmiTimerUse)
149{
150 switch (ipmiTimerUse)
151 {
152 case IpmiTimerUse::Reserved:
153 {
154 return WatchdogService::TimerUse::Reserved;
155 }
156 case IpmiTimerUse::BIOSFRB2:
157 {
158 return WatchdogService::TimerUse::BIOSFRB2;
159 }
160 case IpmiTimerUse::BIOSPOST:
161 {
162 return WatchdogService::TimerUse::BIOSPOST;
163 }
164 case IpmiTimerUse::OSLoad:
165 {
166 return WatchdogService::TimerUse::OSLoad;
167 }
168 case IpmiTimerUse::SMSOS:
169 {
170 return WatchdogService::TimerUse::SMSOS;
171 }
172 case IpmiTimerUse::OEM:
173 {
174 return WatchdogService::TimerUse::OEM;
175 }
176 default:
177 {
178 return WatchdogService::TimerUse::Reserved;
179 }
180 }
181}
182
Yong Li4dd71af2019-09-29 14:18:07 +0800183static bool timerNotLogFlags = false;
Yong Lia729bf42019-10-14 12:42:10 +0800184static std::bitset<8> timerUseExpirationFlags = 0;
Yong Li4dd71af2019-09-29 14:18:07 +0800185static uint3_t timerPreTimeoutInterrupt = 0;
Yong Lia729bf42019-10-14 12:42:10 +0800186static constexpr uint8_t wdExpirationFlagReservedBit0 = 0x0;
187static constexpr uint8_t wdExpirationFlagReservedBit6 = 0x6;
188static constexpr uint8_t wdExpirationFlagReservedBit7 = 0x7;
William A. Kennington III52575252018-02-09 15:54:56 -0800189
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000190/**@brief The Set Watchdog Timer ipmi command.
191 *
192 * @param
193 * - timerUse
194 * - dontStopTimer
195 * - dontLog
196 * - timerAction
197 * - pretimeout
198 * - expireFlags
199 * - initialCountdown
200 *
201 * @return completion code on success.
202 **/
Patrick Williams1318a5e2024-08-16 15:19:54 -0400203ipmi::RspType<> ipmiSetWatchdogTimer(
204 uint3_t timerUse, uint3_t reserved, bool dontStopTimer, bool dontLog,
205 uint3_t timeoutAction, uint1_t reserved1, uint3_t preTimeoutInterrupt,
206 uint1_t reserved2, uint8_t preTimeoutInterval, std::bitset<8> expFlagValue,
207 uint16_t initialCountdown)
William A. Kennington III61d5f7b2018-02-09 15:23:53 -0800208{
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000209 if ((timerUse == wdTimerUseResTimer1) ||
210 (timerUse == wdTimerUseResTimer2) ||
211 (timerUse == wdTimerUseResTimer3) ||
Yong Li4dd71af2019-09-29 14:18:07 +0800212 (timeoutAction > wdTimeoutActionMax) ||
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000213 (preTimeoutInterrupt == wdTimeoutInterruptTimer) ||
Yong Lia729bf42019-10-14 12:42:10 +0800214 (reserved | reserved1 | reserved2 |
215 expFlagValue.test(wdExpirationFlagReservedBit0) |
216 expFlagValue.test(wdExpirationFlagReservedBit6) |
217 expFlagValue.test(wdExpirationFlagReservedBit7)))
William A. Kennington III52575252018-02-09 15:54:56 -0800218 {
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000219 return ipmi::responseInvalidFieldRequest();
William A. Kennington III52575252018-02-09 15:54:56 -0800220 }
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000221
222 if (preTimeoutInterval > (initialCountdown / 10))
223 {
224 return ipmi::responseInvalidFieldRequest();
225 }
226
Yong Li4dd71af2019-09-29 14:18:07 +0800227 timerNotLogFlags = dontLog;
228 timerPreTimeoutInterrupt = preTimeoutInterrupt;
William A. Kennington III61d5f7b2018-02-09 15:23:53 -0800229
William A. Kennington III52575252018-02-09 15:54:56 -0800230 try
William A. Kennington III61d5f7b2018-02-09 15:23:53 -0800231 {
George Liu311d8e82025-03-12 08:48:19 +0800232 WatchdogService wdService;
William A. Kennington III52575252018-02-09 15:54:56 -0800233 // Stop the timer if the don't stop bit is not set
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000234 if (!(dontStopTimer))
William A. Kennington III52575252018-02-09 15:54:56 -0800235 {
George Liu311d8e82025-03-12 08:48:19 +0800236 wdService.setEnabled(false);
William A. Kennington III61d5f7b2018-02-09 15:23:53 -0800237 }
238
William A. Kennington III52575252018-02-09 15:54:56 -0800239 // Set the action based on the request
George Liu311d8e82025-03-12 08:48:19 +0800240 const auto ipmiAction = static_cast<IpmiAction>(
241 static_cast<uint8_t>(timeoutAction) & wdTimeoutActionMask);
242 wdService.setExpireAction(ipmiActionToWdAction(ipmiAction));
William A. Kennington III52575252018-02-09 15:54:56 -0800243
William A. Kennington III7a0e5df2021-05-19 13:31:29 -0700244 const auto ipmiTimerUse = types::enum_cast<IpmiTimerUse>(timerUse);
George Liu311d8e82025-03-12 08:48:19 +0800245 wdService.setTimerUse(ipmiTimerUseToWdTimerUse(ipmiTimerUse));
Yong Li118907e2019-01-11 17:36:17 +0800246
George Liu311d8e82025-03-12 08:48:19 +0800247 wdService.setExpiredTimerUse(WatchdogService::TimerUse::Reserved);
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000248
Yong Lia729bf42019-10-14 12:42:10 +0800249 timerUseExpirationFlags &= ~expFlagValue;
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000250
William A. Kennington III52575252018-02-09 15:54:56 -0800251 // Set the new interval and the time remaining deci -> mill seconds
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000252 const uint64_t interval = initialCountdown * 100;
George Liu311d8e82025-03-12 08:48:19 +0800253 wdService.setInterval(interval);
254 wdService.resetTimeRemaining(false);
William A. Kennington III52575252018-02-09 15:54:56 -0800255
William A. Kennington IIIde14a022018-02-09 16:11:18 -0800256 // Mark as initialized so that future resets behave correctly
George Liu311d8e82025-03-12 08:48:19 +0800257 wdService.setInitialized(true);
258 wdService.setLogTimeout(!dontLog);
William A. Kennington IIIde14a022018-02-09 16:11:18 -0800259
William A. Kennington IIIbae471c2018-06-15 10:38:01 -0700260 lastCallSuccessful = true;
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000261 return ipmi::responseSuccess();
William A. Kennington III61d5f7b2018-02-09 15:23:53 -0800262 }
Patrick Venture0b02be92018-08-31 11:55:55 -0700263 catch (const std::domain_error&)
William A. Kennington III52575252018-02-09 15:54:56 -0800264 {
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000265 return ipmi::responseInvalidFieldRequest();
William A. Kennington III52575252018-02-09 15:54:56 -0800266 }
William A. Kennington III021b4c12018-05-10 11:12:51 -0700267 catch (const InternalFailure& e)
268 {
William A. Kennington IIIbae471c2018-06-15 10:38:01 -0700269 reportError();
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000270 return ipmi::responseUnspecifiedError();
William A. Kennington III021b4c12018-05-10 11:12:51 -0700271 }
William A. Kennington III52575252018-02-09 15:54:56 -0800272 catch (const std::exception& e)
273 {
George Liu05e93872024-07-17 14:48:14 +0800274 lg2::error("wd_set: {ERROR}", "ERROR", e);
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000275 return ipmi::responseUnspecifiedError();
William A. Kennington III52575252018-02-09 15:54:56 -0800276 }
277 catch (...)
278 {
George Liu05e93872024-07-17 14:48:14 +0800279 lg2::error("wd_set: Unknown Error");
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000280 return ipmi::responseUnspecifiedError();
William A. Kennington III52575252018-02-09 15:54:56 -0800281 }
William A. Kennington III61d5f7b2018-02-09 15:23:53 -0800282}
William A. Kennington III73f44512018-02-09 15:28:46 -0800283
284/** @brief Converts a DBUS Watchdog Action to IPMI defined action
George Liu311d8e82025-03-12 08:48:19 +0800285 * @param[in] wdAction The DBUS Watchdog Action
286 * @return The IpmiAction that the wdAction maps to
William A. Kennington III73f44512018-02-09 15:28:46 -0800287 */
George Liu311d8e82025-03-12 08:48:19 +0800288IpmiAction wdActionToIpmiAction(WatchdogService::Action wdAction)
William A. Kennington III73f44512018-02-09 15:28:46 -0800289{
George Liu311d8e82025-03-12 08:48:19 +0800290 switch (wdAction)
William A. Kennington III73f44512018-02-09 15:28:46 -0800291 {
292 case WatchdogService::Action::None:
293 {
294 return IpmiAction::None;
295 }
296 case WatchdogService::Action::HardReset:
297 {
298 return IpmiAction::HardReset;
299 }
300 case WatchdogService::Action::PowerOff:
301 {
302 return IpmiAction::PowerOff;
303 }
304 case WatchdogService::Action::PowerCycle:
305 {
306 return IpmiAction::PowerCycle;
307 }
308 default:
309 {
310 // We have no method via IPMI to signal that the action is unknown
311 // or unmappable in some way.
312 // Just ignore the error and return NONE so the host can reconcile.
313 return IpmiAction::None;
314 }
315 }
316}
317
Yong Li118907e2019-01-11 17:36:17 +0800318IpmiTimerUse wdTimerUseToIpmiTimerUse(WatchdogService::TimerUse wdTimerUse)
319{
320 switch (wdTimerUse)
321 {
322 case WatchdogService::TimerUse::Reserved:
323 {
324 return IpmiTimerUse::Reserved;
325 }
326 case WatchdogService::TimerUse::BIOSFRB2:
327 {
328 return IpmiTimerUse::BIOSFRB2;
329 }
330 case WatchdogService::TimerUse::BIOSPOST:
331 {
332 return IpmiTimerUse::BIOSPOST;
333 }
334 case WatchdogService::TimerUse::OSLoad:
335 {
336 return IpmiTimerUse::OSLoad;
337 }
338
339 case WatchdogService::TimerUse::SMSOS:
340 {
341 return IpmiTimerUse::SMSOS;
342 }
343 case WatchdogService::TimerUse::OEM:
344 {
345 return IpmiTimerUse::OEM;
346 }
347 default:
348 {
349 return IpmiTimerUse::Reserved;
350 }
351 }
352}
353
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000354/**@brief The getWatchdogTimer ipmi command.
355 *
356 * @return Completion code plus timer details.
357 * - timerUse
358 * - timerAction
359 * - pretimeout
360 * - expireFlags
361 * - initialCountdown
362 * - presentCountdown
363 **/
Patrick Williamsfbc6c9d2023-05-10 07:50:16 -0500364ipmi::RspType<uint3_t, // timerUse - timer use
365 uint3_t, // timerUse - reserved
366 bool, // timerUse - timer is started
367 bool, // timerUse - don't log
Yong Li4dd71af2019-09-29 14:18:07 +0800368
Patrick Williamsfbc6c9d2023-05-10 07:50:16 -0500369 uint3_t, // timerAction - timeout action
370 uint1_t, // timerAction - reserved
371 uint3_t, // timerAction - pre-timeout interrupt
372 uint1_t, // timerAction - reserved
Yong Li4dd71af2019-09-29 14:18:07 +0800373
Yong Lia729bf42019-10-14 12:42:10 +0800374 uint8_t, // pretimeout
375 std::bitset<8>, // expireFlags
376 uint16_t, // initial Countdown - Little Endian (deciseconds)
377 uint16_t // present Countdown - Little Endian (deciseconds)
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000378 >
379 ipmiGetWatchdogTimer()
William A. Kennington III73f44512018-02-09 15:28:46 -0800380{
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000381 uint16_t presentCountdown = 0;
382 uint8_t pretimeout = 0;
William A. Kennington III73f44512018-02-09 15:28:46 -0800383
384 try
385 {
George Liu311d8e82025-03-12 08:48:19 +0800386 WatchdogService wdService;
387 WatchdogService::Properties wdProp = wdService.getProperties();
William A. Kennington III73f44512018-02-09 15:28:46 -0800388
389 // Build and return the response
Yong Lif7c9db02019-01-15 13:45:33 +0800390 // Interval and timeRemaining need converted from milli -> deci seconds
George Liu311d8e82025-03-12 08:48:19 +0800391 uint16_t initialCountdown = htole16(wdProp.interval / 100);
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000392
George Liu311d8e82025-03-12 08:48:19 +0800393 if (wdProp.expiredTimerUse != WatchdogService::TimerUse::Reserved)
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000394 {
Yong Lia729bf42019-10-14 12:42:10 +0800395 timerUseExpirationFlags.set(static_cast<uint8_t>(
George Liu311d8e82025-03-12 08:48:19 +0800396 wdTimerUseToIpmiTimerUse(wdProp.expiredTimerUse)));
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000397 }
398
George Liu311d8e82025-03-12 08:48:19 +0800399 if (wdProp.enabled)
William A. Kennington III73f44512018-02-09 15:28:46 -0800400 {
George Liu311d8e82025-03-12 08:48:19 +0800401 presentCountdown = htole16(wdProp.timeRemaining / 100);
Yong Lif7c9db02019-01-15 13:45:33 +0800402 }
403 else
404 {
George Liu311d8e82025-03-12 08:48:19 +0800405 if (wdProp.expiredTimerUse == WatchdogService::TimerUse::Reserved)
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000406 {
407 presentCountdown = initialCountdown;
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000408 }
409 else
410 {
411 presentCountdown = 0;
Yong Li4dd71af2019-09-29 14:18:07 +0800412 // Automatically clear it whenever a timer expiration occurs.
413 timerNotLogFlags = false;
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000414 }
William A. Kennington III73f44512018-02-09 15:28:46 -0800415 }
Yong Li118907e2019-01-11 17:36:17 +0800416
William A. Kennington III73f44512018-02-09 15:28:46 -0800417 // TODO: Do something about having pretimeout support
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000418 pretimeout = 0;
419
William A. Kennington IIIbae471c2018-06-15 10:38:01 -0700420 lastCallSuccessful = true;
Yong Li4dd71af2019-09-29 14:18:07 +0800421 return ipmi::responseSuccess(
William A. Kennington III7a0e5df2021-05-19 13:31:29 -0700422 types::enum_cast<uint3_t>(
George Liu311d8e82025-03-12 08:48:19 +0800423 wdTimerUseToIpmiTimerUse(wdProp.timerUse)),
424 0, wdProp.enabled, timerNotLogFlags,
William A. Kennington III7a0e5df2021-05-19 13:31:29 -0700425 types::enum_cast<uint3_t>(
George Liu311d8e82025-03-12 08:48:19 +0800426 wdActionToIpmiAction(wdProp.expireAction)),
William A. Kennington III7a0e5df2021-05-19 13:31:29 -0700427 0, timerPreTimeoutInterrupt, 0, pretimeout, timerUseExpirationFlags,
Yong Li4dd71af2019-09-29 14:18:07 +0800428 initialCountdown, presentCountdown);
William A. Kennington III73f44512018-02-09 15:28:46 -0800429 }
William A. Kennington III021b4c12018-05-10 11:12:51 -0700430 catch (const InternalFailure& e)
431 {
William A. Kennington IIIbae471c2018-06-15 10:38:01 -0700432 reportError();
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000433 return ipmi::responseUnspecifiedError();
William A. Kennington III021b4c12018-05-10 11:12:51 -0700434 }
William A. Kennington III73f44512018-02-09 15:28:46 -0800435 catch (const std::exception& e)
436 {
George Liu05e93872024-07-17 14:48:14 +0800437 lg2::error("wd_get: {ERROR}", "ERROR", e);
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000438 return ipmi::responseUnspecifiedError();
William A. Kennington III73f44512018-02-09 15:28:46 -0800439 }
440 catch (...)
441 {
George Liu05e93872024-07-17 14:48:14 +0800442 lg2::error("wd_get: Unknown Error");
Deepak Kumar Sahucfae9482019-05-20 14:58:58 +0000443 return ipmi::responseUnspecifiedError();
William A. Kennington III73f44512018-02-09 15:28:46 -0800444 }
445}