diff options
author | Finn Thain <fthain@telegraphics.com.au> | 2016-01-03 00:05:25 -0500 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-01-06 21:42:56 -0500 |
commit | ff3d4578840fd96a50558edf02ca0178b9ebb652 (patch) | |
tree | 4ee34f3341f2eb092e95cc0bb728865675939423 | |
parent | 1d3db59d59861481349437231c263b6c7a0eef78 (diff) |
ncr5380: Implement NCR5380_dma_xfer_len and remove LIMIT_TRANSFERSIZE macro
Follow the example of the atari_NCR5380.c core driver and adopt the
NCR5380_dma_xfer_len() hook. Implement NCR5380_dma_xfer_len() for dtc.c
and g_NCR5380.c to take care of the limitations of these cards. Keep the
default for drivers using PSEUDO_DMA.
Eliminate the unused macro LIMIT_TRANSFERSIZE.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/NCR5380.c | 34 | ||||
-rw-r--r-- | drivers/scsi/arm/cumana_1.c | 3 | ||||
-rw-r--r-- | drivers/scsi/arm/oak.c | 2 | ||||
-rw-r--r-- | drivers/scsi/atari_NCR5380.c | 8 | ||||
-rw-r--r-- | drivers/scsi/dtc.c | 14 | ||||
-rw-r--r-- | drivers/scsi/dtc.h | 3 | ||||
-rw-r--r-- | drivers/scsi/g_NCR5380.c | 15 | ||||
-rw-r--r-- | drivers/scsi/g_NCR5380.h | 3 | ||||
-rw-r--r-- | drivers/scsi/mac_scsi.c | 1 | ||||
-rw-r--r-- | drivers/scsi/pas16.h | 2 | ||||
-rw-r--r-- | drivers/scsi/t128.h | 2 |
11 files changed, 56 insertions, 31 deletions
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 6a030139b41f..91eac63b5239 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c | |||
@@ -201,11 +201,6 @@ | |||
201 | * DONT_USE_INTR - if defined, never use interrupts, even if we probe or | 201 | * DONT_USE_INTR - if defined, never use interrupts, even if we probe or |
202 | * override-configure an IRQ. | 202 | * override-configure an IRQ. |
203 | * | 203 | * |
204 | * LIMIT_TRANSFERSIZE - if defined, limit the pseudo-dma transfers to 512 | ||
205 | * bytes at a time. Since interrupts are disabled by default during | ||
206 | * these transfers, we might need this to give reasonable interrupt | ||
207 | * service time if the transfer size gets too large. | ||
208 | * | ||
209 | * LINKED - if defined, linked commands are supported. | 204 | * LINKED - if defined, linked commands are supported. |
210 | * | 205 | * |
211 | * PSEUDO_DMA - if defined, PSEUDO DMA is used during the data transfer phases. | 206 | * PSEUDO_DMA - if defined, PSEUDO DMA is used during the data transfer phases. |
@@ -2000,29 +1995,12 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) { | |||
2000 | */ | 1995 | */ |
2001 | 1996 | ||
2002 | #if defined(PSEUDO_DMA) || defined(REAL_DMA_POLL) | 1997 | #if defined(PSEUDO_DMA) || defined(REAL_DMA_POLL) |
2003 | /* KLL | 1998 | transfersize = 0; |
2004 | * PSEUDO_DMA is defined here. If this is the g_NCR5380 | 1999 | if (!cmd->device->borken && |
2005 | * driver then it will always be defined, so the | 2000 | !(hostdata->flags & FLAG_NO_PSEUDO_DMA)) |
2006 | * FLAG_NO_PSEUDO_DMA is used to inhibit PDMA in the base | 2001 | transfersize = NCR5380_dma_xfer_len(instance, cmd, phase); |
2007 | * NCR5380 case. I think this is a fairly clean solution. | 2002 | |
2008 | * We supplement these 2 if's with the flag. | 2003 | if (transfersize) { |
2009 | */ | ||
2010 | #ifdef NCR5380_dma_xfer_len | ||
2011 | if (!cmd->device->borken && !(hostdata->flags & FLAG_NO_PSEUDO_DMA) && (transfersize = NCR5380_dma_xfer_len(instance, cmd)) != 0) { | ||
2012 | #else | ||
2013 | transfersize = cmd->transfersize; | ||
2014 | |||
2015 | #ifdef LIMIT_TRANSFERSIZE /* If we have problems with interrupt service */ | ||
2016 | if (transfersize > 512) | ||
2017 | transfersize = 512; | ||
2018 | #endif /* LIMIT_TRANSFERSIZE */ | ||
2019 | |||
2020 | if (!cmd->device->borken && transfersize && !(hostdata->flags & FLAG_NO_PSEUDO_DMA) && cmd->SCp.this_residual && !(cmd->SCp.this_residual % transfersize)) { | ||
2021 | /* Limit transfers to 32K, for xx400 & xx406 | ||
2022 | * pseudoDMA that transfers in 128 bytes blocks. */ | ||
2023 | if (transfersize > 32 * 1024) | ||
2024 | transfersize = 32 * 1024; | ||
2025 | #endif | ||
2026 | len = transfersize; | 2004 | len = transfersize; |
2027 | if (NCR5380_transfer_dma(instance, &phase, &len, (unsigned char **) &cmd->SCp.ptr)) { | 2005 | if (NCR5380_transfer_dma(instance, &phase, &len, (unsigned char **) &cmd->SCp.ptr)) { |
2028 | /* | 2006 | /* |
diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c index 0d0cb62b8cdb..f9fb8dabdbbd 100644 --- a/drivers/scsi/arm/cumana_1.c +++ b/drivers/scsi/arm/cumana_1.c | |||
@@ -22,6 +22,9 @@ | |||
22 | #define priv(host) ((struct NCR5380_hostdata *)(host)->hostdata) | 22 | #define priv(host) ((struct NCR5380_hostdata *)(host)->hostdata) |
23 | #define NCR5380_read(reg) cumanascsi_read(instance, reg) | 23 | #define NCR5380_read(reg) cumanascsi_read(instance, reg) |
24 | #define NCR5380_write(reg, value) cumanascsi_write(instance, reg, value) | 24 | #define NCR5380_write(reg, value) cumanascsi_write(instance, reg, value) |
25 | |||
26 | #define NCR5380_dma_xfer_len(instance, cmd, phase) (cmd->transfersize) | ||
27 | |||
25 | #define NCR5380_intr cumanascsi_intr | 28 | #define NCR5380_intr cumanascsi_intr |
26 | #define NCR5380_queue_command cumanascsi_queue_command | 29 | #define NCR5380_queue_command cumanascsi_queue_command |
27 | #define NCR5380_info cumanascsi_info | 30 | #define NCR5380_info cumanascsi_info |
diff --git a/drivers/scsi/arm/oak.c b/drivers/scsi/arm/oak.c index db337b998299..d95a1d4f4e02 100644 --- a/drivers/scsi/arm/oak.c +++ b/drivers/scsi/arm/oak.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #define NCR5380_write(reg, value) \ | 26 | #define NCR5380_write(reg, value) \ |
27 | writeb(value, priv(instance)->base + ((reg) << 2)) | 27 | writeb(value, priv(instance)->base + ((reg) << 2)) |
28 | 28 | ||
29 | #define NCR5380_dma_xfer_len(instance, cmd, phase) (cmd->transfersize) | ||
30 | |||
29 | #define NCR5380_queue_command oakscsi_queue_command | 31 | #define NCR5380_queue_command oakscsi_queue_command |
30 | #define NCR5380_info oakscsi_info | 32 | #define NCR5380_info oakscsi_info |
31 | #define NCR5380_show_info oakscsi_show_info | 33 | #define NCR5380_show_info oakscsi_show_info |
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c index 64ee92090de3..59b378057198 100644 --- a/drivers/scsi/atari_NCR5380.c +++ b/drivers/scsi/atari_NCR5380.c | |||
@@ -2170,11 +2170,13 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) | |||
2170 | */ | 2170 | */ |
2171 | 2171 | ||
2172 | #if defined(REAL_DMA) | 2172 | #if defined(REAL_DMA) |
2173 | if ( | ||
2174 | #if !defined(CONFIG_SUN3) | 2173 | #if !defined(CONFIG_SUN3) |
2175 | !cmd->device->borken && | 2174 | transfersize = 0; |
2175 | if (!cmd->device->borken) | ||
2176 | #endif | 2176 | #endif |
2177 | (transfersize = NCR5380_dma_xfer_len(instance, cmd, phase)) >= DMA_MIN_SIZE) { | 2177 | transfersize = NCR5380_dma_xfer_len(instance, cmd, phase); |
2178 | |||
2179 | if (transfersize >= DMA_MIN_SIZE) { | ||
2178 | len = transfersize; | 2180 | len = transfersize; |
2179 | cmd->SCp.phase = phase; | 2181 | cmd->SCp.phase = phase; |
2180 | if (NCR5380_transfer_dma(instance, &phase, | 2182 | if (NCR5380_transfer_dma(instance, &phase, |
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c index bc856c8ba0dd..010d9b13aae7 100644 --- a/drivers/scsi/dtc.c +++ b/drivers/scsi/dtc.c | |||
@@ -419,6 +419,20 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, | |||
419 | return (0); | 419 | return (0); |
420 | } | 420 | } |
421 | 421 | ||
422 | static int dtc_dma_xfer_len(struct scsi_cmnd *cmd) | ||
423 | { | ||
424 | int transfersize = cmd->transfersize; | ||
425 | |||
426 | /* Limit transfers to 32K, for xx400 & xx406 | ||
427 | * pseudoDMA that transfers in 128 bytes blocks. | ||
428 | */ | ||
429 | if (transfersize > 32 * 1024 && cmd->SCp.this_residual && | ||
430 | !(cmd->SCp.this_residual % transfersize)) | ||
431 | transfersize = 32 * 1024; | ||
432 | |||
433 | return transfersize; | ||
434 | } | ||
435 | |||
422 | MODULE_LICENSE("GPL"); | 436 | MODULE_LICENSE("GPL"); |
423 | 437 | ||
424 | #include "NCR5380.c" | 438 | #include "NCR5380.c" |
diff --git a/drivers/scsi/dtc.h b/drivers/scsi/dtc.h index 07b0ac98817c..e6c09a9174ce 100644 --- a/drivers/scsi/dtc.h +++ b/drivers/scsi/dtc.h | |||
@@ -27,6 +27,9 @@ | |||
27 | #define NCR5380_read(reg) (readb(DTC_address(reg))) | 27 | #define NCR5380_read(reg) (readb(DTC_address(reg))) |
28 | #define NCR5380_write(reg, value) (writeb(value, DTC_address(reg))) | 28 | #define NCR5380_write(reg, value) (writeb(value, DTC_address(reg))) |
29 | 29 | ||
30 | #define NCR5380_dma_xfer_len(instance, cmd, phase) \ | ||
31 | dtc_dma_xfer_len(cmd) | ||
32 | |||
30 | #define NCR5380_intr dtc_intr | 33 | #define NCR5380_intr dtc_intr |
31 | #define NCR5380_queue_command dtc_queue_command | 34 | #define NCR5380_queue_command dtc_queue_command |
32 | #define NCR5380_abort dtc_abort | 35 | #define NCR5380_abort dtc_abort |
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c index afd092ff0c2e..5b3e03ad50ce 100644 --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c | |||
@@ -699,6 +699,21 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, | |||
699 | ; // TIMEOUT | 699 | ; // TIMEOUT |
700 | return 0; | 700 | return 0; |
701 | } | 701 | } |
702 | |||
703 | static int generic_NCR5380_dma_xfer_len(struct scsi_cmnd *cmd) | ||
704 | { | ||
705 | int transfersize = cmd->transfersize; | ||
706 | |||
707 | /* Limit transfers to 32K, for xx400 & xx406 | ||
708 | * pseudoDMA that transfers in 128 bytes blocks. | ||
709 | */ | ||
710 | if (transfersize > 32 * 1024 && cmd->SCp.this_residual && | ||
711 | !(cmd->SCp.this_residual % transfersize)) | ||
712 | transfersize = 32 * 1024; | ||
713 | |||
714 | return transfersize; | ||
715 | } | ||
716 | |||
702 | #endif /* PSEUDO_DMA */ | 717 | #endif /* PSEUDO_DMA */ |
703 | 718 | ||
704 | /* | 719 | /* |
diff --git a/drivers/scsi/g_NCR5380.h b/drivers/scsi/g_NCR5380.h index 5c656f163beb..0056790a9cbe 100644 --- a/drivers/scsi/g_NCR5380.h +++ b/drivers/scsi/g_NCR5380.h | |||
@@ -73,6 +73,9 @@ | |||
73 | 73 | ||
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | #define NCR5380_dma_xfer_len(instance, cmd, phase) \ | ||
77 | generic_NCR5380_dma_xfer_len(cmd) | ||
78 | |||
76 | #define NCR5380_intr generic_NCR5380_intr | 79 | #define NCR5380_intr generic_NCR5380_intr |
77 | #define NCR5380_queue_command generic_NCR5380_queue_command | 80 | #define NCR5380_queue_command generic_NCR5380_queue_command |
78 | #define NCR5380_abort generic_NCR5380_abort | 81 | #define NCR5380_abort generic_NCR5380_abort |
diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c index 1317f54bab92..f8ed2acd1456 100644 --- a/drivers/scsi/mac_scsi.c +++ b/drivers/scsi/mac_scsi.c | |||
@@ -38,6 +38,7 @@ | |||
38 | 38 | ||
39 | #define NCR5380_pread macscsi_pread | 39 | #define NCR5380_pread macscsi_pread |
40 | #define NCR5380_pwrite macscsi_pwrite | 40 | #define NCR5380_pwrite macscsi_pwrite |
41 | #define NCR5380_dma_xfer_len(instance, cmd, phase) (cmd->transfersize) | ||
41 | 42 | ||
42 | #define NCR5380_intr macscsi_intr | 43 | #define NCR5380_intr macscsi_intr |
43 | #define NCR5380_queue_command macscsi_queue_command | 44 | #define NCR5380_queue_command macscsi_queue_command |
diff --git a/drivers/scsi/pas16.h b/drivers/scsi/pas16.h index 7247b67fb111..a827a7c1c133 100644 --- a/drivers/scsi/pas16.h +++ b/drivers/scsi/pas16.h | |||
@@ -110,6 +110,8 @@ | |||
110 | #define NCR5380_read(reg) ( inb(PAS16_io_port(reg)) ) | 110 | #define NCR5380_read(reg) ( inb(PAS16_io_port(reg)) ) |
111 | #define NCR5380_write(reg, value) ( outb((value),PAS16_io_port(reg)) ) | 111 | #define NCR5380_write(reg, value) ( outb((value),PAS16_io_port(reg)) ) |
112 | 112 | ||
113 | #define NCR5380_dma_xfer_len(instance, cmd, phase) (cmd->transfersize) | ||
114 | |||
113 | #define NCR5380_intr pas16_intr | 115 | #define NCR5380_intr pas16_intr |
114 | #define NCR5380_queue_command pas16_queue_command | 116 | #define NCR5380_queue_command pas16_queue_command |
115 | #define NCR5380_abort pas16_abort | 117 | #define NCR5380_abort pas16_abort |
diff --git a/drivers/scsi/t128.h b/drivers/scsi/t128.h index ca93c97cf4ba..16691d5fb81b 100644 --- a/drivers/scsi/t128.h +++ b/drivers/scsi/t128.h | |||
@@ -84,6 +84,8 @@ | |||
84 | #define NCR5380_read(reg) readb(T128_address(reg)) | 84 | #define NCR5380_read(reg) readb(T128_address(reg)) |
85 | #define NCR5380_write(reg, value) writeb((value),(T128_address(reg))) | 85 | #define NCR5380_write(reg, value) writeb((value),(T128_address(reg))) |
86 | 86 | ||
87 | #define NCR5380_dma_xfer_len(instance, cmd, phase) (cmd->transfersize) | ||
88 | |||
87 | #define NCR5380_intr t128_intr | 89 | #define NCR5380_intr t128_intr |
88 | #define NCR5380_queue_command t128_queue_command | 90 | #define NCR5380_queue_command t128_queue_command |
89 | #define NCR5380_abort t128_abort | 91 | #define NCR5380_abort t128_abort |