aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic7xxx/aic79xx_osm.c
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@steeleye.com>2005-08-03 14:25:10 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-08-03 14:36:52 -0400
commit3f40d7d6eaadecd48f6d1c0c4a5ad414b992260e (patch)
tree0728df045096f3afb750e95b772b3dbb391b0e8d /drivers/scsi/aic7xxx/aic79xx_osm.c
parenta4b53a11806f5c0824eb4115b1de8206ed7bb89a (diff)
[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: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/aic7xxx/aic79xx_osm.c')
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c39
1 files changed, 9 insertions, 30 deletions
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index cf8e0ca830a2..10a2570ca387 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1624,7 +1624,11 @@ ahd_send_async(struct ahd_softc *ahd, char channel,
1624 target_ppr_options = 1624 target_ppr_options =
1625 (spi_dt(starget) ? MSG_EXT_PPR_DT_REQ : 0) 1625 (spi_dt(starget) ? MSG_EXT_PPR_DT_REQ : 0)
1626 + (spi_qas(starget) ? MSG_EXT_PPR_QAS_REQ : 0) 1626 + (spi_qas(starget) ? MSG_EXT_PPR_QAS_REQ : 0)
1627 + (spi_iu(starget) ? MSG_EXT_PPR_IU_REQ : 0); 1627 + (spi_iu(starget) ? MSG_EXT_PPR_IU_REQ : 0)
1628 + (spi_rd_strm(starget) ? MSG_EXT_PPR_RD_STRM : 0)
1629 + (spi_pcomp_en(starget) ? MSG_EXT_PPR_PCOMP_EN : 0)
1630 + (spi_rti(starget) ? MSG_EXT_PPR_RTI : 0)
1631 + (spi_wr_flow(starget) ? MSG_EXT_PPR_WR_FLOW : 0);
1628 1632
1629 if (tinfo->curr.period == spi_period(starget) 1633 if (tinfo->curr.period == spi_period(starget)
1630 && tinfo->curr.width == spi_width(starget) 1634 && tinfo->curr.width == spi_width(starget)
@@ -1639,6 +1643,10 @@ ahd_send_async(struct ahd_softc *ahd, char channel,
1639 spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ ? 1 : 0; 1643 spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ ? 1 : 0;
1640 spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ ? 1 : 0; 1644 spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ ? 1 : 0;
1641 spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ ? 1 : 0; 1645 spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ ? 1 : 0;
1646 spi_rd_strm(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_RD_STRM ? 1 : 0;
1647 spi_pcomp_en(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_PCOMP_EN ? 1 : 0;
1648 spi_rti(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_RTI ? 1 : 0;
1649 spi_wr_flow(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_WR_FLOW ? 1 : 0;
1642 spi_display_xfer_agreement(starget); 1650 spi_display_xfer_agreement(starget);
1643 break; 1651 break;
1644 } 1652 }
@@ -2318,18 +2326,6 @@ done:
2318 2326
2319static void ahd_linux_exit(void); 2327static void ahd_linux_exit(void);
2320 2328
2321static void ahd_linux_set_xferflags(struct scsi_target *starget, unsigned int ppr_options, unsigned int period)
2322{
2323 spi_qas(starget) = (ppr_options & MSG_EXT_PPR_QAS_REQ)? 1 : 0;
2324 spi_dt(starget) = (ppr_options & MSG_EXT_PPR_DT_REQ)? 1 : 0;
2325 spi_iu(starget) = (ppr_options & MSG_EXT_PPR_IU_REQ) ? 1 : 0;
2326 spi_rd_strm(starget) = (ppr_options & MSG_EXT_PPR_RD_STRM) ? 1 : 0;
2327 spi_wr_flow(starget) = (ppr_options & MSG_EXT_PPR_WR_FLOW) ? 1 : 0;
2328 spi_pcomp_en(starget) = (ppr_options & MSG_EXT_PPR_PCOMP_EN) ? 1 : 0;
2329 spi_rti(starget) = (ppr_options & MSG_EXT_PPR_RTI) ? 1 : 0;
2330 spi_period(starget) = period;
2331}
2332
2333static void ahd_linux_set_width(struct scsi_target *starget, int width) 2329static void ahd_linux_set_width(struct scsi_target *starget, int width)
2334{ 2330{
2335 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 2331 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 ahd_find_syncrate(ahd, &period, &ppr_options, 2384 ahd_find_syncrate(ahd, &period, &ppr_options,
2389 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); 2385 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
2390 2386
2391 ahd_linux_set_xferflags(starget, ppr_options, period);
2392
2393 ahd_lock(ahd, &flags); 2387 ahd_lock(ahd, &flags);
2394 ahd_set_syncrate(ahd, &devinfo, period, offset, 2388 ahd_set_syncrate(ahd, &devinfo, period, offset,
2395 ppr_options, AHD_TRANS_GOAL, FALSE); 2389 ppr_options, AHD_TRANS_GOAL, FALSE);
@@ -2424,7 +2418,6 @@ static void ahd_linux_set_offset(struct scsi_target *starget, int offset)
2424 ahd_find_syncrate(ahd, &period, &ppr_options, 2418 ahd_find_syncrate(ahd, &period, &ppr_options,
2425 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); 2419 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
2426 } 2420 }
2427 ahd_linux_set_xferflags(starget, ppr_options, period);
2428 2421
2429 ahd_lock(ahd, &flags); 2422 ahd_lock(ahd, &flags);
2430 ahd_set_syncrate(ahd, &devinfo, period, offset, ppr_options, 2423 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 ahd_find_syncrate(ahd, &period, &ppr_options, 2460 ahd_find_syncrate(ahd, &period, &ppr_options,
2468 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); 2461 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
2469 2462
2470 ahd_linux_set_xferflags(starget, ppr_options, period);
2471
2472 ahd_lock(ahd, &flags); 2463 ahd_lock(ahd, &flags);
2473 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, 2464 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2474 ppr_options, AHD_TRANS_GOAL, FALSE); 2465 ppr_options, AHD_TRANS_GOAL, FALSE);
@@ -2508,8 +2499,6 @@ static void ahd_linux_set_qas(struct scsi_target *starget, int qas)
2508 ahd_find_syncrate(ahd, &period, &ppr_options, 2499 ahd_find_syncrate(ahd, &period, &ppr_options,
2509 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); 2500 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
2510 2501
2511 spi_qas(starget) = (ppr_options & MSG_EXT_PPR_QAS_REQ)? 1 : 0;
2512
2513 ahd_lock(ahd, &flags); 2502 ahd_lock(ahd, &flags);
2514 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, 2503 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2515 ppr_options, AHD_TRANS_GOAL, FALSE); 2504 ppr_options, AHD_TRANS_GOAL, FALSE);
@@ -2550,8 +2539,6 @@ static void ahd_linux_set_iu(struct scsi_target *starget, int iu)
2550 ahd_find_syncrate(ahd, &period, &ppr_options, 2539 ahd_find_syncrate(ahd, &period, &ppr_options,
2551 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); 2540 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
2552 2541
2553 ahd_linux_set_xferflags(starget, ppr_options, period);
2554
2555 ahd_lock(ahd, &flags); 2542 ahd_lock(ahd, &flags);
2556 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, 2543 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2557 ppr_options, AHD_TRANS_GOAL, FALSE); 2544 ppr_options, AHD_TRANS_GOAL, FALSE);
@@ -2588,8 +2575,6 @@ static void ahd_linux_set_rd_strm(struct scsi_target *starget, int rdstrm)
2588 ahd_find_syncrate(ahd, &period, &ppr_options, 2575 ahd_find_syncrate(ahd, &period, &ppr_options,
2589 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); 2576 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
2590 2577
2591 spi_rd_strm(starget) = (ppr_options & MSG_EXT_PPR_RD_STRM) ? 1 : 0;
2592
2593 ahd_lock(ahd, &flags); 2578 ahd_lock(ahd, &flags);
2594 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, 2579 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2595 ppr_options, AHD_TRANS_GOAL, FALSE); 2580 ppr_options, AHD_TRANS_GOAL, FALSE);
@@ -2626,8 +2611,6 @@ static void ahd_linux_set_wr_flow(struct scsi_target *starget, int wrflow)
2626 ahd_find_syncrate(ahd, &period, &ppr_options, 2611 ahd_find_syncrate(ahd, &period, &ppr_options,
2627 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); 2612 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
2628 2613
2629 spi_wr_flow(starget) = (ppr_options & MSG_EXT_PPR_WR_FLOW) ? 1 : 0;
2630
2631 ahd_lock(ahd, &flags); 2614 ahd_lock(ahd, &flags);
2632 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, 2615 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2633 ppr_options, AHD_TRANS_GOAL, FALSE); 2616 ppr_options, AHD_TRANS_GOAL, FALSE);
@@ -2672,8 +2655,6 @@ static void ahd_linux_set_rti(struct scsi_target *starget, int rti)
2672 ahd_find_syncrate(ahd, &period, &ppr_options, 2655 ahd_find_syncrate(ahd, &period, &ppr_options,
2673 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); 2656 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
2674 2657
2675 spi_rti(starget) = (ppr_options & MSG_EXT_PPR_RTI) ? 1 : 0;
2676
2677 ahd_lock(ahd, &flags); 2658 ahd_lock(ahd, &flags);
2678 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, 2659 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2679 ppr_options, AHD_TRANS_GOAL, FALSE); 2660 ppr_options, AHD_TRANS_GOAL, FALSE);
@@ -2710,8 +2691,6 @@ static void ahd_linux_set_pcomp_en(struct scsi_target *starget, int pcomp)
2710 ahd_find_syncrate(ahd, &period, &ppr_options, 2691 ahd_find_syncrate(ahd, &period, &ppr_options,
2711 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2); 2692 dt ? AHD_SYNCRATE_MAX : AHD_SYNCRATE_ULTRA2);
2712 2693
2713 spi_pcomp_en(starget) = (ppr_options & MSG_EXT_PPR_PCOMP_EN) ? 1 : 0;
2714
2715 ahd_lock(ahd, &flags); 2694 ahd_lock(ahd, &flags);
2716 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset, 2695 ahd_set_syncrate(ahd, &devinfo, period, tinfo->goal.offset,
2717 ppr_options, AHD_TRANS_GOAL, FALSE); 2696 ppr_options, AHD_TRANS_GOAL, FALSE);