1 /*
2  * advansys.h - Linux Host Driver for AdvanSys SCSI Adapters
3  *
4  * Copyright (c) 1995-2000 Advanced System Products, Inc.
5  * Copyright (c) 2000-2001 ConnectCom Solutions, Inc.
6  * All Rights Reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that redistributions of source
10  * code retain the above copyright notice and this comment without
11  * modification.
12  *
13  * As of March 8, 2000 Advanced System Products, Inc. (AdvanSys)
14  * changed its name to ConnectCom Solutions, Inc.
15  *
16  * There is an AdvanSys Linux WWW page at:
17  *  http://www.connectcom.net/downloads/software/os/linux.html
18  *  http://www.advansys.com/linux.html
19  *
20  * The latest released version of the AdvanSys driver is available at:
21  *  ftp://ftp.advansys.com/pub/linux/linux.tgz
22  *  ftp://ftp.connectcom.net/pub/linux/linux.tgz
23  *
24  * Please send questions, comments, bug reports to:
25  *  linux@connectcom.net or bfrey@turbolinux.com.cn
26  */
27 
28 #ifndef _ADVANSYS_H
29 #define _ADVANSYS_H
30 
31 #include <linux/config.h>
32 #ifndef LINUX_VERSION_CODE
33 #include <linux/version.h>
34 #endif /* LINUX_VERSION_CODE */
35 
36 /* Convert Linux Version, Patch-level, Sub-level to LINUX_VERSION_CODE. */
37 #define ASC_LINUX_VERSION(V, P, S)    (((V) * 65536) + ((P) * 256) + (S))
38 /* Driver supported only in version 2.2 and version >= 2.4. */
39 #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,2,0) || \
40     (LINUX_VERSION_CODE > ASC_LINUX_VERSION(2,3,0) && \
41      LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,4,0))
42 #error "AdvanSys driver supported only in 2.2 and 2.4 or greater kernels."
43 #endif
44 #define ASC_LINUX_KERNEL22 (LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,4,0))
45 #define ASC_LINUX_KERNEL24 (LINUX_VERSION_CODE >= ASC_LINUX_VERSION(2,4,0))
46 
47 /*
48  * Scsi_Host_Template function prototypes.
49  */
50 int advansys_detect(Scsi_Host_Template *);
51 int advansys_release(struct Scsi_Host *);
52 const char *advansys_info(struct Scsi_Host *);
53 int advansys_queuecommand(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *));
54 int advansys_reset(Scsi_Cmnd *);
55 int advansys_biosparam(Disk *, kdev_t, int[]);
56 #ifdef CONFIG_PROC_FS
57 #if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,3,28)
58 extern struct proc_dir_entry proc_scsi_advansys;
59 #endif /* version < v2.3.28 */
60 int advansys_proc_info(char *, char **, off_t, int, int, int);
61 #else /* !defined(CONFIG_PROC_FS) */
62 #define advansys_proc_info      NULL
63 #endif /* !defined(CONFIG_PROC_FS) */
64 
65 /* init/main.c setup function */
66 void advansys_setup(char *, int *);
67 
68 /*
69  * AdvanSys Host Driver Scsi_Host_Template (struct SHT) from hosts.h.
70  */
71 #if ASC_LINUX_KERNEL24
72 #define ADVANSYS { \
73     proc_name:                  "advansys", \
74     proc_info:                  advansys_proc_info, \
75     name:                       "advansys", \
76     detect:                     advansys_detect, \
77     release:                    advansys_release, \
78     info:                       advansys_info, \
79     queuecommand:               advansys_queuecommand, \
80     use_new_eh_code:		1, \
81     eh_bus_reset_handler:	advansys_reset, \
82     bios_param:                 advansys_biosparam, \
83     /* \
84      * Because the driver may control an ISA adapter 'unchecked_isa_dma' \
85      * must be set. The flag will be cleared in advansys_detect for non-ISA \
86      * adapters. Refer to the comment in scsi_module.c for more information. \
87      */ \
88     unchecked_isa_dma:          1, \
89     /* \
90      * All adapters controlled by this driver are capable of large \
91      * scatter-gather lists. According to the mid-level SCSI documentation \
92      * this obviates any performance gain provided by setting \
93      * 'use_clustering'. But empirically while CPU utilization is increased \
94      * by enabling clustering, I/O throughput increases as well. \
95      */ \
96     use_clustering:             ENABLE_CLUSTERING, \
97 }
98 #elif ASC_LINUX_KERNEL22
99 #define ADVANSYS { \
100     proc_info:                  advansys_proc_info, \
101     name:                       "advansys", \
102     detect:                     advansys_detect, \
103     release:                    advansys_release, \
104     info:                       advansys_info, \
105     queuecommand:               advansys_queuecommand, \
106     use_new_eh_code:		1, \
107     eh_bus_reset_handler:	advansys_reset, \
108     bios_param:                 advansys_biosparam, \
109     /* \
110      * Because the driver may control an ISA adapter 'unchecked_isa_dma' \
111      * must be set. The flag will be cleared in advansys_detect for non-ISA \
112      * adapters. Refer to the comment in scsi_module.c for more information. \
113      */ \
114     unchecked_isa_dma:          1, \
115     /* \
116      * All adapters controlled by this driver are capable of large \
117      * scatter-gather lists. According to the mid-level SCSI documentation \
118      * this obviates any performance gain provided by setting \
119      * 'use_clustering'. But empirically while CPU utilization is increased \
120      * by enabling clustering, I/O throughput increases as well. \
121      */ \
122     use_clustering:             ENABLE_CLUSTERING, \
123 }
124 #endif
125 #endif /* _ADVANSYS_H */
126