blob: 5f3e6b7eccb4e0f45dd2d511a2abd27f90c59c7d [file] [log] [blame]
dp-arm5695cfe2016-08-15 10:35:54 +01001/*
Antonio Nino Diaz81542c02018-10-04 09:55:23 +01002 * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
dp-arm5695cfe2016-08-15 10:35:54 +01003 *
dp-arm82cb2c12017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
dp-arm5695cfe2016-08-15 10:35:54 +01005 */
6
Antonio Nino Diazc3cf06f2018-11-08 10:20:19 +00007#ifndef PMF_ASM_MACROS_S
8#define PMF_ASM_MACROS_S
dp-arm5695cfe2016-08-15 10:35:54 +01009
10#define PMF_TS_SIZE 8
11
12 /*
dp-armd2e201b2016-09-08 11:51:49 +010013 * This macro calculates the address of the per-cpu timestamp
14 * for the given service name and local timestamp id.
dp-arm5695cfe2016-08-15 10:35:54 +010015 * Clobbers: x0 - x9
16 */
Antonio Nino Diaz81542c02018-10-04 09:55:23 +010017 .macro pmf_calc_timestamp_addr _name, _tid
dp-arm5695cfe2016-08-15 10:35:54 +010018 mov x9, x30
19 bl plat_my_core_pos
20 mov x30, x9
Soby Mathewf1722b62018-10-12 16:40:28 +010021 adr x2, __PMF_PERCPU_TIMESTAMP_END__
22 adr x1, __PMF_TIMESTAMP_START__
23 sub x1, x2, x1
dp-arm5695cfe2016-08-15 10:35:54 +010024 mov x2, #(\_tid * PMF_TS_SIZE)
25 madd x0, x0, x1, x2
Soby Mathewf1722b62018-10-12 16:40:28 +010026 adr x1, pmf_ts_mem_\_name
dp-arm5695cfe2016-08-15 10:35:54 +010027 add x0, x0, x1
28 .endm
29
Antonio Nino Diazc3cf06f2018-11-08 10:20:19 +000030#endif /* PMF_ASM_MACROS_S */