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 | 73ac368 | 2020-01-09 10:46:47 -0600 | [diff] [blame] | 5 | namespace attn |
| 6 | { |
| 7 | |
Ben Tyner | dbeaf79 | 2020-05-14 08:27:18 -0500 | [diff] [blame] | 8 | /** @brief Attention handler return codes */ |
| 9 | enum ReturnCodes |
| 10 | { |
Ben Tyner | 4bbcb38 | 2021-02-22 09:29:00 -0600 | [diff] [blame] | 11 | RC_SUCCESS = 0, |
| 12 | RC_NOT_HANDLED = 1, |
| 13 | RC_ANALYZER_ERROR = 2, |
| 14 | RC_CFAM_ERROR = 3, |
| 15 | RC_DBUS_ERROR = 4 |
Ben Tyner | dbeaf79 | 2020-05-14 08:27:18 -0500 | [diff] [blame] | 16 | }; |
| 17 | |
Ben Tyner | 7a0dd54 | 2021-02-12 09:33:44 -0600 | [diff] [blame] | 18 | /** @brief Code seciton for error reporing */ |
| 19 | enum class AttnSection |
| 20 | { |
| 21 | reserved = 0x0000, |
| 22 | attnHandler = 0x0100, |
| 23 | tiHandler = 0x0200, |
| 24 | handlePhypTi = 0x0300, |
| 25 | handleHbTi = 0x0400 |
| 26 | }; |
| 27 | |
| 28 | /** @brief Attention handler error reason codes */ |
Ben Tyner | 29651ef | 2021-02-08 10:51:03 -0600 | [diff] [blame] | 29 | enum AttnCodes |
| 30 | { |
| 31 | ATTN_NO_ERROR = 0, |
Ben Tyner | 7a0dd54 | 2021-02-12 09:33:44 -0600 | [diff] [blame] | 32 | ATTN_INFO_NULL = 1, |
| 33 | ATTN_PDBG_CFAM = 2 |
Ben Tyner | 29651ef | 2021-02-08 10:51:03 -0600 | [diff] [blame] | 34 | }; |
| 35 | |
Ben Tyner | fb19054 | 2020-11-06 09:27:56 -0600 | [diff] [blame] | 36 | /** @brief Attention global status bits */ |
| 37 | constexpr uint32_t SBE_ATTN = 0x00000002; |
| 38 | constexpr uint32_t CHECKSTOP_ATTN = 0x40000000; |
| 39 | constexpr uint32_t SPECIAL_ATTN = 0x20000000; |
| 40 | |
Ben Tyner | b24b220 | 2021-02-08 09:06:10 -0600 | [diff] [blame] | 41 | // Need to add defaultOpalTiInfo with SRC BB821410 (ascii) |
| 42 | |
| 43 | constexpr uint8_t defaultPhypTiInfo[0x58] = { |
| 44 | 0x01, 0xa1, 0x02, 0xa8, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, |
| 45 | 0x09, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 46 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 48 | 0x00, 0x00, 0x00, 0x00, 0x42, 0x37, 0x30, 0x30, 0x46, 0x46, 0x46, |
| 49 | 0x46, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, |
| 50 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, |
| 51 | 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
| 52 | |
Ben Tyner | 4bbcb38 | 2021-02-22 09:29:00 -0600 | [diff] [blame] | 53 | constexpr uint8_t defaultHbTiInfo[0x58] = { |
| 54 | 0x01, 0xa1, 0x02, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 55 | 0x09, 0x01, 0x00, 0x00, 0x00, 0xbc, 0x80, 0x1b, 0x99, 0x00, 0x00, |
| 56 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 57 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 58 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 59 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 60 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 61 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
| 62 | |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 63 | /** |
| 64 | * @brief The main attention handler logic |
| 65 | * |
| 66 | * Check each processor for active attentions of type SBE Vital (vital), |
Ben Tyner | 7a0dd54 | 2021-02-12 09:33:44 -0600 | [diff] [blame] | 67 | * System Checkstop (checkstop) and Special Attention (special) and handle |
| 68 | * each as follows: |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 69 | * |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 70 | * checkstop: Call hardware error analyzer |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 71 | * vital: TBD |
| 72 | * special: Determine if the special attention is a Breakpoint (BP), |
Ben Tyner | 7a0dd54 | 2021-02-12 09:33:44 -0600 | [diff] [blame] | 73 | * Terminate Immediately (TI) or CoreCodeToSp (corecode). For each |
| 74 | * special attention type, do the following: |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 75 | * |
| 76 | * BP: Notify Cronus |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 77 | * TI: Start host diagnostics mode systemd unit |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 78 | * Corecode: TBD |
Ben Tyner | 970fd4f | 2020-02-19 13:46:42 -0600 | [diff] [blame] | 79 | * |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 80 | * @param i_config pointer to attention handler configuration object |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 81 | */ |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 82 | void attnHandler(Config* i_config); |
Ben Tyner | 73ac368 | 2020-01-09 10:46:47 -0600 | [diff] [blame] | 83 | |
| 84 | } // namespace attn |