diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_nx.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_nx.c | 556 |
1 files changed, 313 insertions, 243 deletions
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c index e1138bcc834c..5cbf33a50b14 100644 --- a/drivers/scsi/qla2xxx/qla_nx.c +++ b/drivers/scsi/qla2xxx/qla_nx.c | |||
@@ -348,6 +348,7 @@ static void | |||
348 | qla82xx_pci_set_crbwindow_2M(struct qla_hw_data *ha, ulong *off) | 348 | qla82xx_pci_set_crbwindow_2M(struct qla_hw_data *ha, ulong *off) |
349 | { | 349 | { |
350 | u32 win_read; | 350 | u32 win_read; |
351 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
351 | 352 | ||
352 | ha->crb_win = CRB_HI(*off); | 353 | ha->crb_win = CRB_HI(*off); |
353 | writel(ha->crb_win, | 354 | writel(ha->crb_win, |
@@ -358,9 +359,10 @@ qla82xx_pci_set_crbwindow_2M(struct qla_hw_data *ha, ulong *off) | |||
358 | */ | 359 | */ |
359 | win_read = RD_REG_DWORD((void *)(CRB_WINDOW_2M + ha->nx_pcibase)); | 360 | win_read = RD_REG_DWORD((void *)(CRB_WINDOW_2M + ha->nx_pcibase)); |
360 | if (win_read != ha->crb_win) { | 361 | if (win_read != ha->crb_win) { |
361 | DEBUG2(qla_printk(KERN_INFO, ha, | 362 | ql_dbg(ql_dbg_p3p, vha, 0xb000, |
362 | "%s: Written crbwin (0x%x) != Read crbwin (0x%x), " | 363 | "%s: Written crbwin (0x%x) " |
363 | "off=0x%lx\n", __func__, ha->crb_win, win_read, *off)); | 364 | "!= Read crbwin (0x%x), off=0x%lx.\n", |
365 | ha->crb_win, win_read, *off); | ||
364 | } | 366 | } |
365 | *off = (*off & MASK(16)) + CRB_INDIRECT_2M + ha->nx_pcibase; | 367 | *off = (*off & MASK(16)) + CRB_INDIRECT_2M + ha->nx_pcibase; |
366 | } | 368 | } |
@@ -368,6 +370,7 @@ qla82xx_pci_set_crbwindow_2M(struct qla_hw_data *ha, ulong *off) | |||
368 | static inline unsigned long | 370 | static inline unsigned long |
369 | qla82xx_pci_set_crbwindow(struct qla_hw_data *ha, u64 off) | 371 | qla82xx_pci_set_crbwindow(struct qla_hw_data *ha, u64 off) |
370 | { | 372 | { |
373 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
371 | /* See if we are currently pointing to the region we want to use next */ | 374 | /* See if we are currently pointing to the region we want to use next */ |
372 | if ((off >= QLA82XX_CRB_PCIX_HOST) && (off < QLA82XX_CRB_DDR_NET)) { | 375 | if ((off >= QLA82XX_CRB_PCIX_HOST) && (off < QLA82XX_CRB_DDR_NET)) { |
373 | /* No need to change window. PCIX and PCIEregs are in both | 376 | /* No need to change window. PCIX and PCIEregs are in both |
@@ -398,9 +401,10 @@ qla82xx_pci_set_crbwindow(struct qla_hw_data *ha, u64 off) | |||
398 | return off; | 401 | return off; |
399 | } | 402 | } |
400 | /* strange address given */ | 403 | /* strange address given */ |
401 | qla_printk(KERN_WARNING, ha, | 404 | ql_dbg(ql_dbg_p3p, vha, 0xb001, |
402 | "%s: Warning: unm_nic_pci_set_crbwindow called with" | 405 | "%x: Warning: unm_nic_pci_set_crbwindow " |
403 | " an unknown address(%llx)\n", QLA2XXX_DRIVER_NAME, off); | 406 | "called with an unknown address(%llx).\n", |
407 | QLA2XXX_DRIVER_NAME, off); | ||
404 | return off; | 408 | return off; |
405 | } | 409 | } |
406 | 410 | ||
@@ -563,6 +567,7 @@ qla82xx_pci_set_window(struct qla_hw_data *ha, unsigned long long addr) | |||
563 | { | 567 | { |
564 | int window; | 568 | int window; |
565 | u32 win_read; | 569 | u32 win_read; |
570 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
566 | 571 | ||
567 | if (QLA82XX_ADDR_IN_RANGE(addr, QLA82XX_ADDR_DDR_NET, | 572 | if (QLA82XX_ADDR_IN_RANGE(addr, QLA82XX_ADDR_DDR_NET, |
568 | QLA82XX_ADDR_DDR_NET_MAX)) { | 573 | QLA82XX_ADDR_DDR_NET_MAX)) { |
@@ -574,8 +579,8 @@ qla82xx_pci_set_window(struct qla_hw_data *ha, unsigned long long addr) | |||
574 | win_read = qla82xx_rd_32(ha, | 579 | win_read = qla82xx_rd_32(ha, |
575 | ha->mn_win_crb | QLA82XX_PCI_CRBSPACE); | 580 | ha->mn_win_crb | QLA82XX_PCI_CRBSPACE); |
576 | if ((win_read << 17) != window) { | 581 | if ((win_read << 17) != window) { |
577 | qla_printk(KERN_WARNING, ha, | 582 | ql_dbg(ql_dbg_p3p, vha, 0xb003, |
578 | "%s: Written MNwin (0x%x) != Read MNwin (0x%x)\n", | 583 | "%s: Written MNwin (0x%x) != Read MNwin (0x%x).\n", |
579 | __func__, window, win_read); | 584 | __func__, window, win_read); |
580 | } | 585 | } |
581 | addr = GET_MEM_OFFS_2M(addr) + QLA82XX_PCI_DDR_NET; | 586 | addr = GET_MEM_OFFS_2M(addr) + QLA82XX_PCI_DDR_NET; |
@@ -583,7 +588,7 @@ qla82xx_pci_set_window(struct qla_hw_data *ha, unsigned long long addr) | |||
583 | QLA82XX_ADDR_OCM0_MAX)) { | 588 | QLA82XX_ADDR_OCM0_MAX)) { |
584 | unsigned int temp1; | 589 | unsigned int temp1; |
585 | if ((addr & 0x00ff800) == 0xff800) { | 590 | if ((addr & 0x00ff800) == 0xff800) { |
586 | qla_printk(KERN_WARNING, ha, | 591 | ql_log(ql_log_warn, vha, 0xb004, |
587 | "%s: QM access not handled.\n", __func__); | 592 | "%s: QM access not handled.\n", __func__); |
588 | addr = -1UL; | 593 | addr = -1UL; |
589 | } | 594 | } |
@@ -596,8 +601,8 @@ qla82xx_pci_set_window(struct qla_hw_data *ha, unsigned long long addr) | |||
596 | temp1 = ((window & 0x1FF) << 7) | | 601 | temp1 = ((window & 0x1FF) << 7) | |
597 | ((window & 0x0FFFE0000) >> 17); | 602 | ((window & 0x0FFFE0000) >> 17); |
598 | if (win_read != temp1) { | 603 | if (win_read != temp1) { |
599 | qla_printk(KERN_WARNING, ha, | 604 | ql_log(ql_log_warn, vha, 0xb005, |
600 | "%s: Written OCMwin (0x%x) != Read OCMwin (0x%x)\n", | 605 | "%s: Written OCMwin (0x%x) != Read OCMwin (0x%x).\n", |
601 | __func__, temp1, win_read); | 606 | __func__, temp1, win_read); |
602 | } | 607 | } |
603 | addr = GET_MEM_OFFS_2M(addr) + QLA82XX_PCI_OCM0_2M; | 608 | addr = GET_MEM_OFFS_2M(addr) + QLA82XX_PCI_OCM0_2M; |
@@ -612,8 +617,8 @@ qla82xx_pci_set_window(struct qla_hw_data *ha, unsigned long long addr) | |||
612 | win_read = qla82xx_rd_32(ha, | 617 | win_read = qla82xx_rd_32(ha, |
613 | ha->ms_win_crb | QLA82XX_PCI_CRBSPACE); | 618 | ha->ms_win_crb | QLA82XX_PCI_CRBSPACE); |
614 | if (win_read != window) { | 619 | if (win_read != window) { |
615 | qla_printk(KERN_WARNING, ha, | 620 | ql_log(ql_log_warn, vha, 0xb006, |
616 | "%s: Written MSwin (0x%x) != Read MSwin (0x%x)\n", | 621 | "%s: Written MSwin (0x%x) != Read MSwin (0x%x).\n", |
617 | __func__, window, win_read); | 622 | __func__, window, win_read); |
618 | } | 623 | } |
619 | addr = GET_MEM_OFFS_2M(addr) + QLA82XX_PCI_QDR_NET; | 624 | addr = GET_MEM_OFFS_2M(addr) + QLA82XX_PCI_QDR_NET; |
@@ -624,9 +629,9 @@ qla82xx_pci_set_window(struct qla_hw_data *ha, unsigned long long addr) | |||
624 | */ | 629 | */ |
625 | if ((qla82xx_pci_set_window_warning_count++ < 8) || | 630 | if ((qla82xx_pci_set_window_warning_count++ < 8) || |
626 | (qla82xx_pci_set_window_warning_count%64 == 0)) { | 631 | (qla82xx_pci_set_window_warning_count%64 == 0)) { |
627 | qla_printk(KERN_WARNING, ha, | 632 | ql_log(ql_log_warn, vha, 0xb007, |
628 | "%s: Warning:%s Unknown address range!\n", __func__, | 633 | "%s: Warning:%s Unknown address range!.\n", |
629 | QLA2XXX_DRIVER_NAME); | 634 | __func__, QLA2XXX_DRIVER_NAME); |
630 | } | 635 | } |
631 | addr = -1UL; | 636 | addr = -1UL; |
632 | } | 637 | } |
@@ -671,6 +676,7 @@ static int qla82xx_pci_mem_read_direct(struct qla_hw_data *ha, | |||
671 | uint8_t *mem_ptr = NULL; | 676 | uint8_t *mem_ptr = NULL; |
672 | unsigned long mem_base; | 677 | unsigned long mem_base; |
673 | unsigned long mem_page; | 678 | unsigned long mem_page; |
679 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
674 | 680 | ||
675 | write_lock_irqsave(&ha->hw_lock, flags); | 681 | write_lock_irqsave(&ha->hw_lock, flags); |
676 | 682 | ||
@@ -682,9 +688,10 @@ static int qla82xx_pci_mem_read_direct(struct qla_hw_data *ha, | |||
682 | if ((start == -1UL) || | 688 | if ((start == -1UL) || |
683 | (qla82xx_pci_is_same_window(ha, off + size - 1) == 0)) { | 689 | (qla82xx_pci_is_same_window(ha, off + size - 1) == 0)) { |
684 | write_unlock_irqrestore(&ha->hw_lock, flags); | 690 | write_unlock_irqrestore(&ha->hw_lock, flags); |
685 | qla_printk(KERN_ERR, ha, | 691 | ql_log(ql_log_fatal, vha, 0xb008, |
686 | "%s out of bound pci memory access. " | 692 | "%s out of bound pci memory " |
687 | "offset is 0x%llx\n", QLA2XXX_DRIVER_NAME, off); | 693 | "access, offset is 0x%llx.\n", |
694 | QLA2XXX_DRIVER_NAME, off); | ||
688 | return -1; | 695 | return -1; |
689 | } | 696 | } |
690 | 697 | ||
@@ -741,6 +748,7 @@ qla82xx_pci_mem_write_direct(struct qla_hw_data *ha, | |||
741 | uint8_t *mem_ptr = NULL; | 748 | uint8_t *mem_ptr = NULL; |
742 | unsigned long mem_base; | 749 | unsigned long mem_base; |
743 | unsigned long mem_page; | 750 | unsigned long mem_page; |
751 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
744 | 752 | ||
745 | write_lock_irqsave(&ha->hw_lock, flags); | 753 | write_lock_irqsave(&ha->hw_lock, flags); |
746 | 754 | ||
@@ -752,9 +760,10 @@ qla82xx_pci_mem_write_direct(struct qla_hw_data *ha, | |||
752 | if ((start == -1UL) || | 760 | if ((start == -1UL) || |
753 | (qla82xx_pci_is_same_window(ha, off + size - 1) == 0)) { | 761 | (qla82xx_pci_is_same_window(ha, off + size - 1) == 0)) { |
754 | write_unlock_irqrestore(&ha->hw_lock, flags); | 762 | write_unlock_irqrestore(&ha->hw_lock, flags); |
755 | qla_printk(KERN_ERR, ha, | 763 | ql_log(ql_log_fatal, vha, 0xb009, |
756 | "%s out of bound pci memory access. " | 764 | "%s out of bount memory " |
757 | "offset is 0x%llx\n", QLA2XXX_DRIVER_NAME, off); | 765 | "access, offset is 0x%llx.\n", |
766 | QLA2XXX_DRIVER_NAME, off); | ||
758 | return -1; | 767 | return -1; |
759 | } | 768 | } |
760 | 769 | ||
@@ -855,15 +864,16 @@ qla82xx_wait_rom_busy(struct qla_hw_data *ha) | |||
855 | { | 864 | { |
856 | long timeout = 0; | 865 | long timeout = 0; |
857 | long done = 0 ; | 866 | long done = 0 ; |
867 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
858 | 868 | ||
859 | while (done == 0) { | 869 | while (done == 0) { |
860 | done = qla82xx_rd_32(ha, QLA82XX_ROMUSB_GLB_STATUS); | 870 | done = qla82xx_rd_32(ha, QLA82XX_ROMUSB_GLB_STATUS); |
861 | done &= 4; | 871 | done &= 4; |
862 | timeout++; | 872 | timeout++; |
863 | if (timeout >= rom_max_timeout) { | 873 | if (timeout >= rom_max_timeout) { |
864 | DEBUG(qla_printk(KERN_INFO, ha, | 874 | ql_dbg(ql_dbg_p3p, vha, 0xb00a, |
865 | "%s: Timeout reached waiting for rom busy", | 875 | "%s: Timeout reached waiting for rom busy.\n", |
866 | QLA2XXX_DRIVER_NAME)); | 876 | QLA2XXX_DRIVER_NAME); |
867 | return -1; | 877 | return -1; |
868 | } | 878 | } |
869 | } | 879 | } |
@@ -875,15 +885,16 @@ qla82xx_wait_rom_done(struct qla_hw_data *ha) | |||
875 | { | 885 | { |
876 | long timeout = 0; | 886 | long timeout = 0; |
877 | long done = 0 ; | 887 | long done = 0 ; |
888 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
878 | 889 | ||
879 | while (done == 0) { | 890 | while (done == 0) { |
880 | done = qla82xx_rd_32(ha, QLA82XX_ROMUSB_GLB_STATUS); | 891 | done = qla82xx_rd_32(ha, QLA82XX_ROMUSB_GLB_STATUS); |
881 | done &= 2; | 892 | done &= 2; |
882 | timeout++; | 893 | timeout++; |
883 | if (timeout >= rom_max_timeout) { | 894 | if (timeout >= rom_max_timeout) { |
884 | DEBUG(qla_printk(KERN_INFO, ha, | 895 | ql_dbg(ql_dbg_p3p, vha, 0xb00b, |
885 | "%s: Timeout reached waiting for rom done", | 896 | "%s: Timeout reached waiting for rom done.\n", |
886 | QLA2XXX_DRIVER_NAME)); | 897 | QLA2XXX_DRIVER_NAME); |
887 | return -1; | 898 | return -1; |
888 | } | 899 | } |
889 | } | 900 | } |
@@ -893,15 +904,16 @@ qla82xx_wait_rom_done(struct qla_hw_data *ha) | |||
893 | static int | 904 | static int |
894 | qla82xx_do_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp) | 905 | qla82xx_do_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp) |
895 | { | 906 | { |
907 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
908 | |||
896 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_ADDRESS, addr); | 909 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_ADDRESS, addr); |
897 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); | 910 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); |
898 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_ABYTE_CNT, 3); | 911 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_ABYTE_CNT, 3); |
899 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, 0xb); | 912 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, 0xb); |
900 | qla82xx_wait_rom_busy(ha); | 913 | qla82xx_wait_rom_busy(ha); |
901 | if (qla82xx_wait_rom_done(ha)) { | 914 | if (qla82xx_wait_rom_done(ha)) { |
902 | qla_printk(KERN_WARNING, ha, | 915 | ql_log(ql_log_fatal, vha, 0x00ba, |
903 | "%s: Error waiting for rom done\n", | 916 | "Error waiting for rom done.\n"); |
904 | QLA2XXX_DRIVER_NAME); | ||
905 | return -1; | 917 | return -1; |
906 | } | 918 | } |
907 | /* Reset abyte_cnt and dummy_byte_cnt */ | 919 | /* Reset abyte_cnt and dummy_byte_cnt */ |
@@ -917,6 +929,7 @@ static int | |||
917 | qla82xx_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp) | 929 | qla82xx_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp) |
918 | { | 930 | { |
919 | int ret, loops = 0; | 931 | int ret, loops = 0; |
932 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
920 | 933 | ||
921 | while ((qla82xx_rom_lock(ha) != 0) && (loops < 50000)) { | 934 | while ((qla82xx_rom_lock(ha) != 0) && (loops < 50000)) { |
922 | udelay(100); | 935 | udelay(100); |
@@ -924,9 +937,8 @@ qla82xx_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp) | |||
924 | loops++; | 937 | loops++; |
925 | } | 938 | } |
926 | if (loops >= 50000) { | 939 | if (loops >= 50000) { |
927 | qla_printk(KERN_INFO, ha, | 940 | ql_log(ql_log_fatal, vha, 0x00b9, |
928 | "%s: qla82xx_rom_lock failed\n", | 941 | "Failed to aquire SEM2 lock.\n"); |
929 | QLA2XXX_DRIVER_NAME); | ||
930 | return -1; | 942 | return -1; |
931 | } | 943 | } |
932 | ret = qla82xx_do_rom_fast_read(ha, addr, valp); | 944 | ret = qla82xx_do_rom_fast_read(ha, addr, valp); |
@@ -937,11 +949,12 @@ qla82xx_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp) | |||
937 | static int | 949 | static int |
938 | qla82xx_read_status_reg(struct qla_hw_data *ha, uint32_t *val) | 950 | qla82xx_read_status_reg(struct qla_hw_data *ha, uint32_t *val) |
939 | { | 951 | { |
952 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
940 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, M25P_INSTR_RDSR); | 953 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, M25P_INSTR_RDSR); |
941 | qla82xx_wait_rom_busy(ha); | 954 | qla82xx_wait_rom_busy(ha); |
942 | if (qla82xx_wait_rom_done(ha)) { | 955 | if (qla82xx_wait_rom_done(ha)) { |
943 | qla_printk(KERN_WARNING, ha, | 956 | ql_log(ql_log_warn, vha, 0xb00c, |
944 | "Error waiting for rom done\n"); | 957 | "Error waiting for rom done.\n"); |
945 | return -1; | 958 | return -1; |
946 | } | 959 | } |
947 | *val = qla82xx_rd_32(ha, QLA82XX_ROMUSB_ROM_RDATA); | 960 | *val = qla82xx_rd_32(ha, QLA82XX_ROMUSB_ROM_RDATA); |
@@ -955,6 +968,7 @@ qla82xx_flash_wait_write_finish(struct qla_hw_data *ha) | |||
955 | uint32_t done = 1 ; | 968 | uint32_t done = 1 ; |
956 | uint32_t val; | 969 | uint32_t val; |
957 | int ret = 0; | 970 | int ret = 0; |
971 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
958 | 972 | ||
959 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_ABYTE_CNT, 0); | 973 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_ABYTE_CNT, 0); |
960 | while ((done != 0) && (ret == 0)) { | 974 | while ((done != 0) && (ret == 0)) { |
@@ -964,8 +978,8 @@ qla82xx_flash_wait_write_finish(struct qla_hw_data *ha) | |||
964 | udelay(10); | 978 | udelay(10); |
965 | cond_resched(); | 979 | cond_resched(); |
966 | if (timeout >= 50000) { | 980 | if (timeout >= 50000) { |
967 | qla_printk(KERN_WARNING, ha, | 981 | ql_log(ql_log_warn, vha, 0xb00d, |
968 | "Timeout reached waiting for write finish"); | 982 | "Timeout reached waiting for write finish.\n"); |
969 | return -1; | 983 | return -1; |
970 | } | 984 | } |
971 | } | 985 | } |
@@ -992,13 +1006,14 @@ qla82xx_flash_set_write_enable(struct qla_hw_data *ha) | |||
992 | static int | 1006 | static int |
993 | qla82xx_write_status_reg(struct qla_hw_data *ha, uint32_t val) | 1007 | qla82xx_write_status_reg(struct qla_hw_data *ha, uint32_t val) |
994 | { | 1008 | { |
1009 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
995 | if (qla82xx_flash_set_write_enable(ha)) | 1010 | if (qla82xx_flash_set_write_enable(ha)) |
996 | return -1; | 1011 | return -1; |
997 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_WDATA, val); | 1012 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_WDATA, val); |
998 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, 0x1); | 1013 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, 0x1); |
999 | if (qla82xx_wait_rom_done(ha)) { | 1014 | if (qla82xx_wait_rom_done(ha)) { |
1000 | qla_printk(KERN_WARNING, ha, | 1015 | ql_log(ql_log_warn, vha, 0xb00e, |
1001 | "Error waiting for rom done\n"); | 1016 | "Error waiting for rom done.\n"); |
1002 | return -1; | 1017 | return -1; |
1003 | } | 1018 | } |
1004 | return qla82xx_flash_wait_write_finish(ha); | 1019 | return qla82xx_flash_wait_write_finish(ha); |
@@ -1007,10 +1022,11 @@ qla82xx_write_status_reg(struct qla_hw_data *ha, uint32_t val) | |||
1007 | static int | 1022 | static int |
1008 | qla82xx_write_disable_flash(struct qla_hw_data *ha) | 1023 | qla82xx_write_disable_flash(struct qla_hw_data *ha) |
1009 | { | 1024 | { |
1025 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
1010 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, M25P_INSTR_WRDI); | 1026 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, M25P_INSTR_WRDI); |
1011 | if (qla82xx_wait_rom_done(ha)) { | 1027 | if (qla82xx_wait_rom_done(ha)) { |
1012 | qla_printk(KERN_WARNING, ha, | 1028 | ql_log(ql_log_warn, vha, 0xb00f, |
1013 | "Error waiting for rom done\n"); | 1029 | "Error waiting for rom done.\n"); |
1014 | return -1; | 1030 | return -1; |
1015 | } | 1031 | } |
1016 | return 0; | 1032 | return 0; |
@@ -1020,13 +1036,16 @@ static int | |||
1020 | ql82xx_rom_lock_d(struct qla_hw_data *ha) | 1036 | ql82xx_rom_lock_d(struct qla_hw_data *ha) |
1021 | { | 1037 | { |
1022 | int loops = 0; | 1038 | int loops = 0; |
1039 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
1040 | |||
1023 | while ((qla82xx_rom_lock(ha) != 0) && (loops < 50000)) { | 1041 | while ((qla82xx_rom_lock(ha) != 0) && (loops < 50000)) { |
1024 | udelay(100); | 1042 | udelay(100); |
1025 | cond_resched(); | 1043 | cond_resched(); |
1026 | loops++; | 1044 | loops++; |
1027 | } | 1045 | } |
1028 | if (loops >= 50000) { | 1046 | if (loops >= 50000) { |
1029 | qla_printk(KERN_WARNING, ha, "ROM lock failed\n"); | 1047 | ql_log(ql_log_warn, vha, 0xb010, |
1048 | "ROM lock failed.\n"); | ||
1030 | return -1; | 1049 | return -1; |
1031 | } | 1050 | } |
1032 | return 0;; | 1051 | return 0;; |
@@ -1037,10 +1056,12 @@ qla82xx_write_flash_dword(struct qla_hw_data *ha, uint32_t flashaddr, | |||
1037 | uint32_t data) | 1056 | uint32_t data) |
1038 | { | 1057 | { |
1039 | int ret = 0; | 1058 | int ret = 0; |
1059 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
1040 | 1060 | ||
1041 | ret = ql82xx_rom_lock_d(ha); | 1061 | ret = ql82xx_rom_lock_d(ha); |
1042 | if (ret < 0) { | 1062 | if (ret < 0) { |
1043 | qla_printk(KERN_WARNING, ha, "ROM Lock failed\n"); | 1063 | ql_log(ql_log_warn, vha, 0xb011, |
1064 | "ROM lock failed.\n"); | ||
1044 | return ret; | 1065 | return ret; |
1045 | } | 1066 | } |
1046 | 1067 | ||
@@ -1053,8 +1074,8 @@ qla82xx_write_flash_dword(struct qla_hw_data *ha, uint32_t flashaddr, | |||
1053 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, M25P_INSTR_PP); | 1074 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, M25P_INSTR_PP); |
1054 | qla82xx_wait_rom_busy(ha); | 1075 | qla82xx_wait_rom_busy(ha); |
1055 | if (qla82xx_wait_rom_done(ha)) { | 1076 | if (qla82xx_wait_rom_done(ha)) { |
1056 | qla_printk(KERN_WARNING, ha, | 1077 | ql_log(ql_log_warn, vha, 0xb012, |
1057 | "Error waiting for rom done\n"); | 1078 | "Error waiting for rom done.\n"); |
1058 | ret = -1; | 1079 | ret = -1; |
1059 | goto done_write; | 1080 | goto done_write; |
1060 | } | 1081 | } |
@@ -1159,8 +1180,8 @@ qla82xx_pinit_from_rom(scsi_qla_host_t *vha) | |||
1159 | */ | 1180 | */ |
1160 | if (qla82xx_rom_fast_read(ha, 0, &n) != 0 || n != 0xcafecafeUL || | 1181 | if (qla82xx_rom_fast_read(ha, 0, &n) != 0 || n != 0xcafecafeUL || |
1161 | qla82xx_rom_fast_read(ha, 4, &n) != 0) { | 1182 | qla82xx_rom_fast_read(ha, 4, &n) != 0) { |
1162 | qla_printk(KERN_WARNING, ha, | 1183 | ql_log(ql_log_fatal, vha, 0x006e, |
1163 | "[ERROR] Reading crb_init area: n: %08x\n", n); | 1184 | "Error Reading crb_init area: n: %08x.\n", n); |
1164 | return -1; | 1185 | return -1; |
1165 | } | 1186 | } |
1166 | 1187 | ||
@@ -1172,20 +1193,18 @@ qla82xx_pinit_from_rom(scsi_qla_host_t *vha) | |||
1172 | 1193 | ||
1173 | /* number of addr/value pair should not exceed 1024 enteries */ | 1194 | /* number of addr/value pair should not exceed 1024 enteries */ |
1174 | if (n >= 1024) { | 1195 | if (n >= 1024) { |
1175 | qla_printk(KERN_WARNING, ha, | 1196 | ql_log(ql_log_fatal, vha, 0x0071, |
1176 | "%s: %s:n=0x%x [ERROR] Card flash not initialized.\n", | 1197 | "Card flash not initialized:n=0x%x.\n", n); |
1177 | QLA2XXX_DRIVER_NAME, __func__, n); | ||
1178 | return -1; | 1198 | return -1; |
1179 | } | 1199 | } |
1180 | 1200 | ||
1181 | qla_printk(KERN_INFO, ha, | 1201 | ql_log(ql_log_info, vha, 0x0072, |
1182 | "%s: %d CRB init values found in ROM.\n", QLA2XXX_DRIVER_NAME, n); | 1202 | "%d CRB init values found in ROM.\n", n); |
1183 | 1203 | ||
1184 | buf = kmalloc(n * sizeof(struct crb_addr_pair), GFP_KERNEL); | 1204 | buf = kmalloc(n * sizeof(struct crb_addr_pair), GFP_KERNEL); |
1185 | if (buf == NULL) { | 1205 | if (buf == NULL) { |
1186 | qla_printk(KERN_WARNING, ha, | 1206 | ql_log(ql_log_fatal, vha, 0x010c, |
1187 | "%s: [ERROR] Unable to malloc memory.\n", | 1207 | "Unable to allocate memory.\n"); |
1188 | QLA2XXX_DRIVER_NAME); | ||
1189 | return -1; | 1208 | return -1; |
1190 | } | 1209 | } |
1191 | 1210 | ||
@@ -1236,9 +1255,8 @@ qla82xx_pinit_from_rom(scsi_qla_host_t *vha) | |||
1236 | continue; | 1255 | continue; |
1237 | 1256 | ||
1238 | if (off == ADDR_ERROR) { | 1257 | if (off == ADDR_ERROR) { |
1239 | qla_printk(KERN_WARNING, ha, | 1258 | ql_log(ql_log_fatal, vha, 0x0116, |
1240 | "%s: [ERROR] Unknown addr: 0x%08lx\n", | 1259 | "Unknow addr: 0x%08lx.\n", buf[i].addr); |
1241 | QLA2XXX_DRIVER_NAME, buf[i].addr); | ||
1242 | continue; | 1260 | continue; |
1243 | } | 1261 | } |
1244 | 1262 | ||
@@ -1370,7 +1388,7 @@ qla82xx_pci_mem_write_2M(struct qla_hw_data *ha, | |||
1370 | if (j >= MAX_CTL_CHECK) { | 1388 | if (j >= MAX_CTL_CHECK) { |
1371 | if (printk_ratelimit()) | 1389 | if (printk_ratelimit()) |
1372 | dev_err(&ha->pdev->dev, | 1390 | dev_err(&ha->pdev->dev, |
1373 | "failed to write through agent\n"); | 1391 | "failed to write through agent.\n"); |
1374 | ret = -1; | 1392 | ret = -1; |
1375 | break; | 1393 | break; |
1376 | } | 1394 | } |
@@ -1460,7 +1478,7 @@ qla82xx_pci_mem_read_2M(struct qla_hw_data *ha, | |||
1460 | if (j >= MAX_CTL_CHECK) { | 1478 | if (j >= MAX_CTL_CHECK) { |
1461 | if (printk_ratelimit()) | 1479 | if (printk_ratelimit()) |
1462 | dev_err(&ha->pdev->dev, | 1480 | dev_err(&ha->pdev->dev, |
1463 | "failed to read through agent\n"); | 1481 | "failed to read through agent.\n"); |
1464 | break; | 1482 | break; |
1465 | } | 1483 | } |
1466 | 1484 | ||
@@ -1633,17 +1651,15 @@ qla82xx_iospace_config(struct qla_hw_data *ha) | |||
1633 | uint32_t len = 0; | 1651 | uint32_t len = 0; |
1634 | 1652 | ||
1635 | if (pci_request_regions(ha->pdev, QLA2XXX_DRIVER_NAME)) { | 1653 | if (pci_request_regions(ha->pdev, QLA2XXX_DRIVER_NAME)) { |
1636 | qla_printk(KERN_WARNING, ha, | 1654 | ql_log_pci(ql_log_fatal, ha->pdev, 0x000c, |
1637 | "Failed to reserve selected regions (%s)\n", | 1655 | "Failed to reserver selected regions.\n"); |
1638 | pci_name(ha->pdev)); | ||
1639 | goto iospace_error_exit; | 1656 | goto iospace_error_exit; |
1640 | } | 1657 | } |
1641 | 1658 | ||
1642 | /* Use MMIO operations for all accesses. */ | 1659 | /* Use MMIO operations for all accesses. */ |
1643 | if (!(pci_resource_flags(ha->pdev, 0) & IORESOURCE_MEM)) { | 1660 | if (!(pci_resource_flags(ha->pdev, 0) & IORESOURCE_MEM)) { |
1644 | qla_printk(KERN_ERR, ha, | 1661 | ql_log_pci(ql_log_fatal, ha->pdev, 0x000d, |
1645 | "region #0 not an MMIO resource (%s), aborting\n", | 1662 | "Region #0 not an MMIO resource, aborting.\n"); |
1646 | pci_name(ha->pdev)); | ||
1647 | goto iospace_error_exit; | 1663 | goto iospace_error_exit; |
1648 | } | 1664 | } |
1649 | 1665 | ||
@@ -1651,9 +1667,8 @@ qla82xx_iospace_config(struct qla_hw_data *ha) | |||
1651 | ha->nx_pcibase = | 1667 | ha->nx_pcibase = |
1652 | (unsigned long)ioremap(pci_resource_start(ha->pdev, 0), len); | 1668 | (unsigned long)ioremap(pci_resource_start(ha->pdev, 0), len); |
1653 | if (!ha->nx_pcibase) { | 1669 | if (!ha->nx_pcibase) { |
1654 | qla_printk(KERN_ERR, ha, | 1670 | ql_log_pci(ql_log_fatal, ha->pdev, 0x000e, |
1655 | "cannot remap pcibase MMIO (%s), aborting\n", | 1671 | "Cannot remap pcibase MMIO, aborting.\n"); |
1656 | pci_name(ha->pdev)); | ||
1657 | pci_release_regions(ha->pdev); | 1672 | pci_release_regions(ha->pdev); |
1658 | goto iospace_error_exit; | 1673 | goto iospace_error_exit; |
1659 | } | 1674 | } |
@@ -1667,9 +1682,8 @@ qla82xx_iospace_config(struct qla_hw_data *ha) | |||
1667 | (unsigned long)ioremap((pci_resource_start(ha->pdev, 4) + | 1682 | (unsigned long)ioremap((pci_resource_start(ha->pdev, 4) + |
1668 | (ha->pdev->devfn << 12)), 4); | 1683 | (ha->pdev->devfn << 12)), 4); |
1669 | if (!ha->nxdb_wr_ptr) { | 1684 | if (!ha->nxdb_wr_ptr) { |
1670 | qla_printk(KERN_ERR, ha, | 1685 | ql_log_pci(ql_log_fatal, ha->pdev, 0x000f, |
1671 | "cannot remap MMIO (%s), aborting\n", | 1686 | "Cannot remap MMIO, aborting.\n"); |
1672 | pci_name(ha->pdev)); | ||
1673 | pci_release_regions(ha->pdev); | 1687 | pci_release_regions(ha->pdev); |
1674 | goto iospace_error_exit; | 1688 | goto iospace_error_exit; |
1675 | } | 1689 | } |
@@ -1687,6 +1701,16 @@ qla82xx_iospace_config(struct qla_hw_data *ha) | |||
1687 | 1701 | ||
1688 | ha->max_req_queues = ha->max_rsp_queues = 1; | 1702 | ha->max_req_queues = ha->max_rsp_queues = 1; |
1689 | ha->msix_count = ha->max_rsp_queues + 1; | 1703 | ha->msix_count = ha->max_rsp_queues + 1; |
1704 | ql_dbg_pci(ql_dbg_multiq, ha->pdev, 0xc006, | ||
1705 | "nx_pci_base=%p iobase=%p " | ||
1706 | "max_req_queues=%d msix_count=%d.\n", | ||
1707 | ha->nx_pcibase, ha->iobase, | ||
1708 | ha->max_req_queues, ha->msix_count); | ||
1709 | ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0010, | ||
1710 | "nx_pci_base=%p iobase=%p " | ||
1711 | "max_req_queues=%d msix_count=%d.\n", | ||
1712 | ha->nx_pcibase, ha->iobase, | ||
1713 | ha->max_req_queues, ha->msix_count); | ||
1690 | return 0; | 1714 | return 0; |
1691 | 1715 | ||
1692 | iospace_error_exit: | 1716 | iospace_error_exit: |
@@ -1712,6 +1736,9 @@ qla82xx_pci_config(scsi_qla_host_t *vha) | |||
1712 | pci_set_master(ha->pdev); | 1736 | pci_set_master(ha->pdev); |
1713 | ret = pci_set_mwi(ha->pdev); | 1737 | ret = pci_set_mwi(ha->pdev); |
1714 | ha->chip_revision = ha->pdev->revision; | 1738 | ha->chip_revision = ha->pdev->revision; |
1739 | ql_dbg(ql_dbg_init, vha, 0x0043, | ||
1740 | "Chip revision:%ld.\n", | ||
1741 | ha->chip_revision); | ||
1715 | return 0; | 1742 | return 0; |
1716 | } | 1743 | } |
1717 | 1744 | ||
@@ -1877,6 +1904,7 @@ qla82xx_check_cmdpeg_state(struct qla_hw_data *ha) | |||
1877 | { | 1904 | { |
1878 | u32 val = 0; | 1905 | u32 val = 0; |
1879 | int retries = 60; | 1906 | int retries = 60; |
1907 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
1880 | 1908 | ||
1881 | do { | 1909 | do { |
1882 | read_lock(&ha->hw_lock); | 1910 | read_lock(&ha->hw_lock); |
@@ -1892,15 +1920,15 @@ qla82xx_check_cmdpeg_state(struct qla_hw_data *ha) | |||
1892 | default: | 1920 | default: |
1893 | break; | 1921 | break; |
1894 | } | 1922 | } |
1895 | qla_printk(KERN_WARNING, ha, | 1923 | ql_log(ql_log_info, vha, 0x00a8, |
1896 | "CRB_CMDPEG_STATE: 0x%x and retries: 0x%x\n", | 1924 | "CRB_CMDPEG_STATE: 0x%x and retries:0x%x.\n", |
1897 | val, retries); | 1925 | val, retries); |
1898 | 1926 | ||
1899 | msleep(500); | 1927 | msleep(500); |
1900 | 1928 | ||
1901 | } while (--retries); | 1929 | } while (--retries); |
1902 | 1930 | ||
1903 | qla_printk(KERN_INFO, ha, | 1931 | ql_log(ql_log_fatal, vha, 0x00a9, |
1904 | "Cmd Peg initialization failed: 0x%x.\n", val); | 1932 | "Cmd Peg initialization failed: 0x%x.\n", val); |
1905 | 1933 | ||
1906 | val = qla82xx_rd_32(ha, QLA82XX_ROMUSB_GLB_PEGTUNE_DONE); | 1934 | val = qla82xx_rd_32(ha, QLA82XX_ROMUSB_GLB_PEGTUNE_DONE); |
@@ -1915,6 +1943,7 @@ qla82xx_check_rcvpeg_state(struct qla_hw_data *ha) | |||
1915 | { | 1943 | { |
1916 | u32 val = 0; | 1944 | u32 val = 0; |
1917 | int retries = 60; | 1945 | int retries = 60; |
1946 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
1918 | 1947 | ||
1919 | do { | 1948 | do { |
1920 | read_lock(&ha->hw_lock); | 1949 | read_lock(&ha->hw_lock); |
@@ -1930,17 +1959,16 @@ qla82xx_check_rcvpeg_state(struct qla_hw_data *ha) | |||
1930 | default: | 1959 | default: |
1931 | break; | 1960 | break; |
1932 | } | 1961 | } |
1933 | 1962 | ql_log(ql_log_info, vha, 0x00ab, | |
1934 | qla_printk(KERN_WARNING, ha, | 1963 | "CRB_RCVPEG_STATE: 0x%x and retries: 0x%x.\n", |
1935 | "CRB_RCVPEG_STATE: 0x%x and retries: 0x%x\n", | 1964 | val, retries); |
1936 | val, retries); | ||
1937 | 1965 | ||
1938 | msleep(500); | 1966 | msleep(500); |
1939 | 1967 | ||
1940 | } while (--retries); | 1968 | } while (--retries); |
1941 | 1969 | ||
1942 | qla_printk(KERN_INFO, ha, | 1970 | ql_log(ql_log_fatal, vha, 0x00ac, |
1943 | "Rcv Peg initialization failed: 0x%x.\n", val); | 1971 | "Rcv Peg initializatin failed: 0x%x.\n", val); |
1944 | read_lock(&ha->hw_lock); | 1972 | read_lock(&ha->hw_lock); |
1945 | qla82xx_wr_32(ha, CRB_RCVPEG_STATE, PHAN_INITIALIZE_FAILED); | 1973 | qla82xx_wr_32(ha, CRB_RCVPEG_STATE, PHAN_INITIALIZE_FAILED); |
1946 | read_unlock(&ha->hw_lock); | 1974 | read_unlock(&ha->hw_lock); |
@@ -1989,13 +2017,11 @@ qla82xx_mbx_completion(scsi_qla_host_t *vha, uint16_t mb0) | |||
1989 | } | 2017 | } |
1990 | 2018 | ||
1991 | if (ha->mcp) { | 2019 | if (ha->mcp) { |
1992 | DEBUG3_11(printk(KERN_INFO "%s(%ld): " | 2020 | ql_dbg(ql_dbg_async, vha, 0x5052, |
1993 | "Got mailbox completion. cmd=%x.\n", | 2021 | "Got mailbox completion. cmd=%x.\n", ha->mcp->mb[0]); |
1994 | __func__, vha->host_no, ha->mcp->mb[0])); | ||
1995 | } else { | 2022 | } else { |
1996 | qla_printk(KERN_INFO, ha, | 2023 | ql_dbg(ql_dbg_async, vha, 0x5053, |
1997 | "%s(%ld): MBX pointer ERROR!\n", | 2024 | "MBX pointer ERROR.\n"); |
1998 | __func__, vha->host_no); | ||
1999 | } | 2025 | } |
2000 | } | 2026 | } |
2001 | 2027 | ||
@@ -2019,13 +2045,13 @@ qla82xx_intr_handler(int irq, void *dev_id) | |||
2019 | int status = 0, status1 = 0; | 2045 | int status = 0, status1 = 0; |
2020 | unsigned long flags; | 2046 | unsigned long flags; |
2021 | unsigned long iter; | 2047 | unsigned long iter; |
2022 | uint32_t stat; | 2048 | uint32_t stat = 0; |
2023 | uint16_t mb[4]; | 2049 | uint16_t mb[4]; |
2024 | 2050 | ||
2025 | rsp = (struct rsp_que *) dev_id; | 2051 | rsp = (struct rsp_que *) dev_id; |
2026 | if (!rsp) { | 2052 | if (!rsp) { |
2027 | printk(KERN_INFO | 2053 | printk(KERN_INFO |
2028 | "%s(): NULL response queue pointer\n", __func__); | 2054 | "%s(): NULL response queue pointer.\n", __func__); |
2029 | return IRQ_NONE; | 2055 | return IRQ_NONE; |
2030 | } | 2056 | } |
2031 | ha = rsp->hw; | 2057 | ha = rsp->hw; |
@@ -2075,9 +2101,9 @@ qla82xx_intr_handler(int irq, void *dev_id) | |||
2075 | qla24xx_process_response_queue(vha, rsp); | 2101 | qla24xx_process_response_queue(vha, rsp); |
2076 | break; | 2102 | break; |
2077 | default: | 2103 | default: |
2078 | DEBUG2(printk("scsi(%ld): " | 2104 | ql_dbg(ql_dbg_async, vha, 0x5054, |
2079 | " Unrecognized interrupt type (%d).\n", | 2105 | "Unrecognized interrupt type (%d).\n", |
2080 | vha->host_no, stat & 0xff)); | 2106 | stat & 0xff); |
2081 | break; | 2107 | break; |
2082 | } | 2108 | } |
2083 | } | 2109 | } |
@@ -2089,8 +2115,8 @@ qla82xx_intr_handler(int irq, void *dev_id) | |||
2089 | 2115 | ||
2090 | #ifdef QL_DEBUG_LEVEL_17 | 2116 | #ifdef QL_DEBUG_LEVEL_17 |
2091 | if (!irq && ha->flags.eeh_busy) | 2117 | if (!irq && ha->flags.eeh_busy) |
2092 | qla_printk(KERN_WARNING, ha, | 2118 | ql_log(ql_log_warn, vha, 0x503d, |
2093 | "isr: status %x, cmd_flags %lx, mbox_int %x, stat %x\n", | 2119 | "isr:status %x, cmd_flags %lx, mbox_int %x, stat %x.\n", |
2094 | status, ha->mbx_cmd_flags, ha->flags.mbox_int, stat); | 2120 | status, ha->mbx_cmd_flags, ha->flags.mbox_int, stat); |
2095 | #endif | 2121 | #endif |
2096 | 2122 | ||
@@ -2111,13 +2137,13 @@ qla82xx_msix_default(int irq, void *dev_id) | |||
2111 | struct device_reg_82xx __iomem *reg; | 2137 | struct device_reg_82xx __iomem *reg; |
2112 | int status = 0; | 2138 | int status = 0; |
2113 | unsigned long flags; | 2139 | unsigned long flags; |
2114 | uint32_t stat; | 2140 | uint32_t stat = 0; |
2115 | uint16_t mb[4]; | 2141 | uint16_t mb[4]; |
2116 | 2142 | ||
2117 | rsp = (struct rsp_que *) dev_id; | 2143 | rsp = (struct rsp_que *) dev_id; |
2118 | if (!rsp) { | 2144 | if (!rsp) { |
2119 | printk(KERN_INFO | 2145 | printk(KERN_INFO |
2120 | "%s(): NULL response queue pointer\n", __func__); | 2146 | "%s(): NULL response queue pointer.\n", __func__); |
2121 | return IRQ_NONE; | 2147 | return IRQ_NONE; |
2122 | } | 2148 | } |
2123 | ha = rsp->hw; | 2149 | ha = rsp->hw; |
@@ -2149,9 +2175,9 @@ qla82xx_msix_default(int irq, void *dev_id) | |||
2149 | qla24xx_process_response_queue(vha, rsp); | 2175 | qla24xx_process_response_queue(vha, rsp); |
2150 | break; | 2176 | break; |
2151 | default: | 2177 | default: |
2152 | DEBUG2(printk("scsi(%ld): " | 2178 | ql_dbg(ql_dbg_async, vha, 0x5041, |
2153 | " Unrecognized interrupt type (%d).\n", | 2179 | "Unrecognized interrupt type (%d).\n", |
2154 | vha->host_no, stat & 0xff)); | 2180 | stat & 0xff); |
2155 | break; | 2181 | break; |
2156 | } | 2182 | } |
2157 | } | 2183 | } |
@@ -2162,9 +2188,9 @@ qla82xx_msix_default(int irq, void *dev_id) | |||
2162 | 2188 | ||
2163 | #ifdef QL_DEBUG_LEVEL_17 | 2189 | #ifdef QL_DEBUG_LEVEL_17 |
2164 | if (!irq && ha->flags.eeh_busy) | 2190 | if (!irq && ha->flags.eeh_busy) |
2165 | qla_printk(KERN_WARNING, ha, | 2191 | ql_log(ql_log_warn, vha, 0x5044, |
2166 | "isr: status %x, cmd_flags %lx, mbox_int %x, stat %x\n", | 2192 | "isr:status %x, cmd_flags %lx, mbox_int %x, stat %x.\n", |
2167 | status, ha->mbx_cmd_flags, ha->flags.mbox_int, stat); | 2193 | status, ha->mbx_cmd_flags, ha->flags.mbox_int, stat); |
2168 | #endif | 2194 | #endif |
2169 | 2195 | ||
2170 | if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && | 2196 | if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && |
@@ -2186,7 +2212,7 @@ qla82xx_msix_rsp_q(int irq, void *dev_id) | |||
2186 | rsp = (struct rsp_que *) dev_id; | 2212 | rsp = (struct rsp_que *) dev_id; |
2187 | if (!rsp) { | 2213 | if (!rsp) { |
2188 | printk(KERN_INFO | 2214 | printk(KERN_INFO |
2189 | "%s(): NULL response queue pointer\n", __func__); | 2215 | "%s(): NULL response queue pointer.\n", __func__); |
2190 | return IRQ_NONE; | 2216 | return IRQ_NONE; |
2191 | } | 2217 | } |
2192 | 2218 | ||
@@ -2215,7 +2241,7 @@ qla82xx_poll(int irq, void *dev_id) | |||
2215 | rsp = (struct rsp_que *) dev_id; | 2241 | rsp = (struct rsp_que *) dev_id; |
2216 | if (!rsp) { | 2242 | if (!rsp) { |
2217 | printk(KERN_INFO | 2243 | printk(KERN_INFO |
2218 | "%s(): NULL response queue pointer\n", __func__); | 2244 | "%s(): NULL response queue pointer.\n", __func__); |
2219 | return; | 2245 | return; |
2220 | } | 2246 | } |
2221 | ha = rsp->hw; | 2247 | ha = rsp->hw; |
@@ -2245,9 +2271,9 @@ qla82xx_poll(int irq, void *dev_id) | |||
2245 | qla24xx_process_response_queue(vha, rsp); | 2271 | qla24xx_process_response_queue(vha, rsp); |
2246 | break; | 2272 | break; |
2247 | default: | 2273 | default: |
2248 | DEBUG2(printk("scsi(%ld): Unrecognized interrupt type " | 2274 | ql_dbg(ql_dbg_p3p, vha, 0xb013, |
2249 | "(%d).\n", | 2275 | "Unrecognized interrupt type (%d).\n", |
2250 | vha->host_no, stat & 0xff)); | 2276 | stat * 0xff); |
2251 | break; | 2277 | break; |
2252 | } | 2278 | } |
2253 | } | 2279 | } |
@@ -2347,9 +2373,8 @@ qla82xx_set_rst_ready(struct qla_hw_data *ha) | |||
2347 | drv_state = qla82xx_rd_32(ha, QLA82XX_CRB_DRV_STATE); | 2373 | drv_state = qla82xx_rd_32(ha, QLA82XX_CRB_DRV_STATE); |
2348 | } | 2374 | } |
2349 | drv_state |= (QLA82XX_DRVST_RST_RDY << (ha->portnum * 4)); | 2375 | drv_state |= (QLA82XX_DRVST_RST_RDY << (ha->portnum * 4)); |
2350 | qla_printk(KERN_INFO, ha, | 2376 | ql_log(ql_log_info, vha, 0x00bb, |
2351 | "%s(%ld):drv_state = 0x%x\n", | 2377 | "drv_state = 0x%x.\n", drv_state); |
2352 | __func__, vha->host_no, drv_state); | ||
2353 | qla82xx_wr_32(ha, QLA82XX_CRB_DRV_STATE, drv_state); | 2378 | qla82xx_wr_32(ha, QLA82XX_CRB_DRV_STATE, drv_state); |
2354 | } | 2379 | } |
2355 | 2380 | ||
@@ -2392,8 +2417,8 @@ qla82xx_load_fw(scsi_qla_host_t *vha) | |||
2392 | struct qla_hw_data *ha = vha->hw; | 2417 | struct qla_hw_data *ha = vha->hw; |
2393 | 2418 | ||
2394 | if (qla82xx_pinit_from_rom(vha) != QLA_SUCCESS) { | 2419 | if (qla82xx_pinit_from_rom(vha) != QLA_SUCCESS) { |
2395 | qla_printk(KERN_ERR, ha, | 2420 | ql_log(ql_log_fatal, vha, 0x009f, |
2396 | "%s: Error during CRB Initialization\n", __func__); | 2421 | "Error during CRB initialization.\n"); |
2397 | return QLA_FUNCTION_FAILED; | 2422 | return QLA_FUNCTION_FAILED; |
2398 | } | 2423 | } |
2399 | udelay(500); | 2424 | udelay(500); |
@@ -2411,27 +2436,27 @@ qla82xx_load_fw(scsi_qla_host_t *vha) | |||
2411 | if (ql2xfwloadbin == 2) | 2436 | if (ql2xfwloadbin == 2) |
2412 | goto try_blob_fw; | 2437 | goto try_blob_fw; |
2413 | 2438 | ||
2414 | qla_printk(KERN_INFO, ha, | 2439 | ql_log(ql_log_info, vha, 0x00a0, |
2415 | "Attempting to load firmware from flash\n"); | 2440 | "Attempting to load firmware from flash.\n"); |
2416 | 2441 | ||
2417 | if (qla82xx_fw_load_from_flash(ha) == QLA_SUCCESS) { | 2442 | if (qla82xx_fw_load_from_flash(ha) == QLA_SUCCESS) { |
2418 | qla_printk(KERN_ERR, ha, | 2443 | ql_log(ql_log_info, vha, 0x00a1, |
2419 | "Firmware loaded successfully from flash\n"); | 2444 | "Firmware loaded successully from flash.\n"); |
2420 | return QLA_SUCCESS; | 2445 | return QLA_SUCCESS; |
2421 | } else { | 2446 | } else { |
2422 | qla_printk(KERN_ERR, ha, | 2447 | ql_log(ql_log_warn, vha, 0x0108, |
2423 | "Firmware load from flash failed\n"); | 2448 | "Firmware load from flash failed.\n"); |
2424 | } | 2449 | } |
2425 | 2450 | ||
2426 | try_blob_fw: | 2451 | try_blob_fw: |
2427 | qla_printk(KERN_INFO, ha, | 2452 | ql_log(ql_log_info, vha, 0x00a2, |
2428 | "Attempting to load firmware from blob\n"); | 2453 | "Attempting to load firmware from blob.\n"); |
2429 | 2454 | ||
2430 | /* Load firmware blob. */ | 2455 | /* Load firmware blob. */ |
2431 | blob = ha->hablob = qla2x00_request_firmware(vha); | 2456 | blob = ha->hablob = qla2x00_request_firmware(vha); |
2432 | if (!blob) { | 2457 | if (!blob) { |
2433 | qla_printk(KERN_ERR, ha, | 2458 | ql_log(ql_log_fatal, vha, 0x00a3, |
2434 | "Firmware image not present.\n"); | 2459 | "Firmware image not preset.\n"); |
2435 | goto fw_load_failed; | 2460 | goto fw_load_failed; |
2436 | } | 2461 | } |
2437 | 2462 | ||
@@ -2441,20 +2466,19 @@ try_blob_fw: | |||
2441 | /* Fallback to URI format */ | 2466 | /* Fallback to URI format */ |
2442 | if (qla82xx_validate_firmware_blob(vha, | 2467 | if (qla82xx_validate_firmware_blob(vha, |
2443 | QLA82XX_UNIFIED_ROMIMAGE)) { | 2468 | QLA82XX_UNIFIED_ROMIMAGE)) { |
2444 | qla_printk(KERN_ERR, ha, | 2469 | ql_log(ql_log_fatal, vha, 0x00a4, |
2445 | "No valid firmware image found!!!"); | 2470 | "No valid firmware image found.\n"); |
2446 | return QLA_FUNCTION_FAILED; | 2471 | return QLA_FUNCTION_FAILED; |
2447 | } | 2472 | } |
2448 | } | 2473 | } |
2449 | 2474 | ||
2450 | if (qla82xx_fw_load_from_blob(ha) == QLA_SUCCESS) { | 2475 | if (qla82xx_fw_load_from_blob(ha) == QLA_SUCCESS) { |
2451 | qla_printk(KERN_ERR, ha, | 2476 | ql_log(ql_log_info, vha, 0x00a5, |
2452 | "%s: Firmware loaded successfully " | 2477 | "Firmware loaded successfully from binary blob.\n"); |
2453 | " from binary blob\n", __func__); | ||
2454 | return QLA_SUCCESS; | 2478 | return QLA_SUCCESS; |
2455 | } else { | 2479 | } else { |
2456 | qla_printk(KERN_ERR, ha, | 2480 | ql_log(ql_log_fatal, vha, 0x00a6, |
2457 | "Firmware load failed from binary blob\n"); | 2481 | "Firmware load failed for binary blob.\n"); |
2458 | blob->fw = NULL; | 2482 | blob->fw = NULL; |
2459 | blob = NULL; | 2483 | blob = NULL; |
2460 | goto fw_load_failed; | 2484 | goto fw_load_failed; |
@@ -2486,15 +2510,15 @@ qla82xx_start_firmware(scsi_qla_host_t *vha) | |||
2486 | qla82xx_wr_32(ha, QLA82XX_PEG_HALT_STATUS2, 0); | 2510 | qla82xx_wr_32(ha, QLA82XX_PEG_HALT_STATUS2, 0); |
2487 | 2511 | ||
2488 | if (qla82xx_load_fw(vha) != QLA_SUCCESS) { | 2512 | if (qla82xx_load_fw(vha) != QLA_SUCCESS) { |
2489 | qla_printk(KERN_INFO, ha, | 2513 | ql_log(ql_log_fatal, vha, 0x00a7, |
2490 | "%s: Error trying to start fw!\n", __func__); | 2514 | "Error trying to start fw.\n"); |
2491 | return QLA_FUNCTION_FAILED; | 2515 | return QLA_FUNCTION_FAILED; |
2492 | } | 2516 | } |
2493 | 2517 | ||
2494 | /* Handshake with the card before we register the devices. */ | 2518 | /* Handshake with the card before we register the devices. */ |
2495 | if (qla82xx_check_cmdpeg_state(ha) != QLA_SUCCESS) { | 2519 | if (qla82xx_check_cmdpeg_state(ha) != QLA_SUCCESS) { |
2496 | qla_printk(KERN_INFO, ha, | 2520 | ql_log(ql_log_fatal, vha, 0x00aa, |
2497 | "%s: Error during card handshake!\n", __func__); | 2521 | "Error during card handshake.\n"); |
2498 | return QLA_FUNCTION_FAILED; | 2522 | return QLA_FUNCTION_FAILED; |
2499 | } | 2523 | } |
2500 | 2524 | ||
@@ -2663,8 +2687,11 @@ qla82xx_start_scsi(srb_t *sp) | |||
2663 | /* Send marker if required */ | 2687 | /* Send marker if required */ |
2664 | if (vha->marker_needed != 0) { | 2688 | if (vha->marker_needed != 0) { |
2665 | if (qla2x00_marker(vha, req, | 2689 | if (qla2x00_marker(vha, req, |
2666 | rsp, 0, 0, MK_SYNC_ALL) != QLA_SUCCESS) | 2690 | rsp, 0, 0, MK_SYNC_ALL) != QLA_SUCCESS) { |
2691 | ql_log(ql_log_warn, vha, 0x300c, | ||
2692 | "qla2x00_marker failed for cmd=%p.\n", cmd); | ||
2667 | return QLA_FUNCTION_FAILED; | 2693 | return QLA_FUNCTION_FAILED; |
2694 | } | ||
2668 | vha->marker_needed = 0; | 2695 | vha->marker_needed = 0; |
2669 | } | 2696 | } |
2670 | 2697 | ||
@@ -2701,8 +2728,13 @@ qla82xx_start_scsi(srb_t *sp) | |||
2701 | uint16_t i; | 2728 | uint16_t i; |
2702 | 2729 | ||
2703 | more_dsd_lists = qla82xx_calc_dsd_lists(tot_dsds); | 2730 | more_dsd_lists = qla82xx_calc_dsd_lists(tot_dsds); |
2704 | if ((more_dsd_lists + ha->gbl_dsd_inuse) >= NUM_DSD_CHAIN) | 2731 | if ((more_dsd_lists + ha->gbl_dsd_inuse) >= NUM_DSD_CHAIN) { |
2732 | ql_dbg(ql_dbg_io, vha, 0x300d, | ||
2733 | "Num of DSD list %d is than %d for cmd=%p.\n", | ||
2734 | more_dsd_lists + ha->gbl_dsd_inuse, NUM_DSD_CHAIN, | ||
2735 | cmd); | ||
2705 | goto queuing_error; | 2736 | goto queuing_error; |
2737 | } | ||
2706 | 2738 | ||
2707 | if (more_dsd_lists <= ha->gbl_dsd_avail) | 2739 | if (more_dsd_lists <= ha->gbl_dsd_avail) |
2708 | goto sufficient_dsds; | 2740 | goto sufficient_dsds; |
@@ -2711,13 +2743,20 @@ qla82xx_start_scsi(srb_t *sp) | |||
2711 | 2743 | ||
2712 | for (i = 0; i < more_dsd_lists; i++) { | 2744 | for (i = 0; i < more_dsd_lists; i++) { |
2713 | dsd_ptr = kzalloc(sizeof(struct dsd_dma), GFP_ATOMIC); | 2745 | dsd_ptr = kzalloc(sizeof(struct dsd_dma), GFP_ATOMIC); |
2714 | if (!dsd_ptr) | 2746 | if (!dsd_ptr) { |
2747 | ql_log(ql_log_fatal, vha, 0x300e, | ||
2748 | "Failed to allocate memory for dsd_dma " | ||
2749 | "for cmd=%p.\n", cmd); | ||
2715 | goto queuing_error; | 2750 | goto queuing_error; |
2751 | } | ||
2716 | 2752 | ||
2717 | dsd_ptr->dsd_addr = dma_pool_alloc(ha->dl_dma_pool, | 2753 | dsd_ptr->dsd_addr = dma_pool_alloc(ha->dl_dma_pool, |
2718 | GFP_ATOMIC, &dsd_ptr->dsd_list_dma); | 2754 | GFP_ATOMIC, &dsd_ptr->dsd_list_dma); |
2719 | if (!dsd_ptr->dsd_addr) { | 2755 | if (!dsd_ptr->dsd_addr) { |
2720 | kfree(dsd_ptr); | 2756 | kfree(dsd_ptr); |
2757 | ql_log(ql_log_fatal, vha, 0x300f, | ||
2758 | "Failed to allocate memory for dsd_addr " | ||
2759 | "for cmd=%p.\n", cmd); | ||
2721 | goto queuing_error; | 2760 | goto queuing_error; |
2722 | } | 2761 | } |
2723 | list_add_tail(&dsd_ptr->list, &ha->gbl_dsd_list); | 2762 | list_add_tail(&dsd_ptr->list, &ha->gbl_dsd_list); |
@@ -2742,17 +2781,16 @@ sufficient_dsds: | |||
2742 | 2781 | ||
2743 | ctx = sp->ctx = mempool_alloc(ha->ctx_mempool, GFP_ATOMIC); | 2782 | ctx = sp->ctx = mempool_alloc(ha->ctx_mempool, GFP_ATOMIC); |
2744 | if (!sp->ctx) { | 2783 | if (!sp->ctx) { |
2745 | DEBUG(printk(KERN_INFO | 2784 | ql_log(ql_log_fatal, vha, 0x3010, |
2746 | "%s(%ld): failed to allocate" | 2785 | "Failed to allocate ctx for cmd=%p.\n", cmd); |
2747 | " ctx.\n", __func__, vha->host_no)); | ||
2748 | goto queuing_error; | 2786 | goto queuing_error; |
2749 | } | 2787 | } |
2750 | memset(ctx, 0, sizeof(struct ct6_dsd)); | 2788 | memset(ctx, 0, sizeof(struct ct6_dsd)); |
2751 | ctx->fcp_cmnd = dma_pool_alloc(ha->fcp_cmnd_dma_pool, | 2789 | ctx->fcp_cmnd = dma_pool_alloc(ha->fcp_cmnd_dma_pool, |
2752 | GFP_ATOMIC, &ctx->fcp_cmnd_dma); | 2790 | GFP_ATOMIC, &ctx->fcp_cmnd_dma); |
2753 | if (!ctx->fcp_cmnd) { | 2791 | if (!ctx->fcp_cmnd) { |
2754 | DEBUG2_3(printk("%s(%ld): failed to allocate" | 2792 | ql_log(ql_log_fatal, vha, 0x3011, |
2755 | " fcp_cmnd.\n", __func__, vha->host_no)); | 2793 | "Failed to allocate fcp_cmnd for cmd=%p.\n", cmd); |
2756 | goto queuing_error_fcp_cmnd; | 2794 | goto queuing_error_fcp_cmnd; |
2757 | } | 2795 | } |
2758 | 2796 | ||
@@ -2766,6 +2804,9 @@ sufficient_dsds: | |||
2766 | /* SCSI command bigger than 16 bytes must be | 2804 | /* SCSI command bigger than 16 bytes must be |
2767 | * multiple of 4 | 2805 | * multiple of 4 |
2768 | */ | 2806 | */ |
2807 | ql_log(ql_log_warn, vha, 0x3012, | ||
2808 | "scsi cmd len %d not multiple of 4 " | ||
2809 | "for cmd=%p.\n", cmd->cmd_len, cmd); | ||
2769 | goto queuing_error_fcp_cmnd; | 2810 | goto queuing_error_fcp_cmnd; |
2770 | } | 2811 | } |
2771 | ctx->fcp_cmnd_len = 12 + cmd->cmd_len + 4; | 2812 | ctx->fcp_cmnd_len = 12 + cmd->cmd_len + 4; |
@@ -2845,7 +2886,7 @@ sufficient_dsds: | |||
2845 | cmd_pkt->entry_status = (uint8_t) rsp->id; | 2886 | cmd_pkt->entry_status = (uint8_t) rsp->id; |
2846 | } else { | 2887 | } else { |
2847 | struct cmd_type_7 *cmd_pkt; | 2888 | struct cmd_type_7 *cmd_pkt; |
2848 | req_cnt = qla24xx_calc_iocbs(tot_dsds); | 2889 | req_cnt = qla24xx_calc_iocbs(vha, tot_dsds); |
2849 | if (req->cnt < (req_cnt + 2)) { | 2890 | if (req->cnt < (req_cnt + 2)) { |
2850 | cnt = (uint16_t)RD_REG_DWORD_RELAXED( | 2891 | cnt = (uint16_t)RD_REG_DWORD_RELAXED( |
2851 | ®->req_q_out[0]); | 2892 | ®->req_q_out[0]); |
@@ -2979,8 +3020,8 @@ qla82xx_read_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr, | |||
2979 | /* Dword reads to flash. */ | 3020 | /* Dword reads to flash. */ |
2980 | for (i = 0; i < length/4; i++, faddr += 4) { | 3021 | for (i = 0; i < length/4; i++, faddr += 4) { |
2981 | if (qla82xx_rom_fast_read(ha, faddr, &val)) { | 3022 | if (qla82xx_rom_fast_read(ha, faddr, &val)) { |
2982 | qla_printk(KERN_WARNING, ha, | 3023 | ql_log(ql_log_warn, vha, 0x0106, |
2983 | "Do ROM fast read failed\n"); | 3024 | "Do ROM fast read failed.\n"); |
2984 | goto done_read; | 3025 | goto done_read; |
2985 | } | 3026 | } |
2986 | dwptr[i] = __constant_cpu_to_le32(val); | 3027 | dwptr[i] = __constant_cpu_to_le32(val); |
@@ -2994,10 +3035,12 @@ qla82xx_unprotect_flash(struct qla_hw_data *ha) | |||
2994 | { | 3035 | { |
2995 | int ret; | 3036 | int ret; |
2996 | uint32_t val; | 3037 | uint32_t val; |
3038 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
2997 | 3039 | ||
2998 | ret = ql82xx_rom_lock_d(ha); | 3040 | ret = ql82xx_rom_lock_d(ha); |
2999 | if (ret < 0) { | 3041 | if (ret < 0) { |
3000 | qla_printk(KERN_WARNING, ha, "ROM Lock failed\n"); | 3042 | ql_log(ql_log_warn, vha, 0xb014, |
3043 | "ROM Lock failed.\n"); | ||
3001 | return ret; | 3044 | return ret; |
3002 | } | 3045 | } |
3003 | 3046 | ||
@@ -3013,7 +3056,8 @@ qla82xx_unprotect_flash(struct qla_hw_data *ha) | |||
3013 | } | 3056 | } |
3014 | 3057 | ||
3015 | if (qla82xx_write_disable_flash(ha) != 0) | 3058 | if (qla82xx_write_disable_flash(ha) != 0) |
3016 | qla_printk(KERN_WARNING, ha, "Write disable failed\n"); | 3059 | ql_log(ql_log_warn, vha, 0xb015, |
3060 | "Write disable failed.\n"); | ||
3017 | 3061 | ||
3018 | done_unprotect: | 3062 | done_unprotect: |
3019 | qla82xx_rom_unlock(ha); | 3063 | qla82xx_rom_unlock(ha); |
@@ -3025,10 +3069,12 @@ qla82xx_protect_flash(struct qla_hw_data *ha) | |||
3025 | { | 3069 | { |
3026 | int ret; | 3070 | int ret; |
3027 | uint32_t val; | 3071 | uint32_t val; |
3072 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
3028 | 3073 | ||
3029 | ret = ql82xx_rom_lock_d(ha); | 3074 | ret = ql82xx_rom_lock_d(ha); |
3030 | if (ret < 0) { | 3075 | if (ret < 0) { |
3031 | qla_printk(KERN_WARNING, ha, "ROM Lock failed\n"); | 3076 | ql_log(ql_log_warn, vha, 0xb016, |
3077 | "ROM Lock failed.\n"); | ||
3032 | return ret; | 3078 | return ret; |
3033 | } | 3079 | } |
3034 | 3080 | ||
@@ -3040,10 +3086,12 @@ qla82xx_protect_flash(struct qla_hw_data *ha) | |||
3040 | /* LOCK all sectors */ | 3086 | /* LOCK all sectors */ |
3041 | ret = qla82xx_write_status_reg(ha, val); | 3087 | ret = qla82xx_write_status_reg(ha, val); |
3042 | if (ret < 0) | 3088 | if (ret < 0) |
3043 | qla_printk(KERN_WARNING, ha, "Write status register failed\n"); | 3089 | ql_log(ql_log_warn, vha, 0xb017, |
3090 | "Write status register failed.\n"); | ||
3044 | 3091 | ||
3045 | if (qla82xx_write_disable_flash(ha) != 0) | 3092 | if (qla82xx_write_disable_flash(ha) != 0) |
3046 | qla_printk(KERN_WARNING, ha, "Write disable failed\n"); | 3093 | ql_log(ql_log_warn, vha, 0xb018, |
3094 | "Write disable failed.\n"); | ||
3047 | done_protect: | 3095 | done_protect: |
3048 | qla82xx_rom_unlock(ha); | 3096 | qla82xx_rom_unlock(ha); |
3049 | return ret; | 3097 | return ret; |
@@ -3053,10 +3101,12 @@ static int | |||
3053 | qla82xx_erase_sector(struct qla_hw_data *ha, int addr) | 3101 | qla82xx_erase_sector(struct qla_hw_data *ha, int addr) |
3054 | { | 3102 | { |
3055 | int ret = 0; | 3103 | int ret = 0; |
3104 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
3056 | 3105 | ||
3057 | ret = ql82xx_rom_lock_d(ha); | 3106 | ret = ql82xx_rom_lock_d(ha); |
3058 | if (ret < 0) { | 3107 | if (ret < 0) { |
3059 | qla_printk(KERN_WARNING, ha, "ROM Lock failed\n"); | 3108 | ql_log(ql_log_warn, vha, 0xb019, |
3109 | "ROM Lock failed.\n"); | ||
3060 | return ret; | 3110 | return ret; |
3061 | } | 3111 | } |
3062 | 3112 | ||
@@ -3066,8 +3116,8 @@ qla82xx_erase_sector(struct qla_hw_data *ha, int addr) | |||
3066 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, M25P_INSTR_SE); | 3116 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_INSTR_OPCODE, M25P_INSTR_SE); |
3067 | 3117 | ||
3068 | if (qla82xx_wait_rom_done(ha)) { | 3118 | if (qla82xx_wait_rom_done(ha)) { |
3069 | qla_printk(KERN_WARNING, ha, | 3119 | ql_log(ql_log_warn, vha, 0xb01a, |
3070 | "Error waiting for rom done\n"); | 3120 | "Error waiting for rom done.\n"); |
3071 | ret = -1; | 3121 | ret = -1; |
3072 | goto done; | 3122 | goto done; |
3073 | } | 3123 | } |
@@ -3110,10 +3160,10 @@ qla82xx_write_flash_data(struct scsi_qla_host *vha, uint32_t *dwptr, | |||
3110 | optrom = dma_alloc_coherent(&ha->pdev->dev, OPTROM_BURST_SIZE, | 3160 | optrom = dma_alloc_coherent(&ha->pdev->dev, OPTROM_BURST_SIZE, |
3111 | &optrom_dma, GFP_KERNEL); | 3161 | &optrom_dma, GFP_KERNEL); |
3112 | if (!optrom) { | 3162 | if (!optrom) { |
3113 | qla_printk(KERN_DEBUG, ha, | 3163 | ql_log(ql_log_warn, vha, 0xb01b, |
3114 | "Unable to allocate memory for optrom " | 3164 | "Unable to allocate memory " |
3115 | "burst write (%x KB).\n", | 3165 | "for optron burst write (%x KB).\n", |
3116 | OPTROM_BURST_SIZE / 1024); | 3166 | OPTROM_BURST_SIZE / 1024); |
3117 | } | 3167 | } |
3118 | } | 3168 | } |
3119 | 3169 | ||
@@ -3122,8 +3172,8 @@ qla82xx_write_flash_data(struct scsi_qla_host *vha, uint32_t *dwptr, | |||
3122 | 3172 | ||
3123 | ret = qla82xx_unprotect_flash(ha); | 3173 | ret = qla82xx_unprotect_flash(ha); |
3124 | if (ret) { | 3174 | if (ret) { |
3125 | qla_printk(KERN_WARNING, ha, | 3175 | ql_log(ql_log_warn, vha, 0xb01c, |
3126 | "Unable to unprotect flash for update.\n"); | 3176 | "Unable to unprotect flash for update.\n"); |
3127 | goto write_done; | 3177 | goto write_done; |
3128 | } | 3178 | } |
3129 | 3179 | ||
@@ -3133,9 +3183,9 @@ qla82xx_write_flash_data(struct scsi_qla_host *vha, uint32_t *dwptr, | |||
3133 | 3183 | ||
3134 | ret = qla82xx_erase_sector(ha, faddr); | 3184 | ret = qla82xx_erase_sector(ha, faddr); |
3135 | if (ret) { | 3185 | if (ret) { |
3136 | DEBUG9(qla_printk(KERN_ERR, ha, | 3186 | ql_log(ql_log_warn, vha, 0xb01d, |
3137 | "Unable to erase sector: " | 3187 | "Unable to erase sector: address=%x.\n", |
3138 | "address=%x.\n", faddr)); | 3188 | faddr); |
3139 | break; | 3189 | break; |
3140 | } | 3190 | } |
3141 | } | 3191 | } |
@@ -3149,12 +3199,12 @@ qla82xx_write_flash_data(struct scsi_qla_host *vha, uint32_t *dwptr, | |||
3149 | (ha->flash_data_off | faddr), | 3199 | (ha->flash_data_off | faddr), |
3150 | OPTROM_BURST_DWORDS); | 3200 | OPTROM_BURST_DWORDS); |
3151 | if (ret != QLA_SUCCESS) { | 3201 | if (ret != QLA_SUCCESS) { |
3152 | qla_printk(KERN_WARNING, ha, | 3202 | ql_log(ql_log_warn, vha, 0xb01e, |
3153 | "Unable to burst-write optrom segment " | 3203 | "Unable to burst-write optrom segment " |
3154 | "(%x/%x/%llx).\n", ret, | 3204 | "(%x/%x/%llx).\n", ret, |
3155 | (ha->flash_data_off | faddr), | 3205 | (ha->flash_data_off | faddr), |
3156 | (unsigned long long)optrom_dma); | 3206 | (unsigned long long)optrom_dma); |
3157 | qla_printk(KERN_WARNING, ha, | 3207 | ql_log(ql_log_warn, vha, 0xb01f, |
3158 | "Reverting to slow-write.\n"); | 3208 | "Reverting to slow-write.\n"); |
3159 | 3209 | ||
3160 | dma_free_coherent(&ha->pdev->dev, | 3210 | dma_free_coherent(&ha->pdev->dev, |
@@ -3171,16 +3221,16 @@ qla82xx_write_flash_data(struct scsi_qla_host *vha, uint32_t *dwptr, | |||
3171 | ret = qla82xx_write_flash_dword(ha, faddr, | 3221 | ret = qla82xx_write_flash_dword(ha, faddr, |
3172 | cpu_to_le32(*dwptr)); | 3222 | cpu_to_le32(*dwptr)); |
3173 | if (ret) { | 3223 | if (ret) { |
3174 | DEBUG9(printk(KERN_DEBUG "%s(%ld) Unable to program" | 3224 | ql_dbg(ql_dbg_p3p, vha, 0xb020, |
3175 | "flash address=%x data=%x.\n", __func__, | 3225 | "Unable to program flash address=%x data=%x.\n", |
3176 | ha->host_no, faddr, *dwptr)); | 3226 | faddr, *dwptr); |
3177 | break; | 3227 | break; |
3178 | } | 3228 | } |
3179 | } | 3229 | } |
3180 | 3230 | ||
3181 | ret = qla82xx_protect_flash(ha); | 3231 | ret = qla82xx_protect_flash(ha); |
3182 | if (ret) | 3232 | if (ret) |
3183 | qla_printk(KERN_WARNING, ha, | 3233 | ql_log(ql_log_warn, vha, 0xb021, |
3184 | "Unable to protect flash after update.\n"); | 3234 | "Unable to protect flash after update.\n"); |
3185 | write_done: | 3235 | write_done: |
3186 | if (optrom) | 3236 | if (optrom) |
@@ -3244,9 +3294,12 @@ qla82xx_start_iocbs(srb_t *sp) | |||
3244 | 3294 | ||
3245 | void qla82xx_rom_lock_recovery(struct qla_hw_data *ha) | 3295 | void qla82xx_rom_lock_recovery(struct qla_hw_data *ha) |
3246 | { | 3296 | { |
3297 | scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); | ||
3298 | |||
3247 | if (qla82xx_rom_lock(ha)) | 3299 | if (qla82xx_rom_lock(ha)) |
3248 | /* Someone else is holding the lock. */ | 3300 | /* Someone else is holding the lock. */ |
3249 | qla_printk(KERN_INFO, ha, "Resetting rom_lock\n"); | 3301 | ql_log(ql_log_info, vha, 0xb022, |
3302 | "Resetting rom_lock.\n"); | ||
3250 | 3303 | ||
3251 | /* | 3304 | /* |
3252 | * Either we got the lock, or someone | 3305 | * Either we got the lock, or someone |
@@ -3313,7 +3366,8 @@ qla82xx_device_bootstrap(scsi_qla_host_t *vha) | |||
3313 | 3366 | ||
3314 | dev_initialize: | 3367 | dev_initialize: |
3315 | /* set to DEV_INITIALIZING */ | 3368 | /* set to DEV_INITIALIZING */ |
3316 | qla_printk(KERN_INFO, ha, "HW State: INITIALIZING\n"); | 3369 | ql_log(ql_log_info, vha, 0x009e, |
3370 | "HW State: INITIALIZING.\n"); | ||
3317 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_INITIALIZING); | 3371 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_INITIALIZING); |
3318 | 3372 | ||
3319 | /* Driver that sets device state to initializating sets IDC version */ | 3373 | /* Driver that sets device state to initializating sets IDC version */ |
@@ -3324,14 +3378,16 @@ dev_initialize: | |||
3324 | qla82xx_idc_lock(ha); | 3378 | qla82xx_idc_lock(ha); |
3325 | 3379 | ||
3326 | if (rval != QLA_SUCCESS) { | 3380 | if (rval != QLA_SUCCESS) { |
3327 | qla_printk(KERN_INFO, ha, "HW State: FAILED\n"); | 3381 | ql_log(ql_log_fatal, vha, 0x00ad, |
3382 | "HW State: FAILED.\n"); | ||
3328 | qla82xx_clear_drv_active(ha); | 3383 | qla82xx_clear_drv_active(ha); |
3329 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_FAILED); | 3384 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_FAILED); |
3330 | return rval; | 3385 | return rval; |
3331 | } | 3386 | } |
3332 | 3387 | ||
3333 | dev_ready: | 3388 | dev_ready: |
3334 | qla_printk(KERN_INFO, ha, "HW State: READY\n"); | 3389 | ql_log(ql_log_info, vha, 0x00ae, |
3390 | "HW State: READY.\n"); | ||
3335 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_READY); | 3391 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_READY); |
3336 | 3392 | ||
3337 | return QLA_SUCCESS; | 3393 | return QLA_SUCCESS; |
@@ -3376,15 +3432,15 @@ qla82xx_need_qsnt_handler(scsi_qla_host_t *vha) | |||
3376 | /* quiescence timeout, other functions didn't ack | 3432 | /* quiescence timeout, other functions didn't ack |
3377 | * changing the state to DEV_READY | 3433 | * changing the state to DEV_READY |
3378 | */ | 3434 | */ |
3379 | qla_printk(KERN_INFO, ha, | 3435 | ql_log(ql_log_info, vha, 0xb023, |
3380 | "%s: QUIESCENT TIMEOUT\n", QLA2XXX_DRIVER_NAME); | 3436 | "%s : QUIESCENT TIMEOUT.\n", QLA2XXX_DRIVER_NAME); |
3381 | qla_printk(KERN_INFO, ha, | 3437 | ql_log(ql_log_info, vha, 0xb024, |
3382 | "DRV_ACTIVE:%d DRV_STATE:%d\n", drv_active, | 3438 | "DRV_ACTIVE:%d DRV_STATE:%d.\n", |
3383 | drv_state); | 3439 | drv_active, drv_state); |
3384 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, | 3440 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, |
3385 | QLA82XX_DEV_READY); | 3441 | QLA82XX_DEV_READY); |
3386 | qla_printk(KERN_INFO, ha, | 3442 | ql_log(ql_log_info, vha, 0xb025, |
3387 | "HW State: DEV_READY\n"); | 3443 | "HW State: DEV_READY.\n"); |
3388 | qla82xx_idc_unlock(ha); | 3444 | qla82xx_idc_unlock(ha); |
3389 | qla2x00_perform_loop_resync(vha); | 3445 | qla2x00_perform_loop_resync(vha); |
3390 | qla82xx_idc_lock(ha); | 3446 | qla82xx_idc_lock(ha); |
@@ -3404,7 +3460,8 @@ qla82xx_need_qsnt_handler(scsi_qla_host_t *vha) | |||
3404 | dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE); | 3460 | dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE); |
3405 | /* everyone acked so set the state to DEV_QUIESCENCE */ | 3461 | /* everyone acked so set the state to DEV_QUIESCENCE */ |
3406 | if (dev_state == QLA82XX_DEV_NEED_QUIESCENT) { | 3462 | if (dev_state == QLA82XX_DEV_NEED_QUIESCENT) { |
3407 | qla_printk(KERN_INFO, ha, "HW State: DEV_QUIESCENT\n"); | 3463 | ql_log(ql_log_info, vha, 0xb026, |
3464 | "HW State: DEV_QUIESCENT.\n"); | ||
3408 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_QUIESCENT); | 3465 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_QUIESCENT); |
3409 | } | 3466 | } |
3410 | } | 3467 | } |
@@ -3441,7 +3498,8 @@ qla82xx_dev_failed_handler(scsi_qla_host_t *vha) | |||
3441 | struct qla_hw_data *ha = vha->hw; | 3498 | struct qla_hw_data *ha = vha->hw; |
3442 | 3499 | ||
3443 | /* Disable the board */ | 3500 | /* Disable the board */ |
3444 | qla_printk(KERN_INFO, ha, "Disabling the board\n"); | 3501 | ql_log(ql_log_fatal, vha, 0x00b8, |
3502 | "Disabling the board.\n"); | ||
3445 | 3503 | ||
3446 | qla82xx_idc_lock(ha); | 3504 | qla82xx_idc_lock(ha); |
3447 | qla82xx_clear_drv_active(ha); | 3505 | qla82xx_clear_drv_active(ha); |
@@ -3492,8 +3550,8 @@ qla82xx_need_reset_handler(scsi_qla_host_t *vha) | |||
3492 | 3550 | ||
3493 | while (drv_state != drv_active) { | 3551 | while (drv_state != drv_active) { |
3494 | if (time_after_eq(jiffies, reset_timeout)) { | 3552 | if (time_after_eq(jiffies, reset_timeout)) { |
3495 | qla_printk(KERN_INFO, ha, | 3553 | ql_log(ql_log_warn, vha, 0x00b5, |
3496 | "%s: RESET TIMEOUT!\n", QLA2XXX_DRIVER_NAME); | 3554 | "Reset timeout.\n"); |
3497 | break; | 3555 | break; |
3498 | } | 3556 | } |
3499 | qla82xx_idc_unlock(ha); | 3557 | qla82xx_idc_unlock(ha); |
@@ -3504,12 +3562,15 @@ qla82xx_need_reset_handler(scsi_qla_host_t *vha) | |||
3504 | } | 3562 | } |
3505 | 3563 | ||
3506 | dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE); | 3564 | dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE); |
3507 | qla_printk(KERN_INFO, ha, "3:Device state is 0x%x = %s\n", dev_state, | 3565 | ql_log(ql_log_info, vha, 0x00b6, |
3508 | dev_state < MAX_STATES ? qdev_state[dev_state] : "Unknown"); | 3566 | "Device state is 0x%x = %s.\n", |
3567 | dev_state, | ||
3568 | dev_state < MAX_STATES ? qdev_state[dev_state] : "Unknown"); | ||
3509 | 3569 | ||
3510 | /* Force to DEV_COLD unless someone else is starting a reset */ | 3570 | /* Force to DEV_COLD unless someone else is starting a reset */ |
3511 | if (dev_state != QLA82XX_DEV_INITIALIZING) { | 3571 | if (dev_state != QLA82XX_DEV_INITIALIZING) { |
3512 | qla_printk(KERN_INFO, ha, "HW State: COLD/RE-INIT\n"); | 3572 | ql_log(ql_log_info, vha, 0x00b7, |
3573 | "HW State: COLD/RE-INIT.\n"); | ||
3513 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_COLD); | 3574 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_COLD); |
3514 | } | 3575 | } |
3515 | } | 3576 | } |
@@ -3523,8 +3584,12 @@ qla82xx_check_fw_alive(scsi_qla_host_t *vha) | |||
3523 | fw_heartbeat_counter = qla82xx_rd_32(vha->hw, | 3584 | fw_heartbeat_counter = qla82xx_rd_32(vha->hw, |
3524 | QLA82XX_PEG_ALIVE_COUNTER); | 3585 | QLA82XX_PEG_ALIVE_COUNTER); |
3525 | /* all 0xff, assume AER/EEH in progress, ignore */ | 3586 | /* all 0xff, assume AER/EEH in progress, ignore */ |
3526 | if (fw_heartbeat_counter == 0xffffffff) | 3587 | if (fw_heartbeat_counter == 0xffffffff) { |
3588 | ql_dbg(ql_dbg_timer, vha, 0x6003, | ||
3589 | "FW heartbeat counter is 0xffffffff, " | ||
3590 | "returning status=%d.\n", status); | ||
3527 | return status; | 3591 | return status; |
3592 | } | ||
3528 | if (vha->fw_heartbeat_counter == fw_heartbeat_counter) { | 3593 | if (vha->fw_heartbeat_counter == fw_heartbeat_counter) { |
3529 | vha->seconds_since_last_heartbeat++; | 3594 | vha->seconds_since_last_heartbeat++; |
3530 | /* FW not alive after 2 seconds */ | 3595 | /* FW not alive after 2 seconds */ |
@@ -3535,6 +3600,9 @@ qla82xx_check_fw_alive(scsi_qla_host_t *vha) | |||
3535 | } else | 3600 | } else |
3536 | vha->seconds_since_last_heartbeat = 0; | 3601 | vha->seconds_since_last_heartbeat = 0; |
3537 | vha->fw_heartbeat_counter = fw_heartbeat_counter; | 3602 | vha->fw_heartbeat_counter = fw_heartbeat_counter; |
3603 | if (status) | ||
3604 | ql_dbg(ql_dbg_timer, vha, 0x6004, | ||
3605 | "Returning status=%d.\n", status); | ||
3538 | return status; | 3606 | return status; |
3539 | } | 3607 | } |
3540 | 3608 | ||
@@ -3565,8 +3633,10 @@ qla82xx_device_state_handler(scsi_qla_host_t *vha) | |||
3565 | 3633 | ||
3566 | dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE); | 3634 | dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE); |
3567 | old_dev_state = dev_state; | 3635 | old_dev_state = dev_state; |
3568 | qla_printk(KERN_INFO, ha, "1:Device state is 0x%x = %s\n", dev_state, | 3636 | ql_log(ql_log_info, vha, 0x009b, |
3569 | dev_state < MAX_STATES ? qdev_state[dev_state] : "Unknown"); | 3637 | "Device state is 0x%x = %s.\n", |
3638 | dev_state, | ||
3639 | dev_state < MAX_STATES ? qdev_state[dev_state] : "Unknown"); | ||
3570 | 3640 | ||
3571 | /* wait for 30 seconds for device to go ready */ | 3641 | /* wait for 30 seconds for device to go ready */ |
3572 | dev_init_timeout = jiffies + (ha->nx_dev_init_timeout * HZ); | 3642 | dev_init_timeout = jiffies + (ha->nx_dev_init_timeout * HZ); |
@@ -3574,9 +3644,8 @@ qla82xx_device_state_handler(scsi_qla_host_t *vha) | |||
3574 | while (1) { | 3644 | while (1) { |
3575 | 3645 | ||
3576 | if (time_after_eq(jiffies, dev_init_timeout)) { | 3646 | if (time_after_eq(jiffies, dev_init_timeout)) { |
3577 | DEBUG(qla_printk(KERN_INFO, ha, | 3647 | ql_log(ql_log_fatal, vha, 0x009c, |
3578 | "%s: device init failed!\n", | 3648 | "Device init failed.\n"); |
3579 | QLA2XXX_DRIVER_NAME)); | ||
3580 | rval = QLA_FUNCTION_FAILED; | 3649 | rval = QLA_FUNCTION_FAILED; |
3581 | break; | 3650 | break; |
3582 | } | 3651 | } |
@@ -3586,10 +3655,11 @@ qla82xx_device_state_handler(scsi_qla_host_t *vha) | |||
3586 | old_dev_state = dev_state; | 3655 | old_dev_state = dev_state; |
3587 | } | 3656 | } |
3588 | if (loopcount < 5) { | 3657 | if (loopcount < 5) { |
3589 | qla_printk(KERN_INFO, ha, | 3658 | ql_log(ql_log_info, vha, 0x009d, |
3590 | "2:Device state is 0x%x = %s\n", dev_state, | 3659 | "Device state is 0x%x = %s.\n", |
3591 | dev_state < MAX_STATES ? | 3660 | dev_state, |
3592 | qdev_state[dev_state] : "Unknown"); | 3661 | dev_state < MAX_STATES ? qdev_state[dev_state] : |
3662 | "Unknown"); | ||
3593 | } | 3663 | } |
3594 | 3664 | ||
3595 | switch (dev_state) { | 3665 | switch (dev_state) { |
@@ -3656,29 +3726,26 @@ void qla82xx_watchdog(scsi_qla_host_t *vha) | |||
3656 | dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE); | 3726 | dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE); |
3657 | if (dev_state == QLA82XX_DEV_NEED_RESET && | 3727 | if (dev_state == QLA82XX_DEV_NEED_RESET && |
3658 | !test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) { | 3728 | !test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) { |
3659 | qla_printk(KERN_WARNING, ha, | 3729 | ql_log(ql_log_warn, vha, 0x6001, |
3660 | "scsi(%ld) %s: Adapter reset needed!\n", | 3730 | "Adapter reset needed.\n"); |
3661 | vha->host_no, __func__); | ||
3662 | set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); | 3731 | set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); |
3663 | qla2xxx_wake_dpc(vha); | 3732 | qla2xxx_wake_dpc(vha); |
3664 | } else if (dev_state == QLA82XX_DEV_NEED_QUIESCENT && | 3733 | } else if (dev_state == QLA82XX_DEV_NEED_QUIESCENT && |
3665 | !test_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags)) { | 3734 | !test_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags)) { |
3666 | DEBUG(qla_printk(KERN_INFO, ha, | 3735 | ql_log(ql_log_warn, vha, 0x6002, |
3667 | "scsi(%ld) %s - detected quiescence needed\n", | 3736 | "Quiescent needed.\n"); |
3668 | vha->host_no, __func__)); | ||
3669 | set_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags); | 3737 | set_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags); |
3670 | qla2xxx_wake_dpc(vha); | 3738 | qla2xxx_wake_dpc(vha); |
3671 | } else { | 3739 | } else { |
3672 | if (qla82xx_check_fw_alive(vha)) { | 3740 | if (qla82xx_check_fw_alive(vha)) { |
3673 | halt_status = qla82xx_rd_32(ha, | 3741 | halt_status = qla82xx_rd_32(ha, |
3674 | QLA82XX_PEG_HALT_STATUS1); | 3742 | QLA82XX_PEG_HALT_STATUS1); |
3675 | qla_printk(KERN_INFO, ha, | 3743 | ql_dbg(ql_dbg_timer, vha, 0x6005, |
3676 | "scsi(%ld): %s, Dumping hw/fw registers:\n " | 3744 | "dumping hw/fw registers:.\n " |
3677 | " PEG_HALT_STATUS1: 0x%x, PEG_HALT_STATUS2: 0x%x,\n " | 3745 | " PEG_HALT_STATUS1: 0x%x, PEG_HALT_STATUS2: 0x%x,.\n " |
3678 | " PEG_NET_0_PC: 0x%x, PEG_NET_1_PC: 0x%x,\n " | 3746 | " PEG_NET_0_PC: 0x%x, PEG_NET_1_PC: 0x%x,.\n " |
3679 | " PEG_NET_2_PC: 0x%x, PEG_NET_3_PC: 0x%x,\n " | 3747 | " PEG_NET_2_PC: 0x%x, PEG_NET_3_PC: 0x%x,.\n " |
3680 | " PEG_NET_4_PC: 0x%x\n", | 3748 | " PEG_NET_4_PC: 0x%x.\n", halt_status, |
3681 | vha->host_no, __func__, halt_status, | ||
3682 | qla82xx_rd_32(ha, QLA82XX_PEG_HALT_STATUS2), | 3749 | qla82xx_rd_32(ha, QLA82XX_PEG_HALT_STATUS2), |
3683 | qla82xx_rd_32(ha, | 3750 | qla82xx_rd_32(ha, |
3684 | QLA82XX_CRB_PEG_NET_0 + 0x3c), | 3751 | QLA82XX_CRB_PEG_NET_0 + 0x3c), |
@@ -3694,9 +3761,8 @@ void qla82xx_watchdog(scsi_qla_host_t *vha) | |||
3694 | set_bit(ISP_UNRECOVERABLE, | 3761 | set_bit(ISP_UNRECOVERABLE, |
3695 | &vha->dpc_flags); | 3762 | &vha->dpc_flags); |
3696 | } else { | 3763 | } else { |
3697 | qla_printk(KERN_INFO, ha, | 3764 | ql_log(ql_log_info, vha, 0x6006, |
3698 | "scsi(%ld): %s - detect abort needed\n", | 3765 | "Detect abort needed.\n"); |
3699 | vha->host_no, __func__); | ||
3700 | set_bit(ISP_ABORT_NEEDED, | 3766 | set_bit(ISP_ABORT_NEEDED, |
3701 | &vha->dpc_flags); | 3767 | &vha->dpc_flags); |
3702 | } | 3768 | } |
@@ -3704,10 +3770,10 @@ void qla82xx_watchdog(scsi_qla_host_t *vha) | |||
3704 | ha->flags.isp82xx_fw_hung = 1; | 3770 | ha->flags.isp82xx_fw_hung = 1; |
3705 | if (ha->flags.mbox_busy) { | 3771 | if (ha->flags.mbox_busy) { |
3706 | ha->flags.mbox_int = 1; | 3772 | ha->flags.mbox_int = 1; |
3707 | DEBUG2(qla_printk(KERN_ERR, ha, | 3773 | ql_log(ql_log_warn, vha, 0x6007, |
3708 | "scsi(%ld) Due to fw hung, doing " | 3774 | "Due to FW hung, doing " |
3709 | "premature completion of mbx " | 3775 | "premature completion of mbx " |
3710 | "command\n", vha->host_no)); | 3776 | "command.\n"); |
3711 | if (test_bit(MBX_INTR_WAIT, | 3777 | if (test_bit(MBX_INTR_WAIT, |
3712 | &ha->mbx_cmd_flags)) | 3778 | &ha->mbx_cmd_flags)) |
3713 | complete(&ha->mbx_intr_comp); | 3779 | complete(&ha->mbx_intr_comp); |
@@ -3742,9 +3808,8 @@ qla82xx_abort_isp(scsi_qla_host_t *vha) | |||
3742 | uint32_t dev_state; | 3808 | uint32_t dev_state; |
3743 | 3809 | ||
3744 | if (vha->device_flags & DFLG_DEV_FAILED) { | 3810 | if (vha->device_flags & DFLG_DEV_FAILED) { |
3745 | qla_printk(KERN_WARNING, ha, | 3811 | ql_log(ql_log_warn, vha, 0x8024, |
3746 | "%s(%ld): Device in failed state, " | 3812 | "Device in failed state, exiting.\n"); |
3747 | "Exiting.\n", __func__, vha->host_no); | ||
3748 | return QLA_SUCCESS; | 3813 | return QLA_SUCCESS; |
3749 | } | 3814 | } |
3750 | ha->flags.isp82xx_reset_hdlr_active = 1; | 3815 | ha->flags.isp82xx_reset_hdlr_active = 1; |
@@ -3752,13 +3817,14 @@ qla82xx_abort_isp(scsi_qla_host_t *vha) | |||
3752 | qla82xx_idc_lock(ha); | 3817 | qla82xx_idc_lock(ha); |
3753 | dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE); | 3818 | dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE); |
3754 | if (dev_state == QLA82XX_DEV_READY) { | 3819 | if (dev_state == QLA82XX_DEV_READY) { |
3755 | qla_printk(KERN_INFO, ha, "HW State: NEED RESET\n"); | 3820 | ql_log(ql_log_info, vha, 0x8025, |
3821 | "HW State: NEED RESET.\n"); | ||
3756 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, | 3822 | qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, |
3757 | QLA82XX_DEV_NEED_RESET); | 3823 | QLA82XX_DEV_NEED_RESET); |
3758 | } else | 3824 | } else |
3759 | qla_printk(KERN_INFO, ha, "HW State: %s\n", | 3825 | ql_log(ql_log_info, vha, 0x8026, |
3760 | dev_state < MAX_STATES ? | 3826 | "Hw State: %s.\n", dev_state < MAX_STATES ? |
3761 | qdev_state[dev_state] : "Unknown"); | 3827 | qdev_state[dev_state] : "Unknown"); |
3762 | qla82xx_idc_unlock(ha); | 3828 | qla82xx_idc_unlock(ha); |
3763 | 3829 | ||
3764 | rval = qla82xx_device_state_handler(vha); | 3830 | rval = qla82xx_device_state_handler(vha); |
@@ -3777,9 +3843,9 @@ qla82xx_abort_isp(scsi_qla_host_t *vha) | |||
3777 | vha->flags.online = 1; | 3843 | vha->flags.online = 1; |
3778 | if (test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | 3844 | if (test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { |
3779 | if (ha->isp_abort_cnt == 0) { | 3845 | if (ha->isp_abort_cnt == 0) { |
3780 | qla_printk(KERN_WARNING, ha, | 3846 | ql_log(ql_log_warn, vha, 0x8027, |
3781 | "ISP error recovery failed - " | 3847 | "ISP error recover failed - board " |
3782 | "board disabled\n"); | 3848 | "disabled.\n"); |
3783 | /* | 3849 | /* |
3784 | * The next call disables the board | 3850 | * The next call disables the board |
3785 | * completely. | 3851 | * completely. |
@@ -3791,16 +3857,16 @@ qla82xx_abort_isp(scsi_qla_host_t *vha) | |||
3791 | rval = QLA_SUCCESS; | 3857 | rval = QLA_SUCCESS; |
3792 | } else { /* schedule another ISP abort */ | 3858 | } else { /* schedule another ISP abort */ |
3793 | ha->isp_abort_cnt--; | 3859 | ha->isp_abort_cnt--; |
3794 | DEBUG(qla_printk(KERN_INFO, ha, | 3860 | ql_log(ql_log_warn, vha, 0x8036, |
3795 | "qla%ld: ISP abort - retry remaining %d\n", | 3861 | "ISP abort - retry remaining %d.\n", |
3796 | vha->host_no, ha->isp_abort_cnt)); | 3862 | ha->isp_abort_cnt); |
3797 | rval = QLA_FUNCTION_FAILED; | 3863 | rval = QLA_FUNCTION_FAILED; |
3798 | } | 3864 | } |
3799 | } else { | 3865 | } else { |
3800 | ha->isp_abort_cnt = MAX_RETRIES_OF_ISP_ABORT; | 3866 | ha->isp_abort_cnt = MAX_RETRIES_OF_ISP_ABORT; |
3801 | DEBUG(qla_printk(KERN_INFO, ha, | 3867 | ql_dbg(ql_dbg_taskm, vha, 0x8029, |
3802 | "(%ld): ISP error recovery - retrying (%d) " | 3868 | "ISP error recovery - retrying (%d) more times.\n", |
3803 | "more times\n", vha->host_no, ha->isp_abort_cnt)); | 3869 | ha->isp_abort_cnt); |
3804 | set_bit(ISP_ABORT_RETRY, &vha->dpc_flags); | 3870 | set_bit(ISP_ABORT_RETRY, &vha->dpc_flags); |
3805 | rval = QLA_FUNCTION_FAILED; | 3871 | rval = QLA_FUNCTION_FAILED; |
3806 | } | 3872 | } |
@@ -3872,8 +3938,8 @@ int qla2x00_wait_for_fcoe_ctx_reset(scsi_qla_host_t *vha) | |||
3872 | break; | 3938 | break; |
3873 | } | 3939 | } |
3874 | } | 3940 | } |
3875 | DEBUG2(printk(KERN_INFO | 3941 | ql_dbg(ql_dbg_p3p, vha, 0xb027, |
3876 | "%s status=%d\n", __func__, status)); | 3942 | "%s status=%d.\n", status); |
3877 | 3943 | ||
3878 | return status; | 3944 | return status; |
3879 | } | 3945 | } |
@@ -3902,6 +3968,9 @@ qla82xx_chip_reset_cleanup(scsi_qla_host_t *vha) | |||
3902 | } | 3968 | } |
3903 | } | 3969 | } |
3904 | } | 3970 | } |
3971 | ql_dbg(ql_dbg_init, vha, 0x00b0, | ||
3972 | "Entered %s fw_hung=%d.\n", | ||
3973 | __func__, ha->flags.isp82xx_fw_hung); | ||
3905 | 3974 | ||
3906 | /* Abort all commands gracefully if fw NOT hung */ | 3975 | /* Abort all commands gracefully if fw NOT hung */ |
3907 | if (!ha->flags.isp82xx_fw_hung) { | 3976 | if (!ha->flags.isp82xx_fw_hung) { |
@@ -3922,13 +3991,13 @@ qla82xx_chip_reset_cleanup(scsi_qla_host_t *vha) | |||
3922 | spin_unlock_irqrestore( | 3991 | spin_unlock_irqrestore( |
3923 | &ha->hardware_lock, flags); | 3992 | &ha->hardware_lock, flags); |
3924 | if (ha->isp_ops->abort_command(sp)) { | 3993 | if (ha->isp_ops->abort_command(sp)) { |
3925 | qla_printk(KERN_INFO, ha, | 3994 | ql_log(ql_log_info, vha, |
3926 | "scsi(%ld): mbx abort command failed in %s\n", | 3995 | 0x00b1, |
3927 | vha->host_no, __func__); | 3996 | "mbx abort failed.\n"); |
3928 | } else { | 3997 | } else { |
3929 | qla_printk(KERN_INFO, ha, | 3998 | ql_log(ql_log_info, vha, |
3930 | "scsi(%ld): mbx abort command success in %s\n", | 3999 | 0x00b2, |
3931 | vha->host_no, __func__); | 4000 | "mbx abort success.\n"); |
3932 | } | 4001 | } |
3933 | spin_lock_irqsave(&ha->hardware_lock, flags); | 4002 | spin_lock_irqsave(&ha->hardware_lock, flags); |
3934 | } | 4003 | } |
@@ -3940,8 +4009,9 @@ qla82xx_chip_reset_cleanup(scsi_qla_host_t *vha) | |||
3940 | /* Wait for pending cmds (physical and virtual) to complete */ | 4009 | /* Wait for pending cmds (physical and virtual) to complete */ |
3941 | if (!qla2x00_eh_wait_for_pending_commands(vha, 0, 0, | 4010 | if (!qla2x00_eh_wait_for_pending_commands(vha, 0, 0, |
3942 | WAIT_HOST) == QLA_SUCCESS) { | 4011 | WAIT_HOST) == QLA_SUCCESS) { |
3943 | DEBUG2(qla_printk(KERN_INFO, ha, | 4012 | ql_dbg(ql_dbg_init, vha, 0x00b3, |
3944 | "Done wait for pending commands\n")); | 4013 | "Done wait for " |
4014 | "pending commands.\n"); | ||
3945 | } | 4015 | } |
3946 | } | 4016 | } |
3947 | } | 4017 | } |