mvme147.c (53555fb7bceb14f5fdb9358290daf64d0ea0f56a) mvme147.c (dbb2da557a6a87c88bbb4b1fef037091b57f701b)
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/types.h>
3#include <linux/mm.h>
4#include <linux/blkdev.h>
5#include <linux/interrupt.h>
6#include <linux/init.h>
7#include <linux/kernel.h>
8#include <linux/module.h>

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

28 wd33c93_intr(instance);
29 else
30 m147_pcc->dma_intr = 0x89; /* Ack and enable ints */
31 return IRQ_HANDLED;
32}
33
34static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
35{
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/types.h>
3#include <linux/mm.h>
4#include <linux/blkdev.h>
5#include <linux/interrupt.h>
6#include <linux/init.h>
7#include <linux/kernel.h>
8#include <linux/module.h>

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

28 wd33c93_intr(instance);
29 else
30 m147_pcc->dma_intr = 0x89; /* Ack and enable ints */
31 return IRQ_HANDLED;
32}
33
34static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
35{
36 struct scsi_pointer *scsi_pointer = WD33C93_scsi_pointer(cmd);
36 struct Scsi_Host *instance = cmd->device->host;
37 struct WD33C93_hostdata *hdata = shost_priv(instance);
38 unsigned char flags = 0x01;
37 struct Scsi_Host *instance = cmd->device->host;
38 struct WD33C93_hostdata *hdata = shost_priv(instance);
39 unsigned char flags = 0x01;
39 unsigned long addr = virt_to_bus(cmd->SCp.ptr);
40 unsigned long addr = virt_to_bus(scsi_pointer->ptr);
40
41 /* setup dma direction */
42 if (!dir_in)
43 flags |= 0x04;
44
45 /* remember direction */
46 hdata->dma_dir = dir_in;
47
48 if (dir_in) {
49 /* invalidate any cache */
41
42 /* setup dma direction */
43 if (!dir_in)
44 flags |= 0x04;
45
46 /* remember direction */
47 hdata->dma_dir = dir_in;
48
49 if (dir_in) {
50 /* invalidate any cache */
50 cache_clear(addr, cmd->SCp.this_residual);
51 cache_clear(addr, scsi_pointer->this_residual);
51 } else {
52 /* push any dirty cache */
52 } else {
53 /* push any dirty cache */
53 cache_push(addr, cmd->SCp.this_residual);
54 cache_push(addr, scsi_pointer->this_residual);
54 }
55
56 /* start DMA */
55 }
56
57 /* start DMA */
57 m147_pcc->dma_bcr = cmd->SCp.this_residual | (1 << 24);
58 m147_pcc->dma_bcr = scsi_pointer->this_residual | (1 << 24);
58 m147_pcc->dma_dadr = addr;
59 m147_pcc->dma_cntrl = flags;
60
61 /* return success */
62 return 0;
63}
64
65static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,

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

76 .eh_abort_handler = wd33c93_abort,
77 .eh_host_reset_handler = wd33c93_host_reset,
78 .show_info = wd33c93_show_info,
79 .write_info = wd33c93_write_info,
80 .can_queue = CAN_QUEUE,
81 .this_id = 7,
82 .sg_tablesize = SG_ALL,
83 .cmd_per_lun = CMD_PER_LUN,
59 m147_pcc->dma_dadr = addr;
60 m147_pcc->dma_cntrl = flags;
61
62 /* return success */
63 return 0;
64}
65
66static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,

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

77 .eh_abort_handler = wd33c93_abort,
78 .eh_host_reset_handler = wd33c93_host_reset,
79 .show_info = wd33c93_show_info,
80 .write_info = wd33c93_write_info,
81 .can_queue = CAN_QUEUE,
82 .this_id = 7,
83 .sg_tablesize = SG_ALL,
84 .cmd_per_lun = CMD_PER_LUN,
85 .cmd_size = sizeof(struct scsi_pointer),
84};
85
86static struct Scsi_Host *mvme147_shost;
87
88static int __init mvme147_init(void)
89{
90 wd33c93_regs regs;
91 struct WD33C93_hostdata *hdata;

--- 69 unchanged lines hidden ---
86};
87
88static struct Scsi_Host *mvme147_shost;
89
90static int __init mvme147_init(void)
91{
92 wd33c93_regs regs;
93 struct WD33C93_hostdata *hdata;

--- 69 unchanged lines hidden ---