xref: /openbmc/intel-ipmi-oem/include/smbiosmdrv2.hpp (revision a3702c1f160b7995c4bf5df2654a29cd79be057f)
1*a3702c1fSVernon Mauery /*
2*a3702c1fSVernon Mauery // Copyright (c) 2018 Intel Corporation
3*a3702c1fSVernon Mauery //
4*a3702c1fSVernon Mauery // Licensed under the Apache License, Version 2.0 (the "License");
5*a3702c1fSVernon Mauery // you may not use this file except in compliance with the License.
6*a3702c1fSVernon Mauery // You may obtain a copy of the License at
7*a3702c1fSVernon Mauery //
8*a3702c1fSVernon Mauery //      http://www.apache.org/licenses/LICENSE-2.0
9*a3702c1fSVernon Mauery //
10*a3702c1fSVernon Mauery // Unless required by applicable law or agreed to in writing, software
11*a3702c1fSVernon Mauery // distributed under the License is distributed on an "AS IS" BASIS,
12*a3702c1fSVernon Mauery // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*a3702c1fSVernon Mauery // See the License for the specific language governing permissions and
14*a3702c1fSVernon Mauery // limitations under the License.
15*a3702c1fSVernon Mauery */
16*a3702c1fSVernon Mauery 
17*a3702c1fSVernon Mauery #pragma once
18*a3702c1fSVernon Mauery #include <ipmid/api.h>
19*a3702c1fSVernon Mauery 
20*a3702c1fSVernon Mauery #include <oemcommands.hpp>
21*a3702c1fSVernon Mauery 
22*a3702c1fSVernon Mauery constexpr uint8_t maxDirEntries = 4;
23*a3702c1fSVernon Mauery constexpr uint16_t msgPayloadSize = 1024 * 60;
24*a3702c1fSVernon Mauery constexpr uint32_t smbiosTableStorageSize = 64 * 1024;
25*a3702c1fSVernon Mauery constexpr uint32_t mdriiSMSize = 0x00100000;
26*a3702c1fSVernon Mauery 
27*a3702c1fSVernon Mauery struct DataIdStruct
28*a3702c1fSVernon Mauery {
29*a3702c1fSVernon Mauery     uint8_t dataInfo[16];
30*a3702c1fSVernon Mauery } __attribute__((packed));
31*a3702c1fSVernon Mauery 
32*a3702c1fSVernon Mauery struct Mdr2DirEntry
33*a3702c1fSVernon Mauery {
34*a3702c1fSVernon Mauery     DataIdStruct Id;
35*a3702c1fSVernon Mauery     uint32_t size;
36*a3702c1fSVernon Mauery     uint32_t dataSetSize;
37*a3702c1fSVernon Mauery     uint32_t dataVersion;
38*a3702c1fSVernon Mauery     uint32_t timestamp;
39*a3702c1fSVernon Mauery } __attribute__((packed));
40*a3702c1fSVernon Mauery 
41*a3702c1fSVernon Mauery // ====================== MDR II Pull Command Structures ======================
42*a3702c1fSVernon Mauery // MDR II Pull Agent status inquiry command
43*a3702c1fSVernon Mauery struct MDRiiGetAgentStatus
44*a3702c1fSVernon Mauery {
45*a3702c1fSVernon Mauery     uint16_t agentId;
46*a3702c1fSVernon Mauery     uint8_t dirVersion;
47*a3702c1fSVernon Mauery } __attribute__((packed));
48*a3702c1fSVernon Mauery 
49*a3702c1fSVernon Mauery // MDR II status inquiry response
50*a3702c1fSVernon Mauery struct MDRiiAgentStatusResponse
51*a3702c1fSVernon Mauery {
52*a3702c1fSVernon Mauery     uint8_t mdrVersion;
53*a3702c1fSVernon Mauery     uint8_t agentVersion;
54*a3702c1fSVernon Mauery     uint8_t dirVersion;
55*a3702c1fSVernon Mauery     uint8_t dirEntries;
56*a3702c1fSVernon Mauery     uint8_t dataRequest;
57*a3702c1fSVernon Mauery } __attribute__((packed));
58*a3702c1fSVernon Mauery 
59*a3702c1fSVernon Mauery // MDR II Pull Agent directory information inquiry command
60*a3702c1fSVernon Mauery struct MDRiiGetDirRequest
61*a3702c1fSVernon Mauery {
62*a3702c1fSVernon Mauery     uint16_t agentId;
63*a3702c1fSVernon Mauery     uint8_t dirIndex;
64*a3702c1fSVernon Mauery } __attribute__((packed));
65*a3702c1fSVernon Mauery 
66*a3702c1fSVernon Mauery // MDR II directory information inquiry response
67*a3702c1fSVernon Mauery struct MDRiiGetDirResponse
68*a3702c1fSVernon Mauery {
69*a3702c1fSVernon Mauery     uint8_t mdrVersion;
70*a3702c1fSVernon Mauery     uint8_t dirVersion;
71*a3702c1fSVernon Mauery     uint8_t returnedEntries;
72*a3702c1fSVernon Mauery     uint8_t remainingEntries;
73*a3702c1fSVernon Mauery     uint8_t data[1];
74*a3702c1fSVernon Mauery } __attribute__((packed));
75*a3702c1fSVernon Mauery 
76*a3702c1fSVernon Mauery // MDR II Pull Agent data set information inquiry command
77*a3702c1fSVernon Mauery struct MDRiiGetDataInfoRequest
78*a3702c1fSVernon Mauery {
79*a3702c1fSVernon Mauery     uint16_t agentId;
80*a3702c1fSVernon Mauery     DataIdStruct dataSetInfo;
81*a3702c1fSVernon Mauery } __attribute__((packed));
82*a3702c1fSVernon Mauery 
83*a3702c1fSVernon Mauery // MDR II data set information inquiry response
84*a3702c1fSVernon Mauery struct MDRiiGetDataInfoResponse
85*a3702c1fSVernon Mauery {
86*a3702c1fSVernon Mauery     uint8_t mdrVersion;
87*a3702c1fSVernon Mauery     DataIdStruct dataSetId;
88*a3702c1fSVernon Mauery     uint8_t validFlag;
89*a3702c1fSVernon Mauery     uint32_t dataLength;
90*a3702c1fSVernon Mauery     uint32_t dataVersion;
91*a3702c1fSVernon Mauery     uint32_t timeStamp;
92*a3702c1fSVernon Mauery } __attribute__((packed));
93*a3702c1fSVernon Mauery 
94*a3702c1fSVernon Mauery // MDR II Pull Agent lock data set command
95*a3702c1fSVernon Mauery struct MDRiiLockDataRequest
96*a3702c1fSVernon Mauery {
97*a3702c1fSVernon Mauery     uint16_t agentId;
98*a3702c1fSVernon Mauery     DataIdStruct dataSetInfo;
99*a3702c1fSVernon Mauery     uint16_t timeout;
100*a3702c1fSVernon Mauery } __attribute__((packed));
101*a3702c1fSVernon Mauery 
102*a3702c1fSVernon Mauery // MDR II Pull Agent lock data set response
103*a3702c1fSVernon Mauery struct MDRiiLockDataResponse
104*a3702c1fSVernon Mauery {
105*a3702c1fSVernon Mauery     uint8_t mdrVersion;
106*a3702c1fSVernon Mauery     uint16_t lockHandle;
107*a3702c1fSVernon Mauery     uint32_t dataLength;
108*a3702c1fSVernon Mauery     uint32_t xferAddress;
109*a3702c1fSVernon Mauery     uint32_t xferLength;
110*a3702c1fSVernon Mauery } __attribute__((packed));
111*a3702c1fSVernon Mauery 
112*a3702c1fSVernon Mauery // MDR II Pull Agent unlock data set command
113*a3702c1fSVernon Mauery struct MDRiiUnlockDataRequest
114*a3702c1fSVernon Mauery {
115*a3702c1fSVernon Mauery     uint16_t agentId;
116*a3702c1fSVernon Mauery     uint16_t lockHandle;
117*a3702c1fSVernon Mauery } __attribute__((packed));
118*a3702c1fSVernon Mauery 
119*a3702c1fSVernon Mauery // MDR II Pull Agent get data block command
120*a3702c1fSVernon Mauery struct MDRiiGetDataBlockRequest
121*a3702c1fSVernon Mauery {
122*a3702c1fSVernon Mauery     uint16_t agentId;
123*a3702c1fSVernon Mauery     uint16_t lockHandle;
124*a3702c1fSVernon Mauery     uint32_t xferOffset;
125*a3702c1fSVernon Mauery     uint32_t xferLength;
126*a3702c1fSVernon Mauery } __attribute__((packed));
127*a3702c1fSVernon Mauery 
128*a3702c1fSVernon Mauery // MDR II Pull Agent get data block response
129*a3702c1fSVernon Mauery struct MDRiiGetDataBlockResponse
130*a3702c1fSVernon Mauery {
131*a3702c1fSVernon Mauery     uint32_t xferLength;
132*a3702c1fSVernon Mauery     uint32_t checksum;
133*a3702c1fSVernon Mauery     uint8_t data[msgPayloadSize];
134*a3702c1fSVernon Mauery } __attribute__((packed));
135*a3702c1fSVernon Mauery 
136*a3702c1fSVernon Mauery // ====================== MDR II Push Command Structures ======================
137*a3702c1fSVernon Mauery // MDR II Push Agent send dir info command
138*a3702c1fSVernon Mauery struct MDRiiSendDirRequest
139*a3702c1fSVernon Mauery {
140*a3702c1fSVernon Mauery     uint16_t agentId;
141*a3702c1fSVernon Mauery     uint8_t dirVersion;
142*a3702c1fSVernon Mauery     uint8_t dirIndex;
143*a3702c1fSVernon Mauery     uint8_t returnedEntries;
144*a3702c1fSVernon Mauery     uint8_t remainingEntries;
145*a3702c1fSVernon Mauery     Mdr2DirEntry data[1]; // place holder for N directory entries
146*a3702c1fSVernon Mauery } __attribute__((packed));
147*a3702c1fSVernon Mauery 
148*a3702c1fSVernon Mauery // MDR II Push Agent offer data set info command
149*a3702c1fSVernon Mauery struct MDRiiOfferDataInfo
150*a3702c1fSVernon Mauery {
151*a3702c1fSVernon Mauery     uint16_t agentId;
152*a3702c1fSVernon Mauery } __attribute__((packed));
153*a3702c1fSVernon Mauery 
154*a3702c1fSVernon Mauery // MDR II Client send data set info offer response
155*a3702c1fSVernon Mauery struct MDRiiOfferDataInfoResponse
156*a3702c1fSVernon Mauery {
157*a3702c1fSVernon Mauery     DataIdStruct dataSetInfo;
158*a3702c1fSVernon Mauery } __attribute__((packed));
159*a3702c1fSVernon Mauery 
160*a3702c1fSVernon Mauery // MDR II Push Agent send data set info command
161*a3702c1fSVernon Mauery struct MDRiiSendDataInfoRequest
162*a3702c1fSVernon Mauery {
163*a3702c1fSVernon Mauery     uint16_t agentId;
164*a3702c1fSVernon Mauery     DataIdStruct dataSetInfo;
165*a3702c1fSVernon Mauery     uint8_t validFlag;
166*a3702c1fSVernon Mauery     uint32_t dataLength;
167*a3702c1fSVernon Mauery     uint32_t dataVersion; // Roughly equivalent to the "file name"
168*a3702c1fSVernon Mauery     uint32_t
169*a3702c1fSVernon Mauery         timeStamp; // More info on the identity of this particular set of data
170*a3702c1fSVernon Mauery } __attribute__((packed));
171*a3702c1fSVernon Mauery 
172*a3702c1fSVernon Mauery // MDR II Push Agent send data start command
173*a3702c1fSVernon Mauery struct MDRiiDataStartRequest
174*a3702c1fSVernon Mauery {
175*a3702c1fSVernon Mauery     uint16_t agentId;
176*a3702c1fSVernon Mauery     DataIdStruct dataSetInfo;
177*a3702c1fSVernon Mauery     uint32_t dataLength;
178*a3702c1fSVernon Mauery     uint32_t xferAddress;
179*a3702c1fSVernon Mauery     uint32_t xferLength;
180*a3702c1fSVernon Mauery     uint16_t timeout;
181*a3702c1fSVernon Mauery } __attribute__((packed));
182*a3702c1fSVernon Mauery 
183*a3702c1fSVernon Mauery // MDR II Client send data start response
184*a3702c1fSVernon Mauery struct MDRiiDataStartResponse
185*a3702c1fSVernon Mauery {
186*a3702c1fSVernon Mauery     uint8_t xferStartAck;
187*a3702c1fSVernon Mauery     uint16_t sessionHandle;
188*a3702c1fSVernon Mauery } __attribute__((packed));
189*a3702c1fSVernon Mauery 
190*a3702c1fSVernon Mauery // MDR II
191*a3702c1fSVernon Mauery struct MDRiiDataDoneRequest
192*a3702c1fSVernon Mauery {
193*a3702c1fSVernon Mauery     uint16_t agentId;
194*a3702c1fSVernon Mauery     uint16_t lockHandle;
195*a3702c1fSVernon Mauery } __attribute__((packed));
196*a3702c1fSVernon Mauery 
197*a3702c1fSVernon Mauery // MDR II Push Agent send data block command
198*a3702c1fSVernon Mauery struct MDRiiSendDataBlockRequest
199*a3702c1fSVernon Mauery {
200*a3702c1fSVernon Mauery     uint16_t agentId;
201*a3702c1fSVernon Mauery     uint16_t lockHandle;
202*a3702c1fSVernon Mauery     uint32_t xferOffset;
203*a3702c1fSVernon Mauery     uint32_t xferLength;
204*a3702c1fSVernon Mauery     uint32_t checksum;
205*a3702c1fSVernon Mauery } __attribute__((packed));
206