rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2018 MediaTek Inc. |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining |
| 5 | * a copy of this software and associated documentation files |
| 6 | * (the "Software"), to deal in the Software without restriction, |
| 7 | * including without limitation the rights to use, copy, modify, merge, |
| 8 | * publish, distribute, sublicense, and/or sell copies of the Software, |
| 9 | * and to permit persons to whom the Software is furnished to do so, |
| 10 | * subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice shall be |
| 13 | * included in all copies or substantial portions of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 19 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 20 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 21 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 22 | */ |
| 23 | |
| 24 | #ifndef __PARTITION_H__ |
| 25 | #define __PARTITION_H__ |
| 26 | |
| 27 | #include <platform/mmc_core.h> |
| 28 | |
| 29 | #define BIMG_HEADER_SZ (0x800) |
| 30 | #define MKIMG_HEADER_SZ (0x200) |
| 31 | |
| 32 | #define PART_HDR_DATA_SIZE 512 |
| 33 | |
| 34 | #define PART_KERNEL "KERNEL" |
| 35 | #define PART_ROOTFS "ROOTFS" |
| 36 | |
| 37 | #define PART_MAGIC 0x58881688 |
| 38 | #define PART_EXT_MAGIC 0x58891689 |
| 39 | #define PART_MAX_COUNT 128 |
| 40 | #define PART_PRELOADER_SIZE (0x400) |
| 41 | |
| 42 | #define FRP_NAME "frp" |
| 43 | |
| 44 | typedef union { |
| 45 | struct { |
| 46 | unsigned int magic; /* partition magic */ |
| 47 | unsigned int dsize; /* partition data size */ |
| 48 | char name[32]; /* partition name */ |
| 49 | unsigned int maddr; /* partition memory address */ |
| 50 | unsigned int mode; /* maddr is counted from the beginning or end of RAM */ |
| 51 | /* extension */ |
| 52 | unsigned int ext_magic; /* always EXT_MAGIC */ |
| 53 | unsigned int hdr_size; /* header size is 512 bytes currently, but may extend in the future */ |
| 54 | unsigned int hdr_version; /* see HDR_VERSION */ |
| 55 | unsigned int img_type; /* please refer to #define beginning with IMG_TYPE_ */ |
| 56 | unsigned int img_list_end; /* end of image list? 0: this image is followed by another image 1: end */ |
| 57 | unsigned int align_size; /* image size alignment setting in bytes, 16 by default for AES encryption */ |
| 58 | unsigned int dsize_extend; /* high word of image size for 64 bit address support */ |
| 59 | unsigned int maddr_extend; /* high word of image load address in RAM for 64 bit address support */ |
| 60 | } info; |
| 61 | unsigned char data[PART_HDR_DATA_SIZE]; |
| 62 | } part_hdr_t; |
| 63 | #endif /* __PARTITION_H__ */ |
| 64 | |