diff options
Diffstat (limited to 'drivers/scsi/sym53c8xx_2/sym_hipd.c')
-rw-r--r-- | drivers/scsi/sym53c8xx_2/sym_hipd.c | 113 |
1 files changed, 63 insertions, 50 deletions
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c index 60850cbe3a85..a671bdc07450 100644 --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c | |||
@@ -72,7 +72,10 @@ static void sym_printl_hex(u_char *p, int n) | |||
72 | 72 | ||
73 | static void sym_print_msg(struct sym_ccb *cp, char *label, u_char *msg) | 73 | static void sym_print_msg(struct sym_ccb *cp, char *label, u_char *msg) |
74 | { | 74 | { |
75 | sym_print_addr(cp->cmd, "%s: ", label); | 75 | if (label) |
76 | sym_print_addr(cp->cmd, "%s: ", label); | ||
77 | else | ||
78 | sym_print_addr(cp->cmd, ""); | ||
76 | 79 | ||
77 | spi_print_msg(msg); | 80 | spi_print_msg(msg); |
78 | printf("\n"); | 81 | printf("\n"); |
@@ -472,7 +475,7 @@ static int sym_getpciclock (struct sym_hcb *np) | |||
472 | * calculations more simple. | 475 | * calculations more simple. |
473 | */ | 476 | */ |
474 | #define _5M 5000000 | 477 | #define _5M 5000000 |
475 | static u32 div_10M[] = {2*_5M, 3*_5M, 4*_5M, 6*_5M, 8*_5M, 12*_5M, 16*_5M}; | 478 | static const u32 div_10M[] = {2*_5M, 3*_5M, 4*_5M, 6*_5M, 8*_5M, 12*_5M, 16*_5M}; |
476 | 479 | ||
477 | /* | 480 | /* |
478 | * Get clock factor and sync divisor for a given | 481 | * Get clock factor and sync divisor for a given |
@@ -645,6 +648,37 @@ static void sym_save_initial_setting (struct sym_hcb *np) | |||
645 | } | 648 | } |
646 | 649 | ||
647 | /* | 650 | /* |
651 | * Set SCSI BUS mode. | ||
652 | * - LVD capable chips (895/895A/896/1010) report the current BUS mode | ||
653 | * through the STEST4 IO register. | ||
654 | * - For previous generation chips (825/825A/875), the user has to tell us | ||
655 | * how to check against HVD, since a 100% safe algorithm is not possible. | ||
656 | */ | ||
657 | static void sym_set_bus_mode(struct sym_hcb *np, struct sym_nvram *nvram) | ||
658 | { | ||
659 | if (np->scsi_mode) | ||
660 | return; | ||
661 | |||
662 | np->scsi_mode = SMODE_SE; | ||
663 | if (np->features & (FE_ULTRA2|FE_ULTRA3)) | ||
664 | np->scsi_mode = (np->sv_stest4 & SMODE); | ||
665 | else if (np->features & FE_DIFF) { | ||
666 | if (SYM_SETUP_SCSI_DIFF == 1) { | ||
667 | if (np->sv_scntl3) { | ||
668 | if (np->sv_stest2 & 0x20) | ||
669 | np->scsi_mode = SMODE_HVD; | ||
670 | } else if (nvram->type == SYM_SYMBIOS_NVRAM) { | ||
671 | if (!(INB(np, nc_gpreg) & 0x08)) | ||
672 | np->scsi_mode = SMODE_HVD; | ||
673 | } | ||
674 | } else if (SYM_SETUP_SCSI_DIFF == 2) | ||
675 | np->scsi_mode = SMODE_HVD; | ||
676 | } | ||
677 | if (np->scsi_mode == SMODE_HVD) | ||
678 | np->rv_stest2 |= 0x20; | ||
679 | } | ||
680 | |||
681 | /* | ||
648 | * Prepare io register values used by sym_start_up() | 682 | * Prepare io register values used by sym_start_up() |
649 | * according to selected and supported features. | 683 | * according to selected and supported features. |
650 | */ | 684 | */ |
@@ -654,10 +688,7 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru | |||
654 | u32 period; | 688 | u32 period; |
655 | int i; | 689 | int i; |
656 | 690 | ||
657 | /* | 691 | np->maxwide = (np->features & FE_WIDE) ? 1 : 0; |
658 | * Wide ? | ||
659 | */ | ||
660 | np->maxwide = (np->features & FE_WIDE)? 1 : 0; | ||
661 | 692 | ||
662 | /* | 693 | /* |
663 | * Guess the frequency of the chip's clock. | 694 | * Guess the frequency of the chip's clock. |
@@ -838,6 +869,7 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru | |||
838 | * Get parity checking, host ID and verbose mode from NVRAM | 869 | * Get parity checking, host ID and verbose mode from NVRAM |
839 | */ | 870 | */ |
840 | np->myaddr = 255; | 871 | np->myaddr = 255; |
872 | np->scsi_mode = 0; | ||
841 | sym_nvram_setup_host(shost, np, nvram); | 873 | sym_nvram_setup_host(shost, np, nvram); |
842 | 874 | ||
843 | /* | 875 | /* |
@@ -854,33 +886,7 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru | |||
854 | */ | 886 | */ |
855 | sym_init_burst(np, burst_max); | 887 | sym_init_burst(np, burst_max); |
856 | 888 | ||
857 | /* | 889 | sym_set_bus_mode(np, nvram); |
858 | * Set SCSI BUS mode. | ||
859 | * - LVD capable chips (895/895A/896/1010) report the | ||
860 | * current BUS mode through the STEST4 IO register. | ||
861 | * - For previous generation chips (825/825A/875), | ||
862 | * user has to tell us how to check against HVD, | ||
863 | * since a 100% safe algorithm is not possible. | ||
864 | */ | ||
865 | np->scsi_mode = SMODE_SE; | ||
866 | if (np->features & (FE_ULTRA2|FE_ULTRA3)) | ||
867 | np->scsi_mode = (np->sv_stest4 & SMODE); | ||
868 | else if (np->features & FE_DIFF) { | ||
869 | if (SYM_SETUP_SCSI_DIFF == 1) { | ||
870 | if (np->sv_scntl3) { | ||
871 | if (np->sv_stest2 & 0x20) | ||
872 | np->scsi_mode = SMODE_HVD; | ||
873 | } | ||
874 | else if (nvram->type == SYM_SYMBIOS_NVRAM) { | ||
875 | if (!(INB(np, nc_gpreg) & 0x08)) | ||
876 | np->scsi_mode = SMODE_HVD; | ||
877 | } | ||
878 | } | ||
879 | else if (SYM_SETUP_SCSI_DIFF == 2) | ||
880 | np->scsi_mode = SMODE_HVD; | ||
881 | } | ||
882 | if (np->scsi_mode == SMODE_HVD) | ||
883 | np->rv_stest2 |= 0x20; | ||
884 | 890 | ||
885 | /* | 891 | /* |
886 | * Set LED support from SCRIPTS. | 892 | * Set LED support from SCRIPTS. |
@@ -973,8 +979,8 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru | |||
973 | * | 979 | * |
974 | * Has to be called with interrupts disabled. | 980 | * Has to be called with interrupts disabled. |
975 | */ | 981 | */ |
976 | #ifndef CONFIG_SCSI_SYM53C8XX_IOMAPPED | 982 | #ifdef CONFIG_SCSI_SYM53C8XX_MMIO |
977 | static int sym_regtest (struct sym_hcb *np) | 983 | static int sym_regtest(struct sym_hcb *np) |
978 | { | 984 | { |
979 | register volatile u32 data; | 985 | register volatile u32 data; |
980 | /* | 986 | /* |
@@ -992,20 +998,25 @@ static int sym_regtest (struct sym_hcb *np) | |||
992 | #endif | 998 | #endif |
993 | printf ("CACHE TEST FAILED: reg dstat-sstat2 readback %x.\n", | 999 | printf ("CACHE TEST FAILED: reg dstat-sstat2 readback %x.\n", |
994 | (unsigned) data); | 1000 | (unsigned) data); |
995 | return (0x10); | 1001 | return 0x10; |
996 | } | 1002 | } |
997 | return (0); | 1003 | return 0; |
1004 | } | ||
1005 | #else | ||
1006 | static inline int sym_regtest(struct sym_hcb *np) | ||
1007 | { | ||
1008 | return 0; | ||
998 | } | 1009 | } |
999 | #endif | 1010 | #endif |
1000 | 1011 | ||
1001 | static int sym_snooptest (struct sym_hcb *np) | 1012 | static int sym_snooptest(struct sym_hcb *np) |
1002 | { | 1013 | { |
1003 | u32 sym_rd, sym_wr, sym_bk, host_rd, host_wr, pc, dstat; | 1014 | u32 sym_rd, sym_wr, sym_bk, host_rd, host_wr, pc, dstat; |
1004 | int i, err=0; | 1015 | int i, err; |
1005 | #ifndef CONFIG_SCSI_SYM53C8XX_IOMAPPED | 1016 | |
1006 | err |= sym_regtest (np); | 1017 | err = sym_regtest(np); |
1007 | if (err) return (err); | 1018 | if (err) |
1008 | #endif | 1019 | return err; |
1009 | restart_test: | 1020 | restart_test: |
1010 | /* | 1021 | /* |
1011 | * Enable Master Parity Checking as we intend | 1022 | * Enable Master Parity Checking as we intend |
@@ -1094,7 +1105,7 @@ restart_test: | |||
1094 | err |= 4; | 1105 | err |= 4; |
1095 | } | 1106 | } |
1096 | 1107 | ||
1097 | return (err); | 1108 | return err; |
1098 | } | 1109 | } |
1099 | 1110 | ||
1100 | /* | 1111 | /* |
@@ -1464,7 +1475,7 @@ static int sym_prepare_nego(struct sym_hcb *np, struct sym_ccb *cp, u_char *msgp | |||
1464 | /* | 1475 | /* |
1465 | * Insert a job into the start queue. | 1476 | * Insert a job into the start queue. |
1466 | */ | 1477 | */ |
1467 | static void sym_put_start_queue(struct sym_hcb *np, struct sym_ccb *cp) | 1478 | void sym_put_start_queue(struct sym_hcb *np, struct sym_ccb *cp) |
1468 | { | 1479 | { |
1469 | u_short qidx; | 1480 | u_short qidx; |
1470 | 1481 | ||
@@ -4481,7 +4492,7 @@ static void sym_int_sir (struct sym_hcb *np) | |||
4481 | switch (np->msgin [2]) { | 4492 | switch (np->msgin [2]) { |
4482 | case M_X_MODIFY_DP: | 4493 | case M_X_MODIFY_DP: |
4483 | if (DEBUG_FLAGS & DEBUG_POINTER) | 4494 | if (DEBUG_FLAGS & DEBUG_POINTER) |
4484 | sym_print_msg(cp,"modify DP",np->msgin); | 4495 | sym_print_msg(cp, NULL, np->msgin); |
4485 | tmp = (np->msgin[3]<<24) + (np->msgin[4]<<16) + | 4496 | tmp = (np->msgin[3]<<24) + (np->msgin[4]<<16) + |
4486 | (np->msgin[5]<<8) + (np->msgin[6]); | 4497 | (np->msgin[5]<<8) + (np->msgin[6]); |
4487 | sym_modify_dp(np, tp, cp, tmp); | 4498 | sym_modify_dp(np, tp, cp, tmp); |
@@ -4508,7 +4519,7 @@ static void sym_int_sir (struct sym_hcb *np) | |||
4508 | */ | 4519 | */ |
4509 | case M_IGN_RESIDUE: | 4520 | case M_IGN_RESIDUE: |
4510 | if (DEBUG_FLAGS & DEBUG_POINTER) | 4521 | if (DEBUG_FLAGS & DEBUG_POINTER) |
4511 | sym_print_msg(cp,"ign wide residue", np->msgin); | 4522 | sym_print_msg(cp, NULL, np->msgin); |
4512 | if (cp->host_flags & HF_SENSE) | 4523 | if (cp->host_flags & HF_SENSE) |
4513 | OUTL_DSP(np, SCRIPTA_BA(np, clrack)); | 4524 | OUTL_DSP(np, SCRIPTA_BA(np, clrack)); |
4514 | else | 4525 | else |
@@ -4597,7 +4608,8 @@ struct sym_ccb *sym_get_ccb (struct sym_hcb *np, struct scsi_cmnd *cmd, u_char t | |||
4597 | * Debugging purpose. | 4608 | * Debugging purpose. |
4598 | */ | 4609 | */ |
4599 | #ifndef SYM_OPT_HANDLE_DEVICE_QUEUEING | 4610 | #ifndef SYM_OPT_HANDLE_DEVICE_QUEUEING |
4600 | assert(lp->busy_itl == 0); | 4611 | if (lp->busy_itl != 0) |
4612 | goto out_free; | ||
4601 | #endif | 4613 | #endif |
4602 | /* | 4614 | /* |
4603 | * Allocate resources for tags if not yet. | 4615 | * Allocate resources for tags if not yet. |
@@ -4642,7 +4654,8 @@ struct sym_ccb *sym_get_ccb (struct sym_hcb *np, struct scsi_cmnd *cmd, u_char t | |||
4642 | * Debugging purpose. | 4654 | * Debugging purpose. |
4643 | */ | 4655 | */ |
4644 | #ifndef SYM_OPT_HANDLE_DEVICE_QUEUEING | 4656 | #ifndef SYM_OPT_HANDLE_DEVICE_QUEUEING |
4645 | assert(lp->busy_itl == 0 && lp->busy_itlq == 0); | 4657 | if (lp->busy_itl != 0 || lp->busy_itlq != 0) |
4658 | goto out_free; | ||
4646 | #endif | 4659 | #endif |
4647 | /* | 4660 | /* |
4648 | * Count this nexus for this LUN. | 4661 | * Count this nexus for this LUN. |