aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sym53c8xx_2/sym_hipd.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2006-03-28 11:03:44 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-04-13 11:13:25 -0400
commitc2349df918cdfd47dfe6afaaeed9f504b83255d0 (patch)
tree03911e3716947f204e9d9154d16fd65d0afda2a3 /drivers/scsi/sym53c8xx_2/sym_hipd.c
parent92d578b94c3c6263777687d8f2653c2a63d922bf (diff)
[SCSI] Allow nvram settings to determine bus mode
The PDC code can set the bus mode, but we were ignoring that setting. Also move the code that determines bus mode into its own function. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/sym53c8xx_2/sym_hipd.c')
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c65
1 files changed, 34 insertions, 31 deletions
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index 1d01c24f5ae9..a671bdc07450 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -648,6 +648,37 @@ static void sym_save_initial_setting (struct sym_hcb *np)
648} 648}
649 649
650/* 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 */
657static 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/*
651 * Prepare io register values used by sym_start_up() 682 * Prepare io register values used by sym_start_up()
652 * according to selected and supported features. 683 * according to selected and supported features.
653 */ 684 */
@@ -657,10 +688,7 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru
657 u32 period; 688 u32 period;
658 int i; 689 int i;
659 690
660 /* 691 np->maxwide = (np->features & FE_WIDE) ? 1 : 0;
661 * Wide ?
662 */
663 np->maxwide = (np->features & FE_WIDE)? 1 : 0;
664 692
665 /* 693 /*
666 * Guess the frequency of the chip's clock. 694 * Guess the frequency of the chip's clock.
@@ -841,6 +869,7 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru
841 * Get parity checking, host ID and verbose mode from NVRAM 869 * Get parity checking, host ID and verbose mode from NVRAM
842 */ 870 */
843 np->myaddr = 255; 871 np->myaddr = 255;
872 np->scsi_mode = 0;
844 sym_nvram_setup_host(shost, np, nvram); 873 sym_nvram_setup_host(shost, np, nvram);
845 874
846 /* 875 /*
@@ -857,33 +886,7 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru
857 */ 886 */
858 sym_init_burst(np, burst_max); 887 sym_init_burst(np, burst_max);
859 888
860 /* 889 sym_set_bus_mode(np, nvram);
861 * Set SCSI BUS mode.
862 * - LVD capable chips (895/895A/896/1010) report the
863 * current BUS mode through the STEST4 IO register.
864 * - For previous generation chips (825/825A/875),
865 * user has to tell us how to check against HVD,
866 * since a 100% safe algorithm is not possible.
867 */
868 np->scsi_mode = SMODE_SE;
869 if (np->features & (FE_ULTRA2|FE_ULTRA3))
870 np->scsi_mode = (np->sv_stest4 & SMODE);
871 else if (np->features & FE_DIFF) {
872 if (SYM_SETUP_SCSI_DIFF == 1) {
873 if (np->sv_scntl3) {
874 if (np->sv_stest2 & 0x20)
875 np->scsi_mode = SMODE_HVD;
876 }
877 else if (nvram->type == SYM_SYMBIOS_NVRAM) {
878 if (!(INB(np, nc_gpreg) & 0x08))
879 np->scsi_mode = SMODE_HVD;
880 }
881 }
882 else if (SYM_SETUP_SCSI_DIFF == 2)
883 np->scsi_mode = SMODE_HVD;
884 }
885 if (np->scsi_mode == SMODE_HVD)
886 np->rv_stest2 |= 0x20;
887 890
888 /* 891 /*
889 * Set LED support from SCRIPTS. 892 * Set LED support from SCRIPTS.