1ef320154SBen Tyner #pragma once 2ef320154SBen Tyner 33fb52e53SBen Tyner #include <attn/attn_config.hpp> 43fb52e53SBen Tyner 5*bdb8667cSBen Tyner #include <cstdint> 6*bdb8667cSBen Tyner 773ac368aSBen Tyner namespace attn 873ac368aSBen Tyner { 9fb190545SBen Tyner /** @brief Attention global status bits */ 10fb190545SBen Tyner constexpr uint32_t SBE_ATTN = 0x00000002; 116a69e6e5SBen Tyner constexpr uint32_t ANY_ATTN = 0x80000000; 12fb190545SBen Tyner constexpr uint32_t CHECKSTOP_ATTN = 0x40000000; 13fb190545SBen Tyner constexpr uint32_t SPECIAL_ATTN = 0x20000000; 14135793a8SBen Tyner constexpr uint32_t RECOVERABLE_ATTN = 0x10000000; 15fb190545SBen Tyner 16ef320154SBen Tyner /** 1790516851SBen Tyner * @brief Clear attention interrupts 1890516851SBen Tyner * 1990516851SBen Tyner * The attention interrupts are sticky and may still be set (MPIPL) even if 2090516851SBen Tyner * there are no active attentions. If there is an active attention then 2190516851SBen Tyner * clearing the associated interrupt will have no effect. 2290516851SBen Tyner */ 2390516851SBen Tyner void clearAttnInterrupts(); 2490516851SBen Tyner 2590516851SBen Tyner /** 26ef320154SBen Tyner * @brief The main attention handler logic 27ef320154SBen Tyner * 28ef320154SBen Tyner * Check each processor for active attentions of type SBE Vital (vital), 297a0dd543SBen Tyner * System Checkstop (checkstop) and Special Attention (special) and handle 307a0dd543SBen Tyner * each as follows: 31ef320154SBen Tyner * 323fb52e53SBen Tyner * checkstop: Call hardware error analyzer 33ef320154SBen Tyner * vital: TBD 34ef320154SBen Tyner * special: Determine if the special attention is a Breakpoint (BP), 357a0dd543SBen Tyner * Terminate Immediately (TI) or CoreCodeToSp (corecode). For each 367a0dd543SBen Tyner * special attention type, do the following: 37ef320154SBen Tyner * 38ef320154SBen Tyner * BP: Notify Cronus 393fb52e53SBen Tyner * TI: Start host diagnostics mode systemd unit 40ef320154SBen Tyner * Corecode: TBD 41970fd4fbSBen Tyner * 423fb52e53SBen Tyner * @param i_config pointer to attention handler configuration object 43ef320154SBen Tyner */ 443fb52e53SBen Tyner void attnHandler(Config* i_config); 4573ac368aSBen Tyner 4690516851SBen Tyner /** 4790516851SBen Tyner * @brief Determine if attention is active and not masked 4890516851SBen Tyner * 4990516851SBen Tyner * Determine whether an attention needs to be handled and trace details of 5090516851SBen Tyner * attention type and whether it is masked or not. 5190516851SBen Tyner * 5290516851SBen Tyner * @param i_val attention status register 5390516851SBen Tyner * @param i_mask attention true mask register 5490516851SBen Tyner * @param i_attn attention type 5590516851SBen Tyner * @param i_proc processor associated with registers 5690516851SBen Tyner * 5790516851SBen Tyner * @return true if attention is active and not masked, otherwise false 5890516851SBen Tyner */ 5990516851SBen Tyner bool activeAttn(uint32_t i_val, uint32_t i_mask, uint32_t i_attn); 6090516851SBen Tyner 6173ac368aSBen Tyner } // namespace attn 62