blob: 5e53ec602ff9784eec067a03565b7ed338c19974 [file] [log] [blame]
Soren Brinkmannc8284402016-03-06 20:16:27 -08001/*
Michal Simek619bc132023-04-14 08:43:51 +02002 * Copyright (c) 2013-2018, Arm Limited and Contributors. All rights reserved.
Devanshi Chauhan Alpeshbhaic314a0b2025-04-09 04:38:12 -07003 * Copyright (c) 2022-2025, Advanced Micro Devices, Inc. All rights reserved.
Soren Brinkmannc8284402016-03-06 20:16:27 -08004 *
dp-arm82cb2c12017-05-03 09:38:09 +01005 * SPDX-License-Identifier: BSD-3-Clause
Soren Brinkmannc8284402016-03-06 20:16:27 -08006 */
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
Antonio Nino Diazc3cf06f2018-11-08 10:20:19 +000013#ifndef PM_COMMON_H
14#define PM_COMMON_H
Soren Brinkmannc8284402016-03-06 20:16:27 -080015
Soren Brinkmannc8284402016-03-06 20:16:27 -080016#include <stdint.h>
Jolly Shah65c80d62019-01-09 12:37:57 -080017#include <plat_pm_common.h>
Rajan Vajaf1342002018-02-14 23:10:54 -080018
Venkatesh Yadav Abbarapud7758352021-02-19 01:40:14 -070019#if IPI_CRC_CHECK
20#define PAYLOAD_ARG_CNT 8U
21#define IPI_W0_TO_W6_SIZE 28U
22#define PAYLOAD_CRC_POS 7U
23#define CRC_INIT_VALUE 0x4F4EU
24#define CRC_ORDER 16U
25#define CRC_POLYNOM 0x8005U
26#else
Jay Buddhabhatti03fa6f42024-06-24 01:47:39 -070027#define PAYLOAD_ARG_CNT 7U
Venkatesh Yadav Abbarapud7758352021-02-19 01:40:14 -070028#endif
Jay Buddhabhattie27b9492024-08-16 05:38:00 -070029#define RET_PAYLOAD_ARG_CNT 6U
Venkatesh Yadav Abbarapud7758352021-02-19 01:40:14 -070030#define PAYLOAD_ARG_SIZE 4U /* size in bytes */
31
Devanshi Chauhan Alpeshbhaic314a0b2025-04-09 04:38:12 -070032#define TZ_VERSION_MAJOR 1U
33#define TZ_VERSION_MINOR 0U
Devanshi Chauhan Alpeshbhaif78c5972025-04-09 22:49:59 -070034#define TZ_VERSION (((uint32_t)TZ_VERSION_MAJOR << 16U) | \
Jay Buddhabhattif99306d2022-04-04 23:42:04 -070035 TZ_VERSION_MINOR)
36
Soren Brinkmannc8284402016-03-06 20:16:27 -080037/**
Prasad Kummaride7ed952023-06-09 14:32:00 +053038 * struct pm_ipi - struct for capturing IPI-channel specific info.
39 * @local_ipi_id: Local IPI agent ID.
40 * @remote_ipi_id: Remote IPI Agent ID.
41 * @buffer_base: base address for payload buffer.
42 *
Soren Brinkmannc8284402016-03-06 20:16:27 -080043 */
44struct pm_ipi {
Jolly Shah28e4d372019-01-07 12:51:40 -080045 const uint32_t local_ipi_id;
46 const uint32_t remote_ipi_id;
Soren Brinkmannc8284402016-03-06 20:16:27 -080047 const uintptr_t buffer_base;
48};
49
50/**
Prasad Kummaride7ed952023-06-09 14:32:00 +053051 * struct pm_proc - struct for capturing processor related info.
52 * @node_id: node-ID of the processor.
53 * @pwrdn_mask: cpu-specific mask to be used for power control register.
54 * @ipi: pointer to IPI channel structure.
55 * (in APU all processors share one IPI channel)
56 *
Soren Brinkmannc8284402016-03-06 20:16:27 -080057 */
58struct pm_proc {
Jolly Shah65c80d62019-01-09 12:37:57 -080059 const uint32_t node_id;
Venkatesh Yadav Abbarapuffa91032022-05-19 14:49:49 +053060 const uint32_t pwrdn_mask;
Soren Brinkmannc8284402016-03-06 20:16:27 -080061 const struct pm_ipi *ipi;
62};
63
Venkatesh Yadav Abbarapuffa91032022-05-19 14:49:49 +053064const struct pm_proc *pm_get_proc(uint32_t cpuid);
Soren Brinkmannc8284402016-03-06 20:16:27 -080065
Antonio Nino Diazc3cf06f2018-11-08 10:20:19 +000066#endif /* PM_COMMON_H */