Commit 0f82cb92 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

[SCSI] aic79xx, aic7xxx: Fix incorrect width setting

Wide transfers are required for every setting of PPR apart from QAS.
It seems the DV code starts at the minimum, which turns on DT and Wide
regardless of the setting of max_width.  Redo the PPR and period
setting routines to respect max_width (i.e. start at period = 10 if it
is zero).

This fixes bugzilla 8366
Acked-by: default avatar"Freels, James D." <freelsjd@ornl.gov>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 281afe19
...@@ -2284,9 +2284,12 @@ static void ahd_linux_set_period(struct scsi_target *starget, int period) ...@@ -2284,9 +2284,12 @@ static void ahd_linux_set_period(struct scsi_target *starget, int period)
if (period < 8) if (period < 8)
period = 8; period = 8;
if (period < 10) { if (period < 10) {
ppr_options |= MSG_EXT_PPR_DT_REQ; if (spi_max_width(starget)) {
if (period == 8) ppr_options |= MSG_EXT_PPR_DT_REQ;
ppr_options |= MSG_EXT_PPR_IU_REQ; if (period == 8)
ppr_options |= MSG_EXT_PPR_IU_REQ;
} else
period = 10;
} }
dt = ppr_options & MSG_EXT_PPR_DT_REQ; dt = ppr_options & MSG_EXT_PPR_DT_REQ;
...@@ -2365,7 +2368,7 @@ static void ahd_linux_set_dt(struct scsi_target *starget, int dt) ...@@ -2365,7 +2368,7 @@ static void ahd_linux_set_dt(struct scsi_target *starget, int dt)
printf("%s: %s DT\n", ahd_name(ahd), printf("%s: %s DT\n", ahd_name(ahd),
dt ? "enabling" : "disabling"); dt ? "enabling" : "disabling");
#endif #endif
if (dt) { if (dt && spi_max_width(starget)) {
ppr_options |= MSG_EXT_PPR_DT_REQ; ppr_options |= MSG_EXT_PPR_DT_REQ;
if (!width) if (!width)
ahd_linux_set_width(starget, 1); ahd_linux_set_width(starget, 1);
...@@ -2447,7 +2450,7 @@ static void ahd_linux_set_iu(struct scsi_target *starget, int iu) ...@@ -2447,7 +2450,7 @@ static void ahd_linux_set_iu(struct scsi_target *starget, int iu)
iu ? "enabling" : "disabling"); iu ? "enabling" : "disabling");
#endif #endif
if (iu) { if (iu && spi_max_width(starget)) {
ppr_options |= MSG_EXT_PPR_IU_REQ; ppr_options |= MSG_EXT_PPR_IU_REQ;
ppr_options |= MSG_EXT_PPR_DT_REQ; /* IU requires DT */ ppr_options |= MSG_EXT_PPR_DT_REQ; /* IU requires DT */
} }
...@@ -2487,7 +2490,7 @@ static void ahd_linux_set_rd_strm(struct scsi_target *starget, int rdstrm) ...@@ -2487,7 +2490,7 @@ static void ahd_linux_set_rd_strm(struct scsi_target *starget, int rdstrm)
rdstrm ? "enabling" : "disabling"); rdstrm ? "enabling" : "disabling");
#endif #endif
if (rdstrm) if (rdstrm && spi_max_width(starget))
ppr_options |= MSG_EXT_PPR_RD_STRM; ppr_options |= MSG_EXT_PPR_RD_STRM;
ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
...@@ -2523,7 +2526,7 @@ static void ahd_linux_set_wr_flow(struct scsi_target *starget, int wrflow) ...@@ -2523,7 +2526,7 @@ static void ahd_linux_set_wr_flow(struct scsi_target *starget, int wrflow)
wrflow ? "enabling" : "disabling"); wrflow ? "enabling" : "disabling");
#endif #endif
if (wrflow) if (wrflow && spi_max_width(starget))
ppr_options |= MSG_EXT_PPR_WR_FLOW; ppr_options |= MSG_EXT_PPR_WR_FLOW;
ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
...@@ -2567,7 +2570,7 @@ static void ahd_linux_set_rti(struct scsi_target *starget, int rti) ...@@ -2567,7 +2570,7 @@ static void ahd_linux_set_rti(struct scsi_target *starget, int rti)
rti ? "enabling" : "disabling"); rti ? "enabling" : "disabling");
#endif #endif
if (rti) if (rti && spi_max_width(starget))
ppr_options |= MSG_EXT_PPR_RTI; ppr_options |= MSG_EXT_PPR_RTI;
ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
...@@ -2603,7 +2606,7 @@ static void ahd_linux_set_pcomp_en(struct scsi_target *starget, int pcomp) ...@@ -2603,7 +2606,7 @@ static void ahd_linux_set_pcomp_en(struct scsi_target *starget, int pcomp)
pcomp ? "Enable" : "Disable"); pcomp ? "Enable" : "Disable");
#endif #endif
if (pcomp) { if (pcomp && spi_max_width(starget)) {
uint8_t precomp; uint8_t precomp;
if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) { if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) {
...@@ -2647,7 +2650,7 @@ static void ahd_linux_set_hold_mcs(struct scsi_target *starget, int hold) ...@@ -2647,7 +2650,7 @@ static void ahd_linux_set_hold_mcs(struct scsi_target *starget, int hold)
unsigned int dt = ppr_options & MSG_EXT_PPR_DT_REQ; unsigned int dt = ppr_options & MSG_EXT_PPR_DT_REQ;
unsigned long flags; unsigned long flags;
if (hold) if (hold && spi_max_width(starget))
ppr_options |= MSG_EXT_PPR_HOLD_MCS; ppr_options |= MSG_EXT_PPR_HOLD_MCS;
ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
......
...@@ -2317,8 +2317,13 @@ static void ahc_linux_set_period(struct scsi_target *starget, int period) ...@@ -2317,8 +2317,13 @@ static void ahc_linux_set_period(struct scsi_target *starget, int period)
if (period < 9) if (period < 9)
period = 9; /* 12.5ns is our minimum */ period = 9; /* 12.5ns is our minimum */
if (period == 9) if (period == 9) {
ppr_options |= MSG_EXT_PPR_DT_REQ; if (spi_max_width(starget))
ppr_options |= MSG_EXT_PPR_DT_REQ;
else
/* need wide for DT and need DT for 12.5 ns */
period = 10;
}
ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
starget->channel + 'A', ROLE_INITIATOR); starget->channel + 'A', ROLE_INITIATOR);
...@@ -2381,7 +2386,7 @@ static void ahc_linux_set_dt(struct scsi_target *starget, int dt) ...@@ -2381,7 +2386,7 @@ static void ahc_linux_set_dt(struct scsi_target *starget, int dt)
unsigned long flags; unsigned long flags;
struct ahc_syncrate *syncrate; struct ahc_syncrate *syncrate;
if (dt) { if (dt && spi_max_width(starget)) {
ppr_options |= MSG_EXT_PPR_DT_REQ; ppr_options |= MSG_EXT_PPR_DT_REQ;
if (!width) if (!width)
ahc_linux_set_width(starget, 1); ahc_linux_set_width(starget, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment