diff options
author | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-06-13 13:19:05 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-06-15 11:09:35 -0400 |
commit | ea4431906d86686e541de527915ccbe556761b16 (patch) | |
tree | ee24a3c6fb76443a11ab38fa2c87a4afa88788a1 | |
parent | 4aa312b96f3220103e60c32740452a336dab6260 (diff) |
[SCSI] aic79xx: make driver respect nvram for IU and QAS settings
This patch allows the Adaptec firmware to pass on its values for Packetize and
QAS. To do this, the settings max_iu and max_qas have been introduced into
the SPI transport class and populated from the adaptec NVram tables. Domain
validation in the SPI transport class will respect the max settings when
configuring to the highest possible speed for testing.
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r-- | drivers/scsi/aic7xxx/aic79xx_osm.c | 10 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_spi.c | 18 | ||||
-rw-r--r-- | include/scsi/scsi_transport_spi.h | 4 |
3 files changed, 21 insertions, 11 deletions
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 0f829b3b8ab7..75b23317bd26 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c | |||
@@ -627,19 +627,15 @@ ahd_linux_target_alloc(struct scsi_target *starget) | |||
627 | starget->id, &tstate); | 627 | starget->id, &tstate); |
628 | 628 | ||
629 | if ((flags & CFPACKETIZED) == 0) { | 629 | if ((flags & CFPACKETIZED) == 0) { |
630 | /* Do not negotiate packetized transfers */ | 630 | /* don't negotiate packetized (IU) transfers */ |
631 | spi_rd_strm(starget) = 0; | 631 | spi_max_iu(starget) = 0; |
632 | spi_pcomp_en(starget) = 0; | ||
633 | spi_rti(starget) = 0; | ||
634 | spi_wr_flow(starget) = 0; | ||
635 | spi_hold_mcs(starget) = 0; | ||
636 | } else { | 632 | } else { |
637 | if ((ahd->features & AHD_RTI) == 0) | 633 | if ((ahd->features & AHD_RTI) == 0) |
638 | spi_rti(starget) = 0; | 634 | spi_rti(starget) = 0; |
639 | } | 635 | } |
640 | 636 | ||
641 | if ((flags & CFQAS) == 0) | 637 | if ((flags & CFQAS) == 0) |
642 | spi_qas(starget) = 0; | 638 | spi_max_qas(starget) = 0; |
643 | 639 | ||
644 | /* Transinfo values have been set to BIOS settings */ | 640 | /* Transinfo values have been set to BIOS settings */ |
645 | spi_max_width(starget) = (flags & CFWIDEB) ? 1 : 0; | 641 | spi_max_width(starget) = (flags & CFWIDEB) ? 1 : 0; |
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index f49f55c6bfc8..654a34fb04cb 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c | |||
@@ -234,8 +234,10 @@ static int spi_setup_transport_attrs(struct transport_container *tc, | |||
234 | spi_width(starget) = 0; /* narrow */ | 234 | spi_width(starget) = 0; /* narrow */ |
235 | spi_max_width(starget) = 1; | 235 | spi_max_width(starget) = 1; |
236 | spi_iu(starget) = 0; /* no IU */ | 236 | spi_iu(starget) = 0; /* no IU */ |
237 | spi_max_iu(starget) = 1; | ||
237 | spi_dt(starget) = 0; /* ST */ | 238 | spi_dt(starget) = 0; /* ST */ |
238 | spi_qas(starget) = 0; | 239 | spi_qas(starget) = 0; |
240 | spi_max_qas(starget) = 1; | ||
239 | spi_wr_flow(starget) = 0; | 241 | spi_wr_flow(starget) = 0; |
240 | spi_rd_strm(starget) = 0; | 242 | spi_rd_strm(starget) = 0; |
241 | spi_rti(starget) = 0; | 243 | spi_rti(starget) = 0; |
@@ -360,9 +362,9 @@ static DEVICE_ATTR(field, S_IRUGO, \ | |||
360 | /* The Parallel SCSI Tranport Attributes: */ | 362 | /* The Parallel SCSI Tranport Attributes: */ |
361 | spi_transport_max_attr(offset, "%d\n"); | 363 | spi_transport_max_attr(offset, "%d\n"); |
362 | spi_transport_max_attr(width, "%d\n"); | 364 | spi_transport_max_attr(width, "%d\n"); |
363 | spi_transport_rd_attr(iu, "%d\n"); | 365 | spi_transport_max_attr(iu, "%d\n"); |
364 | spi_transport_rd_attr(dt, "%d\n"); | 366 | spi_transport_rd_attr(dt, "%d\n"); |
365 | spi_transport_rd_attr(qas, "%d\n"); | 367 | spi_transport_max_attr(qas, "%d\n"); |
366 | spi_transport_rd_attr(wr_flow, "%d\n"); | 368 | spi_transport_rd_attr(wr_flow, "%d\n"); |
367 | spi_transport_rd_attr(rd_strm, "%d\n"); | 369 | spi_transport_rd_attr(rd_strm, "%d\n"); |
368 | spi_transport_rd_attr(rti, "%d\n"); | 370 | spi_transport_rd_attr(rti, "%d\n"); |
@@ -874,13 +876,13 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer) | |||
874 | 876 | ||
875 | /* try QAS requests; this should be harmless to set if the | 877 | /* try QAS requests; this should be harmless to set if the |
876 | * target supports it */ | 878 | * target supports it */ |
877 | if (scsi_device_qas(sdev)) { | 879 | if (scsi_device_qas(sdev) && spi_max_qas(starget)) { |
878 | DV_SET(qas, 1); | 880 | DV_SET(qas, 1); |
879 | } else { | 881 | } else { |
880 | DV_SET(qas, 0); | 882 | DV_SET(qas, 0); |
881 | } | 883 | } |
882 | 884 | ||
883 | if (scsi_device_ius(sdev) && min_period < 9) { | 885 | if (scsi_device_ius(sdev) && spi_max_iu(starget) && min_period < 9) { |
884 | /* This u320 (or u640). Set IU transfers */ | 886 | /* This u320 (or u640). Set IU transfers */ |
885 | DV_SET(iu, 1); | 887 | DV_SET(iu, 1); |
886 | /* Then set the optional parameters */ | 888 | /* Then set the optional parameters */ |
@@ -1412,12 +1414,18 @@ static mode_t target_attribute_is_visible(struct kobject *kobj, | |||
1412 | else if (attr == &dev_attr_iu.attr && | 1414 | else if (attr == &dev_attr_iu.attr && |
1413 | spi_support_ius(starget)) | 1415 | spi_support_ius(starget)) |
1414 | return TARGET_ATTRIBUTE_HELPER(iu); | 1416 | return TARGET_ATTRIBUTE_HELPER(iu); |
1417 | else if (attr == &dev_attr_max_iu.attr && | ||
1418 | spi_support_ius(starget)) | ||
1419 | return TARGET_ATTRIBUTE_HELPER(iu); | ||
1415 | else if (attr == &dev_attr_dt.attr && | 1420 | else if (attr == &dev_attr_dt.attr && |
1416 | spi_support_dt(starget)) | 1421 | spi_support_dt(starget)) |
1417 | return TARGET_ATTRIBUTE_HELPER(dt); | 1422 | return TARGET_ATTRIBUTE_HELPER(dt); |
1418 | else if (attr == &dev_attr_qas.attr && | 1423 | else if (attr == &dev_attr_qas.attr && |
1419 | spi_support_qas(starget)) | 1424 | spi_support_qas(starget)) |
1420 | return TARGET_ATTRIBUTE_HELPER(qas); | 1425 | return TARGET_ATTRIBUTE_HELPER(qas); |
1426 | else if (attr == &dev_attr_max_qas.attr && | ||
1427 | spi_support_qas(starget)) | ||
1428 | return TARGET_ATTRIBUTE_HELPER(qas); | ||
1421 | else if (attr == &dev_attr_wr_flow.attr && | 1429 | else if (attr == &dev_attr_wr_flow.attr && |
1422 | spi_support_ius(starget)) | 1430 | spi_support_ius(starget)) |
1423 | return TARGET_ATTRIBUTE_HELPER(wr_flow); | 1431 | return TARGET_ATTRIBUTE_HELPER(wr_flow); |
@@ -1447,8 +1455,10 @@ static struct attribute *target_attributes[] = { | |||
1447 | &dev_attr_width.attr, | 1455 | &dev_attr_width.attr, |
1448 | &dev_attr_max_width.attr, | 1456 | &dev_attr_max_width.attr, |
1449 | &dev_attr_iu.attr, | 1457 | &dev_attr_iu.attr, |
1458 | &dev_attr_max_iu.attr, | ||
1450 | &dev_attr_dt.attr, | 1459 | &dev_attr_dt.attr, |
1451 | &dev_attr_qas.attr, | 1460 | &dev_attr_qas.attr, |
1461 | &dev_attr_max_qas.attr, | ||
1452 | &dev_attr_wr_flow.attr, | 1462 | &dev_attr_wr_flow.attr, |
1453 | &dev_attr_rd_strm.attr, | 1463 | &dev_attr_rd_strm.attr, |
1454 | &dev_attr_rti.attr, | 1464 | &dev_attr_rti.attr, |
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h index 286e9628ed8b..7497a383b1a4 100644 --- a/include/scsi/scsi_transport_spi.h +++ b/include/scsi/scsi_transport_spi.h | |||
@@ -36,8 +36,10 @@ struct spi_transport_attrs { | |||
36 | unsigned int width:1; /* 0 - narrow, 1 - wide */ | 36 | unsigned int width:1; /* 0 - narrow, 1 - wide */ |
37 | unsigned int max_width:1; | 37 | unsigned int max_width:1; |
38 | unsigned int iu:1; /* Information Units enabled */ | 38 | unsigned int iu:1; /* Information Units enabled */ |
39 | unsigned int max_iu:1; | ||
39 | unsigned int dt:1; /* DT clocking enabled */ | 40 | unsigned int dt:1; /* DT clocking enabled */ |
40 | unsigned int qas:1; /* Quick Arbitration and Selection enabled */ | 41 | unsigned int qas:1; /* Quick Arbitration and Selection enabled */ |
42 | unsigned int max_qas:1; | ||
41 | unsigned int wr_flow:1; /* Write Flow control enabled */ | 43 | unsigned int wr_flow:1; /* Write Flow control enabled */ |
42 | unsigned int rd_strm:1; /* Read streaming enabled */ | 44 | unsigned int rd_strm:1; /* Read streaming enabled */ |
43 | unsigned int rti:1; /* Retain Training Information */ | 45 | unsigned int rti:1; /* Retain Training Information */ |
@@ -77,8 +79,10 @@ struct spi_host_attrs { | |||
77 | #define spi_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->width) | 79 | #define spi_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->width) |
78 | #define spi_max_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_width) | 80 | #define spi_max_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_width) |
79 | #define spi_iu(x) (((struct spi_transport_attrs *)&(x)->starget_data)->iu) | 81 | #define spi_iu(x) (((struct spi_transport_attrs *)&(x)->starget_data)->iu) |
82 | #define spi_max_iu(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_iu) | ||
80 | #define spi_dt(x) (((struct spi_transport_attrs *)&(x)->starget_data)->dt) | 83 | #define spi_dt(x) (((struct spi_transport_attrs *)&(x)->starget_data)->dt) |
81 | #define spi_qas(x) (((struct spi_transport_attrs *)&(x)->starget_data)->qas) | 84 | #define spi_qas(x) (((struct spi_transport_attrs *)&(x)->starget_data)->qas) |
85 | #define spi_max_qas(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_qas) | ||
82 | #define spi_wr_flow(x) (((struct spi_transport_attrs *)&(x)->starget_data)->wr_flow) | 86 | #define spi_wr_flow(x) (((struct spi_transport_attrs *)&(x)->starget_data)->wr_flow) |
83 | #define spi_rd_strm(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rd_strm) | 87 | #define spi_rd_strm(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rd_strm) |
84 | #define spi_rti(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rti) | 88 | #define spi_rti(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rti) |