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