Commit 9080063f authored by Hannes Reinecke's avatar Hannes Reinecke Committed by James Bottomley

[SCSI] aic7xxx: Remove slave_destroy

This is a cross-port from aic79xx; we still hit the occasional
BUG_ON in slave_destroy. And again we don't really need the
slave_destroy callback nor the ahc_linux_target structure
at all.
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 843822ad
...@@ -1279,6 +1279,7 @@ typedef enum { ...@@ -1279,6 +1279,7 @@ typedef enum {
} ahc_queue_alg; } ahc_queue_alg;
void ahc_set_tags(struct ahc_softc *ahc, void ahc_set_tags(struct ahc_softc *ahc,
struct scsi_cmnd *cmd,
struct ahc_devinfo *devinfo, struct ahc_devinfo *devinfo,
ahc_queue_alg alg); ahc_queue_alg alg);
......
...@@ -1986,7 +1986,7 @@ ahc_set_syncrate(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, ...@@ -1986,7 +1986,7 @@ ahc_set_syncrate(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
tinfo->curr.ppr_options = ppr_options; tinfo->curr.ppr_options = ppr_options;
ahc_send_async(ahc, devinfo->channel, devinfo->target, ahc_send_async(ahc, devinfo->channel, devinfo->target,
CAM_LUN_WILDCARD, AC_TRANSFER_NEG, NULL); CAM_LUN_WILDCARD, AC_TRANSFER_NEG);
if (bootverbose) { if (bootverbose) {
if (offset != 0) { if (offset != 0) {
printf("%s: target %d synchronous at %sMHz%s, " printf("%s: target %d synchronous at %sMHz%s, "
...@@ -2056,7 +2056,7 @@ ahc_set_width(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, ...@@ -2056,7 +2056,7 @@ ahc_set_width(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
tinfo->curr.width = width; tinfo->curr.width = width;
ahc_send_async(ahc, devinfo->channel, devinfo->target, ahc_send_async(ahc, devinfo->channel, devinfo->target,
CAM_LUN_WILDCARD, AC_TRANSFER_NEG, NULL); CAM_LUN_WILDCARD, AC_TRANSFER_NEG);
if (bootverbose) { if (bootverbose) {
printf("%s: target %d using %dbit transfers\n", printf("%s: target %d using %dbit transfers\n",
ahc_name(ahc), devinfo->target, ahc_name(ahc), devinfo->target,
...@@ -2074,12 +2074,14 @@ ahc_set_width(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, ...@@ -2074,12 +2074,14 @@ ahc_set_width(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
* Update the current state of tagged queuing for a given target. * Update the current state of tagged queuing for a given target.
*/ */
void void
ahc_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, ahc_set_tags(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
ahc_queue_alg alg) struct ahc_devinfo *devinfo, ahc_queue_alg alg)
{ {
ahc_platform_set_tags(ahc, devinfo, alg); struct scsi_device *sdev = cmd->device;
ahc_platform_set_tags(ahc, sdev, devinfo, alg);
ahc_send_async(ahc, devinfo->channel, devinfo->target, ahc_send_async(ahc, devinfo->channel, devinfo->target,
devinfo->lun, AC_TRANSFER_NEG, &alg); devinfo->lun, AC_TRANSFER_NEG);
} }
/* /*
...@@ -3489,7 +3491,7 @@ ahc_handle_msg_reject(struct ahc_softc *ahc, struct ahc_devinfo *devinfo) ...@@ -3489,7 +3491,7 @@ ahc_handle_msg_reject(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
printf("(%s:%c:%d:%d): refuses tagged commands. " printf("(%s:%c:%d:%d): refuses tagged commands. "
"Performing non-tagged I/O\n", ahc_name(ahc), "Performing non-tagged I/O\n", ahc_name(ahc),
devinfo->channel, devinfo->target, devinfo->lun); devinfo->channel, devinfo->target, devinfo->lun);
ahc_set_tags(ahc, devinfo, AHC_QUEUE_NONE); ahc_set_tags(ahc, scb->io_ctx, devinfo, AHC_QUEUE_NONE);
mask = ~0x23; mask = ~0x23;
} else { } else {
printf("(%s:%c:%d:%d): refuses %s tagged commands. " printf("(%s:%c:%d:%d): refuses %s tagged commands. "
...@@ -3497,7 +3499,7 @@ ahc_handle_msg_reject(struct ahc_softc *ahc, struct ahc_devinfo *devinfo) ...@@ -3497,7 +3499,7 @@ ahc_handle_msg_reject(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
ahc_name(ahc), devinfo->channel, devinfo->target, ahc_name(ahc), devinfo->channel, devinfo->target,
devinfo->lun, tag_type == MSG_ORDERED_TASK devinfo->lun, tag_type == MSG_ORDERED_TASK
? "ordered" : "head of queue"); ? "ordered" : "head of queue");
ahc_set_tags(ahc, devinfo, AHC_QUEUE_BASIC); ahc_set_tags(ahc, scb->io_ctx, devinfo, AHC_QUEUE_BASIC);
mask = ~0x03; mask = ~0x03;
} }
...@@ -3763,7 +3765,7 @@ ahc_handle_devreset(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, ...@@ -3763,7 +3765,7 @@ ahc_handle_devreset(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
if (status != CAM_SEL_TIMEOUT) if (status != CAM_SEL_TIMEOUT)
ahc_send_async(ahc, devinfo->channel, devinfo->target, ahc_send_async(ahc, devinfo->channel, devinfo->target,
CAM_LUN_WILDCARD, AC_SENT_BDR, NULL); CAM_LUN_WILDCARD, AC_SENT_BDR);
if (message != NULL if (message != NULL
&& (verbose_level <= bootverbose)) && (verbose_level <= bootverbose))
...@@ -6018,7 +6020,7 @@ ahc_reset_channel(struct ahc_softc *ahc, char channel, int initiate_reset) ...@@ -6018,7 +6020,7 @@ ahc_reset_channel(struct ahc_softc *ahc, char channel, int initiate_reset)
#endif #endif
/* Notify the XPT that a bus reset occurred */ /* Notify the XPT that a bus reset occurred */
ahc_send_async(ahc, devinfo.channel, CAM_TARGET_WILDCARD, ahc_send_async(ahc, devinfo.channel, CAM_TARGET_WILDCARD,
CAM_LUN_WILDCARD, AC_BUS_RESET, NULL); CAM_LUN_WILDCARD, AC_BUS_RESET);
/* /*
* Revert to async/narrow transfers until we renegotiate. * Revert to async/narrow transfers until we renegotiate.
......
...@@ -512,7 +512,6 @@ ahc_linux_target_alloc(struct scsi_target *starget) ...@@ -512,7 +512,6 @@ ahc_linux_target_alloc(struct scsi_target *starget)
struct seeprom_config *sc = ahc->seep_config; struct seeprom_config *sc = ahc->seep_config;
unsigned long flags; unsigned long flags;
struct scsi_target **ahc_targp = ahc_linux_target_in_softc(starget); struct scsi_target **ahc_targp = ahc_linux_target_in_softc(starget);
struct ahc_linux_target *targ = scsi_transport_target_data(starget);
unsigned short scsirate; unsigned short scsirate;
struct ahc_devinfo devinfo; struct ahc_devinfo devinfo;
struct ahc_initiator_tinfo *tinfo; struct ahc_initiator_tinfo *tinfo;
...@@ -533,7 +532,6 @@ ahc_linux_target_alloc(struct scsi_target *starget) ...@@ -533,7 +532,6 @@ ahc_linux_target_alloc(struct scsi_target *starget)
BUG_ON(*ahc_targp != NULL); BUG_ON(*ahc_targp != NULL);
*ahc_targp = starget; *ahc_targp = starget;
memset(targ, 0, sizeof(*targ));
if (sc) { if (sc) {
int maxsync = AHC_SYNCRATE_DT; int maxsync = AHC_SYNCRATE_DT;
...@@ -594,14 +592,11 @@ ahc_linux_slave_alloc(struct scsi_device *sdev) ...@@ -594,14 +592,11 @@ ahc_linux_slave_alloc(struct scsi_device *sdev)
struct ahc_softc *ahc = struct ahc_softc *ahc =
*((struct ahc_softc **)sdev->host->hostdata); *((struct ahc_softc **)sdev->host->hostdata);
struct scsi_target *starget = sdev->sdev_target; struct scsi_target *starget = sdev->sdev_target;
struct ahc_linux_target *targ = scsi_transport_target_data(starget);
struct ahc_linux_device *dev; struct ahc_linux_device *dev;
if (bootverbose) if (bootverbose)
printf("%s: Slave Alloc %d\n", ahc_name(ahc), sdev->id); printf("%s: Slave Alloc %d\n", ahc_name(ahc), sdev->id);
BUG_ON(targ->sdev[sdev->lun] != NULL);
dev = scsi_transport_device_data(sdev); dev = scsi_transport_device_data(sdev);
memset(dev, 0, sizeof(*dev)); memset(dev, 0, sizeof(*dev));
...@@ -618,8 +613,6 @@ ahc_linux_slave_alloc(struct scsi_device *sdev) ...@@ -618,8 +613,6 @@ ahc_linux_slave_alloc(struct scsi_device *sdev)
*/ */
dev->maxtags = 0; dev->maxtags = 0;
targ->sdev[sdev->lun] = sdev;
spi_period(starget) = 0; spi_period(starget) = 0;
return 0; return 0;
...@@ -644,22 +637,6 @@ ahc_linux_slave_configure(struct scsi_device *sdev) ...@@ -644,22 +637,6 @@ ahc_linux_slave_configure(struct scsi_device *sdev)
return 0; return 0;
} }
static void
ahc_linux_slave_destroy(struct scsi_device *sdev)
{
struct ahc_softc *ahc;
struct ahc_linux_device *dev = scsi_transport_device_data(sdev);
struct ahc_linux_target *targ = scsi_transport_target_data(sdev->sdev_target);
ahc = *((struct ahc_softc **)sdev->host->hostdata);
if (bootverbose)
printf("%s: Slave Destroy %d\n", ahc_name(ahc), sdev->id);
BUG_ON(dev->active);
targ->sdev[sdev->lun] = NULL;
}
#if defined(__i386__) #if defined(__i386__)
/* /*
* Return the disk geometry for the given SCSI device. * Return the disk geometry for the given SCSI device.
...@@ -782,7 +759,6 @@ struct scsi_host_template aic7xxx_driver_template = { ...@@ -782,7 +759,6 @@ struct scsi_host_template aic7xxx_driver_template = {
.use_clustering = ENABLE_CLUSTERING, .use_clustering = ENABLE_CLUSTERING,
.slave_alloc = ahc_linux_slave_alloc, .slave_alloc = ahc_linux_slave_alloc,
.slave_configure = ahc_linux_slave_configure, .slave_configure = ahc_linux_slave_configure,
.slave_destroy = ahc_linux_slave_destroy,
.target_alloc = ahc_linux_target_alloc, .target_alloc = ahc_linux_target_alloc,
.target_destroy = ahc_linux_target_destroy, .target_destroy = ahc_linux_target_destroy,
}; };
...@@ -1204,21 +1180,13 @@ void ...@@ -1204,21 +1180,13 @@ void
ahc_platform_free(struct ahc_softc *ahc) ahc_platform_free(struct ahc_softc *ahc)
{ {
struct scsi_target *starget; struct scsi_target *starget;
int i, j; int i;
if (ahc->platform_data != NULL) { if (ahc->platform_data != NULL) {
/* destroy all of the device and target objects */ /* destroy all of the device and target objects */
for (i = 0; i < AHC_NUM_TARGETS; i++) { for (i = 0; i < AHC_NUM_TARGETS; i++) {
starget = ahc->platform_data->starget[i]; starget = ahc->platform_data->starget[i];
if (starget != NULL) { if (starget != NULL) {
for (j = 0; j < AHC_NUM_LUNS; j++) {
struct ahc_linux_target *targ =
scsi_transport_target_data(starget);
if (targ->sdev[j] == NULL)
continue;
targ->sdev[j] = NULL;
}
ahc->platform_data->starget[i] = NULL; ahc->platform_data->starget[i] = NULL;
} }
} }
...@@ -1252,24 +1220,13 @@ ahc_platform_freeze_devq(struct ahc_softc *ahc, struct scb *scb) ...@@ -1252,24 +1220,13 @@ ahc_platform_freeze_devq(struct ahc_softc *ahc, struct scb *scb)
} }
void void
ahc_platform_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
ahc_queue_alg alg) struct ahc_devinfo *devinfo, ahc_queue_alg alg)
{ {
struct scsi_target *starget;
struct ahc_linux_target *targ;
struct ahc_linux_device *dev; struct ahc_linux_device *dev;
struct scsi_device *sdev;
u_int target_offset;
int was_queuing; int was_queuing;
int now_queuing; int now_queuing;
target_offset = devinfo->target;
if (devinfo->channel != 'A')
target_offset += 8;
starget = ahc->platform_data->starget[target_offset];
targ = scsi_transport_target_data(starget);
BUG_ON(targ == NULL);
sdev = targ->sdev[devinfo->lun];
if (sdev == NULL) if (sdev == NULL)
return; return;
dev = scsi_transport_device_data(sdev); dev = scsi_transport_device_data(sdev);
...@@ -1402,11 +1359,15 @@ ahc_linux_device_queue_depth(struct scsi_device *sdev) ...@@ -1402,11 +1359,15 @@ ahc_linux_device_queue_depth(struct scsi_device *sdev)
tags = ahc_linux_user_tagdepth(ahc, &devinfo); tags = ahc_linux_user_tagdepth(ahc, &devinfo);
if (tags != 0 && sdev->tagged_supported != 0) { if (tags != 0 && sdev->tagged_supported != 0) {
ahc_set_tags(ahc, &devinfo, AHC_QUEUE_TAGGED); ahc_platform_set_tags(ahc, sdev, &devinfo, AHC_QUEUE_TAGGED);
ahc_send_async(ahc, devinfo.channel, devinfo.target,
devinfo.lun, AC_TRANSFER_NEG);
ahc_print_devinfo(ahc, &devinfo); ahc_print_devinfo(ahc, &devinfo);
printf("Tagged Queuing enabled. Depth %d\n", tags); printf("Tagged Queuing enabled. Depth %d\n", tags);
} else { } else {
ahc_set_tags(ahc, &devinfo, AHC_QUEUE_NONE); ahc_platform_set_tags(ahc, sdev, &devinfo, AHC_QUEUE_NONE);
ahc_send_async(ahc, devinfo.channel, devinfo.target,
devinfo.lun, AC_TRANSFER_NEG);
} }
} }
...@@ -1630,7 +1591,7 @@ ahc_platform_flushwork(struct ahc_softc *ahc) ...@@ -1630,7 +1591,7 @@ ahc_platform_flushwork(struct ahc_softc *ahc)
void void
ahc_send_async(struct ahc_softc *ahc, char channel, ahc_send_async(struct ahc_softc *ahc, char channel,
u_int target, u_int lun, ac_code code, void *arg) u_int target, u_int lun, ac_code code)
{ {
switch (code) { switch (code) {
case AC_TRANSFER_NEG: case AC_TRANSFER_NEG:
...@@ -1947,7 +1908,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc, ...@@ -1947,7 +1908,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc,
} }
ahc_set_transaction_status(scb, CAM_REQUEUE_REQ); ahc_set_transaction_status(scb, CAM_REQUEUE_REQ);
ahc_set_scsi_status(scb, SCSI_STATUS_OK); ahc_set_scsi_status(scb, SCSI_STATUS_OK);
ahc_platform_set_tags(ahc, &devinfo, ahc_platform_set_tags(ahc, sdev, &devinfo,
(dev->flags & AHC_DEV_Q_BASIC) (dev->flags & AHC_DEV_Q_BASIC)
? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED); ? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED);
break; break;
...@@ -1958,7 +1919,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc, ...@@ -1958,7 +1919,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc,
*/ */
dev->openings = 1; dev->openings = 1;
ahc_set_scsi_status(scb, SCSI_STATUS_BUSY); ahc_set_scsi_status(scb, SCSI_STATUS_BUSY);
ahc_platform_set_tags(ahc, &devinfo, ahc_platform_set_tags(ahc, sdev, &devinfo,
(dev->flags & AHC_DEV_Q_BASIC) (dev->flags & AHC_DEV_Q_BASIC)
? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED); ? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED);
break; break;
...@@ -2600,8 +2561,6 @@ ahc_linux_init(void) ...@@ -2600,8 +2561,6 @@ ahc_linux_init(void)
if (!ahc_linux_transport_template) if (!ahc_linux_transport_template)
return -ENODEV; return -ENODEV;
scsi_transport_reserve_target(ahc_linux_transport_template,
sizeof(struct ahc_linux_target));
scsi_transport_reserve_device(ahc_linux_transport_template, scsi_transport_reserve_device(ahc_linux_transport_template,
sizeof(struct ahc_linux_device)); sizeof(struct ahc_linux_device));
......
...@@ -256,7 +256,6 @@ typedef enum { ...@@ -256,7 +256,6 @@ typedef enum {
AHC_DEV_PERIODIC_OTAG = 0x40, /* Send OTAG to prevent starvation */ AHC_DEV_PERIODIC_OTAG = 0x40, /* Send OTAG to prevent starvation */
} ahc_linux_dev_flags; } ahc_linux_dev_flags;
struct ahc_linux_target;
struct ahc_linux_device { struct ahc_linux_device {
/* /*
* The number of transactions currently * The number of transactions currently
...@@ -329,12 +328,6 @@ struct ahc_linux_device { ...@@ -329,12 +328,6 @@ struct ahc_linux_device {
#define AHC_OTAG_THRESH 500 #define AHC_OTAG_THRESH 500
}; };
struct ahc_linux_target {
struct scsi_device *sdev[AHC_NUM_LUNS];
struct ahc_transinfo last_tinfo;
struct ahc_softc *ahc;
};
/********************* Definitions Required by the Core ***********************/ /********************* Definitions Required by the Core ***********************/
/* /*
* Number of SG segments we require. So long as the S/G segments for * Number of SG segments we require. So long as the S/G segments for
...@@ -822,7 +815,7 @@ ahc_freeze_scb(struct scb *scb) ...@@ -822,7 +815,7 @@ ahc_freeze_scb(struct scb *scb)
} }
} }
void ahc_platform_set_tags(struct ahc_softc *ahc, void ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
struct ahc_devinfo *devinfo, ahc_queue_alg); struct ahc_devinfo *devinfo, ahc_queue_alg);
int ahc_platform_abort_scbs(struct ahc_softc *ahc, int target, int ahc_platform_abort_scbs(struct ahc_softc *ahc, int target,
char channel, int lun, u_int tag, char channel, int lun, u_int tag,
...@@ -832,7 +825,7 @@ irqreturn_t ...@@ -832,7 +825,7 @@ irqreturn_t
void ahc_platform_flushwork(struct ahc_softc *ahc); void ahc_platform_flushwork(struct ahc_softc *ahc);
void ahc_done(struct ahc_softc*, struct scb*); void ahc_done(struct ahc_softc*, struct scb*);
void ahc_send_async(struct ahc_softc *, char channel, void ahc_send_async(struct ahc_softc *, char channel,
u_int target, u_int lun, ac_code, void *); u_int target, u_int lun, ac_code);
void ahc_print_path(struct ahc_softc *, struct scb *); void ahc_print_path(struct ahc_softc *, struct scb *);
void ahc_platform_dump_card_state(struct ahc_softc *ahc); void ahc_platform_dump_card_state(struct ahc_softc *ahc);
......
...@@ -182,7 +182,6 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, ...@@ -182,7 +182,6 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info,
u_int our_id, char channel, u_int target_id, u_int our_id, char channel, u_int target_id,
u_int target_offset) u_int target_offset)
{ {
struct ahc_linux_target *targ;
struct scsi_target *starget; struct scsi_target *starget;
struct ahc_initiator_tinfo *tinfo; struct ahc_initiator_tinfo *tinfo;
struct ahc_tmode_tstate *tstate; struct ahc_tmode_tstate *tstate;
...@@ -198,7 +197,6 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, ...@@ -198,7 +197,6 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info,
starget = ahc->platform_data->starget[target_offset]; starget = ahc->platform_data->starget[target_offset];
if (!starget) if (!starget)
return; return;
targ = scsi_transport_target_data(starget);
copy_info(info, "\tGoal: "); copy_info(info, "\tGoal: ");
ahc_format_transinfo(info, &tinfo->goal); ahc_format_transinfo(info, &tinfo->goal);
...@@ -208,7 +206,7 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, ...@@ -208,7 +206,7 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info,
for (lun = 0; lun < AHC_NUM_LUNS; lun++) { for (lun = 0; lun < AHC_NUM_LUNS; lun++) {
struct scsi_device *sdev; struct scsi_device *sdev;
sdev = targ->sdev[lun]; sdev = scsi_device_lookup_by_target(starget, lun);
if (sdev == NULL) if (sdev == NULL)
continue; continue;
...@@ -383,11 +381,11 @@ ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, ...@@ -383,11 +381,11 @@ ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
} }
copy_info(&info, "\n"); copy_info(&info, "\n");
max_targ = 15; max_targ = 16;
if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0) if ((ahc->features & (AHC_WIDE|AHC_TWIN)) == 0)
max_targ = 7; max_targ = 8;
for (i = 0; i <= max_targ; i++) { for (i = 0; i < max_targ; i++) {
u_int our_id; u_int our_id;
u_int target_id; u_int target_id;
char channel; char channel;
......
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