clean
[linux-2.4.21-pre4.git] / drivers / scsi / g_NCR5380.h
1 /*
2  * Generic Generic NCR5380 driver defines
3  *
4  * Copyright 1993, Drew Eckhardt
5  *      Visionary Computing
6  *      (Unix and Linux consulting and custom programming)
7  *      drew@colorado.edu
8  *      +1 (303) 440-4894
9  *
10  * NCR53C400 extensions (c) 1994,1995,1996, Kevin Lentin
11  *    K.Lentin@cs.monash.edu.au
12  *
13  * ALPHA RELEASE 1. 
14  *
15  * For more information, please consult 
16  *
17  * NCR 5380 Family
18  * SCSI Protocol Controller
19  * Databook
20  *
21  * NCR Microelectronics
22  * 1635 Aeroplaza Drive
23  * Colorado Springs, CO 80916
24  * 1+ (719) 578-3400
25  * 1+ (800) 334-5454
26  */
27
28 /*
29  * $Log: g_NCR5380.h,v $
30  * Revision 1.1.1.1  2005/04/11 02:50:36  jack
31  * first release
32  *
33  * Revision 1.1.1.1  2005/01/10 13:16:35  jack
34  * First release
35  *
36  */
37
38 #ifndef GENERIC_NCR5380_H
39 #define GENERIC_NCR5380_H
40
41 #include <linux/config.h>
42
43 #define GENERIC_NCR5380_PUBLIC_RELEASE 1
44
45 #ifdef NCR53C400
46 #define BIOSPARAM
47 #define NCR5380_BIOSPARAM generic_NCR5380_biosparam
48 #else
49 #define NCR5380_BIOSPARAM NULL
50 #endif
51
52 int generic_NCR5380_abort(Scsi_Cmnd *);
53 int generic_NCR5380_detect(Scsi_Host_Template *);
54 int generic_NCR5380_release_resources(struct Scsi_Host *);
55 int generic_NCR5380_queue_command(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
56 int generic_NCR5380_reset(Scsi_Cmnd *, unsigned int);
57 int notyet_generic_proc_info(char *buffer, char **start, off_t offset, int length, int hostno, int inout);
58 const char *generic_NCR5380_info(struct Scsi_Host *);
59 #ifdef BIOSPARAM
60 int generic_NCR5380_biosparam(Disk *, kdev_t, int *);
61 #endif
62
63 int generic_NCR5380_proc_info(char *buffer, char **start, off_t offset, int length, int hostno, int inout);
64
65 #ifndef CMD_PER_LUN
66 #define CMD_PER_LUN 2
67 #endif
68
69 #ifndef CAN_QUEUE
70 #define CAN_QUEUE 16
71 #endif
72
73 #define GENERIC_NCR5380 {                                               \
74         proc_info:      generic_NCR5380_proc_info,                      \
75         name:           "Generic NCR5380/NCR53C400 Scsi Driver",        \
76         detect:         generic_NCR5380_detect,                         \
77         release:        generic_NCR5380_release_resources,              \
78         info:           (void *)generic_NCR5380_info,                   \
79         queuecommand:   generic_NCR5380_queue_command,                  \
80         abort:          generic_NCR5380_abort,                          \
81         reset:          generic_NCR5380_reset,                          \
82         bios_param:     NCR5380_BIOSPARAM,                              \
83         can_queue:      CAN_QUEUE,                                      \
84         this_id:        7,                                              \
85         sg_tablesize:   SG_ALL,                                         \
86         cmd_per_lun:    CMD_PER_LUN ,                                   \
87         use_clustering: DISABLE_CLUSTERING}
88
89 #ifndef HOSTS_C
90
91 #define __STRVAL(x) #x
92 #define STRVAL(x) __STRVAL(x)
93
94 #ifdef CONFIG_SCSI_G_NCR5380_PORT
95 #define NCR5380_map_config port
96 #define NCR5380_map_type int
97 #define NCR5380_map_name port
98 #define NCR5380_instance_name io_port
99 #define NCR53C400_register_offset 0
100 #define NCR53C400_address_adjust 8
101 /*
102  *      FIXME: size should be runtime decided
103  */
104 #ifdef NCR53C400
105 #define NCR5380_region_size 16
106 #else
107 #define NCR5380_region_size 8
108 #endif
109
110 #define NCR5380_read(reg) (inb(NCR5380_map_name + (reg)))
111 #define NCR5380_write(reg, value) (outb((value), (NCR5380_map_name + (reg))))
112
113 #else
114 /* therefore CONFIG_SCSI_G_NCR5380_MEM */
115
116 #define NCR5380_map_config memory
117 #define NCR5380_map_type unsigned long
118 #define NCR5380_map_name base
119 #define NCR5380_instance_name base
120 #define NCR53C400_register_offset 0x108
121 #define NCR53C400_address_adjust 0
122 #define NCR53C400_mem_base 0x3880
123 #define NCR53C400_host_buffer 0x3900
124 #define NCR5380_region_size 0x3a00
125
126 #define NCR5380_read(reg) isa_readb(NCR5380_map_name + NCR53C400_mem_base + (reg))
127 #define NCR5380_write(reg, value) isa_writeb(NCR5380_map_name + NCR53C400_mem_base + (reg), value)
128
129 #endif
130
131 #define NCR5380_implementation_fields \
132     NCR5380_map_type NCR5380_map_name
133
134 #define NCR5380_local_declare() \
135     register NCR5380_implementation_fields
136
137 #define NCR5380_setup(instance) \
138     NCR5380_map_name = (NCR5380_map_type)((instance)->NCR5380_instance_name)
139
140 #define NCR5380_intr generic_NCR5380_intr
141 #define do_NCR5380_intr do_generic_NCR5380_intr
142 #define NCR5380_queue_command generic_NCR5380_queue_command
143 #define NCR5380_abort generic_NCR5380_abort
144 #define NCR5380_reset generic_NCR5380_reset
145 #define NCR5380_pread generic_NCR5380_pread
146 #define NCR5380_pwrite generic_NCR5380_pwrite
147 #define NCR5380_proc_info notyet_generic_proc_info
148
149 #define BOARD_NCR5380   0
150 #define BOARD_NCR53C400 1
151 #define BOARD_NCR53C400A 2
152 #define BOARD_DTC3181E  3
153
154 #endif                          /* else def HOSTS_C */
155 #endif                          /* GENERIC_NCR5380_H */