xref: /rk3399_ARM-atf/plat/xilinx/common/include/pm_common.h (revision f78c597041fcb6ee7bf1affc270b3178a9e9dba0)
165c80d60SJolly Shah /*
2619bc13eSMichal Simek  * Copyright (c) 2013-2018, Arm Limited and Contributors. All rights reserved.
3c314a0b3SDevanshi Chauhan Alpeshbhai  * Copyright (c) 2022-2025, Advanced Micro Devices, Inc. All rights reserved.
465c80d60SJolly Shah  *
565c80d60SJolly Shah  * SPDX-License-Identifier: BSD-3-Clause
665c80d60SJolly Shah  */
765c80d60SJolly Shah 
865c80d60SJolly Shah /*
965c80d60SJolly Shah  * Contains definitions of commonly used macros and data types needed
1065c80d60SJolly Shah  * for PU Power Management. This file should be common for all PU's.
1165c80d60SJolly Shah  */
1265c80d60SJolly Shah 
1365c80d60SJolly Shah #ifndef PM_COMMON_H
1465c80d60SJolly Shah #define PM_COMMON_H
1565c80d60SJolly Shah 
1665c80d60SJolly Shah #include <stdint.h>
1765c80d60SJolly Shah #include <plat_pm_common.h>
1865c80d60SJolly Shah 
19d7758354SVenkatesh Yadav Abbarapu #if IPI_CRC_CHECK
20d7758354SVenkatesh Yadav Abbarapu #define PAYLOAD_ARG_CNT         8U
21d7758354SVenkatesh Yadav Abbarapu #define IPI_W0_TO_W6_SIZE       28U
22d7758354SVenkatesh Yadav Abbarapu #define PAYLOAD_CRC_POS         7U
23d7758354SVenkatesh Yadav Abbarapu #define CRC_INIT_VALUE          0x4F4EU
24d7758354SVenkatesh Yadav Abbarapu #define CRC_ORDER               16U
25d7758354SVenkatesh Yadav Abbarapu #define CRC_POLYNOM             0x8005U
26d7758354SVenkatesh Yadav Abbarapu #else
2703fa6f42SJay Buddhabhatti #define PAYLOAD_ARG_CNT		7U
28d7758354SVenkatesh Yadav Abbarapu #endif
29e27b9491SJay Buddhabhatti #define RET_PAYLOAD_ARG_CNT	6U
30d7758354SVenkatesh Yadav Abbarapu #define PAYLOAD_ARG_SIZE	4U	/* size in bytes */
31d7758354SVenkatesh Yadav Abbarapu 
32c314a0b3SDevanshi Chauhan Alpeshbhai #define TZ_VERSION_MAJOR	1U
33c314a0b3SDevanshi Chauhan Alpeshbhai #define TZ_VERSION_MINOR	0U
34*f78c5970SDevanshi Chauhan Alpeshbhai #define TZ_VERSION		(((uint32_t)TZ_VERSION_MAJOR << 16U) | \
35f99306d4SJay Buddhabhatti 				 TZ_VERSION_MINOR)
36f99306d4SJay Buddhabhatti 
3765c80d60SJolly Shah /**
38de7ed953SPrasad Kummari  * struct pm_ipi - struct for capturing IPI-channel specific info.
39de7ed953SPrasad Kummari  * @local_ipi_id: Local IPI agent ID.
40de7ed953SPrasad Kummari  * @remote_ipi_id: Remote IPI Agent ID.
41de7ed953SPrasad Kummari  * @buffer_base: base address for payload buffer.
42de7ed953SPrasad Kummari  *
4365c80d60SJolly Shah  */
4465c80d60SJolly Shah struct pm_ipi {
4565c80d60SJolly Shah 	const uint32_t local_ipi_id;
4665c80d60SJolly Shah 	const uint32_t remote_ipi_id;
4765c80d60SJolly Shah 	const uintptr_t buffer_base;
4865c80d60SJolly Shah };
4965c80d60SJolly Shah 
5065c80d60SJolly Shah /**
51de7ed953SPrasad Kummari  * struct pm_proc - struct for capturing processor related info.
52de7ed953SPrasad Kummari  * @node_id: node-ID of the processor.
53de7ed953SPrasad Kummari  * @pwrdn_mask: cpu-specific mask to be used for power control register.
54de7ed953SPrasad Kummari  * @ipi: pointer to IPI channel structure.
5565c80d60SJolly Shah  *       (in APU all processors share one IPI channel)
56de7ed953SPrasad Kummari  *
5765c80d60SJolly Shah  */
5865c80d60SJolly Shah struct pm_proc {
5965c80d60SJolly Shah 	const uint32_t node_id;
60ffa91031SVenkatesh Yadav Abbarapu 	const uint32_t pwrdn_mask;
6165c80d60SJolly Shah 	const struct pm_ipi *ipi;
6265c80d60SJolly Shah };
6365c80d60SJolly Shah 
64ffa91031SVenkatesh Yadav Abbarapu const struct pm_proc *pm_get_proc(uint32_t cpuid);
6565c80d60SJolly Shah 
6665c80d60SJolly Shah #endif /* PM_COMMON_H */
67