xref: /optee_os/lib/libutee/include/pta_gprof.h (revision 1bb929836182ecb96d2d9d268daa807c67596396)
1*1bb92983SJerome Forissier /* SPDX-License-Identifier: BSD-2-Clause */
2883c4be3SJerome Forissier /*
3883c4be3SJerome Forissier  * Copyright (c) 2016, Linaro Limited
4883c4be3SJerome Forissier  * All rights reserved.
5883c4be3SJerome Forissier  *
6883c4be3SJerome Forissier  * Redistribution and use in source and binary forms, with or without
7883c4be3SJerome Forissier  * modification, are permitted provided that the following conditions are met:
8883c4be3SJerome Forissier  *
9883c4be3SJerome Forissier  * 1. Redistributions of source code must retain the above copyright notice,
10883c4be3SJerome Forissier  * this list of conditions and the following disclaimer.
11883c4be3SJerome Forissier  *
12883c4be3SJerome Forissier  * 2. Redistributions in binary form must reproduce the above copyright notice,
13883c4be3SJerome Forissier  * this list of conditions and the following disclaimer in the documentation
14883c4be3SJerome Forissier  * and/or other materials provided with the distribution.
15883c4be3SJerome Forissier  *
16883c4be3SJerome Forissier  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17883c4be3SJerome Forissier  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18883c4be3SJerome Forissier  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19883c4be3SJerome Forissier  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20883c4be3SJerome Forissier  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21883c4be3SJerome Forissier  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22883c4be3SJerome Forissier  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23883c4be3SJerome Forissier  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24883c4be3SJerome Forissier  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25883c4be3SJerome Forissier  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26883c4be3SJerome Forissier  * POSSIBILITY OF SUCH DAMAGE.
27883c4be3SJerome Forissier  */
28883c4be3SJerome Forissier 
29883c4be3SJerome Forissier #ifndef __PTA_GPROF_H
30883c4be3SJerome Forissier #define __PTA_GPROF_H
31883c4be3SJerome Forissier 
32883c4be3SJerome Forissier /*
33883c4be3SJerome Forissier  * Interface to the gprof pseudo-TA, which is used by libutee to control TA
34883c4be3SJerome Forissier  * profiling and forward data to tee-supplicant.
35883c4be3SJerome Forissier  */
36883c4be3SJerome Forissier 
37883c4be3SJerome Forissier #define PTA_GPROF_UUID { 0x2f6e0d48, 0xc574, 0x426d, { \
38883c4be3SJerome Forissier 			 0x82, 0x4e, 0x40, 0x19, 0x8c, 0xde, 0x5c, 0xac } }
39883c4be3SJerome Forissier 
40883c4be3SJerome Forissier /*
41883c4be3SJerome Forissier  * Send TA profiling data (gmon.out format) to tee-supplicant
42883c4be3SJerome Forissier  * Data may be sent in several chunks: first set id to 0, then re-use the
43883c4be3SJerome Forissier  * allocated value in subsequent calls.
44883c4be3SJerome Forissier  *
45883c4be3SJerome Forissier  * [in/out] value[0].a: id
46883c4be3SJerome Forissier  * [in]     memref[1]: profiling data
47883c4be3SJerome Forissier  */
48883c4be3SJerome Forissier #define PTA_GPROF_SEND			0
49883c4be3SJerome Forissier 
50883c4be3SJerome Forissier /*
51883c4be3SJerome Forissier  * Start PC sampling of a user TA session
52883c4be3SJerome Forissier  *
53883c4be3SJerome Forissier  * [in/out] memref[0]: sampling buffer
54883c4be3SJerome Forissier  * [in]     value[1].a: offset: the lowest PC value in the TA
55883c4be3SJerome Forissier  * [in]     value[1].b: scale: histogram scaling factor
56883c4be3SJerome Forissier  */
57883c4be3SJerome Forissier #define PTA_GPROF_START_PC_SAMPLING	1
58883c4be3SJerome Forissier 
59883c4be3SJerome Forissier /*
60883c4be3SJerome Forissier  * Stop PC sampling of a user TA session and retrieve data
61883c4be3SJerome Forissier  *
62883c4be3SJerome Forissier  * [out] value[0].a: sampling frequency
63883c4be3SJerome Forissier  */
64883c4be3SJerome Forissier #define PTA_GPROF_STOP_PC_SAMPLING	2
65883c4be3SJerome Forissier 
66883c4be3SJerome Forissier #endif /* __PTA_GPROF_H */
67