21 #include <linux/kernel.h>
22 #include <linux/types.h>
23 #include <linux/module.h>
41 #define host_to_hostdata(host) ((struct ip22_hostdata *)((host)->hostdata))
49 #define HPC_DMA_SIZE PAGE_SIZE
51 #define DMA_DIR(d) ((d == DATA_OUT_DIR) ? DMA_TO_DEVICE : DMA_FROM_DEVICE)
60 spin_unlock_irqrestore(host->
host_lock, flags);
68 unsigned long len = cmd->
SCp.this_residual;
75 cmd->
SCp.dma_handle = physaddr;
83 count = len > 8192 ? 8192 : len;
84 hcp->
desc.pbuf = physaddr;
99 (
unsigned long)(hcp + 1) - (
unsigned long)hd->
cpu,
103 static int dma_setup(
struct scsi_cmnd *cmd,
int datainp)
109 pr_debug(
"dma_setup: datainp<%d> hcp<%p> ", datainp, hdata->
cpu);
111 hdata->
wh.dma_dir = datainp;
119 if (cmd->
SCp.ptr ==
NULL || cmd->
SCp.this_residual == 0)
122 fill_hpc_entries(hdata, cmd, datainp);
145 if (SCpnt->
SCp.ptr ==
NULL || SCpnt->
SCp.this_residual == 0)
150 pr_debug(
"dma_stop: status<%d> ", status);
153 if (hdata->
wh.dma_dir) {
160 SCpnt->
SCp.this_residual,
176 static inline void init_hpc_chain(
struct ip22_hostdata *hdata)
182 start = (
unsigned long) hcp;
184 while (start <
end) {
195 static int sgiwd93_bus_reset(
struct scsi_cmnd *cmd)
202 spin_lock_irq(cmd->
device->host->host_lock);
204 spin_unlock_irq(cmd->
device->host->host_lock);
216 .proc_name =
"SGIWD93",
220 .eh_bus_reset_handler = sgiwd93_bus_reset,
238 unsigned int irq = pd->
irq;
256 "host %d buffer.\n", unit);
261 init_hpc_chain(hdata);
263 regs.
SASR = wdregs + 3;
264 regs.
SCMD = wdregs + 7;
266 hdata->
wh.no_sync = 0;
272 err =
request_irq(irq, sgiwd93_intr, 0,
"SGI WD93", host);
275 "for host %d.\n", irq, unit);
279 platform_set_drvdata(pdev, host);
281 err = scsi_add_host(host,
NULL);
302 struct Scsi_Host *host = platform_get_drvdata(pdev);
314 .probe = sgiwd93_probe,
322 static int __init sgiwd93_module_init(
void)
327 static void __exit sgiwd93_module_exit(
void)