import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm / mach-mt8127 / ttab / common / pmt.h
1 #ifndef _PMT_H
2 #define _PMT_H
3
4 #include "partition_define.h"
5
6 //mt6516_partition.h has defination
7 //mt6516_download.h define again, both is 20
8
9 #define MAX_PARTITION_NAME_LEN 64
10 #ifdef CONFIG_MTK_EMMC_SUPPORT
11 /*64bit*/
12 typedef struct
13 {
14 char name[MAX_PARTITION_NAME_LEN]; /* partition name */
15 unsigned long long size; /* partition size */
16 unsigned long long part_id; /* partition region */
17 unsigned long long offset; /* partition start */
18 unsigned long long mask_flags; /* partition flags */
19
20 } pt_resident;
21 /*32bit*/
22 typedef struct
23 {
24 char name[MAX_PARTITION_NAME_LEN]; /* partition name */
25 unsigned long size; /* partition size */
26 unsigned long offset; /* partition start */
27 unsigned long mask_flags; /* partition flags */
28
29 } pt_resident32;
30 #else
31
32 typedef struct
33 {
34 char name[MAX_PARTITION_NAME_LEN]; /* partition name */
35 unsigned long long size; /* partition size */
36 unsigned long long part_id; /* partition region */
37 unsigned long long offset; /* partition start */
38 unsigned long long mask_flags; /* partition flags */
39
40 } pt_resident;
41 #endif
42
43
44 #define DM_ERR_OK 0
45 #define DM_ERR_NO_VALID_TABLE 9
46 #define DM_ERR_NO_SPACE_FOUND 10
47 #define ERR_NO_EXIST 1
48
49 //Sequnce number
50
51
52 //#define PT_LOCATION 4090 // (4096-80)
53 //#define MPT_LOCATION 4091 // (4096-81)
54 #define PT_SIG 0x50547633 //"PTv3"
55 #define MPT_SIG 0x4D505433 //"MPT3"
56 #define PT_SIG_SIZE 4
57 //#define is_valid_mpt(buf) ((*(unsigned int *)(buf))==MPT_SIG)
58 //#define is_valid_pt(buf) ((*(unsigned int *)(buf))==PT_SIG)
59 #define is_valid_pt(buf) (!memcmp(buf, "3vTP", 4))
60 #define is_valid_mpt(buf) (!memcmp(buf, "3TPM", 4))
61 #define RETRY_TIMES 5
62
63
64 typedef struct _DM_PARTITION_INFO
65 {
66 char part_name[MAX_PARTITION_NAME_LEN]; /* the name of partition */
67 unsigned long long start_addr; /* the start address of partition */
68 unsigned long long part_len; /* the length of partition */
69 unsigned char part_visibility; /* part_visibility is 0: this partition is hidden and CANNOT download */
70 /* part_visibility is 1: this partition is visible and can download */
71 unsigned char dl_selected; /* dl_selected is 0: this partition is NOT selected to download */
72 /* dl_selected is 1: this partition is selected to download */
73 } DM_PARTITION_INFO;
74
75 typedef struct {
76 unsigned int pattern;
77 unsigned int part_num; /* The actual number of partitions */
78 DM_PARTITION_INFO part_info[PART_MAX_COUNT];
79 } DM_PARTITION_INFO_PACKET;
80
81 typedef struct {
82 int sequencenumber:8;
83 int tool_or_sd_update:8;
84 int mirror_pt_dl:4; //mirror download OK
85 int mirror_pt_has_space:4;
86 int pt_changed:4;
87 int pt_has_space:4;
88 } pt_info;
89
90 #endif
91