1215976Sjmallett/***********************license start*************** 2232812Sjmallett * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights 3215976Sjmallett * reserved. 4215976Sjmallett * 5215976Sjmallett * 6215976Sjmallett * Redistribution and use in source and binary forms, with or without 7215976Sjmallett * modification, are permitted provided that the following conditions are 8215976Sjmallett * met: 9215976Sjmallett * 10215976Sjmallett * * Redistributions of source code must retain the above copyright 11215976Sjmallett * notice, this list of conditions and the following disclaimer. 12215976Sjmallett * 13215976Sjmallett * * Redistributions in binary form must reproduce the above 14215976Sjmallett * copyright notice, this list of conditions and the following 15215976Sjmallett * disclaimer in the documentation and/or other materials provided 16215976Sjmallett * with the distribution. 17215976Sjmallett 18232812Sjmallett * * Neither the name of Cavium Inc. nor the names of 19215976Sjmallett * its contributors may be used to endorse or promote products 20215976Sjmallett * derived from this software without specific prior written 21215976Sjmallett * permission. 22215976Sjmallett 23215976Sjmallett * This Software, including technical data, may be subject to U.S. export control 24215976Sjmallett * laws, including the U.S. Export Administration Act and its associated 25215976Sjmallett * regulations, and may be subject to export or import regulations in other 26215976Sjmallett * countries. 27215976Sjmallett 28215976Sjmallett * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" 29232812Sjmallett * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR 30215976Sjmallett * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO 31215976Sjmallett * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR 32215976Sjmallett * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM 33215976Sjmallett * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, 34215976Sjmallett * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF 35215976Sjmallett * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR 36215976Sjmallett * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR 37215976Sjmallett * PERFORMANCE OF THE SOFTWARE LIES WITH YOU. 38215976Sjmallett ***********************license end**************************************/ 39215976Sjmallett 40215976Sjmallett/** 41215976Sjmallett * @file 42215976Sjmallett * 43215976Sjmallett * Interface to power-throttle control, measurement, and debugging 44215976Sjmallett * facilities. 45215976Sjmallett * 46232812Sjmallett * <hr>$Revision: 70030 $<hr> 47215976Sjmallett * 48215976Sjmallett */ 49215976Sjmallett 50215976Sjmallett#ifndef __CVMX_POWER_THROTTLE_H__ 51215976Sjmallett#define __CVMX_POWER_THROTTLE_H__ 52215976Sjmallett#ifdef __cplusplus 53215976Sjmallettextern "C" { 54215976Sjmallett#endif 55215976Sjmallett 56232812Sjmallettenum cvmx_power_throttle_field_index { 57232812Sjmallett CVMX_PTH_INDEX_MAXPOW, 58232812Sjmallett CVMX_PTH_INDEX_POWER, 59232812Sjmallett CVMX_PTH_INDEX_THROTT, 60232812Sjmallett CVMX_PTH_INDEX_RESERVED, 61232812Sjmallett CVMX_PTH_INDEX_DISTAG, 62232812Sjmallett CVMX_PTH_INDEX_PERIOD, 63232812Sjmallett CVMX_PTH_INDEX_POWLIM, 64232812Sjmallett CVMX_PTH_INDEX_MAXTHR, 65232812Sjmallett CVMX_PTH_INDEX_MINTHR, 66232812Sjmallett CVMX_PTH_INDEX_HRMPOWADJ, 67232812Sjmallett CVMX_PTH_INDEX_OVRRD, 68232812Sjmallett CVMX_PTH_INDEX_MAX 69232812Sjmallett}; 70232812Sjmalletttypedef enum cvmx_power_throttle_field_index cvmx_power_throttle_field_index_t; 71232812Sjmallett 72215976Sjmallett/** 73232812Sjmallett * Throttle power to percentage% of configured maximum (MAXPOW). 74232812Sjmallett * 75232812Sjmallett * @param percentage 0 to 100 76232812Sjmallett * @return 0 for success and -1 for error. 77215976Sjmallett */ 78232812Sjmallettextern int cvmx_power_throttle_self(uint8_t percentage); 79215976Sjmallett 80232812Sjmallett/** 81232812Sjmallett * Throttle power to percentage% of configured maximum (MAXPOW) 82232812Sjmallett * for the cores identified in coremask. 83232812Sjmallett * 84232812Sjmallett * @param percentage 0 to 100 85232812Sjmallett * @param coremask bit mask where each bit identifies a core. 86232812Sjmallett * @return 0 for success and -1 for error. 87232812Sjmallett */ 88232812Sjmallettextern int cvmx_power_throttle(uint8_t percentage, uint64_t coremask); 89215976Sjmallett 90215976Sjmallett/** 91232812Sjmallett * The same functionality as cvmx_power_throttle() but it takes a 92232812Sjmallett * bitmap-based coremask as a parameter. 93215976Sjmallett */ 94232812Sjmallettextern int cvmx_power_throttle_bmp(uint8_t percentage, 95232812Sjmallett struct cvmx_coremask *pcm); 96215976Sjmallett 97215976Sjmallett/** 98232812Sjmallett * Get the i'th field of the power throttle register 99232812Sjmallett * 100232812Sjmallett * @param r is the value of the power throttle register 101232812Sjmallett * @param i is the index of the field 102232812Sjmallett * 103232812Sjmallett * @return (uint64_t)-1 on failure. 104215976Sjmallett */ 105232812Sjmallettextern uint64_t cvmx_power_throttle_get_field(uint64_t r, 106232812Sjmallett cvmx_power_throttle_field_index_t i); 107215976Sjmallett 108215976Sjmallett/** 109232812Sjmallett * Retrieve the content of the power throttle register of a core 110232812Sjmallett * 111232812Sjmallett * @param ppid is the core id 112232812Sjmallett * 113232812Sjmallett * @return (uint64_t)-1 on failure. 114215976Sjmallett */ 115232812Sjmallettextern uint64_t cvmx_power_throttle_get_register(int ppid); 116215976Sjmallett 117215976Sjmallett#ifdef __cplusplus 118215976Sjmallett} 119215976Sjmallett#endif 120215976Sjmallett#endif /* __CVMX_POWER_THROTTLE_H__ */ 121