Kuiying Wang | 6d6dc7a | 2020-04-02 10:15:19 +0800 | [diff] [blame] | 1 | /* |
| 2 | // Copyright (c) 2020 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 | |
| 19 | #include <array> |
| 20 | #include <fstream> |
| 21 | #include <iostream> |
| 22 | #include <string> |
| 23 | #include <variant> |
| 24 | #include <vector> |
| 25 | |
| 26 | constexpr uint8_t maxPayloadSupported = 0x6; |
| 27 | constexpr uint8_t maxHashSize = 64; |
| 28 | constexpr uint8_t maxSeedSize = 16; |
| 29 | constexpr uint8_t maxPasswordSize = 64; |
| 30 | |
| 31 | #pragma pack(push, 1) |
| 32 | struct PayloadStartTransfer |
| 33 | { |
| 34 | uint16_t payloadVersion; |
| 35 | uint32_t payloadTotalSize; |
| 36 | uint32_t payloadTotalChecksum; |
| 37 | uint8_t payloadFlag; |
| 38 | }; |
| 39 | #pragma pack(pop) |
| 40 | |
| 41 | struct PayloadInProgress |
| 42 | { |
| 43 | uint32_t payloadReservationID; |
| 44 | uint32_t payloadOffset; |
| 45 | uint32_t payloadCurrentSize; |
| 46 | uint32_t payloadCurrentChecksum; |
| 47 | }; |
| 48 | |
| 49 | struct PayloadEndTransfer |
| 50 | { |
| 51 | uint32_t payloadReservationID; |
| 52 | }; |
| 53 | |
| 54 | struct SetPayloadRetValue |
| 55 | { |
| 56 | uint32_t reservationToken; |
| 57 | uint32_t actualPayloadWritten; |
| 58 | uint32_t actualTotalPayloadWritten; |
| 59 | }; |
| 60 | |
| 61 | struct setBIOSCapabilitiesReq |
| 62 | { |
| 63 | uint8_t OOBCapability; |
| 64 | uint8_t reserved1; |
| 65 | uint8_t reserved2; |
| 66 | uint8_t reserved3; |
| 67 | }; |
| 68 | |
| 69 | struct PayloadInfo |
| 70 | { |
| 71 | uint32_t payloadReservationID; |
| 72 | uint8_t payloadType; |
| 73 | uint16_t payloadVersion; |
| 74 | uint32_t payloadTotalSize; |
| 75 | uint32_t payloadTotalChecksum; |
| 76 | uint8_t payloadStatus; |
| 77 | uint8_t payloadflag; |
| 78 | uint32_t payloadTimeStamp; |
| 79 | uint32_t payloadCurrentSize; |
| 80 | uint32_t payloadCurrentChecksum; |
| 81 | uint32_t actualTotalPayloadWritten; |
| 82 | std::string payloadFilePath; |
| 83 | }; |
| 84 | |
| 85 | struct NVOOBdata |
| 86 | { |
| 87 | setBIOSCapabilitiesReq mBIOSCapabilities; |
| 88 | uint8_t mIsBIOSCapInitDone; |
| 89 | PayloadInfo payloadInfo[maxPayloadSupported]; |
| 90 | }; |