Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 3 | #include <attn/attn_config.hpp> |
| 4 | |
Ben Tyner | bdb8667 | 2023-06-07 14:18:06 -0700 | [diff] [blame] | 5 | #include <cstdint> |
| 6 | |
Ben Tyner | 73ac368 | 2020-01-09 10:46:47 -0600 | [diff] [blame] | 7 | namespace attn |
| 8 | { |
Ben Tyner | fb19054 | 2020-11-06 09:27:56 -0600 | [diff] [blame] | 9 | /** @brief Attention global status bits */ |
Patrick Williams | 27dd636 | 2023-05-10 07:51:20 -0500 | [diff] [blame] | 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; |
Ben Tyner | 135793a | 2021-10-27 09:18:41 -0500 | [diff] [blame] | 14 | constexpr uint32_t RECOVERABLE_ATTN = 0x10000000; |
Ben Tyner | fb19054 | 2020-11-06 09:27:56 -0600 | [diff] [blame] | 15 | |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 16 | /** |
Ben Tyner | 9051685 | 2022-12-14 21:04:18 -0600 | [diff] [blame] | 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 | /** |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 26 | * @brief The main attention handler logic |
| 27 | * |
| 28 | * Check each processor for active attentions of type SBE Vital (vital), |
Ben Tyner | 7a0dd54 | 2021-02-12 09:33:44 -0600 | [diff] [blame] | 29 | * System Checkstop (checkstop) and Special Attention (special) and handle |
| 30 | * each as follows: |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 31 | * |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 32 | * checkstop: Call hardware error analyzer |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 33 | * vital: TBD |
| 34 | * special: Determine if the special attention is a Breakpoint (BP), |
Ben Tyner | 7a0dd54 | 2021-02-12 09:33:44 -0600 | [diff] [blame] | 35 | * Terminate Immediately (TI) or CoreCodeToSp (corecode). For each |
| 36 | * special attention type, do the following: |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 37 | * |
| 38 | * BP: Notify Cronus |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 39 | * TI: Start host diagnostics mode systemd unit |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 40 | * Corecode: TBD |
Ben Tyner | 970fd4f | 2020-02-19 13:46:42 -0600 | [diff] [blame] | 41 | * |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 42 | * @param i_config pointer to attention handler configuration object |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 43 | */ |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 44 | void attnHandler(Config* i_config); |
Ben Tyner | 73ac368 | 2020-01-09 10:46:47 -0600 | [diff] [blame] | 45 | |
Ben Tyner | 9051685 | 2022-12-14 21:04:18 -0600 | [diff] [blame] | 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 | |
Ben Tyner | 73ac368 | 2020-01-09 10:46:47 -0600 | [diff] [blame] | 61 | } // namespace attn |