[MTHCA] 1. feature: the driver will now enter a simulated "livefish" mode in case...
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 14 Aug 2006 18:19:51 +0000 (18:19 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 14 Aug 2006 18:19:51 +0000 (18:19 +0000)
2. improve printing to Event Log.
3. cleaning: remove a duplicate structure

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

hw/mthca/kernel/hca_pnp.c
hw/mthca/kernel/hca_verbs.c
hw/mthca/kernel/mthca_main.c
hw/mthca/kernel/mthca_provider.c
hw/mthca/mx_abi.h

index 792e1e0..f6753cb 100644 (file)
@@ -890,14 +890,21 @@ hca_start(
        {\r
                struct mthca_dev *mdev = p_ext->hca.mdev;\r
                HCA_PRINT_EV(TRACE_LEVEL_INFORMATION ,HCA_DBG_LOW ,\r
-                       ("Ven %d Dev %d Hw %x Fw %d.%d.%d Drv %s (%s) Flg %s%s%s\n", \r
+                       ("Ven %x Dev %d Hw %x Fw %d.%d.%d Drv %s (%s)", \r
                        (unsigned)p_ext->hcaConfig.VendorID, (unsigned)p_ext->hcaConfig.DeviceID,\r
                        p_ext->hca.hw_ver,      (int) (mdev->fw_ver >> 32),\r
                        (int) (mdev->fw_ver >> 16) & 0xffff, (int) (mdev->fw_ver & 0xffff),\r
-                       DRV_VERSION, DRV_RELDATE,\r
-                       (mdev->mthca_flags & MTHCA_FLAG_MEMFREE) ? "M:" : "",\r
-                       (mdev->mthca_flags & MTHCA_FLAG_PCIE) ? "E:" : "",\r
-                       (mdev->mthca_flags & MTHCA_FLAG_DDR_HIDDEN) ? "H" : ""\r
+                       DRV_VERSION, DRV_RELDATE\r
+                       ));\r
+               HCA_PRINT_EV(TRACE_LEVEL_INFORMATION ,HCA_DBG_LOW ,\r
+                       ("Flags %s%s%s%s%s%s%s\n", \r
+                       (mdev->mthca_flags & MTHCA_FLAG_LIVEFISH) ? "Flash Recovery Mode:" : "",\r
+                       (mdev->mthca_flags & MTHCA_FLAG_MEMFREE) ? "MemFree:" : "",\r
+                       (mdev->mthca_flags & MTHCA_FLAG_NO_LAM) ? "NoLam:" : "",\r
+                       (mdev->mthca_flags & MTHCA_FLAG_FMR) ? "Fmr:" : "",\r
+                       (mdev->mthca_flags & MTHCA_FLAG_SRQ) ? "Srq:" : "",\r
+                       (mdev->mthca_flags & MTHCA_FLAG_DDR_HIDDEN) ? "HideDdr:" : "",\r
+                       (mdev->mthca_flags & MTHCA_FLAG_PCIE) ? "PciEx:" : ""\r
                        ));\r
        }\r
 \r
index 5d6a5d9..f127730 100644 (file)
@@ -392,7 +392,7 @@ mlnx_um_open(
        hca_dev_ext_t *ext_p = EXT_FROM_HOB( hob_p );\r
        struct ib_device *ib_dev = IBDEV_FROM_HOB( hob_p );\r
        struct ib_ucontext *p_context;\r
-       struct mthca_alloc_ucontext_resp *uresp_p;\r
+       struct ibv_get_context_resp *uresp_p;\r
        struct ibv_alloc_pd_resp resp;\r
        ci_umv_buf_t umv_buf;\r
 \r
@@ -441,7 +441,7 @@ mlnx_um_open(
        }\r
        \r
        // fill more parameters for user (sanity checks are in mthca_alloc_ucontext)\r
-       uresp_p = (struct mthca_alloc_ucontext_resp *)(void*)p_umv_buf->p_inout_buf;\r
+       uresp_p = (struct ibv_get_context_resp *)(void*)p_umv_buf->p_inout_buf;\r
        uresp_p->uar_addr = (uint64_t)(UINT_PTR)p_context->user_uar;\r
        uresp_p->pd_handle = resp.pd_handle;\r
        uresp_p->pdn = resp.pdn;\r
index 42c822f..7362448 100644 (file)
@@ -929,6 +929,7 @@ NTSTATUS mthca_init_one(hca_dev_ext_t *ext)
        }
 
        /* find the type of device */
+find_pci_dev:  
        p_id = mthca_find_pci_dev(
                (unsigned)ext->hcaConfig.VendorID,
                (unsigned)ext->hcaConfig.DeviceID);
@@ -938,7 +939,7 @@ NTSTATUS mthca_init_one(hca_dev_ext_t *ext)
        }
 
        /* allocate mdev structure */
-       mdev = kmalloc(sizeof *mdev, GFP_KERNEL);
+       mdev = kzalloc(sizeof *mdev, GFP_KERNEL);
        if (!mdev) {
                // can't use HCA_PRINT_EV here !
                HCA_PRINT(TRACE_LEVEL_ERROR ,HCA_DBG_LOW ,("Device struct alloc failed, "
@@ -948,7 +949,6 @@ NTSTATUS mthca_init_one(hca_dev_ext_t *ext)
        }
         
        /* set some fields */
-       RtlZeroMemory(mdev, sizeof *mdev);
        mdev->ext = ext;                /* pointer to DEVICE OBJECT extension */
        mdev->hca_type = p_id->driver_data;
        mdev->ib_dev.mdev = mdev;
@@ -1040,6 +1040,12 @@ err_cmd:
 
 err_free_dev:
        kfree(mdev);
+
+       /* we failed device initialization - try to simulate "livefish" device to facilitate using FW burning tools */
+       if (ext->hcaConfig.DeviceID == PCI_DEVICE_ID_MELLANOX_ARBEL)
+               ext->hcaConfig.DeviceID = PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT;
+       ext->hcaConfig.DeviceID += 1;   /* generate appropriate "livefish" DevId */
+       goto find_pci_dev;
        
 end:
        return status;
index 01a6b3e..55def7c 100644 (file)
@@ -321,7 +321,7 @@ int mthca_query_gid_chunk(struct ib_device *ibdev, u8 port,
 struct ib_ucontext *mthca_alloc_ucontext(struct ib_device *ibdev,
                                                ci_umv_buf_t* const     p_umv_buf)
 {
-       struct mthca_alloc_ucontext_resp uresp;
+       struct ibv_get_context_resp uresp;
        struct mthca_ucontext           *context;
        int                              err;
 
index 6d93165..8c47111 100644 (file)
  *    different between 32-bit and 64-bit architectures.
  */
 
-struct mthca_alloc_ucontext_resp {
-       uint64_t uar_addr;
-       uint64_t pd_handle;
-       uint32_t pdn;
-       uint32_t qp_tab_size;
-       uint32_t uarc_size;
-       uint32_t vend_id;
-       uint16_t dev_id;
-       uint16_t reserved[3];
-};
-
 struct ibv_get_context_resp {
        uint64_t uar_addr;
        uint64_t pd_handle;
@@ -69,6 +58,7 @@ struct ibv_get_context_resp {
        uint32_t uarc_size;
        uint32_t vend_id;
        uint16_t dev_id;
+       uint16_t reserved[3];
 };
 
 struct ibv_alloc_pd_resp {