aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mac_scsi.c
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2014-11-12 00:12:06 -0500
committerChristoph Hellwig <hch@lst.de>2014-11-20 03:11:12 -0500
commitffdede67d670e507d5202b8b08733c7a3b8e7fa0 (patch)
tree34d57c524dbe8ce6b742fd67712b321610fdd28e /drivers/scsi/mac_scsi.c
parent6e9ae6d560e1a60113ef2a4d27eeb4931048b674 (diff)
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>
Diffstat (limited to 'drivers/scsi/mac_scsi.c')
-rw-r--r--drivers/scsi/mac_scsi.c132
1 files changed, 67 insertions, 65 deletions
diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c
index 3b93f000499a..578207e209e5 100644
--- a/drivers/scsi/mac_scsi.c
+++ b/drivers/scsi/mac_scsi.c
@@ -86,9 +86,9 @@ module_param(setup_hostid, int, 0);
86#define AFTER_RESET_DELAY (HZ/2) 86#define AFTER_RESET_DELAY (HZ/2)
87#endif 87#endif
88 88
89static volatile unsigned char *mac_scsi_regp = NULL; 89static unsigned char *mac_scsi_regp;
90static volatile unsigned char *mac_scsi_drq = NULL; 90static unsigned char *mac_scsi_drq;
91static volatile unsigned char *mac_scsi_nodrq = NULL; 91static unsigned char *mac_scsi_nodrq;
92 92
93 93
94/* 94/*
@@ -262,6 +262,7 @@ static void mac_scsi_reset_boot(struct Scsi_Host *instance)
262} 262}
263#endif 263#endif
264 264
265#ifdef PSEUDO_DMA
265/* 266/*
266 Pseudo-DMA: (Ove Edlund) 267 Pseudo-DMA: (Ove Edlund)
267 The code attempts to catch bus errors that occur if one for example 268 The code attempts to catch bus errors that occur if one for example
@@ -331,38 +332,38 @@ __asm__ __volatile__ \
331 : "0"(s), "1"(d), "2"(len) \ 332 : "0"(s), "1"(d), "2"(len) \
332 : "d0") 333 : "d0")
333 334
334 335static int macscsi_pread(struct Scsi_Host *instance,
335static int macscsi_pread (struct Scsi_Host *instance, 336 unsigned char *dst, int len)
336 unsigned char *dst, int len)
337{ 337{
338 unsigned char *d; 338 unsigned char *d;
339 volatile unsigned char *s; 339 unsigned char *s;
340 340
341 NCR5380_local_declare(); 341 NCR5380_local_declare();
342 NCR5380_setup(instance); 342 NCR5380_setup(instance);
343 343
344 s = mac_scsi_drq+0x60; 344 s = mac_scsi_drq + (INPUT_DATA_REG << 4);
345 d = dst; 345 d = dst;
346 346
347/* These conditions are derived from MacOS */ 347 /* These conditions are derived from MacOS */
348 348
349 while (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ) 349 while (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ) &&
350 && !(NCR5380_read(STATUS_REG) & SR_REQ)) 350 !(NCR5380_read(STATUS_REG) & SR_REQ))
351 ; 351 ;
352 if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ) 352
353 && (NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH)) { 353 if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ) &&
354 printk(KERN_ERR "Error in macscsi_pread\n"); 354 (NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH)) {
355 return -1; 355 pr_err("Error in macscsi_pread\n");
356 } 356 return -1;
357 357 }
358 CP_IO_TO_MEM(s, d, len); 358
359 359 CP_IO_TO_MEM(s, d, len);
360 if (len != 0) { 360
361 printk(KERN_NOTICE "Bus error in macscsi_pread\n"); 361 if (len != 0) {
362 return -1; 362 pr_notice("Bus error in macscsi_pread\n");
363 } 363 return -1;
364 364 }
365 return 0; 365
366 return 0;
366} 367}
367 368
368 369
@@ -424,39 +425,40 @@ __asm__ __volatile__ \
424 : "0"(s), "1"(d), "2"(len) \ 425 : "0"(s), "1"(d), "2"(len) \
425 : "d0") 426 : "d0")
426 427
427static int macscsi_pwrite (struct Scsi_Host *instance, 428static int macscsi_pwrite(struct Scsi_Host *instance,
428 unsigned char *src, int len) 429 unsigned char *src, int len)
429{ 430{
430 unsigned char *s; 431 unsigned char *s;
431 volatile unsigned char *d; 432 unsigned char *d;
432
433 NCR5380_local_declare();
434 NCR5380_setup(instance);
435
436 s = src;
437 d = mac_scsi_drq;
438
439/* These conditions are derived from MacOS */
440
441 while (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ)
442 && (!(NCR5380_read(STATUS_REG) & SR_REQ)
443 || (NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH)))
444 ;
445 if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ)) {
446 printk(KERN_ERR "Error in macscsi_pwrite\n");
447 return -1;
448 }
449
450 CP_MEM_TO_IO(s, d, len);
451
452 if (len != 0) {
453 printk(KERN_NOTICE "Bus error in macscsi_pwrite\n");
454 return -1;
455 }
456
457 return 0;
458}
459 433
434 NCR5380_local_declare();
435 NCR5380_setup(instance);
436
437 s = src;
438 d = mac_scsi_drq + (OUTPUT_DATA_REG << 4);
439
440 /* These conditions are derived from MacOS */
441
442 while (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ) &&
443 (!(NCR5380_read(STATUS_REG) & SR_REQ) ||
444 (NCR5380_read(BUS_AND_STATUS_REG) & BASR_PHASE_MATCH)))
445 ;
446
447 if (!(NCR5380_read(BUS_AND_STATUS_REG) & BASR_DRQ)) {
448 pr_err("Error in macscsi_pwrite\n");
449 return -1;
450 }
451
452 CP_MEM_TO_IO(s, d, len);
453
454 if (len != 0) {
455 pr_notice("Bus error in macscsi_pwrite\n");
456 return -1;
457 }
458
459 return 0;
460}
461#endif
460 462
461#include "NCR5380.c" 463#include "NCR5380.c"
462 464