blob: e6ea434b808edcad94b349a9d70be2de34d2392b [file] [log] [blame]
developer550bf5e2016-07-11 16:05:23 +08001/*
2 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * Neither the name of ARM nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific
16 * prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <arch.h>
32#include <debug.h>
33#include <power_tracer.h>
34
35#define trace_log(...) INFO("psci: " __VA_ARGS__)
36
37void trace_power_flow(unsigned long mpidr, unsigned char mode)
38{
39 switch (mode) {
40 case CPU_UP:
41 trace_log("core %ld:%ld ON\n",
42 (mpidr & MPIDR_CLUSTER_MASK) >> MPIDR_AFFINITY_BITS,
43 (mpidr & MPIDR_CPU_MASK));
44 break;
45 case CPU_DOWN:
46 trace_log("core %ld:%ld OFF\n",
47 (mpidr & MPIDR_CLUSTER_MASK) >> MPIDR_AFFINITY_BITS,
48 (mpidr & MPIDR_CPU_MASK));
49 break;
50 case CPU_SUSPEND:
51 trace_log("core %ld:%ld SUSPEND\n",
52 (mpidr & MPIDR_CLUSTER_MASK) >> MPIDR_AFFINITY_BITS,
53 (mpidr & MPIDR_CPU_MASK));
54 break;
55 case CLUSTER_UP:
56 trace_log("cluster %ld ON\n",
57 (mpidr & MPIDR_CLUSTER_MASK) >> MPIDR_AFFINITY_BITS);
58 break;
59 case CLUSTER_DOWN:
60 trace_log("cluster %ld OFF\n",
61 (mpidr & MPIDR_CLUSTER_MASK) >> MPIDR_AFFINITY_BITS);
62 break;
63 case CLUSTER_SUSPEND:
64 trace_log("cluster %ld SUSPEND\n",
65 (mpidr & MPIDR_CLUSTER_MASK) >> MPIDR_AFFINITY_BITS);
66 break;
67 default:
68 trace_log("unknown power mode\n");
69 break;
70 }
71}