blob: c38cdef359c07f9e24ee7a61e73872260da49351 [file] [log] [blame]
Soren Brinkmann76fcae32016-03-06 20:16:27 -08001/*
Michal Simek2a47faa2023-04-14 08:43:51 +02002 * Copyright (c) 2013-2018, Arm Limited and Contributors. All rights reserved.
Jay Buddhabhattib8c581f2024-06-24 01:47:39 -07003 * Copyright (c) 2022-2024, Advanced Micro Devices, Inc. All rights reserved.
Soren Brinkmann76fcae32016-03-06 20:16:27 -08004 *
dp-armfa3cf0b2017-05-03 09:38:09 +01005 * SPDX-License-Identifier: BSD-3-Clause
Soren Brinkmann76fcae32016-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 Diaz5eb88372018-11-08 10:20:19 +000013#ifndef PM_COMMON_H
14#define PM_COMMON_H
Soren Brinkmann76fcae32016-03-06 20:16:27 -080015
Soren Brinkmann76fcae32016-03-06 20:16:27 -080016#include <stdint.h>
Jolly Shah259afe52019-01-09 12:37:57 -080017#include <plat_pm_common.h>
Rajan Vajac7ee23d2018-02-14 23:10:54 -080018
Venkatesh Yadav Abbarapubfa2a2a2021-02-19 01:40:14 -070019#if IPI_CRC_CHECK
20#define PAYLOAD_ARG_CNT 8U
Jay Buddhabhattib8c581f2024-06-24 01:47:39 -070021#define RET_PAYLOAD_ARG_CNT 7U
Venkatesh Yadav Abbarapubfa2a2a2021-02-19 01:40:14 -070022#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
Jay Buddhabhattib8c581f2024-06-24 01:47:39 -070028#define PAYLOAD_ARG_CNT 7U
29#define RET_PAYLOAD_ARG_CNT 6U
Venkatesh Yadav Abbarapubfa2a2a2021-02-19 01:40:14 -070030#endif
31#define PAYLOAD_ARG_SIZE 4U /* size in bytes */
32
Jay Buddhabhattic3da9c02022-04-04 23:42:04 -070033#define TZ_VERSION_MAJOR 1
34#define TZ_VERSION_MINOR 0
35#define TZ_VERSION ((TZ_VERSION_MAJOR << 16) | \
36 TZ_VERSION_MINOR)
37
Soren Brinkmann76fcae32016-03-06 20:16:27 -080038/**
Prasad Kummari7d0623a2023-06-09 14:32:00 +053039 * 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 *
Soren Brinkmann76fcae32016-03-06 20:16:27 -080044 */
45struct pm_ipi {
Jolly Shah36c930b2019-01-07 12:51:40 -080046 const uint32_t local_ipi_id;
47 const uint32_t remote_ipi_id;
Soren Brinkmann76fcae32016-03-06 20:16:27 -080048 const uintptr_t buffer_base;
49};
50
51/**
Prasad Kummari7d0623a2023-06-09 14:32:00 +053052 * 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 *
Soren Brinkmann76fcae32016-03-06 20:16:27 -080058 */
59struct pm_proc {
Jolly Shah259afe52019-01-09 12:37:57 -080060 const uint32_t node_id;
Venkatesh Yadav Abbarapue7c45382022-05-19 14:49:49 +053061 const uint32_t pwrdn_mask;
Soren Brinkmann76fcae32016-03-06 20:16:27 -080062 const struct pm_ipi *ipi;
63};
64
Venkatesh Yadav Abbarapue7c45382022-05-19 14:49:49 +053065const struct pm_proc *pm_get_proc(uint32_t cpuid);
Soren Brinkmann76fcae32016-03-06 20:16:27 -080066
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000067#endif /* PM_COMMON_H */