Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 1 | #include <attn/attn_common.hpp> |
Ben Tyner | b797b3e | 2020-06-29 10:12:05 -0500 | [diff] [blame] | 2 | #include <attn/attn_handler.hpp> |
| 3 | #include <attn/attn_logging.hpp> |
Ben Tyner | f5210bb | 2021-01-05 12:58:10 -0600 | [diff] [blame] | 4 | #include <attn/pel/pel_common.hpp> |
Ben Tyner | b797b3e | 2020-06-29 10:12:05 -0500 | [diff] [blame] | 5 | #include <attn/ti_handler.hpp> |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 6 | #include <sdbusplus/bus.hpp> |
Ben Tyner | ff17f96 | 2020-09-23 08:21:19 -0500 | [diff] [blame] | 7 | #include <sdbusplus/exception.hpp> |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 8 | |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 9 | #include <iomanip> |
| 10 | #include <iostream> |
| 11 | |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 12 | namespace attn |
| 13 | { |
| 14 | |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 15 | /** |
| 16 | * @brief Determine if this is a HB or PHYP TI event |
| 17 | * |
| 18 | * Use the TI info data area to determine if this is either a HB or a PHYP |
| 19 | * TI event then handle the event. |
| 20 | * |
Ben Tyner | f5210bb | 2021-01-05 12:58:10 -0600 | [diff] [blame] | 21 | * @param i_tiDataArea pointer to the TI info data |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 22 | */ |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 23 | int tiHandler(TiDataArea* i_tiDataArea) |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 24 | { |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 25 | int rc = RC_SUCCESS; |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 26 | |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 27 | // check TI data area if it is available |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 28 | if (nullptr != i_tiDataArea) |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 29 | { |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 30 | // HB v. PHYP TI logic: Only hosboot will fill in hbTerminateType |
| 31 | // and it will be non-zero. Only hostboot will fill out source and it |
| 32 | // it will be non-zero. Only PHYP will fill in srcFormat and it will |
| 33 | // be non-zero. |
| 34 | // source and only PHYP will fill in srcFormat. |
| 35 | if ((0 == i_tiDataArea->hbTerminateType) && |
| 36 | (0 == i_tiDataArea->source) && (0 != i_tiDataArea->srcFormat)) |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 37 | { |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 38 | handlePhypTi(i_tiDataArea); |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 39 | } |
| 40 | else |
| 41 | { |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 42 | handleHbTi(i_tiDataArea); |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 43 | } |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 44 | } |
| 45 | else |
| 46 | { |
| 47 | // TI data was not available, assume PHYP TI for now. When a host state |
| 48 | // management interface becomes availabe we may be able to make a more |
| 49 | // informed decision here. |
| 50 | handlePhypTi(i_tiDataArea); |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 51 | } |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 52 | |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 53 | return rc; |
| 54 | } |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 55 | |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 56 | /** |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 57 | * @brief Handle a PHYP terminate immediate special attention |
| 58 | * |
| 59 | * The TI info data area will contain information pertaining to the TI |
| 60 | * condition. We will wither quiesce the host or initiate a MPIPL depending |
| 61 | * depending on the auto reboot configuration. We will also create a PEL which |
| 62 | * will contain the TI info data and FFDC data captured in the system journal. |
| 63 | * |
| 64 | * @param i_tiDataArea pointer to TI information filled in by hostboot |
| 65 | */ |
| 66 | void handlePhypTi(TiDataArea* i_tiDataArea) |
| 67 | { |
| 68 | trace<level::INFO>("PHYP TI"); |
| 69 | |
| 70 | if (autoRebootEnabled()) |
| 71 | { |
| 72 | // If autoreboot is enabled we will start diagnostic mode target |
| 73 | // which will ultimately mpipl the host. |
Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 74 | transitionHost(HostState::Diagnostic); |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 75 | } |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 76 | else |
| 77 | { |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 78 | // If autoreboot is disabled we will quiesce the host |
Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 79 | transitionHost(HostState::Quiesce); |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 80 | } |
Ben Tyner | 792f32f | 2020-06-02 08:50:47 -0500 | [diff] [blame] | 81 | |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 82 | // gather additional data for PEL |
| 83 | std::map<std::string, std::string> tiAdditionalData; |
Ben Tyner | e4f5dbe | 2020-10-19 07:19:33 -0500 | [diff] [blame] | 84 | |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 85 | if (nullptr != i_tiDataArea) |
| 86 | { |
| 87 | parsePhypOpalTiInfo(tiAdditionalData, i_tiDataArea); |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 88 | } |
| 89 | |
Ben Tyner | f5210bb | 2021-01-05 12:58:10 -0600 | [diff] [blame] | 90 | tiAdditionalData["Subsystem"] = |
| 91 | std::to_string(static_cast<uint8_t>(pel::SubsystemID::hypervisor)); |
| 92 | |
| 93 | char srcChar[8]; |
| 94 | memcpy(srcChar, &(i_tiDataArea->asciiData0), 4); |
| 95 | memcpy(&srcChar[4], &(i_tiDataArea->asciiData1), 4); |
| 96 | tiAdditionalData["SrcAscii"] = std::string{srcChar}; |
| 97 | |
| 98 | eventTerminate(tiAdditionalData, (char*)i_tiDataArea); |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | /** |
| 102 | * @brief Handle a hostboot terminate immediate special attention |
| 103 | * |
| 104 | * The TI info data area will contain information pertaining to the TI |
| 105 | * condition. The course of action to take regarding the host state will |
| 106 | * depend on the contents of the TI info data area. We will also create a |
| 107 | * PEL containing the TI info data and FFDC data captured in the system |
| 108 | * journal. |
| 109 | * |
| 110 | * @param i_tiDataArea pointer to TI information filled in by hostboot |
| 111 | */ |
| 112 | void handleHbTi(TiDataArea* i_tiDataArea) |
| 113 | { |
| 114 | trace<level::INFO>("HB TI"); |
| 115 | |
| 116 | bool hbDumpRequested = true; // HB dump is common case |
| 117 | bool generatePel = true; // assume PEL will be created |
| 118 | bool terminateHost = true; // transition host state |
| 119 | |
| 120 | // handle specific hostboot reason codes |
| 121 | if (nullptr != i_tiDataArea) |
| 122 | { |
| 123 | std::stringstream ss; |
| 124 | ss << std::hex << std::showbase; |
| 125 | |
| 126 | switch (i_tiDataArea->hbTerminateType) |
| 127 | { |
| 128 | case TI_WITH_PLID: |
| 129 | case TI_WITH_EID: |
| 130 | ss << "TI with PLID/EID: " << be32toh(i_tiDataArea->asciiData1); |
| 131 | trace<level::INFO>(ss.str().c_str()); |
| 132 | if (0 == i_tiDataArea->hbDumpFlag) |
| 133 | { |
| 134 | hbDumpRequested = false; // no HB dump requested |
| 135 | } |
| 136 | break; |
| 137 | case TI_WITH_SRC: |
| 138 | // SRC is byte 2 and 3 of 4 byte srcWord12HbWord0 |
| 139 | uint16_t hbSrc = be32toh(i_tiDataArea->srcWord12HbWord0); |
| 140 | |
| 141 | // trace some info |
| 142 | ss << "TI with SRC: " << (int)hbSrc; |
| 143 | trace<level::INFO>(ss.str().c_str()); |
| 144 | ss.str(std::string()); // clear stream |
| 145 | |
| 146 | switch (hbSrc) |
| 147 | { |
| 148 | case HB_SRC_SHUTDOWN_REQUEST: |
| 149 | trace<level::INFO>("shutdown request"); |
| 150 | generatePel = false; |
| 151 | break; |
| 152 | case HB_SRC_KEY_TRANSITION: |
| 153 | trace<level::INFO>("key transition"); |
| 154 | terminateHost = false; |
| 155 | break; |
| 156 | case HB_SRC_INSUFFICIENT_HW: |
| 157 | trace<level::INFO>("insufficient hardware"); |
| 158 | break; |
| 159 | case HB_SRC_TPM_FAIL: |
| 160 | trace<level::INFO>("TPM fail"); |
| 161 | break; |
| 162 | case HB_SRC_ROM_VERIFY: |
| 163 | trace<level::INFO>("ROM verify"); |
| 164 | break; |
| 165 | case HB_SRC_EXT_MISMATCH: |
| 166 | trace<level::INFO>("EXT mismatch"); |
| 167 | break; |
| 168 | case HB_SRC_ECC_UE: |
| 169 | trace<level::INFO>("ECC UE"); |
| 170 | break; |
| 171 | case HB_SRC_UNSUPPORTED_MODE: |
| 172 | trace<level::INFO>("unsupported mode"); |
| 173 | break; |
| 174 | case HB_SRC_UNSUPPORTED_SFCRANGE: |
| 175 | trace<level::INFO>("unsupported SFC range"); |
| 176 | break; |
| 177 | case HB_SRC_PARTITION_TABLE: |
| 178 | trace<level::INFO>("partition table invalid"); |
| 179 | break; |
| 180 | case HB_SRC_UNSUPPORTED_HARDWARE: |
| 181 | trace<level::INFO>("unsupported hardware"); |
| 182 | break; |
| 183 | case HB_SRC_PNOR_CORRUPTION: |
| 184 | trace<level::INFO>("PNOR corruption"); |
| 185 | break; |
| 186 | default: |
| 187 | trace<level::INFO>("reason: other"); |
| 188 | } |
| 189 | |
| 190 | break; |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | if (true == terminateHost) |
| 195 | { |
| 196 | // if hostboot dump is requested initiate dump |
| 197 | if (hbDumpRequested) |
| 198 | { |
| 199 | // Until HB dump support available just quiesce the host - once |
| 200 | // dump support is available the dump component will transition |
| 201 | // (ipl/halt) the host. |
Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 202 | transitionHost(HostState::Quiesce); |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 203 | } |
| 204 | else |
| 205 | { |
| 206 | // Quiese the host - when the host is quiesced it will either |
| 207 | // "halt" or IPL depending on autoreboot setting. |
Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 208 | transitionHost(HostState::Quiesce); |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 209 | } |
| 210 | } |
| 211 | |
| 212 | // gather additional data for PEL |
| 213 | std::map<std::string, std::string> tiAdditionalData; |
| 214 | |
| 215 | if (nullptr != i_tiDataArea) |
| 216 | { |
| 217 | parseHbTiInfo(tiAdditionalData, i_tiDataArea); |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | if (true == generatePel) |
| 221 | { |
Ben Tyner | f5210bb | 2021-01-05 12:58:10 -0600 | [diff] [blame] | 222 | tiAdditionalData["Subsystem"] = |
| 223 | std::to_string(static_cast<uint8_t>(pel::SubsystemID::hostboot)); |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 224 | |
Ben Tyner | f5210bb | 2021-01-05 12:58:10 -0600 | [diff] [blame] | 225 | char srcChar[8]; |
| 226 | memcpy(srcChar, &(i_tiDataArea->srcWord12HbWord0), 4); |
| 227 | memcpy(&srcChar[4], &(i_tiDataArea->asciiData1), 4); |
| 228 | tiAdditionalData["SrcAscii"] = std::string{srcChar}; |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 229 | |
Ben Tyner | f5210bb | 2021-01-05 12:58:10 -0600 | [diff] [blame] | 230 | eventTerminate(tiAdditionalData, (char*)i_tiDataArea); |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 231 | } |
| 232 | } |
| 233 | |
| 234 | /** @brief Parse the TI info data area into map as PHYP/OPAL data */ |
| 235 | void parsePhypOpalTiInfo(std::map<std::string, std::string>& i_map, |
| 236 | TiDataArea* i_tiDataArea) |
| 237 | { |
Ben Tyner | 1c4b02e | 2020-11-09 14:00:29 -0600 | [diff] [blame] | 238 | if (nullptr == i_tiDataArea) |
| 239 | { |
| 240 | return; |
| 241 | } |
| 242 | |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 243 | std::stringstream ss; |
| 244 | |
| 245 | ss << std::hex << std::showbase; |
| 246 | ss << "0x00 TI Area Valid:" << (int)i_tiDataArea->tiAreaValid << ":"; |
| 247 | ss << "0x01 Command:" << (int)i_tiDataArea->command << ":"; |
| 248 | ss << "0x02 Num. Data Bytes:" << be16toh(i_tiDataArea->numDataBytes) << ":"; |
| 249 | ss << "0x04 Reserved:" << (int)i_tiDataArea->reserved1 << ":"; |
| 250 | ss << "0x06 HWDump Type:" << be16toh(i_tiDataArea->hardwareDumpType) << ":"; |
| 251 | ss << "0x08 SRC Format:" << (int)i_tiDataArea->srcFormat << ":"; |
| 252 | ss << "0x09 SRC Flags:" << (int)i_tiDataArea->srcFlags << ":"; |
| 253 | ss << "0x0a Num. ASCII Words:" << (int)i_tiDataArea->numAsciiWords << ":"; |
| 254 | ss << "0x0b Num. Hex Words:" << (int)i_tiDataArea->numHexWords << ":"; |
| 255 | ss << "0x0e Length of SRC:" << be16toh(i_tiDataArea->lenSrc) << ":"; |
| 256 | ss << "0x10 SRC Word 12:" << be32toh(i_tiDataArea->srcWord12HbWord0) << ":"; |
| 257 | ss << "0x14 SRC Word 13:" << be32toh(i_tiDataArea->srcWord13HbWord2) << ":"; |
| 258 | ss << "0x18 SRC Word 14:" << be32toh(i_tiDataArea->srcWord14HbWord3) << ":"; |
| 259 | ss << "0x1c SRC Word 15:" << be32toh(i_tiDataArea->srcWord15HbWord4) << ":"; |
| 260 | ss << "0x20 SRC Word 16:" << be32toh(i_tiDataArea->srcWord16HbWord5) << ":"; |
| 261 | ss << "0x24 SRC Word 17:" << be32toh(i_tiDataArea->srcWord17HbWord6) << ":"; |
| 262 | ss << "0x28 SRC Word 18:" << be32toh(i_tiDataArea->srcWord18HbWord7) << ":"; |
| 263 | ss << "0x2c SRC Word 19:" << be32toh(i_tiDataArea->srcWord19HbWord8) << ":"; |
| 264 | ss << "0x30 ASCII Data:" << be32toh(i_tiDataArea->asciiData0) << ":"; |
| 265 | ss << "0x34 ASCII Data:" << be32toh(i_tiDataArea->asciiData1) << ":"; |
| 266 | ss << "0x38 ASCII Data:" << be32toh(i_tiDataArea->asciiData2) << ":"; |
| 267 | ss << "0x3c ASCII Data:" << be32toh(i_tiDataArea->asciiData3) << ":"; |
| 268 | ss << "0x40 ASCII Data:" << be32toh(i_tiDataArea->asciiData4) << ":"; |
| 269 | ss << "0x44 ASCII Data:" << be32toh(i_tiDataArea->asciiData5) << ":"; |
| 270 | ss << "0x48 ASCII Data:" << be32toh(i_tiDataArea->asciiData6) << ":"; |
| 271 | ss << "0x4c ASCII Data:" << be32toh(i_tiDataArea->asciiData7) << ":"; |
| 272 | ss << "0x50 Location:" << (int)i_tiDataArea->location << ":"; |
| 273 | ss << "0x51 Code Sections:" << (int)i_tiDataArea->codeSection << ":"; |
| 274 | ss << "0x52 Additional Size:" << (int)i_tiDataArea->additionalSize << ":"; |
| 275 | ss << "0x53 Additional Data:" << (int)i_tiDataArea->andData; |
| 276 | |
| 277 | std::string key, value; |
| 278 | char delim = ':'; |
| 279 | |
| 280 | while (std::getline(ss, key, delim)) |
| 281 | { |
| 282 | std::getline(ss, value, delim); |
| 283 | i_map[key] = value; |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | /** @brief Parse the TI info data area into map as hostboot data */ |
| 288 | void parseHbTiInfo(std::map<std::string, std::string>& i_map, |
| 289 | TiDataArea* i_tiDataArea) |
| 290 | { |
Ben Tyner | 1c4b02e | 2020-11-09 14:00:29 -0600 | [diff] [blame] | 291 | if (nullptr == i_tiDataArea) |
| 292 | { |
| 293 | return; |
| 294 | } |
| 295 | |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 296 | std::stringstream ss; |
| 297 | |
| 298 | ss << std::hex << std::showbase; |
| 299 | ss << "0x00 TI Area Valid:" << (int)i_tiDataArea->tiAreaValid << ":"; |
| 300 | ss << "0x04 Reserved:" << (int)i_tiDataArea->reserved1 << ":"; |
| 301 | ss << "0x05 HB_Term. Type:" << (int)i_tiDataArea->hbTerminateType << ":"; |
| 302 | ss << "0x0c HB Dump Flag:" << (int)i_tiDataArea->hbDumpFlag << ":"; |
| 303 | ss << "0x0d Source:" << (int)i_tiDataArea->source << ":"; |
| 304 | ss << "0x10 HB Word 0:" << be32toh(i_tiDataArea->srcWord12HbWord0) << ":"; |
| 305 | ss << "0x14 HB Word 2:" << be32toh(i_tiDataArea->srcWord13HbWord2) << ":"; |
| 306 | ss << "0x18 HB Word 3:" << be32toh(i_tiDataArea->srcWord14HbWord3) << ":"; |
| 307 | ss << "0x1c HB Word 4:" << be32toh(i_tiDataArea->srcWord15HbWord4) << ":"; |
| 308 | ss << "0x20 HB Word 5:" << be32toh(i_tiDataArea->srcWord16HbWord5) << ":"; |
| 309 | ss << "0x24 HB Word 6:" << be32toh(i_tiDataArea->srcWord17HbWord6) << ":"; |
| 310 | ss << "0x28 HB Word 7:" << be32toh(i_tiDataArea->srcWord18HbWord7) << ":"; |
| 311 | ss << "0x2c HB Word 8:" << be32toh(i_tiDataArea->srcWord19HbWord8) << ":"; |
| 312 | ss << "0x30 error_data:" << be32toh(i_tiDataArea->asciiData0) << ":"; |
| 313 | ss << "0x34 EID:" << be32toh(i_tiDataArea->asciiData1); |
| 314 | |
| 315 | std::string key, value; |
| 316 | char delim = ':'; |
| 317 | |
| 318 | while (std::getline(ss, key, delim)) |
| 319 | { |
| 320 | std::getline(ss, value, delim); |
| 321 | i_map[key] = value; |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | /** @brief Read state of autoreboot propertyi via dbus */ |
Ben Tyner | ff17f96 | 2020-09-23 08:21:19 -0500 | [diff] [blame] | 326 | bool autoRebootEnabled() |
| 327 | { |
| 328 | // Use dbus get-property interface to read the autoreboot property |
| 329 | auto bus = sdbusplus::bus::new_system(); |
| 330 | auto method = |
| 331 | bus.new_method_call("xyz.openbmc_project.Settings", |
| 332 | "/xyz/openbmc_project/control/host0/auto_reboot", |
| 333 | "org.freedesktop.DBus.Properties", "Get"); |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 334 | |
Ben Tyner | ff17f96 | 2020-09-23 08:21:19 -0500 | [diff] [blame] | 335 | method.append("xyz.openbmc_project.Control.Boot.RebootPolicy", |
| 336 | "AutoReboot"); |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 337 | |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 338 | bool autoReboot = false; // assume autoreboot attribute not available |
| 339 | |
Ben Tyner | ff17f96 | 2020-09-23 08:21:19 -0500 | [diff] [blame] | 340 | try |
| 341 | { |
| 342 | auto reply = bus.call(method); |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 343 | |
Ben Tyner | ff17f96 | 2020-09-23 08:21:19 -0500 | [diff] [blame] | 344 | std::variant<bool> result; |
| 345 | reply.read(result); |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 346 | autoReboot = std::get<bool>(result); |
Ben Tyner | ff17f96 | 2020-09-23 08:21:19 -0500 | [diff] [blame] | 347 | } |
| 348 | catch (const sdbusplus::exception::SdBusError& ec) |
| 349 | { |
Ben Tyner | ff17f96 | 2020-09-23 08:21:19 -0500 | [diff] [blame] | 350 | std::string traceMessage = |
| 351 | "Error in AutoReboot Get: " + std::string(ec.what()); |
| 352 | trace<level::INFO>(traceMessage.c_str()); |
Ben Tyner | ff17f96 | 2020-09-23 08:21:19 -0500 | [diff] [blame] | 353 | } |
Ben Tyner | 8c5e4f4 | 2020-10-28 11:11:55 -0500 | [diff] [blame] | 354 | |
| 355 | return autoReboot; |
Ben Tyner | ff17f96 | 2020-09-23 08:21:19 -0500 | [diff] [blame] | 356 | } |
Ben Tyner | 4071772 | 2020-09-23 09:43:20 -0500 | [diff] [blame] | 357 | |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 358 | } // namespace attn |