1 #pragma once 2 3 #include <sdbusplus/bus.hpp> 4 #include <util/ffdc_file.hpp> 5 6 #include <string> 7 8 namespace attn 9 { 10 11 enum class HostRunningState 12 { 13 Unknown, 14 NotStarted, 15 Started 16 }; 17 18 /** 19 * Create a dbus method 20 * 21 * Find the dbus service associated with the dbus object path and create 22 * a dbus method for calling the specified dbus interface and function. 23 * 24 * @param i_path - dbus object path 25 * @param i_interface - dbus method interface 26 * @param i_function - dbus interface function 27 * @param o_method - method that is created 28 * @param i_extended - optional for extended methods 29 * @return non-zero if error 30 * 31 **/ 32 int dbusMethod(const std::string& i_path, const std::string& i_interface, 33 const std::string& i_function, 34 sdbusplus::message::message& o_method, 35 const std::string& i_extended = ""); 36 37 /** 38 * Create a PEL for the specified event type 39 * 40 * The additional data provided in the map will be placed in a user data 41 * section of the PEL and may additionally contain key words to trigger 42 * certain behaviors by the backend logging code. Each set of data described 43 * in the vector of ffdc data will be placed in additional user data 44 * sections. 45 * 46 * @param i_event - the event type 47 * @param i_additional - map of additional data 48 * @param i_ffdc - vector of ffdc data 49 * @return Platform log id or 0 if error 50 */ 51 uint32_t createPel(const std::string& i_event, 52 std::map<std::string, std::string>& i_additional, 53 const std::vector<util::FFDCTuple>& i_ffdc); 54 55 /** 56 * Create a PEL from raw PEL data 57 * 58 * Create a PEL based on the pel defined in the data buffer specified. 59 * 60 * @param i_buffer - buffer containing a raw PEL 61 */ 62 void createPelRaw(const std::vector<uint8_t>& i_buffer); 63 64 /** 65 * Get file descriptor of exisitng PEL 66 * 67 * The backend logging code will search for a PEL having the provided pel id 68 * and return a file descriptor of a file containing this pel in raw form. 69 * 70 * @param i_pelid - the PEL ID 71 * @return file descriptor or -1 if error 72 */ 73 int getPel(const uint32_t i_pelId); 74 75 /** 76 * Get the host running state 77 * 78 * Use host boot progress to determine if a host has been started. If host 79 * boot progress can not be determined then host state will be unknown. 80 * 81 * @return HostType == "Unknown", "Started or "NotStarted" 82 */ 83 HostRunningState hostRunningState(); 84 85 } // namespace attn 86