Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
408c3768
Commit
408c3768
authored
May 06, 2014
by
danh-arm
Browse files
Merge pull request #48 from danh-arm/dh/major-refactoring
dh/major refactoring
parents
b495bdef
97043ac9
Changes
118
Hide whitespace changes
Inline
Side-by-side
bl32/tsp/aarch64/tsp_request.S
View file @
408c3768
...
...
@@ -28,8 +28,8 @@
*
POSSIBILITY
OF
SUCH
DAMAGE
.
*/
#include <tsp.h>
#include <asm_macros.S>
#include <tsp.h>
.
globl
tsp_get_magic
...
...
bl32/tsp/tsp-fvp.mk
View file @
408c3768
...
...
@@ -28,11 +28,7 @@
# POSSIBILITY OF SUCH DAMAGE.
#
vpath
%.c
${PLAT_BL2_C_VPATH}
vpath
%.S
${PLAT_BL2_S_VPATH}
# TSP source files specific to FVP platform
BL32_SOURCES
+=
bl32_plat_setup.c
\
plat
form_mp_stack.S
\
plat_common.c
BL32_SOURCES
+=
plat/common/aarch64/platform_mp_stack.S
\
plat
/fvp/bl32_plat_setup.c
\
plat/fvp/aarch64/
plat_common.c
bl32/tsp/tsp.mk
View file @
408c3768
...
...
@@ -28,29 +28,13 @@
# POSSIBILITY OF SUCH DAMAGE.
#
vpath
%.c
common
\
lib
\
plat/${PLAT}
\
plat/${PLAT}/${ARCH}
\
arch/${ARCH}
BL32_SOURCES
+=
bl32/tsp/tsp_main.c
\
bl32/tsp/aarch64/tsp_entrypoint.S
\
bl32/tsp/aarch64/tsp_request.S
\
common/aarch64/early_exceptions.S
\
lib/locks/exclusive/spinlock.S
vpath
%.S
lib/arch/${ARCH}
\
include
\
lib/sync/locks/exclusive
\
common/${ARCH}
BL32_SOURCES
+=
tsp_entrypoint.S
\
tsp_main.c
\
tsp_request.S
\
spinlock.S
\
early_exceptions.S
BL32_LINKERFILE
:=
tsp.ld.S
vpath
%.ld.S
${BL32_ROOT}
vpath
%.c
${BL32_ROOT}
vpath
%.c
${BL32_ROOT}/${ARCH}
vpath
%.S
${BL32_ROOT}/${ARCH}
BL32_LINKERFILE
:=
bl32/tsp/tsp.ld.S
# Include the platform-specific TSP Makefile
# If no platform-specific TSP Makefile exists, it means TSP is not supported
...
...
bl32/tsp/tsp_main.c
View file @
408c3768
...
...
@@ -28,13 +28,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <bl32.h>
#include <tsp.h>
#include <arch_helpers.h>
#include <
stdio
.h>
#include <
platform
.h>
#include <
bl_common
.h>
#include <
bl32
.h>
#include <debug.h>
#include <platform.h>
#include <spinlock.h>
#include <stdio.h>
#include <tsp.h>
/*******************************************************************************
* Lock to control access to the console
...
...
@@ -45,19 +46,19 @@ spinlock_t console_lock;
* Per cpu data structure to populate parameters for an SMC in C code and use
* a pointer to this structure in assembler code to populate x0-x7
******************************************************************************/
static
tsp_args
tsp_smc_args
[
PLATFORM_CORE_COUNT
];
static
tsp_args
_t
tsp_smc_args
[
PLATFORM_CORE_COUNT
];
/*******************************************************************************
* Per cpu data structure to keep track of TSP activity
******************************************************************************/
static
work_statistics
tsp_stats
[
PLATFORM_CORE_COUNT
];
static
work_statistics
_t
tsp_stats
[
PLATFORM_CORE_COUNT
];
/*******************************************************************************
* Single reference to the various entry points exported by the test secure
* payload. A single copy should suffice for all cpus as they are not expected
* to change.
******************************************************************************/
static
const
entry_info
tsp_entry_info
=
{
static
const
entry_info
_t
tsp_entry_info
=
{
tsp_fast_smc_entry
,
tsp_cpu_on_entry
,
tsp_cpu_off_entry
,
...
...
@@ -65,7 +66,7 @@ static const entry_info tsp_entry_info = {
tsp_cpu_suspend_entry
,
};
static
tsp_args
*
set_smc_args
(
uint64_t
arg0
,
static
tsp_args
_t
*
set_smc_args
(
uint64_t
arg0
,
uint64_t
arg1
,
uint64_t
arg2
,
uint64_t
arg3
,
...
...
@@ -76,7 +77,7 @@ static tsp_args *set_smc_args(uint64_t arg0,
{
uint64_t
mpidr
=
read_mpidr
();
uint32_t
linear_id
;
tsp_args
*
pcpu_smc_args
;
tsp_args
_t
*
pcpu_smc_args
;
/*
* Return to Secure Monitor by raising an SMC. The results of the
...
...
@@ -107,7 +108,7 @@ uint64_t tsp_main(void)
uint32_t
linear_id
=
platform_get_core_pos
(
mpidr
);
#if DEBUG
meminfo
*
mem_layout
=
bl32_plat_sec_mem_layout
();
meminfo
_t
*
mem_layout
=
bl32_plat_sec_mem_layout
();
#endif
/* Initialize the platform */
...
...
@@ -145,7 +146,7 @@ uint64_t tsp_main(void)
* after this cpu's architectural state has been setup in response to an earlier
* psci cpu_on request.
******************************************************************************/
tsp_args
*
tsp_cpu_on_main
(
void
)
tsp_args
_t
*
tsp_cpu_on_main
(
void
)
{
uint64_t
mpidr
=
read_mpidr
();
uint32_t
linear_id
=
platform_get_core_pos
(
mpidr
);
...
...
@@ -171,7 +172,7 @@ tsp_args *tsp_cpu_on_main(void)
* This function performs any remaining book keeping in the test secure payload
* before this cpu is turned off in response to a psci cpu_off request.
******************************************************************************/
tsp_args
*
tsp_cpu_off_main
(
uint64_t
arg0
,
tsp_args
_t
*
tsp_cpu_off_main
(
uint64_t
arg0
,
uint64_t
arg1
,
uint64_t
arg2
,
uint64_t
arg3
,
...
...
@@ -206,7 +207,7 @@ tsp_args *tsp_cpu_off_main(uint64_t arg0,
* this cpu's architectural state is saved in response to an earlier psci
* cpu_suspend request.
******************************************************************************/
tsp_args
*
tsp_cpu_suspend_main
(
uint64_t
power_state
,
tsp_args
_t
*
tsp_cpu_suspend_main
(
uint64_t
power_state
,
uint64_t
arg1
,
uint64_t
arg2
,
uint64_t
arg3
,
...
...
@@ -241,7 +242,7 @@ tsp_args *tsp_cpu_suspend_main(uint64_t power_state,
* cpu's architectural state has been restored after wakeup from an earlier psci
* cpu_suspend request.
******************************************************************************/
tsp_args
*
tsp_cpu_resume_main
(
uint64_t
suspend_level
,
tsp_args
_t
*
tsp_cpu_resume_main
(
uint64_t
suspend_level
,
uint64_t
arg1
,
uint64_t
arg2
,
uint64_t
arg3
,
...
...
@@ -277,7 +278,7 @@ tsp_args *tsp_cpu_resume_main(uint64_t suspend_level,
* in the function arguments in order. Once the service is rendered, this
* function returns to Secure Monitor by raising SMC
******************************************************************************/
tsp_args
*
tsp_fast_smc_handler
(
uint64_t
func
,
tsp_args
_t
*
tsp_fast_smc_handler
(
uint64_t
func
,
uint64_t
arg1
,
uint64_t
arg2
,
uint64_t
arg3
,
...
...
common/aarch64/early_exceptions.S
View file @
408c3768
...
...
@@ -28,11 +28,8 @@
*
POSSIBILITY
OF
SUCH
DAMAGE
.
*/
#include <arch.h>
#include <bl_common.h>
#include <platform.h>
#include <runtime_svc.h>
#include <asm_macros.S>
#include <runtime_svc.h>
.
globl
early_exceptions
...
...
common/bl_common.c
View file @
408c3768
...
...
@@ -28,17 +28,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <arch.h>
#include <arch_helpers.h>
#include <console.h>
#include <platform.h>
#include <semihosting.h>
#include <assert.h>
#include <bl_common.h>
#include "io_storage.h"
#include "debug.h"
#include <debug.h>
#include <io_storage.h>
#include <platform.h>
#include <stdio.h>
unsigned
long
page_align
(
unsigned
long
value
,
unsigned
dir
)
{
...
...
@@ -74,7 +71,7 @@ void change_security_state(unsigned int target_security_state)
write_scr
(
scr
);
}
void
__dead2
drop_el
(
aapcs64_params
*
args
,
void
__dead2
drop_el
(
aapcs64_params
_t
*
args
,
unsigned
long
spsr
,
unsigned
long
entrypoint
)
{
...
...
@@ -90,7 +87,7 @@ void __dead2 drop_el(aapcs64_params *args,
args
->
arg7
);
}
void
__dead2
raise_el
(
aapcs64_params
*
args
)
void
__dead2
raise_el
(
aapcs64_params
_t
*
args
)
{
smc
(
args
->
arg0
,
args
->
arg1
,
...
...
@@ -107,7 +104,7 @@ void __dead2 raise_el(aapcs64_params *args)
* Add support for dropping into EL0 etc. Consider adding support
* for switching from S-EL1 to S-EL0/1 etc.
*/
void
__dead2
change_el
(
el_change_info
*
info
)
void
__dead2
change_el
(
el_change_info
_t
*
info
)
{
unsigned
long
current_el
=
read_current_el
();
...
...
@@ -156,8 +153,8 @@ unsigned long make_spsr(unsigned long target_el,
* TODO: Revisit if this and init_bl2_mem_layout can be replaced by a single
* routine.
******************************************************************************/
void
init_bl31_mem_layout
(
const
meminfo
*
bl2_mem_layout
,
meminfo
*
bl31_mem_layout
,
void
init_bl31_mem_layout
(
const
meminfo
_t
*
bl2_mem_layout
,
meminfo
_t
*
bl31_mem_layout
,
unsigned
int
load_type
)
{
if
(
load_type
==
BOT_LOAD
)
{
...
...
@@ -200,7 +197,7 @@ void init_bl31_mem_layout(const meminfo *bl2_mem_layout,
bl31_mem_layout
->
total_size
=
bl2_mem_layout
->
total_size
;
bl31_mem_layout
->
attr
=
load_type
;
flush_dcache_range
((
unsigned
long
)
bl31_mem_layout
,
sizeof
(
meminfo
));
flush_dcache_range
((
unsigned
long
)
bl31_mem_layout
,
sizeof
(
meminfo
_t
));
return
;
}
...
...
@@ -210,8 +207,8 @@ void init_bl31_mem_layout(const meminfo *bl2_mem_layout,
* this information, it populates bl2_mem_layout to tell BL2 how much memory
* it has access to and how much is available for use.
******************************************************************************/
void
init_bl2_mem_layout
(
meminfo
*
bl1_mem_layout
,
meminfo
*
bl2_mem_layout
,
void
init_bl2_mem_layout
(
meminfo
_t
*
bl1_mem_layout
,
meminfo
_t
*
bl2_mem_layout
,
unsigned
int
load_type
,
unsigned
long
bl2_base
)
{
...
...
@@ -232,13 +229,13 @@ void init_bl2_mem_layout(meminfo *bl1_mem_layout,
bl2_mem_layout
->
free_size
=
bl1_mem_layout
->
free_size
;
bl2_mem_layout
->
attr
=
load_type
;
flush_dcache_range
((
unsigned
long
)
bl2_mem_layout
,
sizeof
(
meminfo
));
flush_dcache_range
((
unsigned
long
)
bl2_mem_layout
,
sizeof
(
meminfo
_t
));
return
;
}
static
void
dump_load_info
(
unsigned
long
image_load_addr
,
unsigned
long
image_size
,
const
meminfo
*
mem_layout
)
const
meminfo
_t
*
mem_layout
)
{
#if DEBUG
printf
(
"Trying to load image at address 0x%lx, size = 0x%lx
\r\n
"
,
...
...
@@ -301,7 +298,7 @@ unsigned long image_size(const char *image_name)
* the bottom or top of the free memory. It updates the memory layout if the
* load is successful.
******************************************************************************/
unsigned
long
load_image
(
meminfo
*
mem_layout
,
unsigned
long
load_image
(
meminfo
_t
*
mem_layout
,
const
char
*
image_name
,
unsigned
int
load_type
,
unsigned
long
fixed_addr
)
...
...
@@ -553,7 +550,7 @@ void __dead2 run_image(unsigned long entrypoint,
void
*
first_arg
,
void
*
second_arg
)
{
el_change_info
run_image_info
;
el_change_info
_t
run_image_info
;
unsigned
long
current_el
=
read_current_el
();
/* Tell next EL what we want done */
...
...
drivers/arm/
interconnect/
cci
-
400/cci400.c
→
drivers/arm/cci400/cci400.c
View file @
408c3768
...
...
@@ -28,9 +28,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <assert.h>
#include <platform.h>
#include <cci400.h>
#include <mmio.h>
#include <platform.h>
static
inline
unsigned
long
get_slave_iface_base
(
unsigned
long
mpidr
)
{
...
...
@@ -44,7 +44,8 @@ void cci_enable_coherency(unsigned long mpidr)
DVM_EN_BIT
|
SNOOP_EN_BIT
);
/* Wait for the dust to settle down */
while
(
mmio_read_32
(
CCI400_BASE
+
STATUS_REG
)
&
CHANGE_PENDING_BIT
);
while
(
mmio_read_32
(
CCI400_BASE
+
STATUS_REG
)
&
CHANGE_PENDING_BIT
)
;
}
void
cci_disable_coherency
(
unsigned
long
mpidr
)
...
...
@@ -54,6 +55,7 @@ void cci_disable_coherency(unsigned long mpidr)
~
(
DVM_EN_BIT
|
SNOOP_EN_BIT
));
/* Wait for the dust to settle down */
while
(
mmio_read_32
(
CCI400_BASE
+
STATUS_REG
)
&
CHANGE_PENDING_BIT
);
while
(
mmio_read_32
(
CCI400_BASE
+
STATUS_REG
)
&
CHANGE_PENDING_BIT
)
;
}
arch/syste
m/gic/aarch64/gic_v3_sysregs.S
→
drivers/ar
m/gic/aarch64/gic_v3_sysregs.S
View file @
408c3768
File moved
arch/syste
m/gic/gic_v2.c
→
drivers/ar
m/gic/gic_v2.c
View file @
408c3768
...
...
@@ -29,7 +29,7 @@
*/
#include <assert.h>
#include <gic.h>
#include <gic
_v2
.h>
#include <mmio.h>
/*******************************************************************************
...
...
arch/syste
m/gic/gic_v3.c
→
drivers/ar
m/gic/gic_v3.c
View file @
408c3768
...
...
@@ -28,12 +28,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdint.h>
#include <arch.h>
#include <platform.h>
#include <gic.h>
#include <gic_v3.h>
#include <debug.h>
#include <gic_v3.h>
uintptr_t
gicv3_get_rdist
(
uintptr_t
gicr_base
,
uint64_t
mpidr
)
{
...
...
drivers/arm/
peripherals/
pl011/pl011.c
→
drivers/arm/pl011/pl011.c
View file @
408c3768
...
...
@@ -28,9 +28,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <assert.h>
#include <platform.h>
#include <pl011.h>
#include <assert.h>
void
pl011_setbaudrate
(
unsigned
long
base_addr
,
unsigned
int
baudrate
)
{
...
...
drivers/arm/
peripherals/
pl011/pl011_console.c
→
drivers/arm/pl011/pl011_console.c
View file @
408c3768
...
...
@@ -28,10 +28,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <assert.h>
#include <console.h>
#include <platform.h>
#include <pl011.h>
#include <assert.h>
static
unsigned
long
uart_base
;
...
...
drivers/arm/
interconnect/
tzc
-
400/tzc400.c
→
drivers/arm/tzc400/tzc400.c
View file @
408c3768
...
...
@@ -29,10 +29,10 @@
*/
#include <assert.h>
#include
"arch_helpers
.h
"
#include
"tzc400
.h
"
#include
"mmio
.h
"
#include
"debug
.h
"
#include
<debug
.h
>
#include
<mmio
.h
>
#include
<stddef
.h
>
#include
<tzc400
.h
>
static
uint32_t
tzc_read_build_config
(
uint64_t
base
)
{
...
...
@@ -49,7 +49,7 @@ static void tzc_write_gate_keeper(uint64_t base, uint32_t val)
mmio_write_32
(
base
+
GATE_KEEPER_OFF
,
val
);
}
static
void
tzc_write_action
(
uint64_t
base
,
enum
tzc_action
action
)
static
void
tzc_write_action
(
uint64_t
base
,
tzc_action
_t
action
)
{
mmio_write_32
(
base
+
ACTION_OFF
,
action
);
}
...
...
@@ -130,7 +130,7 @@ static void tzc_set_gate_keeper(uint64_t base, uint8_t filter, uint32_t val)
}
void
tzc_init
(
struct
tzc_instance
*
controller
)
void
tzc_init
(
tzc_instance
_t
*
controller
)
{
uint32_t
tzc_id
,
tzc_build
;
...
...
@@ -166,12 +166,12 @@ void tzc_init(struct tzc_instance *controller)
* this cannot be changed. It is, however, possible to change some region 0
* permissions.
*/
void
tzc_configure_region
(
const
struct
tzc_instance
*
controller
,
void
tzc_configure_region
(
const
tzc_instance
_t
*
controller
,
uint32_t
filters
,
uint8_t
region
,
uint64_t
region_base
,
uint64_t
region_top
,
enum
tzc_region_attributes
sec_attr
,
tzc_region_attributes
_t
sec_attr
,
uint32_t
ns_device_access
)
{
uint64_t
max_addr
;
...
...
@@ -218,7 +218,7 @@ void tzc_configure_region(const struct tzc_instance *controller,
}
void
tzc_set_action
(
const
struct
tzc_instance
*
controller
,
enum
tzc_action
action
)
void
tzc_set_action
(
const
tzc_instance
_t
*
controller
,
tzc_action
_t
action
)
{
assert
(
controller
!=
NULL
);
...
...
@@ -231,7 +231,7 @@ void tzc_set_action(const struct tzc_instance *controller, enum tzc_action actio
}
void
tzc_enable_filters
(
const
struct
tzc_instance
*
controller
)
void
tzc_enable_filters
(
const
tzc_instance
_t
*
controller
)
{
uint32_t
state
;
uint32_t
filter
;
...
...
@@ -250,7 +250,7 @@ void tzc_enable_filters(const struct tzc_instance *controller)
}
void
tzc_disable_filters
(
const
struct
tzc_instance
*
controller
)
void
tzc_disable_filters
(
const
tzc_instance
_t
*
controller
)
{
uint32_t
filter
;
...
...
drivers/io/io_fip.c
View file @
408c3768
...
...
@@ -28,17 +28,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <
stdin
t.h>
#include <
uuid
.h>
#include <
asser
t.h>
#include <
debug
.h>
#include <errno.h>
#include <firmware_image_package.h>
#include <io_driver.h>
#include <io_fip.h>
#include <io_storage.h>
#include <platform.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include "platform.h"
#include "firmware_image_package.h"
#include "io_storage.h"
#include "io_driver.h"
#include "io_fip.h"
#include "debug.h"
#include <uuid.h>
/* Useful for printing UUIDs when debugging.*/
#define PRINT_UUID2(x) \
...
...
@@ -51,7 +51,7 @@
typedef
struct
{
const
char
*
name
;
const
uuid_t
uuid
;
}
plat_fip_name_uuid
;
}
plat_fip_name_uuid
_t
;
typedef
struct
{
/* Put file_pos above the struct to allow {0} on static init.
...
...
@@ -59,10 +59,10 @@ typedef struct {
* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
*/
unsigned
int
file_pos
;
fip_toc_entry
entry
;
}
file_state
;
fip_toc_entry
_t
entry
;
}
file_state
_t
;
static
plat_fip_name_uuid
name_uuid
[]
=
{
static
plat_fip_name_uuid
_t
name_uuid
[]
=
{
{
BL2_IMAGE_NAME
,
UUID_TRUSTED_BOOT_FIRMWARE_BL2
},
{
BL31_IMAGE_NAME
,
UUID_EL3_RUNTIME_FIRMWARE_BL31
},
{
BL32_IMAGE_NAME
,
UUID_SECURE_PAYLOAD_BL32
},
...
...
@@ -70,21 +70,21 @@ static plat_fip_name_uuid name_uuid[] = {
};
static
const
uuid_t
uuid_null
=
{
0
};
static
file_state
current_file
=
{
0
};
static
file_state
_t
current_file
=
{
0
};
static
io_dev_handle
backend_dev_handle
;
static
void
*
backend_image_spec
;
/* Firmware Image Package driver functions */
static
int
fip_dev_open
(
void
*
spec
,
struct
io_dev_info
**
dev_info
);
static
int
fip_file_open
(
struct
io_dev_info
*
dev_info
,
const
void
*
spec
,
struct
io_entity
*
entity
);
static
int
fip_file_len
(
struct
io_entity
*
entity
,
size_t
*
length
);
static
int
fip_file_read
(
struct
io_entity
*
entity
,
void
*
buffer
,
size_t
length
,
static
int
fip_dev_open
(
void
*
spec
,
io_dev_info
_t
**
dev_info
);
static
int
fip_file_open
(
io_dev_info
_t
*
dev_info
,
const
void
*
spec
,
io_entity
_t
*
entity
);
static
int
fip_file_len
(
io_entity
_t
*
entity
,
size_t
*
length
);
static
int
fip_file_read
(
io_entity
_t
*
entity
,
void
*
buffer
,
size_t
length
,
size_t
*
length_read
);
static
int
fip_file_close
(
struct
io_entity
*
entity
);
static
int
fip_dev_init
(
struct
io_dev_info
*
dev_info
,
const
void
*
init_params
);
static
int
fip_dev_close
(
struct
io_dev_info
*
dev_info
);
static
int
fip_file_close
(
io_entity
_t
*
entity
);
static
int
fip_dev_init
(
io_dev_info
_t
*
dev_info
,
const
void
*
init_params
);
static
int
fip_dev_close
(
io_dev_info
_t
*
dev_info
);
static
inline
int
copy_uuid
(
uuid_t
*
dst
,
const
uuid_t
*
src
)
...
...
@@ -102,7 +102,7 @@ static inline int compare_uuids(const uuid_t *uuid1, const uuid_t *uuid2)
/* TODO: We could check version numbers or do a package checksum? */
static
inline
int
is_valid_header
(
fip_toc_header
*
header
)
static
inline
int
is_valid_header
(
fip_toc_header
_t
*
header
)
{
if
((
header
->
name
==
TOC_HEADER_NAME
)
&&
(
header
->
serial_number
!=
0
))
{
return
1
;
...
...
@@ -129,7 +129,7 @@ static int file_to_uuid(const char *filename, uuid_t *uuid)
/* Identify the device type as a virtual driver */
io_type
device_type_fip
(
void
)
io_type
_t
device_type_fip
(
void
)
{
return
IO_TYPE_FIRMWARE_IMAGE_PACKAGE
;
}
...
...
@@ -161,7 +161,7 @@ static struct io_dev_info fip_dev_info = {
/* Open a connection to the FIP device */
static
int
fip_dev_open
(
void
*
spec
__attribute__
((
unused
)),
struct
io_dev_info
**
dev_info
)
io_dev_info
_t
**
dev_info
)
{
assert
(
dev_info
!=
NULL
);
*
dev_info
=
&
fip_dev_info
;
...
...
@@ -171,12 +171,12 @@ static int fip_dev_open(void *spec __attribute__((unused)),
/* Do some basic package checks. */
static
int
fip_dev_init
(
struct
io_dev_info
*
dev_info
,
const
void
*
init_params
)
static
int
fip_dev_init
(
io_dev_info
_t
*
dev_info
,
const
void
*
init_params
)
{
int
result
=
IO_FAIL
;
char
*
image_name
=
(
char
*
)
init_params
;
io_handle
backend_handle
;
fip_toc_header
header
;
fip_toc_header
_t
header
;
size_t
bytes_read
;
/* Obtain a reference to the image by querying the platform layer */
...
...
@@ -215,7 +215,7 @@ static int fip_dev_init(struct io_dev_info *dev_info, const void *init_params)
}
/* Close a connection to the FIP device */
static
int
fip_dev_close
(
struct
io_dev_info
*
dev_info
)
static
int
fip_dev_close
(
io_dev_info
_t
*
dev_info
)
{
/* TODO: Consider tracking open files and cleaning them up here */
...
...
@@ -228,13 +228,13 @@ static int fip_dev_close(struct io_dev_info *dev_info)
/* Open a file for access from package. */
static
int
fip_file_open
(
struct
io_dev_info
*
dev_info
,
const
void
*
spec
,
struct
io_entity
*
entity
)
static
int
fip_file_open
(
io_dev_info
_t
*
dev_info
,
const
void
*
spec
,
io_entity
_t
*
entity
)
{
int
result
=
IO_FAIL
;
io_handle
backend_handle
;
uuid_t
file_uuid
;
const
io_file_spec
*
file_spec
=
(
io_file_spec
*
)
spec
;
const
io_file_spec
_t
*
file_spec
=
(
io_file_spec
_t
*
)
spec
;
size_t
bytes_read
;
int
found_file
=
0
;
...
...
@@ -262,7 +262,7 @@ static int fip_file_open(struct io_dev_info *dev_info, const void *spec,
}
/* Seek past the FIP header into the Table of Contents */
result
=
io_seek
(
backend_handle
,
IO_SEEK_SET
,
sizeof
(
fip_toc_header
));
result
=
io_seek
(
backend_handle
,
IO_SEEK_SET
,
sizeof
(
fip_toc_header
_t
));
if
(
result
!=
IO_SUCCESS
)
{
WARN
(
"fip_file_open: failed to seek
\n
"
);
result
=
IO_FAIL
;
...
...
@@ -310,23 +310,23 @@ static int fip_file_open(struct io_dev_info *dev_info, const void *spec,
/* Return the size of a file in package */
static
int
fip_file_len
(
struct
io_entity
*
entity
,
size_t
*
length
)
static
int
fip_file_len
(
io_entity
_t
*
entity
,
size_t
*
length
)
{
assert
(
entity
!=
NULL
);
assert
(
length
!=
NULL
);
*
length
=
((
file_state
*
)
entity
->
info
)
->
entry
.
size
;
*
length
=
((
file_state
_t
*
)
entity
->
info
)
->
entry
.
size
;
return
IO_SUCCESS
;
}
/* Read data from a file in package */
static
int
fip_file_read
(
struct
io_entity
*
entity
,
void
*
buffer
,
size_t
length
,
static
int
fip_file_read
(
io_entity
_t
*
entity
,
void
*
buffer
,
size_t
length
,
size_t
*
length_read
)
{
int
result
=
IO_FAIL
;
file_state
*
fp
;
file_state
_t
*
fp
;
size_t
file_offset
;
size_t
bytes_read
;
io_handle
backend_handle
;
...
...
@@ -345,7 +345,7 @@ static int fip_file_read(struct io_entity *entity, void *buffer, size_t length,
goto
fip_file_read_exit
;
}
fp
=
(
file_state
*
)
entity
->
info
;
fp
=
(
file_state
_t
*
)
entity
->
info
;
/* Seek to the position in the FIP where the payload lives */
file_offset
=
fp
->
entry
.
offset_address
+
fp
->
file_pos
;
...
...
@@ -378,7 +378,7 @@ static int fip_file_read(struct io_entity *entity, void *buffer, size_t length,
/* Close a file in package */
static
int
fip_file_close
(
struct
io_entity
*
entity
)
static
int
fip_file_close
(
io_entity
_t
*
entity
)
{
/* Clear our current file pointer.
* If we had malloc() we would free() here.
...
...
@@ -396,7 +396,7 @@ static int fip_file_close(struct io_entity *entity)
/* Exported functions */
/* Register the Firmware Image Package driver with the IO abstraction */
int
register_io_dev_fip
(
struct
io_dev_connector
**
dev_con
)
int
register_io_dev_fip
(
io_dev_connector
_t
**
dev_con
)
{
int
result
=
IO_FAIL
;
assert
(
dev_con
!=
NULL
);
...
...
drivers/io/io_memmap.c
View file @
408c3768
...
...
@@ -29,10 +29,10 @@
*/
#include <assert.h>
#include <debug.h>
#include <io_driver.h>
#include <io_storage.h>
#include <string.h>
#include "io_storage.h"
#include "io_driver.h"
#include "debug.h"
/* As we need to be able to keep state for seek, only one file can be open
* at a time. Make this a structure and point to the entity->info. When we
...
...
@@ -45,28 +45,28 @@ typedef struct {
int
in_use
;
size_t
base
;
size_t
file_pos
;
}
file_state
;
}
file_state
_t
;
static
file_state
current_file
=
{
0
};
static
file_state
_t
current_file
=
{
0
};
/* Identify the device type as memmap */
io_type
device_type_memmap
(
void
)
io_type
_t
device_type_memmap
(
void
)
{
return
IO_TYPE_MEMMAP
;
}
/* Memmap device functions */
static
int
memmap_dev_open
(
void
*
spec
,
struct
io_dev_info
**
dev_info
);
static
int
memmap_block_open
(
struct
io_dev_info
*
dev_info
,
const
void
*
spec
,
struct
io_entity
*
entity
);
static
int
memmap_block_seek
(
struct
io_entity
*
entity
,
int
mode
,
static
int
memmap_dev_open
(
void
*
spec
,
io_dev_info
_t
**
dev_info
);
static
int
memmap_block_open
(
io_dev_info
_t
*
dev_info
,
const
void
*
spec
,
io_entity
_t
*
entity
);
static
int
memmap_block_seek
(
io_entity
_t
*
entity
,
int
mode
,
ssize_t
offset
);
static
int
memmap_block_read
(
struct
io_entity
*
entity
,
void
*
buffer
,
static
int
memmap_block_read
(
io_entity
_t
*
entity
,
void
*
buffer
,
size_t
length
,
size_t
*
length_read
);
static
int
memmap_block_write
(
struct
io_entity
*
entity
,
const
void
*
buffer
,
static
int
memmap_block_write
(
io_entity
_t
*
entity
,
const
void
*
buffer
,
size_t
length
,
size_t
*
length_written
);
static
int
memmap_block_close
(
struct
io_entity
*
entity
);
static
int
memmap_dev_close
(
struct
io_dev_info
*
dev_info
);
static
int
memmap_block_close
(
io_entity
_t
*
entity
);
static
int
memmap_dev_close
(
io_dev_info
_t
*
dev_info
);
static
struct
io_dev_connector
memmap_dev_connector
=
{
...
...
@@ -95,7 +95,7 @@ static struct io_dev_info memmap_dev_info = {
/* Open a connection to the memmap device */
static
int
memmap_dev_open
(
void
*
spec
__attribute__
((
unused
)),
struct
io_dev_info
**
dev_info
)
io_dev_info
_t
**
dev_info
)
{
assert
(
dev_info
!=
NULL
);
*
dev_info
=
&
memmap_dev_info
;
...
...
@@ -106,7 +106,7 @@ static int memmap_dev_open(void *spec __attribute__((unused)),
/* Close a connection to the memmap device */
static
int
memmap_dev_close
(
struct
io_dev_info
*
dev_info
)
static
int
memmap_dev_close
(
io_dev_info
_t
*
dev_info
)
{
/* NOP */
/* TODO: Consider tracking open files and cleaning them up here */
...
...
@@ -116,11 +116,11 @@ static int memmap_dev_close(struct io_dev_info *dev_info)
/* Open a file on the memmap device */
/* TODO: Can we do any sensible limit checks on requested memory */
static
int
memmap_block_open
(
struct
io_dev_info
*
dev_info
,
const
void
*
spec
,
struct
io_entity
*
entity
)
static
int
memmap_block_open
(
io_dev_info
_t
*
dev_info
,
const
void
*
spec
,
io_entity
_t
*
entity
)
{
int
result
=
IO_FAIL
;
const
io_block_spec
*
block_spec
=
(
io_block_spec
*
)
spec
;
const
io_block_spec
_t
*
block_spec
=
(
io_block_spec
_t
*
)
spec
;
/* Since we need to track open state for seek() we only allow one open
* spec at a time. When we have dynamic memory we can malloc and set
...
...
@@ -146,7 +146,7 @@ static int memmap_block_open(struct io_dev_info *dev_info, const void *spec,
/* Seek to a particular file offset on the memmap device */
static
int
memmap_block_seek
(
struct
io_entity
*
entity
,
int
mode
,
ssize_t
offset
)
static
int
memmap_block_seek
(
io_entity
_t
*
entity
,
int
mode
,
ssize_t
offset
)
{
int
result
=
IO_FAIL
;
...
...
@@ -155,7 +155,7 @@ static int memmap_block_seek(struct io_entity *entity, int mode, ssize_t offset)
assert
(
entity
!=
NULL
);
/* TODO: can we do some basic limit checks on seek? */
((
file_state
*
)
entity
->
info
)
->
file_pos
=
offset
;
((
file_state
_t
*
)
entity
->
info
)
->
file_pos
=
offset
;
result
=
IO_SUCCESS
;
}
else
{
result
=
IO_FAIL
;
...
...
@@ -166,16 +166,16 @@ static int memmap_block_seek(struct io_entity *entity, int mode, ssize_t offset)
/* Read data from a file on the memmap device */
static
int
memmap_block_read
(
struct
io_entity
*
entity
,
void
*
buffer
,
static
int
memmap_block_read
(
io_entity
_t
*
entity
,
void
*
buffer
,
size_t
length
,
size_t
*
length_read
)
{
file_state
*
fp
;
file_state
_t
*
fp
;
assert
(
entity
!=
NULL
);
assert
(
buffer
!=
NULL
);
assert
(
length_read
!=
NULL
);
fp
=
(
file_state
*
)
entity
->
info
;
fp
=
(
file_state
_t
*
)
entity
->
info
;
memcpy
(
buffer
,
(
void
*
)(
fp
->
base
+
fp
->
file_pos
),
length
);
...
...
@@ -188,16 +188,16 @@ static int memmap_block_read(struct io_entity *entity, void *buffer,
/* Write data to a file on the memmap device */
static
int
memmap_block_write
(
struct
io_entity
*
entity
,
const
void
*
buffer
,
static
int
memmap_block_write
(
io_entity
_t
*
entity
,
const
void
*
buffer
,
size_t
length
,
size_t
*
length_written
)
{
file_state
*
fp
;
file_state
_t
*
fp
;
assert
(
entity
!=
NULL
);
assert
(
buffer
!=
NULL
);
assert
(
length_written
!=
NULL
);
fp
=
(
file_state
*
)
entity
->
info
;
fp
=
(
file_state
_t
*
)
entity
->
info
;
memcpy
((
void
*
)(
fp
->
base
+
fp
->
file_pos
),
buffer
,
length
);
...
...
@@ -211,7 +211,7 @@ static int memmap_block_write(struct io_entity *entity, const void *buffer,
/* Close a file on the memmap device */
static
int
memmap_block_close
(
struct
io_entity
*
entity
)
static
int
memmap_block_close
(
io_entity
_t
*
entity
)
{
assert
(
entity
!=
NULL
);
...
...
@@ -227,7 +227,7 @@ static int memmap_block_close(struct io_entity *entity)
/* Exported functions */
/* Register the memmap driver with the IO abstraction */
int
register_io_dev_memmap
(
struct
io_dev_connector
**
dev_con
)
int
register_io_dev_memmap
(
io_dev_connector
_t
**
dev_con
)
{
int
result
=
IO_FAIL
;
assert
(
dev_con
!=
NULL
);
...
...
drivers/io/io_semihosting.c
View file @
408c3768
...
...
@@ -29,14 +29,14 @@
*/
#include <assert.h>
#include
"
io_
storage
.h
"
#include
"
io_
driver
.h
"
#include
"
semihosting.h
"
#include
<
io_
driver
.h
>
#include
<
io_
storage
.h
>
#include
<
semihosting.h
>
/* Identify the device type as semihosting */
static
io_type
device_type_sh
(
void
)
static
io_type
_t
device_type_sh
(
void
)
{
return
IO_TYPE_SEMIHOSTING
;
}
...
...
@@ -44,16 +44,16 @@ static io_type device_type_sh(void)
/* Semi-hosting functions, device info and handle */
static
int
sh_dev_open
(
void
*
spec
,
struct
io_dev_info
**
dev_info
);
static
int
sh_file_open
(
struct
io_dev_info
*
dev_info
,
const
void
*
spec
,
struct
io_entity
*
entity
);
static
int
sh_file_seek
(
struct
io_entity
*
entity
,
int
mode
,
ssize_t
offset
);
static
int
sh_file_len
(
struct
io_entity
*
entity
,
size_t
*
length
);
static
int
sh_file_read
(
struct
io_entity
*
entity
,
void
*
buffer
,
size_t
length
,
static
int
sh_dev_open
(
void
*
spec
,
io_dev_info
_t
**
dev_info
);
static
int
sh_file_open
(
io_dev_info
_t
*
dev_info
,
const
void
*
spec
,
io_entity
_t
*
entity
);
static
int
sh_file_seek
(
io_entity
_t
*
entity
,
int
mode
,
ssize_t
offset
);
static
int
sh_file_len
(
io_entity
_t
*
entity
,
size_t
*
length
);
static
int
sh_file_read
(
io_entity
_t
*
entity
,
void
*
buffer
,
size_t
length
,
size_t
*
length_read
);
static
int
sh_file_write
(
struct
io_entity
*
entity
,
const
void
*
buffer
,
static
int
sh_file_write
(
io_entity
_t
*
entity
,
const
void
*
buffer
,
size_t
length
,
size_t
*
length_written
);
static
int
sh_file_close
(
struct
io_entity
*
entity
);
static
int
sh_file_close
(
io_entity
_t
*
entity
);
static
struct
io_dev_connector
sh_dev_connector
=
{
.
dev_open
=
sh_dev_open
...
...
@@ -80,7 +80,7 @@ static struct io_dev_info sh_dev_info = {
/* Open a connection to the semi-hosting device */
static
int
sh_dev_open
(
void
*
spec
__unused
,
struct
io_dev_info
**
dev_info
)
static
int
sh_dev_open
(
void
*
spec
__unused
,
io_dev_info
_t
**
dev_info
)
{
int
result
=
IO_SUCCESS
;
assert
(
dev_info
!=
NULL
);
...
...
@@ -90,12 +90,12 @@ static int sh_dev_open(void *spec __unused, struct io_dev_info **dev_info)
/* Open a file on the semi-hosting device */
static
int
sh_file_open
(
struct
io_dev_info
*
dev_info
__attribute__
((
unused
)),
const
void
*
spec
,
struct
io_entity
*
entity
)
static
int
sh_file_open
(
io_dev_info
_t
*
dev_info
__attribute__
((
unused
)),
const
void
*
spec
,
io_entity
_t
*
entity
)
{
int
result
=
IO_FAIL
;
long
sh_result
=
-
1
;
const
io_file_spec
*
file_spec
=
(
io_file_spec
*
)
spec
;
const
io_file_spec
_t
*
file_spec
=
(
io_file_spec
_t
*
)
spec
;
assert
(
file_spec
!=
NULL
);
assert
(
entity
!=
NULL
);
...
...
@@ -113,7 +113,7 @@ static int sh_file_open(struct io_dev_info *dev_info __attribute__((unused)),
/* Seek to a particular file offset on the semi-hosting device */
static
int
sh_file_seek
(
struct
io_entity
*
entity
,
int
mode
,
ssize_t
offset
)
static
int
sh_file_seek
(
io_entity
_t
*
entity
,
int
mode
,
ssize_t
offset
)
{
int
result
=
IO_FAIL
;
long
file_handle
,
sh_result
;
...
...
@@ -131,7 +131,7 @@ static int sh_file_seek(struct io_entity *entity, int mode, ssize_t offset)
/* Return the size of a file on the semi-hosting device */
static
int
sh_file_len
(
struct
io_entity
*
entity
,
size_t
*
length
)
static
int
sh_file_len
(
io_entity
_t
*
entity
,
size_t
*
length
)
{
int
result
=
IO_FAIL
;
...
...
@@ -151,7 +151,7 @@ static int sh_file_len(struct io_entity *entity, size_t *length)
/* Read data from a file on the semi-hosting device */
static
int
sh_file_read
(
struct
io_entity
*
entity
,
void
*
buffer
,
size_t
length
,
static
int
sh_file_read
(
io_entity
_t
*
entity
,
void
*
buffer
,
size_t
length
,
size_t
*
length_read
)
{
int
result
=
IO_FAIL
;
...
...
@@ -178,7 +178,7 @@ static int sh_file_read(struct io_entity *entity, void *buffer, size_t length,
/* Write data to a file on the semi-hosting device */
static
int
sh_file_write
(
struct
io_entity
*
entity
,
const
void
*
buffer
,
static
int
sh_file_write
(
io_entity
_t
*
entity
,
const
void
*
buffer
,
size_t
length
,
size_t
*
length_written
)
{
int
result
=
IO_FAIL
;
...
...
@@ -205,7 +205,7 @@ static int sh_file_write(struct io_entity *entity, const void *buffer,
/* Close a file on the semi-hosting device */
static
int
sh_file_close
(
struct
io_entity
*
entity
)
static
int
sh_file_close
(
io_entity
_t
*
entity
)
{
int
result
=
IO_FAIL
;
long
sh_result
=
-
1
;
...
...
@@ -226,7 +226,7 @@ static int sh_file_close(struct io_entity *entity)
/* Exported functions */
/* Register the semi-hosting driver with the IO abstraction */
int
register_io_dev_sh
(
struct
io_dev_connector
**
dev_con
)
int
register_io_dev_sh
(
io_dev_connector
_t
**
dev_con
)
{
int
result
=
IO_FAIL
;
assert
(
dev_con
!=
NULL
);
...
...
include/bl1.h
→
include/bl1
/bl1
.h
View file @
408c3768
...
...
@@ -31,16 +31,16 @@
#ifndef __BL1_H__
#define __BL1_H__
#include <bl_common.h>
#ifndef __ASSEMBLY__
/******************************************
* Forward declarations
*****************************************/
struct
meminfo
;
/******************************************
* Function prototypes
*****************************************/
extern
void
bl1_platform_setup
(
void
);
extern
meminfo
*
bl1_plat_sec_mem_layout
(
void
);
#endif
/*__ASSEMBLY__*/
extern
struct
meminfo
*
bl1_plat_sec_mem_layout
(
void
);
#endif
/* __BL1_H__ */
include/bl2.h
→
include/bl2
/bl2
.h
View file @
408c3768
...
...
@@ -31,18 +31,22 @@
#ifndef __BL2_H__
#define __BL2_H__
#include <bl_common.h>
/******************************************
* Data declarations
*****************************************/
extern
unsigned
long
long
bl2_entrypoint
;
/******************************************
* Forward declarations
*****************************************/
struct
meminfo
;
struct
bl31_args
;
/******************************************
* Function prototypes
*****************************************/
extern
void
bl2_platform_setup
(
void
);
extern
meminfo
*
bl2_plat_sec_mem_layout
(
void
);
extern
bl31_args
*
bl2_get_bl31_args_ptr
(
void
);
extern
struct
meminfo
*
bl2_plat_sec_mem_layout
(
void
);
extern
struct
bl31_args
*
bl2_get_bl31_args_ptr
(
void
);
#endif
/* __BL2_H__ */
include/bl31.h
→
include/bl31
/bl31
.h
View file @
408c3768
...
...
@@ -31,23 +31,31 @@
#ifndef __BL31_H__
#define __BL31_H__
#include <
bl_common
.h>
#include <
stdint
.h>
/*******************************************************************************
* Data declarations
******************************************************************************/
extern
unsigned
long
bl31_entrypoint
;
/******************************************
* Forward declarations
*****************************************/
struct
meminfo
;
struct
el_change_info
;
/*******************************************************************************
* Function prototypes
******************************************************************************/
extern
void
bl31_arch_setup
(
void
);
extern
void
bl31_next_el_arch_setup
(
uint32_t
security_state
);
extern
void
bl31_set_next_image_type
(
uint32_t
type
);
extern
uint32_t
bl31_get_next_image_type
(
void
);
extern
void
bl31_prepare_next_image_entry
();
extern
el_change_info
*
bl31_get_next_image_info
(
uint32_t
type
);
extern
struct
el_change_info
*
bl31_get_next_image_info
(
uint32_t
type
);
extern
void
bl31_platform_setup
(
void
);
extern
meminfo
*
bl31_plat_get_bl32_mem_layout
(
void
);
extern
meminfo
*
bl31_plat_sec_mem_layout
(
void
);
extern
void
bl31_register_bl32_init
(
int32_t
(
*
)(
meminfo
*
));
extern
struct
meminfo
*
bl31_plat_get_bl32_mem_layout
(
void
);
extern
struct
meminfo
*
bl31_plat_sec_mem_layout
(
void
);
extern
void
bl31_register_bl32_init
(
int32_t
(
*
)(
struct
meminfo
*
));
#endif
/* __BL31_H__ */
include/cm_macros.S
→
include/
bl31/
cm_macros.S
View file @
408c3768
...
...
@@ -27,6 +27,11 @@
*
ARISING
IN
ANY
WAY
OUT
OF
THE
USE
OF
THIS
SOFTWARE
,
EVEN
IF
ADVISED
OF
THE
*
POSSIBILITY
OF
SUCH
DAMAGE
.
*/
#include <arch.h>
#include <context.h>
/
*
---------------------------------------------
*
Zero
out
the
callee
saved
register
to
prevent
*
leakage
of
secure
state
into
the
normal
world
...
...
Prev
1
2
3
4
5
6
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment