From ba94a1bba3600d387edba7eb451990d9891e1c2f Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Tue, 30 May 2006 15:56:48 +0200 Subject: * Update Intel IXP4xx support - Add IXP4xx NPE ethernet MAC support - Add support for Intel IXDPG425 board - Add support for Prodrive PDNB3 board - Add IRQ support Patch by Stefan Roese, 23 May 2006 [This patch does not include cpu/ixp/npe/IxNpeMicrocode.c which still sufferes from licensing issues. Blame Intel.] --- cpu/ixp/npe/include/IxPerfProfAcc.h | 1358 +++++++++++++++++++++++++++++++++++ 1 file changed, 1358 insertions(+) create mode 100644 cpu/ixp/npe/include/IxPerfProfAcc.h (limited to 'cpu/ixp/npe/include/IxPerfProfAcc.h') diff --git a/cpu/ixp/npe/include/IxPerfProfAcc.h b/cpu/ixp/npe/include/IxPerfProfAcc.h new file mode 100644 index 0000000..65c0ba9 --- /dev/null +++ b/cpu/ixp/npe/include/IxPerfProfAcc.h @@ -0,0 +1,1358 @@ +/** + * @file IxPerfProfAcc.h + * + * @brief Header file for the IXP400 Perf Prof component (IxPerfProfAcc) + * + * + * @par + * IXP400 SW Release version 2.0 + * + * -- Copyright Notice -- + * + * @par + * Copyright 2001-2005, Intel Corporation. + * All rights reserved. + * + * @par + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Intel Corporation nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * @par + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @par + * -- End of Copyright Notice -- + */ + +/** + * @defgroup IxPerfProfAcc IXP400 Performance Profiling (IxPerfProfAcc) API + * + * @brief IXP400 Performance Profiling Utility component Public API. + * @li NOTE: Xcycle measurement is not supported in Linux. + * + * + * @{ + */ +#ifndef IXPERFPROFACC_H +#define IXPERFPROFACC_H + +#include "IxOsal.h" + +#ifdef __linux +#include +#endif + +/* + * Section for #define + */ +/** + * @ingroup IxPerfProfAcc + * + * @def IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES + * + * @brief This is the maximum number of profiling samples allowed, which can be + * modified according to the user's discretion + */ +#define IX_PERFPROF_ACC_XSCALE_PMU_MAX_PROFILE_SAMPLES 0xFFFF + +/** + * @ingroup IxPerfProfAcc + * + * @def IX_PERFPROF_ACC_BUS_PMU_MAX_PECS + * + * @brief This is the maximum number of Programmable Event Counters available. + * This is a hardware specific and fixed value. Do not change. + * + */ +#define IX_PERFPROF_ACC_BUS_PMU_MAX_PECS 7 + +/** + * @ingroup IxPerfProfAcc + * + * @def IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS + * + * @brief Max number of measurement allowed. This constant is used when + * creating storage array for Xcycle. When run in continuous mode, + * Xcycle will wrap around and re-use buffer. + */ +#define IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS 600 + +#ifdef __linux +/** + * @ingroup IxPerfProfAcc + * + * @def IX_PERFPROF_ACC_XSCALE_PMU_SYMBOL_ACCURACY + * + * @brief Level of accuracy required for matching the PC Address to + * symbol address. This is used when the XScale PMU time/event + * sampling functions get the PC address and search for the + * corresponding symbol address. + */ +#define IX_PERFPROF_ACC_XSCALE_PMU_SYMBOL_ACCURACY 0xffff + +#endif /*__linux*/ + +/** + * @ingroup IxPerfProfAcc + * + * @def IX_PERFPROF_ACC_LOG + * + * @brief Mechanism for logging a formatted message for the PerfProfAcc component + * + * @param level UINT32 [in] - trace level + * @param device UINT32 [in] - output device + * @param str char* [in] - format string, similar to printf(). + * @param a UINT32 [in] - first argument to display + * @param b UINT32 [in] - second argument to display + * @param c UINT32 [in] - third argument to display + * @param d UINT32 [in] - fourth argument to display + * @param e UINT32 [in] - fifth argument to display + * @param f UINT32 [in] - sixth argument to display + * + * @return none + */ +#ifndef NDEBUG +#define IX_PERFPROF_ACC_LOG(level, device, str, a, b, c, d, e, f)\ + (ixOsalLog (level, device, str, a, b, c, d, e, f)) +#else /*do nothing*/ +#define IX_PERFPROF_ACC_LOG(level, device, str, a, b, c, d, e, f) +#endif /*ifdef NDEBUG */ + +/* + * Section for struct + */ + +/** + * @brief contains summary of samples taken + * + * Structure contains all details of each program counter value - frequency + * that PC occurs + */ +typedef struct +{ + UINT32 programCounter; /** + * + * ************************************************************************************* + * * Bit * Name * Description * + * * * + * ************************************************************************************* + * * [31:18] *Reserved* * + * ************************************************************************************* + * * [17:12] * PSS * Indicates which of the slaves on * + * * * * ARBS was previously * + * * * * accessed by the AHBS. * + * * * * [000001] Expansion Bus * + * * * * [000010] SDRAM Controller * + * * * * [000100] PCI * + * * * * [001000] Queue Manager * + * * * * [010000] AHB-APB Bridge * + * * * * [100000] Reserved * + * ************************************************************************************* + * * [11:8] * PSN * Indicates which of the Slaves on * + * * * * ARBN was previously * + * * * * accessed the AHBN. * + * * * * [0001] SDRAM Controller * + * * * * [0010] AHB-AHB Bridge * + * * * * [0100] Reserved * + * * * * [1000] Reserved * + * ************************************************************************************* + * * [7:4] * PMS * Indicates which of the Masters on * + * * * * ARBS was previously * + * * * * accessing the AHBS. * + * * * * [0001] Gasket * + * * * * [0010] AHB-AHB Bridge * + * * * * [0100] PCI * + * * * * [1000] APB * + * ************************************************************************************* + * * [3:0] * PMN * Indicates which of the Masters on * + * * * * ARBN was previously * + * * * * accessing the AHBN. * + * * * * [0001] NPEA * + * * * * [0010] NPEB * + * * * * [0100] NPEC * + * * * * [1000] Reserved * + * ************************************************************************************* + * + * + * @param *pmsrValue UINT32 [out] - Pointer to return PMSR value. Users need to + * allocate storage for psmrValue. + * + * @return none + * + * @li Reentrant : no + * @li ISR Callable : no + * + **/ +PUBLIC void +ixPerfProfAccBusPmuPMSRGet ( +UINT32 *pmsrValue); + + +/** + * The APIs below are specifically used for Xcycle module. + **/ + +/** + * @ingroup IxPerfProfAcc + * + * @fn ixPerfProfAccXcycleBaselineRun ( + UINT32 *numBaselineCycle) + * + * @brief Perform baseline for Xcycle + * + * @param *numBaselineCycle UINT32 [out] - pointer to baseline value after + * calibration. Calling function are responsible for + * allocating memory space for this pointer. + * + * Global Data : + * - None. + * + * This function MUST be run before the Xcycle tool can be used. This + * function must be run immediately when the OS boots up with no other + * addition programs running. + * Addition note : This API will measure the time needed to perform + * a fix amount of CPU instructions (~ 1 second worth of loops) as a + * highest priority task and with interrupt disabled. The time measured + * is known as the baseline - interpreted as the shortest time + * needed to complete the amount of CPU instructions. The baseline is + * returned as unit of time in 66Mhz clock tick. + * + * @return + * - IX_PERFPROF_ACC_STATUS_SUCCESS - successful run, result is returned + * - IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_SET_FAIL - failed to change + * task priority + * - IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_RESTORE_FAIL - failed to + * restore task priority + * - IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS - another utility + * is running + * - IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_IN_PROGRESS - Xcycle + * tool has already started + * + * @li Reentrant : no + * @li ISR Callable : no + * + */ +PUBLIC IxPerfProfAccStatus +ixPerfProfAccXcycleBaselineRun( + UINT32 *numBaselineCycle); + +/** + * @ingroup IxPerfProfAcc + * + * @fn ixPerfProfAccXcycleStart( + UINT32 numMeasurementsRequested); + * + * @brief Start the measurement + * + * @param numMeasurementsRequested UINT32 [in] - number of measurements + * to perform. Value can be 0 to + * IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS. + * 0 indicate continuous measurement. + * + * Global Data : + * - None. + * + * + * Start the measurements immediately. + * numMeasurementsRequested specifies number of measurements to run. + * If numMeasurementsRequested is set to 0, the measurement will + * be performed continuously until IxPerfProfAccXcycleStop() + * is called. + * It is estimated that 1 measurement takes approximately 1 second during + * low CPU utilization, therefore 128 measurement takes approximately 128 sec. + * When CPU utilization is high, the measurement will take longer. + * This function spawn a task the perform the measurement and returns. + * The measurement may continue even if this function returns. + * + * IMPORTANT: Under heavy CPU utilization, the task spawn by this + * function may starve and fail to respond to stop command. User + * may need to kill the task manually in this case. + * + * There are only IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS + * storage available so storing is wrapped around if measurements are + * more than IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS. + * + * + * @return + * - IX_PERFPROF_ACC_STATUS_SUCCESS - successful start, a thread is created + * in the background to perform measurement. + * - IX_PERFPROF_ACC_STATUS_XCYCLE_PRIORITY_SET_FAIL - failed to set + * task priority + * - IX_PERFPROF_ACC_STATUS_XCYCLE_THREAD_CREATE_FAIL - failed to create + * thread to perform measurement. + * - IX_PERFPROF_ACC_STATUS_XCYCLE_NO_BASELINE - baseline is not available + * - IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_REQUEST_OUT_OF_RANGE - + * value is larger than IX_PERFPROF_ACC_XCYCLE_MAX_NUM_OF_MEASUREMENTS + * - IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_IN_PROGRESS - Xcycle tool + * has already started + * - IX_PERFPROF_ACC_STATUS_ANOTHER_UTIL_IN_PROGRESS - another utility is + * running + * + * @li Reentrant : no + * @li ISR Callable : no + * + */ +PUBLIC IxPerfProfAccStatus +ixPerfProfAccXcycleStart ( + UINT32 numMeasurementsRequested); + +/** + * @ingroup IxPerfProfAcc + * + * @fn ixPerfProfAccXcycleStop(void); + * + * @brief Stop the Xcycle measurement + * + * @param None + * + * Global Data : + * - None. + * + * Stop Xcycle measurements immediately. If the measurements have stopped + * or not started, return IX_PERFPROF_STATUS_XCYCLE_MEASUREMENT_NOT_RUNNING. + * Note: This function does not stop measurement cold. The measurement thread + * may need a few seconds to complete the last measurement. User needs to use + * ixPerfProfAccXcycleInProgress() to determine if measurement is indeed + * completed. + * + * @return + * - IX_PERFPROF_ACC_STATUS_SUCCESS - successful measurement is stopped + * - IX_PERFPROF_STATUS_XCYCLE_MEASUREMENT_NOT_RUNNING - no measurement running + * + * @li Reentrant : no + * @li ISR Callable : no + * + */ +PUBLIC IxPerfProfAccStatus +ixPerfProfAccXcycleStop(void); + +/** + * @ingroup IxPerfProfAcc + * + * @fn ixPerfProfAccXcycleResultsGet( + IxPerfProfAccXcycleResults *xcycleResult ) + * + * @brief Get the results of Xcycle measurement + * + * @param *xcycleResult @ref IxPerfProfAccXcycleResults [out] - Pointer to + * results of last measurements. Calling function are + * responsible for allocating memory space for this pointer. + * + * Global Data : + * - None. + * + * Retrieve the results of last measurement. User should use + * ixPerfProfAccXcycleInProgress() to check if measurement is completed + * before getting the results. + * + * @return + * - IX_PERFPROF_ACC_STATUS_SUCCESS - successful + * - IX_PERFPROF_ACC_STATUS_FAIL - result is not complete. + * - IX_PERFPROF_ACC_STATUS_XCYCLE_NO_BASELINE - baseline is performed + * - IX_PERFPROF_ACC_STATUS_XCYCLE_MEASUREMENT_IN_PROGRESS - Xcycle + * tool is still running + * + * @li Reentrant : no + * @li ISR Callable : no + * + */ +PUBLIC IxPerfProfAccStatus +ixPerfProfAccXcycleResultsGet ( + IxPerfProfAccXcycleResults *xcycleResult); + +/** + * @ingroup IxPerfProfAcc + * + * @fn ixPerfProfAccXcycleInProgress (void) + * + * @brief Check if Xcycle is running + * + * @param None + * Global Data : + * - None. + * + * Check if Xcycle measuring task is running. + * + * @return + * - TRUE - Xcycle is running + * - FALSE - Xcycle is not running + * + * @li Reentrant : no + * @li ISR Callable : no + * + */ +PUBLIC BOOL +ixPerfProfAccXcycleInProgress(void); + +#ifdef __linux +/** + * @ingroup IxPerfProfAcc + * + * @fn ixPerfProfAccXscalePmuTimeSampCreateProcFile + * + * @brief Enables proc file to call module function + * + * @param None + * + * Global Data : + * - None. + * + * This function is declared globally to enable /proc directory system to call + * and execute the function when the registered file is called. This function is not meant to + * be called by the user. + * + * @return + * - Length of data written to file. + * + * @li Reentrant : no + * @li ISR Callable : no + * + */ +int +ixPerfProfAccXscalePmuTimeSampCreateProcFile (char *buf, char **start, off_t offset, + int count, int *eof, void *data); + +/** + * @ingroup IxPerfProfAcc + * + * @fn ixPerfProfAccXscalePmuEventSampCreateProcFile + * + * @brief Enables proc file to call module function + * + * @param None + * + * Global Data : + * - None. + * + * This function is declared globally to enable /proc directory system to call + * and execute the function when the registered file is called. This function is not meant to + * be called by the user. + * + * @return + * - Length of data written to file. + * + * @li Reentrant : no + * @li ISR Callable : no + * + */ +int +ixPerfProfAccXscalePmuEventSampCreateProcFile (char *buf, char **start, off_t offset, + int count, int *eof, void *data); + + +#endif /* ifdef __linux */ + +#endif /* ndef IXPERFPROFACC_H */ + +/** + *@} defgroup IxPerfProfAcc + */ + + -- cgit v1.1