[MTHCA] 1. feature: the driver will now enter a simulated "livefish" mode in case...
[mirror/winof/.git] / hw / mthca / kernel / mthca_main.c
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;