1 /***********************license start***************
2 * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * * Neither the name of Cavium Inc. nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
23 * This Software, including technical data, may be subject to U.S. export control
24 * laws, including the U.S. Export Administration Act and its associated
25 * regulations, and may be subject to export or import regulations in other
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
30 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31 * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32 * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33 * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34 * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35 * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36 * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
37 * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38 ***********************license end**************************************/
43 * Interface to power-throttle control, measurement, and debugging
46 * <hr>$Revision: 70030 $<hr>
50 #ifndef __CVMX_POWER_THROTTLE_H__
51 #define __CVMX_POWER_THROTTLE_H__
56 enum cvmx_power_throttle_field_index {
57 CVMX_PTH_INDEX_MAXPOW,
59 CVMX_PTH_INDEX_THROTT,
60 CVMX_PTH_INDEX_RESERVED,
61 CVMX_PTH_INDEX_DISTAG,
62 CVMX_PTH_INDEX_PERIOD,
63 CVMX_PTH_INDEX_POWLIM,
64 CVMX_PTH_INDEX_MAXTHR,
65 CVMX_PTH_INDEX_MINTHR,
66 CVMX_PTH_INDEX_HRMPOWADJ,
70 typedef enum cvmx_power_throttle_field_index cvmx_power_throttle_field_index_t;
73 * Throttle power to percentage% of configured maximum (MAXPOW).
75 * @param percentage 0 to 100
76 * @return 0 for success and -1 for error.
78 extern int cvmx_power_throttle_self(uint8_t percentage);
81 * Throttle power to percentage% of configured maximum (MAXPOW)
82 * for the cores identified in coremask.
84 * @param percentage 0 to 100
85 * @param coremask bit mask where each bit identifies a core.
86 * @return 0 for success and -1 for error.
88 extern int cvmx_power_throttle(uint8_t percentage, uint64_t coremask);
91 * The same functionality as cvmx_power_throttle() but it takes a
92 * bitmap-based coremask as a parameter.
94 extern int cvmx_power_throttle_bmp(uint8_t percentage,
95 struct cvmx_coremask *pcm);
98 * Get the i'th field of the power throttle register
100 * @param r is the value of the power throttle register
101 * @param i is the index of the field
103 * @return (uint64_t)-1 on failure.
105 extern uint64_t cvmx_power_throttle_get_field(uint64_t r,
106 cvmx_power_throttle_field_index_t i);
109 * Retrieve the content of the power throttle register of a core
111 * @param ppid is the core id
113 * @return (uint64_t)-1 on failure.
115 extern uint64_t cvmx_power_throttle_get_register(int ppid);
120 #endif /* __CVMX_POWER_THROTTLE_H__ */