static int fcal_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd);
-static void fcal_select_queue_depths(struct Scsi_Host *host, Scsi_Device *devlist)
+int fcal_slave_attach(Scsi_Device *device)
{
- Scsi_Device *device;
+ int depth_to_use;
- for (device = devlist; device; device = device->next) {
- if (device->host != host) continue;
- if (device->tagged_supported)
- device->queue_depth = /* 254 */ 8;
- else
- device->queue_depth = 2;
- }
+ if (device->tagged_supported)
+ depth_to_use = /* 254 */ 8;
+ else
+ depth_to_use = 2;
+
+ scsi_adjust_queue_depth(device,
+ (device->tagged_supported ?
+ MSG_SIMPLE_TAG : 0),
+ depth_to_use);
+
+ return 0;
}
/* Detect all FC Arbitrated Loops attached to the machine.
#ifdef __sparc_v9__
host->unchecked_isa_dma = 1;
#endif
- host->select_queue_depths = fcal_select_queue_depths;
fc->channels = 1;
fc->targets = 127;
int fcal_detect(Scsi_Host_Template *);
int fcal_release(struct Scsi_Host *);
int fcal_proc_info (char *, char **, off_t, int, int, int);
+int fcal_slave_attach(Scsi_Device *);
#define FCAL { \
name: "Fibre Channel Arbitrated Loop",\
release: fcal_release, \
proc_info: fcal_proc_info, \
queuecommand: fcp_scsi_queuecommand, \
+ slave_attach: fcal_slave_attach, \
can_queue: FCAL_CAN_QUEUE, \
this_id: -1, \
sg_tablesize: 1, \
#define ScsiResult(host_code, scsi_code) (((host_code) << 16) + ((scsi_code) & 0x7f))
-static void ncr53c8xx_select_queue_depths(
- struct Scsi_Host *host, struct scsi_device *devlist);
static void ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs);
static void ncr53c8xx_timeout(unsigned long np);
instance->dma_channel = 0;
instance->cmd_per_lun = MAX_TAGS;
instance->can_queue = (MAX_START-4);
- instance->select_queue_depths = ncr53c8xx_select_queue_depths;
scsi_set_pci_device(instance, device->pdev);
#ifdef SCSI_NCR_INTEGRITY_CHECKING
** Linux select queue depths function
*/
-static void ncr53c8xx_select_queue_depths(struct Scsi_Host *host, struct scsi_device *devlist)
+int ncr53c8xx_slave_attach(Scsi_Device *device)
{
- struct scsi_device *device;
+ struct Scsi_Host *host = device->host;
+ ncb_p np;
+ tcb_p tp;
+ lcb_p lp;
+ int numtags, depth_to_use;
- for (device = devlist; device; device = device->next) {
- ncb_p np;
- tcb_p tp;
- lcb_p lp;
- int numtags;
+ np = ((struct host_data *) host->hostdata)->ncb;
+ tp = &np->target[device->id];
+ lp = tp->lp[device->lun];
- if (device->host != host)
- continue;
+ /*
+ ** Select queue depth from driver setup.
+ ** Donnot use more than configured by user.
+ ** Use at least 2.
+ ** Donnot use more than our maximum.
+ */
+ numtags = device_queue_depth(np->unit, device->id, device->lun);
+ if (numtags > tp->usrtags)
+ numtags = tp->usrtags;
+ if (!device->tagged_supported)
+ numtags = 1;
+ depth_to_use = numtags;
+ if (depth_to_use < 2)
+ depth_to_use = 2;
+ if (depth_to_use > MAX_TAGS)
+ depth_to_use = MAX_TAGS;
- np = ((struct host_data *) host->hostdata)->ncb;
- tp = &np->target[device->id];
- lp = tp->lp[device->lun];
+ scsi_adjust_queue_depth(device,
+ (device->tagged_supported ?
+ MSG_SIMPLE_TAG : 0),
+ depth_to_use);
- /*
- ** Select queue depth from driver setup.
- ** Donnot use more than configured by user.
- ** Use at least 2.
- ** Donnot use more than our maximum.
- */
- numtags = device_queue_depth(np->unit, device->id, device->lun);
- if (numtags > tp->usrtags)
- numtags = tp->usrtags;
- if (!device->tagged_supported)
- numtags = 1;
- device->queue_depth = numtags;
- if (device->queue_depth < 2)
- device->queue_depth = 2;
- if (device->queue_depth > MAX_TAGS)
- device->queue_depth = MAX_TAGS;
-
- /*
- ** Since the queue depth is not tunable under Linux,
- ** we need to know this value in order not to
- ** announce stupid things to user.
- */
- if (lp) {
- lp->numtags = lp->maxtags = numtags;
- lp->scdev_depth = device->queue_depth;
- }
- ncr_setup_tags (np, device->id, device->lun);
+ /*
+ ** Since the queue depth is not tunable under Linux,
+ ** we need to know this value in order not to
+ ** announce stupid things to user.
+ */
+ if (lp) {
+ lp->numtags = lp->maxtags = numtags;
+ lp->scdev_depth = depth_to_use;
+ }
+ ncr_setup_tags (np, device->id, device->lun);
#ifdef DEBUG_NCR53C8XX
-printk("ncr53c8xx_select_queue_depth: host=%d, id=%d, lun=%d, depth=%d\n",
- np->unit, device->id, device->lun, device->queue_depth);
+ printk("ncr53c8xx_select_queue_depth: host=%d, id=%d, lun=%d, depth=%d\n",
+ np->unit, device->id, device->lun, depth_to_use);
#endif
- }
+
+ return 0;
}
/*
const char *ncr53c8xx_info(struct Scsi_Host *host);
int ncr53c8xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
int ncr53c8xx_reset(Scsi_Cmnd *, unsigned int);
+int ncr53c8xx_slave_attach(Scsi_Device *);
#ifdef MODULE
int ncr53c8xx_release(struct Scsi_Host *);
release: ncr53c8xx_release, \
info: ncr53c8xx_info, \
queuecommand: ncr53c8xx_queue_command,\
+ slave_attach: ncr53c8xx_slave_attach, \
abort: ncr53c8xx_abort, \
reset: ncr53c8xx_reset, \
bios_param: scsicam_bios_param, \
up(&fc_sem);
}
-static void pluto_select_queue_depths(struct Scsi_Host *host, Scsi_Device *devlist)
+int pluto_slave_attach(Scsi_Device *device)
{
- Scsi_Device *device;
-
- for (device = devlist; device; device = device->next) {
- if (device->host != host) continue;
- if (device->tagged_supported)
- device->queue_depth = /* 254 */ 8;
- else
- device->queue_depth = 2;
- }
+ int depth_to_use;
+
+ if (device->tagged_supported)
+ depth_to_use = /* 254 */ 8;
+ else
+ depth_to_use = 2;
+
+ scsi_adjust_queue_depth(device,
+ (device->tagged_supported ?
+ MSG_SIMPLE_TAG : 0),
+ depth_to_use);
+
+ return 0;
}
/* Detect all SSAs attached to the machine.
host->unchecked_isa_dma = 1;
#endif
- host->select_queue_depths = pluto_select_queue_depths;
fc->channels = inq->channels + 1;
fc->targets = inq->targets;
int pluto_detect(Scsi_Host_Template *);
int pluto_release(struct Scsi_Host *);
const char * pluto_info(struct Scsi_Host *);
+int pluto_slave_attach(Scsi_Device *);
#define PLUTO { \
name: "Sparc Storage Array 100/200", \
release: pluto_release, \
info: pluto_info, \
queuecommand: fcp_scsi_queuecommand, \
+ slave_attach: pluto_slave_attach, \
can_queue: PLUTO_CAN_QUEUE, \
this_id: -1, \
sg_tablesize: 1, \
static void qla1280_next(struct scsi_qla_host *, scsi_lu_t *, int);
static void qla1280_putq_t(scsi_lu_t *, srb_t *);
static void qla1280_done_q_put(srb_t *, srb_t **, srb_t **);
-static void qla1280_device_queue_depth(struct scsi_qla_host *, Scsi_Device *);
-static void qla1280_select_queue_depth(struct Scsi_Host *, Scsi_Device *);
+static int qla1280_slave_attach(Scsi_Device *);
#if STOP_ON_ERROR
static void qla1280_panic(char *, struct Scsi_Host *host);
#endif
host->can_queue = 0xfffff; /* unlimited */
host->cmd_per_lun = 1;
- host->select_queue_depths = qla1280_select_queue_depth;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,18)
host->base = (unsigned char *)ha->mmpbase;
#else
}
/**************************************************************************
- * qla1280_device_queue_depth
+ * qla1280_slave_attach
*
* Description:
* Determines the queue depth for a given device. There are two ways
* as the default queue depth. Otherwise, we use either 4 or 8 as the
* default queue depth (dependent on the number of hardware SCBs).
**************************************************************************/
-static void
-qla1280_device_queue_depth(struct scsi_qla_host *p, Scsi_Device * device)
+static int
+qla1280_slave_attach(Scsi_Device * device)
{
- int default_depth = 3;
+ struct scsi_qla_host *p = (struct scsi_qla_host *)device->host->hostdata;
int bus = device->channel;
int target = device->id;
- device->queue_depth = default_depth;
-
+ if (qla1280_check_for_dead_scsi_bus(p, bus))
+ return 1;
if (device->tagged_supported &&
(p->bus_settings[bus].qtag_enables & (BIT_0 << target))) {
- device->tagged_queue = 1;
- device->current_tag = 0;
- device->queue_depth = p->bus_settings[bus].hiwat;
+ scsi_adjust_queue_depth(device, MSG_ORDERED_TAG,
+ p->bus_settings[bus].hiwat);
/* device->queue_depth = 20; */
printk(KERN_INFO "scsi(%li:%d:%d:%d): Enabled tagged queuing, "
"queue depth %d.\n", p->host_no, device->channel,
device->id, device->lun, device->queue_depth);
+ } else {
+ scsi_adjust_queue_depth(device, 0 /* TCQ off */, 3);
}
qla12160_get_target_parameters(p, bus, target, device->lun);
-}
-
-/**************************************************************************
- * qla1280_select_queue_depth
- *
- * Sets the queue depth for each SCSI device hanging off the input
- * host adapter. We use a queue depth of 2 for devices that do not
- * support tagged queueing.
- **************************************************************************/
-static void
-qla1280_select_queue_depth(struct Scsi_Host *host, Scsi_Device * scsi_devs)
-{
- Scsi_Device *device;
- struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata;
-
- ENTER("qla1280_select_queue_depth");
- for (device = scsi_devs; device != NULL; device = device->next) {
- if (device->host == host)
- qla1280_device_queue_depth (ha, device);
- }
-
- if (scsi_devs)
- qla1280_check_for_dead_scsi_bus(ha, scsi_devs->channel);
-
- LEAVE("qla1280_select_queue_depth");
+ return 0;
}
/*
int qla1280_abort(Scsi_Cmnd *);
int qla1280_reset(Scsi_Cmnd *, unsigned int);
int qla1280_biosparam(Disk *, struct block_device *, int[]);
+static int qla1280_slave_attach(Scsi_Device *);
void qla1280_intr_handler(int, void *, struct pt_regs *);
void qla1280_setup(char *s, int *dummy);
/* use_new_eh_code: 0, */ \
abort: qla1280_abort, \
reset: qla1280_reset, \
- slave_attach: NULL, \
+ slave_attach: qla1280_slave_attach, \
bios_param: qla1280_biosparam, \
can_queue: 255, /* max simultaneous cmds */\
this_id: -1, /* scsi id of host adapter */\
#define SetScsiAbortResult(cmd) SetScsiResult(cmd, DID_ABORT, 0xff)
#endif
-static void sym53c8xx_select_queue_depths(
- struct Scsi_Host *host, struct scsi_device *devlist);
static void sym53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs);
static void sym53c8xx_timeout(unsigned long np);
#endif
#endif
- instance->select_queue_depths = sym53c8xx_select_queue_depths;
-
NCR_UNLOCK_NCB(np, flags);
/*
return DEF_DEPTH;
}
-static void sym53c8xx_select_queue_depths(struct Scsi_Host *host, struct scsi_device *devlist)
+int sym53c8xx_slave_attach(Scsi_Device *device)
{
- struct scsi_device *device;
-
- for (device = devlist; device; device = device->next) {
- ncb_p np;
- tcb_p tp;
- lcb_p lp;
- int numtags;
+ struct Scsi_Host *host = device->host;
+ ncb_p np;
+ tcb_p tp;
+ lcb_p lp;
+ int numtags, depth_to_use;
- if (device->host != host)
- continue;
+ np = ((struct host_data *) host->hostdata)->ncb;
+ tp = &np->target[device->id];
+ lp = ncr_lp(np, tp, device->lun);
- np = ((struct host_data *) host->hostdata)->ncb;
- tp = &np->target[device->id];
- lp = ncr_lp(np, tp, device->lun);
+ /*
+ ** Select queue depth from driver setup.
+ ** Donnot use more than configured by user.
+ ** Use at least 2.
+ ** Donnot use more than our maximum.
+ */
+ numtags = device_queue_depth(np, device->id, device->lun);
+ if (numtags > tp->usrtags)
+ numtags = tp->usrtags;
+ if (!device->tagged_supported)
+ numtags = 1;
+ depth_to_use = numtags;
+ if (depth_to_use < 2)
+ depth_to_use = 2;
+ if (depth_to_use > MAX_TAGS)
+ depth_to_use = MAX_TAGS;
- /*
- ** Select queue depth from driver setup.
- ** Donnot use more than configured by user.
- ** Use at least 2.
- ** Donnot use more than our maximum.
- */
- numtags = device_queue_depth(np, device->id, device->lun);
- if (numtags > tp->usrtags)
- numtags = tp->usrtags;
- if (!device->tagged_supported)
- numtags = 1;
- device->queue_depth = numtags;
- if (device->queue_depth < 2)
- device->queue_depth = 2;
- if (device->queue_depth > MAX_TAGS)
- device->queue_depth = MAX_TAGS;
+ scsi_adjust_queue_depth(device,
+ (device->tagged_supported ?
+ MSG_SIMPLE_TAG : 0),
+ depth_to_use);
- /*
- ** Since the queue depth is not tunable under Linux,
- ** we need to know this value in order not to
- ** announce stupid things to user.
- */
- if (lp) {
- lp->numtags = lp->maxtags = numtags;
- lp->scdev_depth = device->queue_depth;
- }
- ncr_setup_tags (np, device->id, device->lun);
+ /*
+ ** Since the queue depth is not tunable under Linux,
+ ** we need to know this value in order not to
+ ** announce stupid things to user.
+ */
+ if (lp) {
+ lp->numtags = lp->maxtags = numtags;
+ lp->scdev_depth = depth_to_use;
+ }
+ ncr_setup_tags (np, device->id, device->lun);
#ifdef DEBUG_SYM53C8XX
-printk("sym53c8xx_select_queue_depth: host=%d, id=%d, lun=%d, depth=%d\n",
- np->unit, device->id, device->lun, device->queue_depth);
+ printk("sym53c8xx_select_queue_depth: host=%d, id=%d, lun=%d, depth=%d\n",
+ np->unit, device->id, device->lun, depth_to_use);
#endif
- }
+
+ return 0;
}
/*
const char *sym53c8xx_info(struct Scsi_Host *host);
int sym53c8xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
int sym53c8xx_reset(Scsi_Cmnd *, unsigned int);
+int sym53c8xx_slave_attach(Scsi_Device *);
#ifdef MODULE
int sym53c8xx_release(struct Scsi_Host *);
release: sym53c8xx_release, \
info: sym53c8xx_info, \
queuecommand: sym53c8xx_queue_command,\
+ slave_attach: sym53c8xx_slave_attach, \
abort: sym53c8xx_abort, \
reset: sym53c8xx_reset, \
bios_param: scsicam_bios_param, \
int sym53c8xx_eh_bus_reset_handler(Scsi_Cmnd *);
int sym53c8xx_eh_host_reset_handler(Scsi_Cmnd *);
+int sym53c8xx_slave_attach(Scsi_Device *);
+
#ifdef MODULE
int sym53c8xx_release(struct Scsi_Host *);
#else
release: sym53c8xx_release, \
info: sym53c8xx_info, \
queuecommand: sym53c8xx_queue_command, \
+ slave_attach: sym53c8xx_slave_attach, \
eh_abort_handler: sym53c8xx_eh_abort_handler, \
eh_device_reset_handler:sym53c8xx_eh_device_reset_handler, \
eh_bus_reset_handler: sym53c8xx_eh_bus_reset_handler, \
/*
* Linux entry point for device queue sizing.
*/
-static void
-sym53c8xx_select_queue_depths(struct Scsi_Host *host,
- struct scsi_device *devlist)
+int
+sym53c8xx_slave_attach(Scsi_Device *device)
{
- struct scsi_device *device;
-
- for (device = devlist; device; device = device->next) {
- hcb_p np;
- tcb_p tp;
- lcb_p lp;
- int reqtags;
-
- if (device->host != host)
- continue;
+ struct Scsi_Host *host = device->host;
+ hcb_p np;
+ tcb_p tp;
+ lcb_p lp;
+ int reqtags, depth_to_use;
- np = ((struct host_data *) host->hostdata)->ncb;
- tp = &np->target[device->id];
+ np = ((struct host_data *) host->hostdata)->ncb;
+ tp = &np->target[device->id];
- /*
- * Get user settings for transfer parameters.
- */
- tp->inq_byte7_valid = (INQ7_SYNC|INQ7_WIDE16);
- sym_update_trans_settings(np, tp);
+ /*
+ * Get user settings for transfer parameters.
+ */
+ tp->inq_byte7_valid = (INQ7_SYNC|INQ7_WIDE16);
+ sym_update_trans_settings(np, tp);
- /*
- * Allocate the LCB if not yet.
- * If it fail, we may well be in the sh*t. :)
- */
- lp = sym_alloc_lcb(np, device->id, device->lun);
- if (!lp) {
- device->queue_depth = 1;
- continue;
- }
+ /*
+ * Allocate the LCB if not yet.
+ * If it fail, we may well be in the sh*t. :)
+ */
+ lp = sym_alloc_lcb(np, device->id, device->lun);
+ if (!lp)
+ return -ENOMEM;
- /*
- * Get user flags.
- */
- lp->curr_flags = lp->user_flags;
+ /*
+ * Get user flags.
+ */
+ lp->curr_flags = lp->user_flags;
- /*
- * Select queue depth from driver setup.
- * Donnot use more than configured by user.
- * Use at least 2.
- * Donnot use more than our maximum.
- */
- reqtags = device_queue_depth(np, device->id, device->lun);
- if (reqtags > tp->usrtags)
- reqtags = tp->usrtags;
- if (!device->tagged_supported)
- reqtags = 0;
+ /*
+ * Select queue depth from driver setup.
+ * Donnot use more than configured by user.
+ * Use at least 2.
+ * Donnot use more than our maximum.
+ */
+ reqtags = device_queue_depth(np, device->id, device->lun);
+ if (reqtags > tp->usrtags)
+ reqtags = tp->usrtags;
+ if (!device->tagged_supported)
+ reqtags = 0;
#if 1 /* Avoid to locally queue commands for no good reasons */
- if (reqtags > SYM_CONF_MAX_TAG)
- reqtags = SYM_CONF_MAX_TAG;
- device->queue_depth = reqtags ? reqtags : 2;
+ if (reqtags > SYM_CONF_MAX_TAG)
+ reqtags = SYM_CONF_MAX_TAG;
+ depth_to_use = (reqtags ? reqtags : 2);
#else
- device->queue_depth = reqtags ? SYM_CONF_MAX_TAG : 2;
+ depth_to_use = (reqtags ? SYM_CONF_MAX_TAG : 2);
#endif
- lp->s.scdev_depth = device->queue_depth;
- sym_tune_dev_queuing(np, device->id, device->lun, reqtags);
- }
+ scsi_adjust_queue_depth(device,
+ (device->tagged_supported ?
+ MSG_SIMPLE_TAG : 0),
+ depth_to_use);
+ lp->s.scdev_depth = depth_to_use;
+ sym_tune_dev_queuing(np, device->id, device->lun, reqtags);
+
+ return 0;
}
/*
#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0)
instance->max_cmd_len = 16;
#endif
- instance->select_queue_depths = sym53c8xx_select_queue_depths;
instance->highmem_io = 1;
SYM_UNLOCK_HCB(np, flags);