1 // SPDX-License-Identifier: Apache-2.0 2 // SPDX-FileCopyrightText: Copyright OpenBMC Authors 3 #pragma once 4 #include <nlohmann/json.hpp> 5 6 namespace log_entry 7 { 8 // clang-format off 9 10 enum class EventSeverity{ 11 Invalid, 12 OK, 13 Warning, 14 Critical, 15 }; 16 17 enum class LogEntryType{ 18 Invalid, 19 Event, 20 SEL, 21 Oem, 22 CXL, 23 }; 24 25 enum class LogEntryCode{ 26 Invalid, 27 Assert, 28 Deassert, 29 LowerNoncriticalgoinglow, 30 LowerNoncriticalgoinghigh, 31 LowerCriticalgoinglow, 32 LowerCriticalgoinghigh, 33 LowerNonrecoverablegoinglow, 34 LowerNonrecoverablegoinghigh, 35 UpperNoncriticalgoinglow, 36 UpperNoncriticalgoinghigh, 37 UpperCriticalgoinglow, 38 UpperCriticalgoinghigh, 39 UpperNonrecoverablegoinglow, 40 UpperNonrecoverablegoinghigh, 41 TransitiontoIdle, 42 TransitiontoActive, 43 TransitiontoBusy, 44 StateDeasserted, 45 StateAsserted, 46 PredictiveFailuredeasserted, 47 PredictiveFailureasserted, 48 LimitNotExceeded, 49 LimitExceeded, 50 PerformanceMet, 51 PerformanceLags, 52 TransitiontoOK, 53 TransitiontoNonCriticalfromOK, 54 TransitiontoCriticalfromlesssevere, 55 TransitiontoNonrecoverablefromlesssevere, 56 TransitiontoNonCriticalfrommoresevere, 57 TransitiontoCriticalfromNonrecoverable, 58 TransitiontoNonrecoverable, 59 Monitor, 60 Informational, 61 DeviceRemovedDeviceAbsent, 62 DeviceInsertedDevicePresent, 63 DeviceDisabled, 64 DeviceEnabled, 65 TransitiontoRunning, 66 TransitiontoInTest, 67 TransitiontoPowerOff, 68 TransitiontoOnLine, 69 TransitiontoOffLine, 70 TransitiontoOffDuty, 71 TransitiontoDegraded, 72 TransitiontoPowerSave, 73 InstallError, 74 FullyRedundant, 75 RedundancyLost, 76 RedundancyDegraded, 77 NonredundantSufficientResourcesfromRedundant, 78 NonredundantSufficientResourcesfromInsufficientResources, 79 NonredundantInsufficientResources, 80 RedundancyDegradedfromFullyRedundant, 81 RedundancyDegradedfromNonredundant, 82 D0PowerState, 83 D1PowerState, 84 D2PowerState, 85 D3PowerState, 86 OEM, 87 }; 88 89 enum class SensorType{ 90 Invalid, 91 PlatformSecurityViolationAttempt, 92 Temperature, 93 Voltage, 94 Current, 95 Fan, 96 PhysicalChassisSecurity, 97 Processor, 98 PowerSupplyConverter, 99 PowerUnit, 100 CoolingDevice, 101 OtherUnitsbasedSensor, 102 Memory, 103 DriveSlotBay, 104 POSTMemoryResize, 105 SystemFirmwareProgress, 106 EventLoggingDisabled, 107 SystemEvent, 108 CriticalInterrupt, 109 ButtonSwitch, 110 ModuleBoard, 111 MicrocontrollerCoprocessor, 112 AddinCard, 113 Chassis, 114 ChipSet, 115 OtherFRU, 116 CableInterconnect, 117 Terminator, 118 SystemBootRestart, 119 BootError, 120 BaseOSBootInstallationStatus, 121 OSStopShutdown, 122 SlotConnector, 123 SystemACPIPowerState, 124 Watchdog, 125 PlatformAlert, 126 EntityPresence, 127 MonitorASICIC, 128 LAN, 129 ManagementSubsystemHealth, 130 Battery, 131 SessionAudit, 132 VersionChange, 133 FRUState, 134 OEM, 135 }; 136 137 enum class LogDiagnosticDataTypes{ 138 Invalid, 139 Manager, 140 PreOS, 141 OS, 142 OEM, 143 CPER, 144 CPERSection, 145 Device, 146 }; 147 148 enum class OriginatorTypes{ 149 Invalid, 150 Client, 151 Internal, 152 SupportingService, 153 }; 154 155 enum class CXLEntryType{ 156 Invalid, 157 DynamicCapacity, 158 Informational, 159 Warning, 160 Failure, 161 Fatal, 162 }; 163 164 NLOHMANN_JSON_SERIALIZE_ENUM(EventSeverity, { 165 {EventSeverity::Invalid, "Invalid"}, 166 {EventSeverity::OK, "OK"}, 167 {EventSeverity::Warning, "Warning"}, 168 {EventSeverity::Critical, "Critical"}, 169 }); 170 171 NLOHMANN_JSON_SERIALIZE_ENUM(LogEntryType, { 172 {LogEntryType::Invalid, "Invalid"}, 173 {LogEntryType::Event, "Event"}, 174 {LogEntryType::SEL, "SEL"}, 175 {LogEntryType::Oem, "Oem"}, 176 {LogEntryType::CXL, "CXL"}, 177 }); 178 179 NLOHMANN_JSON_SERIALIZE_ENUM(LogEntryCode, { 180 {LogEntryCode::Invalid, "Invalid"}, 181 {LogEntryCode::Assert, "Assert"}, 182 {LogEntryCode::Deassert, "Deassert"}, 183 {LogEntryCode::LowerNoncriticalgoinglow, "Lower Non-critical - going low"}, 184 {LogEntryCode::LowerNoncriticalgoinghigh, "Lower Non-critical - going high"}, 185 {LogEntryCode::LowerCriticalgoinglow, "Lower Critical - going low"}, 186 {LogEntryCode::LowerCriticalgoinghigh, "Lower Critical - going high"}, 187 {LogEntryCode::LowerNonrecoverablegoinglow, "Lower Non-recoverable - going low"}, 188 {LogEntryCode::LowerNonrecoverablegoinghigh, "Lower Non-recoverable - going high"}, 189 {LogEntryCode::UpperNoncriticalgoinglow, "Upper Non-critical - going low"}, 190 {LogEntryCode::UpperNoncriticalgoinghigh, "Upper Non-critical - going high"}, 191 {LogEntryCode::UpperCriticalgoinglow, "Upper Critical - going low"}, 192 {LogEntryCode::UpperCriticalgoinghigh, "Upper Critical - going high"}, 193 {LogEntryCode::UpperNonrecoverablegoinglow, "Upper Non-recoverable - going low"}, 194 {LogEntryCode::UpperNonrecoverablegoinghigh, "Upper Non-recoverable - going high"}, 195 {LogEntryCode::TransitiontoIdle, "Transition to Idle"}, 196 {LogEntryCode::TransitiontoActive, "Transition to Active"}, 197 {LogEntryCode::TransitiontoBusy, "Transition to Busy"}, 198 {LogEntryCode::StateDeasserted, "State Deasserted"}, 199 {LogEntryCode::StateAsserted, "State Asserted"}, 200 {LogEntryCode::PredictiveFailuredeasserted, "Predictive Failure deasserted"}, 201 {LogEntryCode::PredictiveFailureasserted, "Predictive Failure asserted"}, 202 {LogEntryCode::LimitNotExceeded, "Limit Not Exceeded"}, 203 {LogEntryCode::LimitExceeded, "Limit Exceeded"}, 204 {LogEntryCode::PerformanceMet, "Performance Met"}, 205 {LogEntryCode::PerformanceLags, "Performance Lags"}, 206 {LogEntryCode::TransitiontoOK, "Transition to OK"}, 207 {LogEntryCode::TransitiontoNonCriticalfromOK, "Transition to Non-Critical from OK"}, 208 {LogEntryCode::TransitiontoCriticalfromlesssevere, "Transition to Critical from less severe"}, 209 {LogEntryCode::TransitiontoNonrecoverablefromlesssevere, "Transition to Non-recoverable from less severe"}, 210 {LogEntryCode::TransitiontoNonCriticalfrommoresevere, "Transition to Non-Critical from more severe"}, 211 {LogEntryCode::TransitiontoCriticalfromNonrecoverable, "Transition to Critical from Non-recoverable"}, 212 {LogEntryCode::TransitiontoNonrecoverable, "Transition to Non-recoverable"}, 213 {LogEntryCode::Monitor, "Monitor"}, 214 {LogEntryCode::Informational, "Informational"}, 215 {LogEntryCode::DeviceRemovedDeviceAbsent, "Device Removed / Device Absent"}, 216 {LogEntryCode::DeviceInsertedDevicePresent, "Device Inserted / Device Present"}, 217 {LogEntryCode::DeviceDisabled, "Device Disabled"}, 218 {LogEntryCode::DeviceEnabled, "Device Enabled"}, 219 {LogEntryCode::TransitiontoRunning, "Transition to Running"}, 220 {LogEntryCode::TransitiontoInTest, "Transition to In Test"}, 221 {LogEntryCode::TransitiontoPowerOff, "Transition to Power Off"}, 222 {LogEntryCode::TransitiontoOnLine, "Transition to On Line"}, 223 {LogEntryCode::TransitiontoOffLine, "Transition to Off Line"}, 224 {LogEntryCode::TransitiontoOffDuty, "Transition to Off Duty"}, 225 {LogEntryCode::TransitiontoDegraded, "Transition to Degraded"}, 226 {LogEntryCode::TransitiontoPowerSave, "Transition to Power Save"}, 227 {LogEntryCode::InstallError, "Install Error"}, 228 {LogEntryCode::FullyRedundant, "Fully Redundant"}, 229 {LogEntryCode::RedundancyLost, "Redundancy Lost"}, 230 {LogEntryCode::RedundancyDegraded, "Redundancy Degraded"}, 231 {LogEntryCode::NonredundantSufficientResourcesfromRedundant, "Non-redundant:Sufficient Resources from Redundant"}, 232 {LogEntryCode::NonredundantSufficientResourcesfromInsufficientResources, "Non-redundant:Sufficient Resources from Insufficient Resources"}, 233 {LogEntryCode::NonredundantInsufficientResources, "Non-redundant:Insufficient Resources"}, 234 {LogEntryCode::RedundancyDegradedfromFullyRedundant, "Redundancy Degraded from Fully Redundant"}, 235 {LogEntryCode::RedundancyDegradedfromNonredundant, "Redundancy Degraded from Non-redundant"}, 236 {LogEntryCode::D0PowerState, "D0 Power State"}, 237 {LogEntryCode::D1PowerState, "D1 Power State"}, 238 {LogEntryCode::D2PowerState, "D2 Power State"}, 239 {LogEntryCode::D3PowerState, "D3 Power State"}, 240 {LogEntryCode::OEM, "OEM"}, 241 }); 242 243 NLOHMANN_JSON_SERIALIZE_ENUM(SensorType, { 244 {SensorType::Invalid, "Invalid"}, 245 {SensorType::PlatformSecurityViolationAttempt, "Platform Security Violation Attempt"}, 246 {SensorType::Temperature, "Temperature"}, 247 {SensorType::Voltage, "Voltage"}, 248 {SensorType::Current, "Current"}, 249 {SensorType::Fan, "Fan"}, 250 {SensorType::PhysicalChassisSecurity, "Physical Chassis Security"}, 251 {SensorType::Processor, "Processor"}, 252 {SensorType::PowerSupplyConverter, "Power Supply / Converter"}, 253 {SensorType::PowerUnit, "PowerUnit"}, 254 {SensorType::CoolingDevice, "CoolingDevice"}, 255 {SensorType::OtherUnitsbasedSensor, "Other Units-based Sensor"}, 256 {SensorType::Memory, "Memory"}, 257 {SensorType::DriveSlotBay, "Drive Slot/Bay"}, 258 {SensorType::POSTMemoryResize, "POST Memory Resize"}, 259 {SensorType::SystemFirmwareProgress, "System Firmware Progress"}, 260 {SensorType::EventLoggingDisabled, "Event Logging Disabled"}, 261 {SensorType::SystemEvent, "System Event"}, 262 {SensorType::CriticalInterrupt, "Critical Interrupt"}, 263 {SensorType::ButtonSwitch, "Button/Switch"}, 264 {SensorType::ModuleBoard, "Module/Board"}, 265 {SensorType::MicrocontrollerCoprocessor, "Microcontroller/Coprocessor"}, 266 {SensorType::AddinCard, "Add-in Card"}, 267 {SensorType::Chassis, "Chassis"}, 268 {SensorType::ChipSet, "ChipSet"}, 269 {SensorType::OtherFRU, "Other FRU"}, 270 {SensorType::CableInterconnect, "Cable/Interconnect"}, 271 {SensorType::Terminator, "Terminator"}, 272 {SensorType::SystemBootRestart, "SystemBoot/Restart"}, 273 {SensorType::BootError, "Boot Error"}, 274 {SensorType::BaseOSBootInstallationStatus, "BaseOSBoot/InstallationStatus"}, 275 {SensorType::OSStopShutdown, "OS Stop/Shutdown"}, 276 {SensorType::SlotConnector, "Slot/Connector"}, 277 {SensorType::SystemACPIPowerState, "System ACPI PowerState"}, 278 {SensorType::Watchdog, "Watchdog"}, 279 {SensorType::PlatformAlert, "Platform Alert"}, 280 {SensorType::EntityPresence, "Entity Presence"}, 281 {SensorType::MonitorASICIC, "Monitor ASIC/IC"}, 282 {SensorType::LAN, "LAN"}, 283 {SensorType::ManagementSubsystemHealth, "Management Subsystem Health"}, 284 {SensorType::Battery, "Battery"}, 285 {SensorType::SessionAudit, "Session Audit"}, 286 {SensorType::VersionChange, "Version Change"}, 287 {SensorType::FRUState, "FRUState"}, 288 {SensorType::OEM, "OEM"}, 289 }); 290 291 NLOHMANN_JSON_SERIALIZE_ENUM(LogDiagnosticDataTypes, { 292 {LogDiagnosticDataTypes::Invalid, "Invalid"}, 293 {LogDiagnosticDataTypes::Manager, "Manager"}, 294 {LogDiagnosticDataTypes::PreOS, "PreOS"}, 295 {LogDiagnosticDataTypes::OS, "OS"}, 296 {LogDiagnosticDataTypes::OEM, "OEM"}, 297 {LogDiagnosticDataTypes::CPER, "CPER"}, 298 {LogDiagnosticDataTypes::CPERSection, "CPERSection"}, 299 {LogDiagnosticDataTypes::Device, "Device"}, 300 }); 301 302 NLOHMANN_JSON_SERIALIZE_ENUM(OriginatorTypes, { 303 {OriginatorTypes::Invalid, "Invalid"}, 304 {OriginatorTypes::Client, "Client"}, 305 {OriginatorTypes::Internal, "Internal"}, 306 {OriginatorTypes::SupportingService, "SupportingService"}, 307 }); 308 309 NLOHMANN_JSON_SERIALIZE_ENUM(CXLEntryType, { 310 {CXLEntryType::Invalid, "Invalid"}, 311 {CXLEntryType::DynamicCapacity, "DynamicCapacity"}, 312 {CXLEntryType::Informational, "Informational"}, 313 {CXLEntryType::Warning, "Warning"}, 314 {CXLEntryType::Failure, "Failure"}, 315 {CXLEntryType::Fatal, "Fatal"}, 316 }); 317 318 } 319 // clang-format on 320