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