[IBAL] check the presence of the device while answering queries of the PnP
authorsleybo <sleybo@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 5 Apr 2007 13:37:17 +0000 (13:37 +0000)
committersleybo <sleybo@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 5 Apr 2007 13:37:17 +0000 (13:37 +0000)
base on patch from Alex Estrin [alex.estrin@qlogic.com]

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@627 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/bus/kernel/bus_iou_mgr.c
core/bus/kernel/bus_port_mgr.c

index 6e21b90..f27a220 100644 (file)
@@ -1370,6 +1370,14 @@ iou_query_interface(
                &GUID_BUS_INTERFACE_STANDARD ) )\r
        {\r
                p_ext = p_dev_obj->DeviceExtension;\r
+               if( !p_ext->h_ca ||\r
+                       !p_ext->b_present ||\r
+                       p_ext->b_reported_missing )\r
+               {\r
+                       return STATUS_NO_SUCH_DEVICE;\r
+               }\r
+\r
+\r
                status = cl_fwd_query_ifc(\r
                        p_ext->h_ca->obj.p_ci_ca->verbs.p_hca_dev, p_io_stack );\r
        }\r
index 60b4f7b..704e2eb 100644 (file)
@@ -953,10 +953,17 @@ port_query_device_id(
                OUT                             IRP* const                              p_irp )\r
 {\r
        WCHAR                           *p_string;\r
-\r
+       bus_port_ext_t          *p_ext;\r
+       \r
        BUS_ENTER( BUS_DBG_PNP );\r
 \r
-       UNUSED_PARAM( p_dev_obj );\r
+       \r
+       p_ext = (bus_port_ext_t*)p_dev_obj->DeviceExtension;\r
+       if( !p_ext->pdo.b_present )\r
+       {\r
+               BUS_TRACE_EXIT( BUS_DBG_ERROR, ("Device not present.\n") );\r
+               return STATUS_NO_SUCH_DEVICE;\r
+       }\r
 \r
        /* Device ID is "IBA\SID_<sid> where <sid> is the IPoIB Service ID. */\r
        p_string = ExAllocatePool( PagedPool, sizeof(IPOIB_DEVICE_ID) );\r
@@ -981,10 +988,17 @@ port_query_hardware_ids(
                OUT                             IRP* const                              p_irp )\r
 {\r
        WCHAR                           *p_string;\r
+       bus_port_ext_t          *p_ext;\r
 \r
        BUS_ENTER( BUS_DBG_PNP );\r
 \r
-       UNUSED_PARAM( p_dev_obj );\r
+\r
+       p_ext = (bus_port_ext_t*)p_dev_obj->DeviceExtension;\r
+       if( !p_ext->pdo.b_present )\r
+       {\r
+               BUS_TRACE_EXIT( BUS_DBG_ERROR, ("Device not present.\n") );\r
+               return STATUS_NO_SUCH_DEVICE;\r
+       }\r
 \r
        p_string = ExAllocatePool( PagedPool, sizeof(IPOIB_HARDWARE_ID) );\r
        if( !p_string )\r
@@ -1042,6 +1056,12 @@ port_query_unique_id(
 \r
        p_ext = p_dev_obj->DeviceExtension;\r
 \r
+       if( !p_ext->pdo.b_present )\r
+       {\r
+               BUS_TRACE_EXIT( BUS_DBG_ERROR, ("Device not present.\n") );\r
+               return STATUS_NO_SUCH_DEVICE;\r
+       }\r
+\r
        /* The instance ID is the port GUID. */\r
        p_string = ExAllocatePool( PagedPool, sizeof(WCHAR) * 17 );\r
        if( !p_string )\r
@@ -1075,10 +1095,17 @@ port_query_description(
                OUT                             IRP* const                              p_irp )\r
 {\r
        WCHAR                           *p_string;\r
-\r
+       bus_port_ext_t          *p_ext;\r
+       \r
        BUS_ENTER( BUS_DBG_PNP );\r
 \r
-       UNUSED_PARAM( p_dev_obj );\r
+       p_ext = p_dev_obj->DeviceExtension;\r
+       if( !p_ext->pdo.b_present )\r
+       {\r
+               BUS_TRACE_EXIT( BUS_DBG_ERROR, ("Device not present.\n") );\r
+               return STATUS_NO_SUCH_DEVICE;\r
+       }\r
+\r
 \r
        /* The instance ID is the port GUID. */\r
        p_string = ExAllocatePool( PagedPool, sizeof(IPOIB_DESCRIPTION) );\r
@@ -1339,6 +1366,13 @@ port_query_interface(
                &GUID_BUS_INTERFACE_STANDARD ) )\r
        {\r
                p_ext = p_dev_obj->DeviceExtension;\r
+               if( !p_ext->h_ca ||\r
+                       !p_ext->b_present ||\r
+                       p_ext->b_reported_missing )\r
+               {\r
+                       return STATUS_NO_SUCH_DEVICE;\r
+               }\r
+\r
                status = cl_fwd_query_ifc(\r
                        p_ext->h_ca->obj.p_ci_ca->verbs.p_hca_dev, p_io_stack );\r
        }\r