Jason M. Bills | 3f7c5e4 | 2018-10-03 14:00:41 -0700 | [diff] [blame^] | 1 | /* |
| 2 | // Copyright (c) 2017 2018 Intel 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 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | #include <cstdint> |
| 19 | #include <phosphor-ipmi-host/sensorhandler.hpp> |
| 20 | |
| 21 | static constexpr uint8_t ipmiSdrVersion = 0x51; |
| 22 | |
| 23 | #pragma pack(push, 1) |
| 24 | struct GetSDRInfoResp |
| 25 | { |
| 26 | uint8_t sdrVersion; |
| 27 | uint8_t recordCountLS; |
| 28 | uint8_t recordCountMS; |
| 29 | uint8_t freeSpace[2]; |
| 30 | uint32_t mostRecentAddition; |
| 31 | uint32_t mostRecentErase; |
| 32 | uint8_t operationSupport; |
| 33 | }; |
| 34 | |
| 35 | struct GetSDRReq |
| 36 | { |
| 37 | uint16_t reservationID; |
| 38 | uint16_t recordID; |
| 39 | uint8_t offset; |
| 40 | uint8_t bytesToRead; |
| 41 | }; |
| 42 | #pragma pack(pop) |
| 43 | |
| 44 | enum class SdrRepositoryInfoOps : uint8_t |
| 45 | { |
| 46 | allocCommandSupported = 0x1, |
| 47 | reserveSDRRepositoryCommandSupported = 0x2, |
| 48 | partialAddSDRSupported = 0x4, |
| 49 | deleteSDRSupported = 0x8, |
| 50 | reserved = 0x10, |
| 51 | modalLSB = 0x20, |
| 52 | modalMSB = 0x40, |
| 53 | overflow = 0x80 |
| 54 | }; |
| 55 | |
| 56 | #pragma pack(push, 1) |
| 57 | struct GetAllocInfoResp |
| 58 | { |
| 59 | uint8_t allocUnitsLSB; |
| 60 | uint8_t allocUnitsMSB; |
| 61 | uint8_t allocUnitSizeLSB; |
| 62 | uint8_t allocUnitSizeMSB; |
| 63 | uint8_t allocUnitFreeLSB; |
| 64 | uint8_t allocUnitFreeMSB; |
| 65 | uint8_t allocUnitLargestFreeLSB; |
| 66 | uint8_t allocUnitLargestFreeMSB; |
| 67 | uint8_t maxRecordSize; |
| 68 | }; |
| 69 | #pragma pack(pop) |
| 70 | |
| 71 | enum class SensorTypeCodes : uint8_t |
| 72 | { |
| 73 | reserved = 0x0, |
| 74 | temperature = 0x1, |
| 75 | voltage = 0x2, |
| 76 | current = 0x3, |
| 77 | fan = 0x4, |
| 78 | other = 0xB, |
| 79 | }; |
| 80 | |
| 81 | enum class SensorUnits : uint8_t |
| 82 | { |
| 83 | unspecified = 0x0, |
| 84 | degreesC = 0x1, |
| 85 | volts = 0x4, |
| 86 | amps = 0x5, |
| 87 | watts = 0x6, |
| 88 | rpm = 0x12, |
| 89 | }; |
| 90 | |
| 91 | enum class IPMINetfnStorageCmds : ipmi_cmd_t |
| 92 | { |
| 93 | ipmiCmdGetFRUInvAreaInfo = 0x10, |
| 94 | ipmiCmdReadFRUData = 0x11, |
| 95 | ipmiCmdWriteFRUData = 0x12, |
| 96 | ipmiCmdGetRepositoryInfo = 0x20, |
| 97 | ipmiCmdGetSDRAllocationInfo = 0x21, |
| 98 | ipmiCmdReserveSDR = 0x22, |
| 99 | ipmiCmdGetSDR = 0x23, |
| 100 | ipmiCmdGetSELInfo = 0x40, |
| 101 | ipmiCmdReserveSEL = 0x42, |
| 102 | ipmiCmdGetSELEntry = 0x43, |
| 103 | ipmiCmdAddSEL = 0x44, |
| 104 | ipmiCmdDeleteSEL = 0x46, |
| 105 | ipmiCmdClearSEL = 0x47, |
| 106 | ipmiCmdGetSELTime = 0x48, |
| 107 | ipmiCmdSetSELTime = 0x49, |
| 108 | }; |
| 109 | |
| 110 | namespace ipmi |
| 111 | { |
| 112 | namespace storage |
| 113 | { |
| 114 | ipmi_ret_t getFruSdrs(size_t index, get_sdr::SensorDataFruRecord& resp); |
| 115 | |
| 116 | ipmi_ret_t getFruSdrCount(size_t& count); |
| 117 | } // namespace storage |
| 118 | } // namespace ipmi |