Main Page | Class List | Directories | File List | Class Members | File Members

ipmi_debug.h

Go to the documentation of this file.
00001 /*
00002  * ipmi_debug.h
00003  *
00004  * MontaVista IPMI interface, debug information.
00005  *
00006  * Author: MontaVista Software, Inc.
00007  *         Corey Minyard <minyard@mvista.com>
00008  *         source@mvista.com
00009  *
00010  * Copyright 2002,2003,2004,2005 MontaVista Software Inc.
00011  *
00012  * This software is available to you under a choice of one of two
00013  * licenses.  You may choose to be licensed under the terms of the GNU
00014  * Lesser General Public License (GPL) Version 2 or the modified BSD
00015  * license below.  The following disclamer applies to both licenses:
00016  *
00017  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
00018  *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00019  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00022  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00023  *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024  *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
00025  *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00026  *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  *
00028  * GNU Lesser General Public Licence
00029  *
00030  *  This program is free software; you can redistribute it and/or
00031  *  modify it under the terms of the GNU Lesser General Public License
00032  *  as published by the Free Software Foundation; either version 2 of
00033  *  the License, or (at your option) any later version.
00034  *
00035  *  You should have received a copy of the GNU Lesser General Public
00036  *  License along with this program; if not, write to the Free
00037  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00038  *
00039  * Modified BSD Licence
00040  *
00041  * Redistribution and use in source and binary forms, with or without
00042  * modification, are permitted provided that the following conditions
00043  * are met:
00044  *
00045  *   1. Redistributions of source code must retain the above copyright
00046  *      notice, this list of conditions and the following disclaimer.
00047  *   2. Redistributions in binary form must reproduce the above
00048  *      copyright notice, this list of conditions and the following
00049  *      disclaimer in the documentation and/or other materials provided
00050  *      with the distribution.
00051  *   3. The name of the author may not be used to endorse or promote
00052  *      products derived from this software without specific prior
00053  *      written permission.
00054  */
00055 
00056 #ifndef _IPMI_DEBUG_H
00057 #define _IPMI_DEBUG_H
00058 
00059 #include <OpenIPMI/os_handler.h>
00060 
00061 #ifdef __cplusplus
00062 extern "C" {
00063 #endif
00064 
00065 extern unsigned int __ipmi_log_mask;
00066 
00067 /* Log normal IPMI messages, but not low-level protocol messages. */
00068 #define DEBUG_MSG_BIT           (1 << 0)
00069 
00070 /* Log all messages. */
00071 #define DEBUG_RAWMSG_BIT        (1 << 1)
00072 
00073 /* Log events that are received. */
00074 #define DEBUG_EVENTS_BIT        (1 << 3)
00075 
00076 /* Force the given connection to no longer work */
00077 #define DEBUG_CON0_FAIL_BIT     (1 << 4)
00078 #define DEBUG_CON1_FAIL_BIT     (1 << 5)
00079 #define DEBUG_CON2_FAIL_BIT     (1 << 6)
00080 #define DEBUG_CON3_FAIL_BIT     (1 << 7)
00081 
00082 #define DEBUG_MSG_ERR_BIT       (1 << 8)
00083 
00084 #define DEBUG_MSG       (__ipmi_log_mask & DEBUG_MSG_BIT)
00085 #define DEBUG_MSG_ENABLE() __ipmi_log_mask |= DEBUG_MSG_BIT
00086 #define DEBUG_MSG_DISABLE() __ipmi_log_mask &= ~DEBUG_MSG_BIT
00087 
00088 #define DEBUG_RAWMSG    (__ipmi_log_mask & DEBUG_RAWMSG_BIT)
00089 #define DEBUG_RAWMSG_ENABLE() __ipmi_log_mask |= DEBUG_RAWMSG_BIT
00090 #define DEBUG_RAWMSG_DISABLE() __ipmi_log_mask &= ~DEBUG_RAWMSG_BIT
00091 
00092 #define DEBUG_EVENTS    (__ipmi_log_mask & DEBUG_EVENTS_BIT)
00093 #define DEBUG_EVENTS_ENABLE() __ipmi_log_mask |= DEBUG_EVENTS_BIT
00094 #define DEBUG_EVENTS_DISABLE() __ipmi_log_mask &= ~DEBUG_EVENTS_BIT
00095 
00096 #define DEBUG_CON_FAIL(con)    (__ipmi_log_mask & (DEBUG_CON0_FAIL_BIT << con))
00097 #define DEBUG_CON_FAIL_ENABLE(con) \
00098         __ipmi_log_mask |= (DEBUG_CON0_FAIL_BIT << con)
00099 #define DEBUG_CON_FAIL_DISABLE(con) \
00100         __ipmi_log_mask &= ~(DEBUG_CON0_FAIL_BIT << con)
00101 
00102 #define DEBUG_MSG_ERR   (__ipmi_log_mask & DEBUG_MSG_ERR_BIT)
00103 #define DEBUG_MSG_ERR_ENABLE() __ipmi_log_mask |= DEBUG_MSG_ERR_BIT
00104 #define DEBUG_MSG_ERR_DISABLE() __ipmi_log_mask &= ~DEBUG_MSG_ERR_BIT
00105 
00106 #ifdef IPMI_CHECK_LOCKS
00107 void ipmi_report_lock_error(os_handler_t *handler, char *str);
00108 #define IPMI_REPORT_LOCK_ERROR(handler, str) ipmi_report_lock_error(handler, \
00109                                                                     str)
00110 #else
00111 #define IPMI_REPORT_LOCK_ERROR(handler, str) do {} while (0)
00112 #endif
00113 
00114 extern int __ipmi_debug_locks;
00115 #define DEBUG_LOCKS     (__ipmi_debug_locks)
00116 #define DEBUG_LOCKS_ENABLE() __ipmi_debug_locks = 1
00117 #define DEBUG_LOCKS_DISABLE() __ipmi_debug_locks = 0
00118 
00119 #ifdef __cplusplus
00120 }
00121 #endif
00122 
00123 #endif /* _IPMI_DEBUG_H */

© sourcejam.com 2005-2008