blob: ef32c7416627dc72795bc21ae5ea46a59bf2535f [file] [log] [blame]
Jason M. Bills3f7c5e42018-10-03 14:00:41 -07001/*
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
21static constexpr uint8_t ipmiSdrVersion = 0x51;
22
23#pragma pack(push, 1)
24struct 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
35struct GetSDRReq
36{
37 uint16_t reservationID;
38 uint16_t recordID;
39 uint8_t offset;
40 uint8_t bytesToRead;
41};
42#pragma pack(pop)
43
44enum 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)
57struct 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
71enum 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
81enum 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
91enum 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
110namespace ipmi
111{
112namespace storage
113{
114ipmi_ret_t getFruSdrs(size_t index, get_sdr::SensorDataFruRecord& resp);
115
116ipmi_ret_t getFruSdrCount(size_t& count);
117} // namespace storage
118} // namespace ipmi