From: leonidk Date: Mon, 14 Aug 2006 18:19:51 +0000 (+0000) Subject: [MTHCA] 1. feature: the driver will now enter a simulated "livefish" mode in case... X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=1abd90fdab6df0cf0812bb47662a546b9c0121d8;p=~shefty%2Frdma-win.git [MTHCA] 1. feature: the driver will now enter a simulated "livefish" mode in case of error in the card initialization. 2. improve printing to Event Log. 3. cleaning: remove a duplicate structure git-svn-id: svn://openib.tc.cornell.edu/gen1@451 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/hw/mthca/kernel/hca_pnp.c b/trunk/hw/mthca/kernel/hca_pnp.c index 792e1e0e..f6753cba 100644 --- a/trunk/hw/mthca/kernel/hca_pnp.c +++ b/trunk/hw/mthca/kernel/hca_pnp.c @@ -890,14 +890,21 @@ hca_start( { struct mthca_dev *mdev = p_ext->hca.mdev; HCA_PRINT_EV(TRACE_LEVEL_INFORMATION ,HCA_DBG_LOW , - ("Ven %d Dev %d Hw %x Fw %d.%d.%d Drv %s (%s) Flg %s%s%s\n", + ("Ven %x Dev %d Hw %x Fw %d.%d.%d Drv %s (%s)", (unsigned)p_ext->hcaConfig.VendorID, (unsigned)p_ext->hcaConfig.DeviceID, p_ext->hca.hw_ver, (int) (mdev->fw_ver >> 32), (int) (mdev->fw_ver >> 16) & 0xffff, (int) (mdev->fw_ver & 0xffff), - DRV_VERSION, DRV_RELDATE, - (mdev->mthca_flags & MTHCA_FLAG_MEMFREE) ? "M:" : "", - (mdev->mthca_flags & MTHCA_FLAG_PCIE) ? "E:" : "", - (mdev->mthca_flags & MTHCA_FLAG_DDR_HIDDEN) ? "H" : "" + DRV_VERSION, DRV_RELDATE + )); + HCA_PRINT_EV(TRACE_LEVEL_INFORMATION ,HCA_DBG_LOW , + ("Flags %s%s%s%s%s%s%s\n", + (mdev->mthca_flags & MTHCA_FLAG_LIVEFISH) ? "Flash Recovery Mode:" : "", + (mdev->mthca_flags & MTHCA_FLAG_MEMFREE) ? "MemFree:" : "", + (mdev->mthca_flags & MTHCA_FLAG_NO_LAM) ? "NoLam:" : "", + (mdev->mthca_flags & MTHCA_FLAG_FMR) ? "Fmr:" : "", + (mdev->mthca_flags & MTHCA_FLAG_SRQ) ? "Srq:" : "", + (mdev->mthca_flags & MTHCA_FLAG_DDR_HIDDEN) ? "HideDdr:" : "", + (mdev->mthca_flags & MTHCA_FLAG_PCIE) ? "PciEx:" : "" )); } diff --git a/trunk/hw/mthca/kernel/hca_verbs.c b/trunk/hw/mthca/kernel/hca_verbs.c index 5d6a5d96..f1277301 100644 --- a/trunk/hw/mthca/kernel/hca_verbs.c +++ b/trunk/hw/mthca/kernel/hca_verbs.c @@ -392,7 +392,7 @@ mlnx_um_open( hca_dev_ext_t *ext_p = EXT_FROM_HOB( hob_p ); struct ib_device *ib_dev = IBDEV_FROM_HOB( hob_p ); struct ib_ucontext *p_context; - struct mthca_alloc_ucontext_resp *uresp_p; + struct ibv_get_context_resp *uresp_p; struct ibv_alloc_pd_resp resp; ci_umv_buf_t umv_buf; @@ -441,7 +441,7 @@ mlnx_um_open( } // fill more parameters for user (sanity checks are in mthca_alloc_ucontext) - uresp_p = (struct mthca_alloc_ucontext_resp *)(void*)p_umv_buf->p_inout_buf; + uresp_p = (struct ibv_get_context_resp *)(void*)p_umv_buf->p_inout_buf; uresp_p->uar_addr = (uint64_t)(UINT_PTR)p_context->user_uar; uresp_p->pd_handle = resp.pd_handle; uresp_p->pdn = resp.pdn; diff --git a/trunk/hw/mthca/kernel/mthca_main.c b/trunk/hw/mthca/kernel/mthca_main.c index 42c822f0..73624483 100644 --- a/trunk/hw/mthca/kernel/mthca_main.c +++ b/trunk/hw/mthca/kernel/mthca_main.c @@ -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; diff --git a/trunk/hw/mthca/kernel/mthca_provider.c b/trunk/hw/mthca/kernel/mthca_provider.c index 01a6b3e8..55def7c9 100644 --- a/trunk/hw/mthca/kernel/mthca_provider.c +++ b/trunk/hw/mthca/kernel/mthca_provider.c @@ -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; diff --git a/trunk/hw/mthca/mx_abi.h b/trunk/hw/mthca/mx_abi.h index 6d931652..8c47111b 100644 --- a/trunk/hw/mthca/mx_abi.h +++ b/trunk/hw/mthca/mx_abi.h @@ -50,17 +50,6 @@ * 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 {