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
108e4df7
Commit
108e4df7
authored
Feb 16, 2017
by
davidcunado-arm
Committed by
GitHub
Feb 16, 2017
Browse files
Merge pull request #834 from douglas-raillard-arm/dr/use_dc_zva_zeroing
Use DC ZVA instruction to zero memory
parents
406a4ade
32f0d3c6
Changes
36
Hide whitespace changes
Inline
Side-by-side
bl1/bl1.ld.S
View file @
108e4df7
/*
*
Copyright
(
c
)
2013
-
201
6
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2013
-
201
7
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
...
...
@@ -133,7 +133,8 @@ SECTIONS
/
*
*
The
.
bss
section
gets
initialised
to
0
at
runtime
.
*
Its
base
address
must
be
16
-
byte
aligned
.
*
Its
base
address
should
be
16
-
byte
aligned
for
better
performance
of
the
*
zero
-
initialization
code
.
*/
.
bss
:
ALIGN
(
16
)
{
__BSS_START__
=
.
;
...
...
bl1/bl1_fwu.c
View file @
108e4df7
/*
* Copyright (c) 2015-201
6
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015-201
7
, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
...
...
@@ -335,7 +335,7 @@ static int bl1_fwu_image_auth(unsigned int image_id,
*/
if
(
image_desc
->
state
==
IMAGE_STATE_COPIED
)
{
/* Clear the memory.*/
mem
set
((
void
*
)
base_addr
,
0
,
total_size
);
zero_normal
mem
((
void
*
)
base_addr
,
total_size
);
flush_dcache_range
(
base_addr
,
total_size
);
/* Indicate that image can be copied again*/
...
...
bl2/aarch64/bl2_entrypoint.S
View file @
108e4df7
/*
*
Copyright
(
c
)
2013
-
201
6
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2013
-
201
7
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
...
...
@@ -94,12 +94,12 @@ func bl2_entrypoint
*/
ldr
x0
,
=
__BSS_START__
ldr
x1
,
=
__BSS_SIZE__
bl
zeromem
16
bl
zeromem
#if USE_COHERENT_MEM
ldr
x0
,
=
__COHERENT_RAM_START__
ldr
x1
,
=
__COHERENT_RAM_UNALIGNED_SIZE__
bl
zeromem
16
bl
zeromem
#endif
/
*
--------------------------------------------
...
...
bl2/bl2.ld.S
View file @
108e4df7
/*
*
Copyright
(
c
)
2013
-
201
4
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2013
-
201
7
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
...
...
@@ -113,7 +113,8 @@ SECTIONS
/
*
*
The
.
bss
section
gets
initialised
to
0
at
runtime
.
*
Its
base
address
must
be
16
-
byte
aligned
.
*
Its
base
address
should
be
16
-
byte
aligned
for
better
performance
of
the
*
zero
-
initialization
code
.
*/
.
bss
:
ALIGN
(
16
)
{
__BSS_START__
=
.
;
...
...
bl2u/aarch64/bl2u_entrypoint.S
View file @
108e4df7
/*
*
Copyright
(
c
)
2015
-
201
6
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2015
-
201
7
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
...
...
@@ -94,7 +94,7 @@ func bl2u_entrypoint
*/
ldr
x0
,
=
__BSS_START__
ldr
x1
,
=
__BSS_SIZE__
bl
zeromem
16
bl
zeromem
/
*
--------------------------------------------
*
Allocate
a
stack
whose
memory
will
be
marked
...
...
bl2u/bl2u.ld.S
View file @
108e4df7
/*
*
Copyright
(
c
)
2015
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2015
-
2017
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
...
...
@@ -100,7 +100,8 @@ SECTIONS
/
*
*
The
.
bss
section
gets
initialised
to
0
at
runtime
.
*
Its
base
address
must
be
16
-
byte
aligned
.
*
Its
base
address
should
be
16
-
byte
aligned
for
better
performance
of
the
*
zero
-
initialization
code
.
*/
.
bss
:
ALIGN
(
16
)
{
__BSS_START__
=
.
;
...
...
bl31/bl31.ld.S
View file @
108e4df7
/*
*
Copyright
(
c
)
2013
-
201
6
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2013
-
201
7
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
...
...
@@ -158,7 +158,8 @@ SECTIONS
/
*
*
The
.
bss
section
gets
initialised
to
0
at
runtime
.
*
Its
base
address
must
be
16
-
byte
aligned
.
*
Its
base
address
should
be
16
-
byte
aligned
for
better
performance
of
the
*
zero
-
initialization
code
.
*/
.
bss
(
NOLOAD
)
:
ALIGN
(
16
)
{
__BSS_START__
=
.
;
...
...
bl32/sp_min/sp_min.ld.S
View file @
108e4df7
/*
*
Copyright
(
c
)
2016
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2016
-
2017
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
...
...
@@ -134,9 +134,10 @@ SECTIONS
/
*
*
The
.
bss
section
gets
initialised
to
0
at
runtime
.
*
Its
base
address
must
be
16
-
byte
aligned
.
*
Its
base
address
should
be
8
-
byte
aligned
for
better
performance
of
the
*
zero
-
initialization
code
.
*/
.
bss
(
NOLOAD
)
:
ALIGN
(
16
)
{
.
bss
(
NOLOAD
)
:
ALIGN
(
8
)
{
__BSS_START__
=
.
;
*(.
bss
*)
*(
COMMON
)
...
...
bl32/sp_min/sp_min_main.c
View file @
108e4df7
/*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2016
-2017
, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
...
...
@@ -45,6 +45,7 @@
#include <stdint.h>
#include <string.h>
#include <types.h>
#include <utils.h>
#include "sp_min_private.h"
/* Pointers to per-core cpu contexts */
...
...
@@ -203,7 +204,7 @@ void sp_min_warm_boot(void)
smc_set_next_ctx
(
NON_SECURE
);
next_smc_ctx
=
smc_get_next_ctx
();
mem
set
(
next_smc_ctx
,
0
,
sizeof
(
smc_ctx_t
));
zero
mem
(
next_smc_ctx
,
sizeof
(
smc_ctx_t
));
copy_cpu_ctx_to_smc_stx
(
get_regs_ctx
(
cm_get_context
(
NON_SECURE
)),
next_smc_ctx
);
...
...
bl32/tsp/aarch64/tsp_entrypoint.S
View file @
108e4df7
/*
*
Copyright
(
c
)
2013
-
201
6
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2013
-
201
7
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
...
...
@@ -120,12 +120,12 @@ func tsp_entrypoint
*/
ldr
x0
,
=
__BSS_START__
ldr
x1
,
=
__BSS_SIZE__
bl
zeromem
16
bl
zeromem
#if USE_COHERENT_MEM
ldr
x0
,
=
__COHERENT_RAM_START__
ldr
x1
,
=
__COHERENT_RAM_UNALIGNED_SIZE__
bl
zeromem
16
bl
zeromem
#endif
/
*
--------------------------------------------
...
...
bl32/tsp/tsp.ld.S
View file @
108e4df7
/*
*
Copyright
(
c
)
2013
-
201
4
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2013
-
201
7
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
...
...
@@ -104,7 +104,8 @@ SECTIONS
/
*
*
The
.
bss
section
gets
initialised
to
0
at
runtime
.
*
Its
base
address
must
be
16
-
byte
aligned
.
*
Its
base
address
should
be
16
-
byte
aligned
for
better
performance
of
the
*
zero
-
initialization
code
.
*/
.
bss
:
ALIGN
(
16
)
{
__BSS_START__
=
.
;
...
...
common/bl_common.c
View file @
108e4df7
/*
* Copyright (c) 2013-201
6
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-201
7
, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
...
...
@@ -347,7 +347,7 @@ static int load_auth_image_internal(unsigned int image_id,
image_data
->
image_size
);
if
(
rc
!=
0
)
{
/* Authentication error, zero memory and flush it right away. */
mem
set
((
void
*
)
image_data
->
image_base
,
0x00
,
zero_normal
mem
((
void
*
)
image_data
->
image_base
,
image_data
->
image_size
);
flush_dcache_range
(
image_data
->
image_base
,
image_data
->
image_size
);
...
...
@@ -543,7 +543,7 @@ static int load_auth_image_internal(meminfo_t *mem_layout,
image_data
->
image_size
);
if
(
rc
!=
0
)
{
/* Authentication error, zero memory and flush it right away. */
mem
set
((
void
*
)
image_data
->
image_base
,
0x00
,
zero_normal
mem
((
void
*
)
image_data
->
image_base
,
image_data
->
image_size
);
flush_dcache_range
(
image_data
->
image_base
,
image_data
->
image_size
);
...
...
docs/firmware-design.md
View file @
108e4df7
...
...
@@ -1342,7 +1342,7 @@ All BL images share the following requirements:
The following linker symbols are defined for this purpose:
*
`__BSS_START__`
Must be aligned on a 16-byte boundary.
*
`__BSS_START__`
*
`__BSS_SIZE__`
*
`__COHERENT_RAM_START__`
Must be aligned on a page-size boundary.
*
`__COHERENT_RAM_END__`
Must be aligned on a page-size boundary.
...
...
drivers/auth/mbedtls/mbedtls_x509_parser.c
View file @
108e4df7
...
...
@@ -43,6 +43,7 @@
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <utils.h>
/* mbed TLS headers */
#include <mbedtls/asn1.h>
...
...
@@ -71,7 +72,7 @@ static void clear_temp_vars(void)
{
#define ZERO_AND_CLEAN(x) \
do { \
memset(&x, 0
, sizeof(x)); \
zeromem(&x
, sizeof(x));
\
clean_dcache_range((uintptr_t)&x, sizeof(x)); \
} while (0);
...
...
@@ -111,7 +112,7 @@ static int get_ext(const char *oid, void **ext, unsigned int *ext_len)
MBEDTLS_ASN1_SEQUENCE
);
while
(
p
<
end
)
{
mem
set
(
&
extn_oid
,
0x0
,
sizeof
(
extn_oid
));
zero
mem
(
&
extn_oid
,
sizeof
(
extn_oid
));
is_critical
=
0
;
/* DEFAULT FALSE */
mbedtls_asn1_get_tag
(
&
p
,
end
,
&
len
,
MBEDTLS_ASN1_CONSTRUCTED
|
...
...
drivers/emmc/emmc.c
View file @
108e4df7
/*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2016
-2017
, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
...
...
@@ -36,6 +36,7 @@
#include <emmc.h>
#include <errno.h>
#include <string.h>
#include <utils.h>
static
const
emmc_ops_t
*
ops
;
static
unsigned
int
emmc_ocr_value
;
...
...
@@ -53,7 +54,7 @@ static int emmc_device_state(void)
int
ret
;
do
{
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
cmd
.
cmd_idx
=
EMMC_CMD13
;
cmd
.
cmd_arg
=
EMMC_FIX_RCA
<<
RCA_SHIFT_OFFSET
;
cmd
.
resp_type
=
EMMC_RESPONSE_R1
;
...
...
@@ -71,7 +72,7 @@ static void emmc_set_ext_csd(unsigned int ext_cmd, unsigned int value)
emmc_cmd_t
cmd
;
int
ret
,
state
;
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
cmd
.
cmd_idx
=
EMMC_CMD6
;
cmd
.
cmd_arg
=
EXTCSD_WRITE_BYTES
|
EXTCSD_CMD
(
ext_cmd
)
|
EXTCSD_VALUE
(
value
)
|
1
;
...
...
@@ -107,14 +108,14 @@ static int emmc_enumerate(int clk, int bus_width)
ops
->
init
();
/* CMD0: reset to IDLE */
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
cmd
.
cmd_idx
=
EMMC_CMD0
;
ret
=
ops
->
send_cmd
(
&
cmd
);
assert
(
ret
==
0
);
while
(
1
)
{
/* CMD1: get OCR register */
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
cmd
.
cmd_idx
=
EMMC_CMD1
;
cmd
.
cmd_arg
=
OCR_SECTOR_MODE
|
OCR_VDD_MIN_2V7
|
OCR_VDD_MIN_1V7
;
...
...
@@ -127,14 +128,14 @@ static int emmc_enumerate(int clk, int bus_width)
}
/* CMD2: Card Identification */
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
cmd
.
cmd_idx
=
EMMC_CMD2
;
cmd
.
resp_type
=
EMMC_RESPONSE_R2
;
ret
=
ops
->
send_cmd
(
&
cmd
);
assert
(
ret
==
0
);
/* CMD3: Set Relative Address */
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
cmd
.
cmd_idx
=
EMMC_CMD3
;
cmd
.
cmd_arg
=
EMMC_FIX_RCA
<<
RCA_SHIFT_OFFSET
;
cmd
.
resp_type
=
EMMC_RESPONSE_R1
;
...
...
@@ -142,7 +143,7 @@ static int emmc_enumerate(int clk, int bus_width)
assert
(
ret
==
0
);
/* CMD9: CSD Register */
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
cmd
.
cmd_idx
=
EMMC_CMD9
;
cmd
.
cmd_arg
=
EMMC_FIX_RCA
<<
RCA_SHIFT_OFFSET
;
cmd
.
resp_type
=
EMMC_RESPONSE_R2
;
...
...
@@ -151,7 +152,7 @@ static int emmc_enumerate(int clk, int bus_width)
memcpy
(
&
emmc_csd
,
&
cmd
.
resp_data
,
sizeof
(
cmd
.
resp_data
));
/* CMD7: Select Card */
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
cmd
.
cmd_idx
=
EMMC_CMD7
;
cmd
.
cmd_arg
=
EMMC_FIX_RCA
<<
RCA_SHIFT_OFFSET
;
cmd
.
resp_type
=
EMMC_RESPONSE_R1
;
...
...
@@ -181,7 +182,7 @@ size_t emmc_read_blocks(int lba, uintptr_t buf, size_t size)
assert
(
ret
==
0
);
if
(
is_cmd23_enabled
())
{
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
/* set block count */
cmd
.
cmd_idx
=
EMMC_CMD23
;
cmd
.
cmd_arg
=
size
/
EMMC_BLOCK_SIZE
;
...
...
@@ -189,7 +190,7 @@ size_t emmc_read_blocks(int lba, uintptr_t buf, size_t size)
ret
=
ops
->
send_cmd
(
&
cmd
);
assert
(
ret
==
0
);
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
cmd
.
cmd_idx
=
EMMC_CMD18
;
}
else
{
if
(
size
>
EMMC_BLOCK_SIZE
)
...
...
@@ -213,7 +214,7 @@ size_t emmc_read_blocks(int lba, uintptr_t buf, size_t size)
if
(
is_cmd23_enabled
()
==
0
)
{
if
(
size
>
EMMC_BLOCK_SIZE
)
{
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
cmd
.
cmd_idx
=
EMMC_CMD12
;
ret
=
ops
->
send_cmd
(
&
cmd
);
assert
(
ret
==
0
);
...
...
@@ -240,17 +241,17 @@ size_t emmc_write_blocks(int lba, const uintptr_t buf, size_t size)
if
(
is_cmd23_enabled
())
{
/* set block count */
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
cmd
.
cmd_idx
=
EMMC_CMD23
;
cmd
.
cmd_arg
=
size
/
EMMC_BLOCK_SIZE
;
cmd
.
resp_type
=
EMMC_RESPONSE_R1
;
ret
=
ops
->
send_cmd
(
&
cmd
);
assert
(
ret
==
0
);
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
cmd
.
cmd_idx
=
EMMC_CMD25
;
}
else
{
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
if
(
size
>
EMMC_BLOCK_SIZE
)
cmd
.
cmd_idx
=
EMMC_CMD25
;
else
...
...
@@ -272,7 +273,7 @@ size_t emmc_write_blocks(int lba, const uintptr_t buf, size_t size)
if
(
is_cmd23_enabled
()
==
0
)
{
if
(
size
>
EMMC_BLOCK_SIZE
)
{
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
cmd
.
cmd_idx
=
EMMC_CMD12
;
ret
=
ops
->
send_cmd
(
&
cmd
);
assert
(
ret
==
0
);
...
...
@@ -291,21 +292,21 @@ size_t emmc_erase_blocks(int lba, size_t size)
assert
(
ops
!=
0
);
assert
((
size
!=
0
)
&&
((
size
%
EMMC_BLOCK_SIZE
)
==
0
));
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
cmd
.
cmd_idx
=
EMMC_CMD35
;
cmd
.
cmd_arg
=
lba
;
cmd
.
resp_type
=
EMMC_RESPONSE_R1
;
ret
=
ops
->
send_cmd
(
&
cmd
);
assert
(
ret
==
0
);
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
cmd
.
cmd_idx
=
EMMC_CMD36
;
cmd
.
cmd_arg
=
lba
+
(
size
/
EMMC_BLOCK_SIZE
)
-
1
;
cmd
.
resp_type
=
EMMC_RESPONSE_R1
;
ret
=
ops
->
send_cmd
(
&
cmd
);
assert
(
ret
==
0
);
mem
set
(
&
cmd
,
0
,
sizeof
(
emmc_cmd_t
));
zero
mem
(
&
cmd
,
sizeof
(
emmc_cmd_t
));
cmd
.
cmd_idx
=
EMMC_CMD38
;
cmd
.
resp_type
=
EMMC_RESPONSE_R1B
;
ret
=
ops
->
send_cmd
(
&
cmd
);
...
...
drivers/io/io_block.c
View file @
108e4df7
/*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2016
-2017
, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
...
...
@@ -36,6 +36,7 @@
#include <io_storage.h>
#include <platform_def.h>
#include <string.h>
#include <utils.h>
typedef
struct
{
io_block_dev_spec_t
*
dev_spec
;
...
...
@@ -135,8 +136,8 @@ static int free_dev_info(io_dev_info_t *dev_info)
result
=
find_first_block_state
(
state
->
dev_spec
,
&
index
);
if
(
result
==
0
)
{
/* free if device info is valid */
mem
set
(
state
,
0
,
sizeof
(
block_dev_state_t
));
mem
set
(
dev_info
,
0
,
sizeof
(
io_dev_info_t
));
zero
mem
(
state
,
sizeof
(
block_dev_state_t
));
zero
mem
(
dev_info
,
sizeof
(
io_dev_info_t
));
--
block_dev_count
;
}
...
...
drivers/io/io_fip.c
View file @
108e4df7
/*
* Copyright (c) 2014, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2014
-2017
, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
...
...
@@ -40,6 +40,7 @@
#include <platform_def.h>
#include <stdint.h>
#include <string.h>
#include <utils.h>
#include <uuid.h>
/* Useful for printing UUIDs when debugging.*/
...
...
@@ -351,7 +352,7 @@ static int fip_file_close(io_entity_t *entity)
* If we had malloc() we would free() here.
*/
if
(
current_file
.
entry
.
offset_address
!=
0
)
{
mem
set
(
&
current_file
,
0
,
sizeof
(
current_file
));
zero
mem
(
&
current_file
,
sizeof
(
current_file
));
}
/* Clear the Entity info. */
...
...
drivers/io/io_memmap.c
View file @
108e4df7
/*
* Copyright (c) 2014, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2014
-2017
, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
...
...
@@ -33,6 +33,7 @@
#include <io_driver.h>
#include <io_storage.h>
#include <string.h>
#include <utils.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
...
...
@@ -231,7 +232,7 @@ static int memmap_block_close(io_entity_t *entity)
entity
->
info
=
0
;
/* This would be a mem free() if we had malloc.*/
mem
set
((
void
*
)
&
current_file
,
0
,
sizeof
(
current_file
));
zero
mem
((
void
*
)
&
current_file
,
sizeof
(
current_file
));
return
0
;
}
...
...
drivers/partition/gpt.c
View file @
108e4df7
/*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2016
-2017
, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
...
...
@@ -33,6 +33,7 @@
#include <errno.h>
#include <gpt.h>
#include <string.h>
#include <utils.h>
static
int
unicode_to_ascii
(
unsigned
short
*
str_in
,
unsigned
char
*
str_out
)
{
...
...
@@ -65,7 +66,7 @@ int parse_gpt_entry(gpt_entry_t *gpt_entry, partition_entry_t *entry)
return
-
EINVAL
;
}
mem
set
(
entry
,
0
,
sizeof
(
partition_entry_t
));
zero
mem
(
entry
,
sizeof
(
partition_entry_t
));
result
=
unicode_to_ascii
(
gpt_entry
->
name
,
(
uint8_t
*
)
entry
->
name
);
if
(
result
!=
0
)
{
return
result
;
...
...
include/common/aarch64/el3_common_macros.S
View file @
108e4df7
/*
*
Copyright
(
c
)
2015
-
201
6
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2015
-
201
7
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
...
...
@@ -252,12 +252,12 @@
ldr
x0
,
=
__BSS_START__
ldr
x1
,
=
__BSS_SIZE__
bl
zeromem
16
bl
zeromem
#if USE_COHERENT_MEM
ldr
x0
,
=
__COHERENT_RAM_START__
ldr
x1
,
=
__COHERENT_RAM_UNALIGNED_SIZE__
bl
zeromem
16
bl
zeromem
#endif
#ifdef IMAGE_BL1
...
...
Prev
1
2
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