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 |
| 18 | #include <ipmid/api.h> |
| 19 | |
| 20 | #include <oemcommands.hpp> |
| 21 | |
| 22 | constexpr uint8_t maxDirEntries = 4; |
| 23 | constexpr uint16_t msgPayloadSize = 1024 * 60; |
| 24 | constexpr uint32_t smbiosTableStorageSize = 64 * 1024; |
| 25 | constexpr uint32_t mdriiSMSize = 0x00100000; |
| 26 | |
| 27 | struct DataIdStruct |
| 28 | { |
| 29 | uint8_t dataInfo[16]; |
| 30 | } __attribute__((packed)); |
| 31 | |
| 32 | struct Mdr2DirEntry |
| 33 | { |
| 34 | DataIdStruct Id; |
| 35 | uint32_t size; |
| 36 | uint32_t dataSetSize; |
| 37 | uint32_t dataVersion; |
| 38 | uint32_t timestamp; |
| 39 | } __attribute__((packed)); |
| 40 | |
| 41 | // ====================== MDR II Pull Command Structures ====================== |
| 42 | // MDR II Pull Agent status inquiry command |
| 43 | struct MDRiiGetAgentStatus |
| 44 | { |
| 45 | uint16_t agentId; |
| 46 | uint8_t dirVersion; |
| 47 | } __attribute__((packed)); |
| 48 | |
| 49 | // MDR II status inquiry response |
| 50 | struct MDRiiAgentStatusResponse |
| 51 | { |
| 52 | uint8_t mdrVersion; |
| 53 | uint8_t agentVersion; |
| 54 | uint8_t dirVersion; |
| 55 | uint8_t dirEntries; |
| 56 | uint8_t dataRequest; |
| 57 | } __attribute__((packed)); |
| 58 | |
| 59 | // MDR II Pull Agent directory information inquiry command |
| 60 | struct MDRiiGetDirRequest |
| 61 | { |
| 62 | uint16_t agentId; |
| 63 | uint8_t dirIndex; |
| 64 | } __attribute__((packed)); |
| 65 | |
| 66 | // MDR II directory information inquiry response |
| 67 | struct MDRiiGetDirResponse |
| 68 | { |
| 69 | uint8_t mdrVersion; |
| 70 | uint8_t dirVersion; |
| 71 | uint8_t returnedEntries; |
| 72 | uint8_t remainingEntries; |
| 73 | uint8_t data[1]; |
| 74 | } __attribute__((packed)); |
| 75 | |
| 76 | // MDR II Pull Agent data set information inquiry command |
| 77 | struct MDRiiGetDataInfoRequest |
| 78 | { |
| 79 | uint16_t agentId; |
| 80 | DataIdStruct dataSetInfo; |
| 81 | } __attribute__((packed)); |
| 82 | |
| 83 | // MDR II data set information inquiry response |
| 84 | struct MDRiiGetDataInfoResponse |
| 85 | { |
| 86 | uint8_t mdrVersion; |
| 87 | DataIdStruct dataSetId; |
| 88 | uint8_t validFlag; |
| 89 | uint32_t dataLength; |
| 90 | uint32_t dataVersion; |
| 91 | uint32_t timeStamp; |
| 92 | } __attribute__((packed)); |
| 93 | |
| 94 | // MDR II Pull Agent lock data set command |
| 95 | struct MDRiiLockDataRequest |
| 96 | { |
| 97 | uint16_t agentId; |
| 98 | DataIdStruct dataSetInfo; |
| 99 | uint16_t timeout; |
| 100 | } __attribute__((packed)); |
| 101 | |
| 102 | // MDR II Pull Agent lock data set response |
| 103 | struct MDRiiLockDataResponse |
| 104 | { |
| 105 | uint8_t mdrVersion; |
| 106 | uint16_t lockHandle; |
| 107 | uint32_t dataLength; |
| 108 | uint32_t xferAddress; |
| 109 | uint32_t xferLength; |
| 110 | } __attribute__((packed)); |
| 111 | |
| 112 | // MDR II Pull Agent unlock data set command |
| 113 | struct MDRiiUnlockDataRequest |
| 114 | { |
| 115 | uint16_t agentId; |
| 116 | uint16_t lockHandle; |
| 117 | } __attribute__((packed)); |
| 118 | |
| 119 | // MDR II Pull Agent get data block command |
| 120 | struct MDRiiGetDataBlockRequest |
| 121 | { |
| 122 | uint16_t agentId; |
| 123 | uint16_t lockHandle; |
| 124 | uint32_t xferOffset; |
| 125 | uint32_t xferLength; |
| 126 | } __attribute__((packed)); |
| 127 | |
| 128 | // MDR II Pull Agent get data block response |
| 129 | struct MDRiiGetDataBlockResponse |
| 130 | { |
| 131 | uint32_t xferLength; |
| 132 | uint32_t checksum; |
| 133 | uint8_t data[msgPayloadSize]; |
| 134 | } __attribute__((packed)); |
| 135 | |
| 136 | // ====================== MDR II Push Command Structures ====================== |
| 137 | // MDR II Push Agent send dir info command |
| 138 | struct MDRiiSendDirRequest |
| 139 | { |
| 140 | uint16_t agentId; |
| 141 | uint8_t dirVersion; |
| 142 | uint8_t dirIndex; |
| 143 | uint8_t returnedEntries; |
| 144 | uint8_t remainingEntries; |
| 145 | Mdr2DirEntry data[1]; // place holder for N directory entries |
| 146 | } __attribute__((packed)); |
| 147 | |
| 148 | // MDR II Push Agent offer data set info command |
| 149 | struct MDRiiOfferDataInfo |
| 150 | { |
| 151 | uint16_t agentId; |
| 152 | } __attribute__((packed)); |
| 153 | |
| 154 | // MDR II Client send data set info offer response |
| 155 | struct MDRiiOfferDataInfoResponse |
| 156 | { |
| 157 | DataIdStruct dataSetInfo; |
| 158 | } __attribute__((packed)); |
| 159 | |
| 160 | // MDR II Push Agent send data set info command |
| 161 | struct MDRiiSendDataInfoRequest |
| 162 | { |
| 163 | uint16_t agentId; |
| 164 | DataIdStruct dataSetInfo; |
| 165 | uint8_t validFlag; |
| 166 | uint32_t dataLength; |
| 167 | uint32_t dataVersion; // Roughly equivalent to the "file name" |
| 168 | uint32_t |
| 169 | timeStamp; // More info on the identity of this particular set of data |
| 170 | } __attribute__((packed)); |
| 171 | |
| 172 | // MDR II Push Agent send data start command |
| 173 | struct MDRiiDataStartRequest |
| 174 | { |
| 175 | uint16_t agentId; |
| 176 | DataIdStruct dataSetInfo; |
| 177 | uint32_t dataLength; |
| 178 | uint32_t xferAddress; |
| 179 | uint32_t xferLength; |
| 180 | uint16_t timeout; |
| 181 | } __attribute__((packed)); |
| 182 | |
| 183 | // MDR II Client send data start response |
| 184 | struct MDRiiDataStartResponse |
| 185 | { |
| 186 | uint8_t xferStartAck; |
| 187 | uint16_t sessionHandle; |
| 188 | } __attribute__((packed)); |
| 189 | |
| 190 | // MDR II |
| 191 | struct MDRiiDataDoneRequest |
| 192 | { |
| 193 | uint16_t agentId; |
| 194 | uint16_t lockHandle; |
| 195 | } __attribute__((packed)); |
| 196 | |
| 197 | // MDR II Push Agent send data block command |
| 198 | struct MDRiiSendDataBlockRequest |
| 199 | { |
| 200 | uint16_t agentId; |
| 201 | uint16_t lockHandle; |
| 202 | uint32_t xferOffset; |
| 203 | uint32_t xferLength; |
| 204 | uint32_t checksum; |
| 205 | } __attribute__((packed)); |