import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm / mach-mt8127 / include / mach / sbchk_base.h
1 #ifndef _SBCHK_BASE_H
2 #define _SBCHK_BASE_H
3
4 #ifndef FALSE
5 #define FALSE (0)
6 #endif
7
8 #ifndef TRUE
9 #define TRUE (1)
10 #endif
11
12 /**************************************************************************
13 * HASH CONFIGURATION
14 **************************************************************************/
15 #define HASH_OUTPUT_LEN (20)
16
17 /**************************************************************************
18 * SBCHK PATH
19 **************************************************************************/
20 #define SBCHK_ENGINE_PATH "/system/bin/sbchk"
21 #define SBCHK_MODULE_PATH "/system/lib/modules/sec.ko"
22 #define MODEM_CORE_MODULE_PATH "/system/lib/modules/ccci.ko"
23 #define MODEM_PLAT_MODULE_PATH "/system/lib/modules/ccci_plat.ko"
24 #define INIT_RC_PATH "init.rc"
25
26 /**************************************************************************
27 * SBCHK CHECK
28 **************************************************************************/
29 #define SBCHK_BASE_HASH_CHECK FALSE
30
31 /**************************************************************************
32 * SBCHK HASH VALUE
33 **************************************************************************/
34 #if SBCHK_BASE_HASH_CHECK
35
36 #error MUST fill the hash value of '/system/bin/sbchk',
37 'init.rc', '/system/lib/modules/sec.ko', '/system/lib/modules/ccci.ko' and
38 '/system/lib/modules/ccci_plat.ko'
39
40 /*
41 Kernel will compare hash values to check if
42 the loaded program are exact as what you expect
43 To ensure the hash value you fill is right.
44 The steps to obtain hash value are listed below;
45
46 (1) Turn off SBCHK_BASE_HASH_CHECK
47 (2) Download images and record kernel log
48 (3) Find the string pattern '[SBCHK_BASE]' in kernel log
49 (4) The hash value of '/system/bin/sbchk' is calculated
50 [SBCHK_BASE] Calculate the hash value of '/system/bin/sbchk' =
51 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
52 (5) Fill hash value in SBCHK_ENGINE_HASH
53 (6) The hash value of '/system/lib/modules/sec.ko' is calculated
54 [SBCHK_BASE] Calculate the hash value of '/system/lib/modules/sec.ko' =
55 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
56 (7) Fill hash value in SBCHK_MODULE_HASH
57 (8) The hash value of '/system/lib/modules/ccci.ko' is calculated
58 [SBCHK_BASE] Calculate the hash value of '/system/lib/modules/ccci.ko' =
59 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
60 (9) Fill hash value in MODEM_CORE_MODULE_HASH
61 (10) The hash value of '/system/lib/modules/ccci_plat.ko' is calculated
62 [SBCHK_BASE] Calculate the hash value of '/system/lib/modules/ccci_plat.ko' =
63 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
64 (11) Fill hash value in MODEM_PLAT_MODULE_HASH
65 (12) The hash value of 'init.rc' is calculated
66 [SBCHK_BASE] Calculate the hash value of 'init.rc' =
67 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
68 (13) Fill hash value in INIT_RC_HASH
69
70 PLEASE NOTE THAT !!!!!!
71 The hash value may be changed if compile tool chain is updated or customer modify this user space program
72 Before delivering boot image, please double check if the hash value should be updated or not.
73 */
74
75 //#define SBCHK_ENGINE_HASH "d20086bd0626defe136e0a39f8790fbbe3ac00f2"
76 //#define SBCHK_MODULE_HASH "475955d07809c5e78a6fa21a2718542ff7d660df"
77 #define SBCHK_ENGINE_HASH ?????????????????????????????????????????
78 #define SBCHK_MODULE_HASH ?????????????????????????????????????????
79 #define MODEM_PLAT_MODULE_HASH ?????????????????????????????????????????
80 #define MODEM_CORE_MODULE_HASH ?????????????????????????????????????????
81 #define INIT_RC_HASH ?????????????????????????????????????????
82
83 #else
84
85 /* dummy */
86 //#define SBCHK_ENGINE_HASH "3a816d2e275818cb12b839a10e838a1e10d729f7"
87 #define SBCHK_ENGINE_HASH "0000000000000000000000000000000000000000"
88 #define SBCHK_MODULE_HASH "0000000000000000000000000000000000000000"
89 #define MODEM_PLAT_MODULE_HASH "0000000000000000000000000000000000000000"
90 #define MODEM_CORE_MODULE_HASH "0000000000000000000000000000000000000000"
91 #define INIT_RC_HASH "0000000000000000000000000000000000000000"
92
93 #endif
94
95 /**************************************************************************
96 * ERROR CODE
97 **************************************************************************/
98 #define SEC_OK (0x0000)
99 #define SBCHK_BASE_OPEN_FAIL (0x1000)
100 #define SBCHK_BASE_READ_FAIL (0x1001)
101 #define SBCHK_BASE_HASH_INIT_FAIL (0x1002)
102 #define SBCHK_BASE_HASH_DATA_FAIL (0x1003)
103 #define SBCHK_BASE_HASH_CHECK_FAIL (0x1004)
104 #define SBCHK_BASE_INDEX_OUT_OF_RANGE (0xFFFFFFFF)
105
106 /**************************************************************************
107 * EXTERNAL FUNCTION
108 **************************************************************************/
109 extern void sbchk_base(void);
110
111
112 /******************************************************************************
113 * GLOBAL DATA
114 ******************************************************************************/
115 #define DEVINFO_DATA_SIZE 26
116 u32 g_devinfo_data[DEVINFO_DATA_SIZE];
117 u32 g_devinfo_data_size = DEVINFO_DATA_SIZE;
118 u32 get_devinfo_with_index(u32 index);
119
120 EXPORT_SYMBOL(g_devinfo_data);
121 EXPORT_SYMBOL(g_devinfo_data_size);
122 EXPORT_SYMBOL(get_devinfo_with_index);
123
124 #endif /*_SBCHK_BASE*/