Ronald G. Minnich | 5d01ec0 | 2009-03-31 11:57:36 +0000 | [diff] [blame] | 1 | /* |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 2 | * Copyright (C) 2009 coresystems GmbH |
| 3 | * written by Patrick Georgi <patrick.georgi@coresystems.de> |
Werner Zeh | e9995f1 | 2016-01-14 13:22:37 +0100 | [diff] [blame] | 4 | * Copyright (C) 2016 Siemens AG |
Ronald G. Minnich | 5d01ec0 | 2009-03-31 11:57:36 +0000 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Ronald G. Minnich | 5d01ec0 | 2009-03-31 11:57:36 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
Stefan Reinauer | 6321758 | 2012-10-29 16:52:36 -0700 | [diff] [blame] | 16 | #ifndef __CBFS_H |
| 17 | #define __CBFS_H |
| 18 | |
Patrick Georgi | 89f2034 | 2015-10-01 15:54:04 +0200 | [diff] [blame] | 19 | #include "common.h" |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 20 | #include <stdint.h> |
Ronald G. Minnich | a8a133d | 2013-12-30 13:16:18 -0800 | [diff] [blame] | 21 | |
Patrick Georgi | 89f2034 | 2015-10-01 15:54:04 +0200 | [diff] [blame] | 22 | #include <vb2_api.h> |
| 23 | |
Patrick Georgi | 2c61506 | 2015-07-15 20:49:00 +0200 | [diff] [blame] | 24 | /* cbfstool will fail when trying to build a cbfs_file header that's larger |
| 25 | * than MAX_CBFS_FILE_HEADER_BUFFER. 1K should give plenty of room. */ |
| 26 | #define MAX_CBFS_FILE_HEADER_BUFFER 1024 |
| 27 | |
Ronald G. Minnich | a8a133d | 2013-12-30 13:16:18 -0800 | [diff] [blame] | 28 | /* create a magic number in host-byte order. |
| 29 | * b3 is the high order byte. |
| 30 | * in the coreboot tools, we go with the 32-bit |
| 31 | * magic number convention. |
| 32 | * This was an inline func but that breaks anything |
| 33 | * that uses it in a case statement. |
| 34 | */ |
| 35 | |
| 36 | #define makemagic(b3, b2, b1, b0)\ |
| 37 | (((b3)<<24) | ((b2) << 16) | ((b1) << 8) | (b0)) |
Ronald G. Minnich | 5d01ec0 | 2009-03-31 11:57:36 +0000 | [diff] [blame] | 38 | |
Patrick Georgi | 2062473 | 2015-07-17 21:35:46 +0200 | [diff] [blame] | 39 | /* To make CBFS more friendly to ROM, fill -1 (0xFF) instead of zero. */ |
| 40 | #define CBFS_CONTENT_DEFAULT_VALUE (-1) |
| 41 | |
Sol Boucher | 67a0a86 | 2015-03-18 12:36:27 -0700 | [diff] [blame] | 42 | // Alignment (in bytes) to be used when no master header is present |
| 43 | #define CBFS_ENTRY_ALIGNMENT 64 |
| 44 | |
David Hendricks | 90ca3b6 | 2012-11-16 14:48:22 -0800 | [diff] [blame] | 45 | #define CBFS_HEADER_MAGIC 0x4F524243 |
| 46 | #define CBFS_HEADPTR_ADDR_X86 0xFFFFFFFC |
Hung-Te Lin | 086842a | 2013-01-04 12:33:03 +0800 | [diff] [blame] | 47 | #define CBFS_HEADER_VERSION1 0x31313131 |
| 48 | #define CBFS_HEADER_VERSION2 0x31313132 |
| 49 | #define CBFS_HEADER_VERSION CBFS_HEADER_VERSION2 |
David Hendricks | 90ca3b6 | 2012-11-16 14:48:22 -0800 | [diff] [blame] | 50 | |
Patrick Georgi | 45acb34 | 2015-07-14 22:18:23 +0200 | [diff] [blame] | 51 | #define CBFS_ALIGNMENT 64 |
| 52 | |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 53 | struct cbfs_header { |
| 54 | uint32_t magic; |
| 55 | uint32_t version; |
| 56 | uint32_t romsize; |
| 57 | uint32_t bootblocksize; |
Patrick Georgi | 45acb34 | 2015-07-14 22:18:23 +0200 | [diff] [blame] | 58 | uint32_t align; /* hard coded to 64 byte */ |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 59 | uint32_t offset; |
David Hendricks | 90ca3b6 | 2012-11-16 14:48:22 -0800 | [diff] [blame] | 60 | uint32_t architecture; /* Version 2 */ |
| 61 | uint32_t pad[1]; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 62 | } __packed; |
Ronald G. Minnich | 5d01ec0 | 2009-03-31 11:57:36 +0000 | [diff] [blame] | 63 | |
David Hendricks | 90ca3b6 | 2012-11-16 14:48:22 -0800 | [diff] [blame] | 64 | #define CBFS_ARCHITECTURE_UNKNOWN 0xFFFFFFFF |
| 65 | #define CBFS_ARCHITECTURE_X86 0x00000001 |
Gabe Black | 51edd54 | 2013-09-30 23:00:33 -0700 | [diff] [blame] | 66 | #define CBFS_ARCHITECTURE_ARM 0x00000010 |
Ronald G. Minnich | 5f43184 | 2013-11-12 09:03:33 -0800 | [diff] [blame] | 67 | #define CBFS_ARCHITECTURE_AARCH64 0x0000aa64 |
Julius Werner | f96d905 | 2019-08-16 15:35:39 -0700 | [diff] [blame] | 68 | #define CBFS_ARCHITECTURE_MIPS 0x00000100 /* deprecated */ |
Ronald G. Minnich | 833bf20 | 2014-10-16 10:55:39 +0000 | [diff] [blame] | 69 | #define CBFS_ARCHITECTURE_RISCV 0xc001d0de |
Ronald G. Minnich | ed4aa04 | 2015-12-11 18:19:52 +0000 | [diff] [blame] | 70 | #define CBFS_ARCHITECTURE_PPC64 0x407570ff |
David Hendricks | 90ca3b6 | 2012-11-16 14:48:22 -0800 | [diff] [blame] | 71 | |
Hung-Te Lin | eab2c81 | 2013-01-29 01:56:17 +0800 | [diff] [blame] | 72 | #define CBFS_FILE_MAGIC "LARCHIVE" |
| 73 | |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 74 | struct cbfs_file { |
Stefan Reinauer | a1e4824 | 2011-10-21 14:24:57 -0700 | [diff] [blame] | 75 | uint8_t magic[8]; |
Patrick Georgi | 5dc01ac | 2015-07-15 16:40:44 +0200 | [diff] [blame] | 76 | /* length of file data */ |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 77 | uint32_t len; |
| 78 | uint32_t type; |
Patrick Georgi | 2c61506 | 2015-07-15 20:49:00 +0200 | [diff] [blame] | 79 | /* offset to struct cbfs_file_attribute or 0 */ |
Patrick Georgi | 0d618af | 2015-07-15 18:28:23 +0200 | [diff] [blame] | 80 | uint32_t attributes_offset; |
Patrick Georgi | 5dc01ac | 2015-07-15 16:40:44 +0200 | [diff] [blame] | 81 | /* length of header incl. variable data */ |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 82 | uint32_t offset; |
Patrick Georgi | c569b8b | 2015-07-15 16:42:38 +0200 | [diff] [blame] | 83 | char filename[]; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 84 | } __packed; |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 85 | |
Patrick Georgi | ab5754d | 2015-09-01 18:20:20 +0200 | [diff] [blame] | 86 | #if defined __GNUC__ && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 |
Patrick Georgi | 5dc01ac | 2015-07-15 16:40:44 +0200 | [diff] [blame] | 87 | _Static_assert(sizeof(struct cbfs_file) == 24, "cbfs_file size mismatch"); |
Patrick Georgi | 57c67e5 | 2015-09-01 12:37:41 +0200 | [diff] [blame] | 88 | #endif |
Patrick Georgi | 5dc01ac | 2015-07-15 16:40:44 +0200 | [diff] [blame] | 89 | |
Patrick Georgi | c6a8da7 | 2015-07-22 21:32:03 +0200 | [diff] [blame] | 90 | /* The common fields of extended cbfs file attributes. |
| 91 | Attributes are expected to start with tag/len, then append their |
| 92 | specific fields. */ |
| 93 | struct cbfs_file_attribute { |
| 94 | uint32_t tag; |
| 95 | /* len covers the whole structure, incl. tag and len */ |
| 96 | uint32_t len; |
| 97 | uint8_t data[0]; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 98 | } __packed; |
Patrick Georgi | c6a8da7 | 2015-07-22 21:32:03 +0200 | [diff] [blame] | 99 | |
Patrick Georgi | 2c61506 | 2015-07-15 20:49:00 +0200 | [diff] [blame] | 100 | /* Depending on how the header was initialized, it may be backed with 0x00 or |
| 101 | * 0xff. Support both. */ |
| 102 | #define CBFS_FILE_ATTR_TAG_UNUSED 0 |
| 103 | #define CBFS_FILE_ATTR_TAG_UNUSED2 0xffffffff |
Daisuke Nojiri | 8984a63 | 2015-07-09 15:07:45 -0700 | [diff] [blame] | 104 | #define CBFS_FILE_ATTR_TAG_COMPRESSION 0x42435a4c |
Patrick Georgi | 89f2034 | 2015-10-01 15:54:04 +0200 | [diff] [blame] | 105 | #define CBFS_FILE_ATTR_TAG_HASH 0x68736148 |
Daisuke Nojiri | ff906fb | 2017-10-30 17:38:04 -0700 | [diff] [blame] | 106 | #define CBFS_FILE_ATTR_TAG_POSITION 0x42435350 /* PSCB */ |
Werner Zeh | e9995f1 | 2016-01-14 13:22:37 +0100 | [diff] [blame] | 107 | #define CBFS_FILE_ATTR_TAG_ALIGNMENT 0x42434c41 /* ALCB */ |
Daisuke Nojiri | ff906fb | 2017-10-30 17:38:04 -0700 | [diff] [blame] | 108 | #define CBFS_FILE_ATTR_TAG_PADDING 0x47444150 /* PDNG */ |
Philipp Deppenwiese | 7ba5871 | 2018-11-20 13:54:49 +0100 | [diff] [blame] | 109 | #define CBFS_FILE_ATTR_TAG_IBB 0x32494242 /* Initial BootBlock */ |
Daisuke Nojiri | 8984a63 | 2015-07-09 15:07:45 -0700 | [diff] [blame] | 110 | |
| 111 | struct cbfs_file_attr_compression { |
| 112 | uint32_t tag; |
| 113 | uint32_t len; |
| 114 | /* whole file compression format. 0 if no compression. */ |
| 115 | uint32_t compression; |
| 116 | uint32_t decompressed_size; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 117 | } __packed; |
Patrick Georgi | 2c61506 | 2015-07-15 20:49:00 +0200 | [diff] [blame] | 118 | |
Patrick Georgi | 89f2034 | 2015-10-01 15:54:04 +0200 | [diff] [blame] | 119 | struct cbfs_file_attr_hash { |
| 120 | uint32_t tag; |
| 121 | uint32_t len; |
| 122 | uint32_t hash_type; |
| 123 | /* hash_data is len - sizeof(struct) bytes */ |
| 124 | uint8_t hash_data[]; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 125 | } __packed; |
Patrick Georgi | 89f2034 | 2015-10-01 15:54:04 +0200 | [diff] [blame] | 126 | |
Werner Zeh | e9995f1 | 2016-01-14 13:22:37 +0100 | [diff] [blame] | 127 | struct cbfs_file_attr_position { |
| 128 | uint32_t tag; |
| 129 | uint32_t len; |
| 130 | uint32_t position; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 131 | } __packed; |
Werner Zeh | e9995f1 | 2016-01-14 13:22:37 +0100 | [diff] [blame] | 132 | |
| 133 | struct cbfs_file_attr_align { |
| 134 | uint32_t tag; |
| 135 | uint32_t len; |
| 136 | uint32_t alignment; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 137 | } __packed; |
Werner Zeh | e9995f1 | 2016-01-14 13:22:37 +0100 | [diff] [blame] | 138 | |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 139 | struct cbfs_stage { |
Stefan Reinauer | a1e4824 | 2011-10-21 14:24:57 -0700 | [diff] [blame] | 140 | uint32_t compression; |
| 141 | uint64_t entry; |
| 142 | uint64_t load; |
| 143 | uint32_t len; |
| 144 | uint32_t memlen; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 145 | } __packed; |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 146 | |
Ronald G. Minnich | a8a133d | 2013-12-30 13:16:18 -0800 | [diff] [blame] | 147 | #define PAYLOAD_SEGMENT_CODE makemagic('C', 'O', 'D', 'E') |
| 148 | #define PAYLOAD_SEGMENT_DATA makemagic('D', 'A', 'T', 'A') |
Wei Hu | 2ad6ee9 | 2014-04-16 22:52:59 -0700 | [diff] [blame] | 149 | #define PAYLOAD_SEGMENT_BSS makemagic('B', 'S', 'S', ' ') |
Ronald G. Minnich | a8a133d | 2013-12-30 13:16:18 -0800 | [diff] [blame] | 150 | #define PAYLOAD_SEGMENT_PARAMS makemagic('P', 'A', 'R', 'A') |
| 151 | #define PAYLOAD_SEGMENT_ENTRY makemagic('E', 'N', 'T', 'R') |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 152 | |
| 153 | struct cbfs_payload_segment { |
Stefan Reinauer | a1e4824 | 2011-10-21 14:24:57 -0700 | [diff] [blame] | 154 | uint32_t type; |
| 155 | uint32_t compression; |
| 156 | uint32_t offset; |
| 157 | uint64_t load_addr; |
| 158 | uint32_t len; |
| 159 | uint32_t mem_len; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 160 | } __packed; |
Patrick Georgi | b7b56dd8 | 2009-09-14 13:29:27 +0000 | [diff] [blame] | 161 | |
| 162 | struct cbfs_payload { |
| 163 | struct cbfs_payload_segment segments; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 164 | } __packed; |
Ronald G. Minnich | 5d01ec0 | 2009-03-31 11:57:36 +0000 | [diff] [blame] | 165 | |
| 166 | /** These are standard component types for well known |
| 167 | components (i.e - those that coreboot needs to consume. |
| 168 | Users are welcome to use any other value for their |
| 169 | components */ |
| 170 | |
Patrick Georgi | 239c742 | 2015-09-09 20:11:26 +0200 | [diff] [blame] | 171 | #define CBFS_COMPONENT_BOOTBLOCK 0x01 |
| 172 | #define CBFS_COMPONENT_CBFSHEADER 0x02 |
Stefan Reinauer | 800379f | 2010-03-01 08:34:19 +0000 | [diff] [blame] | 173 | #define CBFS_COMPONENT_STAGE 0x10 |
Patrick Rudolph | 4f5bed5 | 2018-05-02 09:44:08 +0200 | [diff] [blame] | 174 | #define CBFS_COMPONENT_SELF 0x20 |
Patrick Rudolph | 7ee05ed | 2018-04-26 09:35:13 +0200 | [diff] [blame] | 175 | #define CBFS_COMPONENT_FIT 0x21 |
Stefan Reinauer | 800379f | 2010-03-01 08:34:19 +0000 | [diff] [blame] | 176 | #define CBFS_COMPONENT_OPTIONROM 0x30 |
| 177 | #define CBFS_COMPONENT_BOOTSPLASH 0x40 |
| 178 | #define CBFS_COMPONENT_RAW 0x50 |
| 179 | #define CBFS_COMPONENT_VSA 0x51 |
| 180 | #define CBFS_COMPONENT_MBI 0x52 |
| 181 | #define CBFS_COMPONENT_MICROCODE 0x53 |
Martin Roth | dde307c | 2015-03-24 15:54:20 -0600 | [diff] [blame] | 182 | #define CBFS_COMPONENT_FSP 0x60 |
| 183 | #define CBFS_COMPONENT_MRC 0x61 |
Pratik Prajapati | fb12873 | 2015-09-02 13:46:30 -0700 | [diff] [blame] | 184 | #define CBFS_COMPONENT_MMA 0x62 |
| 185 | #define CBFS_COMPONENT_EFI 0x63 |
Julius Werner | f975e55 | 2016-08-19 15:43:06 -0700 | [diff] [blame] | 186 | #define CBFS_COMPONENT_STRUCT 0x70 |
Patrick Georgi | a865b17 | 2011-01-14 07:40:24 +0000 | [diff] [blame] | 187 | #define CBFS_COMPONENT_CMOS_DEFAULT 0xaa |
Martin Roth | dde307c | 2015-03-24 15:54:20 -0600 | [diff] [blame] | 188 | #define CBFS_COMPONENT_SPD 0xab |
| 189 | #define CBFS_COMPONENT_MRC_CACHE 0xac |
Patrick Georgi | 2447937 | 2011-01-18 13:56:36 +0000 | [diff] [blame] | 190 | #define CBFS_COMPONENT_CMOS_LAYOUT 0x01aa |
Ronald G. Minnich | 5d01ec0 | 2009-03-31 11:57:36 +0000 | [diff] [blame] | 191 | |
Ronald G. Minnich | 83b8f0c | 2009-05-08 19:23:00 +0000 | [diff] [blame] | 192 | /* The deleted type is chosen to be a value |
| 193 | * that can be written in a FLASH from all other |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 194 | * values. |
Ronald G. Minnich | 83b8f0c | 2009-05-08 19:23:00 +0000 | [diff] [blame] | 195 | */ |
| 196 | #define CBFS_COMPONENT_DELETED 0 |
| 197 | |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 198 | /* for all known FLASH, this value can be changed |
| 199 | * to all other values. This allows NULL files to be |
Ronald G. Minnich | 83b8f0c | 2009-05-08 19:23:00 +0000 | [diff] [blame] | 200 | * changed without a block erase |
| 201 | */ |
Peter Stuge | 1d862de | 2009-04-14 00:08:34 +0000 | [diff] [blame] | 202 | #define CBFS_COMPONENT_NULL 0xFFFFFFFF |
Ronald G. Minnich | 5d01ec0 | 2009-03-31 11:57:36 +0000 | [diff] [blame] | 203 | |
Patrick Georgi | dc37dab | 2015-09-09 16:46:00 +0200 | [diff] [blame] | 204 | static struct typedesc_t filetypes[] unused = { |
Patrick Georgi | 239c742 | 2015-09-09 20:11:26 +0200 | [diff] [blame] | 205 | {CBFS_COMPONENT_BOOTBLOCK, "bootblock"}, |
| 206 | {CBFS_COMPONENT_CBFSHEADER, "cbfs header"}, |
Patrick Georgi | dc37dab | 2015-09-09 16:46:00 +0200 | [diff] [blame] | 207 | {CBFS_COMPONENT_STAGE, "stage"}, |
Ronald G. Minnich | c6d1349 | 2018-05-15 18:05:07 -0700 | [diff] [blame] | 208 | {CBFS_COMPONENT_SELF, "simple elf"}, |
Patrick Rudolph | 7ee05ed | 2018-04-26 09:35:13 +0200 | [diff] [blame] | 209 | {CBFS_COMPONENT_FIT, "fit"}, |
Patrick Georgi | dc37dab | 2015-09-09 16:46:00 +0200 | [diff] [blame] | 210 | {CBFS_COMPONENT_OPTIONROM, "optionrom"}, |
| 211 | {CBFS_COMPONENT_BOOTSPLASH, "bootsplash"}, |
| 212 | {CBFS_COMPONENT_RAW, "raw"}, |
| 213 | {CBFS_COMPONENT_VSA, "vsa"}, |
| 214 | {CBFS_COMPONENT_MBI, "mbi"}, |
| 215 | {CBFS_COMPONENT_MICROCODE, "microcode"}, |
| 216 | {CBFS_COMPONENT_FSP, "fsp"}, |
| 217 | {CBFS_COMPONENT_MRC, "mrc"}, |
| 218 | {CBFS_COMPONENT_CMOS_DEFAULT, "cmos_default"}, |
| 219 | {CBFS_COMPONENT_CMOS_LAYOUT, "cmos_layout"}, |
| 220 | {CBFS_COMPONENT_SPD, "spd"}, |
| 221 | {CBFS_COMPONENT_MRC_CACHE, "mrc_cache"}, |
Pratik Prajapati | fb12873 | 2015-09-02 13:46:30 -0700 | [diff] [blame] | 222 | {CBFS_COMPONENT_MMA, "mma"}, |
| 223 | {CBFS_COMPONENT_EFI, "efi"}, |
Julius Werner | f975e55 | 2016-08-19 15:43:06 -0700 | [diff] [blame] | 224 | {CBFS_COMPONENT_STRUCT, "struct"}, |
Patrick Georgi | dc37dab | 2015-09-09 16:46:00 +0200 | [diff] [blame] | 225 | {CBFS_COMPONENT_DELETED, "deleted"}, |
| 226 | {CBFS_COMPONENT_NULL, "null"} |
| 227 | }; |
| 228 | |
Patrick Georgi | 89f2034 | 2015-10-01 15:54:04 +0200 | [diff] [blame] | 229 | static const struct typedesc_t types_cbfs_hash[] unused = { |
| 230 | {VB2_HASH_INVALID, "none"}, |
| 231 | {VB2_HASH_SHA1, "sha1"}, |
| 232 | {VB2_HASH_SHA256, "sha256"}, |
| 233 | {VB2_HASH_SHA512, "sha512"}, |
| 234 | {0, NULL} |
| 235 | }; |
| 236 | |
| 237 | static size_t widths_cbfs_hash[] unused = { |
| 238 | [VB2_HASH_INVALID] = 0, |
| 239 | [VB2_HASH_SHA1] = 20, |
| 240 | [VB2_HASH_SHA256] = 32, |
| 241 | [VB2_HASH_SHA512] = 64, |
| 242 | }; |
| 243 | |
| 244 | #define CBFS_NUM_SUPPORTED_HASHES ARRAY_SIZE(widths_cbfs_hash) |
| 245 | |
Stefan Reinauer | db5b893 | 2013-01-18 15:53:22 -0800 | [diff] [blame] | 246 | #define CBFS_SUBHEADER(_p) ( (void *) ((((uint8_t *) (_p)) + ntohl((_p)->offset))) ) |
Patrick Georgi | 2c61506 | 2015-07-15 20:49:00 +0200 | [diff] [blame] | 247 | |
Ronald G. Minnich | a8a133d | 2013-12-30 13:16:18 -0800 | [diff] [blame] | 248 | /* cbfs_image.c */ |
| 249 | uint32_t get_cbfs_entry_type(const char *name, uint32_t default_value); |
Ronald G. Minnich | a8a133d | 2013-12-30 13:16:18 -0800 | [diff] [blame] | 250 | uint32_t get_cbfs_compression(const char *name, uint32_t unknown); |
Stefan Reinauer | db5b893 | 2013-01-18 15:53:22 -0800 | [diff] [blame] | 251 | |
Ronald G. Minnich | 818f369 | 2014-02-04 08:29:35 -0800 | [diff] [blame] | 252 | /* cbfs-mkpayload.c */ |
| 253 | void xdr_segs(struct buffer *output, |
| 254 | struct cbfs_payload_segment *segs, int nseg); |
Aaron Durbin | ca63027 | 2014-08-05 10:48:20 -0500 | [diff] [blame] | 255 | void xdr_get_seg(struct cbfs_payload_segment *out, |
| 256 | struct cbfs_payload_segment *in); |
Ronald G. Minnich | 818f369 | 2014-02-04 08:29:35 -0800 | [diff] [blame] | 257 | |
Stefan Reinauer | 6321758 | 2012-10-29 16:52:36 -0700 | [diff] [blame] | 258 | #endif |