fas216.c (ffb1e76f4f32d2b8ea4189df0484980370476395) fas216.c (bc41fcbffd5759c9610f7de211420eae6b379503)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * linux/drivers/acorn/scsi/fas216.c
4 *
5 * Copyright (C) 1997-2003 Russell King
6 *
7 * Based on information in qlogicfas.c by Tom Zerucha, Michael Griffith, and
8 * other sources, including:

--- 63 unchanged lines hidden (view full) ---

72 * > reset condition.
73 *
74 * In total, this means that once you have elected to use synchronous
75 * transfers, you must always use DMA.
76 *
77 * I was thinking that this was a good chip until I found this restriction ;(
78 */
79#define SCSI2_SYNC
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * linux/drivers/acorn/scsi/fas216.c
4 *
5 * Copyright (C) 1997-2003 Russell King
6 *
7 * Based on information in qlogicfas.c by Tom Zerucha, Michael Griffith, and
8 * other sources, including:

--- 63 unchanged lines hidden (view full) ---

72 * > reset condition.
73 *
74 * In total, this means that once you have elected to use synchronous
75 * transfers, you must always use DMA.
76 *
77 * I was thinking that this was a good chip until I found this restriction ;(
78 */
79#define SCSI2_SYNC
80#undef SCSI2_TAG
81
82#undef DEBUG_CONNECT
83#undef DEBUG_MESSAGES
84
85#undef CHECK_STRUCTURE
86
87#define LOG_CONNECT (1 << 0)
88#define LOG_BUSSERVICE (1 << 1)

--- 896 unchanged lines hidden (view full) ---

985
986 fas216_log(info, LOG_CONNECT, "Reconnected: target %1x lun %1x tag %02x",
987 target, lun, tag);
988
989 if (info->scsi.disconnectable && info->SCpnt) {
990 info->scsi.disconnectable = 0;
991 if (info->SCpnt->device->id == target &&
992 info->SCpnt->device->lun == lun &&
80
81#undef DEBUG_CONNECT
82#undef DEBUG_MESSAGES
83
84#undef CHECK_STRUCTURE
85
86#define LOG_CONNECT (1 << 0)
87#define LOG_BUSSERVICE (1 << 1)

--- 896 unchanged lines hidden (view full) ---

984
985 fas216_log(info, LOG_CONNECT, "Reconnected: target %1x lun %1x tag %02x",
986 target, lun, tag);
987
988 if (info->scsi.disconnectable && info->SCpnt) {
989 info->scsi.disconnectable = 0;
990 if (info->SCpnt->device->id == target &&
991 info->SCpnt->device->lun == lun &&
993 info->SCpnt->tag == tag) {
992 scsi_cmd_to_rq(info->SCpnt)->tag == tag) {
994 fas216_log(info, LOG_CONNECT, "reconnected previously executing command");
995 } else {
996 queue_add_cmd_tail(&info->queues.disconnected, info->SCpnt);
997 fas216_log(info, LOG_CONNECT, "had to move command to disconnected queue");
998 info->SCpnt = NULL;
999 }
1000 }
1001 if (!info->SCpnt) {

--- 784 unchanged lines hidden (view full) ---

1786 * build outgoing message bytes
1787 */
1788 msgqueue_flush(&info->scsi.msgs);
1789 msgqueue_addmsg(&info->scsi.msgs, 1, IDENTIFY(disconnect_ok, SCpnt->device->lun));
1790
1791 /*
1792 * add tag message if required
1793 */
993 fas216_log(info, LOG_CONNECT, "reconnected previously executing command");
994 } else {
995 queue_add_cmd_tail(&info->queues.disconnected, info->SCpnt);
996 fas216_log(info, LOG_CONNECT, "had to move command to disconnected queue");
997 info->SCpnt = NULL;
998 }
999 }
1000 if (!info->SCpnt) {

--- 784 unchanged lines hidden (view full) ---

1785 * build outgoing message bytes
1786 */
1787 msgqueue_flush(&info->scsi.msgs);
1788 msgqueue_addmsg(&info->scsi.msgs, 1, IDENTIFY(disconnect_ok, SCpnt->device->lun));
1789
1790 /*
1791 * add tag message if required
1792 */
1794 if (SCpnt->tag)
1795 msgqueue_addmsg(&info->scsi.msgs, 2, SIMPLE_QUEUE_TAG, SCpnt->tag);
1793 if (SCpnt->device->simple_tags)
1794 msgqueue_addmsg(&info->scsi.msgs, 2, SIMPLE_QUEUE_TAG,
1795 scsi_cmd_to_rq(SCpnt)->tag);
1796
1797 do {
1798#ifdef SCSI2_SYNC
1799 if ((info->device[SCpnt->device->id].sync_state == neg_wait ||
1800 info->device[SCpnt->device->id].sync_state == neg_complete) &&
1801 (SCpnt->cmnd[0] == REQUEST_SENSE ||
1802 SCpnt->cmnd[0] == INQUIRY)) {
1803 info->device[SCpnt->device->id].sync_state = neg_inprogress;

--- 6 unchanged lines hidden (view full) ---

1810#endif
1811 } while (0);
1812
1813 __fas216_start_command(info, SCpnt);
1814}
1815
1816static void fas216_allocate_tag(FAS216_Info *info, struct scsi_cmnd *SCpnt)
1817{
1796
1797 do {
1798#ifdef SCSI2_SYNC
1799 if ((info->device[SCpnt->device->id].sync_state == neg_wait ||
1800 info->device[SCpnt->device->id].sync_state == neg_complete) &&
1801 (SCpnt->cmnd[0] == REQUEST_SENSE ||
1802 SCpnt->cmnd[0] == INQUIRY)) {
1803 info->device[SCpnt->device->id].sync_state = neg_inprogress;

--- 6 unchanged lines hidden (view full) ---

1810#endif
1811 } while (0);
1812
1813 __fas216_start_command(info, SCpnt);
1814}
1815
1816static void fas216_allocate_tag(FAS216_Info *info, struct scsi_cmnd *SCpnt)
1817{
1818#ifdef SCSI2_TAG
1819 /*
1820 * tagged queuing - allocate a new tag to this command
1821 */
1822 if (SCpnt->device->simple_tags && SCpnt->cmnd[0] != REQUEST_SENSE &&
1823 SCpnt->cmnd[0] != INQUIRY) {
1824 SCpnt->device->current_tag += 1;
1825 if (SCpnt->device->current_tag == 0)
1826 SCpnt->device->current_tag = 1;
1827 SCpnt->tag = SCpnt->device->current_tag;
1828 } else
1829#endif
1830 set_bit(SCpnt->device->id * 8 +
1831 (u8)(SCpnt->device->lun & 0x7), info->busyluns);
1818 set_bit(SCpnt->device->id * 8 +
1819 (u8)(SCpnt->device->lun & 0x7), info->busyluns);
1832
1833 info->stats.removes += 1;
1834 switch (SCpnt->cmnd[0]) {
1835 case WRITE_6:
1836 case WRITE_10:
1837 case WRITE_12:
1838 info->stats.writes += 1;
1839 break;

--- 272 unchanged lines hidden (view full) ---

2112 goto done;
2113
2114 scsi_eh_prep_cmnd(SCpnt, &info->ses, NULL, 0, ~0);
2115 fas216_log_target(info, LOG_CONNECT, SCpnt->device->id,
2116 "requesting sense");
2117 init_SCp(SCpnt);
2118 SCpnt->SCp.Message = 0;
2119 SCpnt->SCp.Status = 0;
1820
1821 info->stats.removes += 1;
1822 switch (SCpnt->cmnd[0]) {
1823 case WRITE_6:
1824 case WRITE_10:
1825 case WRITE_12:
1826 info->stats.writes += 1;
1827 break;

--- 272 unchanged lines hidden (view full) ---

2100 goto done;
2101
2102 scsi_eh_prep_cmnd(SCpnt, &info->ses, NULL, 0, ~0);
2103 fas216_log_target(info, LOG_CONNECT, SCpnt->device->id,
2104 "requesting sense");
2105 init_SCp(SCpnt);
2106 SCpnt->SCp.Message = 0;
2107 SCpnt->SCp.Status = 0;
2120 SCpnt->tag = 0;
2121 SCpnt->host_scribble = (void *)fas216_rq_sns_done;
2122
2123 /*
2124 * Place this command into the high priority "request
2125 * sense" slot. This will be the very next command
2126 * executed, unless a target connects to us.
2127 */
2128 if (info->reqSCpnt)

--- 89 unchanged lines hidden (view full) ---

2218
2219 SCpnt->scsi_done = done;
2220 SCpnt->host_scribble = (void *)fas216_std_done;
2221 SCpnt->result = 0;
2222
2223 init_SCp(SCpnt);
2224
2225 info->stats.queues += 1;
2108 SCpnt->host_scribble = (void *)fas216_rq_sns_done;
2109
2110 /*
2111 * Place this command into the high priority "request
2112 * sense" slot. This will be the very next command
2113 * executed, unless a target connects to us.
2114 */
2115 if (info->reqSCpnt)

--- 89 unchanged lines hidden (view full) ---

2205
2206 SCpnt->scsi_done = done;
2207 SCpnt->host_scribble = (void *)fas216_std_done;
2208 SCpnt->result = 0;
2209
2210 init_SCp(SCpnt);
2211
2212 info->stats.queues += 1;
2226 SCpnt->tag = 0;
2227
2228 spin_lock(&info->host_lock);
2229
2230 /*
2231 * Add command into execute queue and let it complete under
2232 * whatever scheme we're using.
2233 */
2234 result = !queue_add_cmd_ordered(&info->queues.issue, SCpnt);

--- 763 unchanged lines hidden (view full) ---

2998 struct scsi_device *scd;
2999
3000 seq_puts(m, "Device/Lun TaggedQ Parity Sync\n");
3001
3002 shost_for_each_device(scd, info->host) {
3003 dev = &info->device[scd->id];
3004 seq_printf(m, " %d/%llu ", scd->id, scd->lun);
3005 if (scd->tagged_supported)
2213
2214 spin_lock(&info->host_lock);
2215
2216 /*
2217 * Add command into execute queue and let it complete under
2218 * whatever scheme we're using.
2219 */
2220 result = !queue_add_cmd_ordered(&info->queues.issue, SCpnt);

--- 763 unchanged lines hidden (view full) ---

2984 struct scsi_device *scd;
2985
2986 seq_puts(m, "Device/Lun TaggedQ Parity Sync\n");
2987
2988 shost_for_each_device(scd, info->host) {
2989 dev = &info->device[scd->id];
2990 seq_printf(m, " %d/%llu ", scd->id, scd->lun);
2991 if (scd->tagged_supported)
3006 seq_printf(m, "%3sabled(%3d) ",
3007 scd->simple_tags ? "en" : "dis",
3008 scd->current_tag);
2992 seq_printf(m, "%3sabled ",
2993 scd->simple_tags ? "en" : "dis");
3009 else
3010 seq_puts(m, "unsupported ");
3011
3012 seq_printf(m, "%3sabled ", dev->parity_enabled ? "en" : "dis");
3013
3014 if (dev->sof)
3015 seq_printf(m, "offset %d, %d ns\n",
3016 dev->sof, dev->period * 4);

--- 23 unchanged lines hidden ---
2994 else
2995 seq_puts(m, "unsupported ");
2996
2997 seq_printf(m, "%3sabled ", dev->parity_enabled ? "en" : "dis");
2998
2999 if (dev->sof)
3000 seq_printf(m, "offset %d, %d ns\n",
3001 dev->sof, dev->period * 4);

--- 23 unchanged lines hidden ---