blob: feb95dfe48701be14167b54faa59409c23a35e08 [file] [log] [blame]
Ben Tynerbcf65a82020-12-01 08:46:36 -06001#pragma once
2
Ben Tyner21cc6272022-10-05 18:26:36 -05003#include <util/ffdc.hpp>
4
Ben Tynerbcf65a82020-12-01 08:46:36 -06005namespace attn
6{
7
Ben Tyner07ebb9b2021-12-01 12:16:24 -06008// number of seconds to wait for power fault handling
9constexpr int POWER_FAULT_WAIT = 10;
10
Ben Tynerb8335562021-07-16 12:43:52 -050011/** @brief Attention handler return codes */
12enum ReturnCodes
13{
14 RC_SUCCESS = 0,
15 RC_NOT_HANDLED = 1,
16 RC_ANALYZER_ERROR = 2,
17 RC_CFAM_ERROR = 3,
18 RC_DBUS_ERROR = 4
19};
20
21/** @brief Code seciton for error reporing */
22enum class AttnSection
23{
24 reserved = 0x0000,
25 attnHandler = 0x0100,
26 tiHandler = 0x0200,
27 handlePhypTi = 0x0300,
28 handleHbTi = 0x0400,
austinfcuic49d20b2022-02-22 16:36:47 -060029 addHbStatusRegs = 0x0500,
30 attnLogging = 0x0600
Ben Tynerb8335562021-07-16 12:43:52 -050031};
32
33/** @brief Attention handler error reason codes */
34enum AttnCodes
35{
austinfcuic49d20b2022-02-22 16:36:47 -060036 ATTN_NO_ERROR = 0,
37 ATTN_INFO_NULL = 1,
38 ATTN_PDBG_CFAM = 2,
39 ATTN_PDBG_SCOM = 3,
40 ATTN_INVALID_KEY = 4
Ben Tynerb8335562021-07-16 12:43:52 -050041};
42
Ben Tynerb8335562021-07-16 12:43:52 -050043/**
44 * @brief Traces some regs for hostboot
45 *
46 * When we receive a Checkstop or special Attention Term Immediate,
47 * hostboot wants some regs added to the error log. We will do this
48 * by tracing them and then the traces will get added to the error
49 * log later.
50 *
51 * @return nothing
52 */
53void addHbStatusRegs();
54
Ben Tyner21cc6272022-10-05 18:26:36 -050055/** @brief Capture some scratch registers for PRD
56 *
57 * Capture some scratch register data that PRD can use to handle
58 * cases where analysis may have been interrupted. The data will
59 * be traced and also written to the user data section of a PEL.
60 *
61 * @param[out] o_files vector of FFDC files
62 *
63 * @return nothing
64 */
65void addPrdScratchRegs(std::vector<util::FFDCFile>& o_files);
66
Ben Tyner135793a2021-10-27 09:18:41 -050067/**
68 * @brief Check for recoverable errors present
69 *
70 * @return true if any recoverable errors are present, else false
71 */
72bool recoverableErrors();
73
Ben Tyner07ebb9b2021-12-01 12:16:24 -060074/**
75 * @brief sleep for n-seconds
76 *
77 * @param[in] seconds number of seconds to sleep
78 */
79void sleepSeconds(const unsigned int seconds);
80
Ben Tynerbcf65a82020-12-01 08:46:36 -060081} // namespace attn