Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 1 | #include <libpdbg.h> |
| 2 | |
Ben Tyner | 0205f3b | 2020-02-24 10:24:47 -0600 | [diff] [blame] | 3 | #include <analyzer/analyzer_main.hpp> |
Ben Tyner | b797b3e | 2020-06-29 10:12:05 -0500 | [diff] [blame] | 4 | #include <attn/attention.hpp> |
| 5 | #include <attn/attn_config.hpp> |
| 6 | #include <attn/attn_handler.hpp> |
| 7 | #include <attn/attn_logging.hpp> |
| 8 | #include <attn/bp_handler.hpp> |
| 9 | #include <attn/ti_handler.hpp> |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 10 | |
Ben Tyner | b481d90 | 2020-03-05 10:24:23 -0600 | [diff] [blame] | 11 | #include <algorithm> |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 12 | #include <iomanip> |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 13 | #include <map> |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 14 | #include <sstream> |
Ben Tyner | b481d90 | 2020-03-05 10:24:23 -0600 | [diff] [blame] | 15 | #include <vector> |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 16 | |
| 17 | namespace attn |
| 18 | { |
| 19 | |
| 20 | /** |
| 21 | * @brief Handle SBE vital attention |
| 22 | * |
Ben Tyner | b481d90 | 2020-03-05 10:24:23 -0600 | [diff] [blame] | 23 | * @param i_attention Attention object |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 24 | * @return 0 indicates that the vital attention was successfully handled |
| 25 | * 1 indicates that the vital attention was NOT successfully handled |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 26 | */ |
Ben Tyner | b481d90 | 2020-03-05 10:24:23 -0600 | [diff] [blame] | 27 | int handleVital(Attention* i_attention); |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 28 | |
| 29 | /** |
| 30 | * @brief Handle checkstop attention |
| 31 | * |
Ben Tyner | b481d90 | 2020-03-05 10:24:23 -0600 | [diff] [blame] | 32 | * @param i_attention Attention object |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 33 | * @return 0 indicates that the checkstop attention was successfully handled |
| 34 | * 1 indicates that the checkstop attention was NOT successfully |
| 35 | * handled. |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 36 | */ |
Ben Tyner | b481d90 | 2020-03-05 10:24:23 -0600 | [diff] [blame] | 37 | int handleCheckstop(Attention* i_attention); |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 38 | |
| 39 | /** |
| 40 | * @brief Handle special attention |
| 41 | * |
Ben Tyner | b481d90 | 2020-03-05 10:24:23 -0600 | [diff] [blame] | 42 | * @param i_attention Attention object |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 43 | * @return 0 indicates that the special attention was successfully handled |
| 44 | * 1 indicates that the special attention was NOT successfully handled |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 45 | */ |
Ben Tyner | b481d90 | 2020-03-05 10:24:23 -0600 | [diff] [blame] | 46 | int handleSpecial(Attention* i_attention); |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 47 | |
| 48 | /** |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 49 | * @brief The main attention handler logic |
Ben Tyner | 970fd4f | 2020-02-19 13:46:42 -0600 | [diff] [blame] | 50 | * |
| 51 | * @param i_breakpoints true = breakpoint special attn handling enabled |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 52 | */ |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 53 | void attnHandler(Config* i_config) |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 54 | { |
Ben Tyner | b481d90 | 2020-03-05 10:24:23 -0600 | [diff] [blame] | 55 | // Vector of active attentions to be handled |
| 56 | std::vector<Attention> active_attentions; |
| 57 | |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 58 | uint32_t isr_val, isr_mask; |
| 59 | uint32_t proc; |
| 60 | |
| 61 | // loop through processors looking for active attentions |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 62 | trace<level::INFO>("Attention handler started"); |
Ben Tyner | 117af99 | 2020-05-22 13:32:11 -0500 | [diff] [blame] | 63 | |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 64 | pdbg_target* target; |
Ben Tyner | 5e622d8 | 2020-09-11 10:10:24 -0500 | [diff] [blame] | 65 | pdbg_for_each_class_target("proc", target) |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 66 | { |
| 67 | if (PDBG_TARGET_ENABLED == pdbg_target_probe(target)) |
| 68 | { |
| 69 | proc = pdbg_target_index(target); // get processor number |
| 70 | |
| 71 | std::stringstream ss; // log message stream |
Ben Tyner | 9dbab8b | 2020-03-31 08:55:23 -0500 | [diff] [blame] | 72 | ss << "checking processor " << proc; |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 73 | trace<level::INFO>(ss.str().c_str()); |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 74 | |
Ben Tyner | 5e622d8 | 2020-09-11 10:10:24 -0500 | [diff] [blame] | 75 | // The processor FSI target is required for CFAM read |
| 76 | char path[16]; |
| 77 | sprintf(path, "/proc%d/fsi", proc); |
| 78 | pdbg_target* attnTarget = pdbg_target_from_path(nullptr, path); |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 79 | |
Ben Tyner | 5e622d8 | 2020-09-11 10:10:24 -0500 | [diff] [blame] | 80 | if (PDBG_TARGET_ENABLED == pdbg_target_probe(attnTarget)) |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 81 | { |
Ben Tyner | 5e622d8 | 2020-09-11 10:10:24 -0500 | [diff] [blame] | 82 | // get active attentions on processor |
| 83 | if (RC_SUCCESS != fsi_read(attnTarget, 0x1007, &isr_val)) |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 84 | { |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 85 | // event |
| 86 | eventAttentionFail(RC_CFAM_ERROR); |
| 87 | |
| 88 | // trace |
Ben Tyner | 5e622d8 | 2020-09-11 10:10:24 -0500 | [diff] [blame] | 89 | trace<level::INFO>("Error! cfam read 0x1007 FAILED"); |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 90 | } |
| 91 | else |
| 92 | { |
| 93 | std::stringstream ss; // log message stream |
Ben Tyner | 5e622d8 | 2020-09-11 10:10:24 -0500 | [diff] [blame] | 94 | ss << "cfam 0x1007 = 0x"; |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 95 | ss << std::hex << std::setw(8) << std::setfill('0'); |
Ben Tyner | 5e622d8 | 2020-09-11 10:10:24 -0500 | [diff] [blame] | 96 | ss << isr_val; |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 97 | trace<level::INFO>(ss.str().c_str()); |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 98 | |
Ben Tyner | 5e622d8 | 2020-09-11 10:10:24 -0500 | [diff] [blame] | 99 | // get interrupt enabled special attentions mask |
| 100 | if (RC_SUCCESS != fsi_read(attnTarget, 0x100d, &isr_mask)) |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 101 | { |
Ben Tyner | 5e622d8 | 2020-09-11 10:10:24 -0500 | [diff] [blame] | 102 | // event |
| 103 | eventAttentionFail(RC_CFAM_ERROR); |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 104 | |
Ben Tyner | 5e622d8 | 2020-09-11 10:10:24 -0500 | [diff] [blame] | 105 | // trace |
| 106 | trace<level::INFO>("Error! cfam read 0x100d FAILED"); |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 107 | } |
Ben Tyner | 5e622d8 | 2020-09-11 10:10:24 -0500 | [diff] [blame] | 108 | else |
| 109 | { |
| 110 | // CFAM 0x100d is expected to have bits set |
| 111 | // corresponding to attentions that can generate an |
Ben Tyner | 04cbbb3 | 2020-10-07 13:27:46 -0500 | [diff] [blame] | 112 | // attention interrupt. |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 113 | |
Ben Tyner | 5e622d8 | 2020-09-11 10:10:24 -0500 | [diff] [blame] | 114 | std::stringstream ss; // log message stream |
| 115 | ss << "cfam 0x100d = 0x"; |
| 116 | ss << std::hex << std::setw(8) << std::setfill('0'); |
| 117 | ss << isr_mask; |
| 118 | trace<level::INFO>(ss.str().c_str()); |
| 119 | |
| 120 | // bit 0 on "left": bit 30 = SBE vital attention |
Ben Tyner | 04cbbb3 | 2020-10-07 13:27:46 -0500 | [diff] [blame] | 121 | if (isr_val & isr_mask & 0x00000002) |
Ben Tyner | 5e622d8 | 2020-09-11 10:10:24 -0500 | [diff] [blame] | 122 | { |
| 123 | active_attentions.emplace_back(Attention::Vital, |
| 124 | handleVital, target, |
| 125 | i_config); |
| 126 | } |
| 127 | |
| 128 | // bit 0 on "left": bit 1 = checkstop |
Ben Tyner | 04cbbb3 | 2020-10-07 13:27:46 -0500 | [diff] [blame] | 129 | if (isr_val & isr_mask & 0x40000000) |
Ben Tyner | 5e622d8 | 2020-09-11 10:10:24 -0500 | [diff] [blame] | 130 | { |
| 131 | active_attentions.emplace_back(Attention::Checkstop, |
| 132 | handleCheckstop, |
| 133 | target, i_config); |
| 134 | } |
| 135 | |
| 136 | // bit 0 on "left": bit 2 = special attention |
Ben Tyner | 04cbbb3 | 2020-10-07 13:27:46 -0500 | [diff] [blame] | 137 | if (isr_val & isr_mask & 0x20000000) |
Ben Tyner | 5e622d8 | 2020-09-11 10:10:24 -0500 | [diff] [blame] | 138 | { |
| 139 | active_attentions.emplace_back(Attention::Special, |
| 140 | handleSpecial, |
| 141 | target, i_config); |
| 142 | } |
| 143 | } // cfam 0x100d valid |
| 144 | } // cfam 0x1007 valid |
| 145 | } // proc target enabled |
| 146 | } // fsi target enabled |
| 147 | } // next processor |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 148 | |
Ben Tyner | b481d90 | 2020-03-05 10:24:23 -0600 | [diff] [blame] | 149 | // convert to heap, highest priority is at front |
| 150 | if (!std::is_heap(active_attentions.begin(), active_attentions.end())) |
| 151 | { |
| 152 | std::make_heap(active_attentions.begin(), active_attentions.end()); |
| 153 | } |
| 154 | |
| 155 | // call the attention handler until one is handled or all were attempted |
| 156 | while (false == active_attentions.empty()) |
| 157 | { |
| 158 | // handle highest priority attention, done if successful |
| 159 | if (RC_SUCCESS == active_attentions.front().handle()) |
| 160 | { |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 161 | // an attention was handled so we are done |
Ben Tyner | b481d90 | 2020-03-05 10:24:23 -0600 | [diff] [blame] | 162 | break; |
| 163 | } |
| 164 | |
| 165 | // move attention to back of vector |
| 166 | std::pop_heap(active_attentions.begin(), active_attentions.end()); |
| 167 | |
| 168 | // remove attention from vector |
| 169 | active_attentions.pop_back(); |
| 170 | } |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | /** |
| 174 | * @brief Handle SBE vital attention |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 175 | * |
| 176 | * @param i_attention Attention object |
| 177 | * @return 0 indicates that the vital attention was successfully handled |
| 178 | * 1 indicates that the vital attention was NOT successfully handled |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 179 | */ |
Ben Tyner | b481d90 | 2020-03-05 10:24:23 -0600 | [diff] [blame] | 180 | int handleVital(Attention* i_attention) |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 181 | { |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 182 | int rc = RC_SUCCESS; // assume vital handled |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 183 | |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 184 | trace<level::INFO>("vital handler started"); |
| 185 | |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 186 | // if vital handling enabled, handle vital attention |
| 187 | if (false == (i_attention->getConfig()->getFlag(enVital))) |
| 188 | { |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 189 | trace<level::INFO>("vital handling disabled"); |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 190 | rc = RC_NOT_HANDLED; |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 191 | } |
| 192 | else |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 193 | { |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 194 | eventVital(); |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 195 | } |
| 196 | |
| 197 | return rc; |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * @brief Handle checkstop attention |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 202 | * |
| 203 | * @param i_attention Attention object |
| 204 | * @return 0 indicates that the checkstop attention was successfully handled |
| 205 | * 1 indicates that the checkstop attention was NOT successfully |
| 206 | * handled. |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 207 | */ |
Ben Tyner | b481d90 | 2020-03-05 10:24:23 -0600 | [diff] [blame] | 208 | int handleCheckstop(Attention* i_attention) |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 209 | { |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 210 | int rc = RC_SUCCESS; // assume checkstop handled |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 211 | |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 212 | trace<level::INFO>("checkstop handler started"); |
| 213 | |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 214 | // if checkstop handling enabled, handle checkstop attention |
| 215 | if (false == (i_attention->getConfig()->getFlag(enCheckstop))) |
| 216 | { |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 217 | trace<level::INFO>("Checkstop handling disabled"); |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 218 | } |
| 219 | else |
| 220 | { |
Zane Shelley | 9fb7393 | 2020-09-15 13:34:57 -0500 | [diff] [blame] | 221 | // Look for any attentions found in hardware. This will generate and |
| 222 | // comment a PEL if any errors are found. |
| 223 | if (true != analyzer::analyzeHardware()) |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 224 | { |
| 225 | rc = RC_ANALYZER_ERROR; |
| 226 | } |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 227 | } |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 228 | |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 229 | return rc; |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * @brief Handle special attention |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 234 | * |
| 235 | * @param i_attention Attention object |
| 236 | * @return 0 indicates that the special attention was successfully handled |
| 237 | * 1 indicates that the special attention was NOT successfully handled |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 238 | */ |
Ben Tyner | b481d90 | 2020-03-05 10:24:23 -0600 | [diff] [blame] | 239 | int handleSpecial(Attention* i_attention) |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 240 | { |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 241 | int rc = RC_SUCCESS; // assume special attention handled |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 242 | |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 243 | // The TI infor chipop will give us a pointer to the TI info data |
Ben Tyner | 98430b3 | 2020-08-19 19:14:02 -0500 | [diff] [blame] | 244 | uint8_t* tiInfo = nullptr; // ptr to TI info data |
| 245 | uint32_t tiInfoLen = 0; // length of TI info data |
| 246 | pdbg_target* attnProc = i_attention->getTarget(); // proc with attention |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 247 | |
Ben Tyner | 98430b3 | 2020-08-19 19:14:02 -0500 | [diff] [blame] | 248 | if (attnProc != nullptr) |
Ben Tyner | 89c0a7a | 2020-08-07 12:07:35 -0500 | [diff] [blame] | 249 | { |
Ben Tyner | 98430b3 | 2020-08-19 19:14:02 -0500 | [diff] [blame] | 250 | // The processor PIB target is required for get TI info chipop |
| 251 | char path[16]; |
| 252 | sprintf(path, "/proc%d/pib", pdbg_target_index(attnProc)); |
| 253 | pdbg_target* tiInfoTarget = pdbg_target_from_path(nullptr, path); |
| 254 | |
| 255 | if (nullptr != tiInfoTarget) |
Ben Tyner | 89c0a7a | 2020-08-07 12:07:35 -0500 | [diff] [blame] | 256 | { |
Ben Tyner | 98430b3 | 2020-08-19 19:14:02 -0500 | [diff] [blame] | 257 | if (PDBG_TARGET_ENABLED == pdbg_target_probe(tiInfoTarget)) |
| 258 | { |
| 259 | trace<level::INFO>("calling sbe_mpipl_get_ti_info"); |
| 260 | sbe_mpipl_get_ti_info(tiInfoTarget, &tiInfo, &tiInfoLen); |
| 261 | if (tiInfo == nullptr) |
| 262 | { |
| 263 | trace<level::INFO>("TI info data ptr is null after call"); |
| 264 | } |
| 265 | } |
Ben Tyner | 89c0a7a | 2020-08-07 12:07:35 -0500 | [diff] [blame] | 266 | } |
| 267 | } |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 268 | |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 269 | // If TI area exists and is marked valid we can assume TI occurred |
| 270 | if ((nullptr != tiInfo) && (0 != tiInfo[0])) |
Ben Tyner | 970fd4f | 2020-02-19 13:46:42 -0600 | [diff] [blame] | 271 | { |
Ben Tyner | 98430b3 | 2020-08-19 19:14:02 -0500 | [diff] [blame] | 272 | trace<level::INFO>("TI info data present and valid"); |
| 273 | |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 274 | TiDataArea* tiDataArea = (TiDataArea*)tiInfo; |
Ben Tyner | 7e6611f | 2020-02-13 16:42:56 -0600 | [diff] [blame] | 275 | |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 276 | // trace a few known TI data area values |
| 277 | std::stringstream ss; // log message stream |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 278 | |
| 279 | ss << "TI data command = " << (int)tiDataArea->command; |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 280 | trace<level::INFO>(ss.str().c_str()); |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 281 | ss.str(std::string()); |
| 282 | |
| 283 | ss << "TI data SRC format = " << (int)tiDataArea->srcFormat; |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 284 | trace<level::INFO>(ss.str().c_str()); |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 285 | ss.str(std::string()); |
| 286 | |
| 287 | ss << "TI data hb_terminate_type = " |
| 288 | << (int)tiDataArea->hbTerminateType; |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 289 | trace<level::INFO>(ss.str().c_str()); |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 290 | ss.str(std::string()); |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 291 | |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 292 | if (true == (i_attention->getConfig()->getFlag(enTerminate))) |
| 293 | { |
| 294 | trace<level::INFO>("TI (terminate immediately)"); |
| 295 | |
| 296 | // Call TI special attention handler |
| 297 | rc = tiHandler(tiDataArea); |
| 298 | } |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 299 | } |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 300 | // TI area not valid or not available |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 301 | else |
| 302 | { |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 303 | trace<level::INFO>("TI info NOT available"); |
Ben Tyner | 98430b3 | 2020-08-19 19:14:02 -0500 | [diff] [blame] | 304 | |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 305 | // if configured to handle breakpoint as default special attention |
| 306 | if (i_attention->getConfig()->getFlag(dfltBreakpoint)) |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 307 | { |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 308 | trace<level::INFO>("assuming breakpoint"); |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 309 | |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 310 | if (true == (i_attention->getConfig()->getFlag(enBreakpoints))) |
| 311 | { |
| 312 | trace<level::INFO>("breakpoint"); |
| 313 | |
| 314 | // Call the breakpoint special attention handler |
| 315 | bpHandler(); |
| 316 | } |
| 317 | } |
| 318 | // if configured to handle TI as default special attention |
| 319 | else |
| 320 | { |
| 321 | trace<level::INFO>("assuming TI"); |
| 322 | |
| 323 | if (true == (i_attention->getConfig()->getFlag(enTerminate))) |
| 324 | { |
| 325 | trace<level::INFO>("TI (terminate immediately)"); |
| 326 | |
| 327 | // Call TI special attention handler |
| 328 | rc = tiHandler(nullptr); |
| 329 | } |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 330 | } |
Ben Tyner | 970fd4f | 2020-02-19 13:46:42 -0600 | [diff] [blame] | 331 | } |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 332 | |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 333 | // release TI data buffer |
| 334 | if (nullptr != tiInfo) |
| 335 | { |
| 336 | free(tiInfo); |
| 337 | } |
| 338 | |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 339 | if (RC_SUCCESS != rc) |
| 340 | { |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 341 | trace<level::INFO>("Special attn not handled"); |
Ben Tyner | 3fb52e5 | 2020-03-31 10:10:07 -0500 | [diff] [blame] | 342 | } |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 343 | |
| 344 | return rc; |
| 345 | } |
| 346 | |
Ben Tyner | ef32015 | 2020-01-09 10:31:23 -0600 | [diff] [blame] | 347 | } // namespace attn |