Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1296499 > unrolled thread
| Started by | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| First post | 2015-12-22 04:00 +0100 |
| Last post | 2016-01-01 02:30 +0100 |
| Articles | 20 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH v3 00/77] More fixes, cleanup and modernization for NCR5380 drivers Finn Thain <fthain@telegraphics.com.au> - 2015-12-22 04:00 +0100
[PATCH v3 08/77] ncr5380: Move NCR53C400-specific code Finn Thain <fthain@telegraphics.com.au> - 2015-12-22 04:00 +0100
[PATCH v3 11/77] ncr5380: Simplify bus reset handlers Finn Thain <fthain@telegraphics.com.au> - 2015-12-22 04:00 +0100
[PATCH v3 12/77] ncr5380: Remove unused hostdata->aborted flag Finn Thain <fthain@telegraphics.com.au> - 2015-12-22 04:00 +0100
[PATCH v3 14/77] ncr5380: Use return instead of goto in NCR5380_select() Finn Thain <fthain@telegraphics.com.au> - 2015-12-22 04:00 +0100
[PATCH v3 09/77] atari_NCR5380: Reset bus on driver initialization if required Finn Thain <fthain@telegraphics.com.au> - 2015-12-22 04:00 +0100
[PATCH v3 15/77] ncr5380: Always escalate bad target time-out in NCR5380_select() Finn Thain <fthain@telegraphics.com.au> - 2015-12-22 04:00 +0100
[PATCH v3 05/77] ncr5380: Remove NCR5380_local_declare and NCR5380_setup macros Finn Thain <fthain@telegraphics.com.au> - 2015-12-22 04:00 +0100
[PATCH v3 10/77] atari_NCR5380: Remove RESET_BOOT, CONFIG_ATARI_SCSI_TOSHIBA_DELAY and CONFIG_ATARI_SCSI_RESET_BOOT Finn Thain <fthain@telegraphics.com.au> - 2015-12-22 04:00 +0100
[PATCH v3 07/77] ncr5380: Split NCR5380_init() into two functions Finn Thain <fthain@telegraphics.com.au> - 2015-12-22 04:00 +0100
Re: [PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp Joe Perches <joe@perches.com> - 2015-12-22 15:50 +0100
Re: [PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp Finn Thain <fthain@telegraphics.com.au> - 2015-12-23 02:00 +0100
Re: [PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp Joe Perches <joe@perches.com> - 2015-12-23 02:20 +0100
Re: [PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp Finn Thain <fthain@telegraphics.com.au> - 2015-12-23 03:10 +0100
Re: [PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp Joe Perches <joe@perches.com> - 2015-12-23 03:20 +0100
Re: [PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp Finn Thain <fthain@telegraphics.com.au> - 2015-12-23 05:20 +0100
Re: [PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp James Bottomley <James.Bottomley@HansenPartnership.com> - 2015-12-23 02:30 +0100
Re: [PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp Finn Thain <fthain@telegraphics.com.au> - 2015-12-23 03:40 +0100
Re: [PATCH v3 00/77] More fixes, cleanup and modernization for NCR5380 drivers Ondrej Zary <linux@rainbow-software.org> - 2015-12-22 21:20 +0100
Re: [PATCH v3 00/77] More fixes, cleanup and modernization for NCR5380 drivers Michael Schmitz <schmitzmic@gmail.com> - 2016-01-01 02:30 +0100
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-22 04:00 +0100 |
| Subject | [PATCH v3 00/77] More fixes, cleanup and modernization for NCR5380 drivers |
| Message-ID | <qIl1L-6kS-3@gated-at.bofh.it> |
Like my previous work on the NCR5380 drivers, this patch series has bug fixes, code cleanup and modernization. These drivers suffer from mistakes, poor style and neglect and this long series addresses the worst of it, covering all ten wrapper drivers and both of the core driver forks. The combined size of the drivers is reduced by over 700 LoC. This series continues to reduce divergence between the two core driver forks, often by copying a bug fix from one to the other. Most patches are larger for having to keep the two forks in sync. Making the same change to both is churn if one of them is to be removed but neither can be as yet. By the end of this series the diff between the two forks is minimal, so it becomes clear what caused the fork and what can be done about it. This patch series did benefit from scripts/checkpatch.pl but not too much. Decades ago, these drivers started out with 4-space tabs and if the 80 column limit were to be strictly enforced now, it would require adding new functions and shortening identifiers. I would defer this sort of activity until after the fork has been resolved. All patches to all NCR5380 drivers (x86, ARM, m68k) have been compile- tested. The mac_scsi, dmx3191d, g_NCR5380 and atari_scsi modules were regression tested on suitable hardware. Changes since v1: - Patch 8 omits a pointless assignment. - Patch 10 gets a better error message. - Patch 20 drops the WQ_CPU_INTENSIVE flag. - Patch 21 adds timing calibration for the register polling loop. - Patch 49 is replaced by a new one that removes FLAG_DTC3181E. - Patch 72 by Ondrej Zary was added to fix pseudo DMA on 53C400. Changes since v2: - Patch 21 has better calibration with low HZ values. - Patch 57 no longer attempts to dereference a NULL pointer on Atari. - Patch 66 initializes max_sectors in the host templates. - Patches 73 thru 77 by Ondrej Zary were added with additional fixes for 53C400-compatible cards. --- drivers/scsi/Kconfig | 17 drivers/scsi/NCR5380.c | 2868 +++++++++++++++++++------------------------ drivers/scsi/NCR5380.h | 87 - drivers/scsi/arm/cumana_1.c | 31 drivers/scsi/arm/oak.c | 27 drivers/scsi/atari_NCR5380.c | 2292 +++++++++++++++------------------- drivers/scsi/atari_scsi.c | 102 - drivers/scsi/dmx3191d.c | 33 drivers/scsi/dtc.c | 115 - drivers/scsi/dtc.h | 45 drivers/scsi/g_NCR5380.c | 408 +++--- drivers/scsi/g_NCR5380.h | 66 drivers/scsi/mac_scsi.c | 117 - drivers/scsi/pas16.c | 116 - drivers/scsi/pas16.h | 40 drivers/scsi/sun3_scsi.c | 141 -- drivers/scsi/t128.c | 102 - drivers/scsi/t128.h | 39 18 files changed, 2957 insertions(+), 3689 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-22 04:00 +0100 |
| Subject | [PATCH v3 08/77] ncr5380: Move NCR53C400-specific code |
| Message-ID | <qIll8-6s9-17@gated-at.bofh.it> |
| In reply to | #1296499 |
Move board-specific code like this,
NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
from the core driver to the board driver. Eliminate the NCR53C400 macro
from the core driver. Removal of all macros like this one will be
necessary in order to have one core driver that can support all kinds of
boards.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
Changed since v1:
- Don't set FLAG_NO_PSEUDO_DMA when !defined(PSEUDO_DMA). It's pointless.
---
drivers/scsi/NCR5380.c | 18 ------------------
drivers/scsi/g_NCR5380.c | 21 ++++++++++++++++-----
drivers/scsi/g_NCR5380.h | 6 ++----
3 files changed, 18 insertions(+), 27 deletions(-)
Index: linux/drivers/scsi/NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/NCR5380.c 2015-12-22 12:15:35.000000000 +1100
+++ linux/drivers/scsi/NCR5380.c 2015-12-22 12:15:38.000000000 +1100
@@ -654,9 +654,6 @@ static void prepare_info(struct Scsi_Hos
#ifdef UNSAFE
"UNSAFE "
#endif
-#ifdef NCR53C400
- "NCR53C400 "
-#endif
"");
}
@@ -782,15 +779,6 @@ static int NCR5380_init(struct Scsi_Host
if(in_interrupt())
printk(KERN_ERR "NCR5380_init called with interrupts off!\n");
- /*
- * On NCR53C400 boards, NCR5380 registers are mapped 8 past
- * the base address.
- */
-
-#ifdef NCR53C400
- if (flags & FLAG_NCR53C400)
- instance->io_port += NCR53C400_address_adjust;
-#endif
hostdata->aborted = 0;
hostdata->id_mask = 1 << instance->this_id;
@@ -824,12 +812,6 @@ static int NCR5380_init(struct Scsi_Host
NCR5380_write(MODE_REG, MR_BASE);
NCR5380_write(TARGET_COMMAND_REG, 0);
NCR5380_write(SELECT_ENABLE_REG, 0);
-
-#ifdef NCR53C400
- if (hostdata->flags & FLAG_NCR53C400) {
- NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
- }
-#endif
return 0;
}
Index: linux/drivers/scsi/g_NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/g_NCR5380.c 2015-12-22 12:15:35.000000000 +1100
+++ linux/drivers/scsi/g_NCR5380.c 2015-12-22 12:15:38.000000000 +1100
@@ -64,9 +64,7 @@
#define AUTOPROBE_IRQ
#ifdef CONFIG_SCSI_GENERIC_NCR53C400
-#define NCR53C400_PSEUDO_DMA 1
#define PSEUDO_DMA
-#define NCR53C400
#endif
#include <asm/io.h>
@@ -263,7 +261,7 @@ static int __init generic_NCR5380_detect
static unsigned int __initdata dtc_3181e_ports[] = {
0x220, 0x240, 0x280, 0x2a0, 0x2c0, 0x300, 0x320, 0x340, 0
};
- int flags = 0;
+ int flags;
struct Scsi_Host *instance;
#ifdef SCSI_G_NCR5380_MEM
unsigned long base;
@@ -324,12 +322,15 @@ static int __init generic_NCR5380_detect
continue;
ports = NULL;
+ flags = 0;
switch (overrides[current_override].board) {
case BOARD_NCR5380:
flags = FLAG_NO_PSEUDO_DMA;
break;
case BOARD_NCR53C400:
+#ifdef PSEUDO_DMA
flags = FLAG_NCR53C400;
+#endif
break;
case BOARD_NCR53C400A:
flags = FLAG_NO_PSEUDO_DMA;
@@ -415,6 +416,13 @@ static int __init generic_NCR5380_detect
#ifndef SCSI_G_NCR5380_MEM
instance->io_port = overrides[current_override].NCR5380_map_name;
instance->n_io_port = region_size;
+
+ /*
+ * On NCR53C400 boards, NCR5380 registers are mapped 8 past
+ * the base address.
+ */
+ if (overrides[current_override].board == BOARD_NCR53C400)
+ instance->io_port += 8;
#else
instance->base = overrides[current_override].NCR5380_map_name;
((struct NCR5380_hostdata *)instance->hostdata)->iomem = iomem;
@@ -422,6 +430,9 @@ static int __init generic_NCR5380_detect
NCR5380_init(instance, flags);
+ if (overrides[current_override].board == BOARD_NCR53C400)
+ NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
+
NCR5380_maybe_reset_bus(instance);
if (overrides[current_override].irq != IRQ_AUTO)
@@ -506,7 +517,7 @@ generic_NCR5380_biosparam(struct scsi_de
}
#endif
-#ifdef NCR53C400_PSEUDO_DMA
+#ifdef PSEUDO_DMA
/**
* NCR5380_pread - pseudo DMA read
@@ -690,7 +701,7 @@ static inline int NCR5380_pwrite(struct
; // TIMEOUT
return 0;
}
-#endif /* PSEUDO_DMA */
+#endif /* PSEUDO_DMA */
/*
* Include the NCR5380 core code that we build our driver around
Index: linux/drivers/scsi/g_NCR5380.h
===================================================================
--- linux.orig/drivers/scsi/g_NCR5380.h 2015-12-22 12:15:34.000000000 +1100
+++ linux/drivers/scsi/g_NCR5380.h 2015-12-22 12:15:38.000000000 +1100
@@ -14,7 +14,7 @@
#ifndef GENERIC_NCR5380_H
#define GENERIC_NCR5380_H
-#ifdef NCR53C400
+#ifdef CONFIG_SCSI_GENERIC_NCR53C400
#define BIOSPARAM
#define NCR5380_BIOSPARAM generic_NCR5380_biosparam
#else
@@ -37,9 +37,8 @@
#define NCR5380_map_type int
#define NCR5380_map_name port
#define NCR53C400_register_offset 0
-#define NCR53C400_address_adjust 8
-#ifdef NCR53C400
+#ifdef CONFIG_SCSI_GENERIC_NCR53C400
#define NCR5380_region_size 16
#else
#define NCR5380_region_size 8
@@ -58,7 +57,6 @@
#define NCR5380_map_type unsigned long
#define NCR5380_map_name base
#define NCR53C400_register_offset 0x108
-#define NCR53C400_address_adjust 0
#define NCR53C400_mem_base 0x3880
#define NCR53C400_host_buffer 0x3900
#define NCR5380_region_size 0x3a00
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-22 04:00 +0100 |
| Subject | [PATCH v3 11/77] ncr5380: Simplify bus reset handlers |
| Message-ID | <qIll8-6s9-23@gated-at.bofh.it> |
| In reply to | #1296499 |
Make use of do_reset() in the bus reset handler in atari_NCR5380.c. The
version in NCR5380.c already does so. Keep them in sync.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
Bus reset handlers in both core drivers still have serious problems for
EH purposes. Those problems are addressed later in this series.
---
drivers/scsi/NCR5380.c | 20 +++++++++++---------
drivers/scsi/atari_NCR5380.c | 30 ++++++++++++------------------
2 files changed, 23 insertions(+), 27 deletions(-)
Index: linux/drivers/scsi/NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/NCR5380.c 2015-12-22 12:15:41.000000000 +1100
+++ linux/drivers/scsi/NCR5380.c 2015-12-22 12:15:43.000000000 +1100
@@ -668,7 +668,7 @@ static void prepare_info(struct Scsi_Hos
* Locks: called functions disable irqs
*/
-static void NCR5380_print_status(struct Scsi_Host *instance)
+static void __maybe_unused NCR5380_print_status(struct Scsi_Host *instance)
{
NCR5380_dprint(NDEBUG_ANY, instance);
NCR5380_dprint_phase(NDEBUG_ANY, instance);
@@ -2693,24 +2693,26 @@ static int NCR5380_abort(struct scsi_cmn
}
-/*
- * Function : int NCR5380_bus_reset (struct scsi_cmnd *cmd)
- *
- * Purpose : reset the SCSI bus.
- *
- * Returns : SUCCESS
+/**
+ * NCR5380_bus_reset - reset the SCSI bus
+ * @cmd: SCSI command undergoing EH
*
- * Locks: host lock taken by caller
+ * Returns SUCCESS
*/
static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
{
struct Scsi_Host *instance = cmd->device->host;
+ spin_lock_irq(instance->host_lock);
+
+#if (NDEBUG & NDEBUG_ANY)
+ scmd_printk(KERN_INFO, cmd, "performing bus reset\n");
NCR5380_print_status(instance);
+#endif
- spin_lock_irq(instance->host_lock);
do_reset(instance);
+
spin_unlock_irq(instance->host_lock);
return SUCCESS;
Index: linux/drivers/scsi/atari_NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/atari_NCR5380.c 2015-12-22 12:15:41.000000000 +1100
+++ linux/drivers/scsi/atari_NCR5380.c 2015-12-22 12:15:43.000000000 +1100
@@ -719,7 +719,7 @@ static void lprint_Scsi_Cmnd(struct scsi
printk("\n");
}
-static void NCR5380_print_status(struct Scsi_Host *instance)
+static void __maybe_unused NCR5380_print_status(struct Scsi_Host *instance)
{
struct NCR5380_hostdata *hostdata;
struct scsi_cmnd *ptr;
@@ -2982,13 +2982,11 @@ int NCR5380_abort(struct scsi_cmnd *cmd)
}
-/*
- * Function : int NCR5380_reset (struct scsi_cmnd *cmd)
- *
- * Purpose : reset the SCSI bus.
- *
- * Returns : SUCCESS or FAILURE
+/**
+ * NCR5380_bus_reset - reset the SCSI bus
+ * @cmd: SCSI command undergoing EH
*
+ * Returns SUCCESS
*/
static int NCR5380_bus_reset(struct scsi_cmnd *cmd)
@@ -2998,22 +2996,19 @@ static int NCR5380_bus_reset(struct scsi
int i;
unsigned long flags;
+ local_irq_save(flags);
+
+#if (NDEBUG & NDEBUG_ANY)
+ scmd_printk(KERN_INFO, cmd, "performing bus reset\n");
NCR5380_print_status(instance);
+#endif
+
+ do_reset(instance);
- /* get in phase */
- NCR5380_write(TARGET_COMMAND_REG,
- PHASE_SR_TO_TCR(NCR5380_read(STATUS_REG)));
- /* assert RST */
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST);
- udelay(40);
/* reset NCR registers */
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
NCR5380_write(MODE_REG, MR_BASE);
NCR5380_write(TARGET_COMMAND_REG, 0);
NCR5380_write(SELECT_ENABLE_REG, 0);
- /* ++roman: reset interrupt condition! otherwise no interrupts don't get
- * through anymore ... */
- (void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
/* After the reset, there are no more connected or disconnected commands
* and no busy units; so clear the low-level status here to avoid
@@ -3028,7 +3023,6 @@ static int NCR5380_bus_reset(struct scsi
if (hostdata->disconnected_queue)
dprintk(NDEBUG_ABORT, "scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd));
- local_irq_save(flags);
hostdata->issue_queue = NULL;
hostdata->connected = NULL;
hostdata->disconnected_queue = NULL;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-22 04:00 +0100 |
| Subject | [PATCH v3 12/77] ncr5380: Remove unused hostdata->aborted flag |
| Message-ID | <qIll8-6s9-19@gated-at.bofh.it> |
| In reply to | #1296499 |
The aborted flag was introduced in v1.1.38 but never used. Remove it.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
drivers/scsi/NCR5380.c | 2 --
drivers/scsi/NCR5380.h | 1 -
drivers/scsi/atari_NCR5380.c | 2 --
3 files changed, 5 deletions(-)
Index: linux/drivers/scsi/NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/NCR5380.c 2015-12-22 12:15:43.000000000 +1100
+++ linux/drivers/scsi/NCR5380.c 2015-12-22 12:15:44.000000000 +1100
@@ -781,7 +781,6 @@ static int NCR5380_init(struct Scsi_Host
if(in_interrupt())
printk(KERN_ERR "NCR5380_init called with interrupts off!\n");
- hostdata->aborted = 0;
hostdata->id_mask = 1 << instance->this_id;
for (i = hostdata->id_mask; i <= 0x80; i <<= 1)
if (i > hostdata->id_mask)
@@ -2574,7 +2573,6 @@ static int NCR5380_abort(struct scsi_cmn
if (hostdata->connected == cmd) {
dprintk(NDEBUG_ABORT, "scsi%d : aborting connected command\n", instance->host_no);
- hostdata->aborted = 1;
/*
* We should perform BSY checking, and make sure we haven't slipped
* into BUS FREE.
Index: linux/drivers/scsi/atari_NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/atari_NCR5380.c 2015-12-22 12:15:43.000000000 +1100
+++ linux/drivers/scsi/atari_NCR5380.c 2015-12-22 12:15:44.000000000 +1100
@@ -813,7 +813,6 @@ static int __init NCR5380_init(struct Sc
SETUP_HOSTDATA(instance);
hostdata->host = instance;
- hostdata->aborted = 0;
hostdata->id_mask = 1 << instance->this_id;
hostdata->id_higher_mask = 0;
for (i = hostdata->id_mask; i <= 0x80; i <<= 1)
@@ -2834,7 +2833,6 @@ int NCR5380_abort(struct scsi_cmnd *cmd)
*/
if (do_abort(instance) == 0) {
- hostdata->aborted = 1;
hostdata->connected = NULL;
cmd->result = DID_ABORT << 16;
#ifdef SUPPORT_TAGS
Index: linux/drivers/scsi/NCR5380.h
===================================================================
--- linux.orig/drivers/scsi/NCR5380.h 2015-12-22 12:15:41.000000000 +1100
+++ linux/drivers/scsi/NCR5380.h 2015-12-22 12:15:44.000000000 +1100
@@ -271,7 +271,6 @@ struct NCR5380_hostdata {
volatile int restart_select; /* we have disconnected,
used to restart
NCR5380_select() */
- volatile unsigned aborted:1; /* flag, says aborted */
int flags;
unsigned long time_expires; /* in jiffies, set prior to sleeping */
int select_time; /* timer in select for target response */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-22 04:00 +0100 |
| Subject | [PATCH v3 14/77] ncr5380: Use return instead of goto in NCR5380_select() |
| Message-ID | <qIll8-6s9-21@gated-at.bofh.it> |
| In reply to | #1296499 |
The "failed" label in NCR5380_select() is not helpful. Some failures
return 0, others -1. Use return instead of goto to improve clarity and
brevity, like atari_NCR5380.c does. Fix the relevant comments.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
drivers/scsi/NCR5380.c | 30 ++++++++----------------------
drivers/scsi/atari_NCR5380.c | 6 +++---
2 files changed, 11 insertions(+), 25 deletions(-)
Index: linux/drivers/scsi/NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/NCR5380.c 2015-12-22 12:15:46.000000000 +1100
+++ linux/drivers/scsi/NCR5380.c 2015-12-22 12:15:47.000000000 +1100
@@ -997,16 +997,6 @@ static void NCR5380_main(struct work_str
*/
dprintk(NDEBUG_MAIN|NDEBUG_QUEUES, "scsi%d : main() : command for target %d lun %llu removed from issue_queue\n", instance->host_no, tmp->device->id, tmp->device->lun);
- /*
- * A successful selection is defined as one that
- * leaves us with the command connected and
- * in hostdata->connected, OR has terminated the
- * command.
- *
- * With successful commands, we fall through
- * and see if we can do an information transfer,
- * with failures we will restart.
- */
hostdata->selecting = NULL;
/* RvC: have to preset this to indicate a new command is being performed */
@@ -1162,9 +1152,10 @@ static irqreturn_t NCR5380_intr(int dumm
* Inputs : instance - instantiation of the 5380 driver on which this
* target lives, cmd - SCSI command to execute.
*
- * Returns : -1 if selection could not execute for some reason,
- * 0 if selection succeeded or failed because the target
- * did not respond.
+ * Returns : -1 if selection failed but should be retried.
+ * 0 if selection failed and should not be retried.
+ * 0 if selection succeeded completely (hostdata->connected == cmd).
+ * 0 if selection in progress (hostdata->selecting == cmd).
*
* Side effects :
* If bus busy, arbitration failed, etc, NCR5380_select() will exit
@@ -1224,7 +1215,7 @@ static int NCR5380_select(struct Scsi_Ho
printk(KERN_DEBUG "scsi: arbitration timeout at %d\n", __LINE__);
NCR5380_write(MODE_REG, MR_BASE);
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
- goto failed;
+ return -1;
}
dprintk(NDEBUG_ARBITRATION, "scsi%d : arbitration complete\n", instance->host_no);
@@ -1242,7 +1233,7 @@ static int NCR5380_select(struct Scsi_Ho
if ((NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) || (NCR5380_read(CURRENT_SCSI_DATA_REG) & hostdata->id_higher_mask) || (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST)) {
NCR5380_write(MODE_REG, MR_BASE);
dprintk(NDEBUG_ARBITRATION, "scsi%d : lost arbitration, deasserting MR_ARBITRATE\n", instance->host_no);
- goto failed;
+ return -1;
}
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_SEL);
@@ -1255,7 +1246,7 @@ static int NCR5380_select(struct Scsi_Ho
NCR5380_write(MODE_REG, MR_BASE);
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
dprintk(NDEBUG_ARBITRATION, "scsi%d : lost arbitration, deasserting ICR_ASSERT_SEL\n", instance->host_no);
- goto failed;
+ return -1;
}
/*
* Again, bus clear + bus settle time is 1.2us, however, this is
@@ -1412,7 +1403,7 @@ part2:
if(err) {
printk(KERN_ERR "scsi%d: timeout at NCR5380.c:%d\n", instance->host_no, __LINE__);
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
- goto failed;
+ return -1;
}
dprintk(NDEBUG_SELECTION, "scsi%d : target %d selected, going into MESSAGE OUT phase.\n", instance->host_no, cmd->device->id);
@@ -1433,11 +1424,6 @@ part2:
initialize_SCp(cmd);
return 0;
-
- /* Selection failed */
-failed:
- return -1;
-
}
/*
Index: linux/drivers/scsi/atari_NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/atari_NCR5380.c 2015-12-22 12:15:46.000000000 +1100
+++ linux/drivers/scsi/atari_NCR5380.c 2015-12-22 12:15:47.000000000 +1100
@@ -1382,9 +1382,9 @@ static irqreturn_t NCR5380_intr(int irq,
* Inputs : instance - instantiation of the 5380 driver on which this
* target lives, cmd - SCSI command to execute.
*
- * Returns : -1 if selection could not execute for some reason,
- * 0 if selection succeeded or failed because the target
- * did not respond.
+ * Returns : -1 if selection failed but should be retried.
+ * 0 if selection failed and should not be retried.
+ * 0 if selection succeeded completely (hostdata->connected == cmd).
*
* Side effects :
* If bus busy, arbitration failed, etc, NCR5380_select() will exit
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-22 04:00 +0100 |
| Subject | [PATCH v3 09/77] atari_NCR5380: Reset bus on driver initialization if required |
| Message-ID | <qIll8-6s9-25@gated-at.bofh.it> |
| In reply to | #1296499 |
Merge the bus reset code from NCR5380.c into atari_NCR5380.c. This allows
for removal of a lot of duplicated code conditional on the RESET_BOOT
macro (in the next patch).
The atari_NCR5380.c fork lacks the do_reset() and NCR5380_poll_politely()
routines from NCR5380.c, so introduce them. They are indispensible. Keep
the two implementations in sync.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
drivers/scsi/NCR5380.c | 33 +++++++-----
drivers/scsi/atari_NCR5380.c | 113 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 134 insertions(+), 12 deletions(-)
Index: linux/drivers/scsi/NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/NCR5380.c 2015-12-22 12:15:38.000000000 +1100
+++ linux/drivers/scsi/NCR5380.c 2015-12-22 12:15:39.000000000 +1100
@@ -838,19 +838,20 @@ static int NCR5380_maybe_reset_bus(struc
case 1:
case 3:
case 5:
- printk(KERN_INFO "scsi%d: SCSI bus busy, waiting up to five seconds\n", instance->host_no);
- NCR5380_poll_politely(instance, STATUS_REG, SR_BSY, 0, 5*HZ);
+ shost_printk(KERN_ERR, instance, "SCSI bus busy, waiting up to five seconds\n");
+ NCR5380_poll_politely(instance,
+ STATUS_REG, SR_BSY, 0, 5 * HZ);
break;
case 2:
- printk(KERN_WARNING "scsi%d: bus busy, attempting abort\n", instance->host_no);
+ shost_printk(KERN_ERR, instance, "bus busy, attempting abort\n");
do_abort(instance);
break;
case 4:
- printk(KERN_WARNING "scsi%d: bus busy, attempting reset\n", instance->host_no);
+ shost_printk(KERN_ERR, instance, "bus busy, attempting reset\n");
do_reset(instance);
break;
case 6:
- printk(KERN_ERR "scsi%d: bus locked solid or invalid override\n", instance->host_no);
+ shost_printk(KERN_ERR, instance, "bus locked solid\n");
return -ENXIO;
}
}
@@ -1579,21 +1580,29 @@ static int NCR5380_transfer_pio(struct S
}
/**
- * do_reset - issue a reset command
- * @host: adapter to reset
+ * do_reset - issue a reset command
+ * @instance: adapter to reset
*
- * Issue a reset sequence to the NCR5380 and try and get the bus
- * back into sane shape.
+ * Issue a reset sequence to the NCR5380 and try and get the bus
+ * back into sane shape.
*
- * Locks: caller holds queue lock
+ * This clears the reset interrupt flag because there may be no handler for
+ * it. When the driver is initialized, the NCR5380_intr() handler has not yet
+ * been installed. And when in EH we may have released the ST DMA interrupt.
*/
static void do_reset(struct Scsi_Host *instance)
{
- NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(NCR5380_read(STATUS_REG) & PHASE_MASK));
+ unsigned long flags;
+
+ local_irq_save(flags);
+ NCR5380_write(TARGET_COMMAND_REG,
+ PHASE_SR_TO_TCR(NCR5380_read(STATUS_REG) & PHASE_MASK));
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST);
- udelay(25);
+ udelay(50);
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
+ (void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
+ local_irq_restore(flags);
}
/*
Index: linux/drivers/scsi/atari_NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/atari_NCR5380.c 2015-12-22 12:14:49.000000000 +1100
+++ linux/drivers/scsi/atari_NCR5380.c 2015-12-22 12:15:39.000000000 +1100
@@ -234,6 +234,9 @@
#define HOSTNO instance->host_no
#define H_NO(cmd) (cmd)->device->host->host_no
+static int do_abort(struct Scsi_Host *);
+static void do_reset(struct Scsi_Host *);
+
#ifdef SUPPORT_TAGS
/*
@@ -475,6 +478,47 @@ static inline void initialize_SCp(struct
}
}
+/**
+ * NCR5380_poll_politely - wait for NCR5380 status bits
+ * @instance: controller to poll
+ * @reg: 5380 register to poll
+ * @bit: Bitmask to check
+ * @val: Value required to exit
+ *
+ * Polls the NCR5380 in a reasonably efficient manner waiting for
+ * an event to occur, after a short quick poll we begin giving the
+ * CPU back in non IRQ contexts
+ *
+ * Returns the value of the register or a negative error code.
+ */
+
+static int NCR5380_poll_politely(struct Scsi_Host *instance,
+ int reg, int bit, int val, int t)
+{
+ int n = 500;
+ unsigned long end = jiffies + t;
+ int r;
+
+ while (n-- > 0) {
+ r = NCR5380_read(reg);
+ if ((r & bit) == val)
+ return 0;
+ cpu_relax();
+ }
+
+ /* t time yet ? */
+ while (time_before(jiffies, end)) {
+ r = NCR5380_read(reg);
+ if ((r & bit) == val)
+ return 0;
+ if (!in_interrupt())
+ cond_resched();
+ else
+ cpu_relax();
+ }
+ return -ETIMEDOUT;
+}
+
#include <linux/delay.h>
#if NDEBUG
@@ -801,6 +845,49 @@ static int __init NCR5380_init(struct Sc
}
/**
+ * NCR5380_maybe_reset_bus - Detect and correct bus wedge problems.
+ * @instance: adapter to check
+ *
+ * If the system crashed, it may have crashed with a connected target and
+ * the SCSI bus busy. Check for BUS FREE phase. If not, try to abort the
+ * currently established nexus, which we know nothing about. Failing that
+ * do a bus reset.
+ *
+ * Note that a bus reset will cause the chip to assert IRQ.
+ *
+ * Returns 0 if successful, otherwise -ENXIO.
+ */
+
+static int NCR5380_maybe_reset_bus(struct Scsi_Host *instance)
+{
+ int pass;
+
+ for (pass = 1; (NCR5380_read(STATUS_REG) & SR_BSY) && pass <= 6; ++pass) {
+ switch (pass) {
+ case 1:
+ case 3:
+ case 5:
+ shost_printk(KERN_ERR, instance, "SCSI bus busy, waiting up to five seconds\n");
+ NCR5380_poll_politely(instance,
+ STATUS_REG, SR_BSY, 0, 5 * HZ);
+ break;
+ case 2:
+ shost_printk(KERN_ERR, instance, "bus busy, attempting abort\n");
+ do_abort(instance);
+ break;
+ case 4:
+ shost_printk(KERN_ERR, instance, "bus busy, attempting reset\n");
+ do_reset(instance);
+ break;
+ case 6:
+ shost_printk(KERN_ERR, instance, "bus locked solid\n");
+ return -ENXIO;
+ }
+ }
+ return 0;
+}
+
+/**
* NCR5380_exit - remove an NCR5380
* @instance: adapter to remove
*
@@ -1741,6 +1828,32 @@ static int NCR5380_transfer_pio(struct S
return -1;
}
+/**
+ * do_reset - issue a reset command
+ * @instance: adapter to reset
+ *
+ * Issue a reset sequence to the NCR5380 and try and get the bus
+ * back into sane shape.
+ *
+ * This clears the reset interrupt flag because there may be no handler for
+ * it. When the driver is initialized, the NCR5380_intr() handler has not yet
+ * been installed. And when in EH we may have released the ST DMA interrupt.
+ */
+
+static void do_reset(struct Scsi_Host *instance)
+{
+ unsigned long flags;
+
+ local_irq_save(flags);
+ NCR5380_write(TARGET_COMMAND_REG,
+ PHASE_SR_TO_TCR(NCR5380_read(STATUS_REG) & PHASE_MASK));
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST);
+ udelay(50);
+ NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
+ (void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
+ local_irq_restore(flags);
+}
+
/*
* Function : do_abort (Scsi_Host *host)
*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-22 04:00 +0100 |
| Subject | [PATCH v3 15/77] ncr5380: Always escalate bad target time-out in NCR5380_select() |
| Message-ID | <qIll8-6s9-27@gated-at.bofh.it> |
| In reply to | #1296499 |
Remove the restart_select and targets_present variables introduced in
Linux v1.1.38. The former was used only for a questionable debug printk
and the latter "so we can call a select failure a retryable condition".
Well, retrying select failure in general is a different problem to a
target that doesn't assert BSY. We need to handle these two cases
differently; the latter case can be left to the SCSI ML.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
drivers/scsi/NCR5380.c | 13 -------------
drivers/scsi/NCR5380.h | 6 ------
drivers/scsi/atari_NCR5380.c | 13 -------------
3 files changed, 32 deletions(-)
Index: linux/drivers/scsi/NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/NCR5380.c 2015-12-22 12:15:47.000000000 +1100
+++ linux/drivers/scsi/NCR5380.c 2015-12-22 12:15:48.000000000 +1100
@@ -790,7 +790,6 @@ static int NCR5380_init(struct Scsi_Host
#ifdef REAL_DMA
hostdata->dmalen = 0;
#endif
- hostdata->targets_present = 0;
hostdata->connected = NULL;
hostdata->issue_queue = NULL;
hostdata->disconnected_queue = NULL;
@@ -1186,8 +1185,6 @@ static int NCR5380_select(struct Scsi_Ho
if (hostdata->selecting)
goto part2;
- hostdata->restart_select = 0;
-
NCR5380_dprint(NDEBUG_ARBITRATION, instance);
dprintk(NDEBUG_ARBITRATION, "scsi%d : starting arbitration, id = %d\n", instance->host_no, instance->this_id);
@@ -1363,21 +1360,12 @@ part2:
if (!(NCR5380_read(STATUS_REG) & SR_BSY)) {
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
- if (hostdata->targets_present & (1 << scmd_id(cmd))) {
- printk(KERN_DEBUG "scsi%d : weirdness\n", instance->host_no);
- if (hostdata->restart_select)
- printk(KERN_DEBUG "\trestart select\n");
- NCR5380_dprint(NDEBUG_SELECTION, instance);
- NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
- return -1;
- }
cmd->result = DID_BAD_TARGET << 16;
cmd->scsi_done(cmd);
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
dprintk(NDEBUG_SELECTION, "scsi%d : target did not respond within 250ms\n", instance->host_no);
return 0;
}
- hostdata->targets_present |= (1 << scmd_id(cmd));
/*
* Since we followed the SCSI spec, and raised ATN while SEL
@@ -2382,7 +2370,6 @@ static void NCR5380_reselect(struct Scsi
*/
NCR5380_write(MODE_REG, MR_BASE);
- hostdata->restart_select = 1;
target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask);
dprintk(NDEBUG_SELECTION, "scsi%d : reselect\n", instance->host_no);
Index: linux/drivers/scsi/atari_NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/atari_NCR5380.c 2015-12-22 12:15:47.000000000 +1100
+++ linux/drivers/scsi/atari_NCR5380.c 2015-12-22 12:15:48.000000000 +1100
@@ -826,7 +826,6 @@ static int __init NCR5380_init(struct Sc
#if defined (REAL_DMA)
hostdata->dma_len = 0;
#endif
- hostdata->targets_present = 0;
hostdata->connected = NULL;
hostdata->issue_queue = NULL;
hostdata->disconnected_queue = NULL;
@@ -1409,7 +1408,6 @@ static int NCR5380_select(struct Scsi_Ho
unsigned long timeout;
unsigned long flags;
- hostdata->restart_select = 0;
NCR5380_dprint(NDEBUG_ARBITRATION, instance);
dprintk(NDEBUG_ARBITRATION, "scsi%d: starting arbitration, id = %d\n", HOSTNO,
instance->this_id);
@@ -1625,14 +1623,6 @@ static int NCR5380_select(struct Scsi_Ho
if (!(NCR5380_read(STATUS_REG) & SR_BSY)) {
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
- if (hostdata->targets_present & (1 << cmd->device->id)) {
- printk(KERN_ERR "scsi%d: weirdness\n", HOSTNO);
- if (hostdata->restart_select)
- printk(KERN_NOTICE "\trestart select\n");
- NCR5380_dprint(NDEBUG_ANY, instance);
- NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
- return -1;
- }
cmd->result = DID_BAD_TARGET << 16;
#ifdef SUPPORT_TAGS
cmd_free_tag(cmd);
@@ -1643,8 +1633,6 @@ static int NCR5380_select(struct Scsi_Ho
return 0;
}
- hostdata->targets_present |= (1 << cmd->device->id);
-
/*
* Since we followed the SCSI spec, and raised ATN while SEL
* was true but before BSY was false during selection, the information
@@ -2605,7 +2593,6 @@ static void NCR5380_reselect(struct Scsi
*/
NCR5380_write(MODE_REG, MR_BASE);
- hostdata->restart_select = 1;
target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask);
Index: linux/drivers/scsi/NCR5380.h
===================================================================
--- linux.orig/drivers/scsi/NCR5380.h 2015-12-22 12:15:44.000000000 +1100
+++ linux/drivers/scsi/NCR5380.h 2015-12-22 12:15:48.000000000 +1100
@@ -257,9 +257,6 @@ struct NCR5380_hostdata {
NCR5380_implementation_fields; /* implementation specific */
struct Scsi_Host *host; /* Host backpointer */
unsigned char id_mask, id_higher_mask; /* 1 << id, all bits greater */
- unsigned char targets_present; /* targets we have connected
- to, so we can call a select
- failure a retryable condition */
volatile unsigned char busy[8]; /* index = target, bit = lun */
#if defined(REAL_DMA) || defined(REAL_DMA_POLL)
volatile int dma_len; /* requested length of DMA */
@@ -268,9 +265,6 @@ struct NCR5380_hostdata {
volatile struct scsi_cmnd *connected; /* currently connected command */
volatile struct scsi_cmnd *issue_queue; /* waiting to be issued */
volatile struct scsi_cmnd *disconnected_queue; /* waiting for reconnect */
- volatile int restart_select; /* we have disconnected,
- used to restart
- NCR5380_select() */
int flags;
unsigned long time_expires; /* in jiffies, set prior to sleeping */
int select_time; /* timer in select for target response */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-22 04:00 +0100 |
| Subject | [PATCH v3 05/77] ncr5380: Remove NCR5380_local_declare and NCR5380_setup macros |
| Message-ID | <qIll7-6s9-7@gated-at.bofh.it> |
| In reply to | #1296499 |
The NCR5380_local_declare and NCR5380_setup macros exist to define and
initialize a particular local variable, to provide the address of the
chip registers needed for the driver's implementation of its
NCR5380_read/write register access macros.
In cumana_1 and macscsi, these macros generate pointless code like this,
struct Scsi_Host *_instance;
_instance = instance;
In pas16, the use of NCR5380_read/write in pas16_hw_detect() requires that
the io_port local variable has been defined and initialized, but the
NCR5380_local_declare and NCR5380_setup macros can't be used for that
purpose because the Scsi_Host struct has not yet been instantiated.
Moreover, these macros were removed from atari_NCR5380.c long ago and
now they constitute yet another discrepancy between the two core driver
forks.
Remove these "optimizations".
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
Any performance penalty is highly unlikely given the algorithms involved
and the improvements made to compilers over the last two decades. (And
I'd probably accept some loss anyway given the maintainability benefit.)
Following the example of atari_NCR5380.c, the Scsi_Host pointer is now
always named "instance", and the NCR5380_read/write macros depend on this.
I think it is poor style to hard-code the identifier "instance" in these
macros but it is actually an improvement -- previously each NCR5380 driver
named a different local variable in its macro definitions.
Eventually, the NCR5380_read/write macros may have to become function
calls if this is to become a platform driver or a library. The instance
pointer or hostdata pointer will then have to be passed as an argument.
This patch is a step in that direction, in that it rewrites the
NCR5380_read/write macros in terms of hostdata and removes the
NCR5380_read/write usage from pas16_hw_detect() where there is no
Scsi_Host instance as yet.
---
drivers/scsi/NCR5380.c | 60 ++++++--------------------------------------
drivers/scsi/arm/cumana_1.c | 6 +---
drivers/scsi/arm/oak.c | 9 +++---
drivers/scsi/dmx3191d.c | 6 +---
drivers/scsi/dtc.c | 14 +++-------
drivers/scsi/dtc.h | 9 +-----
drivers/scsi/g_NCR5380.c | 27 ++++++++++---------
drivers/scsi/g_NCR5380.h | 30 ++++++++--------------
drivers/scsi/mac_scsi.c | 15 +----------
drivers/scsi/pas16.c | 16 +++++------
drivers/scsi/pas16.h | 11 +-------
drivers/scsi/t128.c | 26 +++++++++----------
drivers/scsi/t128.h | 9 +-----
13 files changed, 77 insertions(+), 161 deletions(-)
Index: linux/drivers/scsi/NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/NCR5380.c 2015-12-22 12:15:24.000000000 +1100
+++ linux/drivers/scsi/NCR5380.c 2015-12-22 12:15:30.000000000 +1100
@@ -230,11 +230,6 @@
* USLEEP_POLL - amount of time, in jiffies, to poll
*
* These macros MUST be defined :
- * NCR5380_local_declare() - declare any local variables needed for your
- * transfer routines.
- *
- * NCR5380_setup(instance) - initialize any local variables needed from a given
- * instance of the host adapter for NCR5380_{read,write,pread,pwrite}
*
* NCR5380_read(register) - read from the specified register
*
@@ -267,8 +262,8 @@
* possible) function may be used.
*/
-static int do_abort(struct Scsi_Host *host);
-static void do_reset(struct Scsi_Host *host);
+static int do_abort(struct Scsi_Host *);
+static void do_reset(struct Scsi_Host *);
/*
* initialize_SCp - init the scsi pointer field
@@ -313,12 +308,9 @@ static inline void initialize_SCp(struct
static int NCR5380_poll_politely(struct Scsi_Host *instance, int reg, int bit, int val, int t)
{
- NCR5380_local_declare();
int n = 500; /* At about 8uS a cycle for the cpu access */
unsigned long end = jiffies + t;
int r;
-
- NCR5380_setup(instance);
while( n-- > 0)
{
@@ -406,9 +398,7 @@ mrs[] = {
static void NCR5380_print(struct Scsi_Host *instance)
{
- NCR5380_local_declare();
unsigned char status, data, basr, mr, icr, i;
- NCR5380_setup(instance);
data = NCR5380_read(CURRENT_SCSI_DATA_REG);
status = NCR5380_read(STATUS_REG);
@@ -447,10 +437,8 @@ static void NCR5380_print(struct Scsi_Ho
static void NCR5380_print_phase(struct Scsi_Host *instance)
{
- NCR5380_local_declare();
unsigned char status;
int i;
- NCR5380_setup(instance);
status = NCR5380_read(STATUS_REG);
if (!(status & SR_REQ))
@@ -566,11 +554,9 @@ static irqreturn_t __init probe_intr(int
static int __init __maybe_unused NCR5380_probe_irq(struct Scsi_Host *instance,
int possible)
{
- NCR5380_local_declare();
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
unsigned long timeout;
int trying_irqs, i, mask;
- NCR5380_setup(instance);
for (trying_irqs = 0, i = 1, mask = 2; i < 16; ++i, mask <<= 1)
if ((mask & possible) && (request_irq(i, &probe_intr, 0, "NCR-probe", NULL) == 0))
@@ -791,7 +777,6 @@ static void lprint_opcode(int opcode, st
static int NCR5380_init(struct Scsi_Host *instance, int flags)
{
- NCR5380_local_declare();
int i, pass;
unsigned long timeout;
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
@@ -808,8 +793,6 @@ static int NCR5380_init(struct Scsi_Host
instance->NCR5380_instance_name += NCR53C400_address_adjust;
#endif
- NCR5380_setup(instance);
-
hostdata->aborted = 0;
hostdata->id_mask = 1 << instance->this_id;
for (i = hostdata->id_mask; i <= 0x80; i <<= 1)
@@ -1100,7 +1083,6 @@ static void NCR5380_main(struct work_str
static irqreturn_t NCR5380_intr(int dummy, void *dev_id)
{
- NCR5380_local_declare();
struct Scsi_Host *instance = dev_id;
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
int done;
@@ -1114,7 +1096,6 @@ static irqreturn_t NCR5380_intr(int dumm
done = 1;
spin_lock_irqsave(instance->host_lock, flags);
/* Look for pending interrupts */
- NCR5380_setup(instance);
basr = NCR5380_read(BUS_AND_STATUS_REG);
/* XXX dispatch to appropriate routine if found and done=0 */
if (basr & BASR_IRQ) {
@@ -1205,7 +1186,6 @@ static irqreturn_t NCR5380_intr(int dumm
static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd)
{
- NCR5380_local_declare();
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
unsigned char tmp[3], phase;
unsigned char *data;
@@ -1213,7 +1193,6 @@ static int NCR5380_select(struct Scsi_Ho
unsigned long timeout;
unsigned char value;
int err;
- NCR5380_setup(instance);
if (hostdata->selecting)
goto part2;
@@ -1487,7 +1466,6 @@ failed:
*/
static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data) {
- NCR5380_local_declare();
unsigned char p = *phase, tmp;
int c = *count;
unsigned char *d = *data;
@@ -1496,7 +1474,6 @@ static int NCR5380_transfer_pio(struct S
*/
int break_allowed = 0;
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
- NCR5380_setup(instance);
if (!(p & SR_IO))
dprintk(NDEBUG_PIO, "scsi%d : pio write %d bytes\n", instance->host_no, c);
@@ -1623,10 +1600,8 @@ static int NCR5380_transfer_pio(struct S
* Locks: caller holds queue lock
*/
-static void do_reset(struct Scsi_Host *host) {
- NCR5380_local_declare();
- NCR5380_setup(host);
-
+static void do_reset(struct Scsi_Host *instance)
+{
NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(NCR5380_read(STATUS_REG) & PHASE_MASK));
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST);
udelay(25);
@@ -1645,13 +1620,11 @@ static void do_reset(struct Scsi_Host *h
* FIXME: sort this out and get new_eh running
*/
-static int do_abort(struct Scsi_Host *host) {
- NCR5380_local_declare();
+static int do_abort(struct Scsi_Host *instance)
+{
unsigned char *msgptr, phase, tmp;
int len;
int rc;
- NCR5380_setup(host);
-
/* Request message out phase */
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
@@ -1666,7 +1639,7 @@ static int do_abort(struct Scsi_Host *ho
* the target sees, so we just handshake.
*/
- rc = NCR5380_poll_politely(host, STATUS_REG, SR_REQ, SR_REQ, 60 * HZ);
+ rc = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, SR_REQ, 60 * HZ);
if(rc < 0)
return -1;
@@ -1677,7 +1650,7 @@ static int do_abort(struct Scsi_Host *ho
if ((tmp & PHASE_MASK) != PHASE_MSGOUT) {
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN | ICR_ASSERT_ACK);
- rc = NCR5380_poll_politely(host, STATUS_REG, SR_REQ, 0, 3*HZ);
+ rc = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, 0, 3 * HZ);
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
if(rc == -1)
return -1;
@@ -1686,7 +1659,7 @@ static int do_abort(struct Scsi_Host *ho
msgptr = &tmp;
len = 1;
phase = PHASE_MSGOUT;
- NCR5380_transfer_pio(host, &phase, &len, &msgptr);
+ NCR5380_transfer_pio(instance, &phase, &len, &msgptr);
/*
* If we got here, and the command completed successfully,
@@ -1719,7 +1692,6 @@ static int do_abort(struct Scsi_Host *ho
static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data) {
- NCR5380_local_declare();
register int c = *count;
register unsigned char p = *phase;
register unsigned char *d = *data;
@@ -1732,8 +1704,6 @@ static int NCR5380_transfer_dma(struct S
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
- NCR5380_setup(instance);
-
if ((tmp = (NCR5380_read(STATUS_REG) & PHASE_MASK)) != p) {
*phase = tmp;
return -1;
@@ -2000,7 +1970,6 @@ static int NCR5380_transfer_dma(struct S
*/
static void NCR5380_information_transfer(struct Scsi_Host *instance) {
- NCR5380_local_declare();
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *)instance->hostdata;
unsigned char msgout = NOP;
int sink = 0;
@@ -2014,8 +1983,6 @@ static void NCR5380_information_transfer
/* RvC: we need to set the end of the polling time */
unsigned long poll_time = jiffies + USLEEP_POLL;
- NCR5380_setup(instance);
-
while (1) {
tmp = NCR5380_read(STATUS_REG);
/* We only have a valid SCSI phase when REQ is asserted */
@@ -2406,7 +2373,6 @@ static void NCR5380_information_transfer
*/
static void NCR5380_reselect(struct Scsi_Host *instance) {
- NCR5380_local_declare();
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *)
instance->hostdata;
unsigned char target_mask;
@@ -2416,7 +2382,6 @@ static void NCR5380_reselect(struct Scsi
unsigned char *data;
struct scsi_cmnd *tmp = NULL, *prev;
int abort = 0;
- NCR5380_setup(instance);
/*
* Disable arbitration, etc. since the host adapter obviously
@@ -2525,10 +2490,8 @@ static void NCR5380_reselect(struct Scsi
#ifdef REAL_DMA
static void NCR5380_dma_complete(NCR5380_instance * instance) {
- NCR5380_local_declare();
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
int transferred;
- NCR5380_setup(instance);
/*
* XXX this might not be right.
@@ -2581,7 +2544,6 @@ static void NCR5380_dma_complete(NCR5380
static int NCR5380_abort(struct scsi_cmnd *cmd)
{
- NCR5380_local_declare();
struct Scsi_Host *instance = cmd->device->host;
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
struct scsi_cmnd *tmp, **prev;
@@ -2590,8 +2552,6 @@ static int NCR5380_abort(struct scsi_cmn
NCR5380_print_status(instance);
- NCR5380_setup(instance);
-
dprintk(NDEBUG_ABORT, "scsi%d : abort called\n", instance->host_no);
dprintk(NDEBUG_ABORT, " basr 0x%X, sr 0x%X\n", NCR5380_read(BUS_AND_STATUS_REG), NCR5380_read(STATUS_REG));
@@ -2737,8 +2697,6 @@ static int NCR5380_bus_reset(struct scsi
{
struct Scsi_Host *instance = cmd->device->host;
- NCR5380_local_declare();
- NCR5380_setup(instance);
NCR5380_print_status(instance);
spin_lock_irq(instance->host_lock);
Index: linux/drivers/scsi/arm/cumana_1.c
===================================================================
--- linux.orig/drivers/scsi/arm/cumana_1.c 2015-12-22 12:14:49.000000000 +1100
+++ linux/drivers/scsi/arm/cumana_1.c 2015-12-22 12:15:30.000000000 +1100
@@ -20,10 +20,8 @@
#define PSEUDO_DMA
#define priv(host) ((struct NCR5380_hostdata *)(host)->hostdata)
-#define NCR5380_local_declare() struct Scsi_Host *_instance
-#define NCR5380_setup(instance) _instance = instance
-#define NCR5380_read(reg) cumanascsi_read(_instance, reg)
-#define NCR5380_write(reg, value) cumanascsi_write(_instance, reg, value)
+#define NCR5380_read(reg) cumanascsi_read(instance, reg)
+#define NCR5380_write(reg, value) cumanascsi_write(instance, reg, value)
#define NCR5380_intr cumanascsi_intr
#define NCR5380_queue_command cumanascsi_queue_command
#define NCR5380_info cumanascsi_info
Index: linux/drivers/scsi/arm/oak.c
===================================================================
--- linux.orig/drivers/scsi/arm/oak.c 2015-12-22 12:14:49.000000000 +1100
+++ linux/drivers/scsi/arm/oak.c 2015-12-22 12:15:30.000000000 +1100
@@ -20,11 +20,12 @@
#define DONT_USE_INTR
#define priv(host) ((struct NCR5380_hostdata *)(host)->hostdata)
-#define NCR5380_local_declare() void __iomem *_base
-#define NCR5380_setup(host) _base = priv(host)->base
-#define NCR5380_read(reg) readb(_base + ((reg) << 2))
-#define NCR5380_write(reg, value) writeb(value, _base + ((reg) << 2))
+#define NCR5380_read(reg) \
+ readb(priv(instance)->base + ((reg) << 2))
+#define NCR5380_write(reg, value) \
+ writeb(value, priv(instance)->base + ((reg) << 2))
+
#define NCR5380_queue_command oakscsi_queue_command
#define NCR5380_info oakscsi_info
#define NCR5380_show_info oakscsi_show_info
Index: linux/drivers/scsi/dmx3191d.c
===================================================================
--- linux.orig/drivers/scsi/dmx3191d.c 2015-12-22 12:14:49.000000000 +1100
+++ linux/drivers/scsi/dmx3191d.c 2015-12-22 12:15:30.000000000 +1100
@@ -36,12 +36,10 @@
#define DONT_USE_INTR
-#define NCR5380_read(reg) inb(port + reg)
-#define NCR5380_write(reg, value) outb(value, port + reg)
+#define NCR5380_read(reg) inb(instance->io_port + reg)
+#define NCR5380_write(reg, value) outb(value, instance->io_port + reg)
#define NCR5380_implementation_fields /* none */
-#define NCR5380_local_declare() unsigned int port
-#define NCR5380_setup(instance) port = instance->io_port
/*
* Includes needed for NCR5380.[ch] (XXX: Move them to NCR5380.h)
Index: linux/drivers/scsi/dtc.c
===================================================================
--- linux.orig/drivers/scsi/dtc.c 2015-12-22 12:15:26.000000000 +1100
+++ linux/drivers/scsi/dtc.c 2015-12-22 12:15:30.000000000 +1100
@@ -325,8 +325,6 @@ static inline int NCR5380_pread(struct S
unsigned char *d = dst;
int i; /* For counting time spent in the poll-loop */
struct NCR5380_hostdata *hostdata = shost_priv(instance);
- NCR5380_local_declare();
- NCR5380_setup(instance);
i = 0;
NCR5380_read(RESET_PARITY_INTERRUPT_REG);
@@ -342,7 +340,7 @@ static inline int NCR5380_pread(struct S
while (NCR5380_read(DTC_CONTROL_REG) & CSR_HOST_BUF_NOT_RDY)
++i;
rtrc(3);
- memcpy_fromio(d, base + DTC_DATA_BUF, 128);
+ memcpy_fromio(d, hostdata->base + DTC_DATA_BUF, 128);
d += 128;
len -= 128;
rtrc(7);
@@ -377,8 +375,6 @@ static inline int NCR5380_pwrite(struct
{
int i;
struct NCR5380_hostdata *hostdata = shost_priv(instance);
- NCR5380_local_declare();
- NCR5380_setup(instance);
NCR5380_read(RESET_PARITY_INTERRUPT_REG);
NCR5380_write(MODE_REG, MR_ENABLE_EOP_INTR | MR_DMA_MODE);
@@ -394,7 +390,7 @@ static inline int NCR5380_pwrite(struct
while (NCR5380_read(DTC_CONTROL_REG) & CSR_HOST_BUF_NOT_RDY)
++i;
rtrc(3);
- memcpy_toio(base + DTC_DATA_BUF, src, 128);
+ memcpy_toio(hostdata->base + DTC_DATA_BUF, src, 128);
src += 128;
len -= 128;
}
@@ -420,15 +416,15 @@ MODULE_LICENSE("GPL");
static int dtc_release(struct Scsi_Host *shost)
{
- NCR5380_local_declare();
- NCR5380_setup(shost);
+ struct NCR5380_hostdata *hostdata = shost_priv(shost);
+
if (shost->irq != NO_IRQ)
free_irq(shost->irq, shost);
NCR5380_exit(shost);
if (shost->io_port && shost->n_io_port)
release_region(shost->io_port, shost->n_io_port);
scsi_unregister(shost);
- iounmap(base);
+ iounmap(hostdata->base);
return 0;
}
Index: linux/drivers/scsi/dtc.h
===================================================================
--- linux.orig/drivers/scsi/dtc.h 2015-12-22 12:15:26.000000000 +1100
+++ linux/drivers/scsi/dtc.h 2015-12-22 12:15:30.000000000 +1100
@@ -21,13 +21,8 @@
#define NCR5380_implementation_fields \
void __iomem *base
-#define NCR5380_local_declare() \
- void __iomem *base
-
-#define NCR5380_setup(instance) \
- base = ((struct NCR5380_hostdata *)(instance)->hostdata)->base
-
-#define DTC_address(reg) (base + DTC_5380_OFFSET + reg)
+#define DTC_address(reg) \
+ (((struct NCR5380_hostdata *)shost_priv(instance))->base + DTC_5380_OFFSET + reg)
#define NCR5380_read(reg) (readb(DTC_address(reg)))
#define NCR5380_write(reg, value) (writeb(value, DTC_address(reg)))
Index: linux/drivers/scsi/g_NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/g_NCR5380.c 2015-12-22 12:15:28.000000000 +1100
+++ linux/drivers/scsi/g_NCR5380.c 2015-12-22 12:15:30.000000000 +1100
@@ -459,9 +459,6 @@ static int __init generic_NCR5380_detect
static int generic_NCR5380_release_resources(struct Scsi_Host *instance)
{
- NCR5380_local_declare();
- NCR5380_setup(instance);
-
if (instance->irq != NO_IRQ)
free_irq(instance->irq, instance);
NCR5380_exit(instance);
@@ -520,13 +517,13 @@ generic_NCR5380_biosparam(struct scsi_de
static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len)
{
+#ifdef SCSI_G_NCR5380_MEM
+ struct NCR5380_hostdata *hostdata = shost_priv(instance);
+#endif
int blocks = len / 128;
int start = 0;
int bl;
- NCR5380_local_declare();
- NCR5380_setup(instance);
-
NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE | CSR_TRANS_DIR);
NCR5380_write(C400_BLOCK_COUNTER_REG, blocks);
while (1) {
@@ -547,7 +544,8 @@ static inline int NCR5380_pread(struct S
}
#else
/* implies SCSI_G_NCR5380_MEM */
- memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128);
+ memcpy_fromio(dst + start,
+ hostdata->iomem + NCR53C400_host_buffer, 128);
#endif
start += 128;
blocks--;
@@ -567,7 +565,8 @@ static inline int NCR5380_pread(struct S
}
#else
/* implies SCSI_G_NCR5380_MEM */
- memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128);
+ memcpy_fromio(dst + start,
+ hostdata->iomem + NCR53C400_host_buffer, 128);
#endif
start += 128;
blocks--;
@@ -604,14 +603,14 @@ static inline int NCR5380_pread(struct S
static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len)
{
+#ifdef SCSI_G_NCR5380_MEM
+ struct NCR5380_hostdata *hostdata = shost_priv(instance);
+#endif
int blocks = len / 128;
int start = 0;
int bl;
int i;
- NCR5380_local_declare();
- NCR5380_setup(instance);
-
NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
NCR5380_write(C400_BLOCK_COUNTER_REG, blocks);
while (1) {
@@ -632,7 +631,8 @@ static inline int NCR5380_pwrite(struct
}
#else
/* implies SCSI_G_NCR5380_MEM */
- memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128);
+ memcpy_toio(hostdata->iomem + NCR53C400_host_buffer,
+ src + start, 128);
#endif
start += 128;
blocks--;
@@ -648,7 +648,8 @@ static inline int NCR5380_pwrite(struct
}
#else
/* implies SCSI_G_NCR5380_MEM */
- memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128);
+ memcpy_toio(hostdata->iomem + NCR53C400_host_buffer,
+ src + start, 128);
#endif
start += 128;
blocks--;
Index: linux/drivers/scsi/g_NCR5380.h
===================================================================
--- linux.orig/drivers/scsi/g_NCR5380.h 2015-12-22 12:15:28.000000000 +1100
+++ linux/drivers/scsi/g_NCR5380.h 2015-12-22 12:15:30.000000000 +1100
@@ -46,17 +46,12 @@
#define NCR5380_region_size 8
#endif
-#define NCR5380_read(reg) (inb(NCR5380_map_name + (reg)))
-#define NCR5380_write(reg, value) (outb((value), (NCR5380_map_name + (reg))))
+#define NCR5380_read(reg) \
+ inb(instance->io_port + (reg))
+#define NCR5380_write(reg, value) \
+ outb(value, instance->io_port + (reg))
-#define NCR5380_implementation_fields \
- NCR5380_map_type NCR5380_map_name
-
-#define NCR5380_local_declare() \
- register NCR5380_implementation_fields
-
-#define NCR5380_setup(instance) \
- NCR5380_map_name = (NCR5380_map_type)((instance)->NCR5380_instance_name)
+#define NCR5380_implementation_fields /* none */
#else
/* therefore SCSI_G_NCR5380_MEM */
@@ -70,19 +65,16 @@
#define NCR53C400_host_buffer 0x3900
#define NCR5380_region_size 0x3a00
-#define NCR5380_read(reg) readb(iomem + NCR53C400_mem_base + (reg))
-#define NCR5380_write(reg, value) writeb(value, iomem + NCR53C400_mem_base + (reg))
+#define NCR5380_read(reg) \
+ readb(((struct NCR5380_hostdata *)shost_priv(instance))->iomem + \
+ NCR53C400_mem_base + (reg))
+#define NCR5380_write(reg, value) \
+ writeb(value, ((struct NCR5380_hostdata *)shost_priv(instance))->iomem + \
+ NCR53C400_mem_base + (reg))
#define NCR5380_implementation_fields \
- NCR5380_map_type NCR5380_map_name; \
void __iomem *iomem;
-#define NCR5380_local_declare() \
- register void __iomem *iomem
-
-#define NCR5380_setup(instance) \
- iomem = (((struct NCR5380_hostdata *)(instance)->hostdata)->iomem)
-
#endif
#define NCR5380_intr generic_NCR5380_intr
Index: linux/drivers/scsi/mac_scsi.c
===================================================================
--- linux.orig/drivers/scsi/mac_scsi.c 2015-12-22 12:14:49.000000000 +1100
+++ linux/drivers/scsi/mac_scsi.c 2015-12-22 12:15:30.000000000 +1100
@@ -32,11 +32,9 @@
#define PSEUDO_DMA
#define NCR5380_implementation_fields unsigned char *pdma_base
-#define NCR5380_local_declare() struct Scsi_Host *_instance
-#define NCR5380_setup(instance) _instance = instance
-#define NCR5380_read(reg) macscsi_read(_instance, reg)
-#define NCR5380_write(reg, value) macscsi_write(_instance, reg, value)
+#define NCR5380_read(reg) macscsi_read(instance, reg)
+#define NCR5380_write(reg, value) macscsi_write(instance, reg, value)
#define NCR5380_pread macscsi_pread
#define NCR5380_pwrite macscsi_pwrite
@@ -129,9 +127,6 @@ static void mac_scsi_reset_boot(struct S
{
unsigned long end;
- NCR5380_local_declare();
- NCR5380_setup(instance);
-
/*
* Do a SCSI reset to clean up the bus during initialization. No messing
* with the queues, interrupts, or locks necessary here.
@@ -235,9 +230,6 @@ static int macscsi_pread(struct Scsi_Hos
unsigned char *d;
unsigned char *s;
- NCR5380_local_declare();
- NCR5380_setup(instance);
-
s = hostdata->pdma_base + (INPUT_DATA_REG << 4);
d = dst;
@@ -329,9 +321,6 @@ static int macscsi_pwrite(struct Scsi_Ho
unsigned char *s;
unsigned char *d;
- NCR5380_local_declare();
- NCR5380_setup(instance);
-
s = src;
d = hostdata->pdma_base + (OUTPUT_DATA_REG << 4);
Index: linux/drivers/scsi/pas16.h
===================================================================
--- linux.orig/drivers/scsi/pas16.h 2015-12-22 12:15:28.000000000 +1100
+++ linux/drivers/scsi/pas16.h 2015-12-22 12:15:30.000000000 +1100
@@ -103,16 +103,9 @@
#define CAN_QUEUE 32
#endif
-#define NCR5380_implementation_fields \
- volatile unsigned short io_port
+#define NCR5380_implementation_fields /* none */
-#define NCR5380_local_declare() \
- volatile unsigned short io_port
-
-#define NCR5380_setup(instance) \
- io_port = (instance)->io_port
-
-#define PAS16_io_port(reg) ( io_port + pas16_offset[(reg)] )
+#define PAS16_io_port(reg) (instance->io_port + pas16_offset[(reg)])
#define NCR5380_read(reg) ( inb(PAS16_io_port(reg)) )
#define NCR5380_write(reg, value) ( outb((value),PAS16_io_port(reg)) )
Index: linux/drivers/scsi/t128.c
===================================================================
--- linux.orig/drivers/scsi/t128.c 2015-12-22 12:15:26.000000000 +1100
+++ linux/drivers/scsi/t128.c 2015-12-22 12:15:30.000000000 +1100
@@ -248,15 +248,15 @@ found:
static int t128_release(struct Scsi_Host *shost)
{
- NCR5380_local_declare();
- NCR5380_setup(shost);
+ struct NCR5380_hostdata *hostdata = shost_priv(shost);
+
if (shost->irq != NO_IRQ)
free_irq(shost->irq, shost);
NCR5380_exit(shost);
if (shost->io_port && shost->n_io_port)
release_region(shost->io_port, shost->n_io_port);
scsi_unregister(shost);
- iounmap(base);
+ iounmap(hostdata->base);
return 0;
}
@@ -302,14 +302,14 @@ static int t128_biosparam(struct scsi_de
* timeout.
*/
-static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst,
- int len) {
- NCR5380_local_declare();
- void __iomem *reg;
+static inline int
+NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len)
+{
+ struct NCR5380_hostdata *hostdata = shost_priv(instance);
+ void __iomem *reg, *base = hostdata->base;
unsigned char *d = dst;
register int i = len;
- NCR5380_setup(instance);
reg = base + T_DATA_REG_OFFSET;
#if 0
@@ -348,14 +348,14 @@ static inline int NCR5380_pread (struct
* timeout.
*/
-static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src,
- int len) {
- NCR5380_local_declare();
- void __iomem *reg;
+static inline int
+NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len)
+{
+ struct NCR5380_hostdata *hostdata = shost_priv(instance);
+ void __iomem *reg, *base = hostdata->base;
unsigned char *s = src;
register int i = len;
- NCR5380_setup(instance);
reg = base + T_DATA_REG_OFFSET;
#if 0
Index: linux/drivers/scsi/t128.h
===================================================================
--- linux.orig/drivers/scsi/t128.h 2015-12-22 12:15:28.000000000 +1100
+++ linux/drivers/scsi/t128.h 2015-12-22 12:15:30.000000000 +1100
@@ -78,13 +78,8 @@
#define NCR5380_implementation_fields \
void __iomem *base
-#define NCR5380_local_declare() \
- void __iomem *base
-
-#define NCR5380_setup(instance) \
- base = ((struct NCR5380_hostdata *)(instance->hostdata))->base
-
-#define T128_address(reg) (base + T_5380_OFFSET + ((reg) * 0x20))
+#define T128_address(reg) \
+ (((struct NCR5380_hostdata *)shost_priv(instance))->base + T_5380_OFFSET + ((reg) * 0x20))
#define NCR5380_read(reg) readb(T128_address(reg))
#define NCR5380_write(reg, value) writeb((value),(T128_address(reg)))
Index: linux/drivers/scsi/pas16.c
===================================================================
--- linux.orig/drivers/scsi/pas16.c 2015-12-22 12:15:28.000000000 +1100
+++ linux/drivers/scsi/pas16.c 2015-12-22 12:15:30.000000000 +1100
@@ -188,7 +188,7 @@ static void __init
outb( 0x01, io_port + P_TIMEOUT_STATUS_REG_OFFSET ); /* Reset TC */
outb( 0x01, io_port + WAIT_STATE ); /* 1 Wait state */
- NCR5380_read( RESET_PARITY_INTERRUPT_REG );
+ inb(io_port + pas16_offset[RESET_PARITY_INTERRUPT_REG]);
/* Set the SCSI interrupt pointer without mucking up the sound
* interrupt pointer in the same byte.
@@ -263,13 +263,13 @@ static int __init
* put in an additional test to try to weed them out.
*/
- outb( 0x01, io_port + WAIT_STATE ); /* 1 Wait state */
- NCR5380_write( MODE_REG, 0x20 ); /* Is it really SCSI? */
- if( NCR5380_read( MODE_REG ) != 0x20 ) /* Write to a reg. */
- return 0; /* and try to read */
- NCR5380_write( MODE_REG, 0x00 ); /* it back. */
- if( NCR5380_read( MODE_REG ) != 0x00 )
- return 0;
+ outb(0x01, io_port + WAIT_STATE); /* 1 Wait state */
+ outb(0x20, io_port + pas16_offset[MODE_REG]); /* Is it really SCSI? */
+ if (inb(io_port + pas16_offset[MODE_REG]) != 0x20) /* Write to a reg. */
+ return 0; /* and try to read */
+ outb(0x00, io_port + pas16_offset[MODE_REG]); /* it back. */
+ if (inb(io_port + pas16_offset[MODE_REG]) != 0x00)
+ return 0;
return 1;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-22 04:00 +0100 |
| Subject | [PATCH v3 10/77] atari_NCR5380: Remove RESET_BOOT, CONFIG_ATARI_SCSI_TOSHIBA_DELAY and CONFIG_ATARI_SCSI_RESET_BOOT |
| Message-ID | <qIll8-6s9-29@gated-at.bofh.it> |
| In reply to | #1296499 |
The atari_NCR5380.c core driver now takes care of bus reset upon driver
initialization if required (same as NCR5380.c). Move the Toshiba CD-ROM
support into the core driver, enabled with a host flag, so that all
NCR5380 drivers can make use of it.
Drop the RESET_BOOT macros and the ATARI_SCSI_RESET_BOOT and
ATARI_SCSI_TOSHIBA_DELAY Kconfig symbols, which are now redundant.
Remove the atari_scsi_reset_boot(), mac_scsi_reset_boot() and
sun3_scsi_reset_boot() routines. None of this duplicated code is needed
now that all drivers can use NCR5380_maybe_reset_bus().
This brings atari_scsi, mac_scsi and sun3_scsi into line with all of the
other NCR5380 drivers.
The bus reset may raise an interrupt. That would be new behaviour for
atari_scsi only when CONFIG_ATARI_SCSI_RESET_BOOT=n. The ST DMA interrupt
is not assigned to atari_scsi at this stage, so
CONFIG_ATARI_SCSI_RESET_BOOT=y may well be problematic already.
Regardless, do_reset() now raises and clears the interrupt within
local_irq_save/restore which should avoid problems.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
Changed since v1:
- Fixed minor inconsistency in mac5380= usage message.
---
drivers/scsi/Kconfig | 17 -----------
drivers/scsi/NCR5380.c | 17 +++++++++--
drivers/scsi/NCR5380.h | 1
drivers/scsi/atari_NCR5380.c | 22 +++++++++-----
drivers/scsi/atari_scsi.c | 60 +++++----------------------------------
drivers/scsi/mac_scsi.c | 65 ++++++-------------------------------------
drivers/scsi/sun3_scsi.c | 47 -------------------------------
7 files changed, 51 insertions(+), 178 deletions(-)
Index: linux/drivers/scsi/Kconfig
===================================================================
--- linux.orig/drivers/scsi/Kconfig 2015-12-22 12:14:49.000000000 +1100
+++ linux/drivers/scsi/Kconfig 2015-12-22 12:15:41.000000000 +1100
@@ -1618,23 +1618,6 @@ config ATARI_SCSI
ST-DMA, replacing ACSI). It does NOT support other schemes, like
in the Hades (without DMA).
-config ATARI_SCSI_TOSHIBA_DELAY
- bool "Long delays for Toshiba CD-ROMs"
- depends on ATARI_SCSI
- help
- This option increases the delay after a SCSI arbitration to
- accommodate some flaky Toshiba CD-ROM drives. Say Y if you intend to
- use a Toshiba CD-ROM drive; otherwise, the option is not needed and
- would impact performance a bit, so say N.
-
-config ATARI_SCSI_RESET_BOOT
- bool "Reset SCSI-devices at boottime"
- depends on ATARI_SCSI
- help
- Reset the devices on your Atari whenever it boots. This makes the
- boot process fractionally longer but may assist recovery from errors
- that leave the devices with SCSI operations partway completed.
-
config MAC_SCSI
tristate "Macintosh NCR5380 SCSI"
depends on MAC && SCSI=y
Index: linux/drivers/scsi/atari_NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/atari_NCR5380.c 2015-12-22 12:15:39.000000000 +1100
+++ linux/drivers/scsi/atari_NCR5380.c 2015-12-22 12:15:41.000000000 +1100
@@ -674,13 +674,14 @@ static void prepare_info(struct Scsi_Hos
"base 0x%lx, irq %d, "
"can_queue %d, cmd_per_lun %d, "
"sg_tablesize %d, this_id %d, "
- "flags { %s}, "
+ "flags { %s%s}, "
"options { %s} ",
instance->hostt->name, instance->io_port, instance->n_io_port,
instance->base, instance->irq,
instance->can_queue, instance->cmd_per_lun,
instance->sg_tablesize, instance->this_id,
hostdata->flags & FLAG_TAGGED_QUEUING ? "TAGGED_QUEUING " : "",
+ hostdata->flags & FLAG_TOSHIBA_DELAY ? "TOSHIBA_DELAY " : "",
#ifdef DIFFERENTIAL
"DIFFERENTIAL "
#endif
@@ -860,6 +861,7 @@ static int __init NCR5380_init(struct Sc
static int NCR5380_maybe_reset_bus(struct Scsi_Host *instance)
{
+ struct NCR5380_hostdata *hostdata = shost_priv(instance);
int pass;
for (pass = 1; (NCR5380_read(STATUS_REG) & SR_BSY) && pass <= 6; ++pass) {
@@ -878,6 +880,14 @@ static int NCR5380_maybe_reset_bus(struc
case 4:
shost_printk(KERN_ERR, instance, "bus busy, attempting reset\n");
do_reset(instance);
+ /* Wait after a reset; the SCSI standard calls for
+ * 250ms, we wait 500ms to be on the safe side.
+ * But some Toshiba CD-ROMs need ten times that.
+ */
+ if (hostdata->flags & FLAG_TOSHIBA_DELAY)
+ msleep(2500);
+ else
+ msleep(500);
break;
case 6:
shost_printk(KERN_ERR, instance, "bus locked solid\n");
@@ -1493,12 +1503,10 @@ static int NCR5380_select(struct Scsi_Ho
* a minimum so we'll udelay ceil(1.2)
*/
-#ifdef CONFIG_ATARI_SCSI_TOSHIBA_DELAY
- /* ++roman: But some targets (see above :-) seem to need a bit more... */
- udelay(15);
-#else
- udelay(2);
-#endif
+ if (hostdata->flags & FLAG_TOSHIBA_DELAY)
+ udelay(15);
+ else
+ udelay(2);
if (hostdata->connected) {
NCR5380_write(MODE_REG, MR_BASE);
Index: linux/drivers/scsi/atari_scsi.c
===================================================================
--- linux.orig/drivers/scsi/atari_scsi.c 2015-12-22 12:15:21.000000000 +1100
+++ linux/drivers/scsi/atari_scsi.c 2015-12-22 12:15:41.000000000 +1100
@@ -164,15 +164,6 @@ static inline unsigned long SCSI_DMA_GET
#define HOSTDATA_DMALEN (((struct NCR5380_hostdata *) \
(atari_scsi_host->hostdata))->dma_len)
-/* Time (in jiffies) to wait after a reset; the SCSI standard calls for 250ms,
- * we usually do 0.5s to be on the safe side. But Toshiba CD-ROMs once more
- * need ten times the standard value... */
-#ifndef CONFIG_ATARI_SCSI_TOSHIBA_DELAY
-#define AFTER_RESET_DELAY (HZ/2)
-#else
-#define AFTER_RESET_DELAY (5*HZ/2)
-#endif
-
#ifdef REAL_DMA
static void atari_scsi_fetch_restbytes(void);
#endif
@@ -208,12 +199,12 @@ static int setup_cmd_per_lun = -1;
module_param(setup_cmd_per_lun, int, 0);
static int setup_sg_tablesize = -1;
module_param(setup_sg_tablesize, int, 0);
-#ifdef SUPPORT_TAGS
static int setup_use_tagged_queuing = -1;
module_param(setup_use_tagged_queuing, int, 0);
-#endif
static int setup_hostid = -1;
module_param(setup_hostid, int, 0);
+static int setup_toshiba_delay = -1;
+module_param(setup_toshiba_delay, int, 0);
#if defined(REAL_DMA)
@@ -488,7 +479,7 @@ static int __init atari_scsi_setup(char
* Defaults depend on TT or Falcon, determined at run time.
* Negative values mean don't change.
*/
- int ints[6];
+ int ints[8];
get_options(str, ARRAY_SIZE(ints), ints);
@@ -504,10 +495,11 @@ static int __init atari_scsi_setup(char
setup_sg_tablesize = ints[3];
if (ints[0] >= 4)
setup_hostid = ints[4];
-#ifdef SUPPORT_TAGS
if (ints[0] >= 5)
setup_use_tagged_queuing = ints[5];
-#endif
+ /* ints[6] (use_pdma) is ignored */
+ if (ints[0] >= 7)
+ setup_toshiba_delay = ints[7];
return 1;
}
@@ -516,38 +508,6 @@ __setup("atascsi=", atari_scsi_setup);
#endif /* !MODULE */
-#ifdef CONFIG_ATARI_SCSI_RESET_BOOT
-static void __init atari_scsi_reset_boot(void)
-{
- unsigned long end;
-
- /*
- * Do a SCSI reset to clean up the bus during initialization. No messing
- * with the queues, interrupts, or locks necessary here.
- */
-
- printk("Atari SCSI: resetting the SCSI bus...");
-
- /* get in phase */
- NCR5380_write(TARGET_COMMAND_REG,
- PHASE_SR_TO_TCR(NCR5380_read(STATUS_REG)));
-
- /* assert RST */
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST);
- /* The min. reset hold time is 25us, so 40us should be enough */
- udelay(50);
- /* reset RST and interrupt */
- NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
- NCR5380_read(RESET_PARITY_INTERRUPT_REG);
-
- end = jiffies + AFTER_RESET_DELAY;
- while (time_before(jiffies, end))
- barrier();
-
- printk(" done\n");
-}
-#endif
-
#if defined(REAL_DMA)
static unsigned long atari_scsi_dma_setup(struct Scsi_Host *instance,
@@ -917,17 +877,13 @@ static int __init atari_scsi_probe(struc
}
atari_scsi_host = instance;
-#ifdef CONFIG_ATARI_SCSI_RESET_BOOT
- atari_scsi_reset_boot();
-#endif
-
instance->irq = irq->start;
host_flags |= IS_A_TT() ? 0 : FLAG_LATE_DMA_SETUP;
-
#ifdef SUPPORT_TAGS
host_flags |= setup_use_tagged_queuing > 0 ? FLAG_TAGGED_QUEUING : 0;
#endif
+ host_flags |= setup_toshiba_delay > 0 ? FLAG_TOSHIBA_DELAY : 0;
NCR5380_init(instance, host_flags);
@@ -975,6 +931,8 @@ static int __init atari_scsi_probe(struc
#endif
}
+ NCR5380_maybe_reset_bus(instance);
+
error = scsi_add_host(instance, NULL);
if (error)
goto fail_host;
Index: linux/drivers/scsi/mac_scsi.c
===================================================================
--- linux.orig/drivers/scsi/mac_scsi.c 2015-12-22 12:15:30.000000000 +1100
+++ linux/drivers/scsi/mac_scsi.c 2015-12-22 12:15:41.000000000 +1100
@@ -49,8 +49,6 @@
#include "NCR5380.h"
-#define RESET_BOOT
-
static int setup_can_queue = -1;
module_param(setup_can_queue, int, 0);
static int setup_cmd_per_lun = -1;
@@ -63,17 +61,8 @@ static int setup_use_tagged_queuing = -1
module_param(setup_use_tagged_queuing, int, 0);
static int setup_hostid = -1;
module_param(setup_hostid, int, 0);
-
-/* Time (in jiffies) to wait after a reset; the SCSI standard calls for 250ms,
- * we usually do 0.5s to be on the safe side. But Toshiba CD-ROMs once more
- * need ten times the standard value... */
-#define TOSHIBA_DELAY
-
-#ifdef TOSHIBA_DELAY
-#define AFTER_RESET_DELAY (5*HZ/2)
-#else
-#define AFTER_RESET_DELAY (HZ/2)
-#endif
+static int setup_toshiba_delay = -1;
+module_param(setup_toshiba_delay, int, 0);
/*
* NCR 5380 register access functions
@@ -92,12 +81,12 @@ static inline void macscsi_write(struct
#ifndef MODULE
static int __init mac_scsi_setup(char *str)
{
- int ints[7];
+ int ints[8];
(void)get_options(str, ARRAY_SIZE(ints), ints);
- if (ints[0] < 1 || ints[0] > 6) {
- pr_err("Usage: mac5380=<can_queue>[,<cmd_per_lun>[,<sg_tablesize>[,<hostid>[,<use_tags>[,<use_pdma>]]]]]\n");
+ if (ints[0] < 1) {
+ pr_err("Usage: mac5380=<can_queue>[,<cmd_per_lun>[,<sg_tablesize>[,<hostid>[,<use_tags>[,<use_pdma>[,<toshiba_delay>]]]]]]\n");
return 0;
}
if (ints[0] >= 1)
@@ -112,47 +101,14 @@ static int __init mac_scsi_setup(char *s
setup_use_tagged_queuing = ints[5];
if (ints[0] >= 6)
setup_use_pdma = ints[6];
+ if (ints[0] >= 7)
+ setup_toshiba_delay = ints[7];
return 1;
}
__setup("mac5380=", mac_scsi_setup);
#endif /* !MODULE */
-#ifdef RESET_BOOT
-/*
- * Our 'bus reset on boot' function
- */
-
-static void mac_scsi_reset_boot(struct Scsi_Host *instance)
-{
- unsigned long end;
-
- /*
- * Do a SCSI reset to clean up the bus during initialization. No messing
- * with the queues, interrupts, or locks necessary here.
- */
-
- printk(KERN_INFO "Macintosh SCSI: resetting the SCSI bus..." );
-
- /* get in phase */
- NCR5380_write( TARGET_COMMAND_REG,
- PHASE_SR_TO_TCR( NCR5380_read(STATUS_REG) ));
-
- /* assert RST */
- NCR5380_write( INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST );
- /* The min. reset hold time is 25us, so 40us should be enough */
- udelay( 50 );
- /* reset RST and interrupt */
- NCR5380_write( INITIATOR_COMMAND_REG, ICR_BASE );
- NCR5380_read( RESET_PARITY_INTERRUPT_REG );
-
- for( end = jiffies + AFTER_RESET_DELAY; time_before(jiffies, end); )
- barrier();
-
- printk(KERN_INFO " done\n" );
-}
-#endif
-
#ifdef PSEUDO_DMA
/*
Pseudo-DMA: (Ove Edlund)
@@ -421,13 +377,10 @@ static int __init mac_scsi_probe(struct
} else
host_flags |= FLAG_NO_PSEUDO_DMA;
-#ifdef RESET_BOOT
- mac_scsi_reset_boot(instance);
-#endif
-
#ifdef SUPPORT_TAGS
host_flags |= setup_use_tagged_queuing > 0 ? FLAG_TAGGED_QUEUING : 0;
#endif
+ host_flags |= setup_toshiba_delay > 0 ? FLAG_TOSHIBA_DELAY : 0;
NCR5380_init(instance, host_flags);
@@ -438,6 +391,8 @@ static int __init mac_scsi_probe(struct
goto fail_irq;
}
+ NCR5380_maybe_reset_bus(instance);
+
error = scsi_add_host(instance, NULL);
if (error)
goto fail_host;
Index: linux/drivers/scsi/sun3_scsi.c
===================================================================
--- linux.orig/drivers/scsi/sun3_scsi.c 2015-12-22 12:15:24.000000000 +1100
+++ linux/drivers/scsi/sun3_scsi.c 2015-12-22 12:15:41.000000000 +1100
@@ -86,10 +86,6 @@ module_param(setup_use_tagged_queuing, i
static int setup_hostid = -1;
module_param(setup_hostid, int, 0);
-/* #define RESET_BOOT */
-
-#define AFTER_RESET_DELAY (HZ/2)
-
/* ms to wait after hitting dma regs */
#define SUN3_DMA_DELAY 10
@@ -144,45 +140,6 @@ static inline void sun3_udc_write(unsign
}
#endif
-#ifdef RESET_BOOT
-static void sun3_scsi_reset_boot(struct Scsi_Host *instance)
-{
- unsigned long end;
-
- /*
- * Do a SCSI reset to clean up the bus during initialization. No
- * messing with the queues, interrupts, or locks necessary here.
- */
-
- printk( "Sun3 SCSI: resetting the SCSI bus..." );
-
- /* switch off SCSI IRQ - catch an interrupt without IRQ bit set else */
-// sun3_disable_irq( IRQ_SUN3_SCSI );
-
- /* get in phase */
- NCR5380_write( TARGET_COMMAND_REG,
- PHASE_SR_TO_TCR( NCR5380_read(STATUS_REG) ));
-
- /* assert RST */
- NCR5380_write( INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST );
-
- /* The min. reset hold time is 25us, so 40us should be enough */
- udelay( 50 );
-
- /* reset RST and interrupt */
- NCR5380_write( INITIATOR_COMMAND_REG, ICR_BASE );
- NCR5380_read( RESET_PARITY_INTERRUPT_REG );
-
- for( end = jiffies + AFTER_RESET_DELAY; time_before(jiffies, end); )
- barrier();
-
- /* switch on SCSI IRQ again */
-// sun3_enable_irq( IRQ_SUN3_SCSI );
-
- printk( " done\n" );
-}
-#endif
-
// safe bits for the CSR
#define CSR_GOOD 0x060f
@@ -631,9 +588,7 @@ static int __init sun3_scsi_probe(struct
dregs->ivect = VME_DATA24 | (instance->irq & 0xff);
#endif
-#ifdef RESET_BOOT
- sun3_scsi_reset_boot(instance);
-#endif
+ NCR5380_maybe_reset_bus(instance);
error = scsi_add_host(instance, NULL);
if (error)
Index: linux/drivers/scsi/NCR5380.h
===================================================================
--- linux.orig/drivers/scsi/NCR5380.h 2015-12-22 12:15:35.000000000 +1100
+++ linux/drivers/scsi/NCR5380.h 2015-12-22 12:15:41.000000000 +1100
@@ -243,6 +243,7 @@
#define FLAG_DTC3181E 16 /* DTC3181E */
#define FLAG_LATE_DMA_SETUP 32 /* Setup NCR before DMA H/W */
#define FLAG_TAGGED_QUEUING 64 /* as X3T9.2 spelled it */
+#define FLAG_TOSHIBA_DELAY 128 /* Allow for borken CD-ROMs */
#ifdef SUPPORT_TAGS
struct tag_alloc {
Index: linux/drivers/scsi/NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/NCR5380.c 2015-12-22 12:15:39.000000000 +1100
+++ linux/drivers/scsi/NCR5380.c 2015-12-22 12:15:41.000000000 +1100
@@ -618,7 +618,7 @@ static void prepare_info(struct Scsi_Hos
"base 0x%lx, irq %d, "
"can_queue %d, cmd_per_lun %d, "
"sg_tablesize %d, this_id %d, "
- "flags { %s%s%s}, "
+ "flags { %s%s%s%s}, "
#if defined(USLEEP_POLL) && defined(USLEEP_WAITLONG)
"USLEEP_POLL %lu, USLEEP_WAITLONG %lu, "
#endif
@@ -630,6 +630,7 @@ static void prepare_info(struct Scsi_Hos
hostdata->flags & FLAG_NCR53C400 ? "NCR53C400 " : "",
hostdata->flags & FLAG_DTC3181E ? "DTC3181E " : "",
hostdata->flags & FLAG_NO_PSEUDO_DMA ? "NO_PSEUDO_DMA " : "",
+ hostdata->flags & FLAG_TOSHIBA_DELAY ? "TOSHIBA_DELAY " : "",
#if defined(USLEEP_POLL) && defined(USLEEP_WAITLONG)
USLEEP_POLL, USLEEP_WAITLONG,
#endif
@@ -831,6 +832,7 @@ static int NCR5380_init(struct Scsi_Host
static int NCR5380_maybe_reset_bus(struct Scsi_Host *instance)
{
+ struct NCR5380_hostdata *hostdata = shost_priv(instance);
int pass;
for (pass = 1; (NCR5380_read(STATUS_REG) & SR_BSY) && pass <= 6; ++pass) {
@@ -849,6 +851,14 @@ static int NCR5380_maybe_reset_bus(struc
case 4:
shost_printk(KERN_ERR, instance, "bus busy, attempting reset\n");
do_reset(instance);
+ /* Wait after a reset; the SCSI standard calls for
+ * 250ms, we wait 500ms to be on the safe side.
+ * But some Toshiba CD-ROMs need ten times that.
+ */
+ if (hostdata->flags & FLAG_TOSHIBA_DELAY)
+ msleep(2500);
+ else
+ msleep(500);
break;
case 6:
shost_printk(KERN_ERR, instance, "bus locked solid\n");
@@ -1253,7 +1263,10 @@ static int NCR5380_select(struct Scsi_Ho
* a minimum so we'll udelay ceil(1.2)
*/
- udelay(2);
+ if (hostdata->flags & FLAG_TOSHIBA_DELAY)
+ udelay(15);
+ else
+ udelay(2);
dprintk(NDEBUG_ARBITRATION, "scsi%d : won arbitration\n", instance->host_no);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-22 04:00 +0100 |
| Subject | [PATCH v3 07/77] ncr5380: Split NCR5380_init() into two functions |
| Message-ID | <qIll8-6s9-31@gated-at.bofh.it> |
| In reply to | #1296499 |
This patch splits the NCR5380_init() function into two parts, similar
to the scheme used with atari_NCR5380.c. This avoids two problems.
Firstly, NCR5380_init() may perform a bus reset, which would cause the
chip to assert IRQ. The chip is unable to mask its bus reset interrupt.
Drivers can't call request_irq() before calling NCR5380_init(), because
initialization must happen before the interrupt handler executes. If
driver initialization causes an interrupt it may be problematic on some
platforms. To avoid that, first move the bus reset code into
NCR5380_maybe_reset_bus().
Secondly, NCR5380_init() contains some board-specific interrupt setup code
for the NCR53C400 that does not belong in the core driver. In moving this
code, better not re-order interrupt initialization and bus reset. Again,
the solution is to move the bus reset code into NCR5380_maybe_reset_bus().
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
---
drivers/scsi/NCR5380.c | 34 ++++++++++++++++++++--------------
drivers/scsi/NCR5380.h | 1 +
drivers/scsi/arm/cumana_1.c | 2 ++
drivers/scsi/arm/oak.c | 2 ++
drivers/scsi/dmx3191d.c | 2 ++
drivers/scsi/dtc.c | 2 ++
drivers/scsi/g_NCR5380.c | 2 ++
drivers/scsi/pas16.c | 2 ++
drivers/scsi/t128.c | 2 ++
9 files changed, 35 insertions(+), 14 deletions(-)
Index: linux/drivers/scsi/NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/NCR5380.c 2015-12-22 12:15:34.000000000 +1100
+++ linux/drivers/scsi/NCR5380.c 2015-12-22 12:15:35.000000000 +1100
@@ -777,8 +777,7 @@ static void lprint_opcode(int opcode, st
static int NCR5380_init(struct Scsi_Host *instance, int flags)
{
- int i, pass;
- unsigned long timeout;
+ int i;
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
if(in_interrupt())
@@ -831,18 +830,26 @@ static int NCR5380_init(struct Scsi_Host
NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE);
}
#endif
+ return 0;
+}
- /*
- * Detect and correct bus wedge problems.
- *
- * If the system crashed, it may have crashed in a state
- * where a SCSI command was still executing, and the
- * SCSI bus is not in a BUS FREE STATE.
- *
- * If this is the case, we'll try to abort the currently
- * established nexus which we know nothing about, and that
- * failing, do a hard reset of the SCSI bus
- */
+/**
+ * NCR5380_maybe_reset_bus - Detect and correct bus wedge problems.
+ * @instance: adapter to check
+ *
+ * If the system crashed, it may have crashed with a connected target and
+ * the SCSI bus busy. Check for BUS FREE phase. If not, try to abort the
+ * currently established nexus, which we know nothing about. Failing that
+ * do a bus reset.
+ *
+ * Note that a bus reset will cause the chip to assert IRQ.
+ *
+ * Returns 0 if successful, otherwise -ENXIO.
+ */
+
+static int NCR5380_maybe_reset_bus(struct Scsi_Host *instance)
+{
+ int pass;
for (pass = 1; (NCR5380_read(STATUS_REG) & SR_BSY) && pass <= 6; ++pass) {
switch (pass) {
@@ -850,7 +857,6 @@ static int NCR5380_init(struct Scsi_Host
case 3:
case 5:
printk(KERN_INFO "scsi%d: SCSI bus busy, waiting up to five seconds\n", instance->host_no);
- timeout = jiffies + 5 * HZ;
NCR5380_poll_politely(instance, STATUS_REG, SR_BSY, 0, 5*HZ);
break;
case 2:
Index: linux/drivers/scsi/NCR5380.h
===================================================================
--- linux.orig/drivers/scsi/NCR5380.h 2015-12-22 12:15:28.000000000 +1100
+++ linux/drivers/scsi/NCR5380.h 2015-12-22 12:15:35.000000000 +1100
@@ -318,6 +318,7 @@ static void NCR5380_print(struct Scsi_Ho
static int NCR5380_probe_irq(struct Scsi_Host *instance, int possible);
#endif
static int NCR5380_init(struct Scsi_Host *instance, int flags);
+static int NCR5380_maybe_reset_bus(struct Scsi_Host *);
static void NCR5380_exit(struct Scsi_Host *instance);
static void NCR5380_information_transfer(struct Scsi_Host *instance);
#ifndef DONT_USE_INTR
Index: linux/drivers/scsi/arm/cumana_1.c
===================================================================
--- linux.orig/drivers/scsi/arm/cumana_1.c 2015-12-22 12:15:30.000000000 +1100
+++ linux/drivers/scsi/arm/cumana_1.c 2015-12-22 12:15:35.000000000 +1100
@@ -240,6 +240,8 @@ static int cumanascsi1_probe(struct expa
NCR5380_init(host, 0);
+ NCR5380_maybe_reset_bus(host);
+
priv(host)->ctrl = 0;
writeb(0, priv(host)->base + CTRL);
Index: linux/drivers/scsi/arm/oak.c
===================================================================
--- linux.orig/drivers/scsi/arm/oak.c 2015-12-22 12:15:30.000000000 +1100
+++ linux/drivers/scsi/arm/oak.c 2015-12-22 12:15:35.000000000 +1100
@@ -145,6 +145,8 @@ static int oakscsi_probe(struct expansio
NCR5380_init(host, 0);
+ NCR5380_maybe_reset_bus(host);
+
ret = scsi_add_host(host, &ec->dev);
if (ret)
goto out_unmap;
Index: linux/drivers/scsi/dmx3191d.c
===================================================================
--- linux.orig/drivers/scsi/dmx3191d.c 2015-12-22 12:15:30.000000000 +1100
+++ linux/drivers/scsi/dmx3191d.c 2015-12-22 12:15:35.000000000 +1100
@@ -97,6 +97,8 @@ static int dmx3191d_probe_one(struct pci
NCR5380_init(shost, FLAG_NO_PSEUDO_DMA | FLAG_DTC3181E);
+ NCR5380_maybe_reset_bus(shost);
+
pci_set_drvdata(pdev, shost);
error = scsi_add_host(shost, &pdev->dev);
Index: linux/drivers/scsi/dtc.c
===================================================================
--- linux.orig/drivers/scsi/dtc.c 2015-12-22 12:15:30.000000000 +1100
+++ linux/drivers/scsi/dtc.c 2015-12-22 12:15:35.000000000 +1100
@@ -237,6 +237,8 @@ found:
NCR5380_init(instance, 0);
+ NCR5380_maybe_reset_bus(instance);
+
NCR5380_write(DTC_CONTROL_REG, CSR_5380_INTR); /* Enable int's */
if (overrides[current_override].irq != IRQ_AUTO)
instance->irq = overrides[current_override].irq;
Index: linux/drivers/scsi/g_NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/g_NCR5380.c 2015-12-22 12:15:34.000000000 +1100
+++ linux/drivers/scsi/g_NCR5380.c 2015-12-22 12:15:35.000000000 +1100
@@ -422,6 +422,8 @@ static int __init generic_NCR5380_detect
NCR5380_init(instance, flags);
+ NCR5380_maybe_reset_bus(instance);
+
if (overrides[current_override].irq != IRQ_AUTO)
instance->irq = overrides[current_override].irq;
else
Index: linux/drivers/scsi/pas16.c
===================================================================
--- linux.orig/drivers/scsi/pas16.c 2015-12-22 12:15:30.000000000 +1100
+++ linux/drivers/scsi/pas16.c 2015-12-22 12:15:35.000000000 +1100
@@ -384,6 +384,8 @@ static int __init pas16_detect(struct sc
NCR5380_init(instance, 0);
+ NCR5380_maybe_reset_bus(instance);
+
if (overrides[current_override].irq != IRQ_AUTO)
instance->irq = overrides[current_override].irq;
else
Index: linux/drivers/scsi/t128.c
===================================================================
--- linux.orig/drivers/scsi/t128.c 2015-12-22 12:15:30.000000000 +1100
+++ linux/drivers/scsi/t128.c 2015-12-22 12:15:35.000000000 +1100
@@ -215,6 +215,8 @@ found:
NCR5380_init(instance, 0);
+ NCR5380_maybe_reset_bus(instance);
+
if (overrides[current_override].irq != IRQ_AUTO)
instance->irq = overrides[current_override].irq;
else
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2015-12-22 15:50 +0100 |
| Subject | Re: [PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp |
| Message-ID | <qIwqe-5cg-13@gated-at.bofh.it> |
| In reply to | #1296499 |
On Tue, 2015-12-22 at 12:18 +1100, Finn Thain wrote: > This patch is just the result of two substitutions. The first removes any > tabs and spaces at the end of the line. The second replaces runs of > tabs and spaces at the beginning of comment lines with a single space. I think the second of these isn't done well. Many of these comments post reformatting are much worse to read because of lost alignment. For instance: > +/* > * Function : int NCR5380_select(struct Scsi_Host *instance, > - * struct scsi_cmnd *cmd) > + * struct scsi_cmnd *cmd) > * > * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command, > - * including ARBITRATION, SELECTION, and initial message out for > - * IDENTIFY and queue messages. > + * including ARBITRATION, SELECTION, and initial message out for > + * IDENTIFY and queue messages. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-23 02:00 +0100 |
| Subject | Re: [PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp |
| Message-ID | <qIFWy-2J8-15@gated-at.bofh.it> |
| In reply to | #1296818 |
[Multipart message — attachments visible in raw view] — view raw
On Tue, 22 Dec 2015, Joe Perches wrote: > On Tue, 2015-12-22 at 12:18 +1100, Finn Thain wrote: > > This patch is just the result of two substitutions. The first removes > > any tabs and spaces at the end of the line. The second replaces runs > > of tabs and spaces at the beginning of comment lines with a single > > space. > > I think the second of these isn't done well. The aim of this patch is not to fix code style, but to make it possible to compare these two files so that the fork can be repaired. Regexp is very helpful in creating uniformity (and a minimal diff). If this was a coding style issue, we would be discussing the use of kernel-doc format for the affected comments, not whitespace. > Many of these comments post reformatting are > much worse to read because of lost alignment. You exaggerate a very trivial point. I admit that a small proportion of comments are slightly less readable. But it is the diff that needs to be readable in order to resolve the fork. As I said in patch 0, I am aware that this patch series can be faulted on trivial grounds but in order to avoid churn I don't wish to address those issues until the fork has been resolved. Thanks for your review. > > For instance: > > > +/* > > * Function : int NCR5380_select(struct Scsi_Host *instance, > > - * struct scsi_cmnd *cmd) > > + * struct scsi_cmnd *cmd) > > * > > * Purpose : establishes I_T_L or I_T_L_Q nexus for new or existing command, > > - * including ARBITRATION, SELECTION, and initial message out for > > - * IDENTIFY and queue messages. > > + * including ARBITRATION, SELECTION, and initial message out for > > + * IDENTIFY and queue messages. > --
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2015-12-23 02:20 +0100 |
| Subject | Re: [PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp |
| Message-ID | <qIGfT-35d-9@gated-at.bofh.it> |
| In reply to | #1297196 |
On Wed, 2015-12-23 at 11:56 +1100, Finn Thain wrote: > On Tue, 22 Dec 2015, Joe Perches wrote: > > > On Tue, 2015-12-22 at 12:18 +1100, Finn Thain wrote: > > > This patch is just the result of two substitutions. The first removes > > > any tabs and spaces at the end of the line. The second replaces runs > > > of tabs and spaces at the beginning of comment lines with a single > > > space. > > > > I think the second of these isn't done well. > > The aim of this patch is not to fix code style, but to make it possible to > compare these two files so that the fork can be repaired. Regexp is very > helpful in creating uniformity (and a minimal diff). > > If this was a coding style issue, we would be discussing the use of > kernel-doc format for the affected comments, not whitespace. > > > Many of these comments post reformatting are > > much worse to read because of lost alignment. > > You exaggerate a very trivial point. <shrug> I prefer that all patches be improvements. > I admit that a small proportion of comments are slightly less readable. > But it is the diff that needs to be readable in order to resolve the fork. diff -w works well. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-23 03:10 +0100 |
| Subject | Re: [PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp |
| Message-ID | <qIH2h-3Ai-9@gated-at.bofh.it> |
| In reply to | #1297203 |
[Multipart message — attachments visible in raw view] — view raw
On Tue, 22 Dec 2015, Joe Perches wrote: > On Wed, 2015-12-23 at 11:56 +1100, Finn Thain wrote: > > On Tue, 22 Dec 2015, Joe Perches wrote: > > > > > On Tue, 2015-12-22 at 12:18 +1100, Finn Thain wrote: > > > > This patch is just the result of two substitutions. The first > > > > removes any tabs and spaces at the end of the line. The second > > > > replaces runs of tabs and spaces at the beginning of comment lines > > > > with a single space. > > > > > > I think the second of these isn't done well. > > > > The aim of this patch is not to fix code style, but to make it > > possible to compare these two files so that the fork can be repaired. > > Regexp is very helpful in creating uniformity (and a minimal diff). > > > > If this was a coding style issue, we would be discussing the use of > > kernel-doc format for the affected comments, not whitespace. > > > > > Many of these comments post reformatting are much worse to read > > > because of lost alignment. > > > > You exaggerate a very trivial point. > > <shrug> > > I prefer that all patches be improvements. > Agreed. But the example you cited is an improvement, in that it creates consistency. Like you, I prefer to see formal parameters aligned when wrapped. But this isn't a formal parameter list, it is a comment, and no comment should duplicate code. Can you suggest a better regexp? Since this is patch 68 in the series, there is a good chance that it will need to be regenerated. > > I admit that a small proportion of comments are slightly less > > readable. But it is the diff that needs to be readable in order to > > resolve the fork. > > diff -w works well. > Yes, it works well at times. For this I prefer to use meld. It does have text filters that allow the user to elide differences that match a given regexp. But I don't want every meld user to have to write those regexps. --
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2015-12-23 03:20 +0100 |
| Subject | Re: [PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp |
| Message-ID | <qIHbY-3DG-7@gated-at.bofh.it> |
| In reply to | #1297209 |
On Wed, 2015-12-23 at 13:03 +1100, Finn Thain wrote: > On Tue, 22 Dec 2015, Joe Perches wrote: > > > On Wed, 2015-12-23 at 11:56 +1100, Finn Thain wrote: > > > On Tue, 22 Dec 2015, Joe Perches wrote: > > > > > > > On Tue, 2015-12-22 at 12:18 +1100, Finn Thain wrote: > > > > > This patch is just the result of two substitutions. The first > > > > > removes any tabs and spaces at the end of the line. The second > > > > > replaces runs of tabs and spaces at the beginning of comment lines > > > > > with a single space. > > > > > > > > I think the second of these isn't done well. > > > > > > The aim of this patch is not to fix code style, but to make it > > > possible to compare these two files so that the fork can be repaired. > > > Regexp is very helpful in creating uniformity (and a minimal diff). > > > > > > If this was a coding style issue, we would be discussing the use of > > > kernel-doc format for the affected comments, not whitespace. > > > > > > > Many of these comments post reformatting are much worse to read > > > > because of lost alignment. > > > > > > You exaggerate a very trivial point. > > > > > > > > I prefer that all patches be improvements. > > > > Agreed. But the example you cited is an improvement, in that it creates > consistency. I think "consistency" isn't a useful argument. The kernel code doesn't care about any other external code bases. > Like you, I prefer to see formal parameters aligned when wrapped. But this > isn't a formal parameter list, it is a comment, and no comment should > duplicate code. > > Can you suggest a better regexp? Since this is patch 68 in the series, > there is a good chance that it will need to be regenerated. I suggest you do 2 patches here. One that removes unnecessary trailing spaces and converts multiple leading spaces to tabs where appropriate and a second patch that fixes whatever odd indentation that does exist after comment leading *. I think there aren't many instances of those and I think those should be done by hand rather than regex. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-23 05:20 +0100 |
| Subject | Re: [PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp |
| Message-ID | <qIJ45-4Qq-1@gated-at.bofh.it> |
| In reply to | #1297212 |
[Multipart message — attachments visible in raw view] — view raw
On Tue, 22 Dec 2015, Joe Perches wrote: > On Wed, 2015-12-23 at 13:03 +1100, Finn Thain wrote: > > On Tue, 22 Dec 2015, Joe Perches wrote: > > > > > On Wed, 2015-12-23 at 11:56 +1100, Finn Thain wrote: > > > > On Tue, 22 Dec 2015, Joe Perches wrote: > > > > > > > > > On Tue, 2015-12-22 at 12:18 +1100, Finn Thain wrote: > > > > > > This patch is just the result of two substitutions. The first > > > > > > removes any tabs and spaces at the end of the line. The second > > > > > > replaces runs of tabs and spaces at the beginning of comment lines > > > > > > with a single space. > > > > > > > > > > I think the second of these isn't done well. > > > > > > > > The aim of this patch is not to fix code style, but to make it > > > > possible to compare these two files so that the fork can be repaired. > > > > Regexp is very helpful in creating uniformity (and a minimal diff). > > > > > > > > If this was a coding style issue, we would be discussing the use of > > > > kernel-doc format for the affected comments, not whitespace. > > > > > > > > > Many of these comments post reformatting are much worse to read > > > > > because of lost alignment. > > > > > > > > You exaggerate a very trivial point. > > > > > > > > > > > > I prefer that all patches be improvements. > > > > > > > Agreed. But the example you cited is an improvement, in that it creates > > consistency. > > I think "consistency" isn't a useful argument. > The kernel code doesn't care about any other > external code bases. I prefer that the drivers I maintain be self-consistent. > > > Like you, I prefer to see formal parameters aligned when wrapped. But this > > isn't a formal parameter list, it is a comment, and no comment should > > duplicate code. > > > > Can you suggest a better regexp? Since this is patch 68 in the series, > > there is a good chance that it will need to be regenerated. > > I suggest you do 2 patches here. One that removes > unnecessary trailing spaces Those are resolved by this patch. > and converts multiple leading spaces to tabs where appropriate As I said, trivial cleanups are better done after the fork is resolved, to avoid churn. To assist with resolving the fork, this patch addresses inconsistencies. > and a > second patch that fixes whatever odd indentation > that does exist after comment leading *. Those are resolved by this patch. > I think > there aren't many instances of those and I think > those should be done by hand rather than regex. I don't know why a regexp wouldn't work and I don't know what you have in mind when you say "[fix] odd indentation". Is there some kind of style guide applicable here, which this patch violates? Upon re-reading this patch, I did find a table where I think the regexp is detrimental. @@ -2096,7 +2096,7 @@ static void NCR5380_information_transfer * Byte * 0 EXTENDED_MESSAGE == 1 * 1 length (includes one byte for code, doesn't - * include first two bytes) + * include first two bytes) * 2 code * 3..length+1 arguments * This table is interesting. Even though the author took the trouble to duplicate a portion of the SCSI spec in the source, they were still able to stuff it up. See patch 44/77 in this series, "ncr5380: Fix off-by-one bug in extended_msg[] bounds check". So how about I remove this table in patch 67, along with the other dud comments, and then regenerate this patch. That way, perhaps we can all agree that the regexp is not actually detrimental? --
[toc] | [prev] | [next] | [standalone]
| From | James Bottomley <James.Bottomley@HansenPartnership.com> |
|---|---|
| Date | 2015-12-23 02:30 +0100 |
| Subject | Re: [PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp |
| Message-ID | <qIGpz-38i-5@gated-at.bofh.it> |
| In reply to | #1297196 |
On Wed, 2015-12-23 at 11:56 +1100, Finn Thain wrote: > On Tue, 22 Dec 2015, Joe Perches wrote: > > > On Tue, 2015-12-22 at 12:18 +1100, Finn Thain wrote: > > > This patch is just the result of two substitutions. The first > removes > > > any tabs and spaces at the end of the line. The second replaces > runs > > > of tabs and spaces at the beginning of comment lines with a > single > > > space. > > > > I think the second of these isn't done well. > > The aim of this patch is not to fix code style, but to make it > possible to compare these two files so that the fork can be repaired. > Regexp is very helpful in creating uniformity (and a minimal diff). > > If this was a coding style issue, we would be discussing the use of > kernel-doc format for the affected comments, not whitespace. > > > Many of these comments post reformatting are > > much worse to read because of lost alignment. > > You exaggerate a very trivial point. > > I admit that a small proportion of comments are slightly less > readable. But it is the diff that needs to be readable in order to > resolve the fork. > > As I said in patch 0, I am aware that this patch series can be > faulted on trivial grounds but in order to avoid churn I don't wish > to address those issues until the fork has been resolved. I don't think it is trivial. I can't actually find a single instance in this patch where collapsing the space at the start of the comment looks justified; most of the time it eliminates intended formatting. Even if there's an odd one I've missed where space at the beginning of a comment is a problem, I think not doing that part of the regexp and just correcting the odd missed case by hand later will be much better. James -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Date | 2015-12-23 03:40 +0100 |
| Subject | Re: [PATCH v3 68/77] ncr5380: Fix whitespace issues using regexp |
| Message-ID | <qIHvj-3Kg-1@gated-at.bofh.it> |
| In reply to | #1297206 |
On Tue, 22 Dec 2015, James Bottomley wrote:
> I don't think it is trivial. I can't actually find a single instance in
> this patch where collapsing the space at the start of the comment looks
> justified; most of the time it eliminates intended formatting.
The present formatting is broken. It differs between the two core driver
forks. One uses spaces, the other tabs. For example, line 3.
$ grep -c "^ [*] *\t" drivers/scsi/{atari_,}NCR5380.c
drivers/scsi/atari_NCR5380.c:14
drivers/scsi/NCR5380.c:23
This patch resolves the issue by deliberately adopting an easy and
foolproof formatting convention.
But clearly there are different views as to what convention should be used
here. It would be great if you would indicate an acceptable convention so
we don't have to bikeshed the use of whitespace in comments.
To set an example, would you be kind enough to reformat, say, the comment
block at the top of the two files? Or some other comment where kernel-doc
is not appropriate, and the comment isn't merely duplicating actual code?
Thanks.
> Even if there's an odd one I've missed where space at the beginning of a
> comment is a problem, I think not doing that part of the regexp and just
> correcting the odd missed case by hand later will be much better.
>
> James
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ondrej Zary <linux@rainbow-software.org> |
|---|---|
| Date | 2015-12-22 21:20 +0100 |
| Message-ID | <qIBzA-7r-13@gated-at.bofh.it> |
| In reply to | #1296499 |
On Tuesday 22 December 2015 02:17:38 Finn Thain wrote: > > Like my previous work on the NCR5380 drivers, this patch series has bug > fixes, code cleanup and modernization. These drivers suffer from mistakes, > poor style and neglect and this long series addresses the worst of it, > covering all ten wrapper drivers and both of the core driver forks. The > combined size of the drivers is reduced by over 700 LoC. > > This series continues to reduce divergence between the two core driver > forks, often by copying a bug fix from one to the other. Most patches are > larger for having to keep the two forks in sync. Making the same change to > both is churn if one of them is to be removed but neither can be as yet. > By the end of this series the diff between the two forks is minimal, so it > becomes clear what caused the fork and what can be done about it. > > This patch series did benefit from scripts/checkpatch.pl but not too much. > Decades ago, these drivers started out with 4-space tabs and if the 80 > column limit were to be strictly enforced now, it would require adding new > functions and shortening identifiers. I would defer this sort of activity > until after the fork has been resolved. > > All patches to all NCR5380 drivers (x86, ARM, m68k) have been compile- > tested. The mac_scsi, dmx3191d, g_NCR5380 and atari_scsi modules were > regression tested on suitable hardware. Tested on HP C2502 (53C400A chip), Canon FG2-5202 (53C400 chip) and DTC-3181L (DTCT-436P chip) ISA cards - everything works fine! Thanks. Tested-by: Ondrej Zary <linux@rainbow-software.org> -- Ondrej Zary -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Michael Schmitz <schmitzmic@gmail.com> |
|---|---|
| Date | 2016-01-01 02:30 +0100 |
| Subject | Re: [PATCH v3 00/77] More fixes, cleanup and modernization for NCR5380 drivers |
| Message-ID | <qLWHw-3yo-1@gated-at.bofh.it> |
| In reply to | #1296499 |
Hi Finn,
I've tested this series thoroughly on my Atari Falcon - no regressions,
runs stable and is quite responsive. No SCSI lock-ups that had plagued
the old driver (before your rewrites).
Please add my
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Cheers,
Michael
Am 22.12.15 um 14:17 schrieb Finn Thain:
> Like my previous work on the NCR5380 drivers, this patch series has bug
> fixes, code cleanup and modernization. These drivers suffer from mistakes,
> poor style and neglect and this long series addresses the worst of it,
> covering all ten wrapper drivers and both of the core driver forks. The
> combined size of the drivers is reduced by over 700 LoC.
>
> This series continues to reduce divergence between the two core driver
> forks, often by copying a bug fix from one to the other. Most patches are
> larger for having to keep the two forks in sync. Making the same change to
> both is churn if one of them is to be removed but neither can be as yet.
> By the end of this series the diff between the two forks is minimal, so it
> becomes clear what caused the fork and what can be done about it.
>
> This patch series did benefit from scripts/checkpatch.pl but not too much.
> Decades ago, these drivers started out with 4-space tabs and if the 80
> column limit were to be strictly enforced now, it would require adding new
> functions and shortening identifiers. I would defer this sort of activity
> until after the fork has been resolved.
>
> All patches to all NCR5380 drivers (x86, ARM, m68k) have been compile-
> tested. The mac_scsi, dmx3191d, g_NCR5380 and atari_scsi modules were
> regression tested on suitable hardware.
>
> Changes since v1:
> - Patch 8 omits a pointless assignment.
> - Patch 10 gets a better error message.
> - Patch 20 drops the WQ_CPU_INTENSIVE flag.
> - Patch 21 adds timing calibration for the register polling loop.
> - Patch 49 is replaced by a new one that removes FLAG_DTC3181E.
> - Patch 72 by Ondrej Zary was added to fix pseudo DMA on 53C400.
>
> Changes since v2:
> - Patch 21 has better calibration with low HZ values.
> - Patch 57 no longer attempts to dereference a NULL pointer on Atari.
> - Patch 66 initializes max_sectors in the host templates.
> - Patches 73 thru 77 by Ondrej Zary were added with additional fixes for
> 53C400-compatible cards.
>
> ---
> drivers/scsi/Kconfig | 17
> drivers/scsi/NCR5380.c | 2868 +++++++++++++++++++------------------------
> drivers/scsi/NCR5380.h | 87 -
> drivers/scsi/arm/cumana_1.c | 31
> drivers/scsi/arm/oak.c | 27
> drivers/scsi/atari_NCR5380.c | 2292 +++++++++++++++-------------------
> drivers/scsi/atari_scsi.c | 102 -
> drivers/scsi/dmx3191d.c | 33
> drivers/scsi/dtc.c | 115 -
> drivers/scsi/dtc.h | 45
> drivers/scsi/g_NCR5380.c | 408 +++---
> drivers/scsi/g_NCR5380.h | 66
> drivers/scsi/mac_scsi.c | 117 -
> drivers/scsi/pas16.c | 116 -
> drivers/scsi/pas16.h | 40
> drivers/scsi/sun3_scsi.c | 141 --
> drivers/scsi/t128.c | 102 -
> drivers/scsi/t128.h | 39
> 18 files changed, 2957 insertions(+), 3689 deletions(-)
>
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web