aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pcmcia/nsp_message.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/scsi/pcmcia/nsp_message.c
Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/scsi/pcmcia/nsp_message.c')
-rw-r--r--drivers/scsi/pcmcia/nsp_message.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/drivers/scsi/pcmcia/nsp_message.c b/drivers/scsi/pcmcia/nsp_message.c
new file mode 100644
index 00000000000..d7057737ff3
--- /dev/null
+++ b/drivers/scsi/pcmcia/nsp_message.c
@@ -0,0 +1,78 @@
1/*==========================================================================
2 NinjaSCSI-3 message handler
3 By: YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>
4
5 This software may be used and distributed according to the terms of
6 the GNU General Public License.
7 */
8
9/* $Id: nsp_message.c,v 1.6 2003/07/26 14:21:09 elca Exp $ */
10
11static void nsp_message_in(Scsi_Cmnd *SCpnt)
12{
13 unsigned int base = SCpnt->device->host->io_port;
14 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
15 unsigned char data_reg, control_reg;
16 int ret, len;
17
18 /*
19 * XXX: NSP QUIRK
20 * NSP invoke interrupts only in the case of scsi phase changes,
21 * therefore we should poll the scsi phase here to catch
22 * the next "msg in" if exists (no scsi phase changes).
23 */
24 ret = 16;
25 len = 0;
26
27 nsp_dbg(NSP_DEBUG_MSGINOCCUR, "msgin loop");
28 do {
29 /* read data */
30 data_reg = nsp_index_read(base, SCSIDATAIN);
31
32 /* assert ACK */
33 control_reg = nsp_index_read(base, SCSIBUSCTRL);
34 control_reg |= SCSI_ACK;
35 nsp_index_write(base, SCSIBUSCTRL, control_reg);
36 nsp_negate_signal(SCpnt, BUSMON_REQ, "msgin<REQ>");
37
38 data->MsgBuffer[len] = data_reg; len++;
39
40 /* deassert ACK */
41 control_reg = nsp_index_read(base, SCSIBUSCTRL);
42 control_reg &= ~SCSI_ACK;
43 nsp_index_write(base, SCSIBUSCTRL, control_reg);
44
45 /* catch a next signal */
46 ret = nsp_expect_signal(SCpnt, BUSPHASE_MESSAGE_IN, BUSMON_REQ);
47 } while (ret > 0 && MSGBUF_SIZE > len);
48
49 data->MsgLen = len;
50
51}
52
53static void nsp_message_out(Scsi_Cmnd *SCpnt)
54{
55 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
56 int ret = 1;
57 int len = data->MsgLen;
58
59 /*
60 * XXX: NSP QUIRK
61 * NSP invoke interrupts only in the case of scsi phase changes,
62 * therefore we should poll the scsi phase here to catch
63 * the next "msg out" if exists (no scsi phase changes).
64 */
65
66 nsp_dbg(NSP_DEBUG_MSGOUTOCCUR, "msgout loop");
67 do {
68 if (nsp_xfer(SCpnt, BUSPHASE_MESSAGE_OUT)) {
69 nsp_msg(KERN_DEBUG, "msgout: xfer short");
70 }
71
72 /* catch a next signal */
73 ret = nsp_expect_signal(SCpnt, BUSPHASE_MESSAGE_OUT, BUSMON_REQ);
74 } while (ret > 0 && len-- > 0);
75
76}
77
78/* end */