| 1 | /* SPDX-License-Identifier: MIT */ |
| 2 | /* |
| 3 | * Copyright © 2023 Intel Corporation |
| 4 | */ |
| 5 | |
| 6 | #ifndef _INTEL_GSC_BINARY_HEADERS_H_ |
| 7 | #define |
| 8 | |
| 9 | #include <linux/types.h> |
| 10 | |
| 11 | struct intel_gsc_version { |
| 12 | u16 major; |
| 13 | u16 minor; |
| 14 | u16 hotfix; |
| 15 | u16 build; |
| 16 | } __packed; |
| 17 | |
| 18 | struct intel_gsc_partition { |
| 19 | u32 offset; |
| 20 | u32 size; |
| 21 | } __packed; |
| 22 | |
| 23 | struct intel_gsc_layout_pointers { |
| 24 | u8 rom_bypass_vector[16]; |
| 25 | |
| 26 | /* size of pointers layout not including ROM bypass vector */ |
| 27 | u16 size; |
| 28 | |
| 29 | /* |
| 30 | * bit0: Backup copy of layout pointers exist |
| 31 | * bits1-15: reserved |
| 32 | */ |
| 33 | u8 flags; |
| 34 | |
| 35 | u8 reserved; |
| 36 | |
| 37 | u32 crc32; |
| 38 | |
| 39 | struct intel_gsc_partition datap; |
| 40 | struct intel_gsc_partition boot1; |
| 41 | struct intel_gsc_partition boot2; |
| 42 | struct intel_gsc_partition boot3; |
| 43 | struct intel_gsc_partition boot4; |
| 44 | struct intel_gsc_partition boot5; |
| 45 | struct intel_gsc_partition temp_pages; |
| 46 | } __packed; |
| 47 | |
| 48 | /* Boot partition structures */ |
| 49 | struct { |
| 50 | u32 ; |
| 51 | #define 0x000055AA |
| 52 | |
| 53 | u16 ; /* num of entries after the header */ |
| 54 | |
| 55 | u8 ; |
| 56 | u8 ; |
| 57 | |
| 58 | u32 ; |
| 59 | |
| 60 | u32 ; |
| 61 | struct intel_gsc_version ; |
| 62 | } __packed; |
| 63 | |
| 64 | struct intel_gsc_bpdt_entry { |
| 65 | /* |
| 66 | * Bits 0-15: BPDT entry type |
| 67 | * Bits 16-17: reserved |
| 68 | * Bit 18: code sub-partition |
| 69 | * Bits 19-31: reserved |
| 70 | */ |
| 71 | u32 type; |
| 72 | #define INTEL_GSC_BPDT_ENTRY_TYPE_MASK GENMASK(15, 0) |
| 73 | #define INTEL_GSC_BPDT_ENTRY_TYPE_GSC_RBE 0x1 |
| 74 | |
| 75 | u32 sub_partition_offset; /* from the base of the BPDT header */ |
| 76 | u32 sub_partition_size; |
| 77 | } __packed; |
| 78 | |
| 79 | /* Code partition directory (CPD) structures */ |
| 80 | struct { |
| 81 | u32 ; |
| 82 | #define 0x44504324 |
| 83 | |
| 84 | u32 ; |
| 85 | u8 ; |
| 86 | u8 ; |
| 87 | u8 ; /* in bytes */ |
| 88 | u8 ; |
| 89 | u32 ; |
| 90 | u32 ; |
| 91 | } __packed; |
| 92 | |
| 93 | struct intel_gsc_cpd_entry { |
| 94 | u8 name[12]; |
| 95 | |
| 96 | /* |
| 97 | * Bits 0-24: offset from the beginning of the code partition |
| 98 | * Bit 25: huffman compressed |
| 99 | * Bits 26-31: reserved |
| 100 | */ |
| 101 | u32 offset; |
| 102 | #define INTEL_GSC_CPD_ENTRY_OFFSET_MASK GENMASK(24, 0) |
| 103 | #define INTEL_GSC_CPD_ENTRY_HUFFMAN_COMP BIT(25) |
| 104 | |
| 105 | /* |
| 106 | * Module/Item length, in bytes. For Huffman-compressed modules, this |
| 107 | * refers to the uncompressed size. For software-compressed modules, |
| 108 | * this refers to the compressed size. |
| 109 | */ |
| 110 | u32 length; |
| 111 | |
| 112 | u8 reserved[4]; |
| 113 | } __packed; |
| 114 | |
| 115 | struct { |
| 116 | u32 ; /* 0x4 for manifest type */ |
| 117 | u32 ; /* in dwords */ |
| 118 | u32 ; |
| 119 | u32 ; |
| 120 | u32 ; |
| 121 | u32 ; |
| 122 | u32 ; /* In dwords, size of entire manifest (header + extensions) */ |
| 123 | u32 ; |
| 124 | u32 ; |
| 125 | struct intel_gsc_version ; |
| 126 | u32 ; |
| 127 | struct intel_gsc_version ; |
| 128 | u32 ; |
| 129 | u8 [4]; |
| 130 | u8 [56]; |
| 131 | u32 ; /* in dwords */ |
| 132 | u32 ; /* in dwords */ |
| 133 | } __packed; |
| 134 | |
| 135 | #endif |
| 136 | |