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 | |
Jason M. Bills | c04e2e7 | 2018-11-28 15:15:56 -0800 | [diff] [blame] | 23 | namespace intel_oem::ipmi::sel |
| 24 | { |
Jason M. Bills | c04e2e7 | 2018-11-28 15:15:56 -0800 | [diff] [blame] | 25 | static constexpr uint8_t selOperationSupport = 0x02; |
| 26 | static constexpr uint8_t systemEvent = 0x02; |
| 27 | static constexpr size_t systemEventSize = 3; |
| 28 | static constexpr uint8_t oemTsEventFirst = 0xC0; |
| 29 | static constexpr uint8_t oemTsEventLast = 0xDF; |
| 30 | static constexpr size_t oemTsEventSize = 9; |
| 31 | static constexpr uint8_t oemEventFirst = 0xE0; |
| 32 | static constexpr uint8_t oemEventLast = 0xFF; |
| 33 | static constexpr size_t oemEventSize = 13; |
| 34 | static constexpr uint8_t eventMsgRev = 0x04; |
| 35 | } // namespace intel_oem::ipmi::sel |
| 36 | |
Jason M. Bills | 3f7c5e4 | 2018-10-03 14:00:41 -0700 | [diff] [blame] | 37 | #pragma pack(push, 1) |
| 38 | struct GetSDRInfoResp |
| 39 | { |
| 40 | uint8_t sdrVersion; |
| 41 | uint8_t recordCountLS; |
| 42 | uint8_t recordCountMS; |
| 43 | uint8_t freeSpace[2]; |
| 44 | uint32_t mostRecentAddition; |
| 45 | uint32_t mostRecentErase; |
| 46 | uint8_t operationSupport; |
| 47 | }; |
| 48 | |
| 49 | struct GetSDRReq |
| 50 | { |
| 51 | uint16_t reservationID; |
| 52 | uint16_t recordID; |
| 53 | uint8_t offset; |
| 54 | uint8_t bytesToRead; |
| 55 | }; |
| 56 | #pragma pack(pop) |
| 57 | |
| 58 | enum class SdrRepositoryInfoOps : uint8_t |
| 59 | { |
| 60 | allocCommandSupported = 0x1, |
| 61 | reserveSDRRepositoryCommandSupported = 0x2, |
| 62 | partialAddSDRSupported = 0x4, |
| 63 | deleteSDRSupported = 0x8, |
| 64 | reserved = 0x10, |
| 65 | modalLSB = 0x20, |
| 66 | modalMSB = 0x40, |
| 67 | overflow = 0x80 |
| 68 | }; |
| 69 | |
| 70 | #pragma pack(push, 1) |
Jason M. Bills | e2d1aee | 2018-10-03 15:57:18 -0700 | [diff] [blame] | 71 | struct GetFRUAreaReq |
| 72 | { |
| 73 | uint8_t fruDeviceID; |
| 74 | uint16_t fruInventoryOffset; |
| 75 | uint8_t countToRead; |
| 76 | }; |
| 77 | |
Jason M. Bills | e2d1aee | 2018-10-03 15:57:18 -0700 | [diff] [blame] | 78 | struct WriteFRUDataReq |
| 79 | { |
| 80 | uint8_t fruDeviceID; |
| 81 | uint16_t fruInventoryOffset; |
| 82 | uint8_t data[]; |
| 83 | }; |
Jason M. Bills | 3f7c5e4 | 2018-10-03 14:00:41 -0700 | [diff] [blame] | 84 | #pragma pack(pop) |
| 85 | |
Jason M. Bills | e2d1aee | 2018-10-03 15:57:18 -0700 | [diff] [blame] | 86 | enum class GetFRUAreaAccessType : uint8_t |
| 87 | { |
| 88 | byte = 0x0, |
| 89 | words = 0x1 |
| 90 | }; |
| 91 | |
Jason M. Bills | 3f7c5e4 | 2018-10-03 14:00:41 -0700 | [diff] [blame] | 92 | enum class SensorUnits : uint8_t |
| 93 | { |
| 94 | unspecified = 0x0, |
| 95 | degreesC = 0x1, |
| 96 | volts = 0x4, |
| 97 | amps = 0x5, |
| 98 | watts = 0x6, |
| 99 | rpm = 0x12, |
| 100 | }; |
| 101 | |
| 102 | enum class IPMINetfnStorageCmds : ipmi_cmd_t |
| 103 | { |
Jason M. Bills | 3f7c5e4 | 2018-10-03 14:00:41 -0700 | [diff] [blame] | 104 | ipmiCmdReadFRUData = 0x11, |
| 105 | ipmiCmdWriteFRUData = 0x12, |
| 106 | ipmiCmdGetRepositoryInfo = 0x20, |
| 107 | ipmiCmdGetSDRAllocationInfo = 0x21, |
| 108 | ipmiCmdReserveSDR = 0x22, |
| 109 | ipmiCmdGetSDR = 0x23, |
Jason M. Bills | 3f7c5e4 | 2018-10-03 14:00:41 -0700 | [diff] [blame] | 110 | }; |
| 111 | |
Jason M. Bills | e2d1aee | 2018-10-03 15:57:18 -0700 | [diff] [blame] | 112 | #pragma pack(push, 1) |
| 113 | struct FRUHeader |
| 114 | { |
| 115 | uint8_t commonHeaderFormat; |
| 116 | uint8_t internalOffset; |
| 117 | uint8_t chassisOffset; |
| 118 | uint8_t boardOffset; |
| 119 | uint8_t productOffset; |
| 120 | uint8_t multiRecordOffset; |
| 121 | uint8_t pad; |
| 122 | uint8_t checksum; |
| 123 | }; |
| 124 | #pragma pack(pop) |
| 125 | |
Jason M. Bills | 3f7c5e4 | 2018-10-03 14:00:41 -0700 | [diff] [blame] | 126 | namespace ipmi |
| 127 | { |
| 128 | namespace storage |
| 129 | { |
| 130 | ipmi_ret_t getFruSdrs(size_t index, get_sdr::SensorDataFruRecord& resp); |
| 131 | |
| 132 | ipmi_ret_t getFruSdrCount(size_t& count); |
| 133 | } // namespace storage |
| 134 | } // namespace ipmi |