[Openib-windows] [PATCH] IOU driver WPP support

Yossi Leybovich sleybo at mellanox.co.il
Tue Aug 29 08:02:38 PDT 2006


Fab 
 
This patch include WPP support for the IOU driver
Also cosmetics changes for the AL WPP
 
I compiled it on check /free x86 and free x64 bit environments.
 
10x
Yossi 
 
Singed-off-by: Yossi Leybovich (sleybo at mellanox.co.il)
 
Index: al/al_debug.h
===================================================================
--- al/al_debug.h (revision 1631)
+++ al/al_debug.h (working copy)
@@ -122,9 +122,9 @@
 // begin_wpp config
 // AL_ENTER( FLAG );
 // AL_EXIT( FLAG );
-// USEPREFIX(AL_PRINT, "%!STDPREFIX! %!FUNC!() :");
-// USESUFFIX(AL_ENTER, " %!FUNC!():[");
-// USESUFFIX(AL_EXIT, " %!FUNC!():]");
+// USEPREFIX(AL_PRINT, "%!STDPREFIX! [AL] :%!FUNC!() :");
+// USESUFFIX(AL_ENTER, " [AL] :%!FUNC!():[");
+// USESUFFIX(AL_EXIT, " [AL] :%!FUNC!():]");
 // end_wpp
 
 
Index: bus/kernel/ib_bus.inf
===================================================================
--- bus/kernel/ib_bus.inf (revision 1631)
+++ bus/kernel/ib_bus.inf (working copy)
@@ -172,7 +172,8 @@
 HKR,"Parameters","IocPollInterval",%REG_DWORD_NO_CLOBBER%,30000
 
 [Iou.ParamsReg]
-HKR,"Parameters","DebugFlags",%REG_DWORD%,0x80000000
+HKR,"Parameters","DebugLevel",%REG_DWORD%,2
+HKR,"Parameters","DebugFlags",%REG_DWORD%,0x00ffffff
 
 [Strings]
 OPENIB = "OpenIB Alliance"
Index: iou/kernel/iou_driver.c
===================================================================
--- iou/kernel/iou_driver.c (revision 1631)
+++ iou/kernel/iou_driver.c (working copy)
@@ -36,15 +36,23 @@
 
 #include <complib/cl_types.h>
 #include "iou_driver.h"
+#if defined(EVENT_TRACING)
+#ifdef offsetof
+#undef offsetof
+#endif
+#include "iou_driver.tmh"
+#endif
 #include "iou_pnp.h"
 #include <complib/cl_init.h>
 
 
 iou_globals_t iou_globals = {
- IOU_DBG_ERROR,
+ 0,
  NULL
 };
 
+uint32_t  g_iou_dbg_level = TRACE_LEVEL_ERROR;
+uint32_t  g_iou_dbg_flags = 0x00000fff;
 
 static NTSTATUS
 __read_registry(
@@ -106,7 +114,7 @@
 {
  NTSTATUS     status;
  /* Remember the terminating entry in the table below. */
- RTL_QUERY_REGISTRY_TABLE table[2];
+ RTL_QUERY_REGISTRY_TABLE table[3];
  UNICODE_STRING    param_path;
 
  IOU_ENTER( IOU_DBG_DRV );
@@ -117,7 +125,7 @@
  param_path.Buffer = cl_zalloc( param_path.MaximumLength );
  if( !param_path.Buffer )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, 
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , 
    ("Failed to allocate parameters path buffer.\n") );
   return STATUS_INSUFFICIENT_RESOURCES;
  }
@@ -134,11 +142,17 @@
  /* Setup the table entries. */
  table[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
  table[0].Name = L"DebugFlags";
- table[0].EntryContext = &iou_globals.dbg_lvl;
+ table[0].EntryContext = &g_iou_dbg_level;
  table[0].DefaultType = REG_DWORD;
- table[0].DefaultData = &iou_globals.dbg_lvl;
+ table[0].DefaultData = &g_iou_dbg_level;
  table[0].DefaultLength = sizeof(ULONG);
 
+ table[1].Flags = RTL_QUERY_REGISTRY_DIRECT;
+ table[1].Name = L"DebugFlags";
+ table[1].EntryContext = &g_iou_dbg_flags;
+ table[1].DefaultType = REG_DWORD;
+ table[1].DefaultData = &g_iou_dbg_flags;
+ table[1].DefaultLength = sizeof(ULONG);
  /* Have at it! */
  status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE, 
   param_path.Buffer, table, NULL, NULL );
@@ -185,6 +199,9 @@
  IN    DRIVER_OBJECT    *p_driver_obj )
 {
  IOU_ENTER( IOU_DBG_DRV );
+#if defined(EVENT_TRACING)
+ WPP_CLEANUP(p_drv_obj);
+#endif
 
  UNUSED_PARAM( p_driver_obj );
 
@@ -202,11 +219,13 @@
  NTSTATUS   status;
 
  IOU_ENTER( IOU_DBG_DRV );
-
+#if defined(EVENT_TRACING)
+ WPP_INIT_TRACING(p_drv_obj, p_registry_path);
+#endif
  status = CL_INIT;
  if( !NT_SUCCESS(status) )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("cl_init returned %08X.\n", status) );
   return status;
  }
@@ -219,7 +238,7 @@
  if( !NT_SUCCESS(status) )
  {
   CL_DEINIT;
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, 
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , 
    ("__read_registry returned %08x.\n", status) );
   return status;
  }
Index: iou/kernel/iou_driver.h
===================================================================
--- iou/kernel/iou_driver.h (revision 1631)
+++ iou/kernel/iou_driver.h (working copy)
@@ -54,34 +54,112 @@
 #endif
 #include <ntstrsafe.h>
 
+extern uint32_t  g_iou_dbg_level;
+extern uint32_t  g_iou_dbg_flags;
 
+#if defined(EVENT_TRACING)
+//
+// Software Tracing Definitions 
+//
+
+#define WPP_CONTROL_GUIDS \
+
WPP_DEFINE_CONTROL_GUID(IOUCtlGuid,(A0090FEF,01BB,4617,AF1E,FD02FD5B24ED
),  \
+ WPP_DEFINE_BIT( IOU_DBG_ERROR) \
+ WPP_DEFINE_BIT( IOU_DBG_DRV) \
+ WPP_DEFINE_BIT( IOU_DBG_PNP) \
+ WPP_DEFINE_BIT( IOU_DBG_POWER) \
+ WPP_DEFINE_BIT( IOU_DBG_PORT) \
+ WPP_DEFINE_BIT( IOU_DBG_IOU))
+
+
+
+#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) (WPP_LEVEL_ENABLED(flags)
&& WPP_CONTROL(WPP_BIT_ ## flags).Level  >= lvl)
+#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) WPP_LEVEL_LOGGER(flags)
+#define WPP_FLAG_ENABLED(flags)(WPP_LEVEL_ENABLED(flags) &&
WPP_CONTROL(WPP_BIT_ ## flags).Level  >= TRACE_LEVEL_VERBOSE)
+#define WPP_FLAG_LOGGER(flags) WPP_LEVEL_LOGGER(flags)
+
+
+// begin_wpp config
+// IOU_ENTER(FLAG);
+// IOU_EXIT(FLAG);
+// USEPREFIX(IOU_PRINT, "%!STDPREFIX! [IOU] :%!FUNC!() :");
+// USESUFFIX(IOU_ENTER, " [IOU] :%!FUNC!():[");
+// USESUFFIX(IOU_EXIT, " [IOU] :%!FUNC!():]");
+// end_wpp
+
+
+#else
+
+
+#include <evntrace.h>
+
 /*
- * Main header for IB Bus driver.
+ * Debug macros
  */
 
-#define IOU_ENTER( lvl )   \
- CL_ENTER( lvl, iou_globals.dbg_lvl )
 
-#define IOU_EXIT( lvl )    \
- CL_EXIT( lvl, iou_globals.dbg_lvl )
+#define IOU_DBG_ERR  (1 << 0)
+#define IOU_DBG_DRV  (1 << 1)
+#define IOU_DBG_PNP  (1 << 2)
+#define IOU_DBG_POWER (1 << 3)
+#define IOU_DBG_PORT (1 << 4)
+#define IOU_DBG_IOU  (1 << 5)
 
-#define IOU_TRACE( lvl, msg )  \
- CL_TRACE( lvl, iou_globals.dbg_lvl, msg )
+#define IOU_DBG_ERROR (CL_DBG_ERROR | IOU_DBG_ERR)
+#define IOU_DBG_ALL CL_DBG_ALL
 
-#define IOU_TRACE_EXIT( lvl, msg ) \
- CL_TRACE_EXIT( lvl, iou_globals.dbg_lvl, msg )
+#if DBG
 
-#define IOU_PRINT( lvl, msg )  \
- CL_PRINT( lvl, iou_globals.dbl_lvl, msg )
+// assignment of _level_ is need to to overcome warning C4127
+#define IOU_PRINT(_level_,_flag_,_msg_) \
+ { \
+  if( g_iou_dbg_level >= (_level_) ) \
+   CL_TRACE( _flag_, g_iou_dbg_flags, _msg_ ); \
+ }
 
-#define IOU_DBG_ERROR CL_DBG_ERROR
-#define IOU_DBG_DRV  (1 << 0)
-#define IOU_DBG_PNP  (1 << 1)
-#define IOU_DBG_POWER (1 << 2)
-#define IOU_DBG_PORT (1 << 3)
-#define IOU_DBG_IOU  (1 << 4)
+#define IOU_PRINT_EXIT(_level_,_flag_,_msg_) \
+ { \
+  if( g_iou_dbg_level >= (_level_) ) \
+   CL_TRACE( _flag_, g_iou_dbg_flags, _msg_ );\
+  IOU_EXIT(_flag_);\
+ }
 
+#define IOU_ENTER(_flag_) \
+ { \
+  if( g_iou_dbg_level >= TRACE_LEVEL_VERBOSE ) \
+   CL_ENTER( _flag_, g_iou_dbg_flags ); \
+ }
+
+#define IOU_EXIT(_flag_)\
+ { \
+  if( g_iou_dbg_level >= TRACE_LEVEL_VERBOSE ) \
+   CL_EXIT( _flag_, g_iou_dbg_flags ); \
+ }
+
+
+#else
+
+#define IOU_PRINT(lvl, flags, msg)
+
+#define IOU_PRINT_EXIT(_level_,_flag_,_msg_)
+
+#define IOU_ENTER(_flag_)
+
+#define IOU_EXIT(_flag_)
+
+
+#endif
+
+
+#endif //EVENT_TRACING
+
 /*
+ * Main header for IB Bus driver.
+ */
+
+
+
+/*
  * ALLOC_PRAGMA sections:
  * PAGE
  *  Default pagable code.  Won't be locked in memory.
Index: iou/kernel/iou_ioc_mgr.c
===================================================================
--- iou/kernel/iou_ioc_mgr.c (revision 1631)
+++ iou/kernel/iou_ioc_mgr.c (working copy)
@@ -34,6 +34,13 @@
 #include <iba/ib_types.h>
 #include <complib/cl_async_proc.h>
 #include <complib/cl_bus_ifc.h>
+#include "iou_driver.h"
+#if defined(EVENT_TRACING)
+#ifdef offsetof
+#undef offsetof
+#endif
+#include "iou_ioc_mgr.tmh"
+#endif
 #include "iou_pnp.h"
 #include "iou_ioc_mgr.h"
 #include <initguid.h>
@@ -282,7 +289,7 @@
  if( cl_status != CL_SUCCESS )
  {
   free_ioc_mgr( &p_ioc_mgr->obj );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("cl_mutex_init returned %s.\n", cl_status_text[cl_status]) );
   return IB_ERROR;
  }
@@ -293,7 +300,7 @@
  if( cl_status != CL_SUCCESS )
  {
   free_ioc_mgr( &p_ioc_mgr->obj );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("cl_obj_init returned %s.\n", cl_status_text[cl_status]) );
   return IB_ERROR;
  }
@@ -302,7 +309,7 @@
  if( status != IB_SUCCESS )
  {
   cl_obj_destroy( &p_ioc_mgr->obj );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, ("ib_reg_pnp returned %s.\n",
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , ("ib_reg_pnp
returned %s.\n",
    p_ioc_mgr->ifc.get_err_str(status)) );
   return status;
  }
@@ -318,7 +325,7 @@
  if( status != IB_SUCCESS )
  {
   cl_obj_destroy( &p_ioc_mgr->obj );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, ("ib_reg_pnp returned %s.\n",
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , ("ib_reg_pnp
returned %s.\n",
    p_ioc_mgr->ifc.get_err_str(status)) );
   return status;
  }
@@ -453,7 +460,7 @@
  if( !n_devs )
  {
   cl_mutex_release( &p_ioc_mgr->pdo_mutex );
-  IOU_TRACE_EXIT( IOU_DBG_PNP, ("No child PDOs.\n") );
+  IOU_PRINT_EXIT(TRACE_LEVEL_INFORMATION ,IOU_DBG_PNP ,("No child
PDOs.\n") );
   return STATUS_NO_SUCH_DEVICE;
  }
 
@@ -462,7 +469,7 @@
  if( !NT_SUCCESS( status ) )
  {
   cl_mutex_release( &p_ioc_mgr->pdo_mutex );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("cl_alloc_relations returned %08x.\n", status) );
   return status;
  }
@@ -496,7 +503,7 @@
   p_pnp_rec->info.chassis_slot != p_ioc_mgr->info.slot||
   p_pnp_rec->info.iou_guid != p_ioc_mgr->info.guid )
  {
-  IOU_TRACE_EXIT( IOU_DBG_PNP, ("IOC not in this IOU.\n") );
+  IOU_PRINT_EXIT(TRACE_LEVEL_INFORMATION ,IOU_DBG_PNP ,("IOC not in
this IOU.\n") );
   return IB_NOT_DONE;
  }
 
@@ -510,7 +517,7 @@
   FALSE, &p_pdo );
  if( !NT_SUCCESS( status ) )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("IoCreateDevice returned %08x.\n", status) );
   return IB_ERROR;
  }
@@ -624,7 +631,7 @@
 
  /* Remove this PDO from its list. */
  cl_mutex_acquire( &p_ioc_mgr->pdo_mutex );
- IOU_TRACE( IOU_DBG_PNP, ("Removing IOC from list.\n") );
+ IOU_PRINT( TRACE_LEVEL_INFORMATION ,IOU_DBG_PNP, ("Removing IOC from
list.\n") );
  cl_qlist_remove_item( &p_ioc_mgr->ioc_list, &p_ext->pdo.list_item );
  cl_mutex_release( &p_ioc_mgr->pdo_mutex );
  po_state.DeviceState = PowerDeviceD3;
@@ -654,7 +661,7 @@
   cl_set_pnp_state( &p_ext->pdo.cl_ext, NotStarted );
   /* Don't delete the device.  It may simply be disabled. */
   *p_action = IrpComplete;
-  IOU_TRACE_EXIT( IOU_DBG_PNP, ("Device still present.\n") );
+  IOU_PRINT_EXIT(TRACE_LEVEL_INFORMATION ,IOU_DBG_PNP ,("Device still
present.\n") );
   return STATUS_SUCCESS;
  }
 
@@ -663,7 +670,7 @@
   /* Reset the state to RemovePending.  Complib set it to Deleted. */
   cl_rollback_pnp_state( &p_ext->pdo.cl_ext );
   *p_action = IrpComplete;
-  IOU_TRACE_EXIT( IOU_DBG_PNP, ("Device not reported missing yet.\n")
);
+  IOU_PRINT_EXIT(TRACE_LEVEL_INFORMATION ,IOU_DBG_PNP ,("Device not
reported missing yet.\n") );
   return STATUS_SUCCESS;
  }
 
@@ -773,7 +780,7 @@
  status = cl_alloc_relations( p_irp, 1 );
  if( !NT_SUCCESS( status ) )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("cl_alloc_relations returned 0x%08x.\n", status) );
   return status;
  }
@@ -803,14 +810,14 @@
  p_ext = (ioc_ext_t*)p_dev_obj->DeviceExtension;
  if( !p_ext->pdo.b_present )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, ("Device not present.\n") );
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , ("Device not
present.\n") );
   return STATUS_NO_SUCH_DEVICE;
  }
 
  p_string = ExAllocatePool( PagedPool, IOC_DEV_ID_SIZE );
  if( !p_string )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to allocate device ID buffer (%d bytes).\n",
    IOC_DEV_ID_SIZE) );
   return STATUS_INSUFFICIENT_RESOURCES;
@@ -826,7 +833,7 @@
  if( !NT_SUCCESS( status ) )
  {
   ExFreePool( p_string );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to format device ID string.\n") );
   return status;
  }
@@ -854,14 +861,14 @@
  p_ext = (ioc_ext_t*)p_dev_obj->DeviceExtension;
  if( !p_ext->pdo.b_present )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, ("Device not present.\n") );
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , ("Device not
present.\n") );
   return STATUS_NO_SUCH_DEVICE;
  }
 
  p_string = ExAllocatePool( PagedPool, IOC_HW_ID_SIZE );
  if( !p_string )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to allocate hardware ID buffer (%d bytes).\n",
    IOC_HW_ID_SIZE) );
   return STATUS_INSUFFICIENT_RESOURCES;
@@ -882,7 +889,7 @@
  if( !NT_SUCCESS( status ) )
  {
   ExFreePool( p_string );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to format hardware ID string.\n") );
   return status;
  }
@@ -894,7 +901,7 @@
  if( !NT_SUCCESS( status ) )
  {
   ExFreePool( p_string );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to format hardware ID string.\n") );
   return status;
  }
@@ -906,7 +913,7 @@
  if( !NT_SUCCESS( status ) )
  {
   ExFreePool( p_string );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to format hardware ID string.\n") );
   return status;
  }
@@ -918,7 +925,7 @@
  if( !NT_SUCCESS( status ) )
  {
   ExFreePool( p_string );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to format hardware ID string.\n") );
   return status;
  }
@@ -945,14 +952,14 @@
  p_ext = (ioc_ext_t*)p_dev_obj->DeviceExtension;
  if( !p_ext->pdo.b_present )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, ("Device not present.\n") );
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , ("Device not
present.\n") );
   return STATUS_NO_SUCH_DEVICE;
  }
 
  p_string = ExAllocatePool( PagedPool, IOC_COMPAT_ID_SIZE );
  if( !p_string )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to allocate compatible ID buffer (%d bytes).\n",
    IOC_HW_ID_SIZE) );
   return STATUS_INSUFFICIENT_RESOURCES;
@@ -971,7 +978,7 @@
  if( !NT_SUCCESS( status ) )
  {
   ExFreePool( p_string );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to format device ID string.\n") );
   return status;
  }
@@ -983,7 +990,7 @@
  if( !NT_SUCCESS( status ) )
  {
   ExFreePool( p_string );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to format device ID string.\n") );
   return status;
  }
@@ -1008,7 +1015,7 @@
  p_ext = p_dev_obj->DeviceExtension;
  if( !p_ext->pdo.b_present )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, ("Device not present.\n") );
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , ("Device not
present.\n") );
   return STATUS_NO_SUCH_DEVICE;
  }
 
@@ -1016,7 +1023,7 @@
  p_string = ExAllocatePool( PagedPool, sizeof(WCHAR) * 17 );
  if( !p_string )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to allocate instance ID buffer (%d bytes).\n",
    sizeof(WCHAR) * 17) );
   return STATUS_NO_MEMORY;
@@ -1028,7 +1035,7 @@
  {
   CL_ASSERT( NT_SUCCESS( status ) );
   ExFreePool( p_string );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("RtlStringCchPrintfW returned %08x.\n", status) );
   return status;
  }
@@ -1054,7 +1061,7 @@
  p_ext = p_dev_obj->DeviceExtension;
  if( !p_ext->pdo.b_present )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, ("Device not present.\n") );
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , ("Device not
present.\n") );
   return STATUS_NO_SUCH_DEVICE;
  }
 
@@ -1062,7 +1069,7 @@
   PagedPool, sizeof(WCHAR) * sizeof(p_ext->info.profile.id_string) );
  if( !p_string )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to allocate device description buffer (%d bytes).\n",
    sizeof(WCHAR) * sizeof(p_ext->info.profile.id_string)) );
   return STATUS_INSUFFICIENT_RESOURCES;
@@ -1092,7 +1099,7 @@
  {
   CL_ASSERT( NT_SUCCESS( status ) );
   ExFreePool( p_string );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("RtlStringCchPrintfW returned %08x.\n", status) );
   return status;
  }
@@ -1117,14 +1124,14 @@
  p_ext = (ioc_ext_t*)p_dev_obj->DeviceExtension;
  if( !p_ext->pdo.b_present )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, ("Device not present.\n") );
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , ("Device not
present.\n") );
   return STATUS_NO_SUCH_DEVICE;
  }
 
  p_string = ExAllocatePool( PagedPool, IOC_LOCATION_SIZE );
  if( !p_string )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to allocate location buffer (%d bytes).\n",
    IOC_LOCATION_SIZE) );
   return STATUS_INSUFFICIENT_RESOURCES;
@@ -1146,7 +1153,7 @@
  if( !NT_SUCCESS( status ) )
  {
   ExFreePool( p_string );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to format device ID string.\n") );
   return status;
  }
@@ -1171,7 +1178,7 @@
  p_ext = (ioc_ext_t*)p_dev_obj->DeviceExtension;
  if( !p_ext->pdo.b_present )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, ("Device not present.\n") );
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , ("Device not
present.\n") );
   return STATUS_NO_SUCH_DEVICE;
  }
 
@@ -1180,7 +1187,7 @@
  p_iou_info = ExAllocatePool( PagedPool, sizeof(PNP_BUS_INFORMATION) );
  if( !p_iou_info )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to allocate PNP_BUS_INFORMATION (%d bytes).\n",
    sizeof(PNP_BUS_INFORMATION)) );
   return STATUS_INSUFFICIENT_RESOURCES;
@@ -1254,14 +1261,14 @@
  /* Compare requested GUID with our supported interface GUIDs. */
  if( IsEqualGUID( p_guid, &GUID_BUS_INTERFACE_STANDARD ) )
  {
-  IOU_TRACE_EXIT( IOU_DBG_PNP, ("BUS_INTERFACE_STANDARD\n") );
+  IOU_PRINT_EXIT(TRACE_LEVEL_INFORMATION ,IOU_DBG_PNP
,("BUS_INTERFACE_STANDARD\n") );
   return cl_fwd_query_ifc(
    p_ext->pdo.p_parent_ext->cl_ext.p_self_do, p_io_stack );
  }
 
  if( !IsEqualGUID( p_guid, &GUID_IB_AL_INTERFACE ) )
  {
-  IOU_TRACE_EXIT( IOU_DBG_PNP, ("Unsupported interface: \n\t"
+  IOU_PRINT_EXIT(TRACE_LEVEL_INFORMATION ,IOU_DBG_PNP ,("Unsupported
interface: \n\t"
    "0x%08x, 0x%04x, 0x%04x, 0x%02x, 0x%02x, 0x%02x,"
    "0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x.\n",
    p_guid->Data1, p_guid->Data2, p_guid->Data3,
@@ -1276,14 +1283,14 @@
   p_ext->pdo.p_parent_ext->cl_ext.p_self_do, p_io_stack );
  if( !NT_SUCCESS( status ) )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to forward interface query: %08X\n", status) );
   return status;
  }
 
  if( !p_io_stack->Parameters.QueryInterface.InterfaceSpecificData )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, ("No interface specific data!\n") );
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , ("No interface
specific data!\n") );
   return status;
  }
 
@@ -1296,7 +1303,7 @@
   p_ifc_data->version != IOC_INTERFACE_DATA_VERSION )
  {
   p_ifc->wdm.InterfaceDereference( p_ifc->wdm.Context );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, ("Unsupported interface data: \n\t"
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , ("Unsupported
interface data: \n\t"
    "0x%08x, 0x%04x, 0x%04x, 0x%02x, 0x%02x, 0x%02x,"
    "0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x.\n",
    p_guid->Data1, p_guid->Data2, p_guid->Data3,
@@ -1311,7 +1318,7 @@
  if( p_ifc_data->size != sizeof(ioc_ifc_data_t) )
  {
   p_ifc->wdm.InterfaceDereference( p_ifc->wdm.Context );
-  IOU_TRACE_EXIT( IOU_DBG_PNP,
+  IOU_PRINT_EXIT(TRACE_LEVEL_INFORMATION ,IOU_DBG_PNP ,
    ("Buffer too small (%d given, %d required).\n",
    p_ifc_data->size,
    sizeof(ioc_ifc_data_t)) );
Index: iou/kernel/iou_pnp.c
===================================================================
--- iou/kernel/iou_pnp.c (revision 1631)
+++ iou/kernel/iou_pnp.c (working copy)
@@ -34,8 +34,13 @@
 /*
  * Implemenation of all PnP functionality for FDO (power policy
owners).
  */
-
-
+#include "iou_driver.h"
+#if defined(EVENT_TRACING)
+#ifdef offsetof
+#undef offsetof
+#endif
+#include "iou_pnp.tmh"
+#endif
 #include "iou_pnp.h"
 #include "iou_ioc_mgr.h"
 #include <complib/cl_memory.h>
@@ -161,7 +166,7 @@
   FILE_DEVICE_SECURE_OPEN, FALSE, &p_dev_obj );
  if( !NT_SUCCESS(status) )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, 
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , 
    ("Failed to create bus root FDO device.\n") );
   return status;
  }
@@ -174,7 +179,7 @@
  if( !p_next_do )
  {
   IoDeleteDevice( p_dev_obj );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, ("IoAttachToDeviceStack failed.\n") );
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
("IoAttachToDeviceStack failed.\n") );
   return STATUS_NO_SUCH_DEVICE;
  }
 
@@ -246,7 +251,7 @@
  status = cl_do_sync_pnp( p_dev_obj, p_irp, p_action );
  if( !NT_SUCCESS( status ) )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, 
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , 
    ("Lower drivers failed IRP_MN_START_DEVICE.\n") );
   return status;
  }
@@ -254,7 +259,7 @@
  status = __get_iou_ifc( p_ext );
  if( !NT_SUCCESS( status ) )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR,
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR ,
    ("Failed to get IOU interface.\n") );
   return status;
  }
@@ -263,7 +268,7 @@
  ib_status = ioc_mgr_init( &p_ext->ioc_mgr );
  if( ib_status != IB_SUCCESS )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, ("ioc_mgr_init returned %s.\n",
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , ("ioc_mgr_init
returned %s.\n",
    p_ext->ioc_mgr.ifc.get_err_str(ib_status)) );
   return STATUS_UNSUCCESSFUL;
  }
@@ -334,7 +339,7 @@
 
  if( !NT_SUCCESS( status ) )
  {
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, 
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , 
    ("cl_do_sync_pnp returned %08x.\n", status) );
   return status;
  }
@@ -499,7 +504,7 @@
  {
   PoStartNextPowerIrp( p_irp );
   IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );
-  IOU_TRACE_EXIT( IOU_DBG_ERROR, 
+  IOU_PRINT_EXIT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR , 
    ("IRP_MN_SET_POWER for system failed by lower driver with %08x.\n",
    p_irp->IoStatus.Status) );
   return STATUS_SUCCESS;
@@ -522,7 +527,7 @@
   p_irp->IoStatus.Status = status;
   IoCompleteRequest( p_irp, IO_NO_INCREMENT );
   IoReleaseRemoveLock( &p_ext->cl_ext.remove_lock, p_irp );
-  IOU_TRACE( IOU_DBG_ERROR,
+  IOU_PRINT(TRACE_LEVEL_ERROR ,IOU_DBG_ERROR,
    ("PoRequestPowerIrp returned %08x.\n", status) );
  }
 
Index: iou/kernel/SOURCES
===================================================================
--- iou/kernel/SOURCES (revision 1631)
+++ iou/kernel/SOURCES (working copy)
@@ -2,6 +2,13 @@
 TARGETPATH=..\..\..\bin\kernel\obj$(BUILD_ALT_DIR)
 TARGETTYPE=DRIVER
 
+!if $(FREEBUILD)
+ENABLE_EVENT_TRACING=1
+!else
+#ENABLE_EVENT_TRACING=1
+!endif
+
+
 SOURCES= ibiou.rc  \
  iou_driver.c  \
  iou_pnp.c   \
@@ -9,8 +16,9 @@
 
 INCLUDES=..\..\..\inc;..\..\..\inc\kernel;
 
-C_DEFINES=$(C_DEFINES) -DDRIVER -DDEPRECATE_DDK_FUNCTIONS -DNEED_CL_OBJ
+C_DEFINES=$(C_DEFINES) -DDRIVER -DDEPRECATE_DDK_FUNCTIONS -DNEED_CL_OBJ
-DWPP_OLDCC
 
+
 TARGETLIBS= \
  $(TARGETPATH)\*\complib.lib
  
@@ -22,4 +30,15 @@
 TARGETLIBS= $(TARGETLIBS) $(DDK_LIB_PATH)\ntstrsafe.lib
 !endif
 
+!IFDEF ENABLE_EVENT_TRACING
+
+C_DEFINES = $(C_DEFINES) -DEVENT_TRACING
+
+RUN_WPP = $(SOURCES) -km -ext: .c .h .C .H \
+  -scan:iou_driver.h \
+ -func:IOU_PRINT(LEVEL,FLAGS,(MSG,...)) \
+ -func:IOU_PRINT_EXIT(LEVEL,FLAGS,(MSG,...)) 
+
+!ENDIF
+
 MSC_WARNING_LEVEL= /W4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: iou_wpp.patch
Type: application/octet-stream
Size: 24377 bytes
Desc: iou_wpp.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20060829/77a7db28/attachment.obj>


More information about the ofw mailing list