diff options
author | Finn Thain <fthain@telegraphics.com.au> | 2016-01-03 00:05:06 -0500 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-01-06 21:42:52 -0500 |
commit | 54d8fe4425c9d3fdf8473c1833c6807b61c6e70e (patch) | |
tree | 7f6597bc2f7277fa2f04496f814372413177d23d | |
parent | c0965e6371fa50fdf5cc2291915de97412fb1ec9 (diff) |
ncr5380: Remove NCR5380_local_declare and NCR5380_setup macros
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>
Tested-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/NCR5380.c | 60 | ||||
-rw-r--r-- | drivers/scsi/arm/cumana_1.c | 6 | ||||
-rw-r--r-- | drivers/scsi/arm/oak.c | 9 | ||||
-rw-r--r-- | drivers/scsi/dmx3191d.c | 6 | ||||
-rw-r--r-- | drivers/scsi/dtc.c | 14 | ||||
-rw-r--r-- | drivers/scsi/dtc.h | 9 | ||||
-rw-r--r-- | drivers/scsi/g_NCR5380.c | 27 | ||||
-rw-r--r-- | drivers/scsi/g_NCR5380.h | 30 | ||||
-rw-r--r-- | drivers/scsi/mac_scsi.c | 15 | ||||
-rw-r--r-- | drivers/scsi/pas16.c | 16 | ||||
-rw-r--r-- | drivers/scsi/pas16.h | 11 | ||||
-rw-r--r-- | drivers/scsi/t128.c | 26 | ||||
-rw-r--r-- | drivers/scsi/t128.h | 9 |
13 files changed, 77 insertions, 161 deletions
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index ed8346fcd516..e4cd85e1ea5b 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c | |||
@@ -230,11 +230,6 @@ | |||
230 | * USLEEP_POLL - amount of time, in jiffies, to poll | 230 | * USLEEP_POLL - amount of time, in jiffies, to poll |
231 | * | 231 | * |
232 | * These macros MUST be defined : | 232 | * These macros MUST be defined : |
233 | * NCR5380_local_declare() - declare any local variables needed for your | ||
234 | * transfer routines. | ||
235 | * | ||
236 | * NCR5380_setup(instance) - initialize any local variables needed from a given | ||
237 | * instance of the host adapter for NCR5380_{read,write,pread,pwrite} | ||
238 | * | 233 | * |
239 | * NCR5380_read(register) - read from the specified register | 234 | * NCR5380_read(register) - read from the specified register |
240 | * | 235 | * |
@@ -267,8 +262,8 @@ | |||
267 | * possible) function may be used. | 262 | * possible) function may be used. |
268 | */ | 263 | */ |
269 | 264 | ||
270 | static int do_abort(struct Scsi_Host *host); | 265 | static int do_abort(struct Scsi_Host *); |
271 | static void do_reset(struct Scsi_Host *host); | 266 | static void do_reset(struct Scsi_Host *); |
272 | 267 | ||
273 | /* | 268 | /* |
274 | * initialize_SCp - init the scsi pointer field | 269 | * initialize_SCp - init the scsi pointer field |
@@ -313,12 +308,9 @@ static inline void initialize_SCp(struct scsi_cmnd *cmd) | |||
313 | 308 | ||
314 | static int NCR5380_poll_politely(struct Scsi_Host *instance, int reg, int bit, int val, int t) | 309 | static int NCR5380_poll_politely(struct Scsi_Host *instance, int reg, int bit, int val, int t) |
315 | { | 310 | { |
316 | NCR5380_local_declare(); | ||
317 | int n = 500; /* At about 8uS a cycle for the cpu access */ | 311 | int n = 500; /* At about 8uS a cycle for the cpu access */ |
318 | unsigned long end = jiffies + t; | 312 | unsigned long end = jiffies + t; |
319 | int r; | 313 | int r; |
320 | |||
321 | NCR5380_setup(instance); | ||
322 | 314 | ||
323 | while( n-- > 0) | 315 | while( n-- > 0) |
324 | { | 316 | { |
@@ -406,9 +398,7 @@ mrs[] = { | |||
406 | 398 | ||
407 | static void NCR5380_print(struct Scsi_Host *instance) | 399 | static void NCR5380_print(struct Scsi_Host *instance) |
408 | { | 400 | { |
409 | NCR5380_local_declare(); | ||
410 | unsigned char status, data, basr, mr, icr, i; | 401 | unsigned char status, data, basr, mr, icr, i; |
411 | NCR5380_setup(instance); | ||
412 | 402 | ||
413 | data = NCR5380_read(CURRENT_SCSI_DATA_REG); | 403 | data = NCR5380_read(CURRENT_SCSI_DATA_REG); |
414 | status = NCR5380_read(STATUS_REG); | 404 | status = NCR5380_read(STATUS_REG); |
@@ -447,10 +437,8 @@ static void NCR5380_print(struct Scsi_Host *instance) | |||
447 | 437 | ||
448 | static void NCR5380_print_phase(struct Scsi_Host *instance) | 438 | static void NCR5380_print_phase(struct Scsi_Host *instance) |
449 | { | 439 | { |
450 | NCR5380_local_declare(); | ||
451 | unsigned char status; | 440 | unsigned char status; |
452 | int i; | 441 | int i; |
453 | NCR5380_setup(instance); | ||
454 | 442 | ||
455 | status = NCR5380_read(STATUS_REG); | 443 | status = NCR5380_read(STATUS_REG); |
456 | if (!(status & SR_REQ)) | 444 | if (!(status & SR_REQ)) |
@@ -566,11 +554,9 @@ static irqreturn_t __init probe_intr(int irq, void *dev_id) | |||
566 | static int __init __maybe_unused NCR5380_probe_irq(struct Scsi_Host *instance, | 554 | static int __init __maybe_unused NCR5380_probe_irq(struct Scsi_Host *instance, |
567 | int possible) | 555 | int possible) |
568 | { | 556 | { |
569 | NCR5380_local_declare(); | ||
570 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; | 557 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; |
571 | unsigned long timeout; | 558 | unsigned long timeout; |
572 | int trying_irqs, i, mask; | 559 | int trying_irqs, i, mask; |
573 | NCR5380_setup(instance); | ||
574 | 560 | ||
575 | for (trying_irqs = 0, i = 1, mask = 2; i < 16; ++i, mask <<= 1) | 561 | for (trying_irqs = 0, i = 1, mask = 2; i < 16; ++i, mask <<= 1) |
576 | if ((mask & possible) && (request_irq(i, &probe_intr, 0, "NCR-probe", NULL) == 0)) | 562 | if ((mask & possible) && (request_irq(i, &probe_intr, 0, "NCR-probe", NULL) == 0)) |
@@ -791,7 +777,6 @@ static void lprint_opcode(int opcode, struct seq_file *m) | |||
791 | 777 | ||
792 | static int NCR5380_init(struct Scsi_Host *instance, int flags) | 778 | static int NCR5380_init(struct Scsi_Host *instance, int flags) |
793 | { | 779 | { |
794 | NCR5380_local_declare(); | ||
795 | int i, pass; | 780 | int i, pass; |
796 | unsigned long timeout; | 781 | unsigned long timeout; |
797 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; | 782 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; |
@@ -808,8 +793,6 @@ static int NCR5380_init(struct Scsi_Host *instance, int flags) | |||
808 | instance->NCR5380_instance_name += NCR53C400_address_adjust; | 793 | instance->NCR5380_instance_name += NCR53C400_address_adjust; |
809 | #endif | 794 | #endif |
810 | 795 | ||
811 | NCR5380_setup(instance); | ||
812 | |||
813 | hostdata->aborted = 0; | 796 | hostdata->aborted = 0; |
814 | hostdata->id_mask = 1 << instance->this_id; | 797 | hostdata->id_mask = 1 << instance->this_id; |
815 | for (i = hostdata->id_mask; i <= 0x80; i <<= 1) | 798 | for (i = hostdata->id_mask; i <= 0x80; i <<= 1) |
@@ -1100,7 +1083,6 @@ static void NCR5380_main(struct work_struct *work) | |||
1100 | 1083 | ||
1101 | static irqreturn_t NCR5380_intr(int dummy, void *dev_id) | 1084 | static irqreturn_t NCR5380_intr(int dummy, void *dev_id) |
1102 | { | 1085 | { |
1103 | NCR5380_local_declare(); | ||
1104 | struct Scsi_Host *instance = dev_id; | 1086 | struct Scsi_Host *instance = dev_id; |
1105 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; | 1087 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; |
1106 | int done; | 1088 | int done; |
@@ -1114,7 +1096,6 @@ static irqreturn_t NCR5380_intr(int dummy, void *dev_id) | |||
1114 | done = 1; | 1096 | done = 1; |
1115 | spin_lock_irqsave(instance->host_lock, flags); | 1097 | spin_lock_irqsave(instance->host_lock, flags); |
1116 | /* Look for pending interrupts */ | 1098 | /* Look for pending interrupts */ |
1117 | NCR5380_setup(instance); | ||
1118 | basr = NCR5380_read(BUS_AND_STATUS_REG); | 1099 | basr = NCR5380_read(BUS_AND_STATUS_REG); |
1119 | /* XXX dispatch to appropriate routine if found and done=0 */ | 1100 | /* XXX dispatch to appropriate routine if found and done=0 */ |
1120 | if (basr & BASR_IRQ) { | 1101 | if (basr & BASR_IRQ) { |
@@ -1205,7 +1186,6 @@ static irqreturn_t NCR5380_intr(int dummy, void *dev_id) | |||
1205 | 1186 | ||
1206 | static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd) | 1187 | static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd) |
1207 | { | 1188 | { |
1208 | NCR5380_local_declare(); | ||
1209 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; | 1189 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; |
1210 | unsigned char tmp[3], phase; | 1190 | unsigned char tmp[3], phase; |
1211 | unsigned char *data; | 1191 | unsigned char *data; |
@@ -1213,7 +1193,6 @@ static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd) | |||
1213 | unsigned long timeout; | 1193 | unsigned long timeout; |
1214 | unsigned char value; | 1194 | unsigned char value; |
1215 | int err; | 1195 | int err; |
1216 | NCR5380_setup(instance); | ||
1217 | 1196 | ||
1218 | if (hostdata->selecting) | 1197 | if (hostdata->selecting) |
1219 | goto part2; | 1198 | goto part2; |
@@ -1487,7 +1466,6 @@ failed: | |||
1487 | */ | 1466 | */ |
1488 | 1467 | ||
1489 | static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data) { | 1468 | static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data) { |
1490 | NCR5380_local_declare(); | ||
1491 | unsigned char p = *phase, tmp; | 1469 | unsigned char p = *phase, tmp; |
1492 | int c = *count; | 1470 | int c = *count; |
1493 | unsigned char *d = *data; | 1471 | unsigned char *d = *data; |
@@ -1496,7 +1474,6 @@ static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase | |||
1496 | */ | 1474 | */ |
1497 | int break_allowed = 0; | 1475 | int break_allowed = 0; |
1498 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; | 1476 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; |
1499 | NCR5380_setup(instance); | ||
1500 | 1477 | ||
1501 | if (!(p & SR_IO)) | 1478 | if (!(p & SR_IO)) |
1502 | dprintk(NDEBUG_PIO, "scsi%d : pio write %d bytes\n", instance->host_no, c); | 1479 | dprintk(NDEBUG_PIO, "scsi%d : pio write %d bytes\n", instance->host_no, c); |
@@ -1623,10 +1600,8 @@ static int NCR5380_transfer_pio(struct Scsi_Host *instance, unsigned char *phase | |||
1623 | * Locks: caller holds queue lock | 1600 | * Locks: caller holds queue lock |
1624 | */ | 1601 | */ |
1625 | 1602 | ||
1626 | static void do_reset(struct Scsi_Host *host) { | 1603 | static void do_reset(struct Scsi_Host *instance) |
1627 | NCR5380_local_declare(); | 1604 | { |
1628 | NCR5380_setup(host); | ||
1629 | |||
1630 | NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(NCR5380_read(STATUS_REG) & PHASE_MASK)); | 1605 | NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(NCR5380_read(STATUS_REG) & PHASE_MASK)); |
1631 | NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST); | 1606 | NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_RST); |
1632 | udelay(25); | 1607 | udelay(25); |
@@ -1645,13 +1620,11 @@ static void do_reset(struct Scsi_Host *host) { | |||
1645 | * FIXME: sort this out and get new_eh running | 1620 | * FIXME: sort this out and get new_eh running |
1646 | */ | 1621 | */ |
1647 | 1622 | ||
1648 | static int do_abort(struct Scsi_Host *host) { | 1623 | static int do_abort(struct Scsi_Host *instance) |
1649 | NCR5380_local_declare(); | 1624 | { |
1650 | unsigned char *msgptr, phase, tmp; | 1625 | unsigned char *msgptr, phase, tmp; |
1651 | int len; | 1626 | int len; |
1652 | int rc; | 1627 | int rc; |
1653 | NCR5380_setup(host); | ||
1654 | |||
1655 | 1628 | ||
1656 | /* Request message out phase */ | 1629 | /* Request message out phase */ |
1657 | NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN); | 1630 | NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN); |
@@ -1666,7 +1639,7 @@ static int do_abort(struct Scsi_Host *host) { | |||
1666 | * the target sees, so we just handshake. | 1639 | * the target sees, so we just handshake. |
1667 | */ | 1640 | */ |
1668 | 1641 | ||
1669 | rc = NCR5380_poll_politely(host, STATUS_REG, SR_REQ, SR_REQ, 60 * HZ); | 1642 | rc = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, SR_REQ, 60 * HZ); |
1670 | 1643 | ||
1671 | if(rc < 0) | 1644 | if(rc < 0) |
1672 | return -1; | 1645 | return -1; |
@@ -1677,7 +1650,7 @@ static int do_abort(struct Scsi_Host *host) { | |||
1677 | 1650 | ||
1678 | if ((tmp & PHASE_MASK) != PHASE_MSGOUT) { | 1651 | if ((tmp & PHASE_MASK) != PHASE_MSGOUT) { |
1679 | NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN | ICR_ASSERT_ACK); | 1652 | NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN | ICR_ASSERT_ACK); |
1680 | rc = NCR5380_poll_politely(host, STATUS_REG, SR_REQ, 0, 3*HZ); | 1653 | rc = NCR5380_poll_politely(instance, STATUS_REG, SR_REQ, 0, 3 * HZ); |
1681 | NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN); | 1654 | NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN); |
1682 | if(rc == -1) | 1655 | if(rc == -1) |
1683 | return -1; | 1656 | return -1; |
@@ -1686,7 +1659,7 @@ static int do_abort(struct Scsi_Host *host) { | |||
1686 | msgptr = &tmp; | 1659 | msgptr = &tmp; |
1687 | len = 1; | 1660 | len = 1; |
1688 | phase = PHASE_MSGOUT; | 1661 | phase = PHASE_MSGOUT; |
1689 | NCR5380_transfer_pio(host, &phase, &len, &msgptr); | 1662 | NCR5380_transfer_pio(instance, &phase, &len, &msgptr); |
1690 | 1663 | ||
1691 | /* | 1664 | /* |
1692 | * If we got here, and the command completed successfully, | 1665 | * If we got here, and the command completed successfully, |
@@ -1719,7 +1692,6 @@ static int do_abort(struct Scsi_Host *host) { | |||
1719 | 1692 | ||
1720 | 1693 | ||
1721 | static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data) { | 1694 | static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase, int *count, unsigned char **data) { |
1722 | NCR5380_local_declare(); | ||
1723 | register int c = *count; | 1695 | register int c = *count; |
1724 | register unsigned char p = *phase; | 1696 | register unsigned char p = *phase; |
1725 | register unsigned char *d = *data; | 1697 | register unsigned char *d = *data; |
@@ -1732,8 +1704,6 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase | |||
1732 | 1704 | ||
1733 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; | 1705 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; |
1734 | 1706 | ||
1735 | NCR5380_setup(instance); | ||
1736 | |||
1737 | if ((tmp = (NCR5380_read(STATUS_REG) & PHASE_MASK)) != p) { | 1707 | if ((tmp = (NCR5380_read(STATUS_REG) & PHASE_MASK)) != p) { |
1738 | *phase = tmp; | 1708 | *phase = tmp; |
1739 | return -1; | 1709 | return -1; |
@@ -2000,7 +1970,6 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char *phase | |||
2000 | */ | 1970 | */ |
2001 | 1971 | ||
2002 | static void NCR5380_information_transfer(struct Scsi_Host *instance) { | 1972 | static void NCR5380_information_transfer(struct Scsi_Host *instance) { |
2003 | NCR5380_local_declare(); | ||
2004 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *)instance->hostdata; | 1973 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *)instance->hostdata; |
2005 | unsigned char msgout = NOP; | 1974 | unsigned char msgout = NOP; |
2006 | int sink = 0; | 1975 | int sink = 0; |
@@ -2014,8 +1983,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) { | |||
2014 | /* RvC: we need to set the end of the polling time */ | 1983 | /* RvC: we need to set the end of the polling time */ |
2015 | unsigned long poll_time = jiffies + USLEEP_POLL; | 1984 | unsigned long poll_time = jiffies + USLEEP_POLL; |
2016 | 1985 | ||
2017 | NCR5380_setup(instance); | ||
2018 | |||
2019 | while (1) { | 1986 | while (1) { |
2020 | tmp = NCR5380_read(STATUS_REG); | 1987 | tmp = NCR5380_read(STATUS_REG); |
2021 | /* We only have a valid SCSI phase when REQ is asserted */ | 1988 | /* We only have a valid SCSI phase when REQ is asserted */ |
@@ -2406,7 +2373,6 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) { | |||
2406 | */ | 2373 | */ |
2407 | 2374 | ||
2408 | static void NCR5380_reselect(struct Scsi_Host *instance) { | 2375 | static void NCR5380_reselect(struct Scsi_Host *instance) { |
2409 | NCR5380_local_declare(); | ||
2410 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) | 2376 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) |
2411 | instance->hostdata; | 2377 | instance->hostdata; |
2412 | unsigned char target_mask; | 2378 | unsigned char target_mask; |
@@ -2416,7 +2382,6 @@ static void NCR5380_reselect(struct Scsi_Host *instance) { | |||
2416 | unsigned char *data; | 2382 | unsigned char *data; |
2417 | struct scsi_cmnd *tmp = NULL, *prev; | 2383 | struct scsi_cmnd *tmp = NULL, *prev; |
2418 | int abort = 0; | 2384 | int abort = 0; |
2419 | NCR5380_setup(instance); | ||
2420 | 2385 | ||
2421 | /* | 2386 | /* |
2422 | * Disable arbitration, etc. since the host adapter obviously | 2387 | * Disable arbitration, etc. since the host adapter obviously |
@@ -2525,10 +2490,8 @@ static void NCR5380_reselect(struct Scsi_Host *instance) { | |||
2525 | 2490 | ||
2526 | #ifdef REAL_DMA | 2491 | #ifdef REAL_DMA |
2527 | static void NCR5380_dma_complete(NCR5380_instance * instance) { | 2492 | static void NCR5380_dma_complete(NCR5380_instance * instance) { |
2528 | NCR5380_local_declare(); | ||
2529 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; | 2493 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; |
2530 | int transferred; | 2494 | int transferred; |
2531 | NCR5380_setup(instance); | ||
2532 | 2495 | ||
2533 | /* | 2496 | /* |
2534 | * XXX this might not be right. | 2497 | * XXX this might not be right. |
@@ -2581,7 +2544,6 @@ static void NCR5380_dma_complete(NCR5380_instance * instance) { | |||
2581 | 2544 | ||
2582 | static int NCR5380_abort(struct scsi_cmnd *cmd) | 2545 | static int NCR5380_abort(struct scsi_cmnd *cmd) |
2583 | { | 2546 | { |
2584 | NCR5380_local_declare(); | ||
2585 | struct Scsi_Host *instance = cmd->device->host; | 2547 | struct Scsi_Host *instance = cmd->device->host; |
2586 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; | 2548 | struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; |
2587 | struct scsi_cmnd *tmp, **prev; | 2549 | struct scsi_cmnd *tmp, **prev; |
@@ -2590,8 +2552,6 @@ static int NCR5380_abort(struct scsi_cmnd *cmd) | |||
2590 | 2552 | ||
2591 | NCR5380_print_status(instance); | 2553 | NCR5380_print_status(instance); |
2592 | 2554 | ||
2593 | NCR5380_setup(instance); | ||
2594 | |||
2595 | dprintk(NDEBUG_ABORT, "scsi%d : abort called\n", instance->host_no); | 2555 | dprintk(NDEBUG_ABORT, "scsi%d : abort called\n", instance->host_no); |
2596 | dprintk(NDEBUG_ABORT, " basr 0x%X, sr 0x%X\n", NCR5380_read(BUS_AND_STATUS_REG), NCR5380_read(STATUS_REG)); | 2556 | dprintk(NDEBUG_ABORT, " basr 0x%X, sr 0x%X\n", NCR5380_read(BUS_AND_STATUS_REG), NCR5380_read(STATUS_REG)); |
2597 | 2557 | ||
@@ -2737,8 +2697,6 @@ static int NCR5380_bus_reset(struct scsi_cmnd *cmd) | |||
2737 | { | 2697 | { |
2738 | struct Scsi_Host *instance = cmd->device->host; | 2698 | struct Scsi_Host *instance = cmd->device->host; |
2739 | 2699 | ||
2740 | NCR5380_local_declare(); | ||
2741 | NCR5380_setup(instance); | ||
2742 | NCR5380_print_status(instance); | 2700 | NCR5380_print_status(instance); |
2743 | 2701 | ||
2744 | spin_lock_irq(instance->host_lock); | 2702 | spin_lock_irq(instance->host_lock); |
diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c index d28d6c0f18c0..8996a6ccc08f 100644 --- a/drivers/scsi/arm/cumana_1.c +++ b/drivers/scsi/arm/cumana_1.c | |||
@@ -20,10 +20,8 @@ | |||
20 | #define PSEUDO_DMA | 20 | #define PSEUDO_DMA |
21 | 21 | ||
22 | #define priv(host) ((struct NCR5380_hostdata *)(host)->hostdata) | 22 | #define priv(host) ((struct NCR5380_hostdata *)(host)->hostdata) |
23 | #define NCR5380_local_declare() struct Scsi_Host *_instance | 23 | #define NCR5380_read(reg) cumanascsi_read(instance, reg) |
24 | #define NCR5380_setup(instance) _instance = instance | 24 | #define NCR5380_write(reg, value) cumanascsi_write(instance, reg, value) |
25 | #define NCR5380_read(reg) cumanascsi_read(_instance, reg) | ||
26 | #define NCR5380_write(reg, value) cumanascsi_write(_instance, reg, value) | ||
27 | #define NCR5380_intr cumanascsi_intr | 25 | #define NCR5380_intr cumanascsi_intr |
28 | #define NCR5380_queue_command cumanascsi_queue_command | 26 | #define NCR5380_queue_command cumanascsi_queue_command |
29 | #define NCR5380_info cumanascsi_info | 27 | #define NCR5380_info cumanascsi_info |
diff --git a/drivers/scsi/arm/oak.c b/drivers/scsi/arm/oak.c index 7c6fa1479c9c..aa5310bef9b7 100644 --- a/drivers/scsi/arm/oak.c +++ b/drivers/scsi/arm/oak.c | |||
@@ -20,11 +20,12 @@ | |||
20 | #define DONT_USE_INTR | 20 | #define DONT_USE_INTR |
21 | 21 | ||
22 | #define priv(host) ((struct NCR5380_hostdata *)(host)->hostdata) | 22 | #define priv(host) ((struct NCR5380_hostdata *)(host)->hostdata) |
23 | #define NCR5380_local_declare() void __iomem *_base | ||
24 | #define NCR5380_setup(host) _base = priv(host)->base | ||
25 | 23 | ||
26 | #define NCR5380_read(reg) readb(_base + ((reg) << 2)) | 24 | #define NCR5380_read(reg) \ |
27 | #define NCR5380_write(reg, value) writeb(value, _base + ((reg) << 2)) | 25 | readb(priv(instance)->base + ((reg) << 2)) |
26 | #define NCR5380_write(reg, value) \ | ||
27 | writeb(value, priv(instance)->base + ((reg) << 2)) | ||
28 | |||
28 | #define NCR5380_queue_command oakscsi_queue_command | 29 | #define NCR5380_queue_command oakscsi_queue_command |
29 | #define NCR5380_info oakscsi_info | 30 | #define NCR5380_info oakscsi_info |
30 | #define NCR5380_show_info oakscsi_show_info | 31 | #define NCR5380_show_info oakscsi_show_info |
diff --git a/drivers/scsi/dmx3191d.c b/drivers/scsi/dmx3191d.c index 3e088125a8be..8d2984d7fa9c 100644 --- a/drivers/scsi/dmx3191d.c +++ b/drivers/scsi/dmx3191d.c | |||
@@ -36,12 +36,10 @@ | |||
36 | 36 | ||
37 | #define DONT_USE_INTR | 37 | #define DONT_USE_INTR |
38 | 38 | ||
39 | #define NCR5380_read(reg) inb(port + reg) | 39 | #define NCR5380_read(reg) inb(instance->io_port + reg) |
40 | #define NCR5380_write(reg, value) outb(value, port + reg) | 40 | #define NCR5380_write(reg, value) outb(value, instance->io_port + reg) |
41 | 41 | ||
42 | #define NCR5380_implementation_fields /* none */ | 42 | #define NCR5380_implementation_fields /* none */ |
43 | #define NCR5380_local_declare() unsigned int port | ||
44 | #define NCR5380_setup(instance) port = instance->io_port | ||
45 | 43 | ||
46 | /* | 44 | /* |
47 | * Includes needed for NCR5380.[ch] (XXX: Move them to NCR5380.h) | 45 | * Includes needed for NCR5380.[ch] (XXX: Move them to NCR5380.h) |
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c index 38325f979b90..43c1739639ba 100644 --- a/drivers/scsi/dtc.c +++ b/drivers/scsi/dtc.c | |||
@@ -325,8 +325,6 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, | |||
325 | unsigned char *d = dst; | 325 | unsigned char *d = dst; |
326 | int i; /* For counting time spent in the poll-loop */ | 326 | int i; /* For counting time spent in the poll-loop */ |
327 | struct NCR5380_hostdata *hostdata = shost_priv(instance); | 327 | struct NCR5380_hostdata *hostdata = shost_priv(instance); |
328 | NCR5380_local_declare(); | ||
329 | NCR5380_setup(instance); | ||
330 | 328 | ||
331 | i = 0; | 329 | i = 0; |
332 | NCR5380_read(RESET_PARITY_INTERRUPT_REG); | 330 | NCR5380_read(RESET_PARITY_INTERRUPT_REG); |
@@ -342,7 +340,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, | |||
342 | while (NCR5380_read(DTC_CONTROL_REG) & CSR_HOST_BUF_NOT_RDY) | 340 | while (NCR5380_read(DTC_CONTROL_REG) & CSR_HOST_BUF_NOT_RDY) |
343 | ++i; | 341 | ++i; |
344 | rtrc(3); | 342 | rtrc(3); |
345 | memcpy_fromio(d, base + DTC_DATA_BUF, 128); | 343 | memcpy_fromio(d, hostdata->base + DTC_DATA_BUF, 128); |
346 | d += 128; | 344 | d += 128; |
347 | len -= 128; | 345 | len -= 128; |
348 | rtrc(7); | 346 | rtrc(7); |
@@ -377,8 +375,6 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, | |||
377 | { | 375 | { |
378 | int i; | 376 | int i; |
379 | struct NCR5380_hostdata *hostdata = shost_priv(instance); | 377 | struct NCR5380_hostdata *hostdata = shost_priv(instance); |
380 | NCR5380_local_declare(); | ||
381 | NCR5380_setup(instance); | ||
382 | 378 | ||
383 | NCR5380_read(RESET_PARITY_INTERRUPT_REG); | 379 | NCR5380_read(RESET_PARITY_INTERRUPT_REG); |
384 | NCR5380_write(MODE_REG, MR_ENABLE_EOP_INTR | MR_DMA_MODE); | 380 | NCR5380_write(MODE_REG, MR_ENABLE_EOP_INTR | MR_DMA_MODE); |
@@ -394,7 +390,7 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, | |||
394 | while (NCR5380_read(DTC_CONTROL_REG) & CSR_HOST_BUF_NOT_RDY) | 390 | while (NCR5380_read(DTC_CONTROL_REG) & CSR_HOST_BUF_NOT_RDY) |
395 | ++i; | 391 | ++i; |
396 | rtrc(3); | 392 | rtrc(3); |
397 | memcpy_toio(base + DTC_DATA_BUF, src, 128); | 393 | memcpy_toio(hostdata->base + DTC_DATA_BUF, src, 128); |
398 | src += 128; | 394 | src += 128; |
399 | len -= 128; | 395 | len -= 128; |
400 | } | 396 | } |
@@ -420,15 +416,15 @@ MODULE_LICENSE("GPL"); | |||
420 | 416 | ||
421 | static int dtc_release(struct Scsi_Host *shost) | 417 | static int dtc_release(struct Scsi_Host *shost) |
422 | { | 418 | { |
423 | NCR5380_local_declare(); | 419 | struct NCR5380_hostdata *hostdata = shost_priv(shost); |
424 | NCR5380_setup(shost); | 420 | |
425 | if (shost->irq != NO_IRQ) | 421 | if (shost->irq != NO_IRQ) |
426 | free_irq(shost->irq, shost); | 422 | free_irq(shost->irq, shost); |
427 | NCR5380_exit(shost); | 423 | NCR5380_exit(shost); |
428 | if (shost->io_port && shost->n_io_port) | 424 | if (shost->io_port && shost->n_io_port) |
429 | release_region(shost->io_port, shost->n_io_port); | 425 | release_region(shost->io_port, shost->n_io_port); |
430 | scsi_unregister(shost); | 426 | scsi_unregister(shost); |
431 | iounmap(base); | 427 | iounmap(hostdata->base); |
432 | return 0; | 428 | return 0; |
433 | } | 429 | } |
434 | 430 | ||
diff --git a/drivers/scsi/dtc.h b/drivers/scsi/dtc.h index 46483b280046..07b0ac98817c 100644 --- a/drivers/scsi/dtc.h +++ b/drivers/scsi/dtc.h | |||
@@ -21,13 +21,8 @@ | |||
21 | #define NCR5380_implementation_fields \ | 21 | #define NCR5380_implementation_fields \ |
22 | void __iomem *base | 22 | void __iomem *base |
23 | 23 | ||
24 | #define NCR5380_local_declare() \ | 24 | #define DTC_address(reg) \ |
25 | void __iomem *base | 25 | (((struct NCR5380_hostdata *)shost_priv(instance))->base + DTC_5380_OFFSET + reg) |
26 | |||
27 | #define NCR5380_setup(instance) \ | ||
28 | base = ((struct NCR5380_hostdata *)(instance)->hostdata)->base | ||
29 | |||
30 | #define DTC_address(reg) (base + DTC_5380_OFFSET + reg) | ||
31 | 26 | ||
32 | #define NCR5380_read(reg) (readb(DTC_address(reg))) | 27 | #define NCR5380_read(reg) (readb(DTC_address(reg))) |
33 | #define NCR5380_write(reg, value) (writeb(value, DTC_address(reg))) | 28 | #define NCR5380_write(reg, value) (writeb(value, DTC_address(reg))) |
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c index 4cca9734175e..21f8236df48f 100644 --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c | |||
@@ -459,9 +459,6 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt) | |||
459 | 459 | ||
460 | static int generic_NCR5380_release_resources(struct Scsi_Host *instance) | 460 | static int generic_NCR5380_release_resources(struct Scsi_Host *instance) |
461 | { | 461 | { |
462 | NCR5380_local_declare(); | ||
463 | NCR5380_setup(instance); | ||
464 | |||
465 | if (instance->irq != NO_IRQ) | 462 | if (instance->irq != NO_IRQ) |
466 | free_irq(instance->irq, instance); | 463 | free_irq(instance->irq, instance); |
467 | NCR5380_exit(instance); | 464 | NCR5380_exit(instance); |
@@ -520,13 +517,13 @@ generic_NCR5380_biosparam(struct scsi_device *sdev, struct block_device *bdev, | |||
520 | 517 | ||
521 | static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len) | 518 | static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len) |
522 | { | 519 | { |
520 | #ifdef SCSI_G_NCR5380_MEM | ||
521 | struct NCR5380_hostdata *hostdata = shost_priv(instance); | ||
522 | #endif | ||
523 | int blocks = len / 128; | 523 | int blocks = len / 128; |
524 | int start = 0; | 524 | int start = 0; |
525 | int bl; | 525 | int bl; |
526 | 526 | ||
527 | NCR5380_local_declare(); | ||
528 | NCR5380_setup(instance); | ||
529 | |||
530 | NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE | CSR_TRANS_DIR); | 527 | NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE | CSR_TRANS_DIR); |
531 | NCR5380_write(C400_BLOCK_COUNTER_REG, blocks); | 528 | NCR5380_write(C400_BLOCK_COUNTER_REG, blocks); |
532 | while (1) { | 529 | while (1) { |
@@ -547,7 +544,8 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, | |||
547 | } | 544 | } |
548 | #else | 545 | #else |
549 | /* implies SCSI_G_NCR5380_MEM */ | 546 | /* implies SCSI_G_NCR5380_MEM */ |
550 | memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128); | 547 | memcpy_fromio(dst + start, |
548 | hostdata->iomem + NCR53C400_host_buffer, 128); | ||
551 | #endif | 549 | #endif |
552 | start += 128; | 550 | start += 128; |
553 | blocks--; | 551 | blocks--; |
@@ -567,7 +565,8 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, | |||
567 | } | 565 | } |
568 | #else | 566 | #else |
569 | /* implies SCSI_G_NCR5380_MEM */ | 567 | /* implies SCSI_G_NCR5380_MEM */ |
570 | memcpy_fromio(dst + start, iomem + NCR53C400_host_buffer, 128); | 568 | memcpy_fromio(dst + start, |
569 | hostdata->iomem + NCR53C400_host_buffer, 128); | ||
571 | #endif | 570 | #endif |
572 | start += 128; | 571 | start += 128; |
573 | blocks--; | 572 | blocks--; |
@@ -604,14 +603,14 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, | |||
604 | 603 | ||
605 | static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len) | 604 | static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len) |
606 | { | 605 | { |
606 | #ifdef SCSI_G_NCR5380_MEM | ||
607 | struct NCR5380_hostdata *hostdata = shost_priv(instance); | ||
608 | #endif | ||
607 | int blocks = len / 128; | 609 | int blocks = len / 128; |
608 | int start = 0; | 610 | int start = 0; |
609 | int bl; | 611 | int bl; |
610 | int i; | 612 | int i; |
611 | 613 | ||
612 | NCR5380_local_declare(); | ||
613 | NCR5380_setup(instance); | ||
614 | |||
615 | NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE); | 614 | NCR5380_write(C400_CONTROL_STATUS_REG, CSR_BASE); |
616 | NCR5380_write(C400_BLOCK_COUNTER_REG, blocks); | 615 | NCR5380_write(C400_BLOCK_COUNTER_REG, blocks); |
617 | while (1) { | 616 | while (1) { |
@@ -632,7 +631,8 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, | |||
632 | } | 631 | } |
633 | #else | 632 | #else |
634 | /* implies SCSI_G_NCR5380_MEM */ | 633 | /* implies SCSI_G_NCR5380_MEM */ |
635 | memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128); | 634 | memcpy_toio(hostdata->iomem + NCR53C400_host_buffer, |
635 | src + start, 128); | ||
636 | #endif | 636 | #endif |
637 | start += 128; | 637 | start += 128; |
638 | blocks--; | 638 | blocks--; |
@@ -648,7 +648,8 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, | |||
648 | } | 648 | } |
649 | #else | 649 | #else |
650 | /* implies SCSI_G_NCR5380_MEM */ | 650 | /* implies SCSI_G_NCR5380_MEM */ |
651 | memcpy_toio(iomem + NCR53C400_host_buffer, src + start, 128); | 651 | memcpy_toio(hostdata->iomem + NCR53C400_host_buffer, |
652 | src + start, 128); | ||
652 | #endif | 653 | #endif |
653 | start += 128; | 654 | start += 128; |
654 | blocks--; | 655 | blocks--; |
diff --git a/drivers/scsi/g_NCR5380.h b/drivers/scsi/g_NCR5380.h index 6669a906a4f7..883c003394cf 100644 --- a/drivers/scsi/g_NCR5380.h +++ b/drivers/scsi/g_NCR5380.h | |||
@@ -46,17 +46,12 @@ | |||
46 | #define NCR5380_region_size 8 | 46 | #define NCR5380_region_size 8 |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | #define NCR5380_read(reg) (inb(NCR5380_map_name + (reg))) | 49 | #define NCR5380_read(reg) \ |
50 | #define NCR5380_write(reg, value) (outb((value), (NCR5380_map_name + (reg)))) | 50 | inb(instance->io_port + (reg)) |
51 | #define NCR5380_write(reg, value) \ | ||
52 | outb(value, instance->io_port + (reg)) | ||
51 | 53 | ||
52 | #define NCR5380_implementation_fields \ | 54 | #define NCR5380_implementation_fields /* none */ |
53 | NCR5380_map_type NCR5380_map_name | ||
54 | |||
55 | #define NCR5380_local_declare() \ | ||
56 | register NCR5380_implementation_fields | ||
57 | |||
58 | #define NCR5380_setup(instance) \ | ||
59 | NCR5380_map_name = (NCR5380_map_type)((instance)->NCR5380_instance_name) | ||
60 | 55 | ||
61 | #else | 56 | #else |
62 | /* therefore SCSI_G_NCR5380_MEM */ | 57 | /* therefore SCSI_G_NCR5380_MEM */ |
@@ -70,19 +65,16 @@ | |||
70 | #define NCR53C400_host_buffer 0x3900 | 65 | #define NCR53C400_host_buffer 0x3900 |
71 | #define NCR5380_region_size 0x3a00 | 66 | #define NCR5380_region_size 0x3a00 |
72 | 67 | ||
73 | #define NCR5380_read(reg) readb(iomem + NCR53C400_mem_base + (reg)) | 68 | #define NCR5380_read(reg) \ |
74 | #define NCR5380_write(reg, value) writeb(value, iomem + NCR53C400_mem_base + (reg)) | 69 | readb(((struct NCR5380_hostdata *)shost_priv(instance))->iomem + \ |
70 | NCR53C400_mem_base + (reg)) | ||
71 | #define NCR5380_write(reg, value) \ | ||
72 | writeb(value, ((struct NCR5380_hostdata *)shost_priv(instance))->iomem + \ | ||
73 | NCR53C400_mem_base + (reg)) | ||
75 | 74 | ||
76 | #define NCR5380_implementation_fields \ | 75 | #define NCR5380_implementation_fields \ |
77 | NCR5380_map_type NCR5380_map_name; \ | ||
78 | void __iomem *iomem; | 76 | void __iomem *iomem; |
79 | 77 | ||
80 | #define NCR5380_local_declare() \ | ||
81 | register void __iomem *iomem | ||
82 | |||
83 | #define NCR5380_setup(instance) \ | ||
84 | iomem = (((struct NCR5380_hostdata *)(instance)->hostdata)->iomem) | ||
85 | |||
86 | #endif | 78 | #endif |
87 | 79 | ||
88 | #define NCR5380_intr generic_NCR5380_intr | 80 | #define NCR5380_intr generic_NCR5380_intr |
diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c index d64a769b8155..e49a9b1d7c3d 100644 --- a/drivers/scsi/mac_scsi.c +++ b/drivers/scsi/mac_scsi.c | |||
@@ -32,11 +32,9 @@ | |||
32 | #define PSEUDO_DMA | 32 | #define PSEUDO_DMA |
33 | 33 | ||
34 | #define NCR5380_implementation_fields unsigned char *pdma_base | 34 | #define NCR5380_implementation_fields unsigned char *pdma_base |
35 | #define NCR5380_local_declare() struct Scsi_Host *_instance | ||
36 | #define NCR5380_setup(instance) _instance = instance | ||
37 | 35 | ||
38 | #define NCR5380_read(reg) macscsi_read(_instance, reg) | 36 | #define NCR5380_read(reg) macscsi_read(instance, reg) |
39 | #define NCR5380_write(reg, value) macscsi_write(_instance, reg, value) | 37 | #define NCR5380_write(reg, value) macscsi_write(instance, reg, value) |
40 | 38 | ||
41 | #define NCR5380_pread macscsi_pread | 39 | #define NCR5380_pread macscsi_pread |
42 | #define NCR5380_pwrite macscsi_pwrite | 40 | #define NCR5380_pwrite macscsi_pwrite |
@@ -129,9 +127,6 @@ static void mac_scsi_reset_boot(struct Scsi_Host *instance) | |||
129 | { | 127 | { |
130 | unsigned long end; | 128 | unsigned long end; |
131 | 129 | ||
132 | NCR5380_local_declare(); | ||
133 | NCR5380_setup(instance); | ||
134 | |||
135 | /* | 130 | /* |
136 | * Do a SCSI reset to clean up the bus during initialization. No messing | 131 | * Do a SCSI reset to clean up the bus during initialization. No messing |
137 | * with the queues, interrupts, or locks necessary here. | 132 | * with the queues, interrupts, or locks necessary here. |
@@ -235,9 +230,6 @@ static int macscsi_pread(struct Scsi_Host *instance, | |||
235 | unsigned char *d; | 230 | unsigned char *d; |
236 | unsigned char *s; | 231 | unsigned char *s; |
237 | 232 | ||
238 | NCR5380_local_declare(); | ||
239 | NCR5380_setup(instance); | ||
240 | |||
241 | s = hostdata->pdma_base + (INPUT_DATA_REG << 4); | 233 | s = hostdata->pdma_base + (INPUT_DATA_REG << 4); |
242 | d = dst; | 234 | d = dst; |
243 | 235 | ||
@@ -329,9 +321,6 @@ static int macscsi_pwrite(struct Scsi_Host *instance, | |||
329 | unsigned char *s; | 321 | unsigned char *s; |
330 | unsigned char *d; | 322 | unsigned char *d; |
331 | 323 | ||
332 | NCR5380_local_declare(); | ||
333 | NCR5380_setup(instance); | ||
334 | |||
335 | s = src; | 324 | s = src; |
336 | d = hostdata->pdma_base + (OUTPUT_DATA_REG << 4); | 325 | d = hostdata->pdma_base + (OUTPUT_DATA_REG << 4); |
337 | 326 | ||
diff --git a/drivers/scsi/pas16.c b/drivers/scsi/pas16.c index bf471a3c4e33..e147f5667f27 100644 --- a/drivers/scsi/pas16.c +++ b/drivers/scsi/pas16.c | |||
@@ -188,7 +188,7 @@ static void __init | |||
188 | outb( 0x01, io_port + P_TIMEOUT_STATUS_REG_OFFSET ); /* Reset TC */ | 188 | outb( 0x01, io_port + P_TIMEOUT_STATUS_REG_OFFSET ); /* Reset TC */ |
189 | outb( 0x01, io_port + WAIT_STATE ); /* 1 Wait state */ | 189 | outb( 0x01, io_port + WAIT_STATE ); /* 1 Wait state */ |
190 | 190 | ||
191 | NCR5380_read( RESET_PARITY_INTERRUPT_REG ); | 191 | inb(io_port + pas16_offset[RESET_PARITY_INTERRUPT_REG]); |
192 | 192 | ||
193 | /* Set the SCSI interrupt pointer without mucking up the sound | 193 | /* Set the SCSI interrupt pointer without mucking up the sound |
194 | * interrupt pointer in the same byte. | 194 | * interrupt pointer in the same byte. |
@@ -263,13 +263,13 @@ static int __init | |||
263 | * put in an additional test to try to weed them out. | 263 | * put in an additional test to try to weed them out. |
264 | */ | 264 | */ |
265 | 265 | ||
266 | outb( 0x01, io_port + WAIT_STATE ); /* 1 Wait state */ | 266 | outb(0x01, io_port + WAIT_STATE); /* 1 Wait state */ |
267 | NCR5380_write( MODE_REG, 0x20 ); /* Is it really SCSI? */ | 267 | outb(0x20, io_port + pas16_offset[MODE_REG]); /* Is it really SCSI? */ |
268 | if( NCR5380_read( MODE_REG ) != 0x20 ) /* Write to a reg. */ | 268 | if (inb(io_port + pas16_offset[MODE_REG]) != 0x20) /* Write to a reg. */ |
269 | return 0; /* and try to read */ | 269 | return 0; /* and try to read */ |
270 | NCR5380_write( MODE_REG, 0x00 ); /* it back. */ | 270 | outb(0x00, io_port + pas16_offset[MODE_REG]); /* it back. */ |
271 | if( NCR5380_read( MODE_REG ) != 0x00 ) | 271 | if (inb(io_port + pas16_offset[MODE_REG]) != 0x00) |
272 | return 0; | 272 | return 0; |
273 | 273 | ||
274 | return 1; | 274 | return 1; |
275 | } | 275 | } |
diff --git a/drivers/scsi/pas16.h b/drivers/scsi/pas16.h index 3634f3fc0325..7247b67fb111 100644 --- a/drivers/scsi/pas16.h +++ b/drivers/scsi/pas16.h | |||
@@ -103,16 +103,9 @@ | |||
103 | #define CAN_QUEUE 32 | 103 | #define CAN_QUEUE 32 |
104 | #endif | 104 | #endif |
105 | 105 | ||
106 | #define NCR5380_implementation_fields \ | 106 | #define NCR5380_implementation_fields /* none */ |
107 | volatile unsigned short io_port | ||
108 | 107 | ||
109 | #define NCR5380_local_declare() \ | 108 | #define PAS16_io_port(reg) (instance->io_port + pas16_offset[(reg)]) |
110 | volatile unsigned short io_port | ||
111 | |||
112 | #define NCR5380_setup(instance) \ | ||
113 | io_port = (instance)->io_port | ||
114 | |||
115 | #define PAS16_io_port(reg) ( io_port + pas16_offset[(reg)] ) | ||
116 | 109 | ||
117 | #define NCR5380_read(reg) ( inb(PAS16_io_port(reg)) ) | 110 | #define NCR5380_read(reg) ( inb(PAS16_io_port(reg)) ) |
118 | #define NCR5380_write(reg, value) ( outb((value),PAS16_io_port(reg)) ) | 111 | #define NCR5380_write(reg, value) ( outb((value),PAS16_io_port(reg)) ) |
diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index 339f018f8950..d06ae1d11ca4 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c | |||
@@ -248,15 +248,15 @@ found: | |||
248 | 248 | ||
249 | static int t128_release(struct Scsi_Host *shost) | 249 | static int t128_release(struct Scsi_Host *shost) |
250 | { | 250 | { |
251 | NCR5380_local_declare(); | 251 | struct NCR5380_hostdata *hostdata = shost_priv(shost); |
252 | NCR5380_setup(shost); | 252 | |
253 | if (shost->irq != NO_IRQ) | 253 | if (shost->irq != NO_IRQ) |
254 | free_irq(shost->irq, shost); | 254 | free_irq(shost->irq, shost); |
255 | NCR5380_exit(shost); | 255 | NCR5380_exit(shost); |
256 | if (shost->io_port && shost->n_io_port) | 256 | if (shost->io_port && shost->n_io_port) |
257 | release_region(shost->io_port, shost->n_io_port); | 257 | release_region(shost->io_port, shost->n_io_port); |
258 | scsi_unregister(shost); | 258 | scsi_unregister(shost); |
259 | iounmap(base); | 259 | iounmap(hostdata->base); |
260 | return 0; | 260 | return 0; |
261 | } | 261 | } |
262 | 262 | ||
@@ -302,14 +302,14 @@ static int t128_biosparam(struct scsi_device *sdev, struct block_device *bdev, | |||
302 | * timeout. | 302 | * timeout. |
303 | */ | 303 | */ |
304 | 304 | ||
305 | static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst, | 305 | static inline int |
306 | int len) { | 306 | NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, int len) |
307 | NCR5380_local_declare(); | 307 | { |
308 | void __iomem *reg; | 308 | struct NCR5380_hostdata *hostdata = shost_priv(instance); |
309 | void __iomem *reg, *base = hostdata->base; | ||
309 | unsigned char *d = dst; | 310 | unsigned char *d = dst; |
310 | register int i = len; | 311 | register int i = len; |
311 | 312 | ||
312 | NCR5380_setup(instance); | ||
313 | reg = base + T_DATA_REG_OFFSET; | 313 | reg = base + T_DATA_REG_OFFSET; |
314 | 314 | ||
315 | #if 0 | 315 | #if 0 |
@@ -348,14 +348,14 @@ static inline int NCR5380_pread (struct Scsi_Host *instance, unsigned char *dst, | |||
348 | * timeout. | 348 | * timeout. |
349 | */ | 349 | */ |
350 | 350 | ||
351 | static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src, | 351 | static inline int |
352 | int len) { | 352 | NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len) |
353 | NCR5380_local_declare(); | 353 | { |
354 | void __iomem *reg; | 354 | struct NCR5380_hostdata *hostdata = shost_priv(instance); |
355 | void __iomem *reg, *base = hostdata->base; | ||
355 | unsigned char *s = src; | 356 | unsigned char *s = src; |
356 | register int i = len; | 357 | register int i = len; |
357 | 358 | ||
358 | NCR5380_setup(instance); | ||
359 | reg = base + T_DATA_REG_OFFSET; | 359 | reg = base + T_DATA_REG_OFFSET; |
360 | 360 | ||
361 | #if 0 | 361 | #if 0 |
diff --git a/drivers/scsi/t128.h b/drivers/scsi/t128.h index cdcde3e672fa..ca93c97cf4ba 100644 --- a/drivers/scsi/t128.h +++ b/drivers/scsi/t128.h | |||
@@ -78,13 +78,8 @@ | |||
78 | #define NCR5380_implementation_fields \ | 78 | #define NCR5380_implementation_fields \ |
79 | void __iomem *base | 79 | void __iomem *base |
80 | 80 | ||
81 | #define NCR5380_local_declare() \ | 81 | #define T128_address(reg) \ |
82 | void __iomem *base | 82 | (((struct NCR5380_hostdata *)shost_priv(instance))->base + T_5380_OFFSET + ((reg) * 0x20)) |
83 | |||
84 | #define NCR5380_setup(instance) \ | ||
85 | base = ((struct NCR5380_hostdata *)(instance->hostdata))->base | ||
86 | |||
87 | #define T128_address(reg) (base + T_5380_OFFSET + ((reg) * 0x20)) | ||
88 | 83 | ||
89 | #define NCR5380_read(reg) readb(T128_address(reg)) | 84 | #define NCR5380_read(reg) readb(T128_address(reg)) |
90 | #define NCR5380_write(reg, value) writeb((value),(T128_address(reg))) | 85 | #define NCR5380_write(reg, value) writeb((value),(T128_address(reg))) |