• Home
  • Raw
  • Download

Lines Matching refs:efct

64 	struct efct *efct = NULL;  in efct_device_alloc()  local
66 efct = kzalloc_node(sizeof(*efct), GFP_KERNEL, nid); in efct_device_alloc()
67 if (!efct) in efct_device_alloc()
68 return efct; in efct_device_alloc()
70 INIT_LIST_HEAD(&efct->list_entry); in efct_device_alloc()
71 list_add_tail(&efct->list_entry, &efct_devices); in efct_device_alloc()
73 return efct; in efct_device_alloc()
77 efct_teardown_msix(struct efct *efct) in efct_teardown_msix() argument
81 for (i = 0; i < efct->n_msix_vec; i++) { in efct_teardown_msix()
82 free_irq(pci_irq_vector(efct->pci, i), in efct_teardown_msix()
83 &efct->intr_context[i]); in efct_teardown_msix()
86 pci_free_irq_vectors(efct->pci); in efct_teardown_msix()
90 efct_efclib_config(struct efct *efct, struct libefc_function_template *tt) in efct_efclib_config() argument
100 efct->efcport = efc; in efct_efclib_config()
103 efc->base = efct; in efct_efclib_config()
104 efc->pci = efct->pci; in efct_efclib_config()
106 efc->def_wwnn = efct_get_wwnn(&efct->hw); in efct_efclib_config()
107 efc->def_wwpn = efct_get_wwpn(&efct->hw); in efct_efclib_config()
111 sli = &efct->hw.sli; in efct_efclib_config()
113 sli_get_max_sgl(&efct->hw.sli); in efct_efclib_config()
115 efc->fcfi = efct->hw.fcf_indicator; in efct_efclib_config()
124 static int efct_request_firmware_update(struct efct *efct);
137 efct_device_attach(struct efct *efct) in efct_device_attach() argument
141 if (efct->attached) { in efct_device_attach()
142 efc_log_err(efct, "Device is already attached\n"); in efct_device_attach()
146 snprintf(efct->name, sizeof(efct->name), "[%s%d] ", "fc", in efct_device_attach()
147 efct->instance_index); in efct_device_attach()
149 efct->logmask = logmask; in efct_device_attach()
150 efct->filter_def = EFCT_DEFAULT_FILTER; in efct_device_attach()
151 efct->max_isr_time_msec = EFCT_OS_MAX_ISR_TIME_MSEC; in efct_device_attach()
153 efct->model = efct_pci_model(efct->pci->device); in efct_device_attach()
155 efct->efct_req_fw_upgrade = true; in efct_device_attach()
158 efct->xport = efct_xport_alloc(efct); in efct_device_attach()
159 if (!efct->xport) { in efct_device_attach()
160 efc_log_err(efct, "failed to allocate transport object\n"); in efct_device_attach()
165 rc = efct_xport_attach(efct->xport); in efct_device_attach()
167 efc_log_err(efct, "failed to attach transport object\n"); in efct_device_attach()
171 rc = efct_xport_initialize(efct->xport); in efct_device_attach()
173 efc_log_err(efct, "failed to initialize transport object\n"); in efct_device_attach()
177 rc = efct_efclib_config(efct, &efct_libefc_templ); in efct_device_attach()
179 efc_log_err(efct, "failed to init efclib\n"); in efct_device_attach()
183 for (i = 0; i < efct->n_msix_vec; i++) { in efct_device_attach()
184 efc_log_debug(efct, "irq %d enabled\n", i); in efct_device_attach()
185 enable_irq(pci_irq_vector(efct->pci, i)); in efct_device_attach()
188 efct->attached = true; in efct_device_attach()
190 if (efct->efct_req_fw_upgrade) in efct_device_attach()
191 efct_request_firmware_update(efct); in efct_device_attach()
196 efct_xport_detach(efct->xport); in efct_device_attach()
198 efct_xport_free(efct->xport); in efct_device_attach()
199 efct->xport = NULL; in efct_device_attach()
205 efct_device_detach(struct efct *efct) in efct_device_detach() argument
209 if (!efct || !efct->attached) { in efct_device_detach()
214 if (efct_xport_control(efct->xport, EFCT_XPORT_SHUTDOWN)) in efct_device_detach()
215 efc_log_err(efct, "Transport Shutdown timed out\n"); in efct_device_detach()
217 for (i = 0; i < efct->n_msix_vec; i++) in efct_device_detach()
218 disable_irq(pci_irq_vector(efct->pci, i)); in efct_device_detach()
220 efct_xport_detach(efct->xport); in efct_device_detach()
222 efct_xport_free(efct->xport); in efct_device_detach()
223 efct->xport = NULL; in efct_device_detach()
225 efcport_destroy(efct->efcport); in efct_device_detach()
226 kfree(efct->efcport); in efct_device_detach()
228 efct->attached = false; in efct_device_detach()
247 efct_firmware_write(struct efct *efct, const u8 *buf, size_t buf_len, in efct_firmware_write() argument
264 dma.virt = dma_alloc_coherent(&efct->pci->dev, in efct_firmware_write()
280 efct_hw_firmware_write(&efct->hw, &dma, xfer_size, offset, in efct_firmware_write()
300 dma_free_coherent(&efct->pci->dev, dma.size, dma.virt, dma.phys); in efct_firmware_write()
305 efct_fw_reset(struct efct *efct) in efct_fw_reset() argument
312 if (timer_pending(&efct->xport->stats_timer)) in efct_fw_reset()
313 del_timer(&efct->xport->stats_timer); in efct_fw_reset()
315 if (efct_hw_reset(&efct->hw, EFCT_HW_RESET_FIRMWARE)) { in efct_fw_reset()
316 efc_log_info(efct, "failed to reset firmware\n"); in efct_fw_reset()
320 efc_log_info(efct, "successfully reset firmware.Now resetting port\n"); in efct_fw_reset()
322 efct_device_detach(efct); in efct_fw_reset()
323 return efct_device_attach(efct); in efct_fw_reset()
327 efct_request_firmware_update(struct efct *efct) in efct_request_firmware_update() argument
334 snprintf(file_name, 256, "%s.grp", efct->model); in efct_request_firmware_update()
336 rc = request_firmware(&fw, file_name, &efct->pci->dev); in efct_request_firmware_update()
338 efc_log_debug(efct, "Firmware file(%s) not found.\n", file_name); in efct_request_firmware_update()
344 if (!strncmp(efct->hw.sli.fw_name[0], fw_image->revision, in efct_request_firmware_update()
346 efc_log_debug(efct, in efct_request_firmware_update()
351 efc_log_info(efct, "Firmware update is initiated. %s -> %s\n", in efct_request_firmware_update()
352 efct->hw.sli.fw_name[0], fw_image->revision); in efct_request_firmware_update()
354 rc = efct_firmware_write(efct, fw->data, fw->size, &fw_change_status); in efct_request_firmware_update()
356 efc_log_err(efct, "Firmware update failed. rc = %d\n", rc); in efct_request_firmware_update()
360 efc_log_info(efct, "Firmware updated successfully\n"); in efct_request_firmware_update()
363 efc_log_info(efct, "New firmware is active.\n"); in efct_request_firmware_update()
366 efc_log_info(efct, in efct_request_firmware_update()
371 efc_log_info(efct, in efct_request_firmware_update()
373 efct_fw_reset(efct); in efct_request_firmware_update()
376 efc_log_info(efct, "Unexpected value change_status:%d\n", in efct_request_firmware_update()
388 efct_device_free(struct efct *efct) in efct_device_free() argument
390 if (efct) { in efct_device_free()
391 list_del(&efct->list_entry); in efct_device_free()
392 kfree(efct); in efct_device_free()
397 efct_device_interrupts_required(struct efct *efct) in efct_device_interrupts_required() argument
401 rc = efct_hw_setup(&efct->hw, efct, efct->pci); in efct_device_interrupts_required()
405 return efct->hw.config.n_eq; in efct_device_interrupts_required()
412 struct efct *efct = intr_ctx->efct; in efct_intr_thread() local
414 efct_hw_process(&efct->hw, intr_ctx->index, efct->max_isr_time_msec); in efct_intr_thread()
425 efct_setup_msix(struct efct *efct, u32 num_intrs) in efct_setup_msix() argument
429 if (!pci_find_capability(efct->pci, PCI_CAP_ID_MSIX)) { in efct_setup_msix()
430 dev_err(&efct->pci->dev, in efct_setup_msix()
435 efct->n_msix_vec = num_intrs; in efct_setup_msix()
437 rc = pci_alloc_irq_vectors(efct->pci, num_intrs, num_intrs, in efct_setup_msix()
441 dev_err(&efct->pci->dev, "Failed to alloc irq : %d\n", rc); in efct_setup_msix()
448 intr_ctx = &efct->intr_context[i]; in efct_setup_msix()
449 intr_ctx->efct = efct; in efct_setup_msix()
452 rc = request_threaded_irq(pci_irq_vector(efct->pci, i), in efct_setup_msix()
456 dev_err(&efct->pci->dev, in efct_setup_msix()
466 free_irq(pci_irq_vector(efct->pci, i), in efct_setup_msix()
467 &efct->intr_context[i]); in efct_setup_msix()
469 pci_free_irq_vectors(efct->pci); in efct_setup_msix()
482 struct efct *efct = NULL; in efct_pci_probe() local
516 efct = efct_device_alloc(nid); in efct_pci_probe()
517 if (!efct) { in efct_pci_probe()
523 efct->pci = pdev; in efct_pci_probe()
524 efct->numa_node = nid; in efct_pci_probe()
529 efct->reg[r] = ioremap(pci_resource_start(pdev, i), in efct_pci_probe()
543 pci_set_drvdata(pdev, efct); in efct_pci_probe()
551 num_interrupts = efct_device_interrupts_required(efct); in efct_pci_probe()
553 efc_log_err(efct, "efct_device_interrupts_required failed\n"); in efct_pci_probe()
562 rc = efct_setup_msix(efct, num_interrupts); in efct_pci_probe()
568 for (i = 0; i < efct->n_msix_vec; i++) { in efct_pci_probe()
569 efc_log_debug(efct, "irq %d disabled\n", i); in efct_pci_probe()
570 disable_irq(pci_irq_vector(efct->pci, i)); in efct_pci_probe()
573 rc = efct_device_attach(efct); in efct_pci_probe()
580 efct_teardown_msix(efct); in efct_pci_probe()
585 if (efct->reg[i]) in efct_pci_probe()
586 iounmap(efct->reg[i]); in efct_pci_probe()
588 efct_device_free(efct); in efct_pci_probe()
601 struct efct *efct = pci_get_drvdata(pdev); in efct_pci_remove() local
604 if (!efct) in efct_pci_remove()
607 efct_device_detach(efct); in efct_pci_remove()
609 efct_teardown_msix(efct); in efct_pci_remove()
612 if (efct->reg[i]) in efct_pci_remove()
613 iounmap(efct->reg[i]); in efct_pci_remove()
618 efct_device_free(efct); in efct_pci_remove()
626 efct_device_prep_for_reset(struct efct *efct, struct pci_dev *pdev) in efct_device_prep_for_reset() argument
628 if (efct) { in efct_device_prep_for_reset()
629 efc_log_debug(efct, in efct_device_prep_for_reset()
631 efct_device_detach(efct); in efct_device_prep_for_reset()
633 efct_teardown_msix(efct); in efct_device_prep_for_reset()
639 efct_device_prep_for_recover(struct efct *efct) in efct_device_prep_for_recover() argument
641 if (efct) { in efct_device_prep_for_recover()
642 efc_log_debug(efct, "PCI channel preparing for recovery\n"); in efct_device_prep_for_recover()
643 efct_hw_io_abort_all(&efct->hw); in efct_device_prep_for_recover()
665 struct efct *efct = pci_get_drvdata(pdev); in efct_pci_io_error_detected() local
670 efct_device_prep_for_recover(efct); in efct_pci_io_error_detected()
674 efct_device_prep_for_reset(efct, pdev); in efct_pci_io_error_detected()
678 efct_device_detach(efct); in efct_pci_io_error_detected()
682 efc_log_debug(efct, "Unknown PCI error state:0x%x\n", state); in efct_pci_io_error_detected()
683 efct_device_prep_for_reset(efct, pdev); in efct_pci_io_error_detected()
695 struct efct *efct = pci_get_drvdata(pdev); in efct_pci_io_slot_reset() local
699 efc_log_err(efct, "failed to enable PCI device after reset\n"); in efct_pci_io_slot_reset()
712 rc = efct_setup_msix(efct, efct->n_msix_vec); in efct_pci_io_slot_reset()
714 efc_log_err(efct, "rc %d returned, IRQ allocation failed\n", in efct_pci_io_slot_reset()
718 efct_device_detach(efct); in efct_pci_io_slot_reset()
720 efct_device_attach(efct); in efct_pci_io_slot_reset()
728 struct efct *efct = pci_get_drvdata(pdev); in efct_pci_io_resume() local
731 efct_device_detach(efct); in efct_pci_io_resume()
733 efct_device_attach(efct); in efct_pci_io_resume()