aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/atari_NCR5380.c33
-rw-r--r--drivers/scsi/atari_scsi.c6
-rw-r--r--drivers/scsi/atari_scsi.h144
3 files changed, 49 insertions, 134 deletions
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 81e4f566b6c8..c912733ac077 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -272,8 +272,9 @@ static struct scsi_host_template *the_template = NULL;
272 (struct NCR5380_hostdata *)(in)->hostdata 272 (struct NCR5380_hostdata *)(in)->hostdata
273#define HOSTDATA(in) ((struct NCR5380_hostdata *)(in)->hostdata) 273#define HOSTDATA(in) ((struct NCR5380_hostdata *)(in)->hostdata)
274 274
275#define NEXT(cmd) ((cmd)->host_scribble) 275#define NEXT(cmd) ((Scsi_Cmnd *)(cmd)->host_scribble)
276#define NEXTADDR(cmd) ((Scsi_Cmnd **)&((cmd)->host_scribble)) 276#define SET_NEXT(cmd,next) ((cmd)->host_scribble = (void *)(next))
277#define NEXTADDR(cmd) ((Scsi_Cmnd **)&(cmd)->host_scribble)
277 278
278#define HOSTNO instance->host_no 279#define HOSTNO instance->host_no
279#define H_NO(cmd) (cmd)->device->host->host_no 280#define H_NO(cmd) (cmd)->device->host->host_no
@@ -479,7 +480,7 @@ static void merge_contiguous_buffers(Scsi_Cmnd *cmd)
479 virt_to_phys(page_address(cmd->SCp.buffer[1].page) + 480 virt_to_phys(page_address(cmd->SCp.buffer[1].page) +
480 cmd->SCp.buffer[1].offset) == endaddr;) { 481 cmd->SCp.buffer[1].offset) == endaddr;) {
481 MER_PRINTK("VTOP(%p) == %08lx -> merging\n", 482 MER_PRINTK("VTOP(%p) == %08lx -> merging\n",
482 cmd->SCp.buffer[1].address, endaddr); 483 page_address(cmd->SCp.buffer[1].page), endaddr);
483#if (NDEBUG & NDEBUG_MERGING) 484#if (NDEBUG & NDEBUG_MERGING)
484 ++cnt; 485 ++cnt;
485#endif 486#endif
@@ -1002,7 +1003,7 @@ static int NCR5380_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
1002 * in a queue 1003 * in a queue
1003 */ 1004 */
1004 1005
1005 NEXT(cmd) = NULL; 1006 SET_NEXT(cmd, NULL);
1006 cmd->scsi_done = done; 1007 cmd->scsi_done = done;
1007 1008
1008 cmd->result = 0; 1009 cmd->result = 0;
@@ -1034,14 +1035,14 @@ static int NCR5380_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
1034 } 1035 }
1035 if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) { 1036 if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) {
1036 LIST(cmd, hostdata->issue_queue); 1037 LIST(cmd, hostdata->issue_queue);
1037 NEXT(cmd) = hostdata->issue_queue; 1038 SET_NEXT(cmd, hostdata->issue_queue);
1038 hostdata->issue_queue = cmd; 1039 hostdata->issue_queue = cmd;
1039 } else { 1040 } else {
1040 for (tmp = (Scsi_Cmnd *)hostdata->issue_queue; 1041 for (tmp = (Scsi_Cmnd *)hostdata->issue_queue;
1041 NEXT(tmp); tmp = NEXT(tmp)) 1042 NEXT(tmp); tmp = NEXT(tmp))
1042 ; 1043 ;
1043 LIST(cmd, tmp); 1044 LIST(cmd, tmp);
1044 NEXT(tmp) = cmd; 1045 SET_NEXT(tmp, cmd);
1045 } 1046 }
1046 local_irq_restore(flags); 1047 local_irq_restore(flags);
1047 1048
@@ -1149,12 +1150,12 @@ static void NCR5380_main(void *bl)
1149 local_irq_disable(); 1150 local_irq_disable();
1150 if (prev) { 1151 if (prev) {
1151 REMOVE(prev, NEXT(prev), tmp, NEXT(tmp)); 1152 REMOVE(prev, NEXT(prev), tmp, NEXT(tmp));
1152 NEXT(prev) = NEXT(tmp); 1153 SET_NEXT(prev, NEXT(tmp));
1153 } else { 1154 } else {
1154 REMOVE(-1, hostdata->issue_queue, tmp, NEXT(tmp)); 1155 REMOVE(-1, hostdata->issue_queue, tmp, NEXT(tmp));
1155 hostdata->issue_queue = NEXT(tmp); 1156 hostdata->issue_queue = NEXT(tmp);
1156 } 1157 }
1157 NEXT(tmp) = NULL; 1158 SET_NEXT(tmp, NULL);
1158 falcon_dont_release++; 1159 falcon_dont_release++;
1159 1160
1160 /* reenable interrupts after finding one */ 1161 /* reenable interrupts after finding one */
@@ -1192,7 +1193,7 @@ static void NCR5380_main(void *bl)
1192 } else { 1193 } else {
1193 local_irq_disable(); 1194 local_irq_disable();
1194 LIST(tmp, hostdata->issue_queue); 1195 LIST(tmp, hostdata->issue_queue);
1195 NEXT(tmp) = hostdata->issue_queue; 1196 SET_NEXT(tmp, hostdata->issue_queue);
1196 hostdata->issue_queue = tmp; 1197 hostdata->issue_queue = tmp;
1197#ifdef SUPPORT_TAGS 1198#ifdef SUPPORT_TAGS
1198 cmd_free_tag(tmp); 1199 cmd_free_tag(tmp);
@@ -2295,7 +2296,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
2295 2296
2296 local_irq_save(flags); 2297 local_irq_save(flags);
2297 LIST(cmd,hostdata->issue_queue); 2298 LIST(cmd,hostdata->issue_queue);
2298 NEXT(cmd) = hostdata->issue_queue; 2299 SET_NEXT(cmd, hostdata->issue_queue);
2299 hostdata->issue_queue = (Scsi_Cmnd *) cmd; 2300 hostdata->issue_queue = (Scsi_Cmnd *) cmd;
2300 local_irq_restore(flags); 2301 local_irq_restore(flags);
2301 QU_PRINTK("scsi%d: REQUEST SENSE added to head of " 2302 QU_PRINTK("scsi%d: REQUEST SENSE added to head of "
@@ -2357,7 +2358,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
2357 local_irq_save(flags); 2358 local_irq_save(flags);
2358 cmd->device->disconnect = 1; 2359 cmd->device->disconnect = 1;
2359 LIST(cmd,hostdata->disconnected_queue); 2360 LIST(cmd,hostdata->disconnected_queue);
2360 NEXT(cmd) = hostdata->disconnected_queue; 2361 SET_NEXT(cmd, hostdata->disconnected_queue);
2361 hostdata->connected = NULL; 2362 hostdata->connected = NULL;
2362 hostdata->disconnected_queue = cmd; 2363 hostdata->disconnected_queue = cmd;
2363 local_irq_restore(flags); 2364 local_irq_restore(flags);
@@ -2632,12 +2633,12 @@ static void NCR5380_reselect(struct Scsi_Host *instance)
2632 falcon_dont_release++; 2633 falcon_dont_release++;
2633 if (prev) { 2634 if (prev) {
2634 REMOVE(prev, NEXT(prev), tmp, NEXT(tmp)); 2635 REMOVE(prev, NEXT(prev), tmp, NEXT(tmp));
2635 NEXT(prev) = NEXT(tmp); 2636 SET_NEXT(prev, NEXT(tmp));
2636 } else { 2637 } else {
2637 REMOVE(-1, hostdata->disconnected_queue, tmp, NEXT(tmp)); 2638 REMOVE(-1, hostdata->disconnected_queue, tmp, NEXT(tmp));
2638 hostdata->disconnected_queue = NEXT(tmp); 2639 hostdata->disconnected_queue = NEXT(tmp);
2639 } 2640 }
2640 NEXT(tmp) = NULL; 2641 SET_NEXT(tmp, NULL);
2641 break; 2642 break;
2642 } 2643 }
2643 } 2644 }
@@ -2769,7 +2770,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
2769 if (cmd == tmp) { 2770 if (cmd == tmp) {
2770 REMOVE(5, *prev, tmp, NEXT(tmp)); 2771 REMOVE(5, *prev, tmp, NEXT(tmp));
2771 (*prev) = NEXT(tmp); 2772 (*prev) = NEXT(tmp);
2772 NEXT(tmp) = NULL; 2773 SET_NEXT(tmp, NULL);
2773 tmp->result = DID_ABORT << 16; 2774 tmp->result = DID_ABORT << 16;
2774 local_irq_restore(flags); 2775 local_irq_restore(flags);
2775 ABRT_PRINTK("scsi%d: abort removed command from issue queue.\n", 2776 ABRT_PRINTK("scsi%d: abort removed command from issue queue.\n",
@@ -2844,7 +2845,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
2844 if (cmd == tmp) { 2845 if (cmd == tmp) {
2845 REMOVE(5, *prev, tmp, NEXT(tmp)); 2846 REMOVE(5, *prev, tmp, NEXT(tmp));
2846 *prev = NEXT(tmp); 2847 *prev = NEXT(tmp);
2847 NEXT(tmp) = NULL; 2848 SET_NEXT(tmp, NULL);
2848 tmp->result = DID_ABORT << 16; 2849 tmp->result = DID_ABORT << 16;
2849 /* We must unlock the tag/LUN immediately here, since the 2850 /* We must unlock the tag/LUN immediately here, since the
2850 * target goes to BUS FREE and doesn't send us another 2851 * target goes to BUS FREE and doesn't send us another
@@ -2965,7 +2966,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
2965 2966
2966 for (i = 0; (cmd = disconnected_queue); ++i) { 2967 for (i = 0; (cmd = disconnected_queue); ++i) {
2967 disconnected_queue = NEXT(cmd); 2968 disconnected_queue = NEXT(cmd);
2968 NEXT(cmd) = NULL; 2969 SET_NEXT(cmd, NULL);
2969 cmd->result = (cmd->result & 0xffff) | (DID_RESET << 16); 2970 cmd->result = (cmd->result & 0xffff) | (DID_RESET << 16);
2970 cmd->scsi_done(cmd); 2971 cmd->scsi_done(cmd);
2971 } 2972 }
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index f766d0d81c99..6f8403b82ba1 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -69,9 +69,9 @@
69 69
70#define NDEBUG (0) 70#define NDEBUG (0)
71 71
72#define NDEBUG_ABORT 0x800000 72#define NDEBUG_ABORT 0x00100000
73#define NDEBUG_TAGS 0x1000000 73#define NDEBUG_TAGS 0x00200000
74#define NDEBUG_MERGING 0x2000000 74#define NDEBUG_MERGING 0x00400000
75 75
76#define AUTOSENSE 76#define AUTOSENSE
77/* For the Atari version, use only polled IO or REAL_DMA */ 77/* For the Atari version, use only polled IO or REAL_DMA */
diff --git a/drivers/scsi/atari_scsi.h b/drivers/scsi/atari_scsi.h
index 75b549b2dfc1..efadb8d567c2 100644
--- a/drivers/scsi/atari_scsi.h
+++ b/drivers/scsi/atari_scsi.h
@@ -113,144 +113,58 @@ int atari_scsi_release (struct Scsi_Host *);
113 * 113 *
114 */ 114 */
115 115
116#if NDEBUG & NDEBUG_ARBITRATION 116#define dprint(flg, format...) \
117({ \
118 if (NDEBUG & (flg)) \
119 printk(KERN_DEBUG format); \
120})
121
117#define ARB_PRINTK(format, args...) \ 122#define ARB_PRINTK(format, args...) \
118 printk(KERN_DEBUG format , ## args) 123 dprint(NDEBUG_ARBITRATION, format , ## args)
119#else
120#define ARB_PRINTK(format, args...)
121#endif
122#if NDEBUG & NDEBUG_AUTOSENSE
123#define ASEN_PRINTK(format, args...) \ 124#define ASEN_PRINTK(format, args...) \
124 printk(KERN_DEBUG format , ## args) 125 dprint(NDEBUG_AUTOSENSE, format , ## args)
125#else
126#define ASEN_PRINTK(format, args...)
127#endif
128#if NDEBUG & NDEBUG_DMA
129#define DMA_PRINTK(format, args...) \ 126#define DMA_PRINTK(format, args...) \
130 printk(KERN_DEBUG format , ## args) 127 dprint(NDEBUG_DMA, format , ## args)
131#else
132#define DMA_PRINTK(format, args...)
133#endif
134#if NDEBUG & NDEBUG_HANDSHAKE
135#define HSH_PRINTK(format, args...) \ 128#define HSH_PRINTK(format, args...) \
136 printk(KERN_DEBUG format , ## args) 129 dprint(NDEBUG_HANDSHAKE, format , ## args)
137#else
138#define HSH_PRINTK(format, args...)
139#endif
140#if NDEBUG & NDEBUG_INFORMATION
141#define INF_PRINTK(format, args...) \ 130#define INF_PRINTK(format, args...) \
142 printk(KERN_DEBUG format , ## args) 131 dprint(NDEBUG_INFORMATION, format , ## args)
143#else
144#define INF_PRINTK(format, args...)
145#endif
146#if NDEBUG & NDEBUG_INIT
147#define INI_PRINTK(format, args...) \ 132#define INI_PRINTK(format, args...) \
148 printk(KERN_DEBUG format , ## args) 133 dprint(NDEBUG_INIT, format , ## args)
149#else
150#define INI_PRINTK(format, args...)
151#endif
152#if NDEBUG & NDEBUG_INTR
153#define INT_PRINTK(format, args...) \ 134#define INT_PRINTK(format, args...) \
154 printk(KERN_DEBUG format , ## args) 135 dprint(NDEBUG_INTR, format , ## args)
155#else
156#define INT_PRINTK(format, args...)
157#endif
158#if NDEBUG & NDEBUG_LINKED
159#define LNK_PRINTK(format, args...) \ 136#define LNK_PRINTK(format, args...) \
160 printk(KERN_DEBUG format , ## args) 137 dprint(NDEBUG_LINKED, format , ## args)
161#else
162#define LNK_PRINTK(format, args...)
163#endif
164#if NDEBUG & NDEBUG_MAIN
165#define MAIN_PRINTK(format, args...) \ 138#define MAIN_PRINTK(format, args...) \
166 printk(KERN_DEBUG format , ## args) 139 dprint(NDEBUG_MAIN, format , ## args)
167#else
168#define MAIN_PRINTK(format, args...)
169#endif
170#if NDEBUG & NDEBUG_NO_DATAOUT
171#define NDAT_PRINTK(format, args...) \ 140#define NDAT_PRINTK(format, args...) \
172 printk(KERN_DEBUG format , ## args) 141 dprint(NDEBUG_NO_DATAOUT, format , ## args)
173#else
174#define NDAT_PRINTK(format, args...)
175#endif
176#if NDEBUG & NDEBUG_NO_WRITE
177#define NWR_PRINTK(format, args...) \ 142#define NWR_PRINTK(format, args...) \
178 printk(KERN_DEBUG format , ## args) 143 dprint(NDEBUG_NO_WRITE, format , ## args)
179#else
180#define NWR_PRINTK(format, args...)
181#endif
182#if NDEBUG & NDEBUG_PIO
183#define PIO_PRINTK(format, args...) \ 144#define PIO_PRINTK(format, args...) \
184 printk(KERN_DEBUG format , ## args) 145 dprint(NDEBUG_PIO, format , ## args)
185#else
186#define PIO_PRINTK(format, args...)
187#endif
188#if NDEBUG & NDEBUG_PSEUDO_DMA
189#define PDMA_PRINTK(format, args...) \ 146#define PDMA_PRINTK(format, args...) \
190 printk(KERN_DEBUG format , ## args) 147 dprint(NDEBUG_PSEUDO_DMA, format , ## args)
191#else
192#define PDMA_PRINTK(format, args...)
193#endif
194#if NDEBUG & NDEBUG_QUEUES
195#define QU_PRINTK(format, args...) \ 148#define QU_PRINTK(format, args...) \
196 printk(KERN_DEBUG format , ## args) 149 dprint(NDEBUG_QUEUES, format , ## args)
197#else
198#define QU_PRINTK(format, args...)
199#endif
200#if NDEBUG & NDEBUG_RESELECTION
201#define RSL_PRINTK(format, args...) \ 150#define RSL_PRINTK(format, args...) \
202 printk(KERN_DEBUG format , ## args) 151 dprint(NDEBUG_RESELECTION, format , ## args)
203#else
204#define RSL_PRINTK(format, args...)
205#endif
206#if NDEBUG & NDEBUG_SELECTION
207#define SEL_PRINTK(format, args...) \ 152#define SEL_PRINTK(format, args...) \
208 printk(KERN_DEBUG format , ## args) 153 dprint(NDEBUG_SELECTION, format , ## args)
209#else
210#define SEL_PRINTK(format, args...)
211#endif
212#if NDEBUG & NDEBUG_USLEEP
213#define USL_PRINTK(format, args...) \ 154#define USL_PRINTK(format, args...) \
214 printk(KERN_DEBUG format , ## args) 155 dprint(NDEBUG_USLEEP, format , ## args)
215#else
216#define USL_PRINTK(format, args...)
217#endif
218#if NDEBUG & NDEBUG_LAST_BYTE_SENT
219#define LBS_PRINTK(format, args...) \ 156#define LBS_PRINTK(format, args...) \
220 printk(KERN_DEBUG format , ## args) 157 dprint(NDEBUG_LAST_BYTE_SENT, format , ## args)
221#else
222#define LBS_PRINTK(format, args...)
223#endif
224#if NDEBUG & NDEBUG_RESTART_SELECT
225#define RSS_PRINTK(format, args...) \ 158#define RSS_PRINTK(format, args...) \
226 printk(KERN_DEBUG format , ## args) 159 dprint(NDEBUG_RESTART_SELECT, format , ## args)
227#else
228#define RSS_PRINTK(format, args...)
229#endif
230#if NDEBUG & NDEBUG_EXTENDED
231#define EXT_PRINTK(format, args...) \ 160#define EXT_PRINTK(format, args...) \
232 printk(KERN_DEBUG format , ## args) 161 dprint(NDEBUG_EXTENDED, format , ## args)
233#else
234#define EXT_PRINTK(format, args...)
235#endif
236#if NDEBUG & NDEBUG_ABORT
237#define ABRT_PRINTK(format, args...) \ 162#define ABRT_PRINTK(format, args...) \
238 printk(KERN_DEBUG format , ## args) 163 dprint(NDEBUG_ABORT, format , ## args)
239#else
240#define ABRT_PRINTK(format, args...)
241#endif
242#if NDEBUG & NDEBUG_TAGS
243#define TAG_PRINTK(format, args...) \ 164#define TAG_PRINTK(format, args...) \
244 printk(KERN_DEBUG format , ## args) 165 dprint(NDEBUG_TAGS, format , ## args)
245#else
246#define TAG_PRINTK(format, args...)
247#endif
248#if NDEBUG & NDEBUG_MERGING
249#define MER_PRINTK(format, args...) \ 166#define MER_PRINTK(format, args...) \
250 printk(KERN_DEBUG format , ## args) 167 dprint(NDEBUG_MERGING, format , ## args)
251#else
252#define MER_PRINTK(format, args...)
253#endif
254 168
255/* conditional macros for NCR5380_print_{,phase,status} */ 169/* conditional macros for NCR5380_print_{,phase,status} */
256 170