blob: af6ebc62259de357f146a5cee98e9696e3102c61 [file] [log] [blame]
Ben Tyneref320152020-01-09 10:31:23 -06001#pragma once
2
Ben Tyner3fb52e52020-03-31 10:10:07 -05003#include <attn/attn_config.hpp>
4
Ben Tyner73ac3682020-01-09 10:46:47 -06005namespace attn
6{
Ben Tynerfb190542020-11-06 09:27:56 -06007/** @brief Attention global status bits */
Patrick Williams27dd6362023-05-10 07:51:20 -05008constexpr uint32_t SBE_ATTN = 0x00000002;
9constexpr uint32_t ANY_ATTN = 0x80000000;
10constexpr uint32_t CHECKSTOP_ATTN = 0x40000000;
11constexpr uint32_t SPECIAL_ATTN = 0x20000000;
Ben Tyner135793a2021-10-27 09:18:41 -050012constexpr uint32_t RECOVERABLE_ATTN = 0x10000000;
Ben Tynerfb190542020-11-06 09:27:56 -060013
Ben Tyneref320152020-01-09 10:31:23 -060014/**
Ben Tyner90516852022-12-14 21:04:18 -060015 * @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 */
21void clearAttnInterrupts();
22
23/**
Ben Tyneref320152020-01-09 10:31:23 -060024 * @brief The main attention handler logic
25 *
26 * Check each processor for active attentions of type SBE Vital (vital),
Ben Tyner7a0dd542021-02-12 09:33:44 -060027 * System Checkstop (checkstop) and Special Attention (special) and handle
28 * each as follows:
Ben Tyneref320152020-01-09 10:31:23 -060029 *
Ben Tyner3fb52e52020-03-31 10:10:07 -050030 * checkstop: Call hardware error analyzer
Ben Tyneref320152020-01-09 10:31:23 -060031 * vital: TBD
32 * special: Determine if the special attention is a Breakpoint (BP),
Ben Tyner7a0dd542021-02-12 09:33:44 -060033 * Terminate Immediately (TI) or CoreCodeToSp (corecode). For each
34 * special attention type, do the following:
Ben Tyneref320152020-01-09 10:31:23 -060035 *
36 * BP: Notify Cronus
Ben Tyner3fb52e52020-03-31 10:10:07 -050037 * TI: Start host diagnostics mode systemd unit
Ben Tyneref320152020-01-09 10:31:23 -060038 * Corecode: TBD
Ben Tyner970fd4f2020-02-19 13:46:42 -060039 *
Ben Tyner3fb52e52020-03-31 10:10:07 -050040 * @param i_config pointer to attention handler configuration object
Ben Tyneref320152020-01-09 10:31:23 -060041 */
Ben Tyner3fb52e52020-03-31 10:10:07 -050042void attnHandler(Config* i_config);
Ben Tyner73ac3682020-01-09 10:46:47 -060043
Ben Tyner90516852022-12-14 21:04:18 -060044/**
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 */
57bool activeAttn(uint32_t i_val, uint32_t i_mask, uint32_t i_attn);
58
Ben Tyner73ac3682020-01-09 10:46:47 -060059} // namespace attn