[SRP] add SCSI errors to the logs
[mirror/winof/.git] / ulp / srp / kernel / srp_driver.c
index c6b5f0b..976ff1d 100644 (file)
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
  * SOFTWARE.\r
  *\r
- * $Id:$\r
+ * $Id$\r
  */\r
 \r
-/*\r
-       $Revision: 1.1 $\r
-*/\r
-\r
-\r
 \r
 #include "srp_data.h"\r
 #include "srp_data_path.h"\r
 #include "srp_debug.h"\r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "srp_driver.tmh"\r
+#endif\r
 #include "srp_descriptors.h"\r
 #include "srp_hba.h"\r
 #include "srp_session.h"\r
 \r
 #include <complib/cl_math.h>\r
 #include <complib/cl_mutex.h>\r
+#include <complib/cl_init.h>\r
 \r
 \r
 #define SCSI_MAXIMUM_TRANSFER_SIZE (1024 * 1024)\r
 \r
 BOOLEAN             g_srp_system_shutdown = FALSE;\r
 \r
-//uint32_t            g_srp_dbg_lvl = SRP_DBG_PNP | SRP_DBG_ERROR | SRP_DBG_WARN | SRP_DBG_VERBOSE | SRP_DBG_FUNC;\r
-uint32_t            g_srp_dbg_lvl = SRP_DBG_DEBUG | SRP_DBG_ERROR | SRP_DBG_WARN;\r
+\r
+uint32_t                       g_srp_dbg_level = TRACE_LEVEL_ERROR;\r
+uint32_t                       g_srp_dbg_flags = 0x0000ffff;\r
 \r
 char g_srb_function_name[][32] =\r
 {\r
@@ -135,6 +138,50 @@ char g_srb_status_name[][32] =
        "LINK_DOWN"               // 0x25\r
 };\r
 \r
+char g_srb_scsi_status_name[][32] =\r
+{\r
+       "SCSISTAT_GOOD",                                //0x00\r
+       "",                                                             //0x01\r
+       " SCSISTAT_CHECK_CONDITION",    //0x02\r
+       "",                                                             //0x03\r
+       " SCSISTAT_CONDITION_MET",              //0x04\r
+       "",                                                             //0x05\r
+       "",                                                             //0x06\r
+       "",                                                             //0x07\r
+       " SCSISTAT_BUSY",                               //0x08\r
+       "",                                                             //0x09\r
+       "",                                                             //0x0A\r
+       "",                                                             //0x0B\r
+       "",                                                             //0x0C\r
+       "",                                                             //0x0D\r
+       "",                                                             //0x0E\r
+       "",                                                             //0x0F\r
+       " SCSISTAT_INTERMEDIATE",               //0x10\r
+       "",                                                             //0x11\r
+       "",                                                             //0x12\r
+       "",                                                             //0x13\r
+       " SCSISTAT_INTERMEDIATE_COND_MET", //0x14\r
+       "",                                                             //0x15\r
+       "",                                                             //0x16\r
+       "",                                                             //0x17\r
+       " SCSISTAT_RESERVATION_CONFLICT",  //0x18\r
+       "",                                                             //0x19\r
+       "",                                                             // 0x1A\r
+       "",                                                             // 0x1B\r
+       "",                                                             // 0x1C\r
+       "",                                                             // 0x1D\r
+       "",                                                             // 0x1E\r
+       "",                                                             // 0x1F\r
+       "",                                                             //0x20\r
+       "",                                                             //0x21\r
+       " SCSISTAT_COMMAND_TERMINATED",    //0x22\r
+       "",                                                             //0x23\r
+       "",                                                             //0x24\r
+       "",                                                             //0x25\r
+       "",                                                             //0x26\r
+       "",                                                             //0x27\r
+       " SCSISTAT_QUEUE_FULL",                 //0x28\r
+};\r
 \r
 DRIVER_OBJECT       *gp_drv_obj;\r
 cl_obj_t            g_drv_obj;\r
@@ -146,6 +193,11 @@ PDRIVER_DISPATCH    gpfn_pnp;
 PDRIVER_ADD_DEVICE  gpfn_add_device;\r
 PDRIVER_UNLOAD      gpfn_unload;\r
 \r
+\r
+static NTSTATUS\r
+__read_registry(\r
+       IN                              UNICODE_STRING* const           p_Param_Path );\r
+\r
 NTSTATUS\r
 srp_add_device(\r
        IN              DRIVER_OBJECT               *p_drv_obj,\r
@@ -202,19 +254,108 @@ static void
 __srp_free(\r
        IN              cl_obj_t                    *p_obj );\r
 \r
+\r
+\r
+static NTSTATUS\r
+__read_registry(\r
+       IN                              UNICODE_STRING* const           p_registry_path )\r
+{\r
+       NTSTATUS                                        status;\r
+       /* Remember the terminating entry in the table below. */\r
+       RTL_QUERY_REGISTRY_TABLE        table[3];\r
+       UNICODE_STRING                          param_path;\r
+\r
+       SRP_ENTER( SRP_DBG_PNP );\r
+\r
+       RtlInitUnicodeString( &param_path, NULL );\r
+       param_path.MaximumLength = p_registry_path->Length + \r
+               sizeof(L"\\Parameters");\r
+       param_path.Buffer = cl_zalloc( param_path.MaximumLength );\r
+       if( !param_path.Buffer )\r
+       {\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR, \r
+                       ("Failed to allocate parameters path buffer.\n") );\r
+               return STATUS_INSUFFICIENT_RESOURCES;\r
+       }\r
+\r
+       RtlAppendUnicodeStringToString( &param_path, p_registry_path );\r
+       RtlAppendUnicodeToString( &param_path, L"\\Parameters" );\r
+\r
+       /*\r
+        * Clear the table.  This clears all the query callback pointers,\r
+        * and sets up the terminating table entry.\r
+        */\r
+       cl_memclr( table, sizeof(table) );\r
+\r
+       /* Setup the table entries. */\r
+       table[0].Flags = RTL_QUERY_REGISTRY_DIRECT;\r
+       table[0].Name = L"DebugLevel";\r
+       table[0].EntryContext = &g_srp_dbg_level;\r
+       table[0].DefaultType = REG_DWORD;\r
+       table[0].DefaultData = &g_srp_dbg_level;\r
+       table[0].DefaultLength = sizeof(ULONG);\r
+\r
+       table[1].Flags = RTL_QUERY_REGISTRY_DIRECT;\r
+       table[1].Name = L"DebugFlags";\r
+       table[1].EntryContext = &g_srp_dbg_flags;\r
+       table[1].DefaultType = REG_DWORD;\r
+       table[1].DefaultData = &g_srp_dbg_flags;\r
+       table[1].DefaultLength = sizeof(ULONG);\r
+       /* Have at it! */\r
+       status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE, \r
+               param_path.Buffer, table, NULL, NULL );\r
+\r
+#ifndef EVENT_TRACING\r
+       if( g_srp_dbg_flags & SRP_DBG_ERR )\r
+               g_srp_dbg_flags |= CL_DBG_ERROR;\r
+#endif\r
+\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
+               ("debug level %d debug flags 0x%.8x\n",\r
+               g_srp_dbg_level,\r
+               g_srp_dbg_flags) );\r
+\r
+       cl_free( param_path.Buffer );\r
+       SRP_EXIT( SRP_DBG_PNP );\r
+       return status;\r
+}\r
+\r
+\r
 ULONG\r
 DriverEntry(\r
        IN              DRIVER_OBJECT               *p_drv_obj,\r
        IN              UNICODE_STRING              *p_registry_path )\r
 {\r
-       ULONG                       status = (ULONG)STATUS_INSUFFICIENT_RESOURCES;\r
+       ULONG                       status;\r
        HW_INITIALIZATION_DATA      hw_data;\r
        cl_status_t                 cl_status;\r
 \r
        SRP_ENTER( SRP_DBG_PNP );\r
 \r
+#if defined(EVENT_TRACING)\r
+       WPP_INIT_TRACING( p_drv_obj, p_registry_path );\r
+#endif\r
+\r
+       status = CL_INIT;\r
+       if( !NT_SUCCESS(status) )\r
+       {\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                       ("cl_init returned %08X.\n", status) );\r
+               return status;\r
+       }\r
+\r
        gp_drv_obj = p_drv_obj;\r
 \r
+       /* Get the registry values. */\r
+       status = __read_registry( p_registry_path );\r
+       if( !NT_SUCCESS(status) )\r
+       {\r
+               CL_DEINIT;\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                       ("__read_registry returned %08x.\n", status) );\r
+               return status;\r
+       }\r
+\r
        cl_obj_construct( &g_drv_obj, SRP_OBJ_TYPE_DRV );\r
 \r
        KeInitializeMutex( &g_srp_pnp_mutex, 0 );\r
@@ -274,12 +415,19 @@ DriverEntry(
                }\r
                else\r
                {\r
-                       SRP_TRACE( SRP_DBG_ERROR,\r
+                       CL_DEINIT;\r
+                       SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                                ("StorPortInitialize returned 0x%x.\n", status) );\r
                }\r
        }\r
+       else\r
+       {\r
+               CL_DEINIT;\r
+               status = (ULONG)STATUS_INSUFFICIENT_RESOURCES;\r
+       }\r
 \r
-       SRP_TRACE_EXIT( SRP_DBG_PNP, ("DriverEntry returning status of 0x%x.\n", status) );\r
+       SRP_PRINT_EXIT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
+               ("DriverEntry returning status of 0x%x.\n", status) );\r
        return status;\r
 }\r
 \r
@@ -288,14 +436,22 @@ srp_unload(
        IN              DRIVER_OBJECT               *p_drv_obj )\r
 {\r
        SRP_ENTER( SRP_DBG_PNP );\r
+#if defined(EVENT_TRACING)\r
+       WPP_CLEANUP( p_drv_obj );\r
+#endif\r
 \r
        /* Kill all SRP objects. */\r
-       SRP_TRACE( SRP_DBG_DEBUG, ("Destroying all SRP objects.\n") );\r
-       SRP_TRACE( SRP_DBG_VERBOSE, ("Driver Object ref_cnt = %d\n", g_drv_obj.ref_cnt) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("Destroying all SRP objects.\n") );\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+               ("Driver Object ref_cnt = %d\n", g_drv_obj.ref_cnt) );\r
        cl_obj_destroy( &g_drv_obj );\r
 \r
+       CL_DEINIT;\r
+\r
        /* Invoke the port driver's unload routine. */\r
-       SRP_TRACE( SRP_DBG_DEBUG, ("Invoking the port driver's unload routine.\n") );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+               ("Invoking the port driver's unload routine.\n") );\r
        gpfn_unload( p_drv_obj );\r
 \r
        SRP_EXIT( SRP_DBG_PNP );\r
@@ -322,7 +478,7 @@ srp_add_device(
        SRP_ENTER( SRP_DBG_PNP );\r
 \r
        status = gpfn_add_device( p_drv_obj, p_pdo );\r
-       SRP_TRACE( SRP_DBG_PNP,\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
                ("srp_add_device status = 0x%x.\n", status) );\r
 \r
        SRP_EXIT( SRP_DBG_PNP );\r
@@ -342,7 +498,7 @@ srp_dispatch_pnp(
 \r
        p_stack = IoGetCurrentIrpStackLocation( p_irp );\r
        minor = p_stack->MinorFunction;\r
-       SRP_TRACE( SRP_DBG_PNP,\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
                ("Minor PNP Function = %d.\n", minor) );\r
 \r
        if( minor == IRP_MN_START_DEVICE )\r
@@ -352,12 +508,12 @@ srp_dispatch_pnp(
                wait_status = KeWaitForMutexObject(\r
                        &g_srp_pnp_mutex, Executive, KernelMode, FALSE, NULL );\r
 \r
-               SRP_TRACE( SRP_DBG_PNP,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
                        ("KeWaitForMutexObject status = 0x%x.\n", wait_status) );\r
                gp_self_do = p_dev_obj;\r
        }\r
        status = gpfn_pnp( p_dev_obj, p_irp );\r
-       SRP_TRACE( SRP_DBG_PNP,\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
                ("gpfn_pnp status = 0x%x.\n", status) );\r
 \r
        if( minor == IRP_MN_START_DEVICE )\r
@@ -365,7 +521,7 @@ srp_dispatch_pnp(
                LONG    release_status;\r
                gp_self_do = NULL;\r
                release_status = KeReleaseMutex( &g_srp_pnp_mutex, FALSE );\r
-               SRP_TRACE( SRP_DBG_PNP,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
                        ("KeReleaseMutex status = %d.\n", release_status) );\r
        }\r
 \r
@@ -396,7 +552,7 @@ srp_find_adapter(
 \r
        if( KeGetCurrentIrql() >= DISPATCH_LEVEL )\r
        {\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("Improper IRQL!\n") );\r
                return SP_RETURN_ERROR;\r
        }\r
@@ -406,13 +562,13 @@ srp_find_adapter(
        ib_status = srp_hba_create( &g_drv_obj, p_ext );\r
        if( ib_status != IB_SUCCESS )\r
        {\r
-               SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
+               SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
                        ("srp_hba_create returned %d\n", ib_status) );\r
                return SP_RETURN_ERROR;\r
        }\r
 \r
-       p_config->SrbExtensionSize            = p_ext->p_hba->max_srb_ext_sz;\r
-       CL_ASSERT( p_config->SrbExtensionSize >= sizeof( srp_send_descriptor_t ) );\r
+       p_config->SrbExtensionSize            = MAX( p_ext->p_hba->max_srb_ext_sz, sizeof( srp_send_descriptor_t ));\r
+       //CL_ASSERT( p_config->SrbExtensionSize >= sizeof( srp_send_descriptor_t ) );\r
 \r
        p_config->MaximumTransferLength       = SCSI_MAXIMUM_TRANSFER_SIZE;\r
        p_config->AlignmentMask               = 0; /* byte alignment */\r
@@ -431,7 +587,7 @@ srp_find_adapter(
 //     p_config->InitiatorBusId[0]           = 127;\r
 //     p_config->DeviceExtensionSize         = sizeof( srp_ext_t );\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE,\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                ("NumberOfPhysicalBreaks passed in = %d.\n", p_config->NumberOfPhysicalBreaks) );\r
 \r
        if ( p_config->NumberOfPhysicalBreaks == SP_UNINITIALIZED_VALUE )\r
@@ -443,7 +599,7 @@ srp_find_adapter(
                p_config->NumberOfPhysicalBreaks = MIN( p_ext->p_hba->max_sg - 1, p_config->NumberOfPhysicalBreaks );\r
        }\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE,\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
                ("NumberOfPhysicalBreaks set to = %d.\n", p_config->NumberOfPhysicalBreaks) );\r
 \r
        SRP_EXIT( SRP_DBG_PNP );\r
@@ -458,7 +614,8 @@ srp_init(
 \r
        UNUSED_PARAM( p_dev_ext );\r
 \r
-       SRP_TRACE( SRP_DBG_PNP, ("called at IRQL %d\n", KeGetCurrentIrql()) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
+               ("called at IRQL %d\n", KeGetCurrentIrql()) );\r
 \r
        SRP_EXIT( SRP_DBG_PNP );\r
        return TRUE;\r
@@ -469,10 +626,11 @@ srp_start_io(
        IN              PVOID                       p_dev_ext,\r
        IN              PSCSI_REQUEST_BLOCK         p_srb )\r
 {\r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
-       SRP_TRACE( SRP_DBG_VERBOSE,\r
-                          ("Starting I/O for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                          ("Starting I/O for Function = %s(0x%x), Path = 0x%x, "\r
+                          "Target = 0x%x, Lun = 0x%x\n",\r
                           g_srb_function_name[p_srb->Function],\r
                           p_srb->Function,\r
                           p_srb->PathId,\r
@@ -514,8 +672,10 @@ srp_start_io(
                                p_srp_session->p_shutdown_srb = p_srb;\r
                                cl_obj_destroy( &p_srp_session->obj );\r
 \r
-                               SRP_TRACE( SRP_DBG_DEBUG,\r
-                                                  ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+                               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                                                  ("Returning SrbStatus %s(0x%x) for "\r
+                                                  "Function = %s(0x%x), Path = 0x%x, "\r
+                                                  "Target = 0x%x, Lun = 0x%x\n",\r
                                                   g_srb_status_name[p_srb->SrbStatus],\r
                                                   p_srb->SrbStatus,\r
                                                   g_srb_function_name[p_srb->Function],\r
@@ -527,8 +687,10 @@ srp_start_io(
                        else\r
                        {\r
                                p_srb->SrbStatus = SRB_STATUS_SUCCESS;\r
-                               SRP_TRACE( SRP_DBG_DEBUG,\r
-                                                  ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+                               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                                                  ("Returning SrbStatus %s(0x%x) for "\r
+                                                  "Function = %s(0x%x), Path = 0x%x, "\r
+                                                  "Target = 0x%x, Lun = 0x%x\n",\r
                                                   g_srb_status_name[p_srb->SrbStatus],\r
                                                   p_srb->SrbStatus,\r
                                                   g_srb_function_name[p_srb->Function],\r
@@ -543,8 +705,10 @@ srp_start_io(
 \r
                case SRB_FUNCTION_FLUSH: /* Only receive this if CachesData is TRUE in PORT_CONFIGURATION_INFORMATION */\r
                        p_srb->SrbStatus = SRB_STATUS_SUCCESS;\r
-                       SRP_TRACE( SRP_DBG_DEBUG,\r
-                                          ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                                          ("Returning SrbStatus %s(0x%x) for "\r
+                                          "Function = %s(0x%x), Path = 0x%x, "\r
+                                          "Target = 0x%x, Lun = 0x%x\n",\r
                                           g_srb_status_name[p_srb->SrbStatus],\r
                                           p_srb->SrbStatus,\r
                                           g_srb_function_name[p_srb->Function],\r
@@ -577,8 +741,10 @@ srp_start_io(
 #endif\r
                default:\r
                        p_srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;\r
-                       SRP_TRACE( SRP_DBG_DEBUG,\r
-                                          ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+                       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
+                                          ("Returning SrbStatus %s(0x%x) for "\r
+                                          "Function = %s(0x%x), Path = 0x%x, "\r
+                                          "Target = 0x%x, Lun = 0x%x\n",\r
                                           g_srb_status_name[p_srb->SrbStatus],\r
                                           p_srb->SrbStatus,\r
                                           g_srb_function_name[p_srb->Function],\r
@@ -590,7 +756,7 @@ srp_start_io(
 \r
        }\r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 \r
        return ( TRUE );\r
 }\r
@@ -603,7 +769,8 @@ srp_isr(
 \r
        UNUSED_PARAM( p_dev_ext );\r
 \r
-       SRP_TRACE( SRP_DBG_PNP, ("called at IRQL %d\n", KeGetCurrentIrql()) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
+               ("called at IRQL %d\n", KeGetCurrentIrql()) );\r
 \r
        SRP_EXIT( SRP_DBG_PNP );\r
        return TRUE;\r
@@ -634,14 +801,15 @@ srp_adapter_ctrl(
 \r
        SRP_ENTER( SRP_DBG_PNP );\r
 \r
-       SRP_TRACE( SRP_DBG_PNP, ("called at IRQL %d\n", KeGetCurrentIrql()) );\r
+       SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_PNP,\r
+               ("called at IRQL %d\n", KeGetCurrentIrql()) );\r
 \r
        p_ext = (srp_ext_t*)p_dev_ext;\r
 \r
        switch( ctrl_type )\r
        {\r
        case ScsiQuerySupportedControlTypes:\r
-               SRP_TRACE( SRP_DBG_DEBUG | SRP_DBG_VERBOSE,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                        ("ScsiQuerySupportedControlTypes\n") );\r
                p_ctrl_list = (SCSI_SUPPORTED_CONTROL_TYPE_LIST*)params;\r
                p_ctrl_list->SupportedTypeList[ScsiQuerySupportedControlTypes] = TRUE;\r
@@ -652,28 +820,29 @@ srp_adapter_ctrl(
                break;\r
 \r
        case ScsiStopAdapter:\r
-               SRP_TRACE( SRP_DBG_DEBUG | SRP_DBG_VERBOSE,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                        ("ScsiStopAdapter\n") );\r
                if( p_ext->p_hba )\r
                {\r
-                       SRP_TRACE( SRP_DBG_VERBOSE, ("HBA Object ref_cnt = %d\n", p_ext->p_hba->obj.ref_cnt) );\r
+                       SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                               ("HBA Object ref_cnt = %d\n", p_ext->p_hba->obj.ref_cnt) );\r
                        cl_obj_destroy( &p_ext->p_hba->obj );\r
                        p_ext->p_hba = NULL;\r
                }\r
                break;\r
 \r
        case ScsiRestartAdapter:\r
-               SRP_TRACE( SRP_DBG_DEBUG | SRP_DBG_VERBOSE,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                        ("ScsiRestartAdapter\n") );\r
                break;\r
 \r
        case ScsiSetBootConfig:\r
-               SRP_TRACE( SRP_DBG_DEBUG | SRP_DBG_VERBOSE,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                        ("ScsiSetBootConfig\n") );\r
                break;\r
 \r
        case ScsiSetRunningConfig:\r
-               SRP_TRACE( SRP_DBG_DEBUG | SRP_DBG_VERBOSE,\r
+               SRP_PRINT( TRACE_LEVEL_INFORMATION, SRP_DBG_DEBUG,\r
                        ("ScsiSetRunningConfig\n") );\r
                break;\r
        }\r
@@ -687,15 +856,16 @@ srp_build_io(
        IN              PVOID                       p_dev_ext,\r
        IN              PSCSI_REQUEST_BLOCK         p_srb )\r
 {\r
-       SRP_ENTER( SRP_DBG_FUNC );\r
+       SRP_ENTER( SRP_DBG_DEBUG );\r
 \r
        if ( p_srb->Function == SRB_FUNCTION_EXECUTE_SCSI )\r
        {\r
 \r
                CL_ASSERT( p_srb->SrbExtension != NULL );\r
 \r
-               SRP_TRACE( SRP_DBG_VERBOSE,\r
-                                  ("Building I/O for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_DEBUG,\r
+                                  ("Building I/O for Function = %s(0x%x), "\r
+                                  "Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
                                   g_srb_function_name[p_srb->Function],\r
                                   p_srb->Function,\r
                                   p_srb->PathId,\r
@@ -704,8 +874,10 @@ srp_build_io(
 \r
                if ( srp_format_io_request( p_dev_ext, p_srb ) == FALSE )\r
                {\r
-                       SRP_TRACE_EXIT( SRP_DBG_ERROR,\r
-                                                       ("Returning SrbStatus %s(0x%x) for Function = %s(0x%x), Path = 0x%x, Target = 0x%x, Lun = 0x%x\n",\r
+                       SRP_PRINT_EXIT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
+                                                       ("Returning SrbStatus %s(0x%x) for "\r
+                                                       "Function = %s(0x%x), Path = 0x%x, "\r
+                                                       "Target = 0x%x, Lun = 0x%x\n",\r
                                                    g_srb_status_name[p_srb->SrbStatus],\r
                                                        p_srb->SrbStatus,\r
                                                        g_srb_function_name[p_srb->Function],\r
@@ -720,7 +892,7 @@ srp_build_io(
                }\r
        }\r
 \r
-       SRP_EXIT( SRP_DBG_FUNC );\r
+       SRP_EXIT( SRP_DBG_DEBUG );\r
 \r
        return ( TRUE );\r
 }\r