Lines Matching refs:ha
13 static void ql4xxx_set_mac_number(struct scsi_qla_host *ha) in ql4xxx_set_mac_number() argument
19 spin_lock_irqsave(&ha->hardware_lock, flags); in ql4xxx_set_mac_number()
20 value = readw(&ha->reg->ctrl_status); in ql4xxx_set_mac_number()
21 spin_unlock_irqrestore(&ha->hardware_lock, flags); in ql4xxx_set_mac_number()
25 ha->mac_index = 1; in ql4xxx_set_mac_number()
28 ha->mac_index = 3; in ql4xxx_set_mac_number()
32 "ispControlStatus = 0x%x\n", ha->host_no, in ql4xxx_set_mac_number()
36 DEBUG2(printk("scsi%ld: %s: mac_index %d.\n", ha->host_no, __func__, in ql4xxx_set_mac_number()
37 ha->mac_index)); in ql4xxx_set_mac_number()
47 void qla4xxx_free_ddb(struct scsi_qla_host *ha, in qla4xxx_free_ddb() argument
51 ha->fw_ddb_index_map[ddb_entry->fw_ddb_index] = in qla4xxx_free_ddb()
53 ha->tot_ddbs--; in qla4xxx_free_ddb()
63 static void qla4xxx_init_response_q_entries(struct scsi_qla_host *ha) in qla4xxx_init_response_q_entries() argument
68 pkt = (struct response *)ha->response_ptr; in qla4xxx_init_response_q_entries()
83 int qla4xxx_init_rings(struct scsi_qla_host *ha) in qla4xxx_init_rings() argument
89 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_init_rings()
90 ha->request_out = 0; in qla4xxx_init_rings()
91 ha->request_in = 0; in qla4xxx_init_rings()
92 ha->request_ptr = &ha->request_ring[ha->request_in]; in qla4xxx_init_rings()
93 ha->req_q_count = REQUEST_QUEUE_DEPTH; in qla4xxx_init_rings()
96 ha->response_in = 0; in qla4xxx_init_rings()
97 ha->response_out = 0; in qla4xxx_init_rings()
98 ha->response_ptr = &ha->response_ring[ha->response_out]; in qla4xxx_init_rings()
100 if (is_qla8022(ha)) { in qla4xxx_init_rings()
102 (unsigned long __iomem *)&ha->qla4_82xx_reg->req_q_out); in qla4xxx_init_rings()
104 (unsigned long __iomem *)&ha->qla4_82xx_reg->rsp_q_in); in qla4xxx_init_rings()
106 (unsigned long __iomem *)&ha->qla4_82xx_reg->rsp_q_out); in qla4xxx_init_rings()
107 } else if (is_qla8032(ha) || is_qla8042(ha)) { in qla4xxx_init_rings()
109 (unsigned long __iomem *)&ha->qla4_83xx_reg->req_q_in); in qla4xxx_init_rings()
111 (unsigned long __iomem *)&ha->qla4_83xx_reg->rsp_q_in); in qla4xxx_init_rings()
113 (unsigned long __iomem *)&ha->qla4_83xx_reg->rsp_q_out); in qla4xxx_init_rings()
122 ha->shadow_regs->req_q_out = cpu_to_le32(0); in qla4xxx_init_rings()
123 ha->shadow_regs->rsp_q_in = cpu_to_le32(0); in qla4xxx_init_rings()
126 writel(0, &ha->reg->req_q_in); in qla4xxx_init_rings()
127 writel(0, &ha->reg->rsp_q_out); in qla4xxx_init_rings()
128 readl(&ha->reg->rsp_q_out); in qla4xxx_init_rings()
131 qla4xxx_init_response_q_entries(ha); in qla4xxx_init_rings()
135 ha->active_mrb_array[i] = NULL; in qla4xxx_init_rings()
137 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_init_rings()
147 int qla4xxx_get_sys_info(struct scsi_qla_host *ha) in qla4xxx_get_sys_info() argument
153 sys_info = dma_alloc_coherent(&ha->pdev->dev, sizeof(*sys_info), in qla4xxx_get_sys_info()
157 ha->host_no, __func__)); in qla4xxx_get_sys_info()
163 if (qla4xxx_get_flash(ha, sys_info_dma, FLASH_OFFSET_SYS_INFO, in qla4xxx_get_sys_info()
166 "failed\n", ha->host_no, __func__)); in qla4xxx_get_sys_info()
172 memcpy(ha->my_mac, &sys_info->physAddr[0].address[0], in qla4xxx_get_sys_info()
173 min(sizeof(ha->my_mac), in qla4xxx_get_sys_info()
175 memcpy(ha->serial_number, &sys_info->acSerialNumber, in qla4xxx_get_sys_info()
176 min(sizeof(ha->serial_number), in qla4xxx_get_sys_info()
182 dma_free_coherent(&ha->pdev->dev, sizeof(*sys_info), sys_info, in qla4xxx_get_sys_info()
194 static void qla4xxx_init_local_data(struct scsi_qla_host *ha) in qla4xxx_init_local_data() argument
197 ha->aen_q_count = MAX_AEN_ENTRIES; in qla4xxx_init_local_data()
201 qla4xxx_wait_for_ip_config(struct scsi_qla_host *ha) in qla4xxx_wait_for_ip_config() argument
210 if (is_ipv4_enabled(ha) && is_ipv6_enabled(ha)) { in qla4xxx_wait_for_ip_config()
211 if (((ha->addl_fw_state & FW_ADDSTATE_DHCPv4_ENABLED) != 0) && in qla4xxx_wait_for_ip_config()
212 ((ha->addl_fw_state & in qla4xxx_wait_for_ip_config()
216 if (((ha->ip_config.ipv6_addl_options & in qla4xxx_wait_for_ip_config()
218 ((ha->ip_config.ipv6_link_local_state == in qla4xxx_wait_for_ip_config()
220 (ha->ip_config.ipv6_addr0_state == in qla4xxx_wait_for_ip_config()
222 (ha->ip_config.ipv6_addr1_state == in qla4xxx_wait_for_ip_config()
227 if ((ha->ip_config.ipv6_link_local_state == in qla4xxx_wait_for_ip_config()
229 (ha->ip_config.ipv6_addr0_state == in qla4xxx_wait_for_ip_config()
231 (ha->ip_config.ipv6_addr1_state == in qla4xxx_wait_for_ip_config()
235 " Don't wait!\n", ha->host_no, in qla4xxx_wait_for_ip_config()
239 if (memcmp(&ha->ip_config.ipv6_default_router_addr, in qla4xxx_wait_for_ip_config()
243 "Don't wait!\n", ha->host_no, in qla4xxx_wait_for_ip_config()
247 if ((ha->ip_config.ipv6_default_router_state == in qla4xxx_wait_for_ip_config()
249 (ha->ip_config.ipv6_link_local_state == in qla4xxx_wait_for_ip_config()
251 (memcmp(&ha->ip_config.ipv6_link_local_addr, in qla4xxx_wait_for_ip_config()
252 &ha->ip_config.ipv6_default_router_addr, 4) == in qla4xxx_wait_for_ip_config()
256 ha->host_no, __func__)); in qla4xxx_wait_for_ip_config()
262 "IP(s) \"", ha->host_no, __func__)); in qla4xxx_wait_for_ip_config()
265 if (ha->ip_config.ipv6_link_local_state == in qla4xxx_wait_for_ip_config()
268 if (ha->ip_config.ipv6_addr0_state == in qla4xxx_wait_for_ip_config()
271 if (ha->ip_config.ipv6_addr1_state == in qla4xxx_wait_for_ip_config()
281 static int qla4_80xx_is_minidump_dma_capable(struct scsi_qla_host *ha, in qla4_80xx_is_minidump_dma_capable() argument
284 int offset = (is_qla8022(ha)) ? QLA8022_TEMPLATE_CAP_OFFSET : in qla4_80xx_is_minidump_dma_capable()
292 ql4_printk(KERN_INFO, ha, "PEX DMA Not supported %d\n", in qla4_80xx_is_minidump_dma_capable()
304 void qla4xxx_alloc_fw_dump(struct scsi_qla_host *ha) in qla4xxx_alloc_fw_dump() argument
314 if (ha->fw_dump) { in qla4xxx_alloc_fw_dump()
315 ql4_printk(KERN_WARNING, ha, in qla4xxx_alloc_fw_dump()
320 status = qla4xxx_req_template_size(ha); in qla4xxx_alloc_fw_dump()
322 ql4_printk(KERN_INFO, ha, in qla4xxx_alloc_fw_dump()
324 ha->host_no); in qla4xxx_alloc_fw_dump()
328 clear_bit(AF_82XX_FW_DUMPED, &ha->flags); in qla4xxx_alloc_fw_dump()
331 md_tmp = dma_alloc_coherent(&ha->pdev->dev, ha->fw_dump_tmplt_size, in qla4xxx_alloc_fw_dump()
334 ql4_printk(KERN_INFO, ha, in qla4xxx_alloc_fw_dump()
336 ha->host_no); in qla4xxx_alloc_fw_dump()
341 status = qla4xxx_get_minidump_template(ha, md_tmp_dma); in qla4xxx_alloc_fw_dump()
343 ql4_printk(KERN_INFO, ha, in qla4xxx_alloc_fw_dump()
345 ha->host_no); in qla4xxx_alloc_fw_dump()
351 dma_capable = qla4_80xx_is_minidump_dma_capable(ha, md_hdr); in qla4xxx_alloc_fw_dump()
358 ha->fw_dump_capture_mask = ql4xmdcapmask; in qla4xxx_alloc_fw_dump()
361 ql4_printk(KERN_INFO, ha, "Falling back to default capture mask, as PEX DMA is not supported\n"); in qla4xxx_alloc_fw_dump()
362 ha->fw_dump_capture_mask = capture_debug_level; in qla4xxx_alloc_fw_dump()
365 md_hdr->driver_capture_mask = ha->fw_dump_capture_mask; in qla4xxx_alloc_fw_dump()
367 DEBUG2(ql4_printk(KERN_INFO, ha, "Minimum num of entries = %d\n", in qla4xxx_alloc_fw_dump()
369 DEBUG2(ql4_printk(KERN_INFO, ha, "Dump template size = %d\n", in qla4xxx_alloc_fw_dump()
370 ha->fw_dump_tmplt_size)); in qla4xxx_alloc_fw_dump()
371 DEBUG2(ql4_printk(KERN_INFO, ha, "Selected Capture mask =0x%x\n", in qla4xxx_alloc_fw_dump()
372 ha->fw_dump_capture_mask)); in qla4xxx_alloc_fw_dump()
377 if (hdr_entry_bit & ha->fw_dump_capture_mask) in qla4xxx_alloc_fw_dump()
378 ha->fw_dump_size += md_hdr->capture_size_array[k]; in qla4xxx_alloc_fw_dump()
382 ha->fw_dump_size += ha->fw_dump_tmplt_size; in qla4xxx_alloc_fw_dump()
383 ha->fw_dump = vmalloc(ha->fw_dump_size); in qla4xxx_alloc_fw_dump()
384 if (!ha->fw_dump) in qla4xxx_alloc_fw_dump()
387 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_alloc_fw_dump()
389 ha->fw_dump_tmplt_size)); in qla4xxx_alloc_fw_dump()
390 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_alloc_fw_dump()
391 "Total Minidump size = 0x%x KB\n", ha->fw_dump_size)); in qla4xxx_alloc_fw_dump()
393 memcpy(ha->fw_dump, md_tmp, ha->fw_dump_tmplt_size); in qla4xxx_alloc_fw_dump()
394 ha->fw_dump_tmplt_hdr = ha->fw_dump; in qla4xxx_alloc_fw_dump()
397 dma_free_coherent(&ha->pdev->dev, ha->fw_dump_tmplt_size, in qla4xxx_alloc_fw_dump()
401 static int qla4xxx_fw_ready(struct scsi_qla_host *ha) in qla4xxx_fw_ready() argument
406 DEBUG2(ql4_printk(KERN_INFO, ha, "Waiting for Firmware Ready..\n")); in qla4xxx_fw_ready()
409 if (test_and_clear_bit(DPC_GET_DHCP_IP_ADDR, &ha->dpc_flags)) in qla4xxx_fw_ready()
410 qla4xxx_get_dhcp_ip_address(ha); in qla4xxx_fw_ready()
413 if (qla4xxx_get_firmware_state(ha) != QLA_SUCCESS) { in qla4xxx_fw_ready()
415 "state\n", ha->host_no, __func__)); in qla4xxx_fw_ready()
419 if (ha->firmware_state & FW_STATE_ERROR) { in qla4xxx_fw_ready()
421 " occurred\n", ha->host_no, __func__)); in qla4xxx_fw_ready()
425 if (ha->firmware_state & FW_STATE_CONFIG_WAIT) { in qla4xxx_fw_ready()
430 if (qla4xxx_initialize_fw_cb(ha) == QLA_ERROR) in qla4xxx_fw_ready()
437 if (ha->firmware_state & FW_STATE_WAIT_AUTOCONNECT) { in qla4xxx_fw_ready()
440 ha->host_no, __func__)); in qla4xxx_fw_ready()
443 if (ha->firmware_state & FW_STATE_CONFIGURING_IP) { in qla4xxx_fw_ready()
446 ha->host_no, __func__)); in qla4xxx_fw_ready()
455 if (ha->addl_fw_state & FW_ADDSTATE_LINK_UP) { in qla4xxx_fw_ready()
458 ha->host_no, __func__)); in qla4xxx_fw_ready()
459 } else if (ha->firmware_state & in qla4xxx_fw_ready()
464 ha->host_no, __func__)); in qla4xxx_fw_ready()
465 ha->firmware_state = FW_STATE_READY; in qla4xxx_fw_ready()
470 if (ha->firmware_state == FW_STATE_READY) { in qla4xxx_fw_ready()
473 &ha->dpc_flags)) in qla4xxx_fw_ready()
474 qla4xxx_get_dhcp_ip_address(ha); in qla4xxx_fw_ready()
476 if (!qla4xxx_wait_for_ip_config(ha) || in qla4xxx_fw_ready()
478 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_fw_ready()
482 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_fw_ready()
484 " - %s\n", ha->host_no, in qla4xxx_fw_ready()
485 __func__, (ha->addl_fw_state & in qla4xxx_fw_ready()
488 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_fw_ready()
490 " Enabled %s\n", ha->host_no, in qla4xxx_fw_ready()
491 __func__, (ha->addl_fw_state & in qla4xxx_fw_ready()
494 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_fw_ready()
496 ha->host_no, __func__, in qla4xxx_fw_ready()
497 (ha->addl_fw_state & in qla4xxx_fw_ready()
500 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_fw_ready()
503 ha->host_no, __func__, in qla4xxx_fw_ready()
504 (ha->addl_fw_state & in qla4xxx_fw_ready()
513 "seconds expired= %d\n", ha->host_no, __func__, in qla4xxx_fw_ready()
514 ha->firmware_state, ha->addl_fw_state, in qla4xxx_fw_ready()
516 if (is_qla4032(ha) && in qla4xxx_fw_ready()
517 !(ha->addl_fw_state & FW_ADDSTATE_LINK_UP) && in qla4xxx_fw_ready()
527 ha->host_no, __func__)); in qla4xxx_fw_ready()
529 if (ha->firmware_state & FW_STATE_CONFIGURING_IP) { in qla4xxx_fw_ready()
532 ha->host_no, __func__)); in qla4xxx_fw_ready()
534 } else if (ha->firmware_state & FW_STATE_WAIT_AUTOCONNECT) { in qla4xxx_fw_ready()
537 ha->host_no, __func__)); in qla4xxx_fw_ready()
549 static int qla4xxx_init_firmware(struct scsi_qla_host *ha) in qla4xxx_init_firmware() argument
553 if (is_aer_supported(ha) && in qla4xxx_init_firmware()
554 test_bit(AF_PCI_CHANNEL_IO_PERM_FAILURE, &ha->flags)) in qla4xxx_init_firmware()
560 if (is_qla80XX(ha)) in qla4xxx_init_firmware()
561 qla4_8xxx_stop_firmware(ha); in qla4xxx_init_firmware()
563 ql4_printk(KERN_INFO, ha, "Initializing firmware..\n"); in qla4xxx_init_firmware()
564 if (qla4xxx_initialize_fw_cb(ha) == QLA_ERROR) { in qla4xxx_init_firmware()
566 "control block\n", ha->host_no, __func__)); in qla4xxx_init_firmware()
570 if (!qla4xxx_fw_ready(ha)) in qla4xxx_init_firmware()
573 if (is_qla80XX(ha) && !test_bit(AF_INIT_DONE, &ha->flags)) in qla4xxx_init_firmware()
574 qla4xxx_alloc_fw_dump(ha); in qla4xxx_init_firmware()
576 return qla4xxx_get_firmware_status(ha); in qla4xxx_init_firmware()
579 static void qla4xxx_set_model_info(struct scsi_qla_host *ha) in qla4xxx_set_model_info() argument
583 int size = sizeof(ha->nvram->isp4022.boardIdStr); in qla4xxx_set_model_info()
587 board_id_string[i] = rd_nvram_word(ha, offset); in qla4xxx_set_model_info()
591 memcpy(ha->model_name, board_id_string, size); in qla4xxx_set_model_info()
594 static int qla4xxx_config_nvram(struct scsi_qla_host *ha) in qla4xxx_config_nvram() argument
599 DEBUG2(printk("scsi%ld: %s: Get EEProm parameters \n", ha->host_no, in qla4xxx_config_nvram()
601 if (ql4xxx_lock_flash(ha) != QLA_SUCCESS) in qla4xxx_config_nvram()
603 if (ql4xxx_lock_nvram(ha) != QLA_SUCCESS) { in qla4xxx_config_nvram()
604 ql4xxx_unlock_flash(ha); in qla4xxx_config_nvram()
609 ql4_printk(KERN_INFO, ha, "Configuring NVRAM ...\n"); in qla4xxx_config_nvram()
610 if (qla4xxx_is_nvram_configuration_valid(ha) == QLA_SUCCESS) { in qla4xxx_config_nvram()
611 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_config_nvram()
613 rd_nvram_word(ha, eeprom_ext_hw_conf_offset(ha)); in qla4xxx_config_nvram()
614 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_config_nvram()
616 ql4_printk(KERN_WARNING, ha, in qla4xxx_config_nvram()
618 "Please update your EEPROM\n", ha->host_no, in qla4xxx_config_nvram()
622 if (is_qla4010(ha)) in qla4xxx_config_nvram()
624 else if (is_qla4022(ha) | is_qla4032(ha)) in qla4xxx_config_nvram()
630 if (is_qla4022(ha) || is_qla4032(ha)) in qla4xxx_config_nvram()
631 qla4xxx_set_model_info(ha); in qla4xxx_config_nvram()
633 strcpy(ha->model_name, "QLA4010"); in qla4xxx_config_nvram()
636 ha->host_no, __func__, extHwConfig.Asuint32_t)); in qla4xxx_config_nvram()
638 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_config_nvram()
639 writel((0xFFFF << 16) | extHwConfig.Asuint32_t, isp_ext_hw_conf(ha)); in qla4xxx_config_nvram()
640 readl(isp_ext_hw_conf(ha)); in qla4xxx_config_nvram()
641 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_config_nvram()
643 ql4xxx_unlock_nvram(ha); in qla4xxx_config_nvram()
644 ql4xxx_unlock_flash(ha); in qla4xxx_config_nvram()
653 void qla4_8xxx_pci_config(struct scsi_qla_host *ha) in qla4_8xxx_pci_config() argument
655 pci_set_master(ha->pdev); in qla4_8xxx_pci_config()
658 void qla4xxx_pci_config(struct scsi_qla_host *ha) in qla4xxx_pci_config() argument
663 ql4_printk(KERN_INFO, ha, "Configuring PCI space...\n"); in qla4xxx_pci_config()
665 pci_set_master(ha->pdev); in qla4xxx_pci_config()
666 status = pci_set_mwi(ha->pdev); in qla4xxx_pci_config()
668 ql4_printk(KERN_WARNING, ha, "Failed to set MWI\n"); in qla4xxx_pci_config()
675 pci_read_config_word(ha->pdev, PCI_COMMAND, &w); in qla4xxx_pci_config()
678 pci_write_config_word(ha->pdev, PCI_COMMAND, w); in qla4xxx_pci_config()
681 static int qla4xxx_start_firmware_from_flash(struct scsi_qla_host *ha) in qla4xxx_start_firmware_from_flash() argument
688 ql4_printk(KERN_INFO, ha, "Starting firmware ...\n"); in qla4xxx_start_firmware_from_flash()
700 ha->host_no, __func__)); in qla4xxx_start_firmware_from_flash()
702 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_start_firmware_from_flash()
703 writel(jiffies, &ha->reg->mailbox[7]); in qla4xxx_start_firmware_from_flash()
704 if (is_qla4022(ha) | is_qla4032(ha)) in qla4xxx_start_firmware_from_flash()
706 &ha->reg->u1.isp4022.nvram); in qla4xxx_start_firmware_from_flash()
708 writel(2, &ha->reg->mailbox[6]); in qla4xxx_start_firmware_from_flash()
709 readl(&ha->reg->mailbox[6]); in qla4xxx_start_firmware_from_flash()
711 writel(set_rmask(CSR_BOOT_ENABLE), &ha->reg->ctrl_status); in qla4xxx_start_firmware_from_flash()
712 readl(&ha->reg->ctrl_status); in qla4xxx_start_firmware_from_flash()
713 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_start_firmware_from_flash()
718 ha->host_no, __func__, FIRMWARE_UP_TOV)); in qla4xxx_start_firmware_from_flash()
723 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_start_firmware_from_flash()
724 ctrl_status = readw(&ha->reg->ctrl_status); in qla4xxx_start_firmware_from_flash()
725 mbox_status = readw(&ha->reg->mailbox[0]); in qla4xxx_start_firmware_from_flash()
726 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_start_firmware_from_flash()
735 ha->host_no, __func__, ctrl_status, max_wait_time)); in qla4xxx_start_firmware_from_flash()
742 ha->host_no, __func__)); in qla4xxx_start_firmware_from_flash()
744 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_start_firmware_from_flash()
746 &ha->reg->ctrl_status); in qla4xxx_start_firmware_from_flash()
747 readl(&ha->reg->ctrl_status); in qla4xxx_start_firmware_from_flash()
748 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_start_firmware_from_flash()
753 "- mbox status 0x%x\n", ha->host_no, __func__, in qla4xxx_start_firmware_from_flash()
790 int qla4xxx_start_firmware(struct scsi_qla_host *ha) in qla4xxx_start_firmware() argument
798 if (is_qla4022(ha) | is_qla4032(ha)) in qla4xxx_start_firmware()
799 ql4xxx_set_mac_number(ha); in qla4xxx_start_firmware()
801 if (ql4xxx_lock_drvr_wait(ha) != QLA_SUCCESS) in qla4xxx_start_firmware()
804 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_start_firmware()
806 DEBUG2(printk("scsi%ld: %s: port_ctrl = 0x%08X\n", ha->host_no, in qla4xxx_start_firmware()
807 __func__, readw(isp_port_ctrl(ha)))); in qla4xxx_start_firmware()
808 DEBUG(printk("scsi%ld: %s: port_status = 0x%08X\n", ha->host_no, in qla4xxx_start_firmware()
809 __func__, readw(isp_port_status(ha)))); in qla4xxx_start_firmware()
812 if ((readw(isp_port_ctrl(ha)) & 0x8000) != 0) { in qla4xxx_start_firmware()
814 "initialized\n", ha->host_no, __func__)); in qla4xxx_start_firmware()
817 mbox_status = readw(&ha->reg->mailbox[0]); in qla4xxx_start_firmware()
820 "0x%x\n", ha->host_no, __func__, mbox_status)); in qla4xxx_start_firmware()
829 &ha->reg->ctrl_status); in qla4xxx_start_firmware()
830 readl(&ha->reg->ctrl_status); in qla4xxx_start_firmware()
832 &ha->reg->ctrl_status); in qla4xxx_start_firmware()
833 readl(&ha->reg->ctrl_status); in qla4xxx_start_firmware()
834 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_start_firmware()
835 if (qla4xxx_get_firmware_state(ha) == QLA_SUCCESS) { in qla4xxx_start_firmware()
838 ha->host_no, in qla4xxx_start_firmware()
839 __func__, ha->firmware_state)); in qla4xxx_start_firmware()
841 if (ha->firmware_state & in qla4xxx_start_firmware()
847 ha->host_no, __func__, in qla4xxx_start_firmware()
848 ha->firmware_state)); in qla4xxx_start_firmware()
856 "0x%x\n", ha->host_no, __func__, in qla4xxx_start_firmware()
857 ha->firmware_state)); in qla4xxx_start_firmware()
859 spin_lock_irqsave(&ha->hardware_lock, flags); in qla4xxx_start_firmware()
863 "started - resetting\n", ha->host_no, __func__)); in qla4xxx_start_firmware()
865 spin_unlock_irqrestore(&ha->hardware_lock, flags); in qla4xxx_start_firmware()
868 ha->host_no, __func__, soft_reset, config_chip)); in qla4xxx_start_firmware()
870 DEBUG(printk("scsi%ld: %s: Issue Soft Reset\n", ha->host_no, in qla4xxx_start_firmware()
872 status = qla4xxx_soft_reset(ha); /* NOTE: acquires drvr in qla4xxx_start_firmware()
876 ha->host_no, __func__)); in qla4xxx_start_firmware()
877 ql4xxx_unlock_drvr(ha); in qla4xxx_start_firmware()
883 if (ql4xxx_lock_drvr_wait(ha) != QLA_SUCCESS) in qla4xxx_start_firmware()
888 if ((status = qla4xxx_config_nvram(ha)) == QLA_SUCCESS) in qla4xxx_start_firmware()
889 status = qla4xxx_start_firmware_from_flash(ha); in qla4xxx_start_firmware()
892 ql4xxx_unlock_drvr(ha); in qla4xxx_start_firmware()
894 if (test_and_clear_bit(AF_GET_CRASH_RECORD, &ha->flags)) in qla4xxx_start_firmware()
895 qla4xxx_get_crash_record(ha); in qla4xxx_start_firmware()
897 qla4xxx_init_rings(ha); in qla4xxx_start_firmware()
900 ha->host_no, __func__)); in qla4xxx_start_firmware()
912 void qla4xxx_free_ddb_index(struct scsi_qla_host *ha) in qla4xxx_free_ddb_index() argument
919 max_ddbs = is_qla40XX(ha) ? MAX_DEV_DB_ENTRIES_40XX : in qla4xxx_free_ddb_index()
923 ret = qla4xxx_get_fwddb_entry(ha, idx, NULL, 0, NULL, in qla4xxx_free_ddb_index()
932 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_free_ddb_index()
934 ret = qla4xxx_clear_ddb_entry(ha, idx); in qla4xxx_free_ddb_index()
936 ql4_printk(KERN_ERR, ha, in qla4xxx_free_ddb_index()
953 int qla4xxx_initialize_adapter(struct scsi_qla_host *ha, int is_reset) in qla4xxx_initialize_adapter() argument
957 ha->eeprom_cmd_data = 0; in qla4xxx_initialize_adapter()
959 ql4_printk(KERN_INFO, ha, "Configuring PCI space...\n"); in qla4xxx_initialize_adapter()
960 ha->isp_ops->pci_config(ha); in qla4xxx_initialize_adapter()
962 ha->isp_ops->disable_intrs(ha); in qla4xxx_initialize_adapter()
965 if (ha->isp_ops->start_firmware(ha) == QLA_ERROR) in qla4xxx_initialize_adapter()
975 if (is_qla8032(ha) || is_qla8042(ha)) in qla4xxx_initialize_adapter()
976 qla4_83xx_enable_mbox_intrs(ha); in qla4xxx_initialize_adapter()
978 if (qla4xxx_about_firmware(ha) == QLA_ERROR) in qla4xxx_initialize_adapter()
981 if (ha->isp_ops->get_sys_info(ha) == QLA_ERROR) in qla4xxx_initialize_adapter()
984 qla4xxx_init_local_data(ha); in qla4xxx_initialize_adapter()
986 status = qla4xxx_init_firmware(ha); in qla4xxx_initialize_adapter()
991 qla4xxx_build_ddb_list(ha, is_reset); in qla4xxx_initialize_adapter()
993 set_bit(AF_ONLINE, &ha->flags); in qla4xxx_initialize_adapter()
996 DEBUG2(printk("scsi%ld: initialize adapter: %s\n", ha->host_no, in qla4xxx_initialize_adapter()
1001 int qla4xxx_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index, in qla4xxx_ddb_change() argument
1008 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_ddb_change()
1020 qla4xxx_update_session_conn_param(ha, ddb_entry); in qla4xxx_ddb_change()
1046 clear_bit(fw_ddb_index, ha->ddb_idx_map); in qla4xxx_ddb_change()
1056 qla4xxx_update_session_conn_param(ha, ddb_entry); in qla4xxx_ddb_change()
1067 DEBUG2(ql4_printk(KERN_INFO, ha, "%s: Unknown Event\n", in qla4xxx_ddb_change()
1095 int qla4xxx_flash_ddb_change(struct scsi_qla_host *ha, uint32_t fw_ddb_index, in qla4xxx_flash_ddb_change() argument
1102 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_flash_ddb_change()
1115 qla4xxx_update_session_conn_fwddb_param(ha, ddb_entry); in qla4xxx_flash_ddb_change()
1140 qla4xxx_update_session_conn_fwddb_param(ha, ddb_entry); in qla4xxx_flash_ddb_change()
1151 DEBUG2(ql4_printk(KERN_INFO, ha, "%s: Unknown Event\n", in qla4xxx_flash_ddb_change()
1167 int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, in qla4xxx_process_ddb_changed() argument
1178 ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, fw_ddb_index); in qla4xxx_process_ddb_changed()
1181 ql4_printk(KERN_ERR, ha, "%s: No ddb_entry at FW index [%d]\n", in qla4xxx_process_ddb_changed()
1185 clear_bit(fw_ddb_index, ha->ddb_idx_map); in qla4xxx_process_ddb_changed()
1190 ddb_entry->ddb_change(ha, fw_ddb_index, ddb_entry, state); in qla4xxx_process_ddb_changed()
1207 struct scsi_qla_host *ha; in qla4xxx_login_flash_ddb() local
1215 ha = ddb_entry->ha; in qla4xxx_login_flash_ddb()
1217 if (!test_bit(AF_LINK_UP, &ha->flags)) in qla4xxx_login_flash_ddb()
1221 DEBUG2(ql4_printk(KERN_INFO, ha, in qla4xxx_login_flash_ddb()
1226 fw_ddb_entry = dma_pool_alloc(ha->fw_ddb_dma_pool, GFP_KERNEL, in qla4xxx_login_flash_ddb()
1229 DEBUG2(ql4_printk(KERN_ERR, ha, "Out of memory\n")); in qla4xxx_login_flash_ddb()
1234 ret = qla4xxx_get_ddb_index(ha, &ddb_entry->fw_ddb_index); in qla4xxx_login_flash_ddb()
1238 ha->fw_ddb_index_map[ddb_entry->fw_ddb_index] = ddb_entry; in qla4xxx_login_flash_ddb()
1239 ha->tot_ddbs++; in qla4xxx_login_flash_ddb()
1246 ret = qla4xxx_set_ddb_entry(ha, ddb_entry->fw_ddb_index, in qla4xxx_login_flash_ddb()
1249 DEBUG2(ql4_printk(KERN_ERR, ha, "Set DDB failed\n")); in qla4xxx_login_flash_ddb()
1254 ret = qla4xxx_conn_open(ha, ddb_entry->fw_ddb_index); in qla4xxx_login_flash_ddb()
1256 ql4_printk(KERN_ERR, ha, "%s: Login failed: %s\n", __func__, in qla4xxx_login_flash_ddb()
1263 dma_pool_free(ha->fw_ddb_dma_pool, fw_ddb_entry, fw_ddb_dma); in qla4xxx_login_flash_ddb()