Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
80e98a9c
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
80e98a9c
编写于
5月 24, 2014
作者:
A
Arnd Bergmann
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'bcm/cleanup' into next/soc
Conflicts: arch/arm/mach-bcm/Kconfig
上级
3c258017
eeda4cb9
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
170 addition
and
149 deletion
+170
-149
arch/arm/mach-bcm/Kconfig
arch/arm/mach-bcm/Kconfig
+35
-5
arch/arm/mach-bcm/Makefile
arch/arm/mach-bcm/Makefile
+17
-4
arch/arm/mach-bcm/bcm_kona_smc.c
arch/arm/mach-bcm/bcm_kona_smc.c
+98
-38
arch/arm/mach-bcm/bcm_kona_smc.h
arch/arm/mach-bcm/bcm_kona_smc.h
+2
-50
arch/arm/mach-bcm/bcm_kona_smc_asm.S
arch/arm/mach-bcm/bcm_kona_smc_asm.S
+0
-41
arch/arm/mach-bcm/board_bcm21664.c
arch/arm/mach-bcm/board_bcm21664.c
+2
-3
arch/arm/mach-bcm/board_bcm281xx.c
arch/arm/mach-bcm/board_bcm281xx.c
+1
-1
arch/arm/mach-bcm/kona_l2_cache.c
arch/arm/mach-bcm/kona_l2_cache.c
+10
-6
arch/arm/mach-bcm/kona_l2_cache.h
arch/arm/mach-bcm/kona_l2_cache.h
+5
-1
未找到文件。
arch/arm/mach-bcm/Kconfig
浏览文件 @
80e98a9c
...
...
@@ -10,21 +10,51 @@ if ARCH_BCM
menu "Broadcom SoC Selection"
config ARCH_BCM_MOBILE
bool "Broadcom Mobile SoC" if ARCH_MULTI_V7
bool "Broadcom Mobile SoC
Support
" if ARCH_MULTI_V7
select ARCH_REQUIRE_GPIOLIB
select ARM_ERRATA_754322
select ARM_ERRATA_764369 if SMP
select ARM_GIC
select GPIO_BCM_KONA
select TICK_ONESHOT
select CACHE_L2X0
select HAVE_ARM_ARCH_TIMER
select PINCTRL
help
This enables support for systems based on Broadcom mobile SoCs.
It currently supports the 'BCM281XX' family, which includes
BCM11130, BCM11140, BCM11351, BCM28145 and
BCM28155 variants.
if ARCH_BCM_MOBILE
menu "Broadcom Mobile SoC Selection"
config ARCH_BCM_281XX
bool "Broadcom BCM281XX SoC family"
default y
help
Enable support for the the BCM281XX family, which includes
BCM11130, BCM11140, BCM11351, BCM28145 and BCM28155
variants.
config ARCH_BCM_21664
bool "Broadcom BCM21664 SoC family"
default y
help
Enable support for the the BCM21664 family, which includes
BCM21663 and BCM21664 variants.
config ARCH_BCM_MOBILE_L2_CACHE
bool "Broadcom mobile SoC level 2 cache support"
depends on (ARCH_BCM_281XX || ARCH_BCM_21664)
default y
select CACHE_L2X0
select ARCH_BCM_MOBILE_SMC
config ARCH_BCM_MOBILE_SMC
bool
depends on ARCH_BCM_281XX || ARCH_BCM_21664
endmenu
endif
config ARCH_BCM2835
bool "Broadcom BCM2835 family" if ARCH_MULTI_V6
...
...
arch/arm/mach-bcm/Makefile
浏览文件 @
80e98a9c
...
...
@@ -10,10 +10,23 @@
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
obj-$(CONFIG_ARCH_BCM_MOBILE)
:=
board_bcm281xx.o board_bcm21664.o
\
bcm_kona_smc.o bcm_kona_smc_asm.o kona.o
# BCM281XX
obj-$(CONFIG_ARCH_BCM_281XX)
+=
board_bcm281xx.o
# BCM21664
obj-$(CONFIG_ARCH_BCM_21664)
+=
board_bcm21664.o
# BCM281XX and BCM21664 L2 cache control
obj-$(CONFIG_ARCH_BCM_MOBILE_L2_CACHE)
+=
kona_l2_cache.o
# Support for secure monitor traps
obj-$(CONFIG_ARCH_BCM_MOBILE_SMC)
+=
bcm_kona_smc.o
ifeq
($(call as-instr,.arch_extension sec,as_has_sec),as_has_sec)
CFLAGS_bcm_kona_smc.o
+=
-Wa
,-march
=
armv7-a+sec
-DREQUIRES_SEC
endif
# BCM2835
obj-$(CONFIG_ARCH_BCM2835)
+=
board_bcm2835.o
plus_sec
:=
$(
call
as-instr,.arch_extension sec,+sec
)
AFLAGS_bcm_kona_smc_asm.o
:=
-Wa
,-march
=
armv7-a
$(plus_sec)
# BCM5301X
obj-$(CONFIG_ARCH_BCM_5301X)
+=
bcm_5301x.o
arch/arm/mach-bcm/bcm_kona_smc.c
浏览文件 @
80e98a9c
...
...
@@ -21,11 +21,8 @@
#include "bcm_kona_smc.h"
struct
secure_bridge_data
{
void
__iomem
*
bounce
;
/* virtual address */
u32
__iomem
buffer_addr
;
/* physical address */
int
initialized
;
}
bridge_data
;
static
u32
bcm_smc_buffer_phys
;
/* physical address */
static
void
__iomem
*
bcm_smc_buffer
;
/* virtual address */
struct
bcm_kona_smc_data
{
unsigned
service_id
;
...
...
@@ -33,6 +30,7 @@ struct bcm_kona_smc_data {
unsigned
arg1
;
unsigned
arg2
;
unsigned
arg3
;
unsigned
result
;
};
static
const
struct
of_device_id
bcm_kona_smc_ids
[]
__initconst
=
{
...
...
@@ -41,59 +39,125 @@ static const struct of_device_id bcm_kona_smc_ids[] __initconst = {
{},
};
/* Map in the
bounce
area */
/* Map in the
args buffer
area */
int
__init
bcm_kona_smc_init
(
void
)
{
struct
device_node
*
node
;
const
__be32
*
prop_val
;
u64
prop_size
=
0
;
unsigned
long
buffer_size
;
u32
buffer_phys
;
/* Read buffer addr and size from the device tree node */
node
=
of_find_matching_node
(
NULL
,
bcm_kona_smc_ids
);
if
(
!
node
)
return
-
ENODEV
;
/* Don't care about size or flags of the DT node */
bridge_data
.
buffer_addr
=
be32_to_cpu
(
*
of_get_address
(
node
,
0
,
NULL
,
NULL
));
BUG_ON
(
!
bridge_data
.
buffer_addr
);
prop_val
=
of_get_address
(
node
,
0
,
&
prop_size
,
NULL
);
if
(
!
prop_val
)
return
-
EINVAL
;
bridge_data
.
bounce
=
of_iomap
(
node
,
0
);
BUG_ON
(
!
bridge_data
.
bounce
);
/* We assume space for four 32-bit arguments */
if
(
prop_size
<
4
*
sizeof
(
u32
)
||
prop_size
>
(
u64
)
ULONG_MAX
)
return
-
EINVAL
;
buffer_size
=
(
unsigned
long
)
prop_size
;
bridge_data
.
initialized
=
1
;
buffer_phys
=
be32_to_cpup
(
prop_val
);
if
(
!
buffer_phys
)
return
-
EINVAL
;
bcm_smc_buffer
=
ioremap
(
buffer_phys
,
buffer_size
);
if
(
!
bcm_smc_buffer
)
return
-
ENOMEM
;
bcm_smc_buffer_phys
=
buffer_phys
;
pr_info
(
"Kona Secure API initialized
\n
"
);
return
0
;
}
/*
* int bcm_kona_do_smc(u32 service_id, u32 buffer_addr)
*
* Only core 0 can run the secure monitor code. If an "smc" request
* is initiated on a different core it must be redirected to core 0
* for execution. We rely on the caller to handle this.
*
* Each "smc" request supplies a service id and the address of a
* buffer containing parameters related to the service to be
* performed. A flags value defines the behavior of the level 2
* cache and interrupt handling while the secure monitor executes.
*
* Parameters to the "smc" request are passed in r4-r6 as follows:
* r4 service id
* r5 flags (SEC_ROM_*)
* r6 physical address of buffer with other parameters
*
* Execution of an "smc" request produces two distinct results.
*
* First, the secure monitor call itself (regardless of the specific
* service request) can succeed, or can produce an error. When an
* "smc" request completes this value is found in r12; it should
* always be SEC_EXIT_NORMAL.
*
* In addition, the particular service performed produces a result.
* The values that should be expected depend on the service. We
* therefore return this value to the caller, so it can handle the
* request result appropriately. This result value is found in r0
* when the "smc" request completes.
*/
static
int
bcm_kona_do_smc
(
u32
service_id
,
u32
buffer_phys
)
{
register
u32
ip
asm
(
"ip"
);
/* Also called r12 */
register
u32
r0
asm
(
"r0"
);
register
u32
r4
asm
(
"r4"
);
register
u32
r5
asm
(
"r5"
);
register
u32
r6
asm
(
"r6"
);
r4
=
service_id
;
r5
=
0x3
;
/* Keep IRQ and FIQ off in SM */
r6
=
buffer_phys
;
asm
volatile
(
/* Make sure we got the registers we want */
__asmeq
(
"%0"
,
"ip"
)
__asmeq
(
"%1"
,
"r0"
)
__asmeq
(
"%2"
,
"r4"
)
__asmeq
(
"%3"
,
"r5"
)
__asmeq
(
"%4"
,
"r6"
)
#ifdef REQUIRES_SEC
".arch_extension sec
\n
"
#endif
" smc #0
\n
"
:
"=r"
(
ip
),
"=r"
(
r0
)
:
"r"
(
r4
),
"r"
(
r5
),
"r"
(
r6
)
:
"r1"
,
"r2"
,
"r3"
,
"r7"
,
"lr"
);
BUG_ON
(
ip
!=
SEC_EXIT_NORMAL
);
return
r0
;
}
/* __bcm_kona_smc() should only run on CPU 0, with pre-emption disabled */
static
void
__bcm_kona_smc
(
void
*
info
)
{
struct
bcm_kona_smc_data
*
data
=
info
;
u32
*
args
=
bridge_data
.
bounce
;
int
rc
=
0
;
u32
*
args
=
bcm_smc_buffer
;
/* Must run on CPU 0 */
BUG_ON
(
smp_processor_id
()
!=
0
);
BUG_ON
(
!
args
);
/* Check map in the bounce area */
BUG_ON
(
!
bridge_data
.
initialized
);
/* Copy one 32 bit word into the bounce area */
args
[
0
]
=
data
->
arg0
;
args
[
1
]
=
data
->
arg1
;
args
[
2
]
=
data
->
arg2
;
args
[
3
]
=
data
->
arg3
;
/* Copy the four 32 bit argument values into the bounce area */
writel_relaxed
(
data
->
arg0
,
args
++
);
writel_relaxed
(
data
->
arg1
,
args
++
);
writel_relaxed
(
data
->
arg2
,
args
++
);
writel
(
data
->
arg3
,
args
);
/* Flush caches for input data passed to Secure Monitor */
if
(
data
->
service_id
!=
SSAPI_BRCM_START_VC_CORE
)
flush_cache_all
();
/* Trap into Secure Monitor */
rc
=
bcm_kona_smc_asm
(
data
->
service_id
,
bridge_data
.
buffer_addr
);
flush_cache_all
();
if
(
rc
!=
SEC_ROM_RET_OK
)
pr_err
(
"Secure Monitor call failed (0x%x)!
\n
"
,
rc
);
/* Trap into Secure Monitor and record the request result */
data
->
result
=
bcm_kona_do_smc
(
data
->
service_id
,
bcm_smc_buffer_phys
);
}
unsigned
bcm_kona_smc
(
unsigned
service_id
,
unsigned
arg0
,
unsigned
arg1
,
...
...
@@ -106,17 +170,13 @@ unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1,
data
.
arg1
=
arg1
;
data
.
arg2
=
arg2
;
data
.
arg3
=
arg3
;
data
.
result
=
0
;
/*
* Due to a limitation of the secure monitor, we must use the SMP
* infrastructure to forward all secure monitor calls to Core 0.
*/
if
(
get_cpu
()
!=
0
)
smp_call_function_single
(
0
,
__bcm_kona_smc
,
(
void
*
)
&
data
,
1
);
else
__bcm_kona_smc
(
&
data
);
smp_call_function_single
(
0
,
__bcm_kona_smc
,
&
data
,
1
);
put_cpu
();
return
0
;
return
data
.
result
;
}
arch/arm/mach-bcm/bcm_kona_smc.h
浏览文件 @
80e98a9c
...
...
@@ -15,55 +15,12 @@
#define BCM_KONA_SMC_H
#include <linux/types.h>
#define FLAGS (SEC_ROM_ICACHE_ENABLE_MASK | SEC_ROM_DCACHE_ENABLE_MASK | \
SEC_ROM_IRQ_ENABLE_MASK | SEC_ROM_FIQ_ENABLE_MASK)
/*!
* Definitions for IRQ & FIQ Mask for ARM
*/
#define FIQ_IRQ_MASK 0xC0
#define FIQ_MASK 0x40
#define IRQ_MASK 0x80
/*!
* Secure Mode FLAGs
*/
/* When set, enables ICache within the secure mode */
#define SEC_ROM_ICACHE_ENABLE_MASK 0x00000001
/* When set, enables DCache within the secure mode */
#define SEC_ROM_DCACHE_ENABLE_MASK 0x00000002
/* When set, enables IRQ within the secure mode */
#define SEC_ROM_IRQ_ENABLE_MASK 0x00000004
/* When set, enables FIQ within the secure mode */
#define SEC_ROM_FIQ_ENABLE_MASK 0x00000008
/* When set, enables Unified L2 cache within the secure mode */
#define SEC_ROM_UL2_CACHE_ENABLE_MASK 0x00000010
/* Broadcom Secure Service API Service IDs */
#define SSAPI_DORMANT_ENTRY_SERV 0x01000000
#define SSAPI_PUBLIC_OTP_SERV 0x01000001
#define SSAPI_ENABLE_L2_CACHE 0x01000002
#define SSAPI_DISABLE_L2_CACHE 0x01000003
#define SSAPI_WRITE_SCU_STATUS 0x01000004
#define SSAPI_WRITE_PWR_GATE 0x01000005
/* Broadcom Secure Service API Return Codes */
/* Broadcom Secure Service API service IDs, return codes, and exit codes */
#define SSAPI_ENABLE_L2_CACHE 0x01000002
#define SEC_ROM_RET_OK 0x00000001
#define SEC_ROM_RET_FAIL 0x00000009
#define SSAPI_RET_FROM_INT_SERV 0x4
#define SEC_EXIT_NORMAL 0x1
#define SSAPI_ROW_AES 0x0E000006
#define SSAPI_BRCM_START_VC_CORE 0x0E000008
#ifndef __ASSEMBLY__
extern
int
__init
bcm_kona_smc_init
(
void
);
extern
unsigned
bcm_kona_smc
(
unsigned
service_id
,
...
...
@@ -72,9 +29,4 @@ extern unsigned bcm_kona_smc(unsigned service_id,
unsigned
arg2
,
unsigned
arg3
);
extern
int
bcm_kona_smc_asm
(
u32
service_id
,
u32
buffer_addr
);
#endif
/* __ASSEMBLY__ */
#endif
/* BCM_KONA_SMC_H */
arch/arm/mach-bcm/bcm_kona_smc_asm.S
已删除
100644 → 0
浏览文件 @
3c258017
/*
*
Copyright
(
C
)
2013
Broadcom
Corporation
*
*
This
program
is
free
software
; you can redistribute it and/or
*
modify
it
under
the
terms
of
the
GNU
General
Public
License
as
*
published
by
the
Free
Software
Foundation
version
2
.
*
*
This
program
is
distributed
"as is"
WITHOUT
ANY
WARRANTY
of
any
*
kind
,
whether
express
or
implied
; without even the implied warranty
*
of
MERCHANTABILITY
or
FITNESS
FOR
A
PARTICULAR
PURPOSE
.
See
the
*
GNU
General
Public
License
for
more
details
.
*/
#include <linux/linkage.h>
#include "bcm_kona_smc.h"
/*
*
int
bcm_kona_smc_asm
(
u32
service_id
,
u32
buffer_addr
)
*/
ENTRY
(
bcm_kona_smc_asm
)
stmfd
sp
!,
{
r4
-
r12
,
lr
}
mov
r4
,
r0
@
service_id
mov
r5
,
#
3
@
Keep
IRQ
and
FIQ
off
in
SM
/
*
*
Since
interrupts
are
disabled
in
the
open
mode
,
we
must
keep
*
interrupts
disabled
in
secure
mode
by
setting
R5
=
0x3
.
If
interrupts
*
are
enabled
in
open
mode
,
we
can
set
R5
=
0x0
to
allow
interrupts
in
*
secure
mode
.
If
we
did
this
,
the
secure
monitor
would
return
back
*
control
to
the
open
mode
to
handle
the
interrupt
prior
to
completing
*
the
secure
service
.
If
this
happened
,
R12
would
not
be
*
SEC_EXIT_NORMAL
and
we
would
need
to
call
SMC
again
after
resetting
*
R5
(
it
gets
clobbered
by
the
secure
monitor
)
and
setting
R4
to
*
SSAPI_RET_FROM_INT_SERV
to
indicate
that
we
want
the
secure
monitor
*
to
finish
up
the
previous
uncompleted
secure
service
.
*/
mov
r6
,
r1
@
buffer_addr
smc
#
0
/
*
Check
r12
for
SEC_EXIT_NORMAL
here
if
interrupts
are
enabled
*/
ldmfd
sp
!,
{
r4
-
r12
,
pc
}
ENDPROC
(
bcm_kona_smc_asm
)
arch/arm/mach-bcm/board_bcm21664.c
浏览文件 @
80e98a9c
...
...
@@ -11,14 +11,13 @@
* GNU General Public License for more details.
*/
#include <linux/clocksource.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/io.h>
#include <asm/mach/arch.h>
#include "bcm_kona_smc.h"
#include "kona.h"
#include "kona_l2_cache.h"
#define RSTMGR_DT_STRING "brcm,bcm21664-resetmgr"
...
...
arch/arm/mach-bcm/board_bcm281xx.c
浏览文件 @
80e98a9c
...
...
@@ -17,7 +17,7 @@
#include <asm/mach/arch.h>
#include "kona.h"
#include "kona
_l2_cache
.h"
#define SECWDOG_OFFSET 0x00000000
#define SECWDOG_RESERVED_MASK 0xe2000000
...
...
arch/arm/mach-bcm/kona.c
→
arch/arm/mach-bcm/kona
_l2_cache
.c
浏览文件 @
80e98a9c
...
...
@@ -11,19 +11,18 @@
* GNU General Public License for more details.
*/
#include <linux/of_platform.h>
#include <linux/init.h>
#include <linux/printk.h>
#include <asm/hardware/cache-l2x0.h>
#include "bcm_kona_smc.h"
#include "kona.h"
void
__init
kona_l2_cache_init
(
void
)
{
unsigned
int
result
;
int
ret
;
if
(
!
IS_ENABLED
(
CONFIG_CACHE_L2X0
))
return
;
ret
=
bcm_kona_smc_init
();
if
(
ret
)
{
pr_info
(
"Secure API not available (%d). Skipping L2 init.
\n
"
,
...
...
@@ -31,7 +30,12 @@ void __init kona_l2_cache_init(void)
return
;
}
bcm_kona_smc
(
SSAPI_ENABLE_L2_CACHE
,
0
,
0
,
0
,
0
);
result
=
bcm_kona_smc
(
SSAPI_ENABLE_L2_CACHE
,
0
,
0
,
0
,
0
);
if
(
result
!=
SEC_ROM_RET_OK
)
{
pr_err
(
"Secure Monitor call failed (%u)! Skipping L2 init.
\n
"
,
result
);
return
;
}
/*
* The aux_val and aux_mask have no effect since L2 cache is already
...
...
arch/arm/mach-bcm/kona.h
→
arch/arm/mach-bcm/kona
_l2_cache
.h
浏览文件 @
80e98a9c
...
...
@@ -11,4 +11,8 @@
* GNU General Public License for more details.
*/
void
__init
kona_l2_cache_init
(
void
);
#ifdef CONFIG_ARCH_BCM_MOBILE_L2_CACHE
void
kona_l2_cache_init
(
void
);
#else
#define kona_l2_cache_init() ((void)0)
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录