1 /* 2 * Copyright (C) 2015 The Android Open Source Project 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 #ifndef _RECOVERY_FMAP_H_ 17 #define _RECOVERY_FMAP_H_ 18 19 #include <stdint.h> 20 21 #define FMAP_SIGNATURE "__FMAP__" 22 #define FMAP_VER_MAJOR 1 /* this header's FMAP minor version */ 23 #define FMAP_VER_MINOR 1 /* this header's FMAP minor version */ 24 #define FMAP_STRLEN 32 /* maximum length for strings, */ 25 /* including null-terminator */ 26 27 enum fmap_flags { 28 FMAP_AREA_STATIC = 1 << 0, 29 FMAP_AREA_COMPRESSED = 1 << 1, 30 FMAP_AREA_RO = 1 << 2, 31 }; 32 33 struct fmap_area { 34 uint32_t offset; /* offset relative to base */ 35 uint32_t size; /* size in bytes */ 36 uint8_t name[FMAP_STRLEN]; /* descriptive name */ 37 uint16_t flags; /* flags for this area */ 38 } __attribute__((packed)); 39 /* Mapping of volatile and static regions in firmware binary */ 40 struct fmap { 41 uint64_t signature; /* "__FMAP__" (0x5F5F50414D465F5F) */ 42 uint8_t ver_major; /* major version */ 43 uint8_t ver_minor; /* minor version */ 44 uint64_t base; /* address of the firmware binary */ 45 uint32_t size; /* size of firmware binary in bytes */ 46 uint8_t name[FMAP_STRLEN]; /* name of this firmware binary */ 47 uint16_t nareas; /* number of areas described by 48 fmap_areas[] below */ 49 struct fmap_area areas[]; 50 } __attribute__((packed)); 51 52 #endif /* _RECOVERY_FMAP_H_ */ 53