diff options
-rw-r--r-- | arch/arm/mach-tegra/cortex-a9.S | 8 | ||||
-rw-r--r-- | arch/arm/mach-tegra/cpuidle-t3.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-tegra/headsmp-t3.S | 5 | ||||
-rw-r--r-- | arch/arm/mach-tegra/tegra2_save.S | 4 | ||||
-rw-r--r-- | arch/arm/mach-tegra/tegra3_save.S | 5 | ||||
-rw-r--r-- | security/tf_driver/tf_comm.c | 70 | ||||
-rw-r--r-- | security/tf_driver/tf_comm.h | 4 | ||||
-rw-r--r-- | security/tf_driver/tf_comm_tz.c | 8 | ||||
-rw-r--r-- | security/tf_driver/tf_protocol.h | 474 |
9 files changed, 276 insertions, 318 deletions
diff --git a/arch/arm/mach-tegra/cortex-a9.S b/arch/arm/mach-tegra/cortex-a9.S index 96f915725eb1..da571910ca06 100644 --- a/arch/arm/mach-tegra/cortex-a9.S +++ b/arch/arm/mach-tegra/cortex-a9.S @@ -465,6 +465,12 @@ ENTRY(__cortex_a9_restore) mcr p15, 2, r0, c0, c0, 0 @ csselr mcr p15, 0, r1, c1, c0, 0 @ sctlr +#ifndef CONFIG_TRUSTED_FOUNDATIONS + /* + * Restoring ACTRL / PCTLR needs to be done by secure code + * as not all bits of ACTRL are writable (and none of PCTLR) + * by non-secure code. + */ tst r2, #(0x1 << 6) orrne r2, r2, #(1 << 0) @ sync FW bit with SMP state mcr p15, 0, r2, c1, c0, 1 @ actlr @@ -475,8 +481,6 @@ ENTRY(__cortex_a9_restore) orreq r3, r3, #(3<<8) @ set MAXCLKLATENCY to 3 on G orrne r3, r3, #(2<<8) @ set MAXCLKLATENCY to 2 on LP #endif -#ifndef CONFIG_TRUSTED_FOUNDATIONS - //TL : moved to secure mcr p15, 0, r3, c15, c0, 0 @ pctlr #endif diff --git a/arch/arm/mach-tegra/cpuidle-t3.c b/arch/arm/mach-tegra/cpuidle-t3.c index ebc009e43354..386adf26b398 100644 --- a/arch/arm/mach-tegra/cpuidle-t3.c +++ b/arch/arm/mach-tegra/cpuidle-t3.c @@ -116,13 +116,6 @@ bool tegra_lp2_is_allowed(struct cpuidle_device *dev, if (!tegra_all_cpus_booted) return false; -#ifdef CONFIG_TRUSTED_FOUNDATIONS - /* For now, we don't understand this behavior... - * Without this check tt will generate the MC_DECERR msg! - */ - if (num_online_cpus() > 1) - return false; -#endif /* On A01, lp2 on slave cpu's cause cpu hang randomly. * Refer to Bug 804085. */ @@ -391,19 +384,22 @@ static int tegra_lp2_debug_show(struct seq_file *s, void *data) (idle_stats.lp2_count ?: 1)); seq_printf(s, "\n"); - seq_printf(s, "lp2 ready time: %8llu %8llu %8llu %8llu %8llu ms\n", + seq_printf(s, "lp2 ready time:%16s %8llu %8llu %8llu %8llu %8llu ms\n", + "", div64_u64(idle_stats.cpu_wants_lp2_time[0], 1000), div64_u64(idle_stats.cpu_wants_lp2_time[1], 1000), div64_u64(idle_stats.cpu_wants_lp2_time[2], 1000), div64_u64(idle_stats.cpu_wants_lp2_time[3], 1000), div64_u64(idle_stats.cpu_wants_lp2_time[4], 1000)); - seq_printf(s, "lp2 time: %8llu %8llu %8llu %8llu %8llu ms\n", + seq_printf(s, "lp2 time:%22s %8llu %8llu %8llu %8llu %8llu ms\n", + "", div64_u64(idle_stats.in_lp2_time[0], 1000), div64_u64(idle_stats.in_lp2_time[1], 1000), div64_u64(idle_stats.in_lp2_time[2], 1000), div64_u64(idle_stats.in_lp2_time[3], 1000), div64_u64(idle_stats.in_lp2_time[4], 1000)); - seq_printf(s, "lp2 %: %7d%% %7d%% %7d%% %7d%% %7d%%\n", + seq_printf(s, "lp2 %%:%26s %7d%% %7d%% %7d%% %7d%% %7d%%\n", + "", (int)(idle_stats.cpu_wants_lp2_time[0] ? div64_u64(idle_stats.in_lp2_time[0] * 100, idle_stats.cpu_wants_lp2_time[0]) : 0), diff --git a/arch/arm/mach-tegra/headsmp-t3.S b/arch/arm/mach-tegra/headsmp-t3.S index b4e70c29e2f4..7eb5c42765fd 100644 --- a/arch/arm/mach-tegra/headsmp-t3.S +++ b/arch/arm/mach-tegra/headsmp-t3.S @@ -151,6 +151,11 @@ ENTRY(tegra_lp2_startup) str r1, [r0] dsb +#ifdef CONFIG_TRUSTED_FOUNDATIONS + /* wake up */ + smc 0 +#endif + adr r4, __tegra_lp2_data ldmia r4, {r5, r7, r12} mov r1, r12 @ ctx_restore = __cortex_a9_restore diff --git a/arch/arm/mach-tegra/tegra2_save.S b/arch/arm/mach-tegra/tegra2_save.S index 3c0de77d21ec..cb76786ee1f3 100644 --- a/arch/arm/mach-tegra/tegra2_save.S +++ b/arch/arm/mach-tegra/tegra2_save.S @@ -183,13 +183,17 @@ __tegra_lp1_reset: /* the CPU and system bus are running at 32KHz and executing from * IRAM when this code is executed; immediately switch to CLKM and * enable PLLP. */ + mov32 r0, TEGRA_CLK_RESET_BASE +#ifndef CONFIG_TRUSTED_FOUNDATIONS + /* secure code handles 32KHz to CLKM/OSC clock switch */ mov r1, #(1<<28) str r1, [r0, #CLK_RESET_SCLK_BURST] str r1, [r0, #CLK_RESET_CCLK_BURST] mov r1, #0 str r1, [r0, #CLK_RESET_SCLK_DIVIDER] str r1, [r0, #CLK_RESET_CCLK_DIVIDER] +#endif ldr r1, [r0, #CLK_RESET_PLLM_BASE] tst r1, #(1<<30) diff --git a/arch/arm/mach-tegra/tegra3_save.S b/arch/arm/mach-tegra/tegra3_save.S index a5e5aabcc8a0..ed214412d6ec 100644 --- a/arch/arm/mach-tegra/tegra3_save.S +++ b/arch/arm/mach-tegra/tegra3_save.S @@ -252,14 +252,17 @@ ENTRY(__tegra_lp1_reset) /* the CPU and system bus are running at 32KHz and executing from * IRAM when this code is executed; immediately switch to CLKM and * enable PLLP, PLLM, PLLC, PLLA and PLLX. */ - mov32 r0, TEGRA_CLK_RESET_BASE + mov32 r0, TEGRA_CLK_RESET_BASE +#ifndef CONFIG_TRUSTED_FOUNDATIONS + /* secure code handles 32KHz to CLKM/OSC clock switch */ mov r1, #(1<<28) str r1, [r0, #CLK_RESET_SCLK_BURST] str r1, [r0, #CLK_RESET_CCLK_BURST] mov r1, #0 str r1, [r0, #CLK_RESET_SCLK_DIVIDER] str r1, [r0, #CLK_RESET_CCLK_DIVIDER] +#endif /* enable PLLM via PMC */ mov32 r2, TEGRA_PMC_BASE diff --git a/security/tf_driver/tf_comm.c b/security/tf_driver/tf_comm.c index 49608fa988b9..1ead98a0160f 100644 --- a/security/tf_driver/tf_comm.c +++ b/security/tf_driver/tf_comm.c @@ -1211,11 +1211,7 @@ static int tf_send_recv(struct tf_comm *comm, union tf_command *command, struct tf_answer_struct *answerStruct, struct tf_connection *connection, - int bKillable - #ifdef CONFIG_TF_ZEBRA - , bool *secure_is_idle - #endif - ) + int bKillable) { int result; u64 timeout; @@ -1229,6 +1225,10 @@ static int tf_send_recv(struct tf_comm *comm, dprintk(KERN_INFO "[pid=%d] tf_send_recv(%p)\n", current->pid, command); +#ifdef CONFIG_TF_ZEBRA + tf_clock_timer_start(); +#endif + #ifdef CONFIG_FREEZER saved_flags = current->flags; current->flags |= PF_FREEZER_NOSIG; @@ -1250,17 +1250,6 @@ copy_answers: #ifdef CONFIG_FREEZER if (unlikely(freezing(current))) { -#ifdef CONFIG_TF_ZEBRA - if (!(*secure_is_idle)) { - if (tf_schedule_secure_world(comm, true) == - STATUS_PENDING) - goto copy_answers; - - tf_l4sec_clkdm_allow_idle(true); - *secure_is_idle = true; - } -#endif - dprintk(KERN_INFO "Entering refrigerator.\n"); refrigerator(); @@ -1366,13 +1355,9 @@ copy_answers: */ #ifdef CONFIG_TF_ZEBRA schedule_secure_world: - if (*secure_is_idle) { - tf_l4sec_clkdm_wakeup(true, false); - *secure_is_idle = false; - } #endif - result = tf_schedule_secure_world(comm, false); + result = tf_schedule_secure_world(comm); if (result < 0) goto exit; goto copy_answers; @@ -1399,18 +1384,6 @@ wait: "prepare to sleep 0x%lx jiffies\n", nRelativeTimeoutJiffies); -#ifdef CONFIG_TF_ZEBRA - if (!(*secure_is_idle)) { - if (tf_schedule_secure_world(comm, true) == STATUS_PENDING) { - finish_wait(&comm->wait_queue, &wait); - wait_prepared = false; - goto copy_answers; - } - tf_l4sec_clkdm_allow_idle(true); - *secure_is_idle = true; - } -#endif - /* go to sleep */ if (schedule_timeout(nRelativeTimeoutJiffies) == 0) dprintk(KERN_INFO @@ -1429,16 +1402,6 @@ exit: wait_prepared = false; } -#ifdef CONFIG_TF_ZEBRA - if ((!(*secure_is_idle)) && (result != -EIO)) { - if (tf_schedule_secure_world(comm, true) == STATUS_PENDING) - goto copy_answers; - - tf_l4sec_clkdm_allow_idle(true); - *secure_is_idle = true; - } -#endif - #ifdef CONFIG_FREEZER current->flags &= ~(PF_FREEZER_NOSIG); current->flags |= (saved_flags & PF_FREEZER_NOSIG); @@ -1469,9 +1432,6 @@ int tf_send_receive(struct tf_comm *comm, cpumask_t saved_cpu_mask; cpumask_t local_cpu_mask = CPU_MASK_NONE; #endif -#ifdef CONFIG_TF_ZEBRA - bool secure_is_idle = true; -#endif answerStructure.answer = answer; answerStructure.answer_copied = false; @@ -1509,11 +1469,7 @@ int tf_send_receive(struct tf_comm *comm, * Send the command */ error = tf_send_recv(comm, - command, &answerStructure, connection, bKillable - #ifdef CONFIG_TF_ZEBRA - , &secure_is_idle - #endif - ); + command, &answerStructure, connection, bKillable); if (!bKillable && sigkill_pending()) { if ((command->header.message_type == @@ -1594,11 +1550,7 @@ int tf_send_receive(struct tf_comm *comm, connection->device_context; error = tf_send_recv(comm, - command, &answerStructure, connection, false - #ifdef CONFIG_TF_ZEBRA - , &secure_is_idle - #endif - ); + command, &answerStructure, connection, false); if (error == -EINTR) { /* * Another thread already sent @@ -1640,11 +1592,7 @@ int tf_send_receive(struct tf_comm *comm, destroy_context: error = tf_send_recv(comm, - command, &answerStructure, connection, false - #ifdef CONFIG_TF_ZEBRA - , &secure_is_idle - #endif - ); + command, &answerStructure, connection, false); /* * tf_send_recv cannot return an error because diff --git a/security/tf_driver/tf_comm.h b/security/tf_driver/tf_comm.h index 48bd93450a06..8921dc1d1be0 100644 --- a/security/tf_driver/tf_comm.h +++ b/security/tf_driver/tf_comm.h @@ -154,9 +154,7 @@ int tf_fill_descriptor_table( * Standard communication operations *----------------------------------------------------------------------------*/ -#define STATUS_PENDING 0x00000001 - -int tf_schedule_secure_world(struct tf_comm *comm, bool prepare_exit); +int tf_schedule_secure_world(struct tf_comm *comm); int tf_send_receive( struct tf_comm *comm, diff --git a/security/tf_driver/tf_comm_tz.c b/security/tf_driver/tf_comm_tz.c index 2d359c2138ba..567b22c1ad9a 100644 --- a/security/tf_driver/tf_comm_tz.c +++ b/security/tf_driver/tf_comm_tz.c @@ -195,7 +195,7 @@ static inline void tf_smc_nyield(void) } /* Yields the Secure World */ -int tf_schedule_secure_world(struct tf_comm *comm, bool prepare_exit) +int tf_schedule_secure_world(struct tf_comm *comm) { tf_set_current_time(comm); @@ -503,7 +503,7 @@ int tf_pm_hibernate(struct tf_comm *comm) } spin_unlock(&(comm->lock)); - (void)tf_schedule_secure_world(comm, false); + (void)tf_schedule_secure_world(comm); } /* now wait for the answer, dispatching other answers */ @@ -597,7 +597,7 @@ int tf_pm_hibernate(struct tf_comm *comm) * no need to check its timeout and schedule() the current * thread */ - (void)tf_schedule_secure_world(comm, false); + (void)tf_schedule_secure_world(comm); } /* while (1) */ printk(KERN_INFO "tf_driver: hibernate.\n"); @@ -833,7 +833,7 @@ int tf_init(struct tf_comm *comm) */ /* yield for the first time */ - (void)tf_schedule_secure_world(comm, false); + (void)tf_schedule_secure_world(comm); dprintk(KERN_INFO "tf_init(): Success\n"); return S_SUCCESS; diff --git a/security/tf_driver/tf_protocol.h b/security/tf_driver/tf_protocol.h index 4e552654aa9a..1a7ea0961d41 100644 --- a/security/tf_driver/tf_protocol.h +++ b/security/tf_driver/tf_protocol.h @@ -30,72 +30,72 @@ /* * The driver interface version returned by the version ioctl */ -#define TF_DRIVER_INTERFACE_VERSION 0x04000000 +#define TF_DRIVER_INTERFACE_VERSION 0x04000000 /* * Protocol version handling */ -#define TF_S_PROTOCOL_MAJOR_VERSION (0x06) +#define TF_S_PROTOCOL_MAJOR_VERSION (0x06) #define GET_PROTOCOL_MAJOR_VERSION(a) (a >> 24) #define GET_PROTOCOL_MINOR_VERSION(a) ((a >> 16) & 0xFF) /* * The S flag of the config_flag_s register. */ -#define TF_CONFIG_FLAG_S (1 << 3) +#define TF_CONFIG_FLAG_S (1 << 3) /* * The TimeSlot field of the sync_serial_n register. */ -#define TF_SYNC_SERIAL_TIMESLOT_N (1) +#define TF_SYNC_SERIAL_TIMESLOT_N (1) /* * status_s related defines. */ -#define TF_STATUS_P_MASK (0X00000001) -#define TF_STATUS_POWER_STATE_SHIFT (3) -#define TF_STATUS_POWER_STATE_MASK (0x1F << TF_STATUS_POWER_STATE_SHIFT) +#define TF_STATUS_P_MASK (0X00000001) +#define TF_STATUS_POWER_STATE_SHIFT (3) +#define TF_STATUS_POWER_STATE_MASK (0x1F << TF_STATUS_POWER_STATE_SHIFT) /* * Possible power states of the POWER_STATE field of the status_s register */ -#define TF_POWER_MODE_COLD_BOOT (0) -#define TF_POWER_MODE_WARM_BOOT (1) -#define TF_POWER_MODE_ACTIVE (3) -#define TF_POWER_MODE_READY_TO_SHUTDOWN (5) -#define TF_POWER_MODE_READY_TO_HIBERNATE (7) -#define TF_POWER_MODE_WAKEUP (8) -#define TF_POWER_MODE_PANIC (15) +#define TF_POWER_MODE_COLD_BOOT (0) +#define TF_POWER_MODE_WARM_BOOT (1) +#define TF_POWER_MODE_ACTIVE (3) +#define TF_POWER_MODE_READY_TO_SHUTDOWN (5) +#define TF_POWER_MODE_READY_TO_HIBERNATE (7) +#define TF_POWER_MODE_WAKEUP (8) +#define TF_POWER_MODE_PANIC (15) /* * Possible command values for MANAGEMENT commands */ -#define TF_MANAGEMENT_HIBERNATE (1) -#define TF_MANAGEMENT_SHUTDOWN (2) -#define TF_MANAGEMENT_PREPARE_FOR_CORE_OFF (3) -#define TF_MANAGEMENT_RESUME_FROM_CORE_OFF (4) +#define TF_MANAGEMENT_HIBERNATE (1) +#define TF_MANAGEMENT_SHUTDOWN (2) +#define TF_MANAGEMENT_PREPARE_FOR_CORE_OFF (3) +#define TF_MANAGEMENT_RESUME_FROM_CORE_OFF (4) /* * The capacity of the Normal Word message queue, in number of slots. */ -#define TF_N_MESSAGE_QUEUE_CAPACITY (512) +#define TF_N_MESSAGE_QUEUE_CAPACITY (512) /* * The capacity of the Secure World message answer queue, in number of slots. */ -#define TF_S_ANSWER_QUEUE_CAPACITY (256) +#define TF_S_ANSWER_QUEUE_CAPACITY (256) /* * The value of the S-timeout register indicating an infinite timeout. */ -#define TF_S_TIMEOUT_0_INFINITE (0xFFFFFFFF) -#define TF_S_TIMEOUT_1_INFINITE (0xFFFFFFFF) +#define TF_S_TIMEOUT_0_INFINITE (0xFFFFFFFF) +#define TF_S_TIMEOUT_1_INFINITE (0xFFFFFFFF) /* * The value of the S-timeout register indicating an immediate timeout. */ -#define TF_S_TIMEOUT_0_IMMEDIATE (0x0) -#define TF_S_TIMEOUT_1_IMMEDIATE (0x0) +#define TF_S_TIMEOUT_0_IMMEDIATE (0x0) +#define TF_S_TIMEOUT_1_IMMEDIATE (0x0) /* * Identifies the get protocol version SMC. @@ -105,32 +105,32 @@ /* * Identifies the init SMC. */ -#define TF_SMC_INIT (0XFFFFFFFF) +#define TF_SMC_INIT (0XFFFFFFFF) /* * Identifies the reset irq SMC. */ -#define TF_SMC_RESET_IRQ (0xFFFFFFFE) +#define TF_SMC_RESET_IRQ (0xFFFFFFFE) /* * Identifies the SET_W3B SMC. */ -#define TF_SMC_WAKE_UP (0xFFFFFFFD) +#define TF_SMC_WAKE_UP (0xFFFFFFFD) /* * Identifies the STOP SMC. */ -#define TF_SMC_STOP (0xFFFFFFFC) +#define TF_SMC_STOP (0xFFFFFFFC) /* * Identifies the n-yield SMC. */ -#define TF_SMC_N_YIELD (0X00000003) +#define TF_SMC_N_YIELD (0X00000003) /* Possible stop commands for SMC_STOP */ -#define SCSTOP_HIBERNATE (0xFFFFFFE1) -#define SCSTOP_SHUTDOWN (0xFFFFFFE2) +#define SCSTOP_HIBERNATE (0xFFFFFFE1) +#define SCSTOP_SHUTDOWN (0xFFFFFFE2) /* * representation of an UUID. @@ -147,57 +147,57 @@ struct tf_uuid { * Command parameters. */ struct tf_command_param_value { - u32 a; - u32 b; + u32 a; + u32 b; }; struct tf_command_param_temp_memref { - u32 descriptor; /* data pointer for exchange message.*/ - u32 size; - u32 offset; + u32 descriptor; /* data pointer for exchange message.*/ + u32 size; + u32 offset; }; struct tf_command_param_memref { - u32 block; - u32 size; - u32 offset; + u32 block; + u32 size; + u32 offset; }; union tf_command_param { - struct tf_command_param_value value; - struct tf_command_param_temp_memref temp_memref; - struct tf_command_param_memref memref; + struct tf_command_param_value value; + struct tf_command_param_temp_memref temp_memref; + struct tf_command_param_memref memref; }; /** * Answer parameters. */ struct tf_answer_param_value { - u32 a; - u32 b; + u32 a; + u32 b; }; struct tf_answer_param_size { - u32 _ignored; - u32 size; + u32 _ignored; + u32 size; }; union tf_answer_param { - struct tf_answer_param_size size; - struct tf_answer_param_value value; + struct tf_answer_param_size size; + struct tf_answer_param_value value; }; /* * Descriptor tables capacity */ -#define TF_MAX_W3B_COARSE_PAGES (2) +#define TF_MAX_W3B_COARSE_PAGES (2) /* TF_MAX_COARSE_PAGES is the number of level 1 descriptors (describing * 1MB each) that can be shared with the secure world in a single registered * shared memory block. It must be kept in synch with * SCHANNEL6_MAX_DESCRIPTORS_PER_REGISTERED_SHARED_MEM in the SChannel * protocol spec. */ -#define TF_MAX_COARSE_PAGES 128 -#define TF_DESCRIPTOR_TABLE_CAPACITY_BIT_SHIFT (8) +#define TF_MAX_COARSE_PAGES 128 +#define TF_DESCRIPTOR_TABLE_CAPACITY_BIT_SHIFT (8) #define TF_DESCRIPTOR_TABLE_CAPACITY \ (1 << TF_DESCRIPTOR_TABLE_CAPACITY_BIT_SHIFT) #define TF_DESCRIPTOR_TABLE_CAPACITY_MASK \ @@ -217,33 +217,33 @@ union tf_answer_param { /* * Shared memory type flags. */ -#define TF_SHMEM_TYPE_READ (0x00000001) -#define TF_SHMEM_TYPE_WRITE (0x00000002) +#define TF_SHMEM_TYPE_READ (0x00000001) +#define TF_SHMEM_TYPE_WRITE (0x00000002) /* * Shared mem flags */ -#define TF_SHARED_MEM_FLAG_INPUT 1 -#define TF_SHARED_MEM_FLAG_OUTPUT 2 -#define TF_SHARED_MEM_FLAG_INOUT 3 +#define TF_SHARED_MEM_FLAG_INPUT 1 +#define TF_SHARED_MEM_FLAG_OUTPUT 2 +#define TF_SHARED_MEM_FLAG_INOUT 3 /* * Parameter types */ -#define TF_PARAM_TYPE_NONE 0x0 -#define TF_PARAM_TYPE_VALUE_INPUT 0x1 -#define TF_PARAM_TYPE_VALUE_OUTPUT 0x2 -#define TF_PARAM_TYPE_VALUE_INOUT 0x3 -#define TF_PARAM_TYPE_MEMREF_TEMP_INPUT 0x5 -#define TF_PARAM_TYPE_MEMREF_TEMP_OUTPUT 0x6 -#define TF_PARAM_TYPE_MEMREF_TEMP_INOUT 0x7 -#define TF_PARAM_TYPE_MEMREF_INPUT 0xD -#define TF_PARAM_TYPE_MEMREF_OUTPUT 0xE -#define TF_PARAM_TYPE_MEMREF_INOUT 0xF +#define TF_PARAM_TYPE_NONE 0x0 +#define TF_PARAM_TYPE_VALUE_INPUT 0x1 +#define TF_PARAM_TYPE_VALUE_OUTPUT 0x2 +#define TF_PARAM_TYPE_VALUE_INOUT 0x3 +#define TF_PARAM_TYPE_MEMREF_TEMP_INPUT 0x5 +#define TF_PARAM_TYPE_MEMREF_TEMP_OUTPUT 0x6 +#define TF_PARAM_TYPE_MEMREF_TEMP_INOUT 0x7 +#define TF_PARAM_TYPE_MEMREF_INPUT 0xD +#define TF_PARAM_TYPE_MEMREF_OUTPUT 0xE +#define TF_PARAM_TYPE_MEMREF_INOUT 0xF -#define TF_PARAM_TYPE_MEMREF_FLAG 0x4 -#define TF_PARAM_TYPE_REGISTERED_MEMREF_FLAG 0x8 +#define TF_PARAM_TYPE_MEMREF_FLAG 0x4 +#define TF_PARAM_TYPE_REGISTERED_MEMREF_FLAG 0x8 #define TF_MAKE_PARAM_TYPES(t0, t1, t2, t3) \ @@ -253,14 +253,14 @@ union tf_answer_param { /* * Login types. */ -#define TF_LOGIN_PUBLIC 0x00000000 -#define TF_LOGIN_USER 0x00000001 -#define TF_LOGIN_GROUP 0x00000002 -#define TF_LOGIN_APPLICATION 0x00000004 -#define TF_LOGIN_APPLICATION_USER 0x00000005 -#define TF_LOGIN_APPLICATION_GROUP 0x00000006 -#define TF_LOGIN_AUTHENTICATION 0x80000000 -#define TF_LOGIN_PRIVILEGED 0x80000002 +#define TF_LOGIN_PUBLIC 0x00000000 +#define TF_LOGIN_USER 0x00000001 +#define TF_LOGIN_GROUP 0x00000002 +#define TF_LOGIN_APPLICATION 0x00000004 +#define TF_LOGIN_APPLICATION_USER 0x00000005 +#define TF_LOGIN_APPLICATION_GROUP 0x00000006 +#define TF_LOGIN_AUTHENTICATION 0x80000000 +#define TF_LOGIN_PRIVILEGED 0x80000002 /* Login variants */ @@ -270,9 +270,9 @@ union tf_answer_param { #define TF_LOGIN_GET_MAIN_TYPE(type) \ ((type) & ~TF_LOGIN_VARIANT(0, 0xFF, 0xFF)) -#define TF_LOGIN_OS_ANY 0x00 -#define TF_LOGIN_OS_LINUX 0x01 -#define TF_LOGIN_OS_ANDROID 0x04 +#define TF_LOGIN_OS_ANY 0x00 +#define TF_LOGIN_OS_LINUX 0x01 +#define TF_LOGIN_OS_ANDROID 0x04 /* OS-independent variants */ #define TF_LOGIN_USER_NONE \ @@ -315,21 +315,21 @@ union tf_answer_param { /* * return origins */ -#define TF_ORIGIN_COMMS 2 -#define TF_ORIGIN_TEE 3 -#define TF_ORIGIN_TRUSTED_APP 4 +#define TF_ORIGIN_COMMS 2 +#define TF_ORIGIN_TEE 3 +#define TF_ORIGIN_TRUSTED_APP 4 /* * The message types. */ -#define TF_MESSAGE_TYPE_CREATE_DEVICE_CONTEXT 0x02 -#define TF_MESSAGE_TYPE_DESTROY_DEVICE_CONTEXT 0xFD -#define TF_MESSAGE_TYPE_REGISTER_SHARED_MEMORY 0xF7 -#define TF_MESSAGE_TYPE_RELEASE_SHARED_MEMORY 0xF9 -#define TF_MESSAGE_TYPE_OPEN_CLIENT_SESSION 0xF0 -#define TF_MESSAGE_TYPE_CLOSE_CLIENT_SESSION 0xF2 -#define TF_MESSAGE_TYPE_INVOKE_CLIENT_COMMAND 0xF5 -#define TF_MESSAGE_TYPE_CANCEL_CLIENT_COMMAND 0xF4 -#define TF_MESSAGE_TYPE_MANAGEMENT 0xFE +#define TF_MESSAGE_TYPE_CREATE_DEVICE_CONTEXT 0x02 +#define TF_MESSAGE_TYPE_DESTROY_DEVICE_CONTEXT 0xFD +#define TF_MESSAGE_TYPE_REGISTER_SHARED_MEMORY 0xF7 +#define TF_MESSAGE_TYPE_RELEASE_SHARED_MEMORY 0xF9 +#define TF_MESSAGE_TYPE_OPEN_CLIENT_SESSION 0xF0 +#define TF_MESSAGE_TYPE_CLOSE_CLIENT_SESSION 0xF2 +#define TF_MESSAGE_TYPE_INVOKE_CLIENT_COMMAND 0xF5 +#define TF_MESSAGE_TYPE_CANCEL_CLIENT_COMMAND 0xF4 +#define TF_MESSAGE_TYPE_MANAGEMENT 0xFE /* @@ -340,129 +340,129 @@ union tf_answer_param { struct tf_command_header { - u8 message_size; - u8 message_type; - u16 message_info; - u32 operation_id; + u8 message_size; + u8 message_type; + u16 message_info; + u32 operation_id; }; struct tf_answer_header { - u8 message_size; - u8 message_type; - u16 message_info; - u32 operation_id; - u32 error_code; + u8 message_size; + u8 message_type; + u16 message_info; + u32 operation_id; + u32 error_code; }; /* * CREATE_DEVICE_CONTEXT command message. */ struct tf_command_create_device_context { - u8 message_size; - u8 message_type; - u16 message_info_rfu; - u32 operation_id; - u32 device_context_id; + u8 message_size; + u8 message_type; + u16 message_info_rfu; + u32 operation_id; + u32 device_context_id; }; /* * CREATE_DEVICE_CONTEXT answer message. */ struct tf_answer_create_device_context { - u8 message_size; - u8 message_type; - u16 message_info_rfu; + u8 message_size; + u8 message_type; + u16 message_info_rfu; /* an opaque Normal World identifier for the operation */ - u32 operation_id; - u32 error_code; + u32 operation_id; + u32 error_code; /* an opaque Normal World identifier for the device context */ - u32 device_context; + u32 device_context; }; /* * DESTROY_DEVICE_CONTEXT command message. */ struct tf_command_destroy_device_context { - u8 message_size; - u8 message_type; - u16 message_info_rfu; - u32 operation_id; - u32 device_context; + u8 message_size; + u8 message_type; + u16 message_info_rfu; + u32 operation_id; + u32 device_context; }; /* * DESTROY_DEVICE_CONTEXT answer message. */ struct tf_answer_destroy_device_context { - u8 message_size; - u8 message_type; - u16 message_info_rfu; + u8 message_size; + u8 message_type; + u16 message_info_rfu; /* an opaque Normal World identifier for the operation */ - u32 operation_id; - u32 error_code; - u32 device_context_id; + u32 operation_id; + u32 error_code; + u32 device_context_id; }; /* * OPEN_CLIENT_SESSION command message. */ struct tf_command_open_client_session { - u8 message_size; - u8 message_type; - u16 param_types; + u8 message_size; + u8 message_type; + u16 param_types; /* an opaque Normal World identifier for the operation */ - u32 operation_id; - u32 device_context; - u32 cancellation_id; - u64 timeout; - struct tf_uuid destination_uuid; - union tf_command_param params[4]; - u32 login_type; + u32 operation_id; + u32 device_context; + u32 cancellation_id; + u64 timeout; + struct tf_uuid destination_uuid; + union tf_command_param params[4]; + u32 login_type; /* * Size = 0 for public, [16] for group identification, [20] for * authentication */ - u8 login_data[20]; + u8 login_data[20]; }; /* * OPEN_CLIENT_SESSION answer message. */ struct tf_answer_open_client_session { - u8 message_size; - u8 message_type; - u8 error_origin; - u8 __reserved; + u8 message_size; + u8 message_type; + u8 error_origin; + u8 __reserved; /* an opaque Normal World identifier for the operation */ - u32 operation_id; - u32 error_code; - u32 client_session; - union tf_answer_param answers[4]; + u32 operation_id; + u32 error_code; + u32 client_session; + union tf_answer_param answers[4]; }; /* * CLOSE_CLIENT_SESSION command message. */ struct tf_command_close_client_session { - u8 message_size; - u8 message_type; - u16 message_info_rfu; + u8 message_size; + u8 message_type; + u16 message_info_rfu; /* an opaque Normal World identifier for the operation */ - u32 operation_id; - u32 device_context; - u32 client_session; + u32 operation_id; + u32 device_context; + u32 client_session; }; /* * CLOSE_CLIENT_SESSION answer message. */ struct tf_answer_close_client_session { - u8 message_size; - u8 message_type; - u16 message_info_rfu; + u8 message_size; + u8 message_type; + u16 message_info_rfu; /* an opaque Normal World identifier for the operation */ - u32 operation_id; - u32 error_code; + u32 operation_id; + u32 error_code; }; @@ -470,8 +470,8 @@ struct tf_answer_close_client_session { * REGISTER_SHARED_MEMORY command message */ struct tf_command_register_shared_memory { - u8 message_size; - u8 message_type; + u8 message_size; + u8 message_type; u16 memory_flags; u32 operation_id; u32 device_context; @@ -485,102 +485,102 @@ struct tf_command_register_shared_memory { * REGISTER_SHARED_MEMORY answer message. */ struct tf_answer_register_shared_memory { - u8 message_size; - u8 message_type; - u16 message_info_rfu; + u8 message_size; + u8 message_type; + u16 message_info_rfu; /* an opaque Normal World identifier for the operation */ - u32 operation_id; - u32 error_code; - u32 block; + u32 operation_id; + u32 error_code; + u32 block; }; /* * RELEASE_SHARED_MEMORY command message. */ struct tf_command_release_shared_memory { - u8 message_size; - u8 message_type; - u16 message_info_rfu; + u8 message_size; + u8 message_type; + u16 message_info_rfu; /* an opaque Normal World identifier for the operation */ - u32 operation_id; - u32 device_context; - u32 block; + u32 operation_id; + u32 device_context; + u32 block; }; /* * RELEASE_SHARED_MEMORY answer message. */ struct tf_answer_release_shared_memory { - u8 message_size; - u8 message_type; - u16 message_info_rfu; - u32 operation_id; - u32 error_code; - u32 block_id; + u8 message_size; + u8 message_type; + u16 message_info_rfu; + u32 operation_id; + u32 error_code; + u32 block_id; }; /* * INVOKE_CLIENT_COMMAND command message. */ struct tf_command_invoke_client_command { - u8 message_size; - u8 message_type; - u16 param_types; - u32 operation_id; - u32 device_context; - u32 client_session; - u64 timeout; - u32 cancellation_id; - u32 client_command_identifier; - union tf_command_param params[4]; + u8 message_size; + u8 message_type; + u16 param_types; + u32 operation_id; + u32 device_context; + u32 client_session; + u64 timeout; + u32 cancellation_id; + u32 client_command_identifier; + union tf_command_param params[4]; }; /* * INVOKE_CLIENT_COMMAND command answer. */ struct tf_answer_invoke_client_command { - u8 message_size; - u8 message_type; - u8 error_origin; - u8 __reserved; - u32 operation_id; - u32 error_code; - union tf_answer_param answers[4]; + u8 message_size; + u8 message_type; + u8 error_origin; + u8 __reserved; + u32 operation_id; + u32 error_code; + union tf_answer_param answers[4]; }; /* * CANCEL_CLIENT_OPERATION command message. */ struct tf_command_cancel_client_operation { - u8 message_size; - u8 message_type; - u16 message_info_rfu; + u8 message_size; + u8 message_type; + u16 message_info_rfu; /* an opaque Normal World identifier for the operation */ - u32 operation_id; - u32 device_context; - u32 client_session; - u32 cancellation_id; + u32 operation_id; + u32 device_context; + u32 client_session; + u32 cancellation_id; }; struct tf_answer_cancel_client_operation { - u8 message_size; - u8 message_type; - u16 message_info_rfu; - u32 operation_id; - u32 error_code; + u8 message_size; + u8 message_type; + u16 message_info_rfu; + u32 operation_id; + u32 error_code; }; /* * MANAGEMENT command message. */ struct tf_command_management { - u8 message_size; - u8 message_type; - u16 command; - u32 operation_id; - u32 w3b_size; - u32 w3b_start_offset; - u32 shared_mem_descriptors[1]; + u8 message_size; + u8 message_type; + u16 command; + u32 operation_id; + u32 w3b_size; + u32 w3b_start_offset; + u32 shared_mem_descriptors[1]; }; /* @@ -593,16 +593,16 @@ struct tf_command_management { * Structure for L2 messages */ union tf_command { - struct tf_command_header header; - struct tf_command_create_device_context create_device_context; - struct tf_command_destroy_device_context destroy_device_context; - struct tf_command_open_client_session open_client_session; - struct tf_command_close_client_session close_client_session; - struct tf_command_register_shared_memory register_shared_memory; - struct tf_command_release_shared_memory release_shared_memory; - struct tf_command_invoke_client_command invoke_client_command; - struct tf_command_cancel_client_operation cancel_client_operation; - struct tf_command_management management; + struct tf_command_header header; + struct tf_command_create_device_context create_device_context; + struct tf_command_destroy_device_context destroy_device_context; + struct tf_command_open_client_session open_client_session; + struct tf_command_close_client_session close_client_session; + struct tf_command_register_shared_memory register_shared_memory; + struct tf_command_release_shared_memory release_shared_memory; + struct tf_command_invoke_client_command invoke_client_command; + struct tf_command_cancel_client_operation cancel_client_operation; + struct tf_command_management management; }; /* @@ -610,15 +610,15 @@ union tf_command { */ union tf_answer { - struct tf_answer_header header; - struct tf_answer_create_device_context create_device_context; - struct tf_answer_open_client_session open_client_session; - struct tf_answer_close_client_session close_client_session; - struct tf_answer_register_shared_memory register_shared_memory; - struct tf_answer_release_shared_memory release_shared_memory; - struct tf_answer_invoke_client_command invoke_client_command; - struct tf_answer_destroy_device_context destroy_device_context; - struct tf_answer_cancel_client_operation cancel_client_operation; + struct tf_answer_header header; + struct tf_answer_create_device_context create_device_context; + struct tf_answer_open_client_session open_client_session; + struct tf_answer_close_client_session close_client_session; + struct tf_answer_register_shared_memory register_shared_memory; + struct tf_answer_release_shared_memory release_shared_memory; + struct tf_answer_invoke_client_command invoke_client_command; + struct tf_answer_destroy_device_context destroy_device_context; + struct tf_answer_cancel_client_operation cancel_client_operation; }; /* Structure of the Communication Buffer */ @@ -634,15 +634,15 @@ struct tf_l1_shared_buffer { u32 conf_descriptor; u32 conf_size; u32 conf_offset; - u8 reserved1[24]; + u8 reserved1[24]; #else u32 config_flag_s; u32 w3b_size_max_s; u32 reserved0; u32 w3b_size_current_s; - u8 reserved1[48]; + u8 reserved1[48]; #endif - u8 version_description[TF_DESCRIPTION_BUFFER_LENGTH]; + u8 version_description[TF_DESCRIPTION_BUFFER_LENGTH]; u32 status_s; u32 reserved2; u32 sync_serial_n; @@ -655,10 +655,10 @@ struct tf_l1_shared_buffer { u32 first_free_answer; u32 w3b_descriptors[128]; #ifdef CONFIG_TF_ZEBRA - u8 rpc_trace_buffer[140]; - u8 rpc_cus_buffer[180]; + u8 rpc_trace_buffer[140]; + u8 rpc_cus_buffer[180]; #else - u8 reserved3[320]; + u8 reserved3[320]; #endif u32 command_queue[TF_N_MESSAGE_QUEUE_CAPACITY]; u32 answer_queue[TF_S_ANSWER_QUEUE_CAPACITY]; @@ -680,9 +680,9 @@ struct tf_version_information_buffer { /* The IOCTLs the driver supports */ #include <linux/ioctl.h> -#define IOCTL_TF_GET_VERSION _IO('z', 0) -#define IOCTL_TF_EXCHANGE _IOWR('z', 1, union tf_command) -#define IOCTL_TF_GET_DESCRIPTION _IOR('z', 2, \ +#define IOCTL_TF_GET_VERSION _IO('z', 0) +#define IOCTL_TF_EXCHANGE _IOWR('z', 1, union tf_command) +#define IOCTL_TF_GET_DESCRIPTION _IOR('z', 2, \ struct tf_version_information_buffer) -#endif /* !defined(__TF_PROTOCOL_H__) */ +#endif /* !defined(__TF_PROTOCOL_H__) */ |