xref: /optee_os/lib/libutee/include/pta_gprof.h (revision 883c4be3d11cacf49665f51d1d6af4c02a0a0afd)
1*883c4be3SJerome Forissier /*
2*883c4be3SJerome Forissier  * Copyright (c) 2016, Linaro Limited
3*883c4be3SJerome Forissier  * All rights reserved.
4*883c4be3SJerome Forissier  *
5*883c4be3SJerome Forissier  * Redistribution and use in source and binary forms, with or without
6*883c4be3SJerome Forissier  * modification, are permitted provided that the following conditions are met:
7*883c4be3SJerome Forissier  *
8*883c4be3SJerome Forissier  * 1. Redistributions of source code must retain the above copyright notice,
9*883c4be3SJerome Forissier  * this list of conditions and the following disclaimer.
10*883c4be3SJerome Forissier  *
11*883c4be3SJerome Forissier  * 2. Redistributions in binary form must reproduce the above copyright notice,
12*883c4be3SJerome Forissier  * this list of conditions and the following disclaimer in the documentation
13*883c4be3SJerome Forissier  * and/or other materials provided with the distribution.
14*883c4be3SJerome Forissier  *
15*883c4be3SJerome Forissier  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16*883c4be3SJerome Forissier  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17*883c4be3SJerome Forissier  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18*883c4be3SJerome Forissier  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19*883c4be3SJerome Forissier  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20*883c4be3SJerome Forissier  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21*883c4be3SJerome Forissier  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22*883c4be3SJerome Forissier  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23*883c4be3SJerome Forissier  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24*883c4be3SJerome Forissier  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25*883c4be3SJerome Forissier  * POSSIBILITY OF SUCH DAMAGE.
26*883c4be3SJerome Forissier  */
27*883c4be3SJerome Forissier 
28*883c4be3SJerome Forissier #ifndef __PTA_GPROF_H
29*883c4be3SJerome Forissier #define __PTA_GPROF_H
30*883c4be3SJerome Forissier 
31*883c4be3SJerome Forissier /*
32*883c4be3SJerome Forissier  * Interface to the gprof pseudo-TA, which is used by libutee to control TA
33*883c4be3SJerome Forissier  * profiling and forward data to tee-supplicant.
34*883c4be3SJerome Forissier  */
35*883c4be3SJerome Forissier 
36*883c4be3SJerome Forissier #define PTA_GPROF_UUID { 0x2f6e0d48, 0xc574, 0x426d, { \
37*883c4be3SJerome Forissier 			 0x82, 0x4e, 0x40, 0x19, 0x8c, 0xde, 0x5c, 0xac } }
38*883c4be3SJerome Forissier 
39*883c4be3SJerome Forissier /*
40*883c4be3SJerome Forissier  * Send TA profiling data (gmon.out format) to tee-supplicant
41*883c4be3SJerome Forissier  * Data may be sent in several chunks: first set id to 0, then re-use the
42*883c4be3SJerome Forissier  * allocated value in subsequent calls.
43*883c4be3SJerome Forissier  *
44*883c4be3SJerome Forissier  * [in/out] value[0].a: id
45*883c4be3SJerome Forissier  * [in]     memref[1]: profiling data
46*883c4be3SJerome Forissier  */
47*883c4be3SJerome Forissier #define PTA_GPROF_SEND			0
48*883c4be3SJerome Forissier 
49*883c4be3SJerome Forissier /*
50*883c4be3SJerome Forissier  * Start PC sampling of a user TA session
51*883c4be3SJerome Forissier  *
52*883c4be3SJerome Forissier  * [in/out] memref[0]: sampling buffer
53*883c4be3SJerome Forissier  * [in]     value[1].a: offset: the lowest PC value in the TA
54*883c4be3SJerome Forissier  * [in]     value[1].b: scale: histogram scaling factor
55*883c4be3SJerome Forissier  */
56*883c4be3SJerome Forissier #define PTA_GPROF_START_PC_SAMPLING	1
57*883c4be3SJerome Forissier 
58*883c4be3SJerome Forissier /*
59*883c4be3SJerome Forissier  * Stop PC sampling of a user TA session and retrieve data
60*883c4be3SJerome Forissier  *
61*883c4be3SJerome Forissier  * [out] value[0].a: sampling frequency
62*883c4be3SJerome Forissier  */
63*883c4be3SJerome Forissier #define PTA_GPROF_STOP_PC_SAMPLING	2
64*883c4be3SJerome Forissier 
65*883c4be3SJerome Forissier #endif /* __PTA_GPROF_H */
66