blob: 97ecbb7d41d8c9ce89bcc225c361dc299f8582f8 [file] [log] [blame]
Vernon Mauerya3702c12019-05-22 13:20:59 -07001/*
2// Copyright (c) 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
James Feistfcd2d3a2020-05-28 10:38:15 -070018#include "ipmid/api.h"
19
Vernon Mauerya3702c12019-05-22 13:20:59 -070020#include <oemcommands.hpp>
21
James Feistfcd2d3a2020-05-28 10:38:15 -070022#include <cstddef>
23#include <cstdint>
Vernon Mauerya3702c12019-05-22 13:20:59 -070024
25constexpr uint16_t msgPayloadSize = 1024 * 60;
26
27typedef enum
28{
29 regionLockUnlocked = 0,
30 regionLockStrict,
31 regionLockPreemptable
32} MDRLockType;
33
34typedef struct
35{
36 uint8_t DirVer;
37 uint8_t MDRType;
38 uint16_t timestamp;
39 uint16_t DataSize;
40} __attribute__((packed)) MDRSmbios_Header;
41
42typedef struct
43{
44 uint8_t MdrVersion;
45 uint8_t regionId;
46 bool valid;
47 uint8_t updateCount;
48 uint8_t lockPolicy;
49 uint16_t regionLength;
50 uint16_t regionUsed;
51 uint8_t CRC8;
52} __attribute__((packed)) MDRState;
53
54struct RegionStatusRequest
55{
56 uint8_t regionId;
57} __attribute__((packed));
58
59struct RegionStatusResponse
60{
61 MDRState State;
62} __attribute__((packed));
63
James Feista73cb812019-08-14 10:17:02 -070064struct RegionCompleteRequest
65{
66 uint8_t sessionId;
67 uint8_t regionId;
68} __attribute__((packed));
69
Vernon Mauerya3702c12019-05-22 13:20:59 -070070struct RegionReadRequest
71{
72 uint8_t regionId;
73 uint8_t length;
74 uint16_t offset;
75} __attribute__((packed));
76
77struct RegionReadResponse
78{
79 uint8_t length;
80 uint8_t updateCount;
81 uint8_t data[msgPayloadSize];
82} __attribute__((packed));
83
James Feista73cb812019-08-14 10:17:02 -070084struct RegionWriteRequest
85{
86 uint8_t sessionId;
87 uint8_t regionId;
88 uint8_t length;
89 uint16_t offset;
90 uint8_t data[msgPayloadSize];
91} __attribute__((packed));
92
93struct RegionLockRequest
94{
95 uint8_t sessionId;
96 uint8_t regionId;
97 uint8_t lockPolicy;
98 uint16_t msTimeout;
99} __attribute__((packed));
100
Vernon Mauerya3702c12019-05-22 13:20:59 -0700101constexpr size_t maxMDRId = 5;