1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only */ 2 3 #ifndef FLASHMAP_SERIALIZED_H__ 4 #define FLASHMAP_SERIALIZED_H__ 5 6 #include <stdint.h> 7 8 #define FMAP_SIGNATURE "__FMAP__" 9 #define FMAP_VER_MAJOR 1 /* this header's FMAP minor version */ 10 #define FMAP_VER_MINOR 1 /* this header's FMAP minor version */ 11 #define FMAP_STRLEN 32 /* maximum length for strings, */ 12 /* including null-terminator */ 13 14 enum fmap_flags { 15 FMAP_AREA_STATIC = 1 << 0, 16 FMAP_AREA_COMPRESSED = 1 << 1, 17 FMAP_AREA_RO = 1 << 2, 18 FMAP_AREA_PRESERVE = 1 << 3, 19 }; 20 21 /* Mapping of volatile and static regions in firmware binary */ 22 struct fmap_area { 23 uint32_t offset; /* offset relative to base */ 24 uint32_t size; /* size in bytes */ 25 uint8_t name[FMAP_STRLEN]; /* descriptive name */ 26 uint16_t flags; /* flags for this area */ 27 } __packed; 28 29 struct fmap { 30 uint8_t signature[8]; /* "__FMAP__" (0x5F5F464D41505F5F) */ 31 uint8_t ver_major; /* major version */ 32 uint8_t ver_minor; /* minor version */ 33 uint64_t base; /* address of the firmware binary */ 34 uint32_t size; /* size of firmware binary in bytes */ 35 uint8_t name[FMAP_STRLEN]; /* name of this firmware binary */ 36 uint16_t nareas; /* number of areas described by 37 fmap_areas[] below */ 38 struct fmap_area areas[]; 39 } __packed; 40 41 #endif /* FLASHMAP_SERIALIZED_H__ */ 42