diff C3 C:/Documents and Settings/scsmith/Local Settings/Temp/bus_pnp.c-revBASE.svn000.tmp.c C:/Documents and Settings/scsmith/My Documents/openIB-windows/SVN/gen1/branches/WOF2-0/trunk/core/bus/kernel/bus_pnp.c
*** C:/Documents and Settings/scsmith/Local Settings/Temp/bus_pnp.c-revBASE.svn000.tmp.c	Mon Sep 15 10:40:37 2008
--- C:/Documents and Settings/scsmith/My Documents/openIB-windows/SVN/gen1/branches/WOF2-0/trunk/core/bus/kernel/bus_pnp.c	Mon Sep 15 10:40:49 2008
***************
*** 289,303 ****
  	}
  
  adxit:
! 	BUS_PRINT( BUS_DBG_PNP, ("%s(%s) exit status 0\n",
! 				__FUNCTION__, p_bfi->whoami) );
  
  	BUS_EXIT( BUS_DBG_PNP );
  	return STATUS_SUCCESS;
  
  bail:
! 	BUS_PRINT( BUS_DBG_PNP, ("%s(%s) exit status 0x%x\n",
! 								__FUNCTION__,p_bfi->whoami,status) );
  	ic = free_bfi(p_bfi);
  	/* if last Bus filter, then cleanup */
  	if ( ic == 0 )
--- 289,301 ----
  	}
  
  adxit:
! 	BUS_PRINT( BUS_DBG_PNP, ("%s exit status 0\n", p_bfi->whoami) );
  
  	BUS_EXIT( BUS_DBG_PNP );
  	return STATUS_SUCCESS;
  
  bail:
! 	BUS_PRINT( BUS_DBG_PNP, ("%s exit status 0x%x\n", p_bfi->whoami,status) );
  	ic = free_bfi(p_bfi);
  	/* if last Bus filter, then cleanup */
  	if ( ic == 0 )
***************
*** 379,385 ****
  	}
  
  	BUS_PRINT(BUS_DBG_PNP,
! 				("%s() %s exit %x\n",__FUNCTION__,p_bfi->whoami,status));
  	BUS_EXIT( BUS_DBG_PNP );
  
  	return status;
--- 377,383 ----
  	}
  
  	BUS_PRINT(BUS_DBG_PNP,
! 				("%s exit %x\n",p_bfi->whoami,status));
  	BUS_EXIT( BUS_DBG_PNP );
  
  	return status;
***************
*** 399,408 ****
  
  	p_ext = p_dev_obj->DeviceExtension;
  
  	BUS_PRINT( BUS_DBG_PNP,
! 		("%s() IRP_MN_QUERY_REMOVE_DEVICE %s @ %p refs CI %d AL %d\n", 
! 		__FUNCTION__, p_ext->cl_ext.vfptr_pnp_po->identity, p_ext,
! 		p_ext->n_ci_ifc_ref,p_ext->n_al_ifc_ref ) );
  
  	if( p_ext->n_ci_ifc_ref )
  	{
--- 397,409 ----
  
  	p_ext = p_dev_obj->DeviceExtension;
  
+ 	CL_ASSERT(p_ext->bus_filter);
  	BUS_PRINT( BUS_DBG_PNP,
! 		("IRP_MN_QUERY_REMOVE_DEVICE %s @ FDO %p refs(CI %d AL %d)\n"
! 		"   %s CA %I64x\n", 
! 		p_ext->cl_ext.vfptr_pnp_po->identity, p_ext, p_ext->n_ci_ifc_ref,
! 		p_ext->n_al_ifc_ref,
! 		p_ext->bus_filter->whoami, p_ext->bus_filter->ca_guid) );
  
  	if( p_ext->n_ci_ifc_ref )
  	{
***************
*** 473,480 ****
  	if ( p_ext->p_iou_mgr && p_bfi->p_iou_mgr )
  	 	cl_obj_destroy( &p_ext->p_iou_mgr->obj );
  
! 	BUS_PRINT( BUS_DBG_PNP, ("%s() Releasing BusFilter %s\n",
! 							__FUNCTION__, p_bfi->whoami ));
  	if (p_bfi) {
  		p_ext->bus_filter = NULL;
  		p_bfi->p_bus_ext = NULL;
--- 474,480 ----
  	if ( p_ext->p_iou_mgr && p_bfi->p_iou_mgr )
  	 	cl_obj_destroy( &p_ext->p_iou_mgr->obj );
  
! 	BUS_PRINT( BUS_DBG_PNP, ("Releasing BusFilter %s\n", p_bfi->whoami ));
  	if (p_bfi) {
  		p_ext->bus_filter = NULL;
  		p_bfi->p_bus_ext = NULL;
***************
*** 484,491 ****
  
  	/* if not last Buf Filter Instance, then exit, otherwise cleanup/shutdown */
  	if ( ic > 0 ) {
! 		BUS_PRINT( BUS_DBG_PNP, ("%s() %d remaining BusFilters\n",
! 						__FUNCTION__, ic ));
  		return;
  	}
  
--- 484,490 ----
  
  	/* if not last Buf Filter Instance, then exit, otherwise cleanup/shutdown */
  	if ( ic > 0 ) {
! 		BUS_PRINT( BUS_DBG_PNP, (" %d remaining BusFilters\n", ic ));
  		return;
  	}
  
***************
*** 563,569 ****
  	{
  		/* BFI has already been released */
  		*p_action = IrpComplete;
! 		BUS_TRACE_EXIT( BUS_DBG_PNP, ("%s() NULL BFI\n", __FUNCTION__) );
  		return STATUS_SUCCESS;
  	}
  
--- 562,568 ----
  	{
  		/* BFI has already been released */
  		*p_action = IrpComplete;
! 		BUS_TRACE_EXIT( BUS_DBG_PNP, ("NULL BFI\n") );
  		return STATUS_SUCCESS;
  	}
  
***************
*** 576,581 ****
--- 575,582 ----
  		 * relations yet.
  		 */
  		status = STATUS_SUCCESS;
+ 		BUS_PRINT(BUS_DBG_PNP, ("%s ca_guid %I64x\n",p_bfi->whoami,
+ 								p_bfi->ca_guid));
  	}
  	else
  	{
***************
*** 640,645 ****
--- 641,651 ----
  	cl_atomic_dec( &p_ext->n_al_ifc_ref );
  	ObDereferenceObject( p_dev_obj );
  
+ 	CL_ASSERT(p_ext->bus_filter);
+ 	BUS_PRINT( BUS_DBG_PNP, ("%s CA_guid %I64x al_ifc_ref %d\n",
+ 					p_ext->bus_filter->whoami, p_ext->bus_filter->ca_guid,
+ 					p_ext->n_al_ifc_ref) );
+ 
  	BUS_EXIT( BUS_DBG_PNP );
  }
  
***************
*** 674,679 ****
--- 680,690 ----
  	cl_atomic_dec( &p_ext->n_ci_ifc_ref );
  	ObDereferenceObject( p_dev_obj );
  
+ 	CL_ASSERT(p_ext->bus_filter);
+ 	BUS_PRINT( BUS_DBG_PNP, ("%s CA_guid %I64x ci_ifc_ref %d\n",
+ 						p_ext->bus_filter->whoami, p_ext->bus_filter->ca_guid,
+ 						p_ext->n_ci_ifc_ref) );
+ 
  	BUS_EXIT( BUS_DBG_PNP );
  }
  
***************
*** 837,846 ****
  	IN		const	net64_t						ca_guid,
  	IN				IRP* const					p_irp )
  {
- 	BUS_ENTER( BUS_DBG_PNP );
  	UNUSED_PARAM( ca_guid );
  	UNUSED_PARAM( p_irp );
  
  	/*
  	 * Now that ibbus is in the same device stack as the HCA driver, skip
  	 * returning relations here as ibbus has already done the deed.
--- 848,858 ----
  	IN		const	net64_t						ca_guid,
  	IN				IRP* const					p_irp )
  {
  	UNUSED_PARAM( ca_guid );
  	UNUSED_PARAM( p_irp );
  
+ 	BUS_ENTER( BUS_DBG_PNP );
+ 
  	/*
  	 * Now that ibbus is in the same device stack as the HCA driver, skip
  	 * returning relations here as ibbus has already done the deed.
***************
*** 1175,1185 ****
  
  	if( !n_devs )
  	{
! 		BUS_EXIT( BUS_DBG_PNP );
  		return STATUS_NO_SUCH_DEVICE;
  	}
  
! 	BUS_TRACE( BUS_DBG_PNP, ("Found %d PDOs .\n", n_devs ));
  
  	/* Add space for our child IOUs. */
  	status = cl_alloc_relations( p_irp, n_devs );
--- 1187,1197 ----
  
  	if( !n_devs )
  	{
! 		BUS_TRACE_EXIT( BUS_DBG_PNP, ("Found 0 PDOs ca_guid %I64x\n", ca_guid));
  		return STATUS_NO_SUCH_DEVICE;
  	}
  
! 	BUS_TRACE( BUS_DBG_PNP, ("Found %d PDOs ca_guid %I64x\n", n_devs, ca_guid));
  
  	/* Add space for our child IOUs. */
  	status = cl_alloc_relations( p_irp, n_devs );
***************
*** 1305,1315 ****
  	}
  	ExReleaseFastMutexUnsafe(&ControlMutex);
  
! 	BUS_PRINT( BUS_DBG_PNP,
! 				("%s() guid 0x%I64x -> bfi[%d] %p\n",
! 				__FUNCTION__, ca_guid,
! 				(matched ? (matched - bus_filters) : (-1)), matched ) );
! 
  	return matched;
  }
  
--- 1317,1329 ----
  	}
  	ExReleaseFastMutexUnsafe(&ControlMutex);
  
! #if DBG
! 	if ( !matched )
! 	{
! 		BUS_PRINT( BUS_DBG_PNP, ("No Match ca_guid 0x%I64x -> bfi[%d] %p\n",
! 									ca_guid, -1, matched ) );
! 	}
! #endif
  	return matched;
  }
  
