blob: 3141130dfb043f989b084c2d08ace78479d9fbf6 [file] [log] [blame]
Ben Tynerb1ebfcb2020-05-08 18:52:48 -05001#include <unistd.h>
2
Ben Tyner135793a2021-10-27 09:18:41 -05003#include <analyzer/analyzer_main.hpp>
Ben Tyner5c5db652021-02-22 18:22:35 -06004#include <attn/attn_common.hpp>
Ben Tyner188f1092021-02-01 09:33:06 -06005#include <attn/attn_dbus.hpp>
Ben Tyner7029e522021-08-09 19:18:24 -05006#include <attn/attn_dump.hpp>
Ben Tynerb797b3e2020-06-29 10:12:05 -05007#include <attn/attn_logging.hpp>
Ben Tynerf5210bb2021-01-05 12:58:10 -06008#include <attn/pel/pel_minimal.hpp>
Ben Tynerb1ebfcb2020-05-08 18:52:48 -05009#include <phosphor-logging/log.hpp>
Ben Tyner13159682022-02-16 14:55:38 -060010#include <util/dbus.hpp>
Ben Tynerfaf33362022-02-16 14:04:51 -060011#include <util/ffdc.hpp>
austinfcuibfa831a2022-01-26 15:37:07 -060012#include <util/trace.hpp>
Ben Tynerf5210bb2021-01-05 12:58:10 -060013
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050014namespace attn
15{
16
Ben Tynerf5210bb2021-01-05 12:58:10 -060017/** @brief Tuple containing information about ffdc files */
18using FFDCTuple =
19 std::tuple<util::FFDCFormat, uint8_t, uint8_t, sdbusplus::message::unix_fd>;
20
Ben Tynerf5210bb2021-01-05 12:58:10 -060021/**
22 * Create FFDCTuple objects corresponding to the specified FFDC files.
23 *
24 * The D-Bus method to create an error log requires a vector of tuples to
25 * pass in the FFDC file information.
26 *
27 * @param files - FFDC files
28 * @return vector of FFDCTuple objects
29 */
30std::vector<FFDCTuple>
31 createFFDCTuples(const std::vector<util::FFDCFile>& files)
32{
33 std::vector<FFDCTuple> ffdcTuples{};
Zane Shelleya79f6c82021-01-12 16:38:49 -060034 util::transformFFDC(files, ffdcTuples);
Ben Tynerf5210bb2021-01-05 12:58:10 -060035
36 return ffdcTuples;
37}
38
39/**
40 * @brief Create an FFDCFile object containing raw data
41 *
42 * Throws an exception if an error occurs.
43 *
44 * @param i_buffer - raw data to add to ffdc faw data file
45 * @param i_size - size of the raw data
46 * @return FFDCFile object
47 */
48util::FFDCFile createFFDCRawFile(void* i_buffer, size_t i_size)
49{
50 util::FFDCFile file{util::FFDCFormat::Custom};
51
52 // Write buffer to file and then reset file description file offset
Ben Tynerd7006092021-02-05 14:55:52 -060053 int fd = file.getFileDescriptor();
54 size_t numBytes = write(fd, static_cast<char*>(i_buffer), i_size);
55 if (i_size != numBytes)
56 {
austinfcuibfa831a2022-01-26 15:37:07 -060057 trace::err("%s only %u of %u bytes written", file.getPath().c_str(),
58 numBytes, i_size);
Ben Tynerd7006092021-02-05 14:55:52 -060059 }
60
Ben Tynerf5210bb2021-01-05 12:58:10 -060061 lseek(fd, 0, SEEK_SET);
62
63 return file;
64}
65
66/**
Ben Tynerf5210bb2021-01-05 12:58:10 -060067 * Create FFDCFile objects containing debug data to store in the error log.
68 *
69 * If an error occurs, the error is written to the journal but an exception
70 * is not thrown.
71 *
72 * @param i_buffer - raw data (if creating raw dump ffdc entry in log)
73 * @return vector of FFDCFile objects
74 */
75std::vector<util::FFDCFile> createFFDCFiles(char* i_buffer = nullptr,
76 size_t i_size = 0)
77{
78 std::vector<util::FFDCFile> files{};
79
80 // Create raw dump file
81 if ((nullptr != i_buffer) && (0 != i_size))
82 {
83 files.emplace_back(createFFDCRawFile(i_buffer, i_size));
84 }
85
86 // Create trace dump file
Ben Tynerfaf33362022-02-16 14:04:51 -060087 util::createFFDCTraceFiles(files);
Ben Tynerf5210bb2021-01-05 12:58:10 -060088
89 return files;
90}
91
92/**
Ben Tynerf5210bb2021-01-05 12:58:10 -060093 * Create a PEL from an existing PEL
94 *
95 * Create a new PEL based on the specified raw PEL and submit the new PEL
96 * to the backend logging code as a raw PEL. Note that additional data map
97 * here contains data to be committed to the PEL and it can also be used to
98 * create the PEL as it contains needed information.
99 *
Ben Tyner135793a2021-10-27 09:18:41 -0500100 * @param i_rawPel - buffer containing a raw PEL
Ben Tynerf5210bb2021-01-05 12:58:10 -0600101 * @param i_additional - additional data to be added to the new PEL
102 */
103void createPelCustom(std::vector<uint8_t>& i_rawPel,
104 std::map<std::string, std::string> i_additional)
105{
106 // create PEL object from buffer
107 auto tiPel = std::make_unique<pel::PelMinimal>(i_rawPel);
108
109 // The additional data contains the TI info as well as the value for the
110 // subystem that provided the TI info. Get the subystem from additional
austinfcuic49d20b2022-02-22 16:36:47 -0600111 // data and then populate the primary SRC and SRC words for the custom PEL
112 // based on the subsystem's TI info.
113 std::map<std::string, std::string>::iterator it;
114 uint8_t subsystem;
115
116 it = i_additional.find("Subsystem");
117 if (it != i_additional.end())
118 {
119 subsystem = std::stoi(it->second);
120 tiPel->setSubsystem(subsystem);
121 }
122 else
123 {
124 // The entry with key "Subsystem" does not exist in the additional map.
125 // Log the error, create failure event, and return.
126 trace::err("Error the key %s does not exist in the map.", "Subsystem");
127 eventAttentionFail((int)AttnSection::attnLogging | ATTN_INVALID_KEY);
128 return;
129 }
Ben Tynerf5210bb2021-01-05 12:58:10 -0600130
Ben Tyner135793a2021-10-27 09:18:41 -0500131 // If recoverable attentions are active we will call the analyzer and
132 // then link the custom pel to analyzer pel.
Ben Tyner135793a2021-10-27 09:18:41 -0500133 it = i_additional.find("recoverables");
134 if (it != i_additional.end() && "true" == it->second)
135 {
136 DumpParameters dumpParameters;
Zane Shelleyebff0d32021-11-21 10:52:07 -0600137 auto plid = analyzer::analyzeHardware(
138 analyzer::AnalysisType::TERMINATE_IMMEDIATE, dumpParameters);
Zane Shelley611b3442021-11-19 16:02:01 -0600139 if (0 != plid)
Ben Tyner135793a2021-10-27 09:18:41 -0500140 {
Zane Shelley611b3442021-11-19 16:02:01 -0600141 // Link the PLID if an attention was found and a PEL was generated.
142 tiPel->setPlid(plid);
Ben Tyner135793a2021-10-27 09:18:41 -0500143 }
144 }
145
Ben Tynerf5210bb2021-01-05 12:58:10 -0600146 if (static_cast<uint8_t>(pel::SubsystemID::hypervisor) == subsystem)
147 {
148 // populate hypervisor SRC words
149 tiPel->setSrcWords(std::array<uint32_t, pel::numSrcWords>{
150 (uint32_t)std::stoul(i_additional["0x10 SRC Word 12"], 0, 16),
151 (uint32_t)std::stoul(i_additional["0x14 SRC Word 13"], 0, 16),
152 (uint32_t)std::stoul(i_additional["0x18 SRC Word 14"], 0, 16),
153 (uint32_t)std::stoul(i_additional["0x1c SRC Word 15"], 0, 16),
154 (uint32_t)std::stoul(i_additional["0x20 SRC Word 16"], 0, 16),
155 (uint32_t)std::stoul(i_additional["0x24 SRC Word 17"], 0, 16),
156 (uint32_t)std::stoul(i_additional["0x28 SRC Word 18"], 0, 16),
157 (uint32_t)std::stoul(i_additional["0x2c SRC Word 19"], 0, 16)});
158
Ben Tyner9d4f91c2021-02-09 08:27:58 -0600159 // Populate phyp primary SRC
160
161 // char array for raw pel src
Ben Tynerf5210bb2021-01-05 12:58:10 -0600162 std::array<char, pel::asciiStringSize> srcChars{'0'};
austinfcuic49d20b2022-02-22 16:36:47 -0600163 std::string srcString;
Ben Tyner9d4f91c2021-02-09 08:27:58 -0600164
165 // src from TI info
austinfcuic49d20b2022-02-22 16:36:47 -0600166 it = i_additional.find("SrcAscii");
167 if (it != i_additional.end())
168 {
169 srcString = it->second;
170 }
171 else
172 {
173 // The entry with key "Subsystem" does not exist in the additional
174 // map. Log the error, create failure event, and return.
175 trace::err("Error the key %s does not exist in the map.",
176 "SrcAscii");
177 eventAttentionFail((int)AttnSection::attnLogging |
178 ATTN_INVALID_KEY);
179 return;
180 }
Ben Tyner9d4f91c2021-02-09 08:27:58 -0600181
182 // copy from string to char array
Ben Tynerf5210bb2021-01-05 12:58:10 -0600183 srcString.copy(srcChars.data(),
184 std::min(srcString.size(), pel::asciiStringSize), 0);
Ben Tyner9d4f91c2021-02-09 08:27:58 -0600185
186 tiPel->setAsciiString(srcChars); // pel object src is char array
Ben Tynerfeeea832021-04-06 10:08:11 -0500187
188 // set symptom-id
austinfcuic49d20b2022-02-22 16:36:47 -0600189 auto symptomId = (srcString.substr(0, 8) + '_');
Ben Tynerfeeea832021-04-06 10:08:11 -0500190
191 symptomId += (i_additional["0x10 SRC Word 12"]);
192 symptomId += (i_additional["0x14 SRC Word 13"] + '_');
193 symptomId += (i_additional["0x18 SRC Word 14"]);
194 symptomId += (i_additional["0x1c SRC Word 15"] + '_');
195 symptomId += (i_additional["0x20 SRC Word 16"]);
196 symptomId += (i_additional["0x24 SRC Word 17"] + '_');
197 symptomId += (i_additional["0x28 SRC Word 18"]);
198 symptomId += (i_additional["0x2c SRC Word 19"]);
199
200 // setSymptomId will take care of required null-terminate and padding
201 tiPel->setSymptomId(symptomId);
Ben Tynerf5210bb2021-01-05 12:58:10 -0600202 }
203 else
204 {
205 // Populate hostboot SRC words - note HB word 0 from the shared info
206 // data (additional data "0x10 HB Word") is reflected in the PEL as
207 // "reason code" so we zero it here. Also note that the first word
208 // in this group of words starts at word 0 and word 1 does not exits.
209 tiPel->setSrcWords(std::array<uint32_t, pel::numSrcWords>{
210 (uint32_t)0x00000000,
211 (uint32_t)std::stoul(i_additional["0x14 HB Word 2"], 0, 16),
212 (uint32_t)std::stoul(i_additional["0x18 HB Word 3"], 0, 16),
213 (uint32_t)std::stoul(i_additional["0x1c HB Word 4"], 0, 16),
214 (uint32_t)std::stoul(i_additional["0x20 HB Word 5"], 0, 16),
215 (uint32_t)std::stoul(i_additional["0x24 HB Word 6"], 0, 16),
216 (uint32_t)std::stoul(i_additional["0x28 HB Word 7"], 0, 16),
217 (uint32_t)std::stoul(i_additional["0x2c HB Word 8"], 0, 16)});
218
Ben Tyner9d4f91c2021-02-09 08:27:58 -0600219 // Populate hostboot primary SRC
220
221 // char array for raw pel src
Ben Tynerf5210bb2021-01-05 12:58:10 -0600222 std::array<char, pel::asciiStringSize> srcChars{'0'};
austinfcuic49d20b2022-02-22 16:36:47 -0600223 std::string srcString;
Ben Tyner9d4f91c2021-02-09 08:27:58 -0600224
225 // src from TI info
austinfcuic49d20b2022-02-22 16:36:47 -0600226 it = i_additional.find("SrcAscii");
227 if (it != i_additional.end())
228 {
229 srcString = it->second;
230 }
231 else
232 {
233 // The entry with key "Subsystem" does not exist in the additional
234 // map. Log the error, create failure event, and return.
235 trace::err("Error the key %s does not exist in the map.",
236 "SrcAscii");
237 eventAttentionFail((int)AttnSection::attnLogging |
238 ATTN_INVALID_KEY);
239 return;
240 }
Ben Tyner9d4f91c2021-02-09 08:27:58 -0600241
242 // copy from string to char array
Ben Tynerf5210bb2021-01-05 12:58:10 -0600243 srcString.copy(srcChars.data(),
244 std::min(srcString.size(), pel::asciiStringSize), 0);
Ben Tyner9d4f91c2021-02-09 08:27:58 -0600245
246 tiPel->setAsciiString(srcChars); // pel object src is char array
Ben Tynerfeeea832021-04-06 10:08:11 -0500247
248 // set symptom-id
austinfcuic49d20b2022-02-22 16:36:47 -0600249 auto symptomId = (srcString.substr(0, 8) + '_');
Ben Tynerfeeea832021-04-06 10:08:11 -0500250
251 symptomId += (i_additional["0x10 HB Word 0"]); // note: word 1
252 symptomId += (i_additional["0x14 HB Word 2"] + '_'); // does not exist
253 symptomId += (i_additional["0x18 HB Word 3"]);
254 symptomId += (i_additional["0x1c HB Word 4"] + '_');
255 symptomId += (i_additional["0x20 HB Word 5"]);
256 symptomId += (i_additional["0x24 HB Word 6"] + '_');
257 symptomId += (i_additional["0x28 HB Word 7"]);
258 symptomId += (i_additional["0x2c HB Word 8"]);
259
260 // setSymptomId will take care of required null-terminate and padding
261 tiPel->setSymptomId(symptomId);
Ben Tynerf5210bb2021-01-05 12:58:10 -0600262 }
263
264 // set severity, event type and action flags
265 tiPel->setSeverity(static_cast<uint8_t>(pel::Severity::termination));
266 tiPel->setType(static_cast<uint8_t>(pel::EventType::na));
Ben Tynerac5bd052022-03-03 14:09:13 -0600267
268 auto actionFlags = pel::ActionFlags::service | pel::ActionFlags::report |
269 pel::ActionFlags::call;
270
271 it = i_additional.find("hidden");
272 if (it != i_additional.end() && "true" == it->second)
273 {
274 trace::inf("making HB TI PEL hidden");
275 actionFlags = actionFlags | pel::ActionFlags::hidden;
276 }
277
278 tiPel->setAction(static_cast<uint16_t>(actionFlags));
Ben Tynerf5210bb2021-01-05 12:58:10 -0600279
280 // The raw PEL that we used as the basis for this custom PEL contains the
281 // attention handler trace data and does not needed to be in this PEL so
282 // we remove it here.
283 tiPel->setSectionCount(tiPel->getSectionCount() - 1);
284
285 // Update the raw PEL with the new custom PEL data
286 tiPel->raw(i_rawPel);
287
288 // create PEL from raw data
289 createPelRaw(i_rawPel);
290}
291
292/**
293 * Log an event handled by the attention handler
294 *
295 * Basic (non TI) events will generate a standard message-registry based PEL
296 *
297 * TI events will create two PEL's. One PEL will be informational and will
298 * contain trace information relevent to attention handler. The second PEL
299 * will be specific to the TI type (including the primary SRC) and will be
300 * based off of the TI information provided to the attention handler through
301 * shared TI info data area.
302 *
303 * @param i_event - The event type
304 * @param i_additional - Additional PEL data
305 * @param i_ffdc - FFDC PEL data
Ben Tyner7f6ce6a2021-08-17 19:40:00 -0500306 * @return Event log Id (0 if no event log generated)
Ben Tynerf5210bb2021-01-05 12:58:10 -0600307 */
Ben Tyner7f6ce6a2021-08-17 19:40:00 -0500308uint32_t event(EventType i_event,
309 std::map<std::string, std::string>& i_additional,
310 const std::vector<util::FFDCFile>& i_ffdc)
Ben Tynerb1ebfcb2020-05-08 18:52:48 -0500311{
Ben Tyner7f6ce6a2021-08-17 19:40:00 -0500312 uint32_t pelId = 0; // assume no event log generated
313
Ben Tynerb1ebfcb2020-05-08 18:52:48 -0500314 bool eventValid = false; // assume no event created
Ben Tynerf5210bb2021-01-05 12:58:10 -0600315 bool tiEvent = false; // assume not a terminate event
Ben Tynerb1ebfcb2020-05-08 18:52:48 -0500316
317 std::string eventName;
318
319 switch (i_event)
320 {
321 case EventType::Checkstop:
322 eventName = "org.open_power.HwDiags.Error.Checkstop";
323 eventValid = true;
324 break;
325 case EventType::Terminate:
326 eventName = "org.open_power.Attn.Error.Terminate";
327 eventValid = true;
Ben Tynerf5210bb2021-01-05 12:58:10 -0600328 tiEvent = true;
Ben Tynerb1ebfcb2020-05-08 18:52:48 -0500329 break;
330 case EventType::Vital:
331 eventName = "org.open_power.Attn.Error.Vital";
332 eventValid = true;
333 break;
334 case EventType::HwDiagsFail:
Ben Tynerb1ebfcb2020-05-08 18:52:48 -0500335 case EventType::AttentionFail:
336 eventName = "org.open_power.Attn.Error.Fail";
337 eventValid = true;
338 break;
339 default:
340 eventValid = false;
341 break;
342 }
343
344 if (true == eventValid)
345 {
Ben Tynerf5210bb2021-01-05 12:58:10 -0600346 // Create PEL with additional data and FFDC data. The newly created
347 // PEL's platform log-id will be returned.
Ben Tyner13159682022-02-16 14:55:38 -0600348 pelId = util::dbus::createPel(eventName, levelPelError, i_additional,
349 createFFDCTuples(i_ffdc));
Ben Tynerb1ebfcb2020-05-08 18:52:48 -0500350
Ben Tynerf5210bb2021-01-05 12:58:10 -0600351 // If this is a TI event we will create an additional PEL that is
352 // specific to the subsystem that generated the TI.
Ben Tyner135793a2021-10-27 09:18:41 -0500353 if ((0 != pelId) && (true == tiEvent))
Ben Tynerf5210bb2021-01-05 12:58:10 -0600354 {
355 // get file descriptor and size of information PEL
Ben Tyner188f1092021-02-01 09:33:06 -0600356 int pelFd = getPel(pelId);
Ben Tyner1b1915e2020-10-23 15:13:38 -0500357
Ben Tynerf5210bb2021-01-05 12:58:10 -0600358 // if PEL found, read into buffer
359 if (-1 != pelFd)
360 {
361 auto pelSize = lseek(pelFd, 0, SEEK_END);
362 lseek(pelFd, 0, SEEK_SET);
Ben Tyner1b1915e2020-10-23 15:13:38 -0500363
Ben Tynerf5210bb2021-01-05 12:58:10 -0600364 // read information PEL into buffer
365 std::vector<uint8_t> buffer(pelSize);
Ben Tynerd7006092021-02-05 14:55:52 -0600366 size_t numBytes = read(pelFd, buffer.data(), buffer.size());
367 if (buffer.size() != numBytes)
368 {
austinfcuibfa831a2022-01-26 15:37:07 -0600369 trace::err("Error reading event log: %u of %u bytes read",
370 numBytes, buffer.size());
Ben Tynerd7006092021-02-05 14:55:52 -0600371 }
372 else
373 {
374 // create PEL from buffer
375 createPelCustom(buffer, i_additional);
376 }
Ben Tynerb1ebfcb2020-05-08 18:52:48 -0500377
Ben Tynerd7006092021-02-05 14:55:52 -0600378 close(pelFd);
Ben Tynerf5210bb2021-01-05 12:58:10 -0600379 }
Ben Tyner5c5db652021-02-22 18:22:35 -0600380
austinfcuic49d20b2022-02-22 16:36:47 -0600381 std::map<std::string, std::string>::iterator it;
382 uint8_t subsystem;
383
384 it = i_additional.find("Subsystem");
385 if (it != i_additional.end())
386 {
387 subsystem = std::stoi(it->second);
388 }
389 else
390 {
391 // The entry with key "Subsystem" does not exist in the
392 // additional map. Log the error, create failure event, and
393 // return.
394 trace::err("Error the key %s does not exist in the map.",
395 "Subsystem");
396 eventAttentionFail((int)AttnSection::attnLogging |
397 ATTN_INVALID_KEY);
398 return 0;
399 }
Ben Tyner5c5db652021-02-22 18:22:35 -0600400
Ben Tyner6bc43c92021-05-27 15:08:02 -0500401 // If not hypervisor TI
402 if (static_cast<uint8_t>(pel::SubsystemID::hypervisor) != subsystem)
Ben Tyner5c5db652021-02-22 18:22:35 -0600403 {
Ben Tyner6bc43c92021-05-27 15:08:02 -0500404 // Request a dump and transition the host
405 if ("true" == i_additional["Dump"])
406 {
407 // will not return until dump is complete
Zane Shelley611b3442021-11-19 16:02:01 -0600408 requestDump(pelId, DumpParameters{0, DumpType::Hostboot});
Ben Tyner6bc43c92021-05-27 15:08:02 -0500409 }
Ben Tyner5c5db652021-02-22 18:22:35 -0600410 }
411 }
Ben Tynerb1ebfcb2020-05-08 18:52:48 -0500412 }
Ben Tyner7f6ce6a2021-08-17 19:40:00 -0500413 return pelId;
Ben Tynerb1ebfcb2020-05-08 18:52:48 -0500414}
415
Ben Tynerf5210bb2021-01-05 12:58:10 -0600416/**
417 * Commit special attention TI event to log
418 *
419 * Create a event log with provided additional information and standard
420 * FFDC data plus TI FFDC data
421 *
422 * @param i_additional - Additional log data
423 * @param i_ti_InfoData - TI FFDC data
424 */
425void eventTerminate(std::map<std::string, std::string> i_additionalData,
426 char* i_tiInfoData)
Ben Tynerb1ebfcb2020-05-08 18:52:48 -0500427{
Ben Tynerb6401ed2021-01-11 09:08:07 -0600428
Ben Tyner29651ef2021-02-08 10:51:03 -0600429 uint32_t tiInfoSize = 0; // assume TI info was not available
Ben Tynerb6401ed2021-01-11 09:08:07 -0600430
Ben Tyner29651ef2021-02-08 10:51:03 -0600431 if (nullptr != i_tiInfoData)
Ben Tynerb6401ed2021-01-11 09:08:07 -0600432 {
Ben Tyner29651ef2021-02-08 10:51:03 -0600433 tiInfoSize = 56; // assume not hypervisor TI
Ben Tynerb6401ed2021-01-11 09:08:07 -0600434
austinfcuic49d20b2022-02-22 16:36:47 -0600435 std::map<std::string, std::string>::iterator it;
436 uint8_t subsystem;
437
438 it = i_additionalData.find("Subsystem");
439 if (it != i_additionalData.end())
440 {
441 subsystem = std::stoi(it->second);
442 }
443 else
444 {
445 // The entry with key "Subsystem" does not exist in the additional
446 // map. Log the error, create failure event, and return.
447 trace::err("Error the key %s does not exist in the map.",
448 "Subsystem");
449 eventAttentionFail((int)AttnSection::attnLogging |
450 ATTN_INVALID_KEY);
451 return;
452 }
Ben Tyner29651ef2021-02-08 10:51:03 -0600453
454 // If hypervisor
455 if (static_cast<uint8_t>(pel::SubsystemID::hypervisor) == subsystem)
Ben Tynerb6401ed2021-01-11 09:08:07 -0600456 {
Ben Tyner29651ef2021-02-08 10:51:03 -0600457 tiInfoSize = 1024; // assume hypervisor max
Ben Tynerb6401ed2021-01-11 09:08:07 -0600458
Ben Tyner29651ef2021-02-08 10:51:03 -0600459 // hypervisor may just want some of the data
460 if (0 == (*(i_tiInfoData + 0x09) & 0x01))
461 {
462 uint32_t* additionalLength = (uint32_t*)(i_tiInfoData + 0x50);
463 uint32_t tiAdditional = be32toh(*additionalLength);
464 tiInfoSize = std::min(tiInfoSize, (84 + tiAdditional));
465 }
Ben Tynerb6401ed2021-01-11 09:08:07 -0600466 }
467 }
468
austinfcuibfa831a2022-01-26 15:37:07 -0600469 trace::inf("TI info size = %u", tiInfoSize);
Ben Tynerb6401ed2021-01-11 09:08:07 -0600470
Ben Tynerf5210bb2021-01-05 12:58:10 -0600471 event(EventType::Terminate, i_additionalData,
Ben Tynerb6401ed2021-01-11 09:08:07 -0600472 createFFDCFiles(i_tiInfoData, tiInfoSize));
Ben Tynerb1ebfcb2020-05-08 18:52:48 -0500473}
474
Ben Tyner7f6ce6a2021-08-17 19:40:00 -0500475/** @brief Commit SBE vital event to log, returns event log ID */
476uint32_t eventVital()
Ben Tynerb1ebfcb2020-05-08 18:52:48 -0500477{
Ben Tynerf5210bb2021-01-05 12:58:10 -0600478 // Additional data for log
Ben Tynerb1ebfcb2020-05-08 18:52:48 -0500479 std::map<std::string, std::string> additionalData;
480
Ben Tynerf5210bb2021-01-05 12:58:10 -0600481 // Create log event with additional data and FFDC data
Ben Tyner7f6ce6a2021-08-17 19:40:00 -0500482 return event(EventType::Vital, additionalData, createFFDCFiles(nullptr, 0));
Ben Tynerb1ebfcb2020-05-08 18:52:48 -0500483}
484
Ben Tynerf5210bb2021-01-05 12:58:10 -0600485/**
Ben Tynerf5210bb2021-01-05 12:58:10 -0600486 * Commit attention handler failure event to log
487 *
488 * Create an event log containing the specified error code.
489 *
490 * @param i_error - Error code
491 */
492void eventAttentionFail(int i_error)
493{
494 // Additional data for log
495 std::map<std::string, std::string> additionalData;
496 additionalData["ERROR_CODE"] = std::to_string(i_error);
497
498 // Create log event with additional data and FFDC data
499 event(EventType::AttentionFail, additionalData,
500 createFFDCFiles(nullptr, 0));
501}
502
Ben Tynerb1ebfcb2020-05-08 18:52:48 -0500503} // namespace attn