diff options
author | Matthew Wilcox <matthew@wil.cx> | 2005-11-29 23:08:44 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-12-13 20:11:45 -0500 |
commit | b37df48923b76155de2a728e1155ed263dba5f53 (patch) | |
tree | d66ce7b56be9df12a7c64521e931dc4925bf800f /drivers/scsi | |
parent | 33333bacf523bb4bb903058fec6041a5952c93c6 (diff) |
[SCSI] sym2: Allow NVRAM settings to limit speed and width
The NVRAM for both Tekram and Symbios boards allows the user to set the
speed and width for individual targets. I took that code out in March
2004 when we introduced Domain Validation, but it seems there's still
a legitimate need for it in some configurations.
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/sym53c8xx_2/sym_glue.c | 3 | ||||
-rw-r--r-- | drivers/scsi/sym53c8xx_2/sym_hipd.c | 2 | ||||
-rw-r--r-- | drivers/scsi/sym53c8xx_2/sym_hipd.h | 6 | ||||
-rw-r--r-- | drivers/scsi/sym53c8xx_2/sym_nvram.c | 29 | ||||
-rw-r--r-- | drivers/scsi/sym53c8xx_2/sym_nvram.h | 4 |
5 files changed, 26 insertions, 18 deletions
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index bb90ef9659ab..cb3d195bdb94 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c | |||
@@ -1038,6 +1038,9 @@ static int sym53c8xx_slave_alloc(struct scsi_device *sdev) | |||
1038 | return -ENOMEM; | 1038 | return -ENOMEM; |
1039 | 1039 | ||
1040 | tp->starget = sdev->sdev_target; | 1040 | tp->starget = sdev->sdev_target; |
1041 | spi_min_period(tp->starget) = tp->usr_period; | ||
1042 | spi_max_width(tp->starget) = tp->usr_width; | ||
1043 | |||
1041 | return 0; | 1044 | return 0; |
1042 | } | 1045 | } |
1043 | 1046 | ||
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c index c36e43bbaae5..0b0cba0d0bbe 100644 --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c | |||
@@ -943,7 +943,7 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru | |||
943 | tp->usrflags |= (SYM_DISC_ENABLED | SYM_TAGS_ENABLED); | 943 | tp->usrflags |= (SYM_DISC_ENABLED | SYM_TAGS_ENABLED); |
944 | tp->usrtags = SYM_SETUP_MAX_TAG; | 944 | tp->usrtags = SYM_SETUP_MAX_TAG; |
945 | 945 | ||
946 | sym_nvram_setup_target(np, i, nvram); | 946 | sym_nvram_setup_target(tp, i, nvram); |
947 | 947 | ||
948 | if (!tp->usrtags) | 948 | if (!tp->usrtags) |
949 | tp->usrflags &= ~SYM_TAGS_ENABLED; | 949 | tp->usrflags &= ~SYM_TAGS_ENABLED; |
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h b/drivers/scsi/sym53c8xx_2/sym_hipd.h index 17181101f6c8..2456090bb241 100644 --- a/drivers/scsi/sym53c8xx_2/sym_hipd.h +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h | |||
@@ -434,8 +434,10 @@ struct sym_tcb { | |||
434 | * Other user settable limits and options. | 434 | * Other user settable limits and options. |
435 | * These limits are read from the NVRAM if present. | 435 | * These limits are read from the NVRAM if present. |
436 | */ | 436 | */ |
437 | u_char usrflags; | 437 | unsigned char usrflags; |
438 | u_short usrtags; | 438 | unsigned char usr_period; |
439 | unsigned char usr_width; | ||
440 | unsigned short usrtags; | ||
439 | struct scsi_target *starget; | 441 | struct scsi_target *starget; |
440 | }; | 442 | }; |
441 | 443 | ||
diff --git a/drivers/scsi/sym53c8xx_2/sym_nvram.c b/drivers/scsi/sym53c8xx_2/sym_nvram.c index 994b7566bcac..15d69298ab6e 100644 --- a/drivers/scsi/sym53c8xx_2/sym_nvram.c +++ b/drivers/scsi/sym53c8xx_2/sym_nvram.c | |||
@@ -92,29 +92,32 @@ void sym_nvram_setup_host(struct Scsi_Host *shost, struct sym_hcb *np, struct sy | |||
92 | * Get target set-up from Symbios format NVRAM. | 92 | * Get target set-up from Symbios format NVRAM. |
93 | */ | 93 | */ |
94 | static void | 94 | static void |
95 | sym_Symbios_setup_target(struct sym_hcb *np, int target, Symbios_nvram *nvram) | 95 | sym_Symbios_setup_target(struct sym_tcb *tp, int target, Symbios_nvram *nvram) |
96 | { | 96 | { |
97 | struct sym_tcb *tp = &np->target[target]; | ||
98 | Symbios_target *tn = &nvram->target[target]; | 97 | Symbios_target *tn = &nvram->target[target]; |
99 | 98 | ||
100 | tp->usrtags = | 99 | if (!(tn->flags & SYMBIOS_QUEUE_TAGS_ENABLED)) |
101 | (tn->flags & SYMBIOS_QUEUE_TAGS_ENABLED)? SYM_SETUP_MAX_TAG : 0; | 100 | tp->usrtags = 0; |
102 | |||
103 | if (!(tn->flags & SYMBIOS_DISCONNECT_ENABLE)) | 101 | if (!(tn->flags & SYMBIOS_DISCONNECT_ENABLE)) |
104 | tp->usrflags &= ~SYM_DISC_ENABLED; | 102 | tp->usrflags &= ~SYM_DISC_ENABLED; |
105 | if (!(tn->flags & SYMBIOS_SCAN_AT_BOOT_TIME)) | 103 | if (!(tn->flags & SYMBIOS_SCAN_AT_BOOT_TIME)) |
106 | tp->usrflags |= SYM_SCAN_BOOT_DISABLED; | 104 | tp->usrflags |= SYM_SCAN_BOOT_DISABLED; |
107 | if (!(tn->flags & SYMBIOS_SCAN_LUNS)) | 105 | if (!(tn->flags & SYMBIOS_SCAN_LUNS)) |
108 | tp->usrflags |= SYM_SCAN_LUNS_DISABLED; | 106 | tp->usrflags |= SYM_SCAN_LUNS_DISABLED; |
107 | tp->usr_period = (tn->sync_period + 3) / 4; | ||
108 | tp->usr_width = (tn->bus_width == 0x8) ? 0 : 1; | ||
109 | } | 109 | } |
110 | 110 | ||
111 | static const unsigned char Tekram_sync[16] = { | ||
112 | 25, 31, 37, 43, 50, 62, 75, 125, 12, 15, 18, 21, 6, 7, 9, 10 | ||
113 | }; | ||
114 | |||
111 | /* | 115 | /* |
112 | * Get target set-up from Tekram format NVRAM. | 116 | * Get target set-up from Tekram format NVRAM. |
113 | */ | 117 | */ |
114 | static void | 118 | static void |
115 | sym_Tekram_setup_target(struct sym_hcb *np, int target, Tekram_nvram *nvram) | 119 | sym_Tekram_setup_target(struct sym_tcb *tp, int target, Tekram_nvram *nvram) |
116 | { | 120 | { |
117 | struct sym_tcb *tp = &np->target[target]; | ||
118 | struct Tekram_target *tn = &nvram->target[target]; | 121 | struct Tekram_target *tn = &nvram->target[target]; |
119 | 122 | ||
120 | if (tn->flags & TEKRAM_TAGGED_COMMANDS) { | 123 | if (tn->flags & TEKRAM_TAGGED_COMMANDS) { |
@@ -124,22 +127,22 @@ sym_Tekram_setup_target(struct sym_hcb *np, int target, Tekram_nvram *nvram) | |||
124 | if (tn->flags & TEKRAM_DISCONNECT_ENABLE) | 127 | if (tn->flags & TEKRAM_DISCONNECT_ENABLE) |
125 | tp->usrflags |= SYM_DISC_ENABLED; | 128 | tp->usrflags |= SYM_DISC_ENABLED; |
126 | 129 | ||
127 | /* If any device does not support parity, we will not use this option */ | 130 | if (tn->flags & TEKRAM_SYNC_NEGO) |
128 | if (!(tn->flags & TEKRAM_PARITY_CHECK)) | 131 | tp->usr_period = Tekram_sync[tn->sync_index & 0xf]; |
129 | np->rv_scntl0 &= ~0x0a; /* SCSI parity checking disabled */ | 132 | tp->usr_width = (tn->flags & TEKRAM_WIDE_NEGO) ? 1 : 0; |
130 | } | 133 | } |
131 | 134 | ||
132 | /* | 135 | /* |
133 | * Get target setup from NVRAM. | 136 | * Get target setup from NVRAM. |
134 | */ | 137 | */ |
135 | void sym_nvram_setup_target(struct sym_hcb *np, int target, struct sym_nvram *nvp) | 138 | void sym_nvram_setup_target(struct sym_tcb *tp, int target, struct sym_nvram *nvp) |
136 | { | 139 | { |
137 | switch (nvp->type) { | 140 | switch (nvp->type) { |
138 | case SYM_SYMBIOS_NVRAM: | 141 | case SYM_SYMBIOS_NVRAM: |
139 | sym_Symbios_setup_target(np, target, &nvp->data.Symbios); | 142 | sym_Symbios_setup_target(tp, target, &nvp->data.Symbios); |
140 | break; | 143 | break; |
141 | case SYM_TEKRAM_NVRAM: | 144 | case SYM_TEKRAM_NVRAM: |
142 | sym_Tekram_setup_target(np, target, &nvp->data.Tekram); | 145 | sym_Tekram_setup_target(tp, target, &nvp->data.Tekram); |
143 | break; | 146 | break; |
144 | default: | 147 | default: |
145 | break; | 148 | break; |
diff --git a/drivers/scsi/sym53c8xx_2/sym_nvram.h b/drivers/scsi/sym53c8xx_2/sym_nvram.h index 1538bede5277..bdfbbb083b69 100644 --- a/drivers/scsi/sym53c8xx_2/sym_nvram.h +++ b/drivers/scsi/sym53c8xx_2/sym_nvram.h | |||
@@ -194,12 +194,12 @@ struct sym_nvram { | |||
194 | 194 | ||
195 | #if SYM_CONF_NVRAM_SUPPORT | 195 | #if SYM_CONF_NVRAM_SUPPORT |
196 | void sym_nvram_setup_host(struct Scsi_Host *shost, struct sym_hcb *np, struct sym_nvram *nvram); | 196 | void sym_nvram_setup_host(struct Scsi_Host *shost, struct sym_hcb *np, struct sym_nvram *nvram); |
197 | void sym_nvram_setup_target (struct sym_hcb *np, int target, struct sym_nvram *nvp); | 197 | void sym_nvram_setup_target (struct sym_tcb *tp, int target, struct sym_nvram *nvp); |
198 | int sym_read_nvram (struct sym_device *np, struct sym_nvram *nvp); | 198 | int sym_read_nvram (struct sym_device *np, struct sym_nvram *nvp); |
199 | char *sym_nvram_type(struct sym_nvram *nvp); | 199 | char *sym_nvram_type(struct sym_nvram *nvp); |
200 | #else | 200 | #else |
201 | static inline void sym_nvram_setup_host(struct Scsi_Host *shost, struct sym_hcb *np, struct sym_nvram *nvram) { } | 201 | static inline void sym_nvram_setup_host(struct Scsi_Host *shost, struct sym_hcb *np, struct sym_nvram *nvram) { } |
202 | static inline void sym_nvram_setup_target(struct sym_hcb *np, struct sym_nvram *nvram) { } | 202 | static inline void sym_nvram_setup_target(struct sym_tcb *tp, struct sym_nvram *nvram) { } |
203 | static inline int sym_read_nvram(struct sym_device *np, struct sym_nvram *nvp) | 203 | static inline int sym_read_nvram(struct sym_device *np, struct sym_nvram *nvp) |
204 | { | 204 | { |
205 | nvp->type = 0; | 205 | nvp->type = 0; |