OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [scsi/] [aha1740.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
#ifndef _AHA1740_H
2
 
3
/* $Id: aha1740.h,v 1.1.1.1 2004-04-15 02:09:46 phoenix Exp $
4
 *
5
 * Header file for the adaptec 1740 driver for Linux
6
 *
7
 * With minor revisions 3/31/93
8
 * Written and (C) 1992,1993 Brad McLean.  See aha1740.c
9
 * for more info
10
 *
11
 */
12
 
13
#include <linux/types.h>
14
#include <linux/kdev_t.h>
15
 
16
/* Eisa Enhanced mode operation - slot locating and addressing */
17
#define MINEISA 1   /* I don't have an EISA Spec to know these ranges, so I */
18
#define MAXEISA 8   /* Just took my machine's specifications.  Adjust to fit.*/
19
                    /* I just saw an ad, and bumped this from 6 to 8 */
20
#define SLOTBASE(x)     ((x << 12) + 0xc80)
21
#define SLOTSIZE        0x5c
22
 
23
/* EISA configuration registers & values */
24
#define HID0(base)      (base + 0x0)
25
#define HID1(base)      (base + 0x1)
26
#define HID2(base)      (base + 0x2)
27
#define HID3(base)      (base + 0x3)
28
#define EBCNTRL(base)   (base + 0x4)
29
#define PORTADR(base)   (base + 0x40)
30
#define BIOSADR(base)   (base + 0x41)
31
#define INTDEF(base)    (base + 0x42)
32
#define SCSIDEF(base)   (base + 0x43)
33
#define BUSDEF(base)    (base + 0x44)
34
#define RESV0(base)     (base + 0x45)
35
#define RESV1(base)     (base + 0x46)
36
#define RESV2(base)     (base + 0x47)
37
 
38
#define HID_MFG "ADP"
39
#define HID_PRD 0
40
#define HID_REV 2
41
#define EBCNTRL_VALUE 1
42
#define PORTADDR_ENH 0x80
43
/* READ */
44
#define G2INTST(base)   (base + 0x56)
45
#define G2STAT(base)    (base + 0x57)
46
#define MBOXIN0(base)   (base + 0x58)
47
#define MBOXIN1(base)   (base + 0x59)
48
#define MBOXIN2(base)   (base + 0x5a)
49
#define MBOXIN3(base)   (base + 0x5b)
50
#define G2STAT2(base)   (base + 0x5c)
51
 
52
#define G2INTST_MASK            0xf0    /* isolate the status */
53
#define G2INTST_CCBGOOD         0x10    /* CCB Completed */
54
#define G2INTST_CCBRETRY        0x50    /* CCB Completed with a retry */
55
#define G2INTST_HARDFAIL        0x70    /* Adapter Hardware Failure */
56
#define G2INTST_CMDGOOD         0xa0    /* Immediate command success */
57
#define G2INTST_CCBERROR        0xc0    /* CCB Completed with error */
58
#define G2INTST_ASNEVENT        0xd0    /* Asynchronous Event Notification */
59
#define G2INTST_CMDERROR        0xe0    /* Immediate command error */
60
 
61
#define G2STAT_MBXOUT   4       /* Mailbox Out Empty Bit */
62
#define G2STAT_INTPEND  2       /* Interrupt Pending Bit */
63
#define G2STAT_BUSY     1       /* Busy Bit (attention pending) */
64
 
65
#define G2STAT2_READY   0        /* Host Ready Bit */
66
 
67
/* WRITE (and ReadBack) */
68
#define MBOXOUT0(base)  (base + 0x50)
69
#define MBOXOUT1(base)  (base + 0x51)
70
#define MBOXOUT2(base)  (base + 0x52)
71
#define MBOXOUT3(base)  (base + 0x53)
72
#define ATTN(base)      (base + 0x54)
73
#define G2CNTRL(base)   (base + 0x55)
74
 
75
#define ATTN_IMMED      0x10    /* Immediate Command */
76
#define ATTN_START      0x40    /* Start CCB */
77
#define ATTN_ABORT      0x50    /* Abort CCB */
78
 
79
#define G2CNTRL_HRST    0x80            /* Hard Reset */
80
#define G2CNTRL_IRST    0x40            /* Clear EISA Interrupt */
81
#define G2CNTRL_HRDY    0x20            /* Sets HOST ready */
82
 
83
/* This is used with scatter-gather */
84
struct aha1740_chain {
85
  u32  dataptr;         /* Location of data */
86
  u32  datalen;         /* Size of this part of chain */
87
};
88
 
89
/* These belong in scsi.h */
90
#define any2scsi(up, p)                         \
91
(up)[0] = (((unsigned long)(p)) >> 16)  ;        \
92
(up)[1] = (((unsigned long)(p)) >> 8);          \
93
(up)[2] = ((unsigned long)(p));
94
 
95
#define scsi2int(up) ( (((long)*(up)) << 16) + (((long)(up)[1]) << 8) + ((long)(up)[2]) )
96
 
97
#define xany2scsi(up, p)        \
98
(up)[0] = ((long)(p)) >> 24;     \
99
(up)[1] = ((long)(p)) >> 16;    \
100
(up)[2] = ((long)(p)) >> 8;     \
101
(up)[3] = ((long)(p));
102
 
103
#define xscsi2int(up) ( (((long)(up)[0]) << 24) + (((long)(up)[1]) << 16) \
104
                      + (((long)(up)[2]) <<  8) +  ((long)(up)[3]) )
105
 
106
#define MAX_CDB 12
107
#define MAX_SENSE 14
108
#define MAX_STATUS 32
109
 
110
struct ecb {                    /* Enhanced Control Block 6.1 */
111
  u16   cmdw;                   /* Command Word */
112
  /* Flag Word 1 */
113
  u16           cne:1,          /* Control Block Chaining */
114
        :6,     di:1,           /* Disable Interrupt */
115
        :2,     ses:1,          /* Suppress Underrun error */
116
        :1,     sg:1,           /* Scatter/Gather */
117
        :1,     dsb:1,          /* Disable Status Block */
118
                ars:1;          /* Automatic Request Sense */
119
  /* Flag Word 2 */
120
  u16           lun:3,          /* Logical Unit */
121
                tag:1,          /* Tagged Queuing */
122
                tt:2,           /* Tag Type */
123
                nd:1,           /* No Disconnect */
124
        :1,     dat:1,          /* Data transfer - check direction */
125
                dir:1,          /* Direction of transfer 1 = datain */
126
                st:1,           /* Suppress Transfer */
127
                chk:1,          /* Calculate Checksum */
128
        :2,     rec:1,  :1;     /* Error Recovery */
129
  u16   nil0;                   /* nothing */
130
  u32   dataptr;                /* Data or Scatter List ptr */
131
  u32   datalen;                /* Data or Scatter List len */
132
  u32   statusptr;              /* Status Block ptr */
133
  u32   linkptr;                /* Chain Address */
134
  u32   nil1;                   /* nothing */
135
  u32   senseptr;               /* Sense Info Pointer */
136
  u8    senselen;               /* Sense Length */
137
  u8    cdblen;                 /* CDB Length */
138
  u16   datacheck;              /* Data checksum */
139
  u8    cdb[MAX_CDB];           /* CDB area */
140
/* Hardware defined portion ends here, rest is driver defined */
141
  u8    sense[MAX_SENSE];       /* Sense area */
142
  u8    status[MAX_STATUS];     /* Status area */
143
  Scsi_Cmnd *SCpnt;             /* Link to the SCSI Command Block */
144
  void (*done)(Scsi_Cmnd *);    /* Completion Function */
145
};
146
 
147
#define AHA1740CMD_NOP   0x00   /* No OP */
148
#define AHA1740CMD_INIT  0x01   /* Initiator SCSI Command */
149
#define AHA1740CMD_DIAG  0x05   /* Run Diagnostic Command */
150
#define AHA1740CMD_SCSI  0x06   /* Initialize SCSI */
151
#define AHA1740CMD_SENSE 0x08   /* Read Sense Information */
152
#define AHA1740CMD_DOWN  0x09   /* Download Firmware (yeah, I bet!) */
153
#define AHA1740CMD_RINQ  0x0a   /* Read Host Adapter Inquiry Data */
154
#define AHA1740CMD_TARG  0x10   /* Target SCSI Command */
155
 
156
int aha1740_detect(Scsi_Host_Template *);
157
int aha1740_command(Scsi_Cmnd *);
158
int aha1740_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
159
int aha1740_abort(Scsi_Cmnd *);
160
int aha1740_reset(Scsi_Cmnd *, unsigned int);
161
int aha1740_biosparam(Disk *, kdev_t, int*);
162
int aha1740_proc_info(char *buffer, char **start, off_t offset,
163
                               int length, int hostno, int inout);
164
 
165
#define AHA1740_ECBS 32
166
#define AHA1740_SCATTER 16
167
#define AHA1740_CMDLUN 1
168
 
169
#ifndef NULL
170
        #define NULL 0
171
#endif
172
 
173
#define AHA1740 {  proc_name:      "aha1740",                           \
174
                   proc_info:      aha1740_proc_info,                   \
175
                   name:           "Adaptec 174x (EISA)",               \
176
                   detect:         aha1740_detect,                      \
177
                   command:        aha1740_command,                     \
178
                   queuecommand:   aha1740_queuecommand,                \
179
                   abort:          aha1740_abort,                       \
180
                   reset:          aha1740_reset,                       \
181
                   bios_param:     aha1740_biosparam,                   \
182
                   can_queue:      AHA1740_ECBS,                        \
183
                   this_id:        7,                                   \
184
                   sg_tablesize:   AHA1740_SCATTER,                     \
185
                   cmd_per_lun:    AHA1740_CMDLUN,                      \
186
                   use_clustering: ENABLE_CLUSTERING}
187
 
188
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.