1
0
Fork 0

mac_scsi: Cleanup PDMA code

Fix whitespace, remove pointless volatile qualifiers and improve code style
by use of INPUT_DATA_REG and OUTPUT_DATA_REG macros.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
wifi-calibration
Finn Thain 2014-11-12 16:12:06 +11:00 committed by Christoph Hellwig
parent 6e9ae6d560
commit ffdede67d6
1 changed files with 57 additions and 55 deletions

View File

@ -86,9 +86,9 @@ module_param(setup_hostid, int, 0);
#define AFTER_RESET_DELAY (HZ/2) #define AFTER_RESET_DELAY (HZ/2)
#endif #endif
static volatile unsigned char *mac_scsi_regp = NULL; static unsigned char *mac_scsi_regp;
static volatile unsigned char *mac_scsi_drq = NULL; static unsigned char *mac_scsi_drq;
static volatile unsigned char *mac_scsi_nodrq = NULL; static unsigned char *mac_scsi_nodrq;
/* /*
@ -262,6 +262,7 @@ static void mac_scsi_reset_boot(struct Scsi_Host *instance)
} }
#endif #endif
#ifdef PSEUDO_DMA
/* /*
Pseudo-DMA: (Ove Edlund) Pseudo-DMA: (Ove Edlund)
The code attempts to catch bus errors that occur if one for example The code attempts to catch bus errors that occur if one for example
@ -331,38 +332,38 @@ __asm__ __volatile__ \
: "0"(s), "1"(d), "2"(len) \ : "0"(s), "1"(d), "2"(len) \
: "d0") : "d0")
static int macscsi_pread(struct Scsi_Host *instance,
static int macscsi_pread (struct Scsi_Host *instance, unsigned char *dst, int len)
unsigned char *dst, int len)
{ {
unsigned char *d; unsigned char *d;
volatile unsigned char *s; unsigned char *s;
NCR5380_local_declare(); NCR5380_local_declare();
NCR5380_setup(instance); NCR5380_setup(instance);
s = mac_scsi_drq+0x60; s = mac_scsi_drq + (INPUT_DATA_REG << 4);
d = dst; d = dst;
/* These conditions are derived from MacOS */ /* These conditions are derived from MacOS */
while (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ) while (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ) &&
&& !(NCR5380_read(STATUS_REG) & SR_REQ)) !(NCR5380_read(STATUS_REG) & SR_REQ))
; ;
if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ)
&& (NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH)) {
printk(KERN_ERR "Error in macscsi_pread\n");
return -1;
}
CP_IO_TO_MEM(s, d, len); if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ) &&
(NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH)) {
if (len != 0) { pr_err("Error in macscsi_pread\n");
printk(KERN_NOTICE "Bus error in macscsi_pread\n"); return -1;
return -1; }
}
CP_IO_TO_MEM(s, d, len);
return 0;
if (len != 0) {
pr_notice("Bus error in macscsi_pread\n");
return -1;
}
return 0;
} }
@ -424,39 +425,40 @@ __asm__ __volatile__ \
: "0"(s), "1"(d), "2"(len) \ : "0"(s), "1"(d), "2"(len) \
: "d0") : "d0")
static int macscsi_pwrite (struct Scsi_Host *instance, static int macscsi_pwrite(struct Scsi_Host *instance,
unsigned char *src, int len) unsigned char *src, int len)
{ {
unsigned char *s; unsigned char *s;
volatile unsigned char *d; unsigned char *d;
NCR5380_local_declare(); NCR5380_local_declare();
NCR5380_setup(instance); NCR5380_setup(instance);
s = src; s = src;
d = mac_scsi_drq; d = mac_scsi_drq + (OUTPUT_DATA_REG << 4);
/* These conditions are derived from MacOS */
while (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ) /* These conditions are derived from MacOS */
&& (!(NCR5380_read(STATUS_REG) & SR_REQ)
|| (NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH)))
;
if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ)) {
printk(KERN_ERR "Error in macscsi_pwrite\n");
return -1;
}
CP_MEM_TO_IO(s, d, len); while (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ) &&
(!(NCR5380_read(STATUS_REG) & SR_REQ) ||
(NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH)))
;
if (len != 0) { if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ)) {
printk(KERN_NOTICE "Bus error in macscsi_pwrite\n"); pr_err("Error in macscsi_pwrite\n");
return -1; return -1;
} }
return 0; CP_MEM_TO_IO(s, d, len);
if (len != 0) {
pr_notice("Bus error in macscsi_pwrite\n");
return -1;
}
return 0;
} }
#endif
#include "NCR5380.c" #include "NCR5380.c"