Vishwanatha Subbanna | 307d80b | 2017-06-28 15:56:09 +0530 | [diff] [blame] | 1 | #include "occ_status.hpp" |
Gunnar Mills | 94df8c9 | 2018-09-14 14:50:03 -0500 | [diff] [blame] | 2 | |
Chris Cain | 1725767 | 2021-10-22 13:41:03 -0500 | [diff] [blame] | 3 | #include "occ_manager.hpp" |
Vishwanatha Subbanna | 6add0b8 | 2017-07-21 19:02:37 +0530 | [diff] [blame] | 4 | #include "occ_sensor.hpp" |
Chris Cain | 78e8601 | 2021-03-04 16:15:31 -0600 | [diff] [blame] | 5 | #include "powermode.hpp" |
Vishwanatha Subbanna | 30e329a | 2017-07-24 23:13:14 +0530 | [diff] [blame] | 6 | #include "utils.hpp" |
Gunnar Mills | 94df8c9 | 2018-09-14 14:50:03 -0500 | [diff] [blame] | 7 | |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 8 | #include <phosphor-logging/lg2.hpp> |
Chris Cain | 78e8601 | 2021-03-04 16:15:31 -0600 | [diff] [blame] | 9 | |
Chris Cain | e2d0a43 | 2022-03-28 11:08:49 -0500 | [diff] [blame] | 10 | #include <filesystem> |
| 11 | |
Vishwanatha Subbanna | 307d80b | 2017-06-28 15:56:09 +0530 | [diff] [blame] | 12 | namespace open_power |
| 13 | { |
| 14 | namespace occ |
| 15 | { |
Chris Cain | 78e8601 | 2021-03-04 16:15:31 -0600 | [diff] [blame] | 16 | |
Chris Cain | a8857c5 | 2021-01-27 11:53:05 -0600 | [diff] [blame] | 17 | using namespace phosphor::logging; |
Vishwanatha Subbanna | 307d80b | 2017-06-28 15:56:09 +0530 | [diff] [blame] | 18 | |
Chris Cain | c86d80f | 2023-05-04 15:49:18 -0500 | [diff] [blame] | 19 | using ThrottleObj = |
| 20 | sdbusplus::xyz::openbmc_project::Control::Power::server::Throttle; |
| 21 | |
Vishwanatha Subbanna | 307d80b | 2017-06-28 15:56:09 +0530 | [diff] [blame] | 22 | // Handles updates to occActive property |
| 23 | bool Status::occActive(bool value) |
| 24 | { |
Vishwanatha Subbanna | 32e84e9 | 2017-06-28 19:17:28 +0530 | [diff] [blame] | 25 | if (value != this->occActive()) |
| 26 | { |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 27 | lg2::info("Status::occActive OCC{INST} changed to {STATE}", "INST", |
| 28 | instance, "STATE", value); |
Vishwanatha Subbanna | 32e84e9 | 2017-06-28 19:17:28 +0530 | [diff] [blame] | 29 | if (value) |
| 30 | { |
Chris Cain | f788150 | 2025-04-16 14:48:30 -0500 | [diff] [blame^] | 31 | // OCC is active |
Chris Cain | c86d80f | 2023-05-04 15:49:18 -0500 | [diff] [blame] | 32 | // Clear prior throttle reason (before setting device active) |
| 33 | updateThrottle(false, THROTTLED_ALL); |
| 34 | |
Eddie James | aced309 | 2022-04-22 16:19:30 -0500 | [diff] [blame] | 35 | // Set the device active |
| 36 | device.setActive(true); |
Vishwanatha Subbanna | ee4d83d | 2017-06-29 18:35:00 +0530 | [diff] [blame] | 37 | |
Chris Cain | a8857c5 | 2021-01-27 11:53:05 -0600 | [diff] [blame] | 38 | // Reset last OCC state |
| 39 | lastState = 0; |
| 40 | |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 41 | // Start watching for errors (throttles, etc) |
| 42 | try |
| 43 | { |
| 44 | addErrorWatch(); |
| 45 | } |
| 46 | catch (const OpenFailure& e) |
| 47 | { |
| 48 | // Failed to add watch for throttle events, request reset to try |
| 49 | // to recover comm |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 50 | lg2::error( |
| 51 | "Status::occActive: Unable to add error watch(s) for OCC{INST} watch: {ERROR}", |
| 52 | "INST", instance, "ERROR", e.what()); |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 53 | deviceError(Error::Descriptor(OCC_COMM_ERROR_PATH)); |
| 54 | return Base::Status::occActive(false); |
| 55 | } |
| 56 | |
| 57 | // Update the OCC active sensor |
| 58 | Base::Status::occActive(value); |
| 59 | |
Chris Cain | 5d66a0a | 2022-02-09 08:52:10 -0600 | [diff] [blame] | 60 | if (device.master()) |
| 61 | { |
Chris Cain | 5d66a0a | 2022-02-09 08:52:10 -0600 | [diff] [blame] | 62 | // Update powercap bounds from OCC |
Chris Cain | 40501a2 | 2022-03-14 17:33:27 -0500 | [diff] [blame] | 63 | manager.updatePcapBounds(); |
Chris Cain | 5d66a0a | 2022-02-09 08:52:10 -0600 | [diff] [blame] | 64 | } |
| 65 | |
Vishwanatha Subbanna | 2dc9b1a | 2017-08-18 18:29:41 +0530 | [diff] [blame] | 66 | // Call into Manager to let know that we have bound |
Chris Cain | 1be4337 | 2021-12-09 19:29:37 -0600 | [diff] [blame] | 67 | if (this->managerCallBack) |
Vishwanatha Subbanna | 2dc9b1a | 2017-08-18 18:29:41 +0530 | [diff] [blame] | 68 | { |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 69 | this->managerCallBack(instance, value); |
Edward A. James | 9fd2bdc | 2017-11-08 16:18:57 -0600 | [diff] [blame] | 70 | } |
Vishwanatha Subbanna | 32e84e9 | 2017-06-28 19:17:28 +0530 | [diff] [blame] | 71 | } |
| 72 | else |
| 73 | { |
Chris Cain | f788150 | 2025-04-16 14:48:30 -0500 | [diff] [blame^] | 74 | // OCC is no longer active |
Chris Cain | a7b74dc | 2021-11-10 17:03:43 -0600 | [diff] [blame] | 75 | #ifdef POWER10 |
Chris Cain | f788150 | 2025-04-16 14:48:30 -0500 | [diff] [blame^] | 76 | if (sensorsValid) |
| 77 | { |
| 78 | sensorsValid = false; |
| 79 | // Sensors not supported (update to NaN and not functional) |
| 80 | manager.setSensorValueToNaN(instance); |
| 81 | } |
| 82 | |
Chris Cain | 1be4337 | 2021-12-09 19:29:37 -0600 | [diff] [blame] | 83 | if (pmode && device.master()) |
Chris Cain | 36f9cde | 2021-11-22 11:18:21 -0600 | [diff] [blame] | 84 | { |
| 85 | // Prevent mode changes |
| 86 | pmode->setMasterActive(false); |
| 87 | } |
Chris Cain | a7b74dc | 2021-11-10 17:03:43 -0600 | [diff] [blame] | 88 | if (safeStateDelayTimer.isEnabled()) |
| 89 | { |
| 90 | // stop safe delay timer |
| 91 | safeStateDelayTimer.setEnabled(false); |
| 92 | } |
| 93 | #endif |
Chris Cain | 36f9cde | 2021-11-22 11:18:21 -0600 | [diff] [blame] | 94 | // Call into Manager to let know that we will unbind. |
Chris Cain | 1be4337 | 2021-12-09 19:29:37 -0600 | [diff] [blame] | 95 | if (this->managerCallBack) |
Chris Cain | 36f9cde | 2021-11-22 11:18:21 -0600 | [diff] [blame] | 96 | { |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 97 | this->managerCallBack(instance, value); |
Chris Cain | 36f9cde | 2021-11-22 11:18:21 -0600 | [diff] [blame] | 98 | } |
| 99 | |
Edward A. James | 9fd2bdc | 2017-11-08 16:18:57 -0600 | [diff] [blame] | 100 | // Stop watching for errors |
| 101 | removeErrorWatch(); |
Vishwanatha Subbanna | ee4d83d | 2017-06-29 18:35:00 +0530 | [diff] [blame] | 102 | |
Eddie James | aced309 | 2022-04-22 16:19:30 -0500 | [diff] [blame] | 103 | // Set the device inactive |
| 104 | device.setActive(false); |
Chris Cain | c86d80f | 2023-05-04 15:49:18 -0500 | [diff] [blame] | 105 | |
| 106 | // Clear throttles (OCC not active after disabling device) |
| 107 | updateThrottle(false, THROTTLED_ALL); |
Vishwanatha Subbanna | 32e84e9 | 2017-06-28 19:17:28 +0530 | [diff] [blame] | 108 | } |
| 109 | } |
Eddie James | aced309 | 2022-04-22 16:19:30 -0500 | [diff] [blame] | 110 | else if (value && !device.active()) |
Edward A. James | 5e17797 | 2017-10-25 15:50:31 -0500 | [diff] [blame] | 111 | { |
| 112 | // Existing error watch is on a dead file descriptor. |
Edward A. James | 9fd2bdc | 2017-11-08 16:18:57 -0600 | [diff] [blame] | 113 | removeErrorWatch(); |
Edward A. James | 5e17797 | 2017-10-25 15:50:31 -0500 | [diff] [blame] | 114 | |
| 115 | /* |
| 116 | * In it's constructor, Status checks Device::bound() to see if OCC is |
| 117 | * active or not. |
| 118 | * Device::bound() checks for occX-dev0 directory. |
| 119 | * We will lose occX-dev0 directories during FSI rescan. |
| 120 | * So, if we start this application (and construct Status), and then |
| 121 | * later do FSI rescan, we will end up with occActive = true and device |
| 122 | * NOT bound. Lets correct that situation here. |
| 123 | */ |
Eddie James | aced309 | 2022-04-22 16:19:30 -0500 | [diff] [blame] | 124 | device.setActive(true); |
Edward A. James | 5e17797 | 2017-10-25 15:50:31 -0500 | [diff] [blame] | 125 | |
| 126 | // Add error watch again |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 127 | try |
| 128 | { |
| 129 | addErrorWatch(); |
| 130 | } |
| 131 | catch (const OpenFailure& e) |
| 132 | { |
| 133 | // Failed to add watch for throttle events, request reset to try to |
| 134 | // recover comm |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 135 | lg2::error( |
| 136 | "Status::occActive: Unable to add error watch(s) again for OCC{INST} watch: {ERROR}", |
| 137 | "INST", instance, "ERROR", e.what()); |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 138 | deviceError(Error::Descriptor(OCC_COMM_ERROR_PATH)); |
| 139 | return Base::Status::occActive(false); |
| 140 | } |
Edward A. James | 5e17797 | 2017-10-25 15:50:31 -0500 | [diff] [blame] | 141 | } |
Eddie James | aced309 | 2022-04-22 16:19:30 -0500 | [diff] [blame] | 142 | else if (!value && device.active()) |
Eddie James | 6d6d1b3 | 2019-04-22 10:45:08 -0500 | [diff] [blame] | 143 | { |
| 144 | removeErrorWatch(); |
| 145 | |
| 146 | // In the event that the application never receives the active signal |
| 147 | // even though the OCC is active (this can occur if the BMC is rebooted |
| 148 | // with the host on, since the initial OCC driver probe will discover |
| 149 | // the OCCs), this application needs to be able to unbind the device |
| 150 | // when we get the OCC inactive signal. |
Eddie James | aced309 | 2022-04-22 16:19:30 -0500 | [diff] [blame] | 151 | device.setActive(false); |
Eddie James | 6d6d1b3 | 2019-04-22 10:45:08 -0500 | [diff] [blame] | 152 | } |
Vishwanatha Subbanna | 307d80b | 2017-06-28 15:56:09 +0530 | [diff] [blame] | 153 | return Base::Status::occActive(value); |
| 154 | } |
| 155 | |
Vishwanatha Subbanna | ee4d83d | 2017-06-29 18:35:00 +0530 | [diff] [blame] | 156 | // Callback handler when a device error is reported. |
Eddie James | 9789e71 | 2022-05-25 15:43:40 -0500 | [diff] [blame] | 157 | void Status::deviceError(Error::Descriptor d) |
Vishwanatha Subbanna | ee4d83d | 2017-06-29 18:35:00 +0530 | [diff] [blame] | 158 | { |
Chris Cain | 36f9cde | 2021-11-22 11:18:21 -0600 | [diff] [blame] | 159 | #ifdef POWER10 |
Chris Cain | 1be4337 | 2021-12-09 19:29:37 -0600 | [diff] [blame] | 160 | if (pmode && device.master()) |
| 161 | { |
| 162 | // Prevent mode changes |
| 163 | pmode->setMasterActive(false); |
| 164 | } |
Chris Cain | 36f9cde | 2021-11-22 11:18:21 -0600 | [diff] [blame] | 165 | #endif |
| 166 | |
Eddie James | 9789e71 | 2022-05-25 15:43:40 -0500 | [diff] [blame] | 167 | if (d.log) |
| 168 | { |
Chris Cain | 3ece5b9 | 2025-01-10 16:06:31 -0600 | [diff] [blame] | 169 | FFDC::createOCCResetPEL(instance, d.path, d.err, d.callout, |
| 170 | d.isInventoryCallout); |
Eddie James | 9789e71 | 2022-05-25 15:43:40 -0500 | [diff] [blame] | 171 | } |
| 172 | |
Eddie James | cbad219 | 2021-10-07 09:39:39 -0500 | [diff] [blame] | 173 | // This would deem OCC inactive |
| 174 | this->occActive(false); |
Vishwanatha Subbanna | 30e329a | 2017-07-24 23:13:14 +0530 | [diff] [blame] | 175 | |
Eddie James | cbad219 | 2021-10-07 09:39:39 -0500 | [diff] [blame] | 176 | // Reset the OCC |
| 177 | this->resetOCC(); |
Vishwanatha Subbanna | 30e329a | 2017-07-24 23:13:14 +0530 | [diff] [blame] | 178 | } |
| 179 | |
| 180 | // Sends message to host control command handler to reset OCC |
| 181 | void Status::resetOCC() |
| 182 | { |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 183 | lg2::info(">>Status::resetOCC() - requesting reset for OCC{INST}", "INST", |
| 184 | instance); |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 185 | this->occActive(false); |
Tom Joseph | 0032523 | 2020-07-29 17:51:48 +0530 | [diff] [blame] | 186 | #ifdef PLDM |
| 187 | if (resetCallBack) |
| 188 | { |
| 189 | this->resetCallBack(instance); |
| 190 | } |
| 191 | #else |
Vishwanatha Subbanna | 30e329a | 2017-07-24 23:13:14 +0530 | [diff] [blame] | 192 | constexpr auto CONTROL_HOST_PATH = "/org/open_power/control/host0"; |
| 193 | constexpr auto CONTROL_HOST_INTF = "org.open_power.Control.Host"; |
| 194 | |
| 195 | // This will throw exception on failure |
George Liu | f3b7514 | 2021-06-10 11:22:50 +0800 | [diff] [blame] | 196 | auto service = utils::getService(CONTROL_HOST_PATH, CONTROL_HOST_INTF); |
Vishwanatha Subbanna | 30e329a | 2017-07-24 23:13:14 +0530 | [diff] [blame] | 197 | |
George Liu | f3b7514 | 2021-06-10 11:22:50 +0800 | [diff] [blame] | 198 | auto& bus = utils::getBus(); |
Gunnar Mills | 94df8c9 | 2018-09-14 14:50:03 -0500 | [diff] [blame] | 199 | auto method = bus.new_method_call(service.c_str(), CONTROL_HOST_PATH, |
| 200 | CONTROL_HOST_INTF, "Execute"); |
Vishwanatha Subbanna | 30e329a | 2017-07-24 23:13:14 +0530 | [diff] [blame] | 201 | // OCC Reset control command |
Gunnar Mills | 94df8c9 | 2018-09-14 14:50:03 -0500 | [diff] [blame] | 202 | method.append(convertForMessage(Control::Host::Command::OCCReset).c_str()); |
Vishwanatha Subbanna | 30e329a | 2017-07-24 23:13:14 +0530 | [diff] [blame] | 203 | |
| 204 | // OCC Sensor ID for callout reasons |
Patrick Williams | e096270 | 2020-05-13 17:50:22 -0500 | [diff] [blame] | 205 | method.append(std::variant<uint8_t>(std::get<0>(sensorMap.at(instance)))); |
Vishwanatha Subbanna | 30e329a | 2017-07-24 23:13:14 +0530 | [diff] [blame] | 206 | bus.call_noreply(method); |
| 207 | return; |
Tom Joseph | 0032523 | 2020-07-29 17:51:48 +0530 | [diff] [blame] | 208 | #endif |
Vishwanatha Subbanna | 30e329a | 2017-07-24 23:13:14 +0530 | [diff] [blame] | 209 | } |
| 210 | |
| 211 | // Handler called by Host control command handler to convey the |
| 212 | // status of the executed command |
Patrick Williams | af40808 | 2022-07-22 19:26:54 -0500 | [diff] [blame] | 213 | void Status::hostControlEvent(sdbusplus::message_t& msg) |
Vishwanatha Subbanna | 30e329a | 2017-07-24 23:13:14 +0530 | [diff] [blame] | 214 | { |
Vishwanatha Subbanna | 30e329a | 2017-07-24 23:13:14 +0530 | [diff] [blame] | 215 | std::string cmdCompleted{}; |
| 216 | std::string cmdStatus{}; |
| 217 | |
| 218 | msg.read(cmdCompleted, cmdStatus); |
| 219 | |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 220 | lg2::debug("Host control signal values: command={CMD}, status={STATUS}", |
| 221 | "CMD", cmdCompleted, "STATUS", cmdStatus); |
Vishwanatha Subbanna | 30e329a | 2017-07-24 23:13:14 +0530 | [diff] [blame] | 222 | |
Gunnar Mills | 94df8c9 | 2018-09-14 14:50:03 -0500 | [diff] [blame] | 223 | if (Control::Host::convertResultFromString(cmdStatus) != |
| 224 | Control::Host::Result::Success) |
Vishwanatha Subbanna | 30e329a | 2017-07-24 23:13:14 +0530 | [diff] [blame] | 225 | { |
Gunnar Mills | 94df8c9 | 2018-09-14 14:50:03 -0500 | [diff] [blame] | 226 | if (Control::Host::convertCommandFromString(cmdCompleted) == |
| 227 | Control::Host::Command::OCCReset) |
Vishwanatha Subbanna | 30e329a | 2017-07-24 23:13:14 +0530 | [diff] [blame] | 228 | { |
Gunnar Mills | 85e6520 | 2018-04-08 15:01:54 -0500 | [diff] [blame] | 229 | // Must be a Timeout. Log an Error trace |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 230 | lg2::error( |
| 231 | "Error resetting the OCC: path={PATH}, sensorid={SENSOR}", |
| 232 | "PATH", path, "SENSOR", std::get<0>(sensorMap.at(instance))); |
Vishwanatha Subbanna | 30e329a | 2017-07-24 23:13:14 +0530 | [diff] [blame] | 233 | } |
| 234 | } |
| 235 | return; |
Vishwanatha Subbanna | ee4d83d | 2017-06-29 18:35:00 +0530 | [diff] [blame] | 236 | } |
| 237 | |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 238 | // Called from Manager::pollerTimerExpired() in preperation to POLL OCC. |
Chris Cain | a8857c5 | 2021-01-27 11:53:05 -0600 | [diff] [blame] | 239 | void Status::readOccState() |
| 240 | { |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 241 | if (stateValid) |
| 242 | { |
| 243 | // Reset retry count (since state is good) |
| 244 | currentOccReadRetriesCount = occReadRetries; |
| 245 | } |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 246 | occReadStateNow(); |
Chris Cain | a8857c5 | 2021-01-27 11:53:05 -0600 | [diff] [blame] | 247 | } |
| 248 | |
Chris Cain | 78e8601 | 2021-03-04 16:15:31 -0600 | [diff] [blame] | 249 | #ifdef POWER10 |
Chris Cain | 78e8601 | 2021-03-04 16:15:31 -0600 | [diff] [blame] | 250 | // Special processing that needs to happen once the OCCs change to ACTIVE state |
| 251 | void Status::occsWentActive() |
| 252 | { |
| 253 | CmdStatus status = CmdStatus::SUCCESS; |
| 254 | |
Chris Cain | 1fe436d | 2024-10-10 09:41:03 -0500 | [diff] [blame] | 255 | // IPS data will get sent automatically after a mode change if the mode |
| 256 | // supports it. |
| 257 | pmode->needToSendIPS(); |
| 258 | |
Chris Cain | 36f9cde | 2021-11-22 11:18:21 -0600 | [diff] [blame] | 259 | status = pmode->sendModeChange(); |
Chris Cain | 78e8601 | 2021-03-04 16:15:31 -0600 | [diff] [blame] | 260 | if (status != CmdStatus::SUCCESS) |
| 261 | { |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 262 | lg2::error( |
| 263 | "Status::occsWentActive: OCC mode change failed with status {STATUS}", |
| 264 | "STATUS", status); |
Chris Cain | c567dc8 | 2022-04-01 15:09:17 -0500 | [diff] [blame] | 265 | |
| 266 | // Disable and reset to try recovering |
| 267 | deviceError(); |
Chris Cain | 78e8601 | 2021-03-04 16:15:31 -0600 | [diff] [blame] | 268 | } |
Chris Cain | 78e8601 | 2021-03-04 16:15:31 -0600 | [diff] [blame] | 269 | } |
| 270 | |
Chris Cain | 1725767 | 2021-10-22 13:41:03 -0500 | [diff] [blame] | 271 | // Send Ambient and Altitude to the OCC |
| 272 | CmdStatus Status::sendAmbient(const uint8_t inTemp, const uint16_t inAltitude) |
| 273 | { |
| 274 | CmdStatus status = CmdStatus::FAILURE; |
| 275 | bool ambientValid = true; |
| 276 | uint8_t ambientTemp = inTemp; |
| 277 | uint16_t altitude = inAltitude; |
| 278 | |
| 279 | if (ambientTemp == 0xFF) |
| 280 | { |
| 281 | // Get latest readings from manager |
| 282 | manager.getAmbientData(ambientValid, ambientTemp, altitude); |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 283 | lg2::debug( |
| 284 | "sendAmbient: valid: {VALID}, Ambient: {TEMP}C, altitude: {ALT}m", |
| 285 | "VALID", ambientValid, "TEMP", ambientTemp, "ALT", altitude); |
Chris Cain | 1725767 | 2021-10-22 13:41:03 -0500 | [diff] [blame] | 286 | } |
| 287 | |
| 288 | std::vector<std::uint8_t> cmd, rsp; |
| 289 | cmd.reserve(11); |
| 290 | cmd.push_back(uint8_t(CmdType::SEND_AMBIENT)); |
| 291 | cmd.push_back(0x00); // Data Length (2 bytes) |
| 292 | cmd.push_back(0x08); // |
| 293 | cmd.push_back(0x00); // Version |
| 294 | cmd.push_back(ambientValid ? 0 : 0xFF); // Ambient Status |
| 295 | cmd.push_back(ambientTemp); // Ambient Temperature |
| 296 | cmd.push_back(altitude >> 8); // Altitude in meters (2 bytes) |
| 297 | cmd.push_back(altitude & 0xFF); // |
| 298 | cmd.push_back(0x00); // Reserved (3 bytes) |
| 299 | cmd.push_back(0x00); |
| 300 | cmd.push_back(0x00); |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 301 | lg2::debug("sendAmbient: SEND_AMBIENT " |
| 302 | "command to OCC{INST} ({SIZE} bytes)", |
| 303 | "INST", instance, "SIZE", cmd.size()); |
Chris Cain | 1725767 | 2021-10-22 13:41:03 -0500 | [diff] [blame] | 304 | status = occCmd.send(cmd, rsp); |
| 305 | if (status == CmdStatus::SUCCESS) |
| 306 | { |
| 307 | if (rsp.size() == 5) |
| 308 | { |
| 309 | if (RspStatus::SUCCESS != RspStatus(rsp[2])) |
| 310 | { |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 311 | lg2::error( |
| 312 | "sendAmbient: SEND_AMBIENT failed with rspStatus {STATUS}", |
| 313 | "STATUS", lg2::hex, rsp[2]); |
Chris Cain | 1725767 | 2021-10-22 13:41:03 -0500 | [diff] [blame] | 314 | dump_hex(rsp); |
| 315 | status = CmdStatus::FAILURE; |
| 316 | } |
| 317 | } |
| 318 | else |
| 319 | { |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 320 | lg2::error( |
| 321 | "sendAmbient: INVALID SEND_AMBIENT response length:{SIZE}", |
| 322 | "SIZE", rsp.size()); |
Chris Cain | 1725767 | 2021-10-22 13:41:03 -0500 | [diff] [blame] | 323 | dump_hex(rsp); |
| 324 | status = CmdStatus::FAILURE; |
| 325 | } |
| 326 | } |
| 327 | else |
| 328 | { |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 329 | lg2::error("sendAmbient: SEND_AMBIENT FAILED! with status {STATUS}", |
| 330 | "STATUS", lg2::hex, uint8_t(status)); |
Chris Cain | c567dc8 | 2022-04-01 15:09:17 -0500 | [diff] [blame] | 331 | |
| 332 | if (status == CmdStatus::COMM_FAILURE) |
Chris Cain | 1725767 | 2021-10-22 13:41:03 -0500 | [diff] [blame] | 333 | { |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 334 | // Disable due to OCC comm failure and reset to try recovering |
| 335 | deviceError(Error::Descriptor(OCC_COMM_ERROR_PATH)); |
Chris Cain | 1725767 | 2021-10-22 13:41:03 -0500 | [diff] [blame] | 336 | } |
| 337 | } |
| 338 | |
| 339 | return status; |
| 340 | } |
Chris Cain | a7b74dc | 2021-11-10 17:03:43 -0600 | [diff] [blame] | 341 | |
| 342 | // Called when safe timer expires to determine if OCCs need to be reset |
| 343 | void Status::safeStateDelayExpired() |
| 344 | { |
| 345 | if (this->occActive()) |
| 346 | { |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 347 | lg2::info( |
| 348 | "safeStateDelayExpired: OCC{INST} state missing or not valid, requesting reset", |
| 349 | "INST", instance); |
Chris Cain | a7b74dc | 2021-11-10 17:03:43 -0600 | [diff] [blame] | 350 | // Disable and reset to try recovering |
Eddie James | 9789e71 | 2022-05-25 15:43:40 -0500 | [diff] [blame] | 351 | deviceError(Error::Descriptor(SAFE_ERROR_PATH)); |
Chris Cain | a7b74dc | 2021-11-10 17:03:43 -0600 | [diff] [blame] | 352 | } |
| 353 | } |
Chris Cain | 78e8601 | 2021-03-04 16:15:31 -0600 | [diff] [blame] | 354 | #endif // POWER10 |
| 355 | |
Chris Cain | e2d0a43 | 2022-03-28 11:08:49 -0500 | [diff] [blame] | 356 | fs::path Status::getHwmonPath() |
Chris Cain | 5d66a0a | 2022-02-09 08:52:10 -0600 | [diff] [blame] | 357 | { |
| 358 | using namespace std::literals::string_literals; |
| 359 | |
Chris Cain | e2d0a43 | 2022-03-28 11:08:49 -0500 | [diff] [blame] | 360 | if (!fs::exists(hwmonPath)) |
| 361 | { |
| 362 | static bool tracedFail[8] = {0}; |
Chris Cain | 5d66a0a | 2022-02-09 08:52:10 -0600 | [diff] [blame] | 363 | |
Chris Cain | e2d0a43 | 2022-03-28 11:08:49 -0500 | [diff] [blame] | 364 | if (!hwmonPath.empty()) |
| 365 | { |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 366 | lg2::warning( |
| 367 | "Status::getHwmonPath(): path no longer exists: {PATH}", "PATH", |
| 368 | hwmonPath); |
Chris Cain | e2d0a43 | 2022-03-28 11:08:49 -0500 | [diff] [blame] | 369 | hwmonPath.clear(); |
| 370 | } |
| 371 | |
| 372 | // Build the base HWMON path |
Patrick Williams | d7542c8 | 2024-08-16 15:20:28 -0400 | [diff] [blame] | 373 | fs::path prefixPath = |
| 374 | fs::path{OCC_HWMON_PATH + "occ-hwmon."s + |
| 375 | std::to_string(instance + 1) + "/hwmon/"s}; |
Chris Cain | e2d0a43 | 2022-03-28 11:08:49 -0500 | [diff] [blame] | 376 | |
| 377 | // Get the hwmonXX directory name |
| 378 | try |
| 379 | { |
| 380 | // there should only be one directory |
| 381 | const int numDirs = std::distance( |
| 382 | fs::directory_iterator(prefixPath), fs::directory_iterator{}); |
| 383 | if (numDirs == 1) |
| 384 | { |
| 385 | hwmonPath = *fs::directory_iterator(prefixPath); |
| 386 | tracedFail[instance] = false; |
| 387 | } |
| 388 | else |
| 389 | { |
| 390 | if (!tracedFail[instance]) |
| 391 | { |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 392 | lg2::error( |
| 393 | "Status::getHwmonPath(): Found multiple ({NUM}) hwmon paths!", |
| 394 | "NUM", numDirs); |
Chris Cain | e2d0a43 | 2022-03-28 11:08:49 -0500 | [diff] [blame] | 395 | tracedFail[instance] = true; |
| 396 | } |
| 397 | } |
| 398 | } |
| 399 | catch (const fs::filesystem_error& e) |
| 400 | { |
| 401 | if (!tracedFail[instance]) |
| 402 | { |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 403 | lg2::error( |
| 404 | "Status::getHwmonPath(): error accessing {PATH}: {ERROR}", |
| 405 | "PATH", prefixPath, "ERROR", e.what()); |
Chris Cain | e2d0a43 | 2022-03-28 11:08:49 -0500 | [diff] [blame] | 406 | tracedFail[instance] = true; |
| 407 | } |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | return hwmonPath; |
Chris Cain | 5d66a0a | 2022-02-09 08:52:10 -0600 | [diff] [blame] | 412 | } |
| 413 | |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 414 | // Called to read state and handle any errors |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 415 | void Status::occReadStateNow() |
| 416 | { |
| 417 | unsigned int state; |
| 418 | const fs::path filename = |
| 419 | fs::path(DEV_PATH) / |
| 420 | fs::path(sysfsName + "." + std::to_string(instance + 1)) / "occ_state"; |
| 421 | |
| 422 | std::ifstream file; |
Chris Cain | f788150 | 2025-04-16 14:48:30 -0500 | [diff] [blame^] | 423 | bool stateWasRead = false; |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 424 | |
| 425 | // open file. |
| 426 | file.open(filename, std::ios::in); |
| 427 | const int openErrno = errno; |
| 428 | |
| 429 | // File is open and state can be used. |
| 430 | if (file.is_open() && file.good()) |
| 431 | { |
Chris Cain | f788150 | 2025-04-16 14:48:30 -0500 | [diff] [blame^] | 432 | stateWasRead = true; |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 433 | file >> state; |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 434 | // Read the error code (if any) to check status of the read |
| 435 | std::ios_base::iostate readState = file.rdstate(); |
| 436 | if (readState) |
| 437 | { |
| 438 | // There was a failure reading the file |
| 439 | if (lastOccReadStatus != -1) |
| 440 | { |
| 441 | // Trace error bits |
| 442 | std::string errorBits = ""; |
| 443 | if (readState & std::ios_base::eofbit) |
| 444 | { |
| 445 | errorBits += " EOF"; |
| 446 | } |
| 447 | if (readState & std::ios_base::failbit) |
| 448 | { |
| 449 | errorBits += " failbit"; |
| 450 | } |
| 451 | if (readState & std::ios_base::badbit) |
| 452 | { |
| 453 | errorBits += " badbit"; |
| 454 | } |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 455 | lg2::error( |
| 456 | "readOccState: Failed to read OCC{INST} state: Read error on I/O operation - {ERROR}", |
| 457 | "INST", instance, "ERROR", errorBits); |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 458 | lastOccReadStatus = -1; |
| 459 | } |
Chris Cain | f788150 | 2025-04-16 14:48:30 -0500 | [diff] [blame^] | 460 | stateWasRead = false; |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 461 | } |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 462 | |
Chris Cain | f788150 | 2025-04-16 14:48:30 -0500 | [diff] [blame^] | 463 | if (stateWasRead && (state != lastState)) |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 464 | { |
| 465 | // Trace OCC state changes |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 466 | lg2::info( |
| 467 | "Status::readOccState: OCC{INST} state {STATE} (lastState: {PRIOR})", |
| 468 | "INST", instance, "STATE", lg2::hex, state, "PRIOR", lg2::hex, |
| 469 | lastState); |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 470 | lastState = state; |
| 471 | #ifdef POWER10 |
| 472 | if (OccState(state) == OccState::ACTIVE) |
| 473 | { |
| 474 | if (pmode && device.master()) |
| 475 | { |
| 476 | // Set the master OCC on the PowerMode object |
| 477 | pmode->setMasterOcc(path); |
| 478 | // Enable mode changes |
| 479 | pmode->setMasterActive(); |
| 480 | |
| 481 | // Special processing by master OCC when it goes active |
| 482 | occsWentActive(); |
| 483 | } |
| 484 | |
| 485 | CmdStatus status = sendAmbient(); |
| 486 | if (status != CmdStatus::SUCCESS) |
| 487 | { |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 488 | lg2::error( |
| 489 | "readOccState: Sending Ambient failed with status {STATUS}", |
| 490 | "STATUS", status); |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 491 | } |
| 492 | } |
| 493 | |
| 494 | // If OCC in known Good State. |
| 495 | if ((OccState(state) == OccState::ACTIVE) || |
| 496 | (OccState(state) == OccState::CHARACTERIZATION) || |
| 497 | (OccState(state) == OccState::OBSERVATION)) |
| 498 | { |
| 499 | // Good OCC State then sensors valid again |
| 500 | stateValid = true; |
Chris Cain | f788150 | 2025-04-16 14:48:30 -0500 | [diff] [blame^] | 501 | sensorsValid = true; |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 502 | |
| 503 | if (safeStateDelayTimer.isEnabled()) |
| 504 | { |
| 505 | // stop safe delay timer (no longer in SAFE state) |
| 506 | safeStateDelayTimer.setEnabled(false); |
| 507 | } |
| 508 | } |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 509 | else |
| 510 | { |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 511 | // OCC is in SAFE or some other unsupported state |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 512 | if (!safeStateDelayTimer.isEnabled()) |
| 513 | { |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 514 | lg2::error( |
Chris Cain | f788150 | 2025-04-16 14:48:30 -0500 | [diff] [blame^] | 515 | "readOccState: Invalid OCC{INST} state of {STATE} (last state: {PRIOR}), starting safe state delay timer", |
| 516 | "INST", instance, "STATE", lg2::hex, state, "PRIOR", |
| 517 | lg2::hex, lastState); |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 518 | // start safe delay timer (before requesting reset) |
| 519 | using namespace std::literals::chrono_literals; |
| 520 | safeStateDelayTimer.restartOnce(60s); |
| 521 | } |
Chris Cain | f788150 | 2025-04-16 14:48:30 -0500 | [diff] [blame^] | 522 | |
| 523 | if (sensorsValid) |
| 524 | { |
| 525 | sensorsValid = false; |
| 526 | // Sensors not supported (update to NaN and not functional) |
| 527 | manager.setSensorValueToNaN(instance); |
| 528 | } |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 529 | } |
| 530 | #else |
| 531 | // Before P10 state not checked, only used good file open. |
| 532 | stateValid = true; |
| 533 | #endif |
| 534 | } |
| 535 | } |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 536 | #ifdef POWER10 |
| 537 | else |
| 538 | { |
| 539 | // Unable to read state |
| 540 | stateValid = false; |
| 541 | } |
| 542 | #endif |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 543 | file.close(); |
| 544 | |
Chris Cain | f788150 | 2025-04-16 14:48:30 -0500 | [diff] [blame^] | 545 | // if failed to read the OCC state -> Attempt retry |
| 546 | if (!stateWasRead) |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 547 | { |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 548 | #ifdef READ_OCC_SENSORS |
Chris Cain | f788150 | 2025-04-16 14:48:30 -0500 | [diff] [blame^] | 549 | if (sensorsValid) |
| 550 | { |
| 551 | sensorsValid = false; |
| 552 | manager.setSensorValueToNaN(instance); |
| 553 | } |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 554 | #endif |
| 555 | |
Chris Cain | f788150 | 2025-04-16 14:48:30 -0500 | [diff] [blame^] | 556 | // If not able to read, OCC may be offline |
| 557 | if (openErrno != lastOccReadStatus) |
| 558 | { |
| 559 | lg2::error( |
| 560 | "Status::readOccState: open/read failed trying to read OCC{INST} state (open errno={ERROR})", |
| 561 | "INST", instance, "ERROR", openErrno); |
| 562 | lastOccReadStatus = openErrno; |
| 563 | } |
| 564 | |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 565 | // See occReadRetries for number of retry attempts. |
| 566 | if (currentOccReadRetriesCount > 0) |
| 567 | { |
| 568 | --currentOccReadRetriesCount; |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 569 | } |
| 570 | else |
| 571 | { |
Chris Cain | f788150 | 2025-04-16 14:48:30 -0500 | [diff] [blame^] | 572 | lg2::error( |
| 573 | "readOccState: failed to read OCC{INST} state! (last state: {PRIOR})", |
| 574 | "INST", instance, "PRIOR", lg2::hex, lastState); |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 575 | |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 576 | // State could not be determined, set it to NO State. |
| 577 | lastState = 0; |
| 578 | |
| 579 | // Disable the ability to send Failed actions until OCC is |
| 580 | // Active again. |
| 581 | stateValid = false; |
| 582 | |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 583 | // Disable due to OCC comm failure and reset to try recovering |
Chris Cain | 3ece5b9 | 2025-01-10 16:06:31 -0600 | [diff] [blame] | 584 | // (processor callout will be added) |
| 585 | deviceError(Error::Descriptor(OCC_COMM_ERROR_PATH, ECOMM, |
| 586 | procPath.c_str(), true)); |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 587 | |
| 588 | // Reset retry count (for next attempt after recovery) |
| 589 | currentOccReadRetriesCount = occReadRetries; |
| 590 | } |
| 591 | } |
Chris Cain | f788150 | 2025-04-16 14:48:30 -0500 | [diff] [blame^] | 592 | else if (lastOccReadStatus != 0) |
Chris Cain | f0295f5 | 2024-09-12 15:41:14 -0500 | [diff] [blame] | 593 | { |
Chris Cain | f788150 | 2025-04-16 14:48:30 -0500 | [diff] [blame^] | 594 | lg2::info("readOccState: successfully read OCC{INST} state: {STATE}", |
| 595 | "INST", instance, "STATE", state); |
| 596 | lastOccReadStatus = 0; // no error |
Sheldon Bailey | 373af75 | 2022-02-21 15:14:00 -0600 | [diff] [blame] | 597 | } |
| 598 | } |
| 599 | |
Chris Cain | c86d80f | 2023-05-04 15:49:18 -0500 | [diff] [blame] | 600 | // Update processor throttle status on dbus |
| 601 | void Status::updateThrottle(const bool isThrottled, const uint8_t newReason) |
| 602 | { |
| 603 | if (!throttleHandle) |
| 604 | { |
| 605 | return; |
| 606 | } |
| 607 | |
| 608 | uint8_t newThrottleCause = throttleCause; |
| 609 | |
| 610 | if (isThrottled) // throttled due to newReason |
| 611 | { |
| 612 | if ((newReason & throttleCause) == 0) |
| 613 | { |
| 614 | // set the bit(s) for passed in reason |
| 615 | newThrottleCause |= newReason; |
| 616 | } |
| 617 | // else no change |
| 618 | } |
| 619 | else // no longer throttled due to newReason |
| 620 | { |
| 621 | if ((newReason & throttleCause) != 0) |
| 622 | { |
| 623 | // clear the bit(s) for passed in reason |
| 624 | newThrottleCause &= ~newReason; |
| 625 | } |
| 626 | // else no change |
| 627 | } |
| 628 | |
| 629 | if (newThrottleCause != throttleCause) |
| 630 | { |
| 631 | if (newThrottleCause == THROTTLED_NONE) |
| 632 | { |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 633 | lg2::debug( |
| 634 | "updateThrottle: OCC{INST} no longer throttled (prior reason: {REASON})", |
| 635 | "INST", instance, "REASON", throttleCause); |
Chris Cain | c86d80f | 2023-05-04 15:49:18 -0500 | [diff] [blame] | 636 | throttleCause = THROTTLED_NONE; |
| 637 | throttleHandle->throttled(false); |
| 638 | throttleHandle->throttleCauses({}); |
| 639 | } |
| 640 | else |
| 641 | { |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 642 | lg2::debug( |
| 643 | "updateThrottle: OCC{INST} is throttled with reason {REASON} (prior reason: {PRIOR})", |
| 644 | "INST", instance, "REASON", newThrottleCause, "PRIOR", |
| 645 | throttleCause); |
Chris Cain | c86d80f | 2023-05-04 15:49:18 -0500 | [diff] [blame] | 646 | throttleCause = newThrottleCause; |
| 647 | |
| 648 | std::vector<ThrottleObj::ThrottleReasons> updatedCauses; |
| 649 | if (throttleCause & THROTTLED_POWER) |
| 650 | { |
| 651 | updatedCauses.push_back( |
| 652 | throttleHandle->ThrottleReasons::PowerLimit); |
| 653 | } |
| 654 | if (throttleCause & THROTTLED_THERMAL) |
| 655 | { |
| 656 | updatedCauses.push_back( |
| 657 | throttleHandle->ThrottleReasons::ThermalLimit); |
| 658 | } |
| 659 | if (throttleCause & THROTTLED_SAFE) |
| 660 | { |
| 661 | updatedCauses.push_back( |
| 662 | throttleHandle->ThrottleReasons::ManagementDetectedFault); |
| 663 | } |
| 664 | throttleHandle->throttleCauses(updatedCauses); |
| 665 | throttleHandle->throttled(true); |
| 666 | } |
| 667 | } |
| 668 | // else no change to throttle status |
| 669 | } |
| 670 | |
| 671 | // Get processor path associated with this OCC |
| 672 | void Status::readProcAssociation() |
| 673 | { |
| 674 | std::string managingPath = path + "/power_managing"; |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 675 | lg2::debug("readProcAssociation: getting endpoints for {MANAGE} ({PATH})", |
| 676 | "MANAGE", managingPath, "PATH", path); |
Chris Cain | c86d80f | 2023-05-04 15:49:18 -0500 | [diff] [blame] | 677 | try |
| 678 | { |
| 679 | utils::PropertyValue procPathProperty{}; |
| 680 | procPathProperty = utils::getProperty( |
| 681 | managingPath, "xyz.openbmc_project.Association", "endpoints"); |
| 682 | auto result = std::get<std::vector<std::string>>(procPathProperty); |
| 683 | if (result.size() > 0) |
| 684 | { |
| 685 | procPath = result[0]; |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 686 | lg2::info("readProcAssociation: OCC{INST} has proc={PATH}", "INST", |
| 687 | instance, "PATH", procPath); |
Chris Cain | c86d80f | 2023-05-04 15:49:18 -0500 | [diff] [blame] | 688 | } |
| 689 | else |
| 690 | { |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 691 | lg2::error( |
| 692 | "readProcAssociation: No processor associated with OCC{INST} / {PATH}", |
| 693 | "INST", instance, "PATH", path); |
Chris Cain | c86d80f | 2023-05-04 15:49:18 -0500 | [diff] [blame] | 694 | } |
| 695 | } |
| 696 | catch (const sdbusplus::exception_t& e) |
| 697 | { |
Chris Cain | 37abe9b | 2024-10-31 17:20:31 -0500 | [diff] [blame] | 698 | lg2::error( |
| 699 | "readProcAssociation: Unable to get proc assocated with {PATH} - {ERROR}", |
| 700 | "PATH", path, "ERROR", e.what()); |
Chris Cain | c86d80f | 2023-05-04 15:49:18 -0500 | [diff] [blame] | 701 | procPath = {}; |
| 702 | } |
| 703 | } |
| 704 | |
Vishwanatha Subbanna | 307d80b | 2017-06-28 15:56:09 +0530 | [diff] [blame] | 705 | } // namespace occ |
| 706 | } // namespace open_power |