Brandon Wyman | 24e422f | 2017-07-25 19:40:14 -0500 | [diff] [blame] | 1 | /** |
| 2 | * Copyright © 2017 IBM Corporation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Brandon Wyman | 442035f | 2017-08-08 15:58:45 -0500 | [diff] [blame] | 16 | #include <phosphor-logging/log.hpp> |
| 17 | #include <phosphor-logging/elog.hpp> |
| 18 | #include <xyz/openbmc_project/Sensor/Device/error.hpp> |
| 19 | #include <xyz/openbmc_project/Control/Device/error.hpp> |
| 20 | #include <xyz/openbmc_project/Power/Fault/error.hpp> |
| 21 | #include "elog-errors.hpp" |
Brandon Wyman | 1029554 | 2017-08-09 18:20:44 -0500 | [diff] [blame] | 22 | #include "names_values.hpp" |
Brandon Wyman | 24e422f | 2017-07-25 19:40:14 -0500 | [diff] [blame] | 23 | #include "power_supply.hpp" |
Brandon Wyman | 442035f | 2017-08-08 15:58:45 -0500 | [diff] [blame] | 24 | #include "pmbus.hpp" |
| 25 | #include "utility.hpp" |
| 26 | |
| 27 | using namespace phosphor::logging; |
| 28 | using namespace sdbusplus::xyz::openbmc_project::Control::Device::Error; |
| 29 | using namespace sdbusplus::xyz::openbmc_project::Sensor::Device::Error; |
| 30 | using namespace sdbusplus::xyz::openbmc_project::Power::Fault::Error; |
Brandon Wyman | 24e422f | 2017-07-25 19:40:14 -0500 | [diff] [blame] | 31 | |
Brandon Wyman | 1db9a9e | 2017-07-26 18:50:22 -0500 | [diff] [blame] | 32 | namespace witherspoon |
Brandon Wyman | 24e422f | 2017-07-25 19:40:14 -0500 | [diff] [blame] | 33 | { |
| 34 | namespace power |
| 35 | { |
| 36 | namespace psu |
| 37 | { |
| 38 | |
Brandon Wyman | 1029554 | 2017-08-09 18:20:44 -0500 | [diff] [blame] | 39 | constexpr auto INVENTORY_OBJ_PATH = "/xyz/openbmc_project/inventory"; |
| 40 | constexpr auto INVENTORY_INTERFACE = "xyz.openbmc_project.Inventory.Item"; |
| 41 | constexpr auto PRESENT_PROP = "Present"; |
Brandon Wyman | 431fbe4 | 2017-08-18 16:22:09 -0500 | [diff] [blame] | 42 | constexpr auto POWER_OBJ_PATH = "/org/openbmc/control/power0"; |
| 43 | constexpr auto POWER_INTERFACE = "org.openbmc.control.Power"; |
Brandon Wyman | 1029554 | 2017-08-09 18:20:44 -0500 | [diff] [blame] | 44 | |
| 45 | PowerSupply::PowerSupply(const std::string& name, size_t inst, |
Brandon Wyman | 431fbe4 | 2017-08-18 16:22:09 -0500 | [diff] [blame] | 46 | const std::string& objpath, |
| 47 | const std::string& invpath, |
| 48 | sdbusplus::bus::bus& bus, |
| 49 | event::Event& e, |
| 50 | std::chrono::seconds& t) |
| 51 | : Device(name, inst), monitorPath(objpath), pmbusIntf(objpath), |
| 52 | inventoryPath(invpath), bus(bus), event(e), powerOnInterval(t), |
| 53 | powerOnTimer(e, [this]() |
| 54 | { |
| 55 | this->powerOn = true; |
| 56 | }) |
Brandon Wyman | 1029554 | 2017-08-09 18:20:44 -0500 | [diff] [blame] | 57 | { |
Brandon Wyman | 1029554 | 2017-08-09 18:20:44 -0500 | [diff] [blame] | 58 | using namespace sdbusplus::bus; |
| 59 | auto present_obj_path = INVENTORY_OBJ_PATH + inventoryPath; |
| 60 | presentMatch = std::make_unique<match_t>(bus, |
| 61 | match::rules::propertiesChanged( |
| 62 | present_obj_path, |
| 63 | INVENTORY_INTERFACE), |
| 64 | [this](auto& msg) |
Brandon Wyman | 431fbe4 | 2017-08-18 16:22:09 -0500 | [diff] [blame] | 65 | { |
| 66 | this->inventoryChanged(msg); |
| 67 | }); |
| 68 | // Get initial presence state. |
Brandon Wyman | 253dc9b | 2017-08-12 13:45:52 -0500 | [diff] [blame] | 69 | updatePresence(); |
Brandon Wyman | 431fbe4 | 2017-08-18 16:22:09 -0500 | [diff] [blame] | 70 | |
| 71 | // Subscribe to power state changes |
| 72 | powerOnMatch = std::make_unique<match_t>(bus, |
| 73 | match::rules::propertiesChanged( |
| 74 | POWER_OBJ_PATH, |
| 75 | POWER_INTERFACE), |
| 76 | [this](auto& msg) |
| 77 | { |
| 78 | this->powerStateChanged(msg); |
| 79 | }); |
| 80 | // Get initial power state. |
| 81 | updatePowerState(); |
Brandon Wyman | 1029554 | 2017-08-09 18:20:44 -0500 | [diff] [blame] | 82 | } |
Brandon Wyman | 442035f | 2017-08-08 15:58:45 -0500 | [diff] [blame] | 83 | |
Brandon Wyman | 431fbe4 | 2017-08-18 16:22:09 -0500 | [diff] [blame] | 84 | |
Brandon Wyman | 1db9a9e | 2017-07-26 18:50:22 -0500 | [diff] [blame] | 85 | void PowerSupply::analyze() |
| 86 | { |
Brandon Wyman | 442035f | 2017-08-08 15:58:45 -0500 | [diff] [blame] | 87 | using namespace witherspoon::pmbus; |
| 88 | |
| 89 | try |
| 90 | { |
Brandon Wyman | 1029554 | 2017-08-09 18:20:44 -0500 | [diff] [blame] | 91 | if (present) |
Brandon Wyman | 442035f | 2017-08-08 15:58:45 -0500 | [diff] [blame] | 92 | { |
Brandon Wyman | 764c797 | 2017-08-22 17:05:36 -0500 | [diff] [blame] | 93 | std::uint16_t statusWord = 0; |
Brandon Wyman | 764c797 | 2017-08-22 17:05:36 -0500 | [diff] [blame] | 94 | |
| 95 | // Read the 2 byte STATUS_WORD value to check for faults. |
| 96 | statusWord = pmbusIntf.read(STATUS_WORD, Type::Debug); |
| 97 | |
Brandon Wyman | 1029554 | 2017-08-09 18:20:44 -0500 | [diff] [blame] | 98 | //TODO: 3 consecutive reads should be performed. |
| 99 | // If 3 consecutive reads are seen, log the fault. |
| 100 | // Driver gives cached value, read once a second. |
| 101 | // increment for fault on, decrement for fault off, to deglitch. |
| 102 | // If count reaches 3, we have fault. If count reaches 0, fault is |
| 103 | // cleared. |
| 104 | |
Brandon Wyman | 603cc00 | 2017-08-28 18:17:58 -0500 | [diff] [blame] | 105 | checkInputFault(statusWord); |
Brandon Wyman | 764c797 | 2017-08-22 17:05:36 -0500 | [diff] [blame] | 106 | |
| 107 | if (powerOn) |
| 108 | { |
Brandon Wyman | 603cc00 | 2017-08-28 18:17:58 -0500 | [diff] [blame] | 109 | checkPGOrUnitOffFault(statusWord); |
| 110 | checkCurrentOutOverCurrentFault(statusWord); |
Brandon Wyman | ab05c07 | 2017-08-30 18:26:41 -0500 | [diff] [blame] | 111 | checkOutputOvervoltageFault(statusWord); |
Brandon Wyman | 12661f1 | 2017-08-31 15:28:21 -0500 | [diff] [blame^] | 112 | checkFanFault(statusWord); |
Brandon Wyman | 442035f | 2017-08-08 15:58:45 -0500 | [diff] [blame] | 113 | } |
| 114 | } |
| 115 | } |
| 116 | catch (ReadFailure& e) |
| 117 | { |
| 118 | if (!readFailLogged) |
| 119 | { |
| 120 | commit<ReadFailure>(); |
| 121 | readFailLogged = true; |
Brandon Wyman | 442035f | 2017-08-08 15:58:45 -0500 | [diff] [blame] | 122 | } |
| 123 | } |
| 124 | |
Brandon Wyman | 1db9a9e | 2017-07-26 18:50:22 -0500 | [diff] [blame] | 125 | return; |
| 126 | } |
| 127 | |
Brandon Wyman | 1029554 | 2017-08-09 18:20:44 -0500 | [diff] [blame] | 128 | void PowerSupply::inventoryChanged(sdbusplus::message::message& msg) |
| 129 | { |
| 130 | std::string msgSensor; |
| 131 | std::map<std::string, sdbusplus::message::variant<uint32_t, bool>> msgData; |
| 132 | msg.read(msgSensor, msgData); |
| 133 | |
| 134 | // Check if it was the Present property that changed. |
| 135 | auto valPropMap = msgData.find(PRESENT_PROP); |
| 136 | if (valPropMap != msgData.end()) |
| 137 | { |
| 138 | present = sdbusplus::message::variant_ns::get<bool>(valPropMap->second); |
| 139 | |
| 140 | if (present) |
| 141 | { |
| 142 | readFailLogged = false; |
| 143 | vinUVFault = false; |
Brandon Wyman | 253dc9b | 2017-08-12 13:45:52 -0500 | [diff] [blame] | 144 | inputFault = false; |
Brandon Wyman | b165c25 | 2017-08-25 18:59:54 -0500 | [diff] [blame] | 145 | outputOCFault = false; |
Brandon Wyman | ab05c07 | 2017-08-30 18:26:41 -0500 | [diff] [blame] | 146 | outputOVFault = false; |
Brandon Wyman | 12661f1 | 2017-08-31 15:28:21 -0500 | [diff] [blame^] | 147 | fanFault = false; |
Brandon Wyman | 1029554 | 2017-08-09 18:20:44 -0500 | [diff] [blame] | 148 | } |
| 149 | } |
| 150 | |
| 151 | return; |
| 152 | } |
| 153 | |
| 154 | void PowerSupply::updatePresence() |
| 155 | { |
| 156 | // Use getProperty utility function to get presence status. |
| 157 | std::string path = INVENTORY_OBJ_PATH + inventoryPath; |
| 158 | std::string service = "xyz.openbmc_project.Inventory.Manager"; |
Brandon Wyman | 8731a30 | 2017-08-16 16:15:34 -0500 | [diff] [blame] | 159 | |
| 160 | try |
| 161 | { |
| 162 | util::getProperty(INVENTORY_INTERFACE, PRESENT_PROP, path, |
| 163 | service, bus, this->present); |
| 164 | } |
| 165 | catch (std::exception& e) |
| 166 | { |
| 167 | // If we happen to be trying to update presence just as it is being |
| 168 | // updated, we may encounter a runtime_error. Just catch that for |
| 169 | // now, let the inventoryChanged signal handler update presence later. |
| 170 | present = false; |
| 171 | } |
| 172 | |
Brandon Wyman | 1029554 | 2017-08-09 18:20:44 -0500 | [diff] [blame] | 173 | } |
| 174 | |
Brandon Wyman | 431fbe4 | 2017-08-18 16:22:09 -0500 | [diff] [blame] | 175 | void PowerSupply::powerStateChanged(sdbusplus::message::message& msg) |
| 176 | { |
| 177 | int32_t state = 0; |
| 178 | std::string msgSensor; |
| 179 | std::map<std::string, sdbusplus::message::variant<int32_t, int32_t>> |
| 180 | msgData; |
| 181 | msg.read(msgSensor, msgData); |
| 182 | |
| 183 | // Check if it was the Present property that changed. |
| 184 | auto valPropMap = msgData.find("state"); |
| 185 | if (valPropMap != msgData.end()) |
| 186 | { |
| 187 | state = sdbusplus::message::variant_ns::get<int32_t>(valPropMap->second); |
| 188 | |
| 189 | // Power is on when state=1. Set the fault logged variables to false |
| 190 | // and start the power on timer when the state changes to 1. |
| 191 | if (state) |
| 192 | { |
| 193 | readFailLogged = false; |
| 194 | vinUVFault = false; |
| 195 | inputFault = false; |
Brandon Wyman | 764c797 | 2017-08-22 17:05:36 -0500 | [diff] [blame] | 196 | powerOnFault = false; |
Brandon Wyman | b165c25 | 2017-08-25 18:59:54 -0500 | [diff] [blame] | 197 | outputOCFault = false; |
Brandon Wyman | ab05c07 | 2017-08-30 18:26:41 -0500 | [diff] [blame] | 198 | outputOVFault = false; |
Brandon Wyman | 12661f1 | 2017-08-31 15:28:21 -0500 | [diff] [blame^] | 199 | fanFault = false; |
Brandon Wyman | 431fbe4 | 2017-08-18 16:22:09 -0500 | [diff] [blame] | 200 | powerOnTimer.start(powerOnInterval, Timer::TimerType::oneshot); |
| 201 | } |
| 202 | else |
| 203 | { |
| 204 | powerOnTimer.stop(); |
| 205 | powerOn = false; |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | } |
| 210 | |
| 211 | void PowerSupply::updatePowerState() |
| 212 | { |
| 213 | // When state = 1, system is powered on |
| 214 | int32_t state = 0; |
| 215 | |
| 216 | try |
| 217 | { |
| 218 | auto service = util::getService(POWER_OBJ_PATH, |
| 219 | POWER_INTERFACE, |
| 220 | bus); |
| 221 | |
| 222 | // Use getProperty utility function to get power state. |
| 223 | util::getProperty<int32_t>(POWER_INTERFACE, |
| 224 | "state", |
| 225 | POWER_OBJ_PATH, |
| 226 | service, |
| 227 | bus, |
| 228 | state); |
| 229 | |
| 230 | if (state) |
| 231 | { |
| 232 | powerOn = true; |
| 233 | } |
| 234 | else |
| 235 | { |
| 236 | powerOn = false; |
| 237 | } |
| 238 | } |
| 239 | catch (std::exception& e) |
| 240 | { |
| 241 | log<level::INFO>("Failed to get power state. Assuming it is off."); |
| 242 | powerOn = false; |
| 243 | } |
| 244 | |
| 245 | } |
| 246 | |
Brandon Wyman | 603cc00 | 2017-08-28 18:17:58 -0500 | [diff] [blame] | 247 | void PowerSupply::checkInputFault(const uint16_t statusWord) |
| 248 | { |
| 249 | using namespace witherspoon::pmbus; |
| 250 | |
| 251 | std::uint8_t statusInput = 0; |
| 252 | |
| 253 | if ((statusWord & status_word::VIN_UV_FAULT) && !vinUVFault) |
| 254 | { |
| 255 | vinUVFault = true; |
| 256 | |
| 257 | util::NamesValues nv; |
| 258 | nv.add("STATUS_WORD", statusWord); |
| 259 | |
| 260 | using metadata = xyz::openbmc_project::Power::Fault:: |
| 261 | PowerSupplyUnderVoltageFault; |
| 262 | |
| 263 | report<PowerSupplyUnderVoltageFault>(metadata::RAW_STATUS( |
| 264 | nv.get().c_str())); |
| 265 | } |
| 266 | else |
| 267 | { |
| 268 | if (vinUVFault) |
| 269 | { |
| 270 | vinUVFault = false; |
| 271 | log<level::INFO>("VIN_UV_FAULT cleared", |
| 272 | entry("POWERSUPPLY=%s", |
| 273 | inventoryPath.c_str())); |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | if ((statusWord & status_word::INPUT_FAULT_WARN) && !inputFault) |
| 278 | { |
| 279 | inputFault = true; |
| 280 | |
| 281 | statusInput = pmbusIntf.read(STATUS_INPUT, Type::Debug); |
| 282 | |
| 283 | util::NamesValues nv; |
| 284 | nv.add("STATUS_WORD", statusWord); |
| 285 | nv.add("STATUS_INPUT", statusInput); |
| 286 | |
| 287 | using metadata = xyz::openbmc_project::Power::Fault:: |
| 288 | PowerSupplyInputFault; |
| 289 | |
| 290 | report<PowerSupplyInputFault>( |
| 291 | metadata::RAW_STATUS(nv.get().c_str())); |
| 292 | } |
| 293 | else |
| 294 | { |
| 295 | if ((inputFault) && |
| 296 | !(statusWord & status_word::INPUT_FAULT_WARN)) |
| 297 | { |
| 298 | inputFault = false; |
| 299 | statusInput = pmbusIntf.read(STATUS_INPUT, Type::Debug); |
| 300 | |
| 301 | log<level::INFO>("INPUT_FAULT_WARN cleared", |
| 302 | entry("POWERSUPPLY=%s", inventoryPath.c_str()), |
| 303 | entry("STATUS_WORD=0x%04X", statusWord), |
| 304 | entry("STATUS_INPUT=0x%02X", statusInput)); |
| 305 | } |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | void PowerSupply::checkPGOrUnitOffFault(const uint16_t statusWord) |
| 310 | { |
| 311 | using namespace witherspoon::pmbus; |
| 312 | |
| 313 | std::uint8_t statusInput = 0; |
| 314 | std::uint8_t statusVout = 0; |
| 315 | std::uint8_t statusIout = 0; |
| 316 | std::uint8_t statusMFR = 0; |
| 317 | |
| 318 | // Check PG# and UNIT_IS_OFF |
| 319 | if (((statusWord & status_word::POWER_GOOD_NEGATED) || |
| 320 | (statusWord & status_word::UNIT_IS_OFF)) && |
| 321 | !powerOnFault) |
| 322 | { |
| 323 | statusInput = pmbusIntf.read(STATUS_INPUT, Type::Debug); |
| 324 | auto status0Vout = pmbusIntf.insertPageNum(STATUS_VOUT, 0); |
| 325 | statusVout = pmbusIntf.read(status0Vout, Type::Debug); |
| 326 | statusIout = pmbusIntf.read(STATUS_IOUT, Type::Debug); |
| 327 | statusMFR = pmbusIntf.read(STATUS_MFR, Type::Debug); |
| 328 | |
| 329 | util::NamesValues nv; |
| 330 | nv.add("STATUS_WORD", statusWord); |
| 331 | nv.add("STATUS_INPUT", statusInput); |
| 332 | nv.add("STATUS_VOUT", statusVout); |
| 333 | nv.add("STATUS_IOUT", statusIout); |
| 334 | nv.add("MFR_SPECIFIC", statusMFR); |
| 335 | |
| 336 | using metadata = xyz::openbmc_project::Power::Fault:: |
| 337 | PowerSupplyShouldBeOn; |
| 338 | |
| 339 | // A power supply is OFF (or pgood low) but should be on. |
| 340 | report<PowerSupplyShouldBeOn>(metadata::RAW_STATUS(nv.get().c_str()), |
| 341 | metadata::CALLOUT_INVENTORY_PATH( |
| 342 | inventoryPath.c_str())); |
| 343 | |
| 344 | powerOnFault = true; |
| 345 | } |
| 346 | |
| 347 | } |
| 348 | |
| 349 | void PowerSupply::checkCurrentOutOverCurrentFault(const uint16_t statusWord) |
| 350 | { |
| 351 | using namespace witherspoon::pmbus; |
| 352 | |
| 353 | std::uint8_t statusInput = 0; |
| 354 | std::uint8_t statusVout = 0; |
| 355 | std::uint8_t statusIout = 0; |
| 356 | std::uint8_t statusMFR = 0; |
| 357 | |
| 358 | // Check for an output overcurrent fault. |
| 359 | if ((statusWord & status_word::IOUT_OC_FAULT) && |
| 360 | !outputOCFault) |
| 361 | { |
| 362 | statusInput = pmbusIntf.read(STATUS_INPUT, Type::Debug); |
| 363 | auto status0Vout = pmbusIntf.insertPageNum(STATUS_VOUT, 0); |
| 364 | statusVout = pmbusIntf.read(status0Vout, Type::Debug); |
| 365 | statusIout = pmbusIntf.read(STATUS_IOUT, Type::Debug); |
| 366 | statusMFR = pmbusIntf.read(STATUS_MFR, Type::Debug); |
| 367 | |
| 368 | util::NamesValues nv; |
| 369 | nv.add("STATUS_WORD", statusWord); |
| 370 | nv.add("STATUS_INPUT", statusInput); |
| 371 | nv.add("STATUS_VOUT", statusVout); |
| 372 | nv.add("STATUS_IOUT", statusIout); |
| 373 | nv.add("MFR_SPECIFIC", statusMFR); |
| 374 | |
| 375 | using metadata = xyz::openbmc_project::Power::Fault:: |
| 376 | PowerSupplyOutputOvercurrent; |
| 377 | |
| 378 | report<PowerSupplyOutputOvercurrent>(metadata::RAW_STATUS( |
| 379 | nv.get().c_str()), |
| 380 | metadata::CALLOUT_INVENTORY_PATH( |
| 381 | inventoryPath.c_str())); |
| 382 | |
| 383 | outputOCFault = true; |
| 384 | } |
| 385 | } |
| 386 | |
Brandon Wyman | ab05c07 | 2017-08-30 18:26:41 -0500 | [diff] [blame] | 387 | void PowerSupply::checkOutputOvervoltageFault(const uint16_t statusWord) |
| 388 | { |
| 389 | using namespace witherspoon::pmbus; |
| 390 | |
| 391 | std::uint8_t statusInput = 0; |
| 392 | std::uint8_t statusVout = 0; |
| 393 | std::uint8_t statusIout = 0; |
| 394 | std::uint8_t statusMFR = 0; |
| 395 | |
| 396 | // Check for an output overvoltage fault. |
| 397 | if ((statusWord & status_word::VOUT_OV_FAULT) && |
| 398 | !outputOVFault) |
| 399 | { |
| 400 | statusInput = pmbusIntf.read(STATUS_INPUT, Type::Debug); |
| 401 | statusVout = pmbusIntf.read(STATUS_VOUT, Type::Debug); |
| 402 | statusIout = pmbusIntf.read(STATUS_IOUT, Type::Debug); |
| 403 | statusMFR = pmbusIntf.read(STATUS_MFR, Type::Debug); |
| 404 | |
| 405 | util::NamesValues nv; |
| 406 | nv.add("STATUS_WORD", statusWord); |
| 407 | nv.add("STATUS_INPUT", statusInput); |
| 408 | nv.add("STATUS_VOUT", statusVout); |
| 409 | nv.add("STATUS_IOUT", statusIout); |
| 410 | nv.add("MFR_SPECIFIC", statusMFR); |
| 411 | |
| 412 | using metadata = xyz::openbmc_project::Power::Fault:: |
| 413 | PowerSupplyOutputOvervoltage; |
| 414 | |
| 415 | report<PowerSupplyOutputOvervoltage>(metadata::RAW_STATUS( |
| 416 | nv.get().c_str()), |
| 417 | metadata::CALLOUT_INVENTORY_PATH( |
| 418 | inventoryPath.c_str())); |
| 419 | |
| 420 | outputOVFault = true; |
| 421 | } |
| 422 | } |
| 423 | |
Brandon Wyman | 12661f1 | 2017-08-31 15:28:21 -0500 | [diff] [blame^] | 424 | void PowerSupply::checkFanFault(const uint16_t statusWord) |
| 425 | { |
| 426 | using namespace witherspoon::pmbus; |
| 427 | |
| 428 | std::uint8_t statusMFR = 0; |
| 429 | std::uint8_t statusTemperature = 0; |
| 430 | std::uint8_t statusFans12 = 0; |
| 431 | |
| 432 | // Check for an output overcurrent fault. |
| 433 | if ((statusWord & status_word::FAN_FAULT) && |
| 434 | !fanFault) |
| 435 | { |
| 436 | statusMFR = pmbusIntf.read(STATUS_MFR, Type::Debug); |
| 437 | statusTemperature = pmbusIntf.read(STATUS_TEMPERATURE, Type::Debug); |
| 438 | statusFans12 = pmbusIntf.read(STATUS_FANS_1_2, Type::Debug); |
| 439 | |
| 440 | util::NamesValues nv; |
| 441 | nv.add("STATUS_WORD", statusWord); |
| 442 | nv.add("MFR_SPECIFIC", statusMFR); |
| 443 | nv.add("STATUS_TEMPERATURE", statusTemperature); |
| 444 | nv.add("STATUS_FANS_1_2", statusFans12); |
| 445 | |
| 446 | using metadata = xyz::openbmc_project::Power::Fault:: |
| 447 | PowerSupplyFanFault; |
| 448 | |
| 449 | report<PowerSupplyFanFault>( |
| 450 | metadata::RAW_STATUS(nv.get().c_str()), |
| 451 | metadata::CALLOUT_INVENTORY_PATH(inventoryPath.c_str())); |
| 452 | |
| 453 | fanFault = true; |
| 454 | } |
| 455 | } |
| 456 | |
Brandon Wyman | 1db9a9e | 2017-07-26 18:50:22 -0500 | [diff] [blame] | 457 | void PowerSupply::clearFaults() |
| 458 | { |
Brandon Wyman | 1029554 | 2017-08-09 18:20:44 -0500 | [diff] [blame] | 459 | //TODO - Clear faults at pre-poweron. openbmc/openbmc#1736 |
Brandon Wyman | 1db9a9e | 2017-07-26 18:50:22 -0500 | [diff] [blame] | 460 | return; |
| 461 | } |
| 462 | |
Brandon Wyman | 24e422f | 2017-07-25 19:40:14 -0500 | [diff] [blame] | 463 | } |
| 464 | } |
| 465 | } |