2 * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
9 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
23 * The full GNU General Public License is included in this distribution
24 * in the file called LICENSE.GPL.
28 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
29 * All rights reserved.
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
35 * * Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * * Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in
39 * the documentation and/or other materials provided with the
42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56 #ifndef _SCI_LOGGER_H_
57 #define _SCI_LOGGER_H_
62 * @brief This file contains all of the interface methods that can be called
63 * by an SCI user on the logger object. These methods should be
64 * utilized to control the amount of information being logged by the
72 #include <dev/isci/scil/sci_types.h>
75 /* The following is a list of verbosity levels that can be used to enable */
76 /* logging for specific log objects. */
78 /** Enable/disable error level logging for the associated logger object(s). */
79 #define SCI_LOG_VERBOSITY_ERROR 0x00
81 /** Enable/disable warning level logging for the associated logger object(s). */
82 #define SCI_LOG_VERBOSITY_WARNING 0x01
85 * Enable/disable informative level logging for the associated logger object(s).
87 #define SCI_LOG_VERBOSITY_INFO 0x02
90 * This constant is used to enable function trace (enter/exit) level
91 * logging for the associated log object(s).
93 #define SCI_LOG_VERBOSITY_TRACE 0x03
96 * This constant is used to enable state tracing information it will emit a
97 * log message each time a state is entered for the associated log object(s).
99 #define SCI_LOG_VERBOSITY_STATES 0x04
104 * @brief This method will return the verbosity levels enabled for the object
105 * listed in the log_object parameter.
106 * @note Logging must be enabled at compile time in the driver, otherwise
107 * calling this method has no affect.
109 * @param[in] logger This parameter specifies the logger for which to
110 * disable the supplied objects/verbosities. For example,
111 * the framework and core components have different loggers.
112 * @param[in] log_object This parameter specifies the log object for which
113 * to retrieve the associated verbosity levels.
114 * @note This parameter is not a mask, but rather a discrete
117 * @return This method will return the verbosity levels enabled for the
118 * supplied log object.
119 * @retval SCI_LOGGER_VERBOSITY_ERROR This value indicates that the error
120 * verbosity level was set for the supplied log_object.
121 * @retval SCI_LOGGER_VERBOSITY_WARNING This value indicates that the warning
122 * verbosity level was set for the supplied log_object.
123 * @retval SCI_LOGGER_VERBOSITY_INFO This value indicates that the
124 * informational verbosity level was set for the supplied log_object.
125 * @retval SCI_LOGGER_VERBOSITY_TRACE This value indicates that the trace
126 * verbosity level was set for the supplied log_object.
127 * @retval SCI_LOGGER_VERBOSITY_STATES This value indicates that the states
128 * transition verbosity level was set for the supplied log_object
130 U8 sci_logger_get_verbosity_mask(
131 SCI_LOGGER_HANDLE_T logger,
136 * @brief This method simply returns the log object mask. This mask
137 * is essentially a list of log objects for which the specified
138 * level (verbosity) is enabled.
139 * @note Logging must be enabled at compile time in the driver, otherwise
140 * calling this method has no affect.
141 * @note Reserved bits in both the supplied masks shall be ignored.
143 * @param[in] logger This parameter specifies the logger for which to
144 * disable the supplied objects/verbosities. For example,
145 * the framework and core components have different loggers.
146 * @param[in] verbosity This parameter specifies the verbosity for which
147 * to retrieve the set of enabled log objects. Valid values for
148 * this parameter are:
149 * -# SCI_LOGGER_VERBOSITY_ERROR
150 * -# SCI_LOGGER_VERBOSITY_WARNING
151 * -# SCI_LOGGER_VERBOSITY_INFO
152 * -# SCI_LOGGER_VERBOSITY_TRACE
153 * -# SCI_LOGGER_VERBOSITY_STATES
154 * @note This parameter is not a mask, but rather a discrete
157 * @return This method will return the log object mask indicating each of
158 * the log objects for which logging is enabled at the supplied level.
160 U32 sci_logger_get_object_mask(
161 SCI_LOGGER_HANDLE_T logger,
166 * @brief This method will enable each of the supplied log objects in
167 * log_object_mask for each of the supplied verbosities in
168 * verbosity_mask. To enable all logging, simply set all bits in
169 * both the log_object_mask and verbosity_mask.
170 * @note Logging must be enabled at compile time in the driver, otherwise
171 * calling this method has no affect.
172 * @note Reserved bits in both the supplied masks shall be ignored.
174 * @param[in] logger This parameter specifies the logger for which to
175 * disable the supplied objects/verbosities. For example,
176 * the framework and core components have different loggers.
177 * @param[in] log_object_mask This parameter specifies the log objects for
178 * which to enable logging.
179 * @param[in] verbosity_mask This parameter specifies the verbosity levels
180 * at which to enable each log_object.
184 void sci_logger_enable(
185 SCI_LOGGER_HANDLE_T logger,
191 * @brief This method will disable each of the supplied log objects in
192 * log_object_mask for each of the supplied verbosities in
193 * verbosity_mask. To disable all logging, simply set all bits in
194 * both the log_object_mask and verbosity_mask.
195 * @note Logging must be enabled at compile time in the driver, otherwise
196 * calling this method has no affect.
197 * @note Reserved bits in both the supplied masks shall be ignored.
199 * @param[in] logger This parameter specifies the logger for which to
200 * disable the supplied objects/verbosities. For example,
201 * the framework and core components have different loggers.
202 * @param[in] log_object_mask This parameter specifies the log objects for
203 * which to disable logging.
204 * @param[in] verbosity_mask This parameter specifies the verbosity levels
205 * at which to disable each log_object.
209 void sci_logger_disable(
210 SCI_LOGGER_HANDLE_T logger,
217 * @brief this macro checks whether it is ok to log.
219 * @param[in] logger This parameter specifies the logger for
220 * which to disable the supplied
221 * objects/verbosities. For example, the framework
222 * and core components have different loggers.
223 * @param[in] log_object_mask This parameter specifies the log objects for
224 * which to disable logging.
225 * @param[in] verbosity_mask This parameter specifies the verbosity levels
226 * at which to disable each log_object.
228 * @return TRUE or FALSE
230 BOOL sci_logger_is_enabled(
231 SCI_LOGGER_HANDLE_T logger,
239 #define sci_logger_get_verbosity_mask(logger, log_object)
240 #define sci_logger_get_object_mask(logger, verbosity)
241 #define sci_logger_enable(logger, log_object_mask, verbosity_mask)
242 #define sci_logger_disable(logger, log_object_mask, verbosity_mask)
243 #define sci_logger_is_enabled(logger, log_object_mask, verbosity_level)
245 #endif // SCI_LOGGING
249 #endif // __cplusplus
251 #endif // _SCI_LOGGER_H_