[IBAL, HCA] Provide HCA driver with UM CA handle for resource
[mirror/winof/.git] / hw / mt23108 / kernel / hca_driver.c
index 1f35d22..519251c 100644 (file)
@@ -26,7 +26,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
  * SOFTWARE.\r
  *\r
- * $Id:$\r
+ * $Id$\r
  */\r
 \r
 \r
@@ -42,6 +42,7 @@
 #include "MdCard.h"\r
 #pragma warning( pop )\r
 #include <iba/ib_ci_ifc.h>\r
+#include <complib/cl_init.h>\r
 \r
 \r
 /*\r
@@ -267,9 +268,18 @@ DriverEntry(
 \r
        HCA_ENTER( HCA_DBG_DEV );\r
 \r
+       status = CL_INIT;\r
+       if( !NT_SUCCESS(status) )\r
+       {\r
+               HCA_TRACE_EXIT( HCA_DBG_ERROR,\r
+                       ("cl_init returned %08X.\n", status) );\r
+               return status;\r
+       }\r
+\r
        status = __read_registry( p_registry_path );\r
        if( !NT_SUCCESS( status ) )\r
        {\r
+               CL_DEINIT;\r
                HCA_TRACE_EXIT( HCA_DBG_ERROR,\r
                        ("__read_registry_path returned 0x%X.\n", status) );\r
                return status;\r
@@ -279,6 +289,7 @@ DriverEntry(
        cl_status = mlnx_hobs_init();\r
        if( cl_status != CL_SUCCESS )\r
        {\r
+               CL_DEINIT;\r
                HCA_TRACE_EXIT( HCA_DBG_ERROR,\r
                        ("mlnx_hobs_init returned %s.\n", cl_status_text[cl_status]) );\r
                return cl_to_ntstatus( cl_status );\r
@@ -353,6 +364,8 @@ hca_drv_unload(
 \r
        UNUSED_PARAM( p_driver_obj );\r
 \r
+       CL_DEINIT;\r
+\r
        HCA_EXIT( HCA_DBG_DEV );\r
 }\r
 \r
@@ -1297,7 +1310,10 @@ fw_access_ctrl(
        UNREFERENCED_PARAMETER(p_umv_buf);\r
 \r
        status =  STATUS_SUCCESS;\r
-       p_hob = (mlnx_hob_t *)(const void *)p_context;\r
+       if( p_umv_buf )\r
+               p_hob = ((mlnx_um_ca_t* __ptr64)p_context)->hob_p;\r
+       else\r
+               p_hob = (mlnx_hob_t *)(const void *)p_context;\r
 \r
        p_dev_obj = (DEVICE_OBJECT *)(const void *)p_hob->p_dev_obj;\r
        p_ci =  p_ci_op;\r