aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sym53c8xx_2/sym_glue.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/sym53c8xx_2/sym_glue.c')
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c59
1 files changed, 31 insertions, 28 deletions
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 7fc0b97173e1..a2bfdf8417a2 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -563,10 +563,7 @@ int sym_setup_data_and_start(struct sym_hcb *np, struct scsi_cmnd *cmd, struct s
563 /* 563 /*
564 * activate this job. 564 * activate this job.
565 */ 565 */
566 if (lp) 566 sym_start_next_ccbs(np, lp, 2);
567 sym_start_next_ccbs(np, lp, 2);
568 else
569 sym_put_start_queue(np, cp);
570 return 0; 567 return 0;
571 568
572out_abort: 569out_abort:
@@ -981,15 +978,13 @@ static int device_queue_depth(struct sym_hcb *np, int target, int lun)
981 978
982static int sym53c8xx_slave_alloc(struct scsi_device *sdev) 979static int sym53c8xx_slave_alloc(struct scsi_device *sdev)
983{ 980{
984 struct sym_hcb *np; 981 struct sym_hcb *np = sym_get_hcb(sdev->host);
985 struct sym_tcb *tp; 982 struct sym_tcb *tp = &np->target[sdev->id];
983 struct sym_lcb *lp;
986 984
987 if (sdev->id >= SYM_CONF_MAX_TARGET || sdev->lun >= SYM_CONF_MAX_LUN) 985 if (sdev->id >= SYM_CONF_MAX_TARGET || sdev->lun >= SYM_CONF_MAX_LUN)
988 return -ENXIO; 986 return -ENXIO;
989 987
990 np = sym_get_hcb(sdev->host);
991 tp = &np->target[sdev->id];
992
993 /* 988 /*
994 * Fail the device init if the device is flagged NOSCAN at BOOT in 989 * Fail the device init if the device is flagged NOSCAN at BOOT in
995 * the NVRAM. This may speed up boot and maintain coherency with 990 * the NVRAM. This may speed up boot and maintain coherency with
@@ -1005,6 +1000,10 @@ static int sym53c8xx_slave_alloc(struct scsi_device *sdev)
1005 return -ENXIO; 1000 return -ENXIO;
1006 } 1001 }
1007 1002
1003 lp = sym_alloc_lcb(np, sdev->id, sdev->lun);
1004 if (!lp)
1005 return -ENOMEM;
1006
1008 tp->starget = sdev->sdev_target; 1007 tp->starget = sdev->sdev_target;
1009 return 0; 1008 return 0;
1010} 1009}
@@ -1012,22 +1011,14 @@ static int sym53c8xx_slave_alloc(struct scsi_device *sdev)
1012/* 1011/*
1013 * Linux entry point for device queue sizing. 1012 * Linux entry point for device queue sizing.
1014 */ 1013 */
1015static int sym53c8xx_slave_configure(struct scsi_device *device) 1014static int sym53c8xx_slave_configure(struct scsi_device *sdev)
1016{ 1015{
1017 struct sym_hcb *np = sym_get_hcb(device->host); 1016 struct sym_hcb *np = sym_get_hcb(sdev->host);
1018 struct sym_tcb *tp = &np->target[device->id]; 1017 struct sym_tcb *tp = &np->target[sdev->id];
1019 struct sym_lcb *lp; 1018 struct sym_lcb *lp = sym_lp(tp, sdev->lun);
1020 int reqtags, depth_to_use; 1019 int reqtags, depth_to_use;
1021 1020
1022 /* 1021 /*
1023 * Allocate the LCB if not yet.
1024 * If it fail, we may well be in the sh*t. :)
1025 */
1026 lp = sym_alloc_lcb(np, device->id, device->lun);
1027 if (!lp)
1028 return -ENOMEM;
1029
1030 /*
1031 * Get user flags. 1022 * Get user flags.
1032 */ 1023 */
1033 lp->curr_flags = lp->user_flags; 1024 lp->curr_flags = lp->user_flags;
@@ -1038,10 +1029,10 @@ static int sym53c8xx_slave_configure(struct scsi_device *device)
1038 * Use at least 2. 1029 * Use at least 2.
1039 * Donnot use more than our maximum. 1030 * Donnot use more than our maximum.
1040 */ 1031 */
1041 reqtags = device_queue_depth(np, device->id, device->lun); 1032 reqtags = device_queue_depth(np, sdev->id, sdev->lun);
1042 if (reqtags > tp->usrtags) 1033 if (reqtags > tp->usrtags)
1043 reqtags = tp->usrtags; 1034 reqtags = tp->usrtags;
1044 if (!device->tagged_supported) 1035 if (!sdev->tagged_supported)
1045 reqtags = 0; 1036 reqtags = 0;
1046#if 1 /* Avoid to locally queue commands for no good reasons */ 1037#if 1 /* Avoid to locally queue commands for no good reasons */
1047 if (reqtags > SYM_CONF_MAX_TAG) 1038 if (reqtags > SYM_CONF_MAX_TAG)
@@ -1050,19 +1041,30 @@ static int sym53c8xx_slave_configure(struct scsi_device *device)
1050#else 1041#else
1051 depth_to_use = (reqtags ? SYM_CONF_MAX_TAG : 2); 1042 depth_to_use = (reqtags ? SYM_CONF_MAX_TAG : 2);
1052#endif 1043#endif
1053 scsi_adjust_queue_depth(device, 1044 scsi_adjust_queue_depth(sdev,
1054 (device->tagged_supported ? 1045 (sdev->tagged_supported ?
1055 MSG_SIMPLE_TAG : 0), 1046 MSG_SIMPLE_TAG : 0),
1056 depth_to_use); 1047 depth_to_use);
1057 lp->s.scdev_depth = depth_to_use; 1048 lp->s.scdev_depth = depth_to_use;
1058 sym_tune_dev_queuing(tp, device->lun, reqtags); 1049 sym_tune_dev_queuing(tp, sdev->lun, reqtags);
1059 1050
1060 if (!spi_initial_dv(device->sdev_target)) 1051 if (!spi_initial_dv(sdev->sdev_target))
1061 spi_dv_device(device); 1052 spi_dv_device(sdev);
1062 1053
1063 return 0; 1054 return 0;
1064} 1055}
1065 1056
1057static void sym53c8xx_slave_destroy(struct scsi_device *sdev)
1058{
1059 struct sym_hcb *np = sym_get_hcb(sdev->host);
1060 struct sym_lcb *lp = sym_lp(&np->target[sdev->id], sdev->lun);
1061
1062 if (lp->itlq_tbl)
1063 sym_mfree_dma(lp->itlq_tbl, SYM_CONF_MAX_TASK * 4, "ITLQ_TBL");
1064 kfree(lp->cb_tags);
1065 sym_mfree_dma(lp, sizeof(*lp), "LCB");
1066}
1067
1066/* 1068/*
1067 * Linux entry point for info() function 1069 * Linux entry point for info() function
1068 */ 1070 */
@@ -1926,6 +1928,7 @@ static struct scsi_host_template sym2_template = {
1926 .queuecommand = sym53c8xx_queue_command, 1928 .queuecommand = sym53c8xx_queue_command,
1927 .slave_alloc = sym53c8xx_slave_alloc, 1929 .slave_alloc = sym53c8xx_slave_alloc,
1928 .slave_configure = sym53c8xx_slave_configure, 1930 .slave_configure = sym53c8xx_slave_configure,
1931 .slave_destroy = sym53c8xx_slave_destroy,
1929 .eh_abort_handler = sym53c8xx_eh_abort_handler, 1932 .eh_abort_handler = sym53c8xx_eh_abort_handler,
1930 .eh_device_reset_handler = sym53c8xx_eh_device_reset_handler, 1933 .eh_device_reset_handler = sym53c8xx_eh_device_reset_handler,
1931 .eh_bus_reset_handler = sym53c8xx_eh_bus_reset_handler, 1934 .eh_bus_reset_handler = sym53c8xx_eh_bus_reset_handler,