[ALL] a fix to support debug print in Windows 2008. [mlnx: 3510]
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 27 Nov 2008 13:34:14 +0000 (13:34 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 27 Nov 2008 13:34:14 +0000 (13:34 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1773 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

14 files changed:
core/complib/kernel/cl_driver.c
hw/mlx4/kernel/bus/core/l2w_debug.c
hw/mlx4/kernel/bus/drv/wpptrace.h
hw/mlx4/kernel/hca/debug.h
hw/mlx4/kernel/hca/drv.c
hw/mlx4/kernel/inc/l2w.h
hw/mlx4/kernel/inc/l2w_memory.h
hw/mlx4/kernel/inc/mlx4_debug.h
hw/mthca/kernel/hca_debug.h
hw/mthca/kernel/hca_pnp.c
hw/mthca/kernel/mt_memory.h
hw/mthca/kernel/mt_types.h
inc/kernel/complib/cl_debug_osd.h
ulp/ipoib/kernel/ipoib_debug.h

index 28558e6..0087ee1 100644 (file)
@@ -31,6 +31,7 @@
 \r
 \r
 #include "complib/comp_lib.h"\r
+#include <stdarg.h>\r
 \r
 \r
 CL_EXPORT NTSTATUS\r
@@ -64,3 +65,16 @@ cl_from_ntstatus(
                return CL_ERROR;\r
        }\r
 }\r
+\r
+\r
+#if defined( _DEBUG_ )\r
+\r
+VOID cl_dbg_out( IN PCCH  format, ...)\r
+{\r
+       va_list  list;\r
+       va_start(list, format);\r
+       vDbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL, format, list);\r
+       va_end(list);\r
+}\r
+#endif\r
+\r
index dcb1a36..9973d81 100644 (file)
@@ -134,7 +134,7 @@ mlx4_err(
        buf[MAX_BUFFER_SIZE - 1] = '\0';
        if (RtlStringCbVPrintfA( (char*)buf, sizeof(buf), format, list))
                return;
-       DbgPrint( "%s\n", (char*)buf );
+       cl_dbg_out( "%s\n", (char*)buf );
        va_end(list);
 
        // print to Event Log
@@ -158,7 +158,7 @@ mlx4_dbg(
        va_start(list, format);
        buf[MAX_BUFFER_SIZE - 1] = '\0';
        RtlStringCbVPrintfA( (char*)buf, sizeof(buf), format, list);
-       DbgPrint( "%s\n", (char*)buf );
+       cl_dbg_out( "%s\n", (char*)buf );
        va_end(list);
 #else  
        UNUSED_PARAM(mdev);
@@ -181,7 +181,7 @@ dev_err(
        va_start(list, format);
        buf[MAX_BUFFER_SIZE - 1] = '\0';
        RtlStringCbVPrintfA( (char*)buf, sizeof(buf), format, list);
-       DbgPrint( "%s\n", (char*)buf );
+       cl_dbg_out( "%s\n", (char*)buf );
        va_end(list);
 
        // print to Event Log
@@ -205,7 +205,7 @@ dev_info(
        va_start(list, format);
        buf[MAX_BUFFER_SIZE - 1] = '\0';
        RtlStringCbVPrintfA( (char*)buf, sizeof(buf), format, list);
-       DbgPrint( "%s\n", (char*)buf );
+       cl_dbg_out( "%s\n", (char*)buf );
        va_end(list);
 #else  
        UNUSED_PARAM(p_mdev);
index 81ab335..bef591c 100644 (file)
@@ -91,9 +91,9 @@ extern const unsigned int g_SdpDbgFlags;
     if (g_SdpDbgLevel >= (_level_) && (g_SdpDbgFlags & (_flag_)))               \\r
     {                                                                           \\r
         if(_level_ == TRACE_LEVEL_ERROR)                                        \\r
-            DbgPrint ("***ERROR***  ");                                         \\r
-        DbgPrint ("%s(): ",__FUNCTION__);                                       \\r
-        DbgPrint _msg_;                                                         \\r
+            cl_dbg_out ("***ERROR***  ");                                         \\r
+        cl_dbg_out ("%s(): ",__FUNCTION__);                                       \\r
+        cl_dbg_out _msg_;                                                         \\r
     }\r
 \r
 #else\r
index 2b1e8b5..a810798 100644 (file)
                int __lvl = _level_; \\r
                if (g.DebugPrintLevel >= (_level_) && \\r
                        (g.DebugPrintFlags & (_flag_))) { \\r
-                               DbgPrint ("~%d:[MLX4_HCA] %s() :", KeGetCurrentProcessorNumber(), __FUNCTION__); \\r
-                               if(__lvl == TRACE_LEVEL_ERROR) DbgPrint ("***ERROR***  "); \\r
-                               DbgPrint _msg_; \\r
+                               cl_dbg_out ("~%d:[MLX4_HCA] %s() :", KeGetCurrentProcessorNumber(), __FUNCTION__); \\r
+                               if(__lvl == TRACE_LEVEL_ERROR) cl_dbg_out ("***ERROR***  "); \\r
+                               cl_dbg_out _msg_; \\r
                } \\r
        }\r
 \r
index 7e6cba4..8c5aed4 100644 (file)
@@ -742,7 +742,7 @@ EvtDeviceQueryRemove(
        PFDO_DEVICE_DATA p_fdo = FdoGetData(Device);\r
        HCA_ENTER( HCA_DBG_PNP );\r
        if (atomic_read(&p_fdo->usecnt)) {\r
-               DbgPrint( "MLX4: Can't get unloaded. %d applications are still in work\n", p_fdo->usecnt);\r
+               cl_dbg_out( "MLX4: Can't get unloaded. %d applications are still in work\n", p_fdo->usecnt);\r
                return STATUS_UNSUCCESSFUL;\r
        }\r
        HCA_EXIT( HCA_DBG_PNP );\r
@@ -1180,7 +1180,7 @@ hca_add_device(
        }\r
 \r
        /* Inititalize the complib extension. */\r
-       cl_init_pnp_po_ext( p_dev_obj, pNextDevObj, pPdo, 0,\r
+       cl_init_pnp_po_ext( p_dev_obj, pNextDevObj, pPdo, CL_DBG_PNP | CL_DBG_ERROR,\r
                &vfptrHcaPnp, NULL );\r
 \r
        p_fdo->state = HCA_ADDED;\r
@@ -1961,7 +1961,7 @@ hca_query_remove(
 {\r
        PFDO_DEVICE_DATA p_fdo = (PFDO_DEVICE_DATA)p_dev_obj->DeviceExtension;\r
        if (atomic_read(&p_fdo->usecnt)) {\r
-               DbgPrint( "MTHCA: Can't get unloaded. %d applications are still in work\n", p_fdo->usecnt);\r
+               cl_dbg_out( "MTHCA: Can't get unloaded. %d applications are still in work\n", p_fdo->usecnt);\r
                p_irp->IoStatus.Status = STATUS_UNSUCCESSFUL;\r
                return cl_irp_complete( p_dev_obj, p_irp, p_action );\r
        }\r
index 1c89f17..bb12de9 100644 (file)
@@ -47,7 +47,7 @@
 
 #define BUG_ON(exp)            ASSERT(!(exp)) /* in Linux follows here panic() !*/ 
 #define snprintf               _snprintf
-#define printk                 DbgPrint
+#define printk                 cl_dbg_out
 #define KERN_ERR               "err:"
 #define KERN_WARNING   "warn:"
 #define KERN_DEBUG             "dbg:"
index 5a7d936..b10242c 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 #include "iobuf.h"
+#include "complib\cl_debug.h"
 
 ////////////////////////////////////////////////////////
 //
@@ -94,7 +95,7 @@ static inline void * kmalloc( SIZE_T bsize, gfp_t gfp_mask)
                        ptr = ExAllocatePoolWithTag( NonPagedPool, bsize, MT_TAG_HIGH );
                        break;
                default:
-                       DbgPrint("kmalloc: unsupported flag %d\n", gfp_mask);
+                       cl_dbg_out("kmalloc: unsupported flag %d\n", gfp_mask);
                        ptr = NULL;
                        break;
        }
index d9b21bc..051a590 100644 (file)
@@ -165,9 +165,9 @@ end:
                uint32_t __lvl = _level_; \\r
                if (g_mlx4_dbg_level >= (uint32_t)(__lvl) && \\r
                        (g_mlx4_dbg_flags & (_flag_))) { \\r
-                               DbgPrint ("~%d:[MLX4_BUS] %s() :", KeGetCurrentProcessorNumber(), __FUNCTION__); \\r
-                               if(__lvl == TRACE_LEVEL_ERROR) DbgPrint ("***ERROR***  "); \\r
-                               DbgPrint _msg_; \\r
+                               cl_dbg_out ("~%d:[MLX4_BUS] %s() :", KeGetCurrentProcessorNumber(), __FUNCTION__); \\r
+                               if(__lvl == TRACE_LEVEL_ERROR) cl_dbg_out ("***ERROR***  "); \\r
+                               cl_dbg_out _msg_; \\r
                } \\r
        }\r
 \r
index 9b6f1f6..fb330b8 100644 (file)
@@ -148,9 +148,9 @@ static void _build_str( const char *        format, ... )
                int __lvl = _level_; \\r
                if (g_mthca_dbg_level >= (_level_) && \\r
                        (g_mthca_dbg_flags & (_flag_))) { \\r
-                               DbgPrint ("~%d:[MTHCA] %s() :", KeGetCurrentProcessorNumber(), __FUNCTION__); \\r
-                               if(__lvl == TRACE_LEVEL_ERROR) DbgPrint ("***ERROR***  "); \\r
-                               DbgPrint _msg_; \\r
+                               cl_dbg_out ("~%d:[MTHCA] %s() :", KeGetCurrentProcessorNumber(), __FUNCTION__); \\r
+                               if(__lvl == TRACE_LEVEL_ERROR) cl_dbg_out ("***ERROR***  "); \\r
+                               cl_dbg_out _msg_; \\r
                } \\r
        }\r
 \r
index 0e01505..f1235fc 100644 (file)
@@ -250,7 +250,7 @@ hca_add_device(
        }\r
 \r
        /* Inititalize the complib extension. */\r
-       cl_init_pnp_po_ext( p_dev_obj, pNextDevObj, pPdo, 0,\r
+       cl_init_pnp_po_ext( p_dev_obj, pNextDevObj, pPdo, CL_DBG_PNP | CL_DBG_ERROR,\r
                &vfptrHcaPnp, NULL );\r
 \r
        p_ext->state = HCA_ADDED;\r
@@ -1181,7 +1181,7 @@ hca_query_remove(
 {\r
        hca_dev_ext_t*p_ext = (hca_dev_ext_t*)p_dev_obj->DeviceExtension;\r
        if (atomic_read(&p_ext->usecnt)) {\r
-               DbgPrint( "MTHCA: Can't get unloaded. %d applications are still in work\n", p_ext->usecnt);\r
+               cl_dbg_out( "MTHCA: Can't get unloaded. %d applications are still in work\n", p_ext->usecnt);\r
                p_irp->IoStatus.Status = STATUS_UNSUCCESSFUL;\r
                return cl_irp_complete( p_dev_obj, p_irp, p_action );\r
        }\r
index 29cd334..fdfcbea 100644 (file)
@@ -2,6 +2,7 @@
 #define MT_MEMORY_H
 
 #include "iba/ib_types.h"
+#include "complib\cl_debug.h"
 
 // ===========================================
 // CONSTANTS
@@ -60,7 +61,7 @@ static inline void * kmalloc( SIZE_T bsize, unsigned int gfp_mask)
                        ptr = ExAllocatePoolWithTag( NonPagedPool, bsize, MT_TAG_HIGH );
                        break;
                default:
-                       DbgPrint("kmalloc: unsupported flag %d\n", gfp_mask);
+                       cl_dbg_out("kmalloc: unsupported flag %d\n", gfp_mask);
                        ptr = NULL;
                        break;
        }
index efe9a85..ec8f70e 100644 (file)
@@ -52,7 +52,7 @@ typedef u64 io_addr_t;
 
 // assert
 #ifdef _DEBUG_
-#define MT_ASSERT( exp )       (void)(!(exp)?DbgPrint("Assertion Failed:" #exp "\n"),DbgBreakPoint(),FALSE:TRUE)
+#define MT_ASSERT( exp )       (void)(!(exp)?cl_dbg_out("Assertion Failed:" #exp "\n"),DbgBreakPoint(),FALSE:TRUE)
 #else
 #define MT_ASSERT( exp )
 #endif /* _DEBUG_ */
index 7a3d2f9..092ef93 100644 (file)
@@ -59,7 +59,8 @@
 \r
 \r
 #if defined( _DEBUG_ )\r
-#define cl_dbg_out     DbgPrint\r
+//#define cl_dbg_out DbgPrintHelper\r
+VOID cl_dbg_out( IN PCCH  Format, ...);\r
 #else\r
 #define cl_dbg_out     __noop\r
 #endif /* defined( _DEBUG_ ) */\r
index d1dec00..9370114 100644 (file)
@@ -160,13 +160,13 @@ extern uint32_t           g_ipoib_dbg_flags;
                        size_t _loop_;                                                                                                  \\r
                        for( _loop_ = 0; _loop_ < (len); ++_loop_ )                                             \\r
                        {                                                                                                                               \\r
-                               DbgPrint( "0x%.2X ", ((uint8_t*)(ptr))[_loop_] );                       \\r
+                               cl_dbg_out( "0x%.2X ", ((uint8_t*)(ptr))[_loop_] );                     \\r
                                if( (_loop_ + 1)% 16 == 0 )                                                                     \\r
-                                       DbgPrint("\n");                                                                                 \\r
+                                       cl_dbg_out("\n");                                                                                       \\r
                                else if( (_loop_ % 4 + 1) == 0 )                                                        \\r
-                                       DbgPrint("  ");                                                                                 \\r
+                                       cl_dbg_out("  ");                                                                                       \\r
                        }                                                                                                                               \\r
-                       DbgPrint("\n");                                                                                                 \\r
+                       cl_dbg_out("\n");                                                                                                       \\r
                }                                                                                                                                       \\r
        }\r
 \r