xref: /rk3399_ARM-atf/plat/xilinx/common/include/pm_common.h (revision 5e0be8c0241e5075b34bd5b14df2df9f048715d3)
1 /*
2  * Copyright (c) 2013-2018, Arm Limited and Contributors. All rights reserved.
3  * Copyright (c) 2022-2024, Advanced Micro Devices, Inc. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 /*
9  * Contains definitions of commonly used macros and data types needed
10  * for PU Power Management. This file should be common for all PU's.
11  */
12 
13 #ifndef PM_COMMON_H
14 #define PM_COMMON_H
15 
16 #include <stdint.h>
17 #include <plat_pm_common.h>
18 
19 #if IPI_CRC_CHECK
20 #define PAYLOAD_ARG_CNT         8U
21 #define RET_PAYLOAD_ARG_CNT	7U
22 #define IPI_W0_TO_W6_SIZE       28U
23 #define PAYLOAD_CRC_POS         7U
24 #define CRC_INIT_VALUE          0x4F4EU
25 #define CRC_ORDER               16U
26 #define CRC_POLYNOM             0x8005U
27 #else
28 #define PAYLOAD_ARG_CNT		7U
29 #define RET_PAYLOAD_ARG_CNT	6U
30 #endif
31 #define PAYLOAD_ARG_SIZE	4U	/* size in bytes */
32 
33 #define TZ_VERSION_MAJOR	1
34 #define TZ_VERSION_MINOR	0
35 #define TZ_VERSION		((TZ_VERSION_MAJOR << 16) | \
36 				 TZ_VERSION_MINOR)
37 
38 /**
39  * struct pm_ipi - struct for capturing IPI-channel specific info.
40  * @local_ipi_id: Local IPI agent ID.
41  * @remote_ipi_id: Remote IPI Agent ID.
42  * @buffer_base: base address for payload buffer.
43  *
44  */
45 struct pm_ipi {
46 	const uint32_t local_ipi_id;
47 	const uint32_t remote_ipi_id;
48 	const uintptr_t buffer_base;
49 };
50 
51 /**
52  * struct pm_proc - struct for capturing processor related info.
53  * @node_id: node-ID of the processor.
54  * @pwrdn_mask: cpu-specific mask to be used for power control register.
55  * @ipi: pointer to IPI channel structure.
56  *       (in APU all processors share one IPI channel)
57  *
58  */
59 struct pm_proc {
60 	const uint32_t node_id;
61 	const uint32_t pwrdn_mask;
62 	const struct pm_ipi *ipi;
63 };
64 
65 const struct pm_proc *pm_get_proc(uint32_t cpuid);
66 
67 #endif /* PM_COMMON_H */
68