1*de54f486SWilly Tu /* 2*de54f486SWilly Tu // Copyright (c) 2017 2018 Intel Corporation 3*de54f486SWilly Tu // 4*de54f486SWilly Tu // Licensed under the Apache License, Version 2.0 (the "License"); 5*de54f486SWilly Tu // you may not use this file except in compliance with the License. 6*de54f486SWilly Tu // You may obtain a copy of the License at 7*de54f486SWilly Tu // 8*de54f486SWilly Tu // http://www.apache.org/licenses/LICENSE-2.0 9*de54f486SWilly Tu // 10*de54f486SWilly Tu // Unless required by applicable law or agreed to in writing, software 11*de54f486SWilly Tu // distributed under the License is distributed on an "AS IS" BASIS, 12*de54f486SWilly Tu // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*de54f486SWilly Tu // See the License for the specific language governing permissions and 14*de54f486SWilly Tu // limitations under the License. 15*de54f486SWilly Tu */ 16*de54f486SWilly Tu 17*de54f486SWilly Tu #pragma once 18*de54f486SWilly Tu #include "sensorhandler.hpp" 19*de54f486SWilly Tu 20*de54f486SWilly Tu #include <cstdint> 21*de54f486SWilly Tu 22*de54f486SWilly Tu #define USING_ENTITY_MANAGER_DECORATORS 23*de54f486SWilly Tu 24*de54f486SWilly Tu static constexpr uint8_t ipmiSdrVersion = 0x51; 25*de54f486SWilly Tu 26*de54f486SWilly Tu namespace dynamic_sensors::ipmi::sel 27*de54f486SWilly Tu { 28*de54f486SWilly Tu static constexpr uint8_t selOperationSupport = 0x02; 29*de54f486SWilly Tu static constexpr uint8_t systemEvent = 0x02; 30*de54f486SWilly Tu static constexpr size_t systemEventSize = 3; 31*de54f486SWilly Tu static constexpr uint8_t oemTsEventFirst = 0xC0; 32*de54f486SWilly Tu static constexpr uint8_t oemTsEventLast = 0xDF; 33*de54f486SWilly Tu static constexpr size_t oemTsEventSize = 9; 34*de54f486SWilly Tu static constexpr uint8_t oemEventFirst = 0xE0; 35*de54f486SWilly Tu static constexpr uint8_t oemEventLast = 0xFF; 36*de54f486SWilly Tu static constexpr size_t oemEventSize = 13; 37*de54f486SWilly Tu static constexpr uint8_t eventMsgRev = 0x04; 38*de54f486SWilly Tu } // namespace dynamic_sensors::ipmi::sel 39*de54f486SWilly Tu 40*de54f486SWilly Tu enum class SdrRepositoryInfoOps : uint8_t 41*de54f486SWilly Tu { 42*de54f486SWilly Tu allocCommandSupported = 0x1, 43*de54f486SWilly Tu reserveSDRRepositoryCommandSupported = 0x2, 44*de54f486SWilly Tu partialAddSDRSupported = 0x4, 45*de54f486SWilly Tu deleteSDRSupported = 0x8, 46*de54f486SWilly Tu reserved = 0x10, 47*de54f486SWilly Tu modalLSB = 0x20, 48*de54f486SWilly Tu modalMSB = 0x40, 49*de54f486SWilly Tu overflow = 0x80 50*de54f486SWilly Tu }; 51*de54f486SWilly Tu 52*de54f486SWilly Tu enum class GetFRUAreaAccessType : uint8_t 53*de54f486SWilly Tu { 54*de54f486SWilly Tu byte = 0x0, 55*de54f486SWilly Tu words = 0x1 56*de54f486SWilly Tu }; 57*de54f486SWilly Tu 58*de54f486SWilly Tu enum class SensorUnits : uint8_t 59*de54f486SWilly Tu { 60*de54f486SWilly Tu unspecified = 0x0, 61*de54f486SWilly Tu degreesC = 0x1, 62*de54f486SWilly Tu volts = 0x4, 63*de54f486SWilly Tu amps = 0x5, 64*de54f486SWilly Tu watts = 0x6, 65*de54f486SWilly Tu rpm = 0x12, 66*de54f486SWilly Tu }; 67*de54f486SWilly Tu 68*de54f486SWilly Tu #pragma pack(push, 1) 69*de54f486SWilly Tu struct FRUHeader 70*de54f486SWilly Tu { 71*de54f486SWilly Tu uint8_t commonHeaderFormat; 72*de54f486SWilly Tu uint8_t internalOffset; 73*de54f486SWilly Tu uint8_t chassisOffset; 74*de54f486SWilly Tu uint8_t boardOffset; 75*de54f486SWilly Tu uint8_t productOffset; 76*de54f486SWilly Tu uint8_t multiRecordOffset; 77*de54f486SWilly Tu uint8_t pad; 78*de54f486SWilly Tu uint8_t checksum; 79*de54f486SWilly Tu }; 80*de54f486SWilly Tu #pragma pack(pop) 81*de54f486SWilly Tu 82*de54f486SWilly Tu #pragma pack(push, 1) 83*de54f486SWilly Tu struct Type12Record 84*de54f486SWilly Tu { 85*de54f486SWilly Tu get_sdr::SensorDataRecordHeader header; 86*de54f486SWilly Tu uint8_t slaveAddress; 87*de54f486SWilly Tu uint8_t channelNumber; 88*de54f486SWilly Tu uint8_t powerStateNotification; 89*de54f486SWilly Tu uint8_t deviceCapabilities; 90*de54f486SWilly Tu uint24_t reserved; 91*de54f486SWilly Tu uint8_t entityID; 92*de54f486SWilly Tu uint8_t entityInstance; 93*de54f486SWilly Tu uint8_t oem; 94*de54f486SWilly Tu uint8_t typeLengthCode; 95*de54f486SWilly Tu char name[16]; 96*de54f486SWilly Tu }; 97*de54f486SWilly Tu #pragma pack(pop) 98*de54f486SWilly Tu 99*de54f486SWilly Tu namespace ipmi 100*de54f486SWilly Tu { 101*de54f486SWilly Tu namespace storage 102*de54f486SWilly Tu { 103*de54f486SWilly Tu 104*de54f486SWilly Tu constexpr const size_t type12Count = 2; 105*de54f486SWilly Tu ipmi_ret_t getFruSdrs(ipmi::Context::ptr ctx, size_t index, 106*de54f486SWilly Tu get_sdr::SensorDataFruRecord& resp); 107*de54f486SWilly Tu 108*de54f486SWilly Tu ipmi_ret_t getFruSdrCount(ipmi::Context::ptr ctx, size_t& count); 109*de54f486SWilly Tu 110*de54f486SWilly Tu std::vector<uint8_t> getType12SDRs(uint16_t index, uint16_t recordId); 111*de54f486SWilly Tu std::vector<uint8_t> getNMDiscoverySDR(uint16_t index, uint16_t recordId); 112*de54f486SWilly Tu } // namespace storage 113*de54f486SWilly Tu } // namespace ipmi 114