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**************************************/
45 #ifndef __CVMX_LOG_H__
46 #define __CVMX_LOG_H__
51 * cvmx-log supplies a fast log buffer implementation. Each core writes
52 * log data to a differnet buffer to avoid synchronization overhead. Function
53 * call logging can be turned on with the GCC option "-pg".
55 * <hr>$Revision: 70030 $<hr>
58 #ifdef CVMX_BUILD_FOR_LINUX_KERNEL
59 #include <asm/octeon/cvmx-core.h>
61 #include "cvmx-core.h"
69 * Add CVMX_LOG_DISABLE_PC_LOGGING as an attribute to and function prototype
70 * that you don't want logged when the gcc option "-pg" is supplied. We
71 * use it on the cvmx-log functions since it is pointless to log the
72 * calling of a function than in itself writes to the log.
74 #define CVMX_LOG_DISABLE_PC_LOGGING __attribute__((no_instrument_function))
77 * Log a constant printf style format string with 0 to 4
78 * arguments. The string must persist until the log is read,
79 * but the parameters are copied into the log.
81 * @param format Constant printf style format string.
82 * @param numberx 64bit argument to the printf format string
84 void cvmx_log_printf0(const char *format) CVMX_LOG_DISABLE_PC_LOGGING;
85 void cvmx_log_printf1(const char *format, uint64_t number1) CVMX_LOG_DISABLE_PC_LOGGING;
86 void cvmx_log_printf2(const char *format, uint64_t number1, uint64_t number2) CVMX_LOG_DISABLE_PC_LOGGING;
87 void cvmx_log_printf3(const char *format, uint64_t number1, uint64_t number2, uint64_t number3) CVMX_LOG_DISABLE_PC_LOGGING;
88 void cvmx_log_printf4(const char *format, uint64_t number1, uint64_t number2, uint64_t number3, uint64_t number4) CVMX_LOG_DISABLE_PC_LOGGING;
91 * Log an arbitrary block of 64bit words. At most 255 64bit
92 * words can be logged. The words are copied into the log.
94 * @param size_in_dwords
95 * Number of 64bit dwords to copy into the log.
96 * @param data Array of 64bit dwords to copy
98 void cvmx_log_data(uint64_t size_in_dwords, const uint64_t *data) CVMX_LOG_DISABLE_PC_LOGGING;
101 * Log a structured data object. Post processing will use the
102 * debugging information in the ELF file to determine how to
103 * display the structure. Max of 2032 bytes.
106 * cvmx_log_structure("cvmx_wqe_t", work, sizeof(*work));
108 * @param type C typedef expressed as a string. This will be used to
109 * lookup the structure in the debugging infirmation.
110 * @param data Data to be written to the log.
111 * @param size_in_bytes
112 * Size if the data in bytes. Normally you'll use the
113 * sizeof() operator here.
115 void cvmx_log_structure(const char *type, void *data, int size_in_bytes) CVMX_LOG_DISABLE_PC_LOGGING;
118 * Setup the mips performance counters
120 * @param counter1 Event type for counter 1
121 * @param counter2 Event type for counter 2
123 void cvmx_log_perf_setup(cvmx_core_perf_t counter1, cvmx_core_perf_t counter2);
126 * Log the performance counters
128 void cvmx_log_perf(void) CVMX_LOG_DISABLE_PC_LOGGING;
131 * Display the current log in a human readable format.
133 void cvmx_log_display(void);