1 /******************************************************************************* 2 *Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved. 3 * 4 *Redistribution and use in source and binary forms, with or without modification, are permitted provided 5 *that the following conditions are met: 6 *1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 7 *following disclaimer. 8 *2. Redistributions in binary form must reproduce the above copyright notice, 9 *this list of conditions and the following disclaimer in the documentation and/or other materials provided 10 *with the distribution. 11 * 12 *THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED 13 *WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 14 *FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 15 *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 16 *NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 17 *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 18 *LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 19 *SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE 20 * 21 * 22 *******************************************************************************/ 23 /*************************************************************************** 24 25 Version Control Information: 26 27 $RCSfile: osdebug.h,v $ 28 $Revision: 114125 $ 29 30 Note: 31 ***************************************************************************/ 32 33 #ifndef __OSDEBUG_H__ 34 #define __OSDEBUG_H__ 35 36 #ifdef AGTIAPI_KDB_ENABLE 37 #include <linux/kdb.h> 38 #endif 39 40 /*************************************************************************** 41 OS_ASSERT : This macro is used when an internal error is detected. 42 ***************************************************************************/ 43 #ifdef AGTIAPI_KDB_ENABLE 44 #define OS_ASSERT(expr, message) \ 45 do { \ 46 if (!(expr)) \ 47 { \ 48 printf("ASSERT: %s", message); \ 49 printf(" - file %s, line %d\n", __FILE__, __LINE__); \ 50 BUG_ON(1); \ 51 KDB_ENTER(); \ 52 } \ 53 } while (0) 54 #else 55 #define OS_ASSERT(expr, message) \ 56 do { \ 57 if (!(expr)) \ 58 { \ 59 printf("ASSERT: %s", message); \ 60 printf(" - file %s, line %d\n", __FILE__, __LINE__); \ 61 } \ 62 } while (0) 63 #endif 64 65 #define AG_ERROR_MSG(mask, val, format) \ 66 do { \ 67 if (mask) \ 68 { \ 69 if (mask >= val) \ 70 printf format; \ 71 } \ 72 else \ 73 printf format; \ 74 } while (0) 75 76 #ifdef TD_DEBUG_ENABLE 77 #define TIDEBUG_MSG(mask, val, format) \ 78 do { \ 79 if (mask) \ 80 { \ 81 if (!val) \ 82 printf format ; \ 83 else \ 84 if (!(mask & 0x80000000)) \ 85 { \ 86 if (mask >= val) \ 87 printf format ; \ 88 } \ 89 else \ 90 { \ 91 if (mask & val) \ 92 printf format ; \ 93 } \ 94 } \ 95 } while (0) 96 97 #define TIDEBUG_MSG0(format) \ 98 do { \ 99 printf format ; \ 100 } while (0) 101 #else 102 #define TIDEBUG_MSG(mask, val, format) 103 #define TIDEBUG_MSG0(format) 104 #endif 105 106 /*************************************************************************** 107 FC debug - The following is used for FC specific debug. 108 **************************************************************************/ 109 #ifdef AG_PROTOCOL_FC 110 #ifndef fcEnableTraceFunctions 111 #define fcEnableTraceFunctions 1 112 #endif 113 #else 114 #ifndef fcEnableTraceFunctions 115 #define fcEnableTraceFunctions 0 116 #endif 117 118 #endif /* AG_PROTOCOL_FC */ 119 120 #endif /* #ifndef __OSDEBUG_H__ */ 121 122