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
7b3ab4eb
Commit
7b3ab4eb
authored
5 years ago
by
Manish Pandey
Committed by
TrustedFirmware Code Review
5 years ago
Browse files
Options
Download
Plain Diff
Merge "plat: xilinx: zynqmp: Add checksum support for IPI data" into integration
parents
7ae80e5e
fe550ede
master
v2.5
v2.5-rc1
v2.5-rc0
v2.4
v2.4-rc2
v2.4-rc1
v2.4-rc0
v2.3
v2.3-rc2
v2.3-rc1
v2.3-rc0
arm_cca_v0.2
arm_cca_v0.1
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
plat/xilinx/common/include/pm_ipi.h
+4
-1
plat/xilinx/common/include/pm_ipi.h
plat/xilinx/common/pm_service/pm_ipi.c
+63
-1
plat/xilinx/common/pm_service/pm_ipi.c
plat/xilinx/zynqmp/include/plat_pm_common.h
+11
-2
plat/xilinx/zynqmp/include/plat_pm_common.h
plat/xilinx/zynqmp/platform.mk
+8
-2
plat/xilinx/zynqmp/platform.mk
with
86 additions
and
6 deletions
+86
-6
plat/xilinx/common/include/pm_ipi.h
View file @
7b3ab4eb
/*
* Copyright (c) 2013-20
18
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-20
20
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
...
...
@@ -26,5 +26,8 @@ void pm_ipi_buff_read_callb(unsigned int *value, size_t count);
void
pm_ipi_irq_enable
(
const
struct
pm_proc
*
proc
);
void
pm_ipi_irq_clear
(
const
struct
pm_proc
*
proc
);
uint32_t
pm_ipi_irq_status
(
const
struct
pm_proc
*
proc
);
#if ZYNQMP_IPI_CRC_CHECK
uint32_t
calculate_crc
(
uint32_t
payload
[
PAYLOAD_ARG_CNT
],
uint32_t
buffersize
);
#endif
#endif
/* PM_IPI_H */
This diff is collapsed.
Click to expand it.
plat/xilinx/common/pm_service/pm_ipi.c
View file @
7b3ab4eb
/*
* Copyright (c) 2013-20
18
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-20
20
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
...
...
@@ -57,6 +57,9 @@ static enum pm_ret_status pm_ipi_send_common(const struct pm_proc *proc,
uintptr_t
buffer_base
=
proc
->
ipi
->
buffer_base
+
IPI_BUFFER_TARGET_REMOTE_OFFSET
+
IPI_BUFFER_REQ_OFFSET
;
#if ZYNQMP_IPI_CRC_CHECK
payload
[
PAYLOAD_CRC_POS
]
=
calculate_crc
(
payload
,
IPI_W0_TO_W6_SIZE
);
#endif
/* Write payload into IPI buffer */
for
(
size_t
i
=
0
;
i
<
PAYLOAD_ARG_CNT
;
i
++
)
{
...
...
@@ -132,6 +135,10 @@ static enum pm_ret_status pm_ipi_buff_read(const struct pm_proc *proc,
unsigned
int
*
value
,
size_t
count
)
{
size_t
i
;
#if ZYNQMP_IPI_CRC_CHECK
size_t
j
;
unsigned
int
response_payload
[
PAYLOAD_ARG_CNT
];
#endif
uintptr_t
buffer_base
=
proc
->
ipi
->
buffer_base
+
IPI_BUFFER_TARGET_REMOTE_OFFSET
+
IPI_BUFFER_RESP_OFFSET
;
...
...
@@ -147,6 +154,16 @@ static enum pm_ret_status pm_ipi_buff_read(const struct pm_proc *proc,
*
value
=
mmio_read_32
(
buffer_base
+
(
i
*
PAYLOAD_ARG_SIZE
));
value
++
;
}
#if ZYNQMP_IPI_CRC_CHECK
for
(
j
=
0
;
j
<
PAYLOAD_ARG_CNT
;
j
++
)
response_payload
[
j
]
=
mmio_read_32
(
buffer_base
+
(
j
*
PAYLOAD_ARG_SIZE
));
if
(
response_payload
[
PAYLOAD_CRC_POS
]
!=
calculate_crc
(
response_payload
,
IPI_W0_TO_W6_SIZE
))
NOTICE
(
"ERROR in CRC response payload value:0x%x
\n
"
,
response_payload
[
PAYLOAD_CRC_POS
]);
#endif
return
mmio_read_32
(
buffer_base
);
}
...
...
@@ -162,6 +179,10 @@ static enum pm_ret_status pm_ipi_buff_read(const struct pm_proc *proc,
void
pm_ipi_buff_read_callb
(
unsigned
int
*
value
,
size_t
count
)
{
size_t
i
;
#if ZYNQMP_IPI_CRC_CHECK
size_t
j
;
unsigned
int
response_payload
[
PAYLOAD_ARG_CNT
];
#endif
uintptr_t
buffer_base
=
IPI_BUFFER_REMOTE_BASE
+
IPI_BUFFER_TARGET_LOCAL_OFFSET
+
IPI_BUFFER_REQ_OFFSET
;
...
...
@@ -173,6 +194,16 @@ void pm_ipi_buff_read_callb(unsigned int *value, size_t count)
*
value
=
mmio_read_32
(
buffer_base
+
(
i
*
PAYLOAD_ARG_SIZE
));
value
++
;
}
#if ZYNQMP_IPI_CRC_CHECK
for
(
j
=
0
;
j
<
PAYLOAD_ARG_CNT
;
j
++
)
response_payload
[
j
]
=
mmio_read_32
(
buffer_base
+
(
j
*
PAYLOAD_ARG_SIZE
));
if
(
response_payload
[
PAYLOAD_CRC_POS
]
!=
calculate_crc
(
response_payload
,
IPI_W0_TO_W6_SIZE
))
NOTICE
(
"ERROR in CRC response payload value:0x%x
\n
"
,
response_payload
[
PAYLOAD_CRC_POS
]);
#endif
}
/**
...
...
@@ -228,3 +259,34 @@ uint32_t pm_ipi_irq_status(const struct pm_proc *proc)
else
return
0
;
}
#if ZYNQMP_IPI_CRC_CHECK
uint32_t
calculate_crc
(
uint32_t
*
payload
,
uint32_t
bufsize
)
{
uint32_t
crcinit
=
CRC_INIT_VALUE
;
uint32_t
order
=
CRC_ORDER
;
uint32_t
polynom
=
CRC_POLYNOM
;
uint32_t
i
,
j
,
c
,
bit
,
datain
,
crcmask
,
crchighbit
;
uint32_t
crc
=
crcinit
;
crcmask
=
((
uint32_t
)((
1U
<<
(
order
-
1U
))
-
1U
)
<<
1U
)
|
1U
;
crchighbit
=
(
uint32_t
)(
1U
<<
(
order
-
1U
));
for
(
i
=
0U
;
i
<
bufsize
;
i
++
)
{
datain
=
mmio_read_8
((
unsigned
long
)
payload
+
i
);
c
=
datain
;
j
=
0x80U
;
while
(
j
!=
0U
)
{
bit
=
crc
&
crchighbit
;
crc
<<=
1U
;
if
(
0U
!=
(
c
&
j
))
bit
^=
crchighbit
;
if
(
bit
!=
0U
)
crc
^=
polynom
;
j
>>=
1U
;
}
crc
&=
crcmask
;
}
return
crc
;
}
#endif
This diff is collapsed.
Click to expand it.
plat/xilinx/zynqmp/include/plat_pm_common.h
View file @
7b3ab4eb
/*
* Copyright (c) 2013-20
18
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-20
20
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
...
...
@@ -16,7 +16,16 @@
#include <common/debug.h>
#include "pm_defs.h"
#if ZYNQMP_IPI_CRC_CHECK
#define PAYLOAD_ARG_CNT 8U
#define IPI_W0_TO_W6_SIZE 28U
#define PAYLOAD_CRC_POS 7U
#define CRC_INIT_VALUE 0x4F4EU
#define CRC_ORDER 16U
#define CRC_POLYNOM 0x8005U
#else
#define PAYLOAD_ARG_CNT 6U
#endif
#define PAYLOAD_ARG_SIZE 4U
/* size in bytes */
#define ZYNQMP_TZ_VERSION_MAJOR 1
...
...
This diff is collapsed.
Click to expand it.
plat/xilinx/zynqmp/platform.mk
View file @
7b3ab4eb
#
# Copyright (c) 2013-20
19
, ARM Limited and Contributors. All rights reserved.
# Copyright (c) 2013-20
20
, ARM Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
...
...
@@ -9,6 +9,7 @@ PSCI_EXTENDED_STATE_ID := 1
A53_DISABLE_NON_TEMPORAL_HINT
:=
0
SEPARATE_CODE_AND_RODATA
:=
1
ZYNQMP_WDT_RESTART
:=
0
ZYNQMP_IPI_CRC_CHECK
:=
0
override RESET_TO_BL31
:
= 1
# Do not enable SVE
...
...
@@ -45,7 +46,12 @@ ifdef ZYNQMP_WDT_RESTART
$(eval
$(call
add_define,ZYNQMP_WDT_RESTART))
endif
PLAT_INCLUDES
:=
-Iinclude
/plat/arm/common/aarch64/
\
ifdef
ZYNQMP_IPI_CRC_CHECK
$(eval
$(call
add_define,ZYNQMP_IPI_CRC_CHECK))
endif
PLAT_INCLUDES
:=
-Iinclude
/plat/arm/common/
\
-Iinclude
/plat/arm/common/aarch64/
\
-Iplat
/xilinx/common/include/
\
-Iplat
/xilinx/zynqmp/include/
\
-Iplat
/xilinx/zynqmp/pm_service/
\
...
...
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