Commit 3f40d7d6 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

[SCSI] aic79xx: fix up transport settings

There's a slight problem in the way you've done the transport
parameters; reading from the variables actually produces the current
settings, not the ones you just set (and there's usually a lag because
devices don't renegotiate until the next command goes over the bus).  If
you set the bit immediately, you get into the situation where the
transport parameters report something as being set even if the drive
cannot support it.

I patched the driver to do it this way and also corrected a panic in the
proc routines.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent a4b53a11
...@@ -1624,7 +1624,11 @@ ahd_send_async(struct ahd_softc *ahd, char channel, ...@@ -1624,7 +1624,11 @@ ahd_send_async(struct ahd_softc *ahd, char channel,
target_ppr_options = target_ppr_options =
(spi_dt(starget) ? MSG_EXT_PPR_DT_REQ : 0) (spi_dt(starget) ? MSG_EXT_PPR_DT_REQ : 0)
+ (spi_qas(starget) ? MSG_EXT_PPR_QAS_REQ : 0) + (spi_qas(starget) ? MSG_EXT_PPR_QAS_REQ : 0)
+ (spi_iu(starget) ? MSG_EXT_PPR_IU_REQ : 0); + (spi_iu(starget) ? MSG_EXT_PPR_IU_REQ : 0)
+ (spi_rd_strm(starget) ? MSG_EXT_PPR_RD_STRM : 0)
+ (spi_pcomp_en(starget) ? MSG_EXT_PPR_PCOMP_EN : 0)
+ (spi_rti(starget) ? MSG_EXT_PPR_RTI : 0)
+ (spi_wr_flow(starget) ? MSG_EXT_PPR_WR_FLOW : 0);
if (tinfo->curr.period == spi_period(starget) if (tinfo->curr.period == spi_period(starget)
&& tinfo->curr.width == spi_width(starget) && tinfo->curr.width == spi_width(starget)
...@@ -1639,6 +1643,10 @@ ahd_send_async(struct ahd_softc *ahd, char channel, ...@@ -1639,6 +1643,10 @@ ahd_send_async(struct ahd_softc *ahd, char channel,
spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ ? 1 : 0; spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ ? 1 : 0;
spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ ? 1 : 0; spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ ? 1 : 0;
spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ ? 1 : 0; spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ ? 1 : 0;
spi_rd_strm(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_RD_STRM ? 1 : 0;
spi_pcomp_en(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_PCOMP_EN ? 1 : 0;
spi_rti(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_RTI ? 1 : 0;
spi_wr_flow(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_WR_FLOW ? 1 : 0;
spi_display_xfer_agreement(starget); spi_display_xfer_agreement(starget);
break; break;
} }
...@@ -2318,18 +2326,6 @@ done: ...@@ -2318,18 +2326,6 @@ done:
static void ahd_linux_exit(void); static void ahd_linux_exit(void);
static void ahd_linux_set_xferflags(struct scsi_target *starget, unsigned int ppr_options, unsigned int period)
{
spi_qas(starget) = (ppr_options & MSG_EXT_PPR_QAS_REQ)? 1 : 0;
spi_dt(starget) = (ppr_options & MSG_EXT_PPR_DT_REQ)? 1 : 0;
spi_iu(starget) = (ppr_options & MSG_EXT_PPR_IU_REQ) ? 1 : 0;
spi_rd_strm(starget) = (ppr_options & MSG_EXT_PPR_RD_STRM) ? 1 : 0;
spi_wr_flow(starget) = (ppr_options & MSG_EXT_PPR_WR_FLOW) ? 1 : 0;
spi_pcomp_en(starget) = (ppr_options & MSG_EXT_PPR_PCOMP_EN) ? 1 : 0;
spi_rti(starget) = (ppr_options & MSG_EXT_PPR_RTI) ? 1 : 0;
spi_period(starget) = period;
}
static void ahd_linux_set_width(struct scsi_target *starget, int width) static void ahd_linux_set_width(struct scsi_target *starget, int width)
{ {
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
...@@ -2388,8 +2384,6 @@ static void ahd_linux_set_period(struct scsi_target *starget, int period) ...@@ -2388,8 +2384,6 @@ static void ahd_linux_set_period(struct scsi_target *starget, int period)
ahd_find_syncrate(ahd, &period, &ppr_options, ahd_find_syncrate(ahd, &period, &ppr_options,
dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
ahd_linux_set_xferflags(starget, ppr_options, period);
ahd_lock(ahd, &flags); ahd_lock(ahd, &flags);
ahd_set_syncrate(ahd, &devinfo, period, offset, ahd_set_syncrate(ahd, &devinfo, period, offset,
ppr_options, AHD_TRANS_GOAL, FALSE); ppr_options, AHD_TRANS_GOAL, FALSE);
...@@ -2424,7 +2418,6 @@ static void ahd_linux_set_offset(struct scsi_target *starget, int offset) ...@@ -2424,7 +2418,6 @@ static void ahd_linux_set_offset(struct scsi_target *starget, int offset)
ahd_find_syncrate(ahd, &period, &ppr_options, ahd_find_syncrate(ahd, &period, &ppr_options,
dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
} }
ahd_linux_set_xferflags(starget, ppr_options, period);
ahd_lock(ahd, &flags); ahd_lock(ahd, &flags);
ahd_set_syncrate(ahd, &devinfo, period, offset, ppr_options, ahd_set_syncrate(ahd, &devinfo, period, offset, ppr_options,
...@@ -2467,8 +2460,6 @@ static void ahd_linux_set_dt(struct scsi_target *starget, int dt) ...@@ -2467,8 +2460,6 @@ static void ahd_linux_set_dt(struct scsi_target *starget, int dt)
ahd_find_syncrate(ahd, &period, &ppr_options, ahd_find_syncrate(ahd, &period, &ppr_options,
dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
ahd_linux_set_xferflags(starget, ppr_options, period);
ahd_lock(ahd, &flags); ahd_lock(ahd, &flags);
ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
ppr_options, AHD_TRANS_GOAL, FALSE); ppr_options, AHD_TRANS_GOAL, FALSE);
...@@ -2508,8 +2499,6 @@ static void ahd_linux_set_qas(struct scsi_target *starget, int qas) ...@@ -2508,8 +2499,6 @@ static void ahd_linux_set_qas(struct scsi_target *starget, int qas)
ahd_find_syncrate(ahd, &period, &ppr_options, ahd_find_syncrate(ahd, &period, &ppr_options,
dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
spi_qas(starget) = (ppr_options & MSG_EXT_PPR_QAS_REQ)? 1 : 0;
ahd_lock(ahd, &flags); ahd_lock(ahd, &flags);
ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
ppr_options, AHD_TRANS_GOAL, FALSE); ppr_options, AHD_TRANS_GOAL, FALSE);
...@@ -2550,8 +2539,6 @@ static void ahd_linux_set_iu(struct scsi_target *starget, int iu) ...@@ -2550,8 +2539,6 @@ static void ahd_linux_set_iu(struct scsi_target *starget, int iu)
ahd_find_syncrate(ahd, &period, &ppr_options, ahd_find_syncrate(ahd, &period, &ppr_options,
dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
ahd_linux_set_xferflags(starget, ppr_options, period);
ahd_lock(ahd, &flags); ahd_lock(ahd, &flags);
ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
ppr_options, AHD_TRANS_GOAL, FALSE); ppr_options, AHD_TRANS_GOAL, FALSE);
...@@ -2588,8 +2575,6 @@ static void ahd_linux_set_rd_strm(struct scsi_target *starget, int rdstrm) ...@@ -2588,8 +2575,6 @@ static void ahd_linux_set_rd_strm(struct scsi_target *starget, int rdstrm)
ahd_find_syncrate(ahd, &period, &ppr_options, ahd_find_syncrate(ahd, &period, &ppr_options,
dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
spi_rd_strm(starget) = (ppr_options & MSG_EXT_PPR_RD_STRM) ? 1 : 0;
ahd_lock(ahd, &flags); ahd_lock(ahd, &flags);
ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
ppr_options, AHD_TRANS_GOAL, FALSE); ppr_options, AHD_TRANS_GOAL, FALSE);
...@@ -2626,8 +2611,6 @@ static void ahd_linux_set_wr_flow(struct scsi_target *starget, int wrflow) ...@@ -2626,8 +2611,6 @@ static void ahd_linux_set_wr_flow(struct scsi_target *starget, int wrflow)
ahd_find_syncrate(ahd, &period, &ppr_options, ahd_find_syncrate(ahd, &period, &ppr_options,
dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
spi_wr_flow(starget) = (ppr_options & MSG_EXT_PPR_WR_FLOW) ? 1 : 0;
ahd_lock(ahd, &flags); ahd_lock(ahd, &flags);
ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
ppr_options, AHD_TRANS_GOAL, FALSE); ppr_options, AHD_TRANS_GOAL, FALSE);
...@@ -2672,8 +2655,6 @@ static void ahd_linux_set_rti(struct scsi_target *starget, int rti) ...@@ -2672,8 +2655,6 @@ static void ahd_linux_set_rti(struct scsi_target *starget, int rti)
ahd_find_syncrate(ahd, &period, &ppr_options, ahd_find_syncrate(ahd, &period, &ppr_options,
dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
spi_rti(starget) = (ppr_options & MSG_EXT_PPR_RTI) ? 1 : 0;
ahd_lock(ahd, &flags); ahd_lock(ahd, &flags);
ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
ppr_options, AHD_TRANS_GOAL, FALSE); ppr_options, AHD_TRANS_GOAL, FALSE);
...@@ -2710,8 +2691,6 @@ static void ahd_linux_set_pcomp_en(struct scsi_target *starget, int pcomp) ...@@ -2710,8 +2691,6 @@ static void ahd_linux_set_pcomp_en(struct scsi_target *starget, int pcomp)
ahd_find_syncrate(ahd, &period, &ppr_options, ahd_find_syncrate(ahd, &period, &ppr_options,
dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
spi_pcomp_en(starget) = (ppr_options & MSG_EXT_PPR_PCOMP_EN) ? 1 : 0;
ahd_lock(ahd, &flags); ahd_lock(ahd, &flags);
ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
ppr_options, AHD_TRANS_GOAL, FALSE); ppr_options, AHD_TRANS_GOAL, FALSE);
......
...@@ -178,9 +178,9 @@ ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info, ...@@ -178,9 +178,9 @@ ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info,
copy_info(info, "\tUser: "); copy_info(info, "\tUser: ");
ahd_format_transinfo(info, &tinfo->user); ahd_format_transinfo(info, &tinfo->user);
starget = ahd->platform_data->starget[target_offset]; starget = ahd->platform_data->starget[target_offset];
targ = scsi_transport_target_data(starget); if (starget == NULL)
if (targ == NULL)
return; return;
targ = scsi_transport_target_data(starget);
copy_info(info, "\tGoal: "); copy_info(info, "\tGoal: ");
ahd_format_transinfo(info, &tinfo->goal); ahd_format_transinfo(info, &tinfo->goal);
......
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