a3000.c (5a84d159061d914c8dd4aa372ac6e9529c2be453) a3000.c (cc0455fac06f0539277d7b724dbc513284629069)
1#include <linux/types.h>
2#include <linux/mm.h>
3#include <linux/blkdev.h>
4#include <linux/ioport.h>
5#include <linux/init.h>
6#include <linux/spinlock.h>
7#include <linux/interrupt.h>
8

--- 56 unchanged lines hidden (view full) ---

65 /* can't allocate memory; use PIO */
66 if (!HDATA(a3000_host)->dma_bounce_buffer) {
67 HDATA(a3000_host)->dma_bounce_len = 0;
68 return 1;
69 }
70
71 if (!dir_in) {
72 /* copy to bounce buffer for a write */
1#include <linux/types.h>
2#include <linux/mm.h>
3#include <linux/blkdev.h>
4#include <linux/ioport.h>
5#include <linux/init.h>
6#include <linux/spinlock.h>
7#include <linux/interrupt.h>
8

--- 56 unchanged lines hidden (view full) ---

65 /* can't allocate memory; use PIO */
66 if (!HDATA(a3000_host)->dma_bounce_buffer) {
67 HDATA(a3000_host)->dma_bounce_len = 0;
68 return 1;
69 }
70
71 if (!dir_in) {
72 /* copy to bounce buffer for a write */
73 if (cmd->use_sg) {
74 memcpy (HDATA(a3000_host)->dma_bounce_buffer,
75 cmd->SCp.ptr, cmd->SCp.this_residual);
76 } else
77 memcpy (HDATA(a3000_host)->dma_bounce_buffer,
78 cmd->request_buffer, cmd->request_bufflen);
73 memcpy (HDATA(a3000_host)->dma_bounce_buffer,
74 cmd->SCp.ptr, cmd->SCp.this_residual);
79 }
80
81 addr = virt_to_bus(HDATA(a3000_host)->dma_bounce_buffer);
82 }
83
84 /* setup dma direction */
85 if (!dir_in)
86 cntr |= CNTR_DDIR;

--- 54 unchanged lines hidden (view full) ---

141 mb(); /* make sure DMA is stopped before next IO */
142
143 /* restore the CONTROL bits (minus the direction flag) */
144 DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN;
145 mb(); /* make sure CNTR is updated before next IO */
146
147 /* copy from a bounce buffer, if necessary */
148 if (status && HDATA(instance)->dma_bounce_buffer) {
75 }
76
77 addr = virt_to_bus(HDATA(a3000_host)->dma_bounce_buffer);
78 }
79
80 /* setup dma direction */
81 if (!dir_in)
82 cntr |= CNTR_DDIR;

--- 54 unchanged lines hidden (view full) ---

137 mb(); /* make sure DMA is stopped before next IO */
138
139 /* restore the CONTROL bits (minus the direction flag) */
140 DMA(instance)->CNTR = CNTR_PDMD | CNTR_INTEN;
141 mb(); /* make sure CNTR is updated before next IO */
142
143 /* copy from a bounce buffer, if necessary */
144 if (status && HDATA(instance)->dma_bounce_buffer) {
149 if (SCpnt && SCpnt->use_sg) {
145 if (SCpnt) {
150 if (HDATA(instance)->dma_dir && SCpnt)
151 memcpy (SCpnt->SCp.ptr,
152 HDATA(instance)->dma_bounce_buffer,
153 SCpnt->SCp.this_residual);
154 kfree (HDATA(instance)->dma_bounce_buffer);
155 HDATA(instance)->dma_bounce_buffer = NULL;
156 HDATA(instance)->dma_bounce_len = 0;
157 } else {
146 if (HDATA(instance)->dma_dir && SCpnt)
147 memcpy (SCpnt->SCp.ptr,
148 HDATA(instance)->dma_bounce_buffer,
149 SCpnt->SCp.this_residual);
150 kfree (HDATA(instance)->dma_bounce_buffer);
151 HDATA(instance)->dma_bounce_buffer = NULL;
152 HDATA(instance)->dma_bounce_len = 0;
153 } else {
158 if (HDATA(instance)->dma_dir && SCpnt)
159 memcpy (SCpnt->request_buffer,
160 HDATA(instance)->dma_bounce_buffer,
161 SCpnt->request_bufflen);
162
163 kfree (HDATA(instance)->dma_bounce_buffer);
164 HDATA(instance)->dma_bounce_buffer = NULL;
165 HDATA(instance)->dma_bounce_len = 0;
166 }
167 }
168}
169
170int __init a3000_detect(struct scsi_host_template *tpnt)

--- 81 unchanged lines hidden ---
154 kfree (HDATA(instance)->dma_bounce_buffer);
155 HDATA(instance)->dma_bounce_buffer = NULL;
156 HDATA(instance)->dma_bounce_len = 0;
157 }
158 }
159}
160
161int __init a3000_detect(struct scsi_host_template *tpnt)

--- 81 unchanged lines hidden ---