[ofw][patch] a fix to support debug print in Windows 2008

Leonid Keller leonid at mellanox.co.il
Sun Nov 23 10:37:38 PST 2008


[ALL] a fix to support debug print in Windows 2008. [mlnx: 3510]

Replace the use of DbgPrint with DbgPrintEx that is displayed on windows
2008 by default.

Index: core/complib/kernel/cl_driver.c
===================================================================
--- core/complib/kernel/cl_driver.c (revision 1765)
+++ core/complib/kernel/cl_driver.c (working copy)
@@ -31,6 +31,7 @@
 
 
 #include "complib/comp_lib.h"
+#include <stdarg.h>
 
 
 CL_EXPORT NTSTATUS
@@ -64,3 +65,16 @@
   return CL_ERROR;
  }
 }
+
+
+#if defined( _DEBUG_ )
+
+VOID cl_dbg_out( IN PCCH  format, ...)
+{
+ va_list  list;
+ va_start(list, format);
+ vDbgPrintEx(DPFLTR_IHVNETWORK_ID, DPFLTR_ERROR_LEVEL, format, list);
+ va_end(list);
+}
+#endif
+
Index: hw/mlx4/kernel/bus/core/l2w_debug.c
===================================================================
--- hw/mlx4/kernel/bus/core/l2w_debug.c (revision 1765)
+++ hw/mlx4/kernel/bus/core/l2w_debug.c (working copy)
@@ -134,7 +134,7 @@
  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 @@
  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 @@
  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 @@
  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: hw/mlx4/kernel/bus/drv/wpptrace.h
===================================================================
--- hw/mlx4/kernel/bus/drv/wpptrace.h (revision 1765)
+++ hw/mlx4/kernel/bus/drv/wpptrace.h (working copy)
@@ -91,9 +91,9 @@
     if (g_SdpDbgLevel >= (_level_) && (g_SdpDbgFlags & (_flag_)))
\
     {
\
         if(_level_ == TRACE_LEVEL_ERROR)
\
-            DbgPrint ("***ERROR***  ");
\
-        DbgPrint ("%s(): ",__FUNCTION__);
\
-        DbgPrint _msg_;
\
+            cl_dbg_out ("***ERROR***  ");
\
+        cl_dbg_out ("%s(): ",__FUNCTION__);
\
+        cl_dbg_out _msg_;
\
     }
 
 #else
Index: hw/mlx4/kernel/hca/debug.h
===================================================================
--- hw/mlx4/kernel/hca/debug.h (revision 1765)
+++ hw/mlx4/kernel/hca/debug.h (working copy)
@@ -108,9 +108,9 @@
   int __lvl = _level_; \
   if (g.DebugPrintLevel >= (_level_) && \
    (g.DebugPrintFlags & (_flag_))) { \
-    DbgPrint ("~%d:[MLX4_HCA] %s() :", KeGetCurrentProcessorNumber(),
__FUNCTION__); \
-    if(__lvl == TRACE_LEVEL_ERROR) DbgPrint ("***ERROR***  "); \
-    DbgPrint _msg_; \
+    cl_dbg_out ("~%d:[MLX4_HCA] %s() :", KeGetCurrentProcessorNumber(),
__FUNCTION__); \
+    if(__lvl == TRACE_LEVEL_ERROR) cl_dbg_out ("***ERROR***  "); \
+    cl_dbg_out _msg_; \
   } \
  }
 
Index: hw/mlx4/kernel/hca/drv.c
===================================================================
--- hw/mlx4/kernel/hca/drv.c (revision 1765)
+++ hw/mlx4/kernel/hca/drv.c (working copy)
@@ -742,7 +742,7 @@
  PFDO_DEVICE_DATA p_fdo = FdoGetData(Device);
  HCA_ENTER( HCA_DBG_PNP );
  if (atomic_read(&p_fdo->usecnt)) {
-  DbgPrint( "MLX4: Can't get unloaded. %d applications are still in
work\n", p_fdo->usecnt);
+  cl_dbg_out( "MLX4: Can't get unloaded. %d applications are still in
work\n", p_fdo->usecnt);
   return STATUS_UNSUCCESSFUL;
  }
  HCA_EXIT( HCA_DBG_PNP );
@@ -1961,7 +1961,7 @@
 {
  PFDO_DEVICE_DATA p_fdo = (PFDO_DEVICE_DATA)p_dev_obj->DeviceExtension;
  if (atomic_read(&p_fdo->usecnt)) {
-  DbgPrint( "MTHCA: Can't get unloaded. %d applications are still in
work\n", p_fdo->usecnt);
+  cl_dbg_out( "MTHCA: Can't get unloaded. %d applications are still in
work\n", p_fdo->usecnt);
   p_irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
   return cl_irp_complete( p_dev_obj, p_irp, p_action );
  }
Index: hw/mlx4/kernel/inc/l2w.h
===================================================================
--- hw/mlx4/kernel/inc/l2w.h (revision 1765)
+++ hw/mlx4/kernel/inc/l2w.h (working copy)
@@ -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: hw/mlx4/kernel/inc/l2w_memory.h
===================================================================
--- hw/mlx4/kernel/inc/l2w_memory.h (revision 1765)
+++ hw/mlx4/kernel/inc/l2w_memory.h (working copy)
@@ -1,6 +1,7 @@
 #pragma once
 
 #include "iobuf.h"
+#include "complib\cl_debug.h"
 
 ////////////////////////////////////////////////////////
 //
@@ -94,7 +95,7 @@
    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: hw/mlx4/kernel/inc/mlx4_debug.h
===================================================================
--- hw/mlx4/kernel/inc/mlx4_debug.h (revision 1765)
+++ hw/mlx4/kernel/inc/mlx4_debug.h (working copy)
@@ -165,9 +165,9 @@
   uint32_t __lvl = _level_; \
   if (g_mlx4_dbg_level >= (uint32_t)(__lvl) && \
    (g_mlx4_dbg_flags & (_flag_))) { \
-    DbgPrint ("~%d:[MLX4_BUS] %s() :", KeGetCurrentProcessorNumber(),
__FUNCTION__); \
-    if(__lvl == TRACE_LEVEL_ERROR) DbgPrint ("***ERROR***  "); \
-    DbgPrint _msg_; \
+    cl_dbg_out ("~%d:[MLX4_BUS] %s() :", KeGetCurrentProcessorNumber(),
__FUNCTION__); \
+    if(__lvl == TRACE_LEVEL_ERROR) cl_dbg_out ("***ERROR***  "); \
+    cl_dbg_out _msg_; \
   } \
  }
 
Index: hw/mthca/kernel/hca_debug.h
===================================================================
--- hw/mthca/kernel/hca_debug.h (revision 1765)
+++ hw/mthca/kernel/hca_debug.h (working copy)
@@ -148,9 +148,9 @@
   int __lvl = _level_; \
   if (g_mthca_dbg_level >= (_level_) && \
    (g_mthca_dbg_flags & (_flag_))) { \
-    DbgPrint ("~%d:[MTHCA] %s() :", KeGetCurrentProcessorNumber(),
__FUNCTION__); \
-    if(__lvl == TRACE_LEVEL_ERROR) DbgPrint ("***ERROR***  "); \
-    DbgPrint _msg_; \
+    cl_dbg_out ("~%d:[MTHCA] %s() :", KeGetCurrentProcessorNumber(),
__FUNCTION__); \
+    if(__lvl == TRACE_LEVEL_ERROR) cl_dbg_out ("***ERROR***  "); \
+    cl_dbg_out _msg_; \
   } \
  }
 
Index: hw/mthca/kernel/hca_pnp.c
===================================================================
--- hw/mthca/kernel/hca_pnp.c (revision 1765)
+++ hw/mthca/kernel/hca_pnp.c (working copy)
@@ -1181,7 +1181,7 @@
 {
  hca_dev_ext_t*p_ext = (hca_dev_ext_t*)p_dev_obj->DeviceExtension;
  if (atomic_read(&p_ext->usecnt)) {
-  DbgPrint( "MTHCA: Can't get unloaded. %d applications are still in
work\n", p_ext->usecnt);
+  cl_dbg_out( "MTHCA: Can't get unloaded. %d applications are still in
work\n", p_ext->usecnt);
   p_irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
   return cl_irp_complete( p_dev_obj, p_irp, p_action );
  }
Index: hw/mthca/kernel/mt_memory.h
===================================================================
--- hw/mthca/kernel/mt_memory.h (revision 1765)
+++ hw/mthca/kernel/mt_memory.h (working copy)
@@ -2,6 +2,7 @@
 #define MT_MEMORY_H
 
 #include "iba/ib_types.h"
+#include "complib\cl_debug.h"
 
 // ===========================================
 // CONSTANTS
@@ -60,7 +61,7 @@
    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: hw/mthca/kernel/mt_types.h
===================================================================
--- hw/mthca/kernel/mt_types.h (revision 1765)
+++ hw/mthca/kernel/mt_types.h (working copy)
@@ -52,7 +52,7 @@
 
 // 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: inc/kernel/complib/cl_debug_osd.h
===================================================================
--- inc/kernel/complib/cl_debug_osd.h (revision 1765)
+++ inc/kernel/complib/cl_debug_osd.h (working copy)
@@ -59,7 +59,8 @@
 
 
 #if defined( _DEBUG_ )
-#define cl_dbg_out DbgPrint
+//#define cl_dbg_out DbgPrintHelper
+VOID cl_dbg_out( IN PCCH  Format, ...);
 #else
 #define cl_dbg_out __noop
 #endif /* defined( _DEBUG_ ) */
Index: ulp/ipoib/kernel/ipoib_debug.h
===================================================================
--- ulp/ipoib/kernel/ipoib_debug.h (revision 1765)
+++ ulp/ipoib/kernel/ipoib_debug.h (working copy)
@@ -160,13 +160,13 @@
    size_t _loop_;             \
    for( _loop_ = 0; _loop_ < (len); ++_loop_ )      \
    {                \
-    DbgPrint( "0x%.2X ", ((uint8_t*)(ptr))[_loop_] );   \
+    cl_dbg_out( "0x%.2X ", ((uint8_t*)(ptr))[_loop_] );   \
     if( (_loop_ + 1)% 16 == 0 )         \
-     DbgPrint("\n");           \
+     cl_dbg_out("\n");           \
     else if( (_loop_ % 4 + 1) == 0 )       \
-     DbgPrint("  ");           \
+     cl_dbg_out("  ");           \
    }                \
-   DbgPrint("\n");             \
+   cl_dbg_out("\n");             \
   }                 \
  }
 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20081123/45adcb91/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug_print.patch
Type: application/octet-stream
Size: 10213 bytes
Desc: debug_print.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20081123/45adcb91/attachment.obj>


More information about the ofw mailing list