Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
a0d89439
Unverified
Commit
a0d89439
authored
6 years ago
by
Antonio Niño Díaz
Committed by
GitHub
6 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #1772 from glneo/clear-proxy-queue
TI K3 Clear proxy receive queue on transmit
parents
94764b06
73522f00
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
plat/ti/k3/common/drivers/sec_proxy/sec_proxy.c
+38
-0
plat/ti/k3/common/drivers/sec_proxy/sec_proxy.c
plat/ti/k3/common/drivers/sec_proxy/sec_proxy.h
+9
-0
plat/ti/k3/common/drivers/sec_proxy/sec_proxy.h
plat/ti/k3/common/drivers/ti_sci/ti_sci.c
+8
-0
plat/ti/k3/common/drivers/ti_sci/ti_sci.c
with
55 additions
and
0 deletions
+55
-0
plat/ti/k3/common/drivers/sec_proxy/sec_proxy.c
View file @
a0d89439
...
...
@@ -162,6 +162,44 @@ static inline int k3_sec_proxy_verify_thread(struct k3_sec_proxy_thread *spt,
return
0
;
}
/**
* k3_sec_proxy_clear_rx_thread() - Clear Secure Proxy thread
*
* @id: Channel Identifier
*
* Return: 0 if all goes well, else appropriate error message
*/
int
k3_sec_proxy_clear_rx_thread
(
enum
k3_sec_proxy_chan_id
id
)
{
struct
k3_sec_proxy_thread
*
spt
=
&
spm
.
threads
[
id
];
/* Check for any errors already available */
if
(
mmio_read_32
(
spt
->
rt
+
RT_THREAD_STATUS
)
&
RT_THREAD_STATUS_ERROR_MASK
)
{
ERROR
(
"Thread %d is corrupted, cannot send data
\n
"
,
spt
->
id
);
return
-
EINVAL
;
}
/* Make sure thread is configured for right direction */
if
(
!
(
mmio_read_32
(
spt
->
scfg
+
SCFG_THREAD_CTRL
)
&
SCFG_THREAD_CTRL_DIR_MASK
))
{
ERROR
(
"Cannot clear a transmit thread %d
\n
"
,
spt
->
id
);
return
-
EINVAL
;
}
/* Read off messages from thread until empty */
uint32_t
try_count
=
10
;
while
(
mmio_read_32
(
spt
->
rt
+
RT_THREAD_STATUS
)
&
RT_THREAD_STATUS_CUR_CNT_MASK
)
{
if
(
!
(
try_count
--
))
{
ERROR
(
"Could not clear all messages from thread %d
\n
"
,
spt
->
id
);
return
-
ETIMEDOUT
;
}
WARN
(
"Clearing message from thread %d
\n
"
,
spt
->
id
);
mmio_read_32
(
spt
->
data
+
spm
.
desc
.
data_end_offset
);
}
return
0
;
}
/**
* k3_sec_proxy_send() - Send data over a Secure Proxy thread
* @id: Channel Identifier
...
...
This diff is collapsed.
Click to expand it.
plat/ti/k3/common/drivers/sec_proxy/sec_proxy.h
View file @
a0d89439
...
...
@@ -37,6 +37,15 @@ struct k3_sec_proxy_msg {
uint8_t
*
buf
;
};
/**
* k3_sec_proxy_send() - Send data over a Secure Proxy thread
* @id: Channel Identifier
* @msg: Pointer to k3_sec_proxy_msg
*
* Return: 0 if all goes well, else appropriate error message
*/
int
k3_sec_proxy_clear_rx_thread
(
enum
k3_sec_proxy_chan_id
id
);
/**
* k3_sec_proxy_send() - Send data over a Secure Proxy thread
* @id: Channel Identifier
...
...
This diff is collapsed.
Click to expand it.
plat/ti/k3/common/drivers/ti_sci/ti_sci.c
View file @
a0d89439
...
...
@@ -158,6 +158,13 @@ static inline int ti_sci_do_xfer(struct ti_sci_xfer *xfer)
struct
k3_sec_proxy_msg
*
msg
=
&
xfer
->
tx_message
;
int
ret
;
/* Clear any spurious messages in receive queue */
ret
=
k3_sec_proxy_clear_rx_thread
(
SP_RESPONSE
);
if
(
ret
)
{
ERROR
(
"Could not clear response queue (%d)
\n
"
,
ret
);
return
ret
;
}
/* Send the message */
ret
=
k3_sec_proxy_send
(
SP_HIGH_PRIORITY
,
msg
);
if
(
ret
)
{
...
...
@@ -165,6 +172,7 @@ static inline int ti_sci_do_xfer(struct ti_sci_xfer *xfer)
return
ret
;
}
/* Get the response */
ret
=
ti_sci_get_response
(
xfer
,
SP_RESPONSE
);
if
(
ret
)
{
ERROR
(
"Failed to get response (%d)
\n
"
,
ret
);
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help