Vernon Mauery | a3702c1 | 2019-05-22 13:20:59 -0700 | [diff] [blame] | 1 | /* |
| 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 Feist | fcd2d3a | 2020-05-28 10:38:15 -0700 | [diff] [blame] | 18 | #include "ipmid/api.h" |
| 19 | |
Vernon Mauery | a3702c1 | 2019-05-22 13:20:59 -0700 | [diff] [blame] | 20 | #include <oemcommands.hpp> |
| 21 | |
James Feist | fcd2d3a | 2020-05-28 10:38:15 -0700 | [diff] [blame] | 22 | #include <cstddef> |
| 23 | #include <cstdint> |
Vernon Mauery | a3702c1 | 2019-05-22 13:20:59 -0700 | [diff] [blame] | 24 | |
| 25 | constexpr uint16_t msgPayloadSize = 1024 * 60; |
| 26 | |
| 27 | typedef enum |
| 28 | { |
| 29 | regionLockUnlocked = 0, |
| 30 | regionLockStrict, |
| 31 | regionLockPreemptable |
| 32 | } MDRLockType; |
| 33 | |
| 34 | typedef struct |
| 35 | { |
| 36 | uint8_t DirVer; |
| 37 | uint8_t MDRType; |
| 38 | uint16_t timestamp; |
| 39 | uint16_t DataSize; |
| 40 | } __attribute__((packed)) MDRSmbios_Header; |
| 41 | |
| 42 | typedef 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 | |
| 54 | struct RegionStatusRequest |
| 55 | { |
| 56 | uint8_t regionId; |
| 57 | } __attribute__((packed)); |
| 58 | |
| 59 | struct RegionStatusResponse |
| 60 | { |
| 61 | MDRState State; |
| 62 | } __attribute__((packed)); |
| 63 | |
James Feist | a73cb81 | 2019-08-14 10:17:02 -0700 | [diff] [blame] | 64 | struct RegionCompleteRequest |
| 65 | { |
| 66 | uint8_t sessionId; |
| 67 | uint8_t regionId; |
| 68 | } __attribute__((packed)); |
| 69 | |
Vernon Mauery | a3702c1 | 2019-05-22 13:20:59 -0700 | [diff] [blame] | 70 | struct RegionReadRequest |
| 71 | { |
| 72 | uint8_t regionId; |
| 73 | uint8_t length; |
| 74 | uint16_t offset; |
| 75 | } __attribute__((packed)); |
| 76 | |
| 77 | struct RegionReadResponse |
| 78 | { |
| 79 | uint8_t length; |
| 80 | uint8_t updateCount; |
| 81 | uint8_t data[msgPayloadSize]; |
| 82 | } __attribute__((packed)); |
| 83 | |
James Feist | a73cb81 | 2019-08-14 10:17:02 -0700 | [diff] [blame] | 84 | struct 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 | |
| 93 | struct RegionLockRequest |
| 94 | { |
| 95 | uint8_t sessionId; |
| 96 | uint8_t regionId; |
| 97 | uint8_t lockPolicy; |
| 98 | uint16_t msTimeout; |
| 99 | } __attribute__((packed)); |
| 100 | |
Vernon Mauery | a3702c1 | 2019-05-22 13:20:59 -0700 | [diff] [blame] | 101 | constexpr size_t maxMDRId = 5; |