1 #pragma once
2 
3 #include <attn/attn_config.hpp>
4 
5 #include <cstdint>
6 
7 namespace attn
8 {
9 /** @brief Attention global status bits */
10 constexpr uint32_t SBE_ATTN = 0x00000002;
11 constexpr uint32_t ANY_ATTN = 0x80000000;
12 constexpr uint32_t CHECKSTOP_ATTN = 0x40000000;
13 constexpr uint32_t SPECIAL_ATTN = 0x20000000;
14 constexpr uint32_t RECOVERABLE_ATTN = 0x10000000;
15 
16 /**
17  * @brief Clear attention interrupts
18  *
19  * The attention interrupts are sticky and may still be set (MPIPL) even if
20  * there are no active attentions. If there is an active attention then
21  * clearing the associated interrupt will have no effect.
22  */
23 void clearAttnInterrupts();
24 
25 /**
26  * @brief The main attention handler logic
27  *
28  * Check each processor for active attentions of type SBE Vital (vital),
29  * System Checkstop (checkstop) and Special Attention (special) and handle
30  * each as follows:
31  *
32  * checkstop: Call hardware error analyzer
33  * vital:     TBD
34  * special:   Determine if the special attention is a Breakpoint (BP),
35  *            Terminate Immediately (TI) or CoreCodeToSp (corecode). For each
36  *            special attention type, do the following:
37  *
38  *            BP:          Notify Cronus
39  *            TI:          Start host diagnostics mode systemd unit
40  *            Corecode:    TBD
41  *
42  * @param i_config pointer to attention handler configuration object
43  */
44 void attnHandler(Config* i_config);
45 
46 /**
47  * @brief Determine if attention is active and not masked
48  *
49  * Determine whether an attention needs to be handled and trace details of
50  * attention type and whether it is masked or not.
51  *
52  * @param i_val attention status register
53  * @param i_mask attention true mask register
54  * @param i_attn attention type
55  * @param i_proc processor associated with registers
56  *
57  * @return true if attention is active and not masked, otherwise false
58  */
59 bool activeAttn(uint32_t i_val, uint32_t i_mask, uint32_t i_attn);
60 
61 } // namespace attn
62