partition_define.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #ifndef __PARTITION_DEFINE_H__
  2. #define __PARTITION_DEFINE_H__
  3. #define KB (1024ULL)
  4. #define MB (1024 * KB)
  5. #define GB (1024 * MB)
  6. #define PART_PRELOADER "PRELOADER"
  7. #define PART_MBR "MBR"
  8. #define PART_EBR1 "EBR1"
  9. #define PART_PRO_INFO "PRO_INFO"
  10. #define PART_NVRAM "NVRAM"
  11. #define PART_PROTECT_F "PROTECT_F"
  12. #define PART_PROTECT_S "PROTECT_S"
  13. #define PART_SECCFG "SECCFG"
  14. #define PART_UBOOT "UBOOT"
  15. #define PART_BOOTIMG "BOOTIMG"
  16. #define PART_RECOVERY "RECOVERY"
  17. #define PART_SEC_RO "SEC_RO"
  18. #define PART_MISC "MISC"
  19. #define PART_LOGO "LOGO"
  20. #define PART_EBR2 "EBR2"
  21. #define PART_EXPDB "EXPDB"
  22. #define PART_TEE1 "TEE1"
  23. #define PART_TEE2 "TEE2"
  24. #define PART_KB "KB"
  25. #define PART_DKB "DKB"
  26. #define PART_ANDROID "ANDROID"
  27. #define PART_CACHE "CACHE"
  28. #define PART_USRDATA "USRDATA"
  29. #define PART_FAT "FAT"
  30. #define PART_BMTPOOL "BMTPOOL"
  31. /*preloader re-name*/
  32. #define PART_SECURE "SECURE"
  33. #define PART_SECSTATIC "SECSTATIC"
  34. #define PART_ANDSYSIMG "ANDSYSIMG"
  35. #define PART_USER "USER"
  36. /*Uboot re-name*/
  37. #define PART_APANIC "APANIC"
  38. #define PART_FLAG_NONE 0
  39. #define PART_FLAG_LEFT 0x1
  40. #define PART_FLAG_END 0x2
  41. #define PART_MAGIC 0x58881688
  42. #define PART_SIZE_PRELOADER (256*KB)
  43. #define PART_SIZE_MBR (512*KB)
  44. #define PART_SIZE_EBR1 (512*KB)
  45. #define PART_SIZE_PRO_INFO (3072*KB)
  46. #define PART_SIZE_NVRAM (5120*KB)
  47. #define PART_SIZE_PROTECT_F (10240*KB)
  48. #define PART_SIZE_PROTECT_S (10240*KB)
  49. #define PART_SIZE_SECCFG (128*KB)
  50. #define PART_OFFSET_SECCFG (0x1d00000)
  51. #define PART_SIZE_UBOOT (384*KB)
  52. #define PART_SIZE_BOOTIMG (16384*KB)
  53. #define PART_SIZE_RECOVERY (16384*KB)
  54. #define PART_SIZE_SEC_RO (6144*KB)
  55. #define PART_OFFSET_SEC_RO (0x3d80000)
  56. #define PART_SIZE_MISC (512*KB)
  57. #define PART_SIZE_LOGO (3072*KB)
  58. #define PART_SIZE_EBR2 (512*KB)
  59. #define PART_SIZE_EXPDB (10240*KB)
  60. #define PART_SIZE_TEE1 (5120*KB)
  61. #define PART_SIZE_TEE2 (5120*KB)
  62. #define PART_SIZE_KB (1024*KB)
  63. #define PART_SIZE_DKB (1024*KB)
  64. #define PART_SIZE_ANDROID (1048576*KB)
  65. #define PART_SIZE_CACHE (129024*KB)
  66. #define PART_SIZE_USRDATA (2097152*KB)
  67. #define PART_SIZE_FAT (0*KB)
  68. #define PART_SIZE_BMTPOOL (0) /* (0xa8) */
  69. #ifdef CONFIG_MTK_EMMC_SUPPORT
  70. #define PART_NUM 25
  71. #else
  72. extern int get_part_num_nand(void);
  73. #define PART_NUM get_part_num_nand()
  74. #endif
  75. #ifndef RAND_START_ADDR
  76. #define RAND_START_ADDR 1024
  77. #endif
  78. #define PART_MAX_COUNT 40
  79. #define MBR_START_ADDRESS_BYTE (20480*KB)
  80. #define WRITE_SIZE_Byte 512
  81. typedef enum {
  82. EMMC = 1,
  83. NAND = 2,
  84. } dev_type;
  85. #ifdef CONFIG_MTK_EMMC_SUPPORT
  86. typedef enum {
  87. EMMC_PART_UNKNOWN =
  88. 0, EMMC_PART_BOOT1, EMMC_PART_BOOT2, EMMC_PART_RPMB, EMMC_PART_GP1, EMMC_PART_GP2,
  89. EMMC_PART_GP3, EMMC_PART_GP4, EMMC_PART_USER, EMMC_PART_END
  90. } Region;
  91. #else
  92. typedef enum {
  93. NAND_PART_UNKNOWN = 0, NAND_PART_USER
  94. } Region;
  95. #endif
  96. struct excel_info {
  97. char *name;
  98. unsigned long long size;
  99. unsigned long long start_address;
  100. dev_type type;
  101. unsigned int partition_idx;
  102. Region region;
  103. };
  104. #ifdef CONFIG_MTK_EMMC_SUPPORT
  105. /*MBR or EBR struct*/
  106. #define SLOT_PER_MBR 4
  107. #define MBR_COUNT 8
  108. struct MBR_EBR_struct {
  109. char part_name[8];
  110. int part_index[SLOT_PER_MBR];
  111. };
  112. extern struct MBR_EBR_struct MBR_EBR_px[MBR_COUNT];
  113. #endif
  114. extern struct excel_info PartInfo[PART_MAX_COUNT];
  115. #endif