aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic7xxx
diff options
context:
space:
mode:
authorJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-07-03 10:41:12 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-07-03 10:41:12 -0400
commitc4e00fac42f268ed0a547cdd1d12bb8399864040 (patch)
tree1a54d87be2066c49b71a03764fcb4fc7f9c68c41 /drivers/scsi/aic7xxx
parent29454dde27d8e340bb1987bad9aa504af7081eba (diff)
parentd6b0c53723753fc0cfda63f56735b225c43e1e9a (diff)
Merge ../scsi-misc-2.6
Conflicts: drivers/scsi/nsp32.c drivers/scsi/pcmcia/nsp_cs.c Removal of randomness flag conflicts with SA_ -> IRQF_ global replacement. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/aic7xxx')
-rw-r--r--drivers/scsi/aic7xxx/aic79xx.h1
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_core.c24
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c62
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.h11
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_proc.c19
5 files changed, 36 insertions, 81 deletions
diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h
index eb7745692682..df3346b5caf8 100644
--- a/drivers/scsi/aic7xxx/aic79xx.h
+++ b/drivers/scsi/aic7xxx/aic79xx.h
@@ -1487,6 +1487,7 @@ typedef enum {
1487} ahd_queue_alg; 1487} ahd_queue_alg;
1488 1488
1489void ahd_set_tags(struct ahd_softc *ahd, 1489void ahd_set_tags(struct ahd_softc *ahd,
1490 struct scsi_cmnd *cmd,
1490 struct ahd_devinfo *devinfo, 1491 struct ahd_devinfo *devinfo,
1491 ahd_queue_alg alg); 1492 ahd_queue_alg alg);
1492 1493
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index 801fc81d0b20..a1e8ca758594 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -1090,7 +1090,7 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)
1090 1090
1091 /* Notify XPT */ 1091 /* Notify XPT */
1092 ahd_send_async(ahd, devinfo.channel, devinfo.target, 1092 ahd_send_async(ahd, devinfo.channel, devinfo.target,
1093 CAM_LUN_WILDCARD, AC_SENT_BDR, NULL); 1093 CAM_LUN_WILDCARD, AC_SENT_BDR);
1094 1094
1095 /* 1095 /*
1096 * Allow the sequencer to continue with 1096 * Allow the sequencer to continue with
@@ -3062,7 +3062,7 @@ ahd_set_syncrate(struct ahd_softc *ahd, struct ahd_devinfo *devinfo,
3062 tinfo->curr.ppr_options = ppr_options; 3062 tinfo->curr.ppr_options = ppr_options;
3063 3063
3064 ahd_send_async(ahd, devinfo->channel, devinfo->target, 3064 ahd_send_async(ahd, devinfo->channel, devinfo->target,
3065 CAM_LUN_WILDCARD, AC_TRANSFER_NEG, NULL); 3065 CAM_LUN_WILDCARD, AC_TRANSFER_NEG);
3066 if (bootverbose) { 3066 if (bootverbose) {
3067 if (offset != 0) { 3067 if (offset != 0) {
3068 int options; 3068 int options;
@@ -3184,7 +3184,7 @@ ahd_set_width(struct ahd_softc *ahd, struct ahd_devinfo *devinfo,
3184 3184
3185 tinfo->curr.width = width; 3185 tinfo->curr.width = width;
3186 ahd_send_async(ahd, devinfo->channel, devinfo->target, 3186 ahd_send_async(ahd, devinfo->channel, devinfo->target,
3187 CAM_LUN_WILDCARD, AC_TRANSFER_NEG, NULL); 3187 CAM_LUN_WILDCARD, AC_TRANSFER_NEG);
3188 if (bootverbose) { 3188 if (bootverbose) {
3189 printf("%s: target %d using %dbit transfers\n", 3189 printf("%s: target %d using %dbit transfers\n",
3190 ahd_name(ahd), devinfo->target, 3190 ahd_name(ahd), devinfo->target,
@@ -3211,12 +3211,14 @@ ahd_set_width(struct ahd_softc *ahd, struct ahd_devinfo *devinfo,
3211 * Update the current state of tagged queuing for a given target. 3211 * Update the current state of tagged queuing for a given target.
3212 */ 3212 */
3213void 3213void
3214ahd_set_tags(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, 3214ahd_set_tags(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
3215 ahd_queue_alg alg) 3215 struct ahd_devinfo *devinfo, ahd_queue_alg alg)
3216{ 3216{
3217 ahd_platform_set_tags(ahd, devinfo, alg); 3217 struct scsi_device *sdev = cmd->device;
3218
3219 ahd_platform_set_tags(ahd, sdev, devinfo, alg);
3218 ahd_send_async(ahd, devinfo->channel, devinfo->target, 3220 ahd_send_async(ahd, devinfo->channel, devinfo->target,
3219 devinfo->lun, AC_TRANSFER_NEG, &alg); 3221 devinfo->lun, AC_TRANSFER_NEG);
3220} 3222}
3221 3223
3222static void 3224static void
@@ -4746,7 +4748,7 @@ ahd_handle_msg_reject(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
4746 printf("(%s:%c:%d:%d): refuses tagged commands. " 4748 printf("(%s:%c:%d:%d): refuses tagged commands. "
4747 "Performing non-tagged I/O\n", ahd_name(ahd), 4749 "Performing non-tagged I/O\n", ahd_name(ahd),
4748 devinfo->channel, devinfo->target, devinfo->lun); 4750 devinfo->channel, devinfo->target, devinfo->lun);
4749 ahd_set_tags(ahd, devinfo, AHD_QUEUE_NONE); 4751 ahd_set_tags(ahd, scb->io_ctx, devinfo, AHD_QUEUE_NONE);
4750 mask = ~0x23; 4752 mask = ~0x23;
4751 } else { 4753 } else {
4752 printf("(%s:%c:%d:%d): refuses %s tagged commands. " 4754 printf("(%s:%c:%d:%d): refuses %s tagged commands. "
@@ -4754,7 +4756,7 @@ ahd_handle_msg_reject(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
4754 ahd_name(ahd), devinfo->channel, devinfo->target, 4756 ahd_name(ahd), devinfo->channel, devinfo->target,
4755 devinfo->lun, tag_type == MSG_ORDERED_TASK 4757 devinfo->lun, tag_type == MSG_ORDERED_TASK
4756 ? "ordered" : "head of queue"); 4758 ? "ordered" : "head of queue");
4757 ahd_set_tags(ahd, devinfo, AHD_QUEUE_BASIC); 4759 ahd_set_tags(ahd, scb->io_ctx, devinfo, AHD_QUEUE_BASIC);
4758 mask = ~0x03; 4760 mask = ~0x03;
4759 } 4761 }
4760 4762
@@ -5098,7 +5100,7 @@ ahd_handle_devreset(struct ahd_softc *ahd, struct ahd_devinfo *devinfo,
5098 5100
5099 if (status != CAM_SEL_TIMEOUT) 5101 if (status != CAM_SEL_TIMEOUT)
5100 ahd_send_async(ahd, devinfo->channel, devinfo->target, 5102 ahd_send_async(ahd, devinfo->channel, devinfo->target,
5101 CAM_LUN_WILDCARD, AC_SENT_BDR, NULL); 5103 CAM_LUN_WILDCARD, AC_SENT_BDR);
5102 5104
5103 if (message != NULL && bootverbose) 5105 if (message != NULL && bootverbose)
5104 printf("%s: %s on %c:%d. %d SCBs aborted\n", ahd_name(ahd), 5106 printf("%s: %s on %c:%d. %d SCBs aborted\n", ahd_name(ahd),
@@ -7952,7 +7954,7 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset)
7952#endif 7954#endif
7953 /* Notify the XPT that a bus reset occurred */ 7955 /* Notify the XPT that a bus reset occurred */
7954 ahd_send_async(ahd, devinfo.channel, CAM_TARGET_WILDCARD, 7956 ahd_send_async(ahd, devinfo.channel, CAM_TARGET_WILDCARD,
7955 CAM_LUN_WILDCARD, AC_BUS_RESET, NULL); 7957 CAM_LUN_WILDCARD, AC_BUS_RESET);
7956 7958
7957 /* 7959 /*
7958 * Revert to async/narrow transfers until we renegotiate. 7960 * Revert to async/narrow transfers until we renegotiate.
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index e0ccdf362200..b244c7124179 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -484,7 +484,6 @@ ahd_linux_target_alloc(struct scsi_target *starget)
484 struct seeprom_config *sc = ahd->seep_config; 484 struct seeprom_config *sc = ahd->seep_config;
485 unsigned long flags; 485 unsigned long flags;
486 struct scsi_target **ahd_targp = ahd_linux_target_in_softc(starget); 486 struct scsi_target **ahd_targp = ahd_linux_target_in_softc(starget);
487 struct ahd_linux_target *targ = scsi_transport_target_data(starget);
488 struct ahd_devinfo devinfo; 487 struct ahd_devinfo devinfo;
489 struct ahd_initiator_tinfo *tinfo; 488 struct ahd_initiator_tinfo *tinfo;
490 struct ahd_tmode_tstate *tstate; 489 struct ahd_tmode_tstate *tstate;
@@ -495,7 +494,6 @@ ahd_linux_target_alloc(struct scsi_target *starget)
495 BUG_ON(*ahd_targp != NULL); 494 BUG_ON(*ahd_targp != NULL);
496 495
497 *ahd_targp = starget; 496 *ahd_targp = starget;
498 memset(targ, 0, sizeof(*targ));
499 497
500 if (sc) { 498 if (sc) {
501 int flags = sc->device_flags[starget->id]; 499 int flags = sc->device_flags[starget->id];
@@ -551,15 +549,11 @@ ahd_linux_slave_alloc(struct scsi_device *sdev)
551{ 549{
552 struct ahd_softc *ahd = 550 struct ahd_softc *ahd =
553 *((struct ahd_softc **)sdev->host->hostdata); 551 *((struct ahd_softc **)sdev->host->hostdata);
554 struct scsi_target *starget = sdev->sdev_target;
555 struct ahd_linux_target *targ = scsi_transport_target_data(starget);
556 struct ahd_linux_device *dev; 552 struct ahd_linux_device *dev;
557 553
558 if (bootverbose) 554 if (bootverbose)
559 printf("%s: Slave Alloc %d\n", ahd_name(ahd), sdev->id); 555 printf("%s: Slave Alloc %d\n", ahd_name(ahd), sdev->id);
560 556
561 BUG_ON(targ->sdev[sdev->lun] != NULL);
562
563 dev = scsi_transport_device_data(sdev); 557 dev = scsi_transport_device_data(sdev);
564 memset(dev, 0, sizeof(*dev)); 558 memset(dev, 0, sizeof(*dev));
565 559
@@ -576,8 +570,6 @@ ahd_linux_slave_alloc(struct scsi_device *sdev)
576 */ 570 */
577 dev->maxtags = 0; 571 dev->maxtags = 0;
578 572
579 targ->sdev[sdev->lun] = sdev;
580
581 return (0); 573 return (0);
582} 574}
583 575
@@ -599,23 +591,6 @@ ahd_linux_slave_configure(struct scsi_device *sdev)
599 return 0; 591 return 0;
600} 592}
601 593
602static void
603ahd_linux_slave_destroy(struct scsi_device *sdev)
604{
605 struct ahd_softc *ahd;
606 struct ahd_linux_device *dev = scsi_transport_device_data(sdev);
607 struct ahd_linux_target *targ = scsi_transport_target_data(sdev->sdev_target);
608
609 ahd = *((struct ahd_softc **)sdev->host->hostdata);
610 if (bootverbose)
611 printf("%s: Slave Destroy %d\n", ahd_name(ahd), sdev->id);
612
613 BUG_ON(dev->active);
614
615 targ->sdev[sdev->lun] = NULL;
616
617}
618
619#if defined(__i386__) 594#if defined(__i386__)
620/* 595/*
621 * Return the disk geometry for the given SCSI device. 596 * Return the disk geometry for the given SCSI device.
@@ -822,7 +797,6 @@ struct scsi_host_template aic79xx_driver_template = {
822 .use_clustering = ENABLE_CLUSTERING, 797 .use_clustering = ENABLE_CLUSTERING,
823 .slave_alloc = ahd_linux_slave_alloc, 798 .slave_alloc = ahd_linux_slave_alloc,
824 .slave_configure = ahd_linux_slave_configure, 799 .slave_configure = ahd_linux_slave_configure,
825 .slave_destroy = ahd_linux_slave_destroy,
826 .target_alloc = ahd_linux_target_alloc, 800 .target_alloc = ahd_linux_target_alloc,
827 .target_destroy = ahd_linux_target_destroy, 801 .target_destroy = ahd_linux_target_destroy,
828}; 802};
@@ -1249,20 +1223,13 @@ void
1249ahd_platform_free(struct ahd_softc *ahd) 1223ahd_platform_free(struct ahd_softc *ahd)
1250{ 1224{
1251 struct scsi_target *starget; 1225 struct scsi_target *starget;
1252 int i, j; 1226 int i;
1253 1227
1254 if (ahd->platform_data != NULL) { 1228 if (ahd->platform_data != NULL) {
1255 /* destroy all of the device and target objects */ 1229 /* destroy all of the device and target objects */
1256 for (i = 0; i < AHD_NUM_TARGETS; i++) { 1230 for (i = 0; i < AHD_NUM_TARGETS; i++) {
1257 starget = ahd->platform_data->starget[i]; 1231 starget = ahd->platform_data->starget[i];
1258 if (starget != NULL) { 1232 if (starget != NULL) {
1259 for (j = 0; j < AHD_NUM_LUNS; j++) {
1260 struct ahd_linux_target *targ =
1261 scsi_transport_target_data(starget);
1262 if (targ->sdev[j] == NULL)
1263 continue;
1264 targ->sdev[j] = NULL;
1265 }
1266 ahd->platform_data->starget[i] = NULL; 1233 ahd->platform_data->starget[i] = NULL;
1267 } 1234 }
1268 } 1235 }
@@ -1318,20 +1285,13 @@ ahd_platform_freeze_devq(struct ahd_softc *ahd, struct scb *scb)
1318} 1285}
1319 1286
1320void 1287void
1321ahd_platform_set_tags(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, 1288ahd_platform_set_tags(struct ahd_softc *ahd, struct scsi_device *sdev,
1322 ahd_queue_alg alg) 1289 struct ahd_devinfo *devinfo, ahd_queue_alg alg)
1323{ 1290{
1324 struct scsi_target *starget;
1325 struct ahd_linux_target *targ;
1326 struct ahd_linux_device *dev; 1291 struct ahd_linux_device *dev;
1327 struct scsi_device *sdev;
1328 int was_queuing; 1292 int was_queuing;
1329 int now_queuing; 1293 int now_queuing;
1330 1294
1331 starget = ahd->platform_data->starget[devinfo->target];
1332 targ = scsi_transport_target_data(starget);
1333 BUG_ON(targ == NULL);
1334 sdev = targ->sdev[devinfo->lun];
1335 if (sdev == NULL) 1295 if (sdev == NULL)
1336 return; 1296 return;
1337 1297
@@ -1467,11 +1427,15 @@ ahd_linux_device_queue_depth(struct scsi_device *sdev)
1467 tags = ahd_linux_user_tagdepth(ahd, &devinfo); 1427 tags = ahd_linux_user_tagdepth(ahd, &devinfo);
1468 if (tags != 0 && sdev->tagged_supported != 0) { 1428 if (tags != 0 && sdev->tagged_supported != 0) {
1469 1429
1470 ahd_set_tags(ahd, &devinfo, AHD_QUEUE_TAGGED); 1430 ahd_platform_set_tags(ahd, sdev, &devinfo, AHD_QUEUE_TAGGED);
1431 ahd_send_async(ahd, devinfo.channel, devinfo.target,
1432 devinfo.lun, AC_TRANSFER_NEG);
1471 ahd_print_devinfo(ahd, &devinfo); 1433 ahd_print_devinfo(ahd, &devinfo);
1472 printf("Tagged Queuing enabled. Depth %d\n", tags); 1434 printf("Tagged Queuing enabled. Depth %d\n", tags);
1473 } else { 1435 } else {
1474 ahd_set_tags(ahd, &devinfo, AHD_QUEUE_NONE); 1436 ahd_platform_set_tags(ahd, sdev, &devinfo, AHD_QUEUE_NONE);
1437 ahd_send_async(ahd, devinfo.channel, devinfo.target,
1438 devinfo.lun, AC_TRANSFER_NEG);
1475 } 1439 }
1476} 1440}
1477 1441
@@ -1629,7 +1593,7 @@ ahd_linux_isr(int irq, void *dev_id, struct pt_regs * regs)
1629 1593
1630void 1594void
1631ahd_send_async(struct ahd_softc *ahd, char channel, 1595ahd_send_async(struct ahd_softc *ahd, char channel,
1632 u_int target, u_int lun, ac_code code, void *arg) 1596 u_int target, u_int lun, ac_code code)
1633{ 1597{
1634 switch (code) { 1598 switch (code) {
1635 case AC_TRANSFER_NEG: 1599 case AC_TRANSFER_NEG:
@@ -1956,7 +1920,7 @@ ahd_linux_handle_scsi_status(struct ahd_softc *ahd,
1956 } 1920 }
1957 ahd_set_transaction_status(scb, CAM_REQUEUE_REQ); 1921 ahd_set_transaction_status(scb, CAM_REQUEUE_REQ);
1958 ahd_set_scsi_status(scb, SCSI_STATUS_OK); 1922 ahd_set_scsi_status(scb, SCSI_STATUS_OK);
1959 ahd_platform_set_tags(ahd, &devinfo, 1923 ahd_platform_set_tags(ahd, sdev, &devinfo,
1960 (dev->flags & AHD_DEV_Q_BASIC) 1924 (dev->flags & AHD_DEV_Q_BASIC)
1961 ? AHD_QUEUE_BASIC : AHD_QUEUE_TAGGED); 1925 ? AHD_QUEUE_BASIC : AHD_QUEUE_TAGGED);
1962 break; 1926 break;
@@ -1966,7 +1930,7 @@ ahd_linux_handle_scsi_status(struct ahd_softc *ahd,
1966 * as if the target returned BUSY SCSI status. 1930 * as if the target returned BUSY SCSI status.
1967 */ 1931 */
1968 dev->openings = 1; 1932 dev->openings = 1;
1969 ahd_platform_set_tags(ahd, &devinfo, 1933 ahd_platform_set_tags(ahd, sdev, &devinfo,
1970 (dev->flags & AHD_DEV_Q_BASIC) 1934 (dev->flags & AHD_DEV_Q_BASIC)
1971 ? AHD_QUEUE_BASIC : AHD_QUEUE_TAGGED); 1935 ? AHD_QUEUE_BASIC : AHD_QUEUE_TAGGED);
1972 ahd_set_scsi_status(scb, SCSI_STATUS_BUSY); 1936 ahd_set_scsi_status(scb, SCSI_STATUS_BUSY);
@@ -2778,8 +2742,6 @@ ahd_linux_init(void)
2778 if (!ahd_linux_transport_template) 2742 if (!ahd_linux_transport_template)
2779 return -ENODEV; 2743 return -ENODEV;
2780 2744
2781 scsi_transport_reserve_target(ahd_linux_transport_template,
2782 sizeof(struct ahd_linux_target));
2783 scsi_transport_reserve_device(ahd_linux_transport_template, 2745 scsi_transport_reserve_device(ahd_linux_transport_template,
2784 sizeof(struct ahd_linux_device)); 2746 sizeof(struct ahd_linux_device));
2785 2747
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h
index 92c6154575e7..9e871de23835 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.h
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.h
@@ -262,7 +262,6 @@ typedef enum {
262 AHD_DEV_PERIODIC_OTAG = 0x40, /* Send OTAG to prevent starvation */ 262 AHD_DEV_PERIODIC_OTAG = 0x40, /* Send OTAG to prevent starvation */
263} ahd_linux_dev_flags; 263} ahd_linux_dev_flags;
264 264
265struct ahd_linux_target;
266struct ahd_linux_device { 265struct ahd_linux_device {
267 TAILQ_ENTRY(ahd_linux_device) links; 266 TAILQ_ENTRY(ahd_linux_device) links;
268 267
@@ -342,12 +341,6 @@ struct ahd_linux_device {
342#define AHD_OTAG_THRESH 500 341#define AHD_OTAG_THRESH 500
343}; 342};
344 343
345struct ahd_linux_target {
346 struct scsi_device *sdev[AHD_NUM_LUNS];
347 struct ahd_transinfo last_tinfo;
348 struct ahd_softc *ahd;
349};
350
351/********************* Definitions Required by the Core ***********************/ 344/********************* Definitions Required by the Core ***********************/
352/* 345/*
353 * Number of SG segments we require. So long as the S/G segments for 346 * Number of SG segments we require. So long as the S/G segments for
@@ -864,7 +857,7 @@ ahd_freeze_scb(struct scb *scb)
864 } 857 }
865} 858}
866 859
867void ahd_platform_set_tags(struct ahd_softc *ahd, 860void ahd_platform_set_tags(struct ahd_softc *ahd, struct scsi_device *sdev,
868 struct ahd_devinfo *devinfo, ahd_queue_alg); 861 struct ahd_devinfo *devinfo, ahd_queue_alg);
869int ahd_platform_abort_scbs(struct ahd_softc *ahd, int target, 862int ahd_platform_abort_scbs(struct ahd_softc *ahd, int target,
870 char channel, int lun, u_int tag, 863 char channel, int lun, u_int tag,
@@ -873,7 +866,7 @@ irqreturn_t
873 ahd_linux_isr(int irq, void *dev_id, struct pt_regs * regs); 866 ahd_linux_isr(int irq, void *dev_id, struct pt_regs * regs);
874void ahd_done(struct ahd_softc*, struct scb*); 867void ahd_done(struct ahd_softc*, struct scb*);
875void ahd_send_async(struct ahd_softc *, char channel, 868void ahd_send_async(struct ahd_softc *, char channel,
876 u_int target, u_int lun, ac_code, void *); 869 u_int target, u_int lun, ac_code);
877void ahd_print_path(struct ahd_softc *, struct scb *); 870void ahd_print_path(struct ahd_softc *, struct scb *);
878 871
879#ifdef CONFIG_PCI 872#ifdef CONFIG_PCI
diff --git a/drivers/scsi/aic7xxx/aic79xx_proc.c b/drivers/scsi/aic7xxx/aic79xx_proc.c
index 24fd59a230bf..c5f0ee591509 100644
--- a/drivers/scsi/aic7xxx/aic79xx_proc.c
+++ b/drivers/scsi/aic7xxx/aic79xx_proc.c
@@ -47,7 +47,7 @@ static int copy_info(struct info_str *info, char *fmt, ...);
47static void ahd_dump_target_state(struct ahd_softc *ahd, 47static void ahd_dump_target_state(struct ahd_softc *ahd,
48 struct info_str *info, 48 struct info_str *info,
49 u_int our_id, char channel, 49 u_int our_id, char channel,
50 u_int target_id, u_int target_offset); 50 u_int target_id);
51static void ahd_dump_device_state(struct info_str *info, 51static void ahd_dump_device_state(struct info_str *info,
52 struct scsi_device *sdev); 52 struct scsi_device *sdev);
53static int ahd_proc_write_seeprom(struct ahd_softc *ahd, 53static int ahd_proc_write_seeprom(struct ahd_softc *ahd,
@@ -204,10 +204,8 @@ ahd_format_transinfo(struct info_str *info, struct ahd_transinfo *tinfo)
204 204
205static void 205static void
206ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info, 206ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info,
207 u_int our_id, char channel, u_int target_id, 207 u_int our_id, char channel, u_int target_id)
208 u_int target_offset)
209{ 208{
210 struct ahd_linux_target *targ;
211 struct scsi_target *starget; 209 struct scsi_target *starget;
212 struct ahd_initiator_tinfo *tinfo; 210 struct ahd_initiator_tinfo *tinfo;
213 struct ahd_tmode_tstate *tstate; 211 struct ahd_tmode_tstate *tstate;
@@ -218,10 +216,9 @@ ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info,
218 copy_info(info, "Target %d Negotiation Settings\n", target_id); 216 copy_info(info, "Target %d Negotiation Settings\n", target_id);
219 copy_info(info, "\tUser: "); 217 copy_info(info, "\tUser: ");
220 ahd_format_transinfo(info, &tinfo->user); 218 ahd_format_transinfo(info, &tinfo->user);
221 starget = ahd->platform_data->starget[target_offset]; 219 starget = ahd->platform_data->starget[target_id];
222 if (starget == NULL) 220 if (starget == NULL)
223 return; 221 return;
224 targ = scsi_transport_target_data(starget);
225 222
226 copy_info(info, "\tGoal: "); 223 copy_info(info, "\tGoal: ");
227 ahd_format_transinfo(info, &tinfo->goal); 224 ahd_format_transinfo(info, &tinfo->goal);
@@ -231,7 +228,7 @@ ahd_dump_target_state(struct ahd_softc *ahd, struct info_str *info,
231 for (lun = 0; lun < AHD_NUM_LUNS; lun++) { 228 for (lun = 0; lun < AHD_NUM_LUNS; lun++) {
232 struct scsi_device *dev; 229 struct scsi_device *dev;
233 230
234 dev = targ->sdev[lun]; 231 dev = scsi_device_lookup_by_target(starget, lun);
235 232
236 if (dev == NULL) 233 if (dev == NULL)
237 continue; 234 continue;
@@ -355,7 +352,7 @@ ahd_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
355 copy_info(&info, "Allocated SCBs: %d, SG List Length: %d\n\n", 352 copy_info(&info, "Allocated SCBs: %d, SG List Length: %d\n\n",
356 ahd->scb_data.numscbs, AHD_NSEG); 353 ahd->scb_data.numscbs, AHD_NSEG);
357 354
358 max_targ = 15; 355 max_targ = 16;
359 356
360 if (ahd->seep_config == NULL) 357 if (ahd->seep_config == NULL)
361 copy_info(&info, "No Serial EEPROM\n"); 358 copy_info(&info, "No Serial EEPROM\n");
@@ -373,12 +370,12 @@ ahd_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
373 copy_info(&info, "\n"); 370 copy_info(&info, "\n");
374 371
375 if ((ahd->features & AHD_WIDE) == 0) 372 if ((ahd->features & AHD_WIDE) == 0)
376 max_targ = 7; 373 max_targ = 8;
377 374
378 for (i = 0; i <= max_targ; i++) { 375 for (i = 0; i < max_targ; i++) {
379 376
380 ahd_dump_target_state(ahd, &info, ahd->our_id, 'A', 377 ahd_dump_target_state(ahd, &info, ahd->our_id, 'A',
381 /*target_id*/i, /*target_offset*/i); 378 /*target_id*/i);
382 } 379 }
383 retval = info.pos > info.offset ? info.pos - info.offset : 0; 380 retval = info.pos > info.offset ? info.pos - info.offset : 0;
384done: 381done: