1 #pragma once
2 
3 #include <attn/attn_config.hpp>
4 
5 namespace attn
6 {
7 
8 /** @brief Attention handler return codes */
9 enum ReturnCodes
10 {
11     RC_SUCCESS = 0,
12     RC_NOT_HANDLED,
13     RC_ANALYZER_ERROR,
14     RC_CFAM_ERROR
15 };
16 
17 /** @brief Code seciton for error reporing */
18 enum class AttnSection
19 {
20     reserved     = 0x0000,
21     attnHandler  = 0x0100,
22     tiHandler    = 0x0200,
23     handlePhypTi = 0x0300,
24     handleHbTi   = 0x0400
25 };
26 
27 /** @brief Attention handler error reason codes */
28 enum AttnCodes
29 {
30     ATTN_NO_ERROR  = 0,
31     ATTN_INFO_NULL = 1,
32     ATTN_PDBG_CFAM = 2
33 };
34 
35 /** @brief Attention global status bits */
36 constexpr uint32_t SBE_ATTN       = 0x00000002;
37 constexpr uint32_t CHECKSTOP_ATTN = 0x40000000;
38 constexpr uint32_t SPECIAL_ATTN   = 0x20000000;
39 
40 // Need to add defaultHbTiInfo with SRC BC801B99 (hex)
41 
42 // Need to add defaultOpalTiInfo with SRC BB821410 (ascii)
43 
44 constexpr uint8_t defaultPhypTiInfo[0x58] = {
45     0x01, 0xa1, 0x02, 0xa8, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
46     0x09, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
47     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
48     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
49     0x00, 0x00, 0x00, 0x00, 0x42, 0x37, 0x30, 0x30, 0x46, 0x46, 0x46,
50     0x46, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
51     0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
52     0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
53 
54 /**
55  * @brief The main attention handler logic
56  *
57  * Check each processor for active attentions of type SBE Vital (vital),
58  * System Checkstop (checkstop) and Special Attention (special) and handle
59  * each as follows:
60  *
61  * checkstop: Call hardware error analyzer
62  * vital:     TBD
63  * special:   Determine if the special attention is a Breakpoint (BP),
64  *            Terminate Immediately (TI) or CoreCodeToSp (corecode). For each
65  *            special attention type, do the following:
66  *
67  *            BP:          Notify Cronus
68  *            TI:          Start host diagnostics mode systemd unit
69  *            Corecode:    TBD
70  *
71  * @param i_config pointer to attention handler configuration object
72  */
73 void attnHandler(Config* i_config);
74 
75 } // namespace attn
76