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
1f6b06c8
"vscode:/vscode.git/clone" did not exist on "1e86678f9d3c8c979ff8d3c8b5aac19e9e611441"
Commit
1f6b06c8
authored
Feb 10, 2020
by
Sandrine Bailleux
Committed by
TrustedFirmware Code Review
Feb 10, 2020
Browse files
Merge "intel: Include address range check for SiP Mailbox" into integration
parents
aab154fb
1a87db5d
Changes
1
Show whitespace changes
Inline
Side-by-side
plat/intel/soc/common/socfpga_sip_svc.c
View file @
1f6b06c8
...
@@ -252,12 +252,16 @@ static bool is_fpga_config_buffer_full(void)
...
@@ -252,12 +252,16 @@ static bool is_fpga_config_buffer_full(void)
return
true
;
return
true
;
}
}
static
bool
is_address_in_ddr_range
(
uint64_t
addr
)
static
bool
is_address_in_ddr_range
(
uint64_t
addr
,
uint64_t
size
)
{
{
if
(
addr
>=
DRAM_BASE
&&
addr
<=
DRAM_BASE
+
DRAM_SIZE
)
if
(
size
>
(
UINT64_MAX
-
addr
)
)
return
tru
e
;
return
fals
e
;
if
(
addr
<
DRAM_BASE
)
return
false
;
return
false
;
if
(
addr
+
size
>
DRAM_BASE
+
DRAM_SIZE
)
return
false
;
return
true
;
}
}
static
uint32_t
intel_fpga_config_write
(
uint64_t
mem
,
uint64_t
size
)
static
uint32_t
intel_fpga_config_write
(
uint64_t
mem
,
uint64_t
size
)
...
@@ -266,8 +270,7 @@ static uint32_t intel_fpga_config_write(uint64_t mem, uint64_t size)
...
@@ -266,8 +270,7 @@ static uint32_t intel_fpga_config_write(uint64_t mem, uint64_t size)
intel_fpga_sdm_write_all
();
intel_fpga_sdm_write_all
();
if
(
!
is_address_in_ddr_range
(
mem
)
||
if
(
!
is_address_in_ddr_range
(
mem
,
size
)
||
!
is_address_in_ddr_range
(
mem
+
size
)
||
is_fpga_config_buffer_full
())
is_fpga_config_buffer_full
())
return
INTEL_SIP_SMC_STATUS_REJECTED
;
return
INTEL_SIP_SMC_STATUS_REJECTED
;
...
@@ -406,11 +409,16 @@ static uint32_t intel_mbox_send_cmd(uint32_t cmd, uint32_t *args, int len,
...
@@ -406,11 +409,16 @@ static uint32_t intel_mbox_send_cmd(uint32_t cmd, uint32_t *args, int len,
int
resp_len
,
int
*
mbox_status
,
int
resp_len
,
int
*
mbox_status
,
int
*
len_in_resp
)
int
*
len_in_resp
)
{
{
*
len_in_resp
=
0
;
*
mbox_status
=
0
;
if
(
!
is_address_in_ddr_range
((
uint64_t
)
args
,
sizeof
(
uint32_t
)
*
len
))
return
INTEL_SIP_SMC_STATUS_REJECTED
;
int
status
=
mailbox_send_cmd
(
MBOX_JOB_ID
,
cmd
,
args
,
len
,
urgent
,
int
status
=
mailbox_send_cmd
(
MBOX_JOB_ID
,
cmd
,
args
,
len
,
urgent
,
response
,
resp_len
);
response
,
resp_len
);
if
(
status
<
0
)
{
if
(
status
<
0
)
{
*
len_in_resp
=
0
;
*
mbox_status
=
-
status
;
*
mbox_status
=
-
status
;
return
INTEL_SIP_SMC_STATUS_ERROR
;
return
INTEL_SIP_SMC_STATUS_ERROR
;
}
}
...
...
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