blob: 3fc8e3863d8c6c6caa874bdead89bc5d6cd9cc6d [file] [log] [blame]
Yatharth Kochar9518d022016-03-11 14:20:19 +00001/*
Roberto Vargas777dd432018-02-12 12:36:17 +00002 * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
Yatharth Kochar9518d022016-03-11 14:20:19 +00003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Yatharth Kochar9518d022016-03-11 14:20:19 +00005 */
6
Antonio Nino Diaze89a4532018-07-18 13:26:25 +01007#ifndef PMF_H
8#define PMF_H
Yatharth Kochar9518d022016-03-11 14:20:19 +00009
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000010#include <lib/cassert.h>
11#include <lib/pmf/pmf_helpers.h>
12#include <lib/utils_def.h>
Yatharth Kochar9518d022016-03-11 14:20:19 +000013
14/*
15 * Constants used for/by PMF services.
16 */
Antonio Nino Diazbf170be2018-10-25 17:38:23 +010017#define PMF_ARM_TIF_IMPL_ID U(0x41)
Yatharth Kochar9518d022016-03-11 14:20:19 +000018#define PMF_TID_SHIFT 0
Antonio Nino Diazbf170be2018-10-25 17:38:23 +010019#define PMF_TID_MASK (U(0xFF) << PMF_TID_SHIFT)
Yatharth Kochar9518d022016-03-11 14:20:19 +000020#define PMF_SVC_ID_SHIFT 10
Antonio Nino Diazbf170be2018-10-25 17:38:23 +010021#define PMF_SVC_ID_MASK (U(0x3F) << PMF_SVC_ID_SHIFT)
Yatharth Kochar9518d022016-03-11 14:20:19 +000022#define PMF_IMPL_ID_SHIFT 24
Antonio Nino Diazbf170be2018-10-25 17:38:23 +010023#define PMF_IMPL_ID_MASK (U(0xFF) << PMF_IMPL_ID_SHIFT)
Yatharth Kochar9518d022016-03-11 14:20:19 +000024
25/*
26 * Flags passed to PMF_REGISTER_SERVICE
27 */
28#define PMF_STORE_ENABLE (1 << 0)
29#define PMF_DUMP_ENABLE (1 << 1)
30
31/*
32 * Flags passed to PMF_GET_TIMESTAMP_XXX
33 * and PMF_CAPTURE_TIMESTAMP
34 */
Antonio Nino Diaze89a4532018-07-18 13:26:25 +010035#define PMF_CACHE_MAINT (U(1) << 0)
36#define PMF_NO_CACHE_MAINT U(0)
Yatharth Kochar9518d022016-03-11 14:20:19 +000037
38/*
39 * Defines for PMF SMC function ids.
40 */
Antonio Nino Diazbf170be2018-10-25 17:38:23 +010041#define PMF_SMC_GET_TIMESTAMP_32 U(0x82000010)
42#define PMF_SMC_GET_TIMESTAMP_64 U(0xC2000010)
Yatharth Kochar9518d022016-03-11 14:20:19 +000043#define PMF_NUM_SMC_CALLS 2
44
45/*
46 * The macros below are used to identify
47 * PMF calls from the SMC function ID.
48 */
Antonio Nino Diazbf170be2018-10-25 17:38:23 +010049#define PMF_FID_MASK U(0xffe0)
50#define PMF_FID_VALUE U(0)
Yatharth Kochar9518d022016-03-11 14:20:19 +000051#define is_pmf_fid(_fid) (((_fid) & PMF_FID_MASK) == PMF_FID_VALUE)
52
53/* Following are the supported PMF service IDs */
54#define PMF_PSCI_STAT_SVC_ID 0
dp-arm3cac7862016-09-19 11:18:44 +010055#define PMF_RT_INSTR_SVC_ID 1
Yatharth Kochar9518d022016-03-11 14:20:19 +000056
Yatharth Kochar9518d022016-03-11 14:20:19 +000057/*******************************************************************************
58 * Function & variable prototypes
59 ******************************************************************************/
60/* PMF common functions */
61int pmf_get_timestamp_smc(unsigned int tid,
62 u_register_t mpidr,
63 unsigned int flags,
Roberto Vargas777dd432018-02-12 12:36:17 +000064 unsigned long long *ts_value);
Yatharth Kochar9518d022016-03-11 14:20:19 +000065int pmf_setup(void);
66uintptr_t pmf_smc_handler(unsigned int smc_fid,
67 u_register_t x1,
68 u_register_t x2,
69 u_register_t x3,
70 u_register_t x4,
71 void *cookie,
72 void *handle,
73 u_register_t flags);
74
Antonio Nino Diaze89a4532018-07-18 13:26:25 +010075#endif /* PMF_H */