9506 Want support for QLogic QL41000/45000 series devices
[unleashed.git] / usr / src / uts / common / io / qede / 579xx / hsi / mfw_trace.h
blob0d0983b4f6ab1359ec72b4cbfbdf7356fee4331b
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, v.1, (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://opensource.org/licenses/CDDL-1.0.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2014-2017 Cavium, Inc.
24 * The contents of this file are subject to the terms of the Common Development
25 * and Distribution License, v.1, (the "License").
27 * You may not use this file except in compliance with the License.
29 * You can obtain a copy of the License at available
30 * at http://opensource.org/licenses/CDDL-1.0
32 * See the License for the specific language governing permissions and
33 * limitations under the License.
36 /* To use this file, please define the following macros:
37 * MFWT_ALLOC(size) - allocate memory for array
38 * MFWT_FREE(void *) - free memory
39 * MFWT_STRNCPY(d,s,n) - copy string up to size n
40 * MFWT_ERROR(fmt, ...) - error print
41 * MFWT_TRACE(fmt, ...) - debug trace
42 * ENOMEM - return value for: Out of memory
43 * EINVAL - return value for: Invalid argument
45 #ifndef MFW_TRACE_H
46 #define MFW_TRACE_H
48 #include "mfw_hsi.h"
50 struct mfw_trace_fmt;
52 struct mfw_trace_meta {
53 unsigned int modules_num;
54 char **modules;
55 unsigned int fmts_num;
56 struct mfw_trace_fmt *fmts;
59 /**
60 * @brief mfw_trace_load_meta_data - load the meta data into memory
62 * This function allocates memory for all the formats. The
63 * mfw_trace_free_meta_data should be called to release this memory.
65 * @param input_str - the content of the meta data
66 * @param p_meta - the output struct that will contain all the allocated
67 * memory for the fromats
69 * @status - 0 on success
71 u32 mfw_trace_load_meta_data(const char *input_str,
72 struct mfw_trace_meta *p_meta);
74 /**
75 * @brief mfw_trace_free_meta_data - releases all the allocated memory
77 * This function releases the memory allocated by mfw_trace_load_meta_data.
79 * @param p_meta
81 void mfw_trace_free_meta_data(struct mfw_trace_meta *p_meta);
83 /**
84 * @brief mfw_trace_parse_trace - releases all the allocated memory
86 * This function releases the memory allocated by mfw_trace_load_meta_data.
88 * @param trace_buffer - the buffer read from the chip
89 * @param p_meta - the parsed meta data
90 * @param p_print - the function used to print the parsed trace
92 * @status - 0 on success
94 typedef int (*output_printf) (const char *fmt, ...);
95 u32 mfw_trace_parse_trace(struct mcp_trace *p_trace,
96 struct mfw_trace_meta *p_meta,
97 output_printf p_print);
99 #endif /* MFW_TRACE_H */