bus_pdo_ext_t *p_pdo_ext = NULL;\r
size_t n_devs = 0;\r
iou_mgr_t *gp_iou_mgr = p_bfi->p_iou_mgr;\r
- cl_qlist_t* p_pdo_list = &gp_iou_mgr->iou_list;\r
+ cl_qlist_t *p_pdo_list = &gp_iou_mgr->iou_list;\r
iou_pnp_ctx_t *p_ctx = p_pnp_rec->pnp_rec.context;\r
\r
BUS_ENTER( BUS_DBG_PNP );\r
p_pdo_ext->h_ca = acquire_ca( p_pnp_rec->ca_guid );\r
if( !p_pdo_ext->h_ca )\r
{\r
- BUS_TRACE( BUS_DBG_ERROR, ("acquire_ca failed to find CA by guid %I64x\n",\r
+ BUS_TRACE( BUS_DBG_ERROR,\r
+ ("acquire_ca failed to find CA by guid %I64x\n",\r
p_pnp_rec->ca_guid ) );\r
status = IB_INVALID_GUID;\r
}\r
\r
p_bfi = get_set_bfi_by_ca_guid( p_pnp_rec->ca_guid );\r
if ( !p_bfi ) {\r
- BUS_PRINT( BUS_DBG_PNP,("%s() NULL p_bfi? ca_guid 0x%I64x\n",\r
- __FUNCTION__, p_pnp_rec->ca_guid ) );\r
+ BUS_TRACE_EXIT( BUS_DBG_PNP,("%s() NULL p_bfi? ca_guid 0x%I64x\n",\r
+ __FUNCTION__, p_pnp_rec->ca_guid ) );\r
return IB_ERROR;\r
}\r
\r
p_ctx = cl_zalloc( sizeof(*p_ctx) );\r
if( !p_ctx )\r
{\r
- BUS_PRINT(BUS_DBG_PNP, ("%s(%s) ca_guid 0x%I64x iou_guid(%I64x) "\r
+ BUS_TRACE_EXIT(BUS_DBG_PNP, ("%s(%s) ca_guid %I64x iou_guid(%I64x) "\r
"BAD alloc for PNP context\n", __FUNCTION__,\r
p_bfi->whoami, p_bfi->ca_guid, p_pnp_rec->guid ));\r
\r
IoInvalidateDeviceRelations(\r
p_iou_ext->pdo.h_ca->obj.p_ci_ca->verbs.p_hca_dev, BusRelations );\r
\r
-#if 0 // XXX\r
- /* Invalidate removal relations for the bus driver. */\r
- IoInvalidateDeviceRelations(\r
- p_bfi->p_bus_ext->cl_ext.p_pdo, RemovalRelations );\r
-#endif\r
-\r
BUS_EXIT( BUS_DBG_PNP );\r
\r
return IB_SUCCESS;\r
\r
gp_iou_mgr = p_bfi->p_iou_mgr;\r
\r
- /* Within the Bus fabric instance is the port extension; see\r
+ /* Within the PNP record's context is the IOU extension; see\r
* was_hibernated().\r
*/\r
p_ext = p_ctx->p_pdo_ext;\r
cl_mutex_acquire( &gp_iou_mgr->pdo_mutex );\r
if ( !p_ext->h_ca )\r
{\r
- BUS_TRACE( BUS_DBG_PNP, ("%s() NULL h_ca? p_ext %p\n",\r
+ BUS_TRACE_EXIT( BUS_DBG_PNP, ("%s() NULL h_ca? p_ext %p\n",\r
__FUNCTION__, p_ext ) );\r
return;\r
}\r
p_ext->cl_ext.vfptr_pnp_po->identity, p_ext, p_ext->b_present,\r
p_ext->b_reported_missing ) );\r
\r
-#if 0 // XXX\r
- /* Invalidate removal relations for the bus driver. */\r
- IoInvalidateDeviceRelations( p_bfi->p_bus_ext->cl_ext.p_pdo,\r
- RemovalRelations );\r
-#endif\r
-\r
/* Invalidate bus relations for the HCA. */\r
IoInvalidateDeviceRelations(\r
p_ext->h_ca->obj.p_ci_ca->verbs.p_hca_dev, BusRelations );\r
cl_irp_skip,\r
cl_irp_skip,\r
cl_do_sync_pnp,\r
- fdo_query_bus_relations /*cl_irp_ignore*/ ,\r
+ fdo_query_bus_relations,\r
cl_irp_ignore,\r
- cl_irp_skip /*fdo_query_remove_relations now _bus_relations */ ,\r
+ cl_irp_skip,\r
cl_irp_ignore,\r
cl_irp_ignore,\r
cl_irp_ignore,\r
p_bfi = alloc_bfi( p_driver_obj, &ic );\r
if ( !p_bfi )\r
{\r
- BUS_PRINT( BUS_DBG_PNP,\r
+ BUS_TRACE_EXIT( BUS_DBG_PNP,\r
("%s() Err - Exceeded MAX_BUS_FILTERS(%d)\n",MAX_BUS_FILTERS));\r
return STATUS_UNSUCCESSFUL;\r
}\r
FILE_DEVICE_SECURE_OPEN, FALSE, &p_dev_obj );\r
if( !NT_SUCCESS(status) )\r
{\r
- BUS_TRACE_EXIT( BUS_DBG_ERROR, \r
+ BUS_PRINT( BUS_DBG_ERROR, \r
("Failed to create ControlDeviceObject, status %x.\n",status) );\r
goto bail;\r
}\r
if( !NT_SUCCESS(status) )\r
{\r
IoDeleteDevice( p_dev_obj );\r
- BUS_TRACE_EXIT( BUS_DBG_ERROR,\r
+ BUS_PRINT( BUS_DBG_ERROR,\r
("Failed to create symlink for dos name.\n") );\r
goto bail;\r
}\r
status = IoCreateDevice( p_driver_obj, sizeof(bus_fdo_ext_t),\r
NULL, FILE_DEVICE_BUS_EXTENDER,\r
FILE_DEVICE_SECURE_OPEN, FALSE, &p_dev_obj );\r
- }\r
-\r
- if( !NT_SUCCESS(status) )\r
- {\r
- BUS_TRACE_EXIT( BUS_DBG_ERROR, \r
- ("Failed to create bus root FDO device.\n") );\r
- goto bail;\r
+ if( !NT_SUCCESS(status) )\r
+ {\r
+ BUS_PRINT( BUS_DBG_ERROR, \r
+ ("Failed to create bus root FDO device.\n") );\r
+ goto bail;\r
+ }\r
}\r
\r
p_ext = p_dev_obj->DeviceExtension;\r
if( !p_next_do )\r
{\r
IoDeleteDevice( p_dev_obj );\r
- BUS_TRACE_EXIT( BUS_DBG_ERROR, ("IoAttachToDeviceStack failed.\n") );\r
+ BUS_PRINT( BUS_DBG_ERROR, ("IoAttachToDeviceStack failed.\n") );\r
status = STATUS_NO_SUCH_DEVICE;\r
goto bail;\r
}\r
{\r
IoDetachDevice( p_ext->cl_ext.p_next_do );\r
IoDeleteDevice( p_dev_obj );\r
- BUS_TRACE_EXIT( BUS_DBG_ERROR, \r
+ BUS_PRINT( BUS_DBG_ERROR, \r
("IoRegisterDeviceInterface for upper interface returned %08x\n",\r
status) );\r
status = STATUS_NO_SUCH_DEVICE;\r
{\r
IoDetachDevice( p_ext->cl_ext.p_next_do );\r
IoDeleteDevice( p_dev_obj );\r
- BUS_TRACE_EXIT( BUS_DBG_ERROR, \r
+ BUS_PRINT( BUS_DBG_ERROR, \r
("IoRegisterDeviceInterface for lower interface returned %08x\n",\r
status) );\r
status = STATUS_NO_SUCH_DEVICE;\r
return STATUS_SUCCESS;\r
\r
bail:\r
- BUS_PRINT( BUS_DBG_PNP, ("%s(%s) exit status %d\n",\r
+ BUS_PRINT( BUS_DBG_PNP, ("%s(%s) exit status 0x%x\n",\r
__FUNCTION__,p_bfi->whoami,status) );\r
ic = free_bfi(p_bfi);\r
/* if last Bus filter, then cleanup */\r
OUT cl_irp_action_t* const p_action )\r
{\r
bus_fdo_ext_t *p_ext;\r
+ bus_filter_t *p_bfi;\r
\r
BUS_ENTER( BUS_DBG_PNP );\r
\r
BUS_PRINT( BUS_DBG_PNP,\r
("%s() IRP_MN_QUERY_REMOVE_DEVICE %s @ %p refs CI %d AL %d\n", \r
__FUNCTION__, p_ext->cl_ext.vfptr_pnp_po->identity, p_ext,\r
- p_ext->n_ci_ifc_ref,p_ext->n_al_ifc_ref ) ); // XXX\r
+ p_ext->n_ci_ifc_ref,p_ext->n_al_ifc_ref ) );\r
\r
if( p_ext->n_ci_ifc_ref )\r
{\r
return STATUS_UNSUCCESSFUL;\r
}\r
\r
+ /* remove port & iou managers */ \r
+ p_bfi = p_ext->bus_filter;\r
+ CL_ASSERT( p_bfi );\r
+\r
+ //TODO: Fail outstanding I/O operations.\r
+\r
+ if ( p_ext->p_port_mgr && p_bfi->p_port_mgr )\r
+ cl_obj_destroy( &p_ext->p_port_mgr->obj );\r
+\r
+ if ( p_ext->p_iou_mgr && p_bfi->p_iou_mgr )\r
+ cl_obj_destroy( &p_ext->p_iou_mgr->obj );\r
+\r
+\r
*p_action = IrpSkip;\r
/* The FDO driver must set the status even when passing down. */\r
p_irp->IoStatus.Status = STATUS_SUCCESS;\r
+\r
BUS_EXIT( BUS_DBG_PNP );\r
return STATUS_SUCCESS;\r
}\r
p_ext = p_dev_obj->DeviceExtension;\r
ic = get_bfi_count();\r
\r
+ p_bfi = p_ext->bus_filter;\r
+ CL_ASSERT( p_bfi );\r
+\r
//TODO: Fail outstanding I/O operations.\r
\r
- if (p_ext->p_port_mgr)\r
+ if ( p_ext->p_port_mgr && p_bfi->p_port_mgr )\r
cl_obj_destroy( &p_ext->p_port_mgr->obj );\r
\r
- if (p_ext->p_iou_mgr)\r
+ if ( p_ext->p_iou_mgr && p_bfi->p_iou_mgr )\r
cl_obj_destroy( &p_ext->p_iou_mgr->obj );\r
\r
- p_bfi = p_ext->bus_filter;\r
- CL_ASSERT( p_bfi );\r
BUS_PRINT( BUS_DBG_PNP, ("%s() Releasing BusFilter %s\n",\r
__FUNCTION__, p_bfi->whoami ));\r
if (p_bfi) {\r
}\r
\r
\r
-#if 0 // XXX\r
-\r
static NTSTATUS\r
-fdo_query_removal_relations(\r
+fdo_query_bus_relations(\r
IN DEVICE_OBJECT* const p_dev_obj,\r
IN IRP* const p_irp, \r
OUT cl_irp_action_t* const p_action )\r
{\r
NTSTATUS status;\r
- UNUSED_PARAM( p_dev_obj );\r
+ bus_fdo_ext_t *p_ext;\r
+ bus_filter_t *p_bfi;\r
\r
BUS_ENTER( BUS_DBG_PNP );\r
\r
- status = port_mgr_get_bus_relations( 0, p_irp );\r
- if( status == STATUS_SUCCESS || \r
- status == STATUS_NO_SUCH_DEVICE )\r
- {\r
- status = iou_mgr_get_bus_relations( 0, p_irp );\r
- }\r
- if( status == STATUS_NO_SUCH_DEVICE )\r
- status = STATUS_SUCCESS;\r
+ p_ext = p_dev_obj->DeviceExtension;\r
\r
- switch( status )\r
+ if ( !p_ext->bus_filter )\r
{\r
- case STATUS_NO_SUCH_DEVICE:\r
- *p_action = IrpSkip;\r
- status = STATUS_SUCCESS;\r
- break;\r
-\r
- case STATUS_SUCCESS:\r
- *p_action = IrpPassDown;\r
- break;\r
-\r
- default:\r
+ /* BFI has already been released */\r
*p_action = IrpComplete;\r
- break;\r
+ BUS_TRACE_EXIT( BUS_DBG_PNP, ("%s() NULL BFI\n", __FUNCTION__) );\r
+ return STATUS_SUCCESS;\r
}\r
\r
- BUS_EXIT( BUS_DBG_PNP );\r
- return status;\r
-}\r
-#endif\r
-\r
-\r
-static NTSTATUS\r
-fdo_query_bus_relations(\r
- IN DEVICE_OBJECT* const p_dev_obj,\r
- IN IRP* const p_irp, \r
- OUT cl_irp_action_t* const p_action )\r
-{\r
- NTSTATUS status;\r
- bus_fdo_ext_t *p_ext;\r
- bus_filter_t *p_bfi;\r
-\r
- BUS_ENTER( BUS_DBG_PNP );\r
-\r
- p_ext = p_dev_obj->DeviceExtension;\r
- CL_ASSERT( p_ext->bus_filter );\r
p_bfi = p_ext->bus_filter;\r
CL_ASSERT( p_bfi->magic == BFI_MAGIC );\r
\r
- BUS_PRINT( BUS_DBG_PNP, ("%s(%s) ca_guid %I64x\n",\r
- __FUNCTION__,p_bfi->whoami, p_bfi->ca_guid) );\r
-\r
if ( p_bfi->ca_guid == 0ULL )\r
{\r
/* HCA not yet bound to a BFI slot (no PNP ADD event seen), no bus\r
cl_atomic_inc( &p_ext->n_al_ifc_ref );\r
ObReferenceObject( p_dev_obj );\r
\r
- BUS_PRINT( BUS_DBG_PNP, (" %p->n_al_ifc_ref %d\n",\r
- p_ext,p_ext->n_al_ifc_ref )); // XXX\r
BUS_EXIT( BUS_DBG_PNP );\r
}\r
\r
cl_atomic_dec( &p_ext->n_al_ifc_ref );\r
ObDereferenceObject( p_dev_obj );\r
\r
- BUS_PRINT( BUS_DBG_PNP, (" %p->n_al_ifc_ref %d\n",\r
- p_ext,p_ext->n_al_ifc_ref )); // XXX\r
BUS_EXIT( BUS_DBG_PNP );\r
}\r
\r
cl_atomic_inc( &p_ext->n_ci_ifc_ref );\r
ObReferenceObject( p_dev_obj );\r
\r
- BUS_PRINT( BUS_DBG_PNP, (" %p->n_ci_ifc_ref %d\n",\r
- p_ext,p_ext->n_ci_ifc_ref )); // XXX\r
BUS_EXIT( BUS_DBG_PNP );\r
}\r
\r
cl_atomic_dec( &p_ext->n_ci_ifc_ref );\r
ObDereferenceObject( p_dev_obj );\r
\r
- BUS_PRINT( BUS_DBG_PNP, (" %p->n_ci_ifc_ref %d\n",\r
- p_ext,p_ext->n_ci_ifc_ref )); // XXX\r
BUS_EXIT( BUS_DBG_PNP );\r
}\r
\r
IN const net64_t ca_guid,\r
IN IRP* const p_irp )\r
{\r
- NTSTATUS status;\r
-\r
BUS_ENTER( BUS_DBG_PNP );\r
+ UNUSED_PARAM( ca_guid );\r
+ UNUSED_PARAM( p_irp );\r
\r
- /* TODO: For IOUs, filter relations based on multi-HCA support. */\r
- status = port_mgr_get_bus_relations( ca_guid, p_irp );\r
- if( status == STATUS_SUCCESS || \r
- status == STATUS_NO_SUCH_DEVICE )\r
- {\r
- status = iou_mgr_get_bus_relations( ca_guid, p_irp );\r
- }\r
- if( status == STATUS_NO_SUCH_DEVICE )\r
- status = STATUS_SUCCESS;\r
+ /*\r
+ * Now that ibbus is in the same device stack as the HCA driver, skip\r
+ * returning relations here as ibbus has already done the deed.\r
+ * This interface remains to minimize changes to HCA drivers for now.\r
+ */\r
\r
BUS_EXIT( BUS_DBG_PNP );\r
- return status;\r
+ return STATUS_SUCCESS;\r
}\r
\r
\r
p_bfi->whoami, p_ext->cl_ext.vfptr_pnp_po->identity,\r
p_ext->cl_ext.p_self_do, p_ext ) );\r
\r
- BUS_TRACE( BUS_DBG_PNP,("%s(%s) h_ca->obj.state %s refs %d\n",\r
- __FUNCTION__, p_bfi->whoami,\r
- get_obj_state_str(p_ext->h_ca->obj.state),\r
- p_ext->h_ca->obj.ref_cnt)); // XXX\r
-\r
IoDeleteDevice( p_ext->cl_ext.p_self_do );\r
}\r
\r
bus_pdo_ext_t *p_pdo_ext = NULL;\r
size_t n_devs = 0;\r
port_mgr_t *gp_port_mgr = p_bfi->p_port_mgr;\r
- cl_qlist_t* p_pdo_list = &gp_port_mgr->port_list;\r
-\r
+ cl_qlist_t *p_pdo_list = &gp_port_mgr->port_list;\r
port_pnp_ctx_t *p_ctx = p_pnp_rec->pnp_rec.context;\r
\r
BUS_ENTER( BUS_DBG_PNP );\r
return status;\r
}\r
\r
+#if DBG\r
\r
void\r
dump_pnp_port_rec( ib_pnp_port_rec_t* pr )\r
BUS_PRINT( BUS_DBG_PNP, (" Desc %s\n",pr->desc ));\r
}\r
}\r
+#endif\r
\r
\r
ib_api_status_t\r
\r
p_bfi = get_set_bfi_by_ca_guid( p_pnp_rec->p_ca_attr->ca_guid );\r
if ( !p_bfi ) {\r
- BUS_PRINT( BUS_DBG_PNP,("%s() NULL p_bfi? ca_guid 0x%I64x\n",\r
+ BUS_TRACE_EXIT( BUS_DBG_PNP,("%s() NULL p_bfi? ca_guid 0x%I64x\n",\r
__FUNCTION__, p_pnp_rec->p_ca_attr->ca_guid ) );\r
return IB_ERROR;\r
}\r
p_ctx = cl_zalloc( sizeof(*p_ctx) );\r
if( !p_ctx )\r
{\r
- BUS_PRINT(BUS_DBG_PNP,\r
+ BUS_TRACE_EXIT(BUS_DBG_PNP,\r
("%s(%s) ca_guid %I64x port(%d) BAD alloc PNP context\n",\r
__FUNCTION__, p_bfi->whoami, p_bfi->ca_guid, \r
p_pnp_rec->p_port_attr->port_num));\r
IoInvalidateDeviceRelations(\r
p_port_ext->pdo.h_ca->obj.p_ci_ca->verbs.p_hca_dev, BusRelations );\r
\r
-#if 0 // XXX\r
- /* Invalidate removal relations for the bus driver. */\r
- IoInvalidateDeviceRelations( p_bfi->p_bus_ext->cl_ext.p_pdo,\r
- RemovalRelations );\r
-#endif\r
-\r
BUS_EXIT( BUS_DBG_PNP );\r
return IB_SUCCESS;\r
}\r
IoInvalidateDeviceRelations(\r
p_port_ext->pdo.h_ca->obj.p_ci_ca->verbs.p_hca_dev, BusRelations );\r
\r
-#if 0 // XXX\r
- /* Invalidate removal relations for the bus driver. */\r
- IoInvalidateDeviceRelations( p_bfi->p_bus_ext->cl_ext.p_pdo,\r
- RemovalRelations );\r
-#endif\r
-\r
BUS_EXIT( BUS_DBG_PNP );\r
return CL_SUCCESS;\r
}\r
\r
+\r
void\r
port_mgr_port_remove(\r
IN ib_pnp_port_rec_t* p_pnp_rec )\r
*/\r
p_ext = p_ctx->p_pdo_ext;\r
CL_ASSERT( p_ext );\r
-\r
CL_ASSERT(p_bfi == p_ext->p_parent_ext->bus_filter);\r
-#if DBG // XXX\r
- if (p_bfi != p_ext->p_parent_ext->bus_filter) {\r
- BUS_PRINT(BUS_DBG_PNP,\r
- ("%s() p_bfi(%p) != p_ext->bus_filter(%p) line %d file %s\n",\r
- __FUNCTION__,p_bfi,p_ext->p_parent_ext->bus_filter,\r
- __LINE__,__FILE__));\r
- }\r
-#endif\r
\r
/*\r
* Flag the port PDO as no longer being present. We have to wait until\r
*/\r
if ( !p_ext->h_ca )\r
{\r
- BUS_TRACE( BUS_DBG_PNP, ("%s() %s NULL h_ca? p_ext %p\n",\r
+ BUS_TRACE_EXIT( BUS_DBG_PNP, ("%s() %s NULL h_ca? p_ext %p\n",\r
__FUNCTION__, p_bfi->whoami, p_ext ) );\r
return;\r
}\r
p_ext->cl_ext.vfptr_pnp_po->identity, p_ext->cl_ext.p_self_do, p_ext,\r
p_ext->b_present, p_ext->b_reported_missing ) );\r
\r
-#if 0 // XXX\r
- /* Invalidate removal relations for the bus driver. */\r
- IoInvalidateDeviceRelations( p_bfi->p_bus_ext->cl_ext.p_pdo,\r
- RemovalRelations );\r
-#endif\r
-\r
/* Invalidate bus relations for the HCA. */\r
IoInvalidateDeviceRelations(\r
p_ext->h_ca->obj.p_ci_ca->verbs.p_hca_dev, BusRelations );\r
\r
p_ext = p_dev_obj->DeviceExtension;\r
\r
-BUS_PRINT( BUS_DBG_PNP, ("%s() %p->n_ifc_ref %d\n",\r
- __FUNCTION__,p_ext,p_ext->n_ifc_ref ));\r
-\r
*p_action = IrpComplete;\r
if( p_ext->n_ifc_ref )\r
{\r
p_irp->IoStatus.Status = STATUS_SUCCESS;\r
IoCompleteRequest( p_irp, IO_NO_INCREMENT );\r
\r
- BUS_PRINT/*XXX TRACE*/( BUS_DBG_PNP, ("Deleted device %s: PDO %p(=%p), ext %p\n",\r
+ BUS_TRACE( BUS_DBG_PNP, ("Deleted device %s: PDO %p(=%p), ext %p\n",\r
p_ext->pdo.cl_ext.vfptr_pnp_po->identity, p_ext->pdo.cl_ext.p_self_do,\r
p_dev_obj, p_ext ) );\r
+\r
IoDeleteDevice( p_dev_obj );\r
\r
*p_action = IrpDoNothing;\r
p_ipoib_data->port_guid = p_ext->port_guid;\r
p_ipoib_data->port_num = (uint8_t)p_ext->n_port;\r
\r
- BUS_TRACE_EXIT( BUS_DBG_PNP,\r
- (" %p->n_ifc_ref %d\n",p_ext,p_ext->n_ifc_ref) ); //XXX\r
-\r
BUS_EXIT( BUS_DBG_PNP );\r
return STATUS_SUCCESS;\r
}\r