aboutsummaryrefslogtreecommitdiffstats
path: root/security/tf_driver
diff options
context:
space:
mode:
Diffstat (limited to 'security/tf_driver')
-rw-r--r--security/tf_driver/Kconfig8
-rw-r--r--security/tf_driver/Makefile36
-rw-r--r--security/tf_driver/s_version.h92
-rw-r--r--security/tf_driver/tf_comm.c1745
-rw-r--r--security/tf_driver/tf_comm.h202
-rw-r--r--security/tf_driver/tf_comm_tz.c885
-rw-r--r--security/tf_driver/tf_conn.c1574
-rw-r--r--security/tf_driver/tf_conn.h106
-rw-r--r--security/tf_driver/tf_defs.h538
-rw-r--r--security/tf_driver/tf_device.c796
-rw-r--r--security/tf_driver/tf_protocol.h690
-rw-r--r--security/tf_driver/tf_util.c1143
-rw-r--r--security/tf_driver/tf_util.h122
13 files changed, 7937 insertions, 0 deletions
diff --git a/security/tf_driver/Kconfig b/security/tf_driver/Kconfig
new file mode 100644
index 00000000000..2a980c5ade4
--- /dev/null
+++ b/security/tf_driver/Kconfig
@@ -0,0 +1,8 @@
1config TRUSTED_FOUNDATIONS
2 bool "Enable TF Driver"
3 default n
4 select CRYPTO_SHA1
5 help
6 This option adds kernel support for communication with the Trusted Foundations.
7 If you are unsure how to answer this question, answer N.
8
diff --git a/security/tf_driver/Makefile b/security/tf_driver/Makefile
new file mode 100644
index 00000000000..dfadb7d9740
--- /dev/null
+++ b/security/tf_driver/Makefile
@@ -0,0 +1,36 @@
1#
2# Copyright (c) 2006-2010 Trusted Logic S.A.
3# All Rights Reserved.
4#
5# This program is free software; you can redistribute it and/or
6# modify it under the terms of the GNU General Public License as
7# published by the Free Software Foundation; either version 2 of
8# the License, or (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18# MA 02111-1307 USA
19#
20
21# debug options
22#EXTRA_CFLAGS += -O0 -DDEBUG -D_DEBUG -DCONFIG_TF_DRIVER_DEBUG_SUPPORT
23EXTRA_CFLAGS += -DNDEBUG
24EXTRA_CFLAGS += -DLINUX -DCONFIG_TF_TRUSTZONE -DCONFIG_TFN
25
26ifdef S_VERSION_BUILD
27EXTRA_CFLAGS += -DS_VERSION_BUILD=$(S_VERSION_BUILD)
28endif
29
30tf_driver-objs += tf_util.o
31tf_driver-objs += tf_conn.o
32tf_driver-objs += tf_device.o
33tf_driver-objs += tf_comm.o
34tf_driver-objs += tf_comm_tz.o
35
36obj-$(CONFIG_TRUSTED_FOUNDATIONS) += tf_driver.o
diff --git a/security/tf_driver/s_version.h b/security/tf_driver/s_version.h
new file mode 100644
index 00000000000..6244d3fe7e8
--- /dev/null
+++ b/security/tf_driver/s_version.h
@@ -0,0 +1,92 @@
1/*
2 * Copyright (c) 2011 Trusted Logic S.A.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
17 * MA 02111-1307 USA
18 */
19
20#ifndef __S_VERSION_H__
21#define __S_VERSION_H__
22
23/*
24 * Usage: define S_VERSION_BUILD on the compiler's command line.
25 *
26 * Then set:
27 * - S_VERSION_OS
28 * - S_VERSION_PLATFORM
29 * - S_VERSION_MAIN
30 * - S_VERSION_ENG is optional
31 * - S_VERSION_PATCH is optional
32 * - S_VERSION_BUILD = 0 if S_VERSION_BUILD not defined or empty
33 */
34
35#define S_VERSION_OS "A" /* "A" for all Android */
36#define S_VERSION_PLATFORM "B" /* "B" for Tegra3 */
37
38/*
39 * This version number must be updated for each new release
40 */
41#define S_VERSION_MAIN "01.03"
42
43/*
44* If this is a patch or engineering version use the following
45* defines to set the version number. Else set these values to 0.
46*/
47#define S_VERSION_ENG 0
48#define S_VERSION_PATCH 0
49
50#ifdef S_VERSION_BUILD
51/* TRICK: detect if S_VERSION is defined but empty */
52#if 0 == S_VERSION_BUILD-0
53#undef S_VERSION_BUILD
54#define S_VERSION_BUILD 0
55#endif
56#else
57/* S_VERSION_BUILD is not defined */
58#define S_VERSION_BUILD 0
59#endif
60
61#define __STRINGIFY(X) #X
62#define __STRINGIFY2(X) __STRINGIFY(X)
63
64#if S_VERSION_ENG != 0
65#define _S_VERSION_ENG "e" __STRINGIFY2(S_VERSION_ENG)
66#else
67#define _S_VERSION_ENG ""
68#endif
69
70#if S_VERSION_PATCH != 0
71#define _S_VERSION_PATCH "p" __STRINGIFY2(S_VERSION_PATCH)
72#else
73#define _S_VERSION_PATCH ""
74#endif
75
76#if !defined(NDEBUG) || defined(_DEBUG)
77#define S_VERSION_VARIANT "D "
78#else
79#define S_VERSION_VARIANT " "
80#endif
81
82#define S_VERSION_STRING \
83 "TFN" \
84 S_VERSION_OS \
85 S_VERSION_PLATFORM \
86 S_VERSION_MAIN \
87 _S_VERSION_ENG \
88 _S_VERSION_PATCH \
89 "." __STRINGIFY2(S_VERSION_BUILD) " " \
90 S_VERSION_VARIANT
91
92#endif /* __S_VERSION_H__ */
diff --git a/security/tf_driver/tf_comm.c b/security/tf_driver/tf_comm.c
new file mode 100644
index 00000000000..16915beb406
--- /dev/null
+++ b/security/tf_driver/tf_comm.c
@@ -0,0 +1,1745 @@
1/**
2 * Copyright (c) 2011 Trusted Logic S.A.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
17 * MA 02111-1307 USA
18 */
19
20#include <asm/div64.h>
21#include <asm/system.h>
22#include <linux/version.h>
23#include <asm/cputype.h>
24#include <linux/interrupt.h>
25#include <linux/page-flags.h>
26#include <linux/pagemap.h>
27#include <linux/vmalloc.h>
28#include <linux/jiffies.h>
29#include <linux/freezer.h>
30
31#include "tf_defs.h"
32#include "tf_comm.h"
33#include "tf_protocol.h"
34#include "tf_util.h"
35#include "tf_conn.h"
36
37#ifdef CONFIG_TF_ZEBRA
38#include "tf_zebra.h"
39#endif
40
41/*---------------------------------------------------------------------------
42 * Internal Constants
43 *---------------------------------------------------------------------------*/
44
45/*
46 * shared memories descriptor constants
47 */
48#define DESCRIPTOR_B_MASK (1 << 2)
49#define DESCRIPTOR_C_MASK (1 << 3)
50#define DESCRIPTOR_S_MASK (1 << 10)
51
52#define L1_COARSE_DESCRIPTOR_BASE (0x00000001)
53#define L1_COARSE_DESCRIPTOR_ADDR_MASK (0xFFFFFC00)
54#define L1_COARSE_DESCRIPTOR_V13_12_SHIFT (5)
55
56#define L2_PAGE_DESCRIPTOR_BASE (0x00000003)
57#define L2_PAGE_DESCRIPTOR_AP_APX_READ (0x220)
58#define L2_PAGE_DESCRIPTOR_AP_APX_READ_WRITE (0x30)
59
60#define L2_INIT_DESCRIPTOR_BASE (0x00000003)
61#define L2_INIT_DESCRIPTOR_V13_12_SHIFT (4)
62
63/*