pmt.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #ifndef _PMT_H
  2. #define _PMT_H
  3. #include <partition_define.h>
  4. /* mt6516_partition.h has defination */
  5. /* mt6516_download.h define again, both is 20 */
  6. #define MAX_PARTITION_NAME_LEN 64
  7. #ifdef CONFIG_MTK_EMMC_SUPPORT
  8. /*64bit*/
  9. typedef struct {
  10. char name[MAX_PARTITION_NAME_LEN]; /* partition name */
  11. unsigned long long size; /* partition size */
  12. unsigned long long part_id; /* partition region */
  13. unsigned long long offset; /* partition start */
  14. unsigned long long mask_flags; /* partition flags */
  15. } pt_resident;
  16. /*32bit*/
  17. typedef struct {
  18. char name[MAX_PARTITION_NAME_LEN]; /* partition name */
  19. unsigned long size; /* partition size */
  20. unsigned long offset; /* partition start */
  21. unsigned long mask_flags; /* partition flags */
  22. } pt_resident32;
  23. #else
  24. #define REGION_LOW_PAGE 0x004C4F57
  25. #define REGION_FULL_PAGE 0x46554C4C
  26. typedef struct {
  27. char name[MAX_PARTITION_NAME_LEN]; /* partition name */
  28. unsigned long long size; /* partition size */
  29. unsigned long long part_id; /* partition region */ /*will be used as download type on L branch. xiaolei */
  30. unsigned long long offset; /* partition start */
  31. unsigned long long mask_flags; /* partition flags */
  32. } pt_resident;
  33. #endif
  34. #define DM_ERR_OK 0
  35. #define DM_ERR_NO_VALID_TABLE 9
  36. #define DM_ERR_NO_SPACE_FOUND 10
  37. #define ERR_NO_EXIST 1
  38. /* Sequnce number */
  39. /* #define PT_LOCATION 4090 // (4096-80) */
  40. /* #define MPT_LOCATION 4091 // (4096-81) */
  41. #define PT_SIG 0x50547633 /* "PTv3" */
  42. #define MPT_SIG 0x4D505433 /* "MPT3" */
  43. #define PT_SIG_SIZE 4
  44. /* #define is_valid_mpt(buf) ((*(unsigned int *)(buf))==MPT_SIG) */
  45. /* #define is_valid_pt(buf) ((*(unsigned int *)(buf))==PT_SIG) */
  46. #define is_valid_pt(buf) (!memcmp(buf, "3vTP", 4))
  47. #define is_valid_mpt(buf) (!memcmp(buf, "3TPM", 4))
  48. #define RETRY_TIMES 5
  49. typedef struct _DM_PARTITION_INFO {
  50. char part_name[MAX_PARTITION_NAME_LEN]; /* the name of partition */
  51. unsigned long long start_addr; /* the start address of partition */
  52. unsigned long long part_len; /* the length of partition */
  53. unsigned char part_visibility; /* part_visibility is 0: this partition is hidden and CANNOT download */
  54. /* part_visibility is 1: this partition is visible and can download */
  55. unsigned char dl_selected; /* dl_selected is 0: this partition is NOT selected to download */
  56. /* dl_selected is 1: this partition is selected to download */
  57. } DM_PARTITION_INFO;
  58. typedef struct {
  59. unsigned int pattern;
  60. unsigned int part_num; /* The actual number of partitions */
  61. DM_PARTITION_INFO part_info[PART_MAX_COUNT];
  62. } DM_PARTITION_INFO_PACKET;
  63. typedef struct {
  64. int sequencenumber:8;
  65. int tool_or_sd_update:8;
  66. int mirror_pt_dl:4; /* mirror download OK */
  67. int mirror_pt_has_space:4;
  68. int pt_changed:4;
  69. int pt_has_space:4;
  70. } pt_info;
  71. #define PMT 1
  72. #ifdef PMT
  73. #if defined(CONFIG_MTK_MLC_NAND_SUPPORT)
  74. extern bool MLC_DEVICE; /* to build pass xiaolei */
  75. #endif
  76. extern bool g_bInitDone;
  77. extern struct mtk_nand_host *host;
  78. #if defined(CONFIG_MTK_SPI_NAND_SUPPORT)
  79. extern snand_flashdev_info devinfo;
  80. #else
  81. extern flashdev_info_t devinfo;
  82. #endif
  83. typedef u32(*GetLowPageNumber) (u32 pageNo);
  84. extern GetLowPageNumber functArray[];
  85. int new_part_tab(u8 *buf, struct mtd_info *mtd);
  86. int update_part_tab(struct mtd_info *mtd);
  87. #endif
  88. #endif