Blame view
drivers/scsi/gdth.c
175 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 6 |
/************************************************************************ * Linux driver for * * ICP vortex GmbH: GDT ISA/EISA/PCI Disk Array Controllers * * Intel Corporation: Storage RAID Controllers * * * * gdth.c * |
cbd5f69b9 [SCSI] remove the... |
7 |
* Copyright (C) 1995-06 ICP vortex GmbH, Achim Leubner * |
1da177e4c Linux-2.6.12-rc2 |
8 |
* Copyright (C) 2002-04 Intel Corporation * |
cbd5f69b9 [SCSI] remove the... |
9 |
* Copyright (C) 2003-06 Adaptec Inc. * |
1da177e4c Linux-2.6.12-rc2 |
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
* <achim_leubner@adaptec.com> * * * * Additions/Fixes: * * Boji Tony Kannanthanam <boji.t.kannanthanam@intel.com> * * Johannes Dinner <johannes_dinner@adaptec.com> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published * * by the Free Software Foundation; either version 2 of the License, * * or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this kernel; if not, write to the Free Software * * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * * |
8d7a5da4f [SCSI] gdth: Remo... |
30 |
* Linux kernel 2.6.x supported * |
1da177e4c Linux-2.6.12-rc2 |
31 |
* * |
1da177e4c Linux-2.6.12-rc2 |
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
************************************************************************/ /* All GDT Disk Array Controllers are fully supported by this driver. * This includes the PCI/EISA/ISA SCSI Disk Array Controllers and the * PCI Fibre Channel Disk Array Controllers. See gdth.h for a complete * list of all controller types. * * If you have one or more GDT3000/3020 EISA controllers with * controller BIOS disabled, you have to set the IRQ values with the * command line option "gdth=irq1,irq2,...", where the irq1,irq2,... are * the IRQ values for the EISA controllers. * * After the optional list of IRQ values, other possible * command line options are: * disable:Y disable driver * disable:N enable driver * reserve_mode:0 reserve no drives for the raw service * reserve_mode:1 reserve all not init., removable drives * reserve_mode:2 reserve all not init. drives * reserve_list:h,b,t,l,h,b,t,l,... reserve particular drive(s) with * h- controller no., b- channel no., * t- target ID, l- LUN * reverse_scan:Y reverse scan order for PCI controllers * reverse_scan:N scan PCI controllers like BIOS * max_ids:x x - target ID count per channel (1..MAXID) * rescan:Y rescan all channels/IDs * rescan:N use all devices found until now |
1da177e4c Linux-2.6.12-rc2 |
59 60 61 |
* hdr_channel:x x - number of virtual bus for host drives * shared_access:Y disable driver reserve/release protocol to * access a shared resource from several nodes, |
575c96871 spelling: s/appro... |
62 |
* appropriate controller firmware required |
1da177e4c Linux-2.6.12-rc2 |
63 64 65 66 67 68 69 |
* shared_access:N enable driver reserve/release protocol * probe_eisa_isa:Y scan for EISA/ISA controllers * probe_eisa_isa:N do not scan for EISA/ISA controllers * force_dma32:Y use only 32 bit DMA mode * force_dma32:N use 64 bit DMA mode, if supported * * The default values are: "gdth=disable:N,reserve_mode:1,reverse_scan:N, |
52759e6ab [SCSI] gdth: Remo... |
70 |
* max_ids:127,rescan:N,hdr_channel:0, |
1da177e4c Linux-2.6.12-rc2 |
71 72 73 74 75 76 77 78 79 80 |
* shared_access:Y,probe_eisa_isa:N,force_dma32:N". * Here is another example: "gdth=reserve_list:0,1,2,0,0,1,3,0,rescan:Y". * * When loading the gdth driver as a module, the same options are available. * You can set the IRQs with "IRQ=...". However, the syntax to specify the * options changes slightly. You must replace all ',' between options * with ' ' and all ':' with '=' and you must use * '1' in place of 'Y' and '0' in place of 'N'. * * Default: "modprobe gdth disable=0 reserve_mode=1 reverse_scan=0 |
52759e6ab [SCSI] gdth: Remo... |
81 |
* max_ids=127 rescan=0 hdr_channel=0 shared_access=0 |
1da177e4c Linux-2.6.12-rc2 |
82 83 84 85 86 87 |
* probe_eisa_isa=0 force_dma32=0" * The other example: "modprobe gdth reserve_list=0,1,2,0,0,1,3,0 rescan=1". */ /* The meaning of the Scsi_Pointer members in this driver is as follows: * ptr: Chaining |
d35055a0f [SCSI] gdth: remo... |
88 89 |
* this_residual: unused * buffer: unused |
3892d88ae [SCSI] gdth: !use... |
90 |
* dma_handle: unused |
d35055a0f [SCSI] gdth: remo... |
91 |
* buffers_residual: unused |
3892d88ae [SCSI] gdth: !use... |
92 |
* Status: unused |
f842b64e0 [SCSI] gdth: Move... |
93 94 95 96 |
* Message: unused * have_data_in: unused * sent_command: unused * phase: unused |
1da177e4c Linux-2.6.12-rc2 |
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
*/ /* interrupt coalescing */ /* #define INT_COAL */ /* statistics */ #define GDTH_STATISTICS #include <linux/module.h> #include <linux/version.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/pci.h> #include <linux/string.h> #include <linux/ctype.h> #include <linux/ioport.h> #include <linux/delay.h> |
1da177e4c Linux-2.6.12-rc2 |
116 117 118 119 120 |
#include <linux/interrupt.h> #include <linux/in.h> #include <linux/proc_fs.h> #include <linux/time.h> #include <linux/timer.h> |
910638ae7 [PATCH] Replace 0... |
121 |
#include <linux/dma-mapping.h> |
835cc24af [SCSI] gdth: swit... |
122 |
#include <linux/list.h> |
c45d15d24 scsi: autoconvert... |
123 |
#include <linux/mutex.h> |
5a0e3ad6a include cleanup: ... |
124 |
#include <linux/slab.h> |
cbd5f69b9 [SCSI] remove the... |
125 |
|
1da177e4c Linux-2.6.12-rc2 |
126 127 128 129 130 131 132 133 134 135 |
#ifdef GDTH_RTC #include <linux/mc146818rtc.h> #endif #include <linux/reboot.h> #include <asm/dma.h> #include <asm/system.h> #include <asm/io.h> #include <asm/uaccess.h> #include <linux/spinlock.h> |
1da177e4c Linux-2.6.12-rc2 |
136 |
#include <linux/blkdev.h> |
3892d88ae [SCSI] gdth: !use... |
137 |
#include <linux/scatterlist.h> |
1da177e4c Linux-2.6.12-rc2 |
138 139 140 |
#include "scsi.h" #include <scsi/scsi_host.h> |
cbd5f69b9 [SCSI] remove the... |
141 |
#include "gdth.h" |
1da177e4c Linux-2.6.12-rc2 |
142 |
|
c45d15d24 scsi: autoconvert... |
143 |
static DEFINE_MUTEX(gdth_mutex); |
1da177e4c Linux-2.6.12-rc2 |
144 |
static void gdth_delay(int milliseconds); |
1fe6dbf4d [SCSI] gdth: Conv... |
145 |
static void gdth_eval_mapping(u32 size, u32 *cyls, int *heads, int *secs); |
7d12e780e IRQ: Maintain reg... |
146 |
static irqreturn_t gdth_interrupt(int irq, void *dev_id); |
230e886e7 [SCSI] gdth: kill... |
147 |
static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, |
10e1b4bc9 [SCSI] gdth: gdth... |
148 |
int gdth_from_wait, int* pIndex); |
1fe6dbf4d [SCSI] gdth: Conv... |
149 |
static int gdth_sync_event(gdth_ha_str *ha, int service, u8 index, |
45f1a41b2 [SCSI] gdth: clea... |
150 151 |
Scsi_Cmnd *scp); static int gdth_async_event(gdth_ha_str *ha); |
1da177e4c Linux-2.6.12-rc2 |
152 |
static void gdth_log_event(gdth_evt_data *dvr, char *buffer); |
1fe6dbf4d [SCSI] gdth: Conv... |
153 |
static void gdth_putq(gdth_ha_str *ha, Scsi_Cmnd *scp, u8 priority); |
45f1a41b2 [SCSI] gdth: clea... |
154 |
static void gdth_next(gdth_ha_str *ha); |
1fe6dbf4d [SCSI] gdth: Conv... |
155 |
static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, u8 b); |
45f1a41b2 [SCSI] gdth: clea... |
156 |
static int gdth_special_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp); |
1fe6dbf4d [SCSI] gdth: Conv... |
157 158 |
static gdth_evt_str *gdth_store_event(gdth_ha_str *ha, u16 source, u16 idx, gdth_evt_data *evt); |
1da177e4c Linux-2.6.12-rc2 |
159 |
static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr); |
1fe6dbf4d [SCSI] gdth: Conv... |
160 |
static void gdth_readapp_event(gdth_ha_str *ha, u8 application, |
1da177e4c Linux-2.6.12-rc2 |
161 162 |
gdth_evt_str *estr); static void gdth_clear_events(void); |
45f1a41b2 [SCSI] gdth: clea... |
163 |
static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp, |
1fe6dbf4d [SCSI] gdth: Conv... |
164 |
char *buffer, u16 count); |
45f1a41b2 [SCSI] gdth: clea... |
165 |
static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp); |
1fe6dbf4d [SCSI] gdth: Conv... |
166 |
static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, u16 hdrive); |
1da177e4c Linux-2.6.12-rc2 |
167 |
|
45f1a41b2 [SCSI] gdth: clea... |
168 |
static void gdth_enable_int(gdth_ha_str *ha); |
45f1a41b2 [SCSI] gdth: clea... |
169 170 171 |
static int gdth_test_busy(gdth_ha_str *ha); static int gdth_get_cmd_index(gdth_ha_str *ha); static void gdth_release_event(gdth_ha_str *ha); |
1fe6dbf4d [SCSI] gdth: Conv... |
172 173 174 |
static int gdth_wait(gdth_ha_str *ha, int index,u32 time); static int gdth_internal_cmd(gdth_ha_str *ha, u8 service, u16 opcode, u32 p1, u64 p2,u64 p3); |
45f1a41b2 [SCSI] gdth: clea... |
175 |
static int gdth_search_drives(gdth_ha_str *ha); |
1fe6dbf4d [SCSI] gdth: Conv... |
176 |
static int gdth_analyse_hdrive(gdth_ha_str *ha, u16 hdrive); |
1da177e4c Linux-2.6.12-rc2 |
177 |
|
45f1a41b2 [SCSI] gdth: clea... |
178 |
static const char *gdth_ctr_name(gdth_ha_str *ha); |
1da177e4c Linux-2.6.12-rc2 |
179 180 181 |
static int gdth_open(struct inode *inode, struct file *filep); static int gdth_close(struct inode *inode, struct file *filep); |
f4927c45b scsi: Push down B... |
182 183 |
static long gdth_unlocked_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); |
1da177e4c Linux-2.6.12-rc2 |
184 |
|
45f1a41b2 [SCSI] gdth: clea... |
185 |
static void gdth_flush(gdth_ha_str *ha); |
f281233d3 SCSI host lock pu... |
186 |
static int gdth_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *cmd); |
3058d5de4 [SCSI] gdth: Setu... |
187 188 |
static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp, struct gdth_cmndinfo *cmndinfo); |
cbd5f69b9 [SCSI] remove the... |
189 |
static void gdth_scsi_done(struct scsi_cmnd *scp); |
1da177e4c Linux-2.6.12-rc2 |
190 191 |
#ifdef DEBUG_GDTH |
1fe6dbf4d [SCSI] gdth: Conv... |
192 |
static u8 DebugState = DEBUG_GDTH; |
1da177e4c Linux-2.6.12-rc2 |
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
#ifdef __SERIAL__ #define MAX_SERBUF 160 static void ser_init(void); static void ser_puts(char *str); static void ser_putc(char c); static int ser_printk(const char *fmt, ...); static char strbuf[MAX_SERBUF+1]; #ifdef __COM2__ #define COM_BASE 0x2f8 #else #define COM_BASE 0x3f8 #endif static void ser_init() { unsigned port=COM_BASE; outb(0x80,port+3); outb(0,port+1); /* 19200 Baud, if 9600: outb(12,port) */ outb(6, port); outb(3,port+3); outb(0,port+1); /* ser_putc('I'); ser_putc(' '); */ } static void ser_puts(char *str) { char *ptr; ser_init(); for (ptr=str;*ptr;++ptr) ser_putc(*ptr); } static void ser_putc(char c) { unsigned port=COM_BASE; while ((inb(port+5) & 0x20)==0); outb(c,port); if (c==0x0a) { while ((inb(port+5) & 0x20)==0); outb(0x0d,port); } } static int ser_printk(const char *fmt, ...) { va_list args; int i; va_start(args,fmt); i = vsprintf(strbuf,fmt,args); ser_puts(strbuf); va_end(args); return i; } #define TRACE(a) {if (DebugState==1) {ser_printk a;}} #define TRACE2(a) {if (DebugState==1 || DebugState==2) {ser_printk a;}} #define TRACE3(a) {if (DebugState!=0) {ser_printk a;}} #else /* !__SERIAL__ */ #define TRACE(a) {if (DebugState==1) {printk a;}} #define TRACE2(a) {if (DebugState==1 || DebugState==2) {printk a;}} #define TRACE3(a) {if (DebugState!=0) {printk a;}} #endif #else /* !DEBUG */ #define TRACE(a) #define TRACE2(a) #define TRACE3(a) #endif #ifdef GDTH_STATISTICS |
1fe6dbf4d [SCSI] gdth: Conv... |
273 |
static u32 max_rq=0, max_index=0, max_sg=0; |
1da177e4c Linux-2.6.12-rc2 |
274 |
#ifdef INT_COAL |
1fe6dbf4d [SCSI] gdth: Conv... |
275 |
static u32 max_int_coal=0; |
1da177e4c Linux-2.6.12-rc2 |
276 |
#endif |
1fe6dbf4d [SCSI] gdth: Conv... |
277 |
static u32 act_ints=0, act_ios=0, act_stats=0, act_rq=0; |
1da177e4c Linux-2.6.12-rc2 |
278 279 |
static struct timer_list gdth_timer; #endif |
1fe6dbf4d [SCSI] gdth: Conv... |
280 |
#define PTR2USHORT(a) (u16)(unsigned long)(a) |
6391a1137 [SCSI] drivers/sc... |
281 282 |
#define GDTOFFSOF(a,b) (size_t)&(((a*)0)->b) #define INDEX_OK(i,t) ((i)<ARRAY_SIZE(t)) |
1da177e4c Linux-2.6.12-rc2 |
283 |
|
1da177e4c Linux-2.6.12-rc2 |
284 |
#define BUS_L2P(a,b) ((b)>(a)->virt_bus ? (b-1):(b)) |
aed91cb52 [SCSI] gdth: spli... |
285 |
#ifdef CONFIG_ISA |
1fe6dbf4d [SCSI] gdth: Conv... |
286 |
static u8 gdth_drq_tab[4] = {5,6,7,7}; /* DRQ table */ |
aed91cb52 [SCSI] gdth: spli... |
287 |
#endif |
c8e91b0a8 [SCSI] gdth: fix ... |
288 |
#if defined(CONFIG_EISA) || defined(CONFIG_ISA) |
1fe6dbf4d [SCSI] gdth: Conv... |
289 |
static u8 gdth_irq_tab[6] = {0,10,11,12,14,0}; /* IRQ table */ |
706a5d456 [SCSI] gdth: spli... |
290 |
#endif |
1fe6dbf4d [SCSI] gdth: Conv... |
291 |
static u8 gdth_polling; /* polling if TRUE */ |
1da177e4c Linux-2.6.12-rc2 |
292 |
static int gdth_ctr_count = 0; /* controller count */ |
884f7fba0 [SCSI] gdth: Remo... |
293 |
static LIST_HEAD(gdth_instances); /* controller list */ |
1fe6dbf4d [SCSI] gdth: Conv... |
294 |
static u8 gdth_write_through = FALSE; /* write through */ |
1da177e4c Linux-2.6.12-rc2 |
295 296 297 298 299 300 301 302 303 |
static gdth_evt_str ebuffer[MAX_EVENTS]; /* event buffer */ static int elastidx; static int eoldidx; static int major; #define DIN 1 /* IN data direction */ #define DOU 2 /* OUT data direction */ #define DNO DIN /* no data transfer */ #define DUN DIN /* unknown data direction */ |
1fe6dbf4d [SCSI] gdth: Conv... |
304 |
static u8 gdth_direction_tab[0x100] = { |
1da177e4c Linux-2.6.12-rc2 |
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
DNO,DNO,DIN,DIN,DOU,DIN,DIN,DOU,DIN,DUN,DOU,DOU,DUN,DUN,DUN,DIN, DNO,DIN,DIN,DOU,DIN,DOU,DNO,DNO,DOU,DNO,DIN,DNO,DIN,DOU,DNO,DUN, DIN,DUN,DIN,DUN,DOU,DIN,DUN,DUN,DIN,DIN,DOU,DNO,DUN,DIN,DOU,DOU, DOU,DOU,DOU,DNO,DIN,DNO,DNO,DIN,DOU,DOU,DOU,DOU,DIN,DOU,DIN,DOU, DOU,DOU,DIN,DIN,DIN,DNO,DUN,DNO,DNO,DNO,DUN,DNO,DOU,DIN,DUN,DUN, DUN,DUN,DUN,DUN,DUN,DOU,DUN,DUN,DUN,DUN,DIN,DUN,DUN,DUN,DUN,DUN, DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DIN,DUN,DOU,DUN,DUN,DUN,DUN,DUN, DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DIN,DUN, DUN,DUN,DUN,DUN,DUN,DNO,DNO,DUN,DIN,DNO,DOU,DUN,DNO,DUN,DOU,DOU, DOU,DOU,DOU,DNO,DUN,DIN,DOU,DIN,DIN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, DUN,DUN,DOU,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN, DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DOU,DUN,DUN,DUN,DUN,DUN, DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN,DUN }; /* LILO and modprobe/insmod parameters */ /* IRQ list for GDT3000/3020 EISA controllers */ static int irq[MAXHA] __initdata = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; /* disable driver flag */ static int disable __initdata = 0; /* reserve flag */ static int reserve_mode = 1; /* reserve list */ static int reserve_list[MAX_RES_ARGS] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; /* scan order for PCI controllers */ static int reverse_scan = 0; /* virtual channel for the host drives */ static int hdr_channel = 0; /* max. IDs per channel */ static int max_ids = MAXID; /* rescan all IDs */ static int rescan = 0; |
1da177e4c Linux-2.6.12-rc2 |
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
/* shared access */ static int shared_access = 1; /* enable support for EISA and ISA controllers */ static int probe_eisa_isa = 0; /* 64 bit DMA mode, support for drives > 2 TB, if force_dma32 = 0 */ static int force_dma32 = 0; /* parameters for modprobe/insmod */ module_param_array(irq, int, NULL, 0); module_param(disable, int, 0); module_param(reserve_mode, int, 0); module_param_array(reserve_list, int, NULL, 0); module_param(reverse_scan, int, 0); module_param(hdr_channel, int, 0); module_param(max_ids, int, 0); module_param(rescan, int, 0); |
1da177e4c Linux-2.6.12-rc2 |
361 362 363 364 365 366 367 |
module_param(shared_access, int, 0); module_param(probe_eisa_isa, int, 0); module_param(force_dma32, int, 0); MODULE_AUTHOR("Achim Leubner"); MODULE_LICENSE("GPL"); /* ioctl interface */ |
00977a59b [PATCH] mark stru... |
368 |
static const struct file_operations gdth_fops = { |
f4927c45b scsi: Push down B... |
369 |
.unlocked_ioctl = gdth_unlocked_ioctl, |
1da177e4c Linux-2.6.12-rc2 |
370 371 |
.open = gdth_open, .release = gdth_close, |
6038f373a llseek: automatic... |
372 |
.llseek = noop_llseek, |
1da177e4c Linux-2.6.12-rc2 |
373 374 375 376 |
}; #include "gdth_proc.h" #include "gdth_proc.c" |
884f7fba0 [SCSI] gdth: Remo... |
377 378 379 380 381 382 383 384 385 386 |
static gdth_ha_str *gdth_find_ha(int hanum) { gdth_ha_str *ha; list_for_each_entry(ha, &gdth_instances, list) if (hanum == ha->hanum) return ha; return NULL; } |
3058d5de4 [SCSI] gdth: Setu... |
387 388 389 |
static struct gdth_cmndinfo *gdth_get_cmndinfo(gdth_ha_str *ha) { struct gdth_cmndinfo *priv = NULL; |
1fe6dbf4d [SCSI] gdth: Conv... |
390 |
unsigned long flags; |
3058d5de4 [SCSI] gdth: Setu... |
391 392 393 394 395 396 397 |
int i; spin_lock_irqsave(&ha->smp_lock, flags); for (i=0; i<GDTH_MAXCMDS; ++i) { if (ha->cmndinfo[i].index == 0) { priv = &ha->cmndinfo[i]; |
3058d5de4 [SCSI] gdth: Setu... |
398 |
memset(priv, 0, sizeof(*priv)); |
ee54cc6af [SCSI] gdth: fix ... |
399 |
priv->index = i+1; |
3058d5de4 [SCSI] gdth: Setu... |
400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
break; } } spin_unlock_irqrestore(&ha->smp_lock, flags); return priv; } static void gdth_put_cmndinfo(struct gdth_cmndinfo *priv) { BUG_ON(!priv); priv->index = 0; } |
1da177e4c Linux-2.6.12-rc2 |
414 415 416 417 418 419 420 421 |
static void gdth_delay(int milliseconds) { if (milliseconds == 0) { udelay(1); } else { mdelay(milliseconds); } } |
cbd5f69b9 [SCSI] remove the... |
422 423 |
static void gdth_scsi_done(struct scsi_cmnd *scp) { |
3058d5de4 [SCSI] gdth: Setu... |
424 425 |
struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp); int internal_command = cmndinfo->internal_command; |
b8bff2aea gdth: Make one ab... |
426 427 |
TRACE2(("gdth_scsi_done() ")); |
cbd5f69b9 [SCSI] remove the... |
428 |
|
3058d5de4 [SCSI] gdth: Setu... |
429 430 431 432 |
gdth_put_cmndinfo(cmndinfo); scp->host_scribble = NULL; if (internal_command) |
b8bff2aea gdth: Make one ab... |
433 434 435 |
complete((struct completion *)scp->request); else scp->scsi_done(scp); |
cbd5f69b9 [SCSI] remove the... |
436 437 438 439 440 |
} int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd, int timeout, u32 *info) { |
3058d5de4 [SCSI] gdth: Setu... |
441 |
gdth_ha_str *ha = shost_priv(sdev->host); |
cbd5f69b9 [SCSI] remove the... |
442 |
Scsi_Cmnd *scp; |
3058d5de4 [SCSI] gdth: Setu... |
443 |
struct gdth_cmndinfo cmndinfo; |
6e9a4738c [PATCH] completio... |
444 |
DECLARE_COMPLETION_ONSTACK(wait); |
cbd5f69b9 [SCSI] remove the... |
445 |
int rval; |
bbfbbbc11 [SCSI] kmalloc + ... |
446 |
scp = kzalloc(sizeof(*scp), GFP_KERNEL); |
cbd5f69b9 [SCSI] remove the... |
447 448 |
if (!scp) return -ENOMEM; |
bbfbbbc11 [SCSI] kmalloc + ... |
449 |
|
1b96f8955 [SCSI] gdth: Allo... |
450 451 452 453 454 |
scp->sense_buffer = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL); if (!scp->sense_buffer) { kfree(scp); return -ENOMEM; } |
cbd5f69b9 [SCSI] remove the... |
455 |
scp->device = sdev; |
3058d5de4 [SCSI] gdth: Setu... |
456 |
memset(&cmndinfo, 0, sizeof(cmndinfo)); |
beb404875 [SCSI] remove scs... |
457 458 |
/* use request field to save the ptr. to completion struct. */ scp->request = (struct request *)&wait; |
cbd5f69b9 [SCSI] remove the... |
459 |
scp->cmd_len = 12; |
64a87b244 [SCSI] Let scsi_c... |
460 |
scp->cmnd = cmnd; |
f842b64e0 [SCSI] gdth: Move... |
461 |
cmndinfo.priority = IOCTL_PRI; |
ee54cc6af [SCSI] gdth: fix ... |
462 |
cmndinfo.internal_cmd_str = gdtcmd; |
3058d5de4 [SCSI] gdth: Setu... |
463 464 465 466 467 |
cmndinfo.internal_command = 1; TRACE(("__gdth_execute() cmd 0x%x ", scp->cmnd[0])); __gdth_queuecommand(ha, scp, &cmndinfo); |
cbd5f69b9 [SCSI] remove the... |
468 |
wait_for_completion(&wait); |
f842b64e0 [SCSI] gdth: Move... |
469 |
rval = cmndinfo.status; |
cbd5f69b9 [SCSI] remove the... |
470 |
if (info) |
f842b64e0 [SCSI] gdth: Move... |
471 |
*info = cmndinfo.info; |
1b96f8955 [SCSI] gdth: Allo... |
472 |
kfree(scp->sense_buffer); |
cbd5f69b9 [SCSI] remove the... |
473 474 475 |
kfree(scp); return rval; } |
cbd5f69b9 [SCSI] remove the... |
476 477 478 479 480 481 482 483 484 485 |
int gdth_execute(struct Scsi_Host *shost, gdth_cmd_str *gdtcmd, char *cmnd, int timeout, u32 *info) { struct scsi_device *sdev = scsi_get_host_dev(shost); int rval = __gdth_execute(sdev, gdtcmd, cmnd, timeout, info); scsi_free_host_dev(sdev); return rval; } |
1fe6dbf4d [SCSI] gdth: Conv... |
486 |
static void gdth_eval_mapping(u32 size, u32 *cyls, int *heads, int *secs) |
1da177e4c Linux-2.6.12-rc2 |
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 |
{ *cyls = size /HEADS/SECS; if (*cyls <= MAXCYLS) { *heads = HEADS; *secs = SECS; } else { /* too high for 64*32 */ *cyls = size /MEDHEADS/MEDSECS; if (*cyls <= MAXCYLS) { *heads = MEDHEADS; *secs = MEDSECS; } else { /* too high for 127*63 */ *cyls = size /BIGHEADS/BIGSECS; *heads = BIGHEADS; *secs = BIGSECS; } } } /* controller search and initialization functions */ |
706a5d456 [SCSI] gdth: spli... |
506 |
#ifdef CONFIG_EISA |
1fe6dbf4d [SCSI] gdth: Conv... |
507 |
static int __init gdth_search_eisa(u16 eisa_adr) |
1da177e4c Linux-2.6.12-rc2 |
508 |
{ |
1fe6dbf4d [SCSI] gdth: Conv... |
509 |
u32 id; |
1da177e4c Linux-2.6.12-rc2 |
510 511 512 513 514 515 516 517 518 519 520 521 522 523 |
TRACE(("gdth_search_eisa() adr. %x ",eisa_adr)); id = inl(eisa_adr+ID0REG); if (id == GDT3A_ID || id == GDT3B_ID) { /* GDT3000A or GDT3000B */ if ((inb(eisa_adr+EISAREG) & 8) == 0) return 0; /* not EISA configured */ return 1; } if (id == GDT3_ID) /* GDT3000 */ return 1; return 0; } |
706a5d456 [SCSI] gdth: spli... |
524 |
#endif /* CONFIG_EISA */ |
1da177e4c Linux-2.6.12-rc2 |
525 |
|
aed91cb52 [SCSI] gdth: spli... |
526 |
#ifdef CONFIG_ISA |
1fe6dbf4d [SCSI] gdth: Conv... |
527 |
static int __init gdth_search_isa(u32 bios_adr) |
1da177e4c Linux-2.6.12-rc2 |
528 529 |
{ void __iomem *addr; |
1fe6dbf4d [SCSI] gdth: Conv... |
530 |
u32 id; |
1da177e4c Linux-2.6.12-rc2 |
531 532 533 |
TRACE(("gdth_search_isa() bios adr. %x ",bios_adr)); |
1fe6dbf4d [SCSI] gdth: Conv... |
534 |
if ((addr = ioremap(bios_adr+BIOS_ID_OFFS, sizeof(u32))) != NULL) { |
a52667f3c [SCSI] gdth: kill... |
535 |
id = readl(addr); |
1da177e4c Linux-2.6.12-rc2 |
536 537 538 539 540 541 |
iounmap(addr); if (id == GDT2_ID) /* GDT2000 */ return 1; } return 0; } |
aed91cb52 [SCSI] gdth: spli... |
542 |
#endif /* CONFIG_ISA */ |
1da177e4c Linux-2.6.12-rc2 |
543 |
|
8514ef27e [SCSI] gdth: spli... |
544 |
#ifdef CONFIG_PCI |
8514ef27e [SCSI] gdth: spli... |
545 |
|
1fe6dbf4d [SCSI] gdth: Conv... |
546 |
static bool gdth_search_vortex(u16 device) |
1da177e4c Linux-2.6.12-rc2 |
547 |
{ |
cff268064 [SCSI] gdth: conv... |
548 549 550 551 552 553 554 555 556 |
if (device <= PCI_DEVICE_ID_VORTEX_GDT6555) return true; if (device >= PCI_DEVICE_ID_VORTEX_GDT6x17RP && device <= PCI_DEVICE_ID_VORTEX_GDTMAXRP) return true; if (device == PCI_DEVICE_ID_VORTEX_GDTNEWRX || device == PCI_DEVICE_ID_VORTEX_GDTNEWRX2) return true; return false; |
1da177e4c Linux-2.6.12-rc2 |
557 |
} |
cff268064 [SCSI] gdth: conv... |
558 559 560 561 562 |
static int gdth_pci_probe_one(gdth_pci_str *pcistr, gdth_ha_str **ha_out); static int gdth_pci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); static void gdth_pci_remove_one(struct pci_dev *pdev); static void gdth_remove_one(gdth_ha_str *ha); |
1da177e4c Linux-2.6.12-rc2 |
563 564 565 |
/* Vortex only makes RAID controllers. * We do not really want to specify all 550 ids here, so wildcard match. */ |
cff268064 [SCSI] gdth: conv... |
566 567 568 569 570 |
static const struct pci_device_id gdthtable[] = { { PCI_VDEVICE(VORTEX, PCI_ANY_ID) }, { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SRC) }, { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SRC_XSCALE) }, { } /* terminate list */ |
1da177e4c Linux-2.6.12-rc2 |
571 |
}; |
cff268064 [SCSI] gdth: conv... |
572 |
MODULE_DEVICE_TABLE(pci, gdthtable); |
1da177e4c Linux-2.6.12-rc2 |
573 |
|
cff268064 [SCSI] gdth: conv... |
574 575 576 577 578 579 |
static struct pci_driver gdth_pci_driver = { .name = "gdth", .id_table = gdthtable, .probe = gdth_pci_init_one, .remove = gdth_pci_remove_one, }; |
ced7172ad gdth section fixes |
580 |
static void __devexit gdth_pci_remove_one(struct pci_dev *pdev) |
1da177e4c Linux-2.6.12-rc2 |
581 |
{ |
cff268064 [SCSI] gdth: conv... |
582 583 584 585 586 587 588 589 590 |
gdth_ha_str *ha = pci_get_drvdata(pdev); pci_set_drvdata(pdev, NULL); list_del(&ha->list); gdth_remove_one(ha); pci_disable_device(pdev); } |
ced7172ad gdth section fixes |
591 |
static int __devinit gdth_pci_init_one(struct pci_dev *pdev, |
cff268064 [SCSI] gdth: conv... |
592 593 |
const struct pci_device_id *ent) { |
1fe6dbf4d [SCSI] gdth: Conv... |
594 595 596 |
u16 vendor = pdev->vendor; u16 device = pdev->device; unsigned long base0, base1, base2; |
cff268064 [SCSI] gdth: conv... |
597 598 599 |
int rc; gdth_pci_str gdth_pcistr; gdth_ha_str *ha = NULL; |
1da177e4c Linux-2.6.12-rc2 |
600 |
|
cff268064 [SCSI] gdth: conv... |
601 602 603 |
TRACE(("gdth_search_dev() cnt %d vendor %x device %x ", gdth_ctr_count, vendor, device)); |
1da177e4c Linux-2.6.12-rc2 |
604 |
|
cff268064 [SCSI] gdth: conv... |
605 606 607 608 609 610 611 612 613 614 615 |
memset(&gdth_pcistr, 0, sizeof(gdth_pcistr)); if (vendor == PCI_VENDOR_ID_VORTEX && !gdth_search_vortex(device)) return -ENODEV; rc = pci_enable_device(pdev); if (rc) return rc; if (gdth_ctr_count >= MAXHA) return -EBUSY; |
99109301d [SCSI] gdth: upda... |
616 |
|
1da177e4c Linux-2.6.12-rc2 |
617 |
/* GDT PCI controller found, resources are already in pdev */ |
cff268064 [SCSI] gdth: conv... |
618 |
gdth_pcistr.pdev = pdev; |
1da177e4c Linux-2.6.12-rc2 |
619 620 621 622 623 624 |
base0 = pci_resource_flags(pdev, 0); base1 = pci_resource_flags(pdev, 1); base2 = pci_resource_flags(pdev, 2); if (device <= PCI_DEVICE_ID_VORTEX_GDT6000B || /* GDT6000/B */ device >= PCI_DEVICE_ID_VORTEX_GDT6x17RP) { /* MPR */ if (!(base0 & IORESOURCE_MEM)) |
cff268064 [SCSI] gdth: conv... |
625 626 |
return -ENODEV; gdth_pcistr.dpmem = pci_resource_start(pdev, 0); |
1da177e4c Linux-2.6.12-rc2 |
627 628 629 630 |
} else { /* GDT6110, GDT6120, .. */ if (!(base0 & IORESOURCE_MEM) || !(base2 & IORESOURCE_MEM) || !(base1 & IORESOURCE_IO)) |
cff268064 [SCSI] gdth: conv... |
631 632 633 |
return -ENODEV; gdth_pcistr.dpmem = pci_resource_start(pdev, 2); gdth_pcistr.io = pci_resource_start(pdev, 1); |
1da177e4c Linux-2.6.12-rc2 |
634 635 636 |
} TRACE2(("Controller found at %d/%d, irq %d, dpmem 0x%lx ", |
cff268064 [SCSI] gdth: conv... |
637 638 639 640 |
gdth_pcistr.pdev->bus->number, PCI_SLOT(gdth_pcistr.pdev->devfn), gdth_pcistr.irq, gdth_pcistr.dpmem)); |
1da177e4c Linux-2.6.12-rc2 |
641 |
|
cff268064 [SCSI] gdth: conv... |
642 643 644 |
rc = gdth_pci_probe_one(&gdth_pcistr, &ha); if (rc) return rc; |
1da177e4c Linux-2.6.12-rc2 |
645 |
|
cff268064 [SCSI] gdth: conv... |
646 |
return 0; |
1da177e4c Linux-2.6.12-rc2 |
647 |
} |
8514ef27e [SCSI] gdth: spli... |
648 |
#endif /* CONFIG_PCI */ |
1da177e4c Linux-2.6.12-rc2 |
649 |
|
706a5d456 [SCSI] gdth: spli... |
650 |
#ifdef CONFIG_EISA |
1fe6dbf4d [SCSI] gdth: Conv... |
651 |
static int __init gdth_init_eisa(u16 eisa_adr,gdth_ha_str *ha) |
1da177e4c Linux-2.6.12-rc2 |
652 |
{ |
1fe6dbf4d [SCSI] gdth: Conv... |
653 654 |
u32 retries,id; u8 prot_ver,eisacf,i,irq_found; |
1da177e4c Linux-2.6.12-rc2 |
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 |
TRACE(("gdth_init_eisa() adr. %x ",eisa_adr)); /* disable board interrupts, deinitialize services */ outb(0xff,eisa_adr+EDOORREG); outb(0x00,eisa_adr+EDENABREG); outb(0x00,eisa_adr+EINTENABREG); outb(0xff,eisa_adr+LDOORREG); retries = INIT_RETRIES; gdth_delay(20); while (inb(eisa_adr+EDOORREG) != 0xff) { if (--retries == 0) { printk("GDT-EISA: Initialization error (DEINIT failed) "); return 0; } gdth_delay(1); TRACE2(("wait for DEINIT: retries=%d ",retries)); } prot_ver = inb(eisa_adr+MAILBOXREG); outb(0xff,eisa_adr+EDOORREG); if (prot_ver != PROTOCOL_VERSION) { printk("GDT-EISA: Illegal protocol version "); return 0; } ha->bmic = eisa_adr; |
1fe6dbf4d [SCSI] gdth: Conv... |
685 |
ha->brd_phys = (u32)eisa_adr >> 12; |
1da177e4c Linux-2.6.12-rc2 |
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 |
outl(0,eisa_adr+MAILBOXREG); outl(0,eisa_adr+MAILBOXREG+4); outl(0,eisa_adr+MAILBOXREG+8); outl(0,eisa_adr+MAILBOXREG+12); /* detect IRQ */ if ((id = inl(eisa_adr+ID0REG)) == GDT3_ID) { ha->oem_id = OEM_ID_ICP; ha->type = GDT_EISA; ha->stype = id; outl(1,eisa_adr+MAILBOXREG+8); outb(0xfe,eisa_adr+LDOORREG); retries = INIT_RETRIES; gdth_delay(20); while (inb(eisa_adr+EDOORREG) != 0xfe) { if (--retries == 0) { printk("GDT-EISA: Initialization error (get IRQ failed) "); return 0; } gdth_delay(1); } ha->irq = inb(eisa_adr+MAILBOXREG); outb(0xff,eisa_adr+EDOORREG); TRACE2(("GDT3000/3020: IRQ=%d ",ha->irq)); /* check the result */ if (ha->irq == 0) { TRACE2(("Unknown IRQ, use IRQ table from cmd line ! ")); for (i = 0, irq_found = FALSE; i < MAXHA && irq[i] != 0xff; ++i) { if (irq[i]==10 || irq[i]==11 || irq[i]==12 || irq[i]==14) { irq_found = TRUE; break; } } if (irq_found) { ha->irq = irq[i]; irq[i] = 0; printk("GDT-EISA: Can not detect controller IRQ, "); printk("Use IRQ setting from command line (IRQ = %d) ", ha->irq); } else { printk("GDT-EISA: Initialization error (unknown IRQ), Enable "); printk("the controller BIOS or use command line parameters "); return 0; } } } else { eisacf = inb(eisa_adr+EISAREG) & 7; if (eisacf > 4) /* level triggered */ eisacf -= 4; ha->irq = gdth_irq_tab[eisacf]; ha->oem_id = OEM_ID_ICP; ha->type = GDT_EISA; ha->stype = id; } ha->dma64_support = 0; return 1; } |
706a5d456 [SCSI] gdth: spli... |
753 |
#endif /* CONFIG_EISA */ |
1da177e4c Linux-2.6.12-rc2 |
754 |
|
aed91cb52 [SCSI] gdth: spli... |
755 |
#ifdef CONFIG_ISA |
1fe6dbf4d [SCSI] gdth: Conv... |
756 |
static int __init gdth_init_isa(u32 bios_adr,gdth_ha_str *ha) |
1da177e4c Linux-2.6.12-rc2 |
757 758 759 |
{ register gdt2_dpram_str __iomem *dp2_ptr; int i; |
1fe6dbf4d [SCSI] gdth: Conv... |
760 761 |
u8 irq_drq,prot_ver; u32 retries; |
1da177e4c Linux-2.6.12-rc2 |
762 763 764 765 766 767 768 769 770 771 772 |
TRACE(("gdth_init_isa() bios adr. %x ",bios_adr)); ha->brd = ioremap(bios_adr, sizeof(gdt2_dpram_str)); if (ha->brd == NULL) { printk("GDT-ISA: Initialization error (DPMEM remap error) "); return 0; } dp2_ptr = ha->brd; |
a52667f3c [SCSI] gdth: kill... |
773 |
writeb(1, &dp2_ptr->io.memlock); /* switch off write protection */ |
1da177e4c Linux-2.6.12-rc2 |
774 775 |
/* reset interface area */ memset_io(&dp2_ptr->u, 0, sizeof(dp2_ptr->u)); |
a52667f3c [SCSI] gdth: kill... |
776 |
if (readl(&dp2_ptr->u) != 0) { |
1da177e4c Linux-2.6.12-rc2 |
777 778 779 780 781 782 783 |
printk("GDT-ISA: Initialization error (DPMEM write error) "); iounmap(ha->brd); return 0; } /* disable board interrupts, read DRQ and IRQ */ |
a52667f3c [SCSI] gdth: kill... |
784 785 786 787 |
writeb(0xff, &dp2_ptr->io.irqdel); writeb(0x00, &dp2_ptr->io.irqen); writeb(0x00, &dp2_ptr->u.ic.S_Status); writeb(0x00, &dp2_ptr->u.ic.Cmd_Index); |
1da177e4c Linux-2.6.12-rc2 |
788 |
|
a52667f3c [SCSI] gdth: kill... |
789 |
irq_drq = readb(&dp2_ptr->io.rq); |
1da177e4c Linux-2.6.12-rc2 |
790 791 792 793 794 795 |
for (i=0; i<3; ++i) { if ((irq_drq & 1)==0) break; irq_drq >>= 1; } ha->drq = gdth_drq_tab[i]; |
a52667f3c [SCSI] gdth: kill... |
796 |
irq_drq = readb(&dp2_ptr->io.rq) >> 3; |
1da177e4c Linux-2.6.12-rc2 |
797 798 799 800 801 802 803 804 |
for (i=1; i<5; ++i) { if ((irq_drq & 1)==0) break; irq_drq >>= 1; } ha->irq = gdth_irq_tab[i]; /* deinitialize services */ |
a52667f3c [SCSI] gdth: kill... |
805 806 807 |
writel(bios_adr, &dp2_ptr->u.ic.S_Info[0]); writeb(0xff, &dp2_ptr->u.ic.S_Cmd_Indx); writeb(0, &dp2_ptr->io.event); |
1da177e4c Linux-2.6.12-rc2 |
808 809 |
retries = INIT_RETRIES; gdth_delay(20); |
a52667f3c [SCSI] gdth: kill... |
810 |
while (readb(&dp2_ptr->u.ic.S_Status) != 0xff) { |
1da177e4c Linux-2.6.12-rc2 |
811 812 813 814 815 816 817 818 |
if (--retries == 0) { printk("GDT-ISA: Initialization error (DEINIT failed) "); iounmap(ha->brd); return 0; } gdth_delay(1); } |
1fe6dbf4d [SCSI] gdth: Conv... |
819 |
prot_ver = (u8)readl(&dp2_ptr->u.ic.S_Info[0]); |
a52667f3c [SCSI] gdth: kill... |
820 821 |
writeb(0, &dp2_ptr->u.ic.Status); writeb(0xff, &dp2_ptr->io.irqdel); |
1da177e4c Linux-2.6.12-rc2 |
822 823 824 825 826 827 828 829 830 831 832 833 834 835 |
if (prot_ver != PROTOCOL_VERSION) { printk("GDT-ISA: Illegal protocol version "); iounmap(ha->brd); return 0; } ha->oem_id = OEM_ID_ICP; ha->type = GDT_ISA; ha->ic_all_size = sizeof(dp2_ptr->u); ha->stype= GDT2_ID; ha->brd_phys = bios_adr >> 4; /* special request to controller BIOS */ |
a52667f3c [SCSI] gdth: kill... |
836 837 838 839 840 841 |
writel(0x00, &dp2_ptr->u.ic.S_Info[0]); writel(0x00, &dp2_ptr->u.ic.S_Info[1]); writel(0x01, &dp2_ptr->u.ic.S_Info[2]); writel(0x00, &dp2_ptr->u.ic.S_Info[3]); writeb(0xfe, &dp2_ptr->u.ic.S_Cmd_Indx); writeb(0, &dp2_ptr->io.event); |
1da177e4c Linux-2.6.12-rc2 |
842 843 |
retries = INIT_RETRIES; gdth_delay(20); |
a52667f3c [SCSI] gdth: kill... |
844 |
while (readb(&dp2_ptr->u.ic.S_Status) != 0xfe) { |
1da177e4c Linux-2.6.12-rc2 |
845 846 847 848 849 850 851 852 |
if (--retries == 0) { printk("GDT-ISA: Initialization error "); iounmap(ha->brd); return 0; } gdth_delay(1); } |
a52667f3c [SCSI] gdth: kill... |
853 854 |
writeb(0, &dp2_ptr->u.ic.Status); writeb(0xff, &dp2_ptr->io.irqdel); |
1da177e4c Linux-2.6.12-rc2 |
855 856 857 858 |
ha->dma64_support = 0; return 1; } |
aed91cb52 [SCSI] gdth: spli... |
859 |
#endif /* CONFIG_ISA */ |
1da177e4c Linux-2.6.12-rc2 |
860 |
|
8514ef27e [SCSI] gdth: spli... |
861 |
#ifdef CONFIG_PCI |
ced7172ad gdth section fixes |
862 |
static int __devinit gdth_init_pci(struct pci_dev *pdev, gdth_pci_str *pcistr, |
cff268064 [SCSI] gdth: conv... |
863 |
gdth_ha_str *ha) |
1da177e4c Linux-2.6.12-rc2 |
864 865 866 867 |
{ register gdt6_dpram_str __iomem *dp6_ptr; register gdt6c_dpram_str __iomem *dp6c_ptr; register gdt6m_dpram_str __iomem *dp6m_ptr; |
1fe6dbf4d [SCSI] gdth: Conv... |
868 869 870 |
u32 retries; u8 prot_ver; u16 command; |
1da177e4c Linux-2.6.12-rc2 |
871 872 873 874 |
int i, found = FALSE; TRACE(("gdth_init_pci() ")); |
4c9c8d782 [SCSI] gdth: PCI ... |
875 |
if (pdev->vendor == PCI_VENDOR_ID_INTEL) |
1da177e4c Linux-2.6.12-rc2 |
876 877 878 |
ha->oem_id = OEM_ID_INTEL; else ha->oem_id = OEM_ID_ICP; |
4c9c8d782 [SCSI] gdth: PCI ... |
879 |
ha->brd_phys = (pdev->bus->number << 8) | (pdev->devfn & 0xf8); |
1fe6dbf4d [SCSI] gdth: Conv... |
880 |
ha->stype = (u32)pdev->device; |
4c9c8d782 [SCSI] gdth: PCI ... |
881 882 |
ha->irq = pdev->irq; ha->pdev = pdev; |
1da177e4c Linux-2.6.12-rc2 |
883 |
|
8e9a8a0d5 [SCSI] gdth: remo... |
884 |
if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6000B) { /* GDT6000/B */ |
1da177e4c Linux-2.6.12-rc2 |
885 886 887 888 889 890 891 892 893 894 |
TRACE2(("init_pci() dpmem %lx irq %d ",pcistr->dpmem,ha->irq)); ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6_dpram_str)); if (ha->brd == NULL) { printk("GDT-PCI: Initialization error (DPMEM remap error) "); return 0; } /* check and reset interface area */ dp6_ptr = ha->brd; |
a52667f3c [SCSI] gdth: kill... |
895 896 |
writel(DPMEM_MAGIC, &dp6_ptr->u); if (readl(&dp6_ptr->u) != DPMEM_MAGIC) { |
1da177e4c Linux-2.6.12-rc2 |
897 898 899 900 901 902 |
printk("GDT-PCI: Cannot access DPMEM at 0x%lx (shadowed?) ", pcistr->dpmem); found = FALSE; for (i = 0xC8000; i < 0xE8000; i += 0x4000) { iounmap(ha->brd); |
1fe6dbf4d [SCSI] gdth: Conv... |
903 |
ha->brd = ioremap(i, sizeof(u16)); |
1da177e4c Linux-2.6.12-rc2 |
904 905 906 907 908 |
if (ha->brd == NULL) { printk("GDT-PCI: Initialization error (DPMEM remap error) "); return 0; } |
a52667f3c [SCSI] gdth: kill... |
909 |
if (readw(ha->brd) != 0xffff) { |
1da177e4c Linux-2.6.12-rc2 |
910 911 912 913 914 |
TRACE2(("init_pci_old() address 0x%x busy ", i)); continue; } iounmap(ha->brd); |
4c9c8d782 [SCSI] gdth: PCI ... |
915 |
pci_write_config_dword(pdev, PCI_BASE_ADDRESS_0, i); |
1da177e4c Linux-2.6.12-rc2 |
916 917 918 919 920 921 922 |
ha->brd = ioremap(i, sizeof(gdt6_dpram_str)); if (ha->brd == NULL) { printk("GDT-PCI: Initialization error (DPMEM remap error) "); return 0; } dp6_ptr = ha->brd; |
a52667f3c [SCSI] gdth: kill... |
923 924 |
writel(DPMEM_MAGIC, &dp6_ptr->u); if (readl(&dp6_ptr->u) == DPMEM_MAGIC) { |
1da177e4c Linux-2.6.12-rc2 |
925 926 927 928 929 930 931 932 933 934 935 936 937 938 |
printk("GDT-PCI: Use free address at 0x%x ", i); found = TRUE; break; } } if (!found) { printk("GDT-PCI: No free address found! "); iounmap(ha->brd); return 0; } } memset_io(&dp6_ptr->u, 0, sizeof(dp6_ptr->u)); |
a52667f3c [SCSI] gdth: kill... |
939 |
if (readl(&dp6_ptr->u) != 0) { |
1da177e4c Linux-2.6.12-rc2 |
940 941 942 943 944 945 946 |
printk("GDT-PCI: Initialization error (DPMEM write error) "); iounmap(ha->brd); return 0; } /* disable board interrupts, deinit services */ |
a52667f3c [SCSI] gdth: kill... |
947 948 949 950 951 952 953 954 |
writeb(0xff, &dp6_ptr->io.irqdel); writeb(0x00, &dp6_ptr->io.irqen); writeb(0x00, &dp6_ptr->u.ic.S_Status); writeb(0x00, &dp6_ptr->u.ic.Cmd_Index); writel(pcistr->dpmem, &dp6_ptr->u.ic.S_Info[0]); writeb(0xff, &dp6_ptr->u.ic.S_Cmd_Indx); writeb(0, &dp6_ptr->io.event); |
1da177e4c Linux-2.6.12-rc2 |
955 956 |
retries = INIT_RETRIES; gdth_delay(20); |
a52667f3c [SCSI] gdth: kill... |
957 |
while (readb(&dp6_ptr->u.ic.S_Status) != 0xff) { |
1da177e4c Linux-2.6.12-rc2 |
958 959 960 961 962 963 964 965 |
if (--retries == 0) { printk("GDT-PCI: Initialization error (DEINIT failed) "); iounmap(ha->brd); return 0; } gdth_delay(1); } |
1fe6dbf4d [SCSI] gdth: Conv... |
966 |
prot_ver = (u8)readl(&dp6_ptr->u.ic.S_Info[0]); |
a52667f3c [SCSI] gdth: kill... |
967 968 |
writeb(0, &dp6_ptr->u.ic.S_Status); writeb(0xff, &dp6_ptr->io.irqdel); |
1da177e4c Linux-2.6.12-rc2 |
969 970 971 972 973 974 975 976 977 978 979 |
if (prot_ver != PROTOCOL_VERSION) { printk("GDT-PCI: Illegal protocol version "); iounmap(ha->brd); return 0; } ha->type = GDT_PCI; ha->ic_all_size = sizeof(dp6_ptr->u); /* special command to controller BIOS */ |
a52667f3c [SCSI] gdth: kill... |
980 981 982 983 984 985 |
writel(0x00, &dp6_ptr->u.ic.S_Info[0]); writel(0x00, &dp6_ptr->u.ic.S_Info[1]); writel(0x00, &dp6_ptr->u.ic.S_Info[2]); writel(0x00, &dp6_ptr->u.ic.S_Info[3]); writeb(0xfe, &dp6_ptr->u.ic.S_Cmd_Indx); writeb(0, &dp6_ptr->io.event); |
1da177e4c Linux-2.6.12-rc2 |
986 987 |
retries = INIT_RETRIES; gdth_delay(20); |
a52667f3c [SCSI] gdth: kill... |
988 |
while (readb(&dp6_ptr->u.ic.S_Status) != 0xfe) { |
1da177e4c Linux-2.6.12-rc2 |
989 990 991 992 993 994 995 996 |
if (--retries == 0) { printk("GDT-PCI: Initialization error "); iounmap(ha->brd); return 0; } gdth_delay(1); } |
a52667f3c [SCSI] gdth: kill... |
997 998 |
writeb(0, &dp6_ptr->u.ic.S_Status); writeb(0xff, &dp6_ptr->io.irqdel); |
1da177e4c Linux-2.6.12-rc2 |
999 1000 |
ha->dma64_support = 0; |
8e9a8a0d5 [SCSI] gdth: remo... |
1001 |
} else if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6555) { /* GDT6110, ... */ |
1da177e4c Linux-2.6.12-rc2 |
1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 |
ha->plx = (gdt6c_plx_regs *)pcistr->io; TRACE2(("init_pci_new() dpmem %lx irq %d ", pcistr->dpmem,ha->irq)); ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6c_dpram_str)); if (ha->brd == NULL) { printk("GDT-PCI: Initialization error (DPMEM remap error) "); iounmap(ha->brd); return 0; } /* check and reset interface area */ dp6c_ptr = ha->brd; |
a52667f3c [SCSI] gdth: kill... |
1015 1016 |
writel(DPMEM_MAGIC, &dp6c_ptr->u); if (readl(&dp6c_ptr->u) != DPMEM_MAGIC) { |
1da177e4c Linux-2.6.12-rc2 |
1017 1018 1019 1020 1021 1022 |
printk("GDT-PCI: Cannot access DPMEM at 0x%lx (shadowed?) ", pcistr->dpmem); found = FALSE; for (i = 0xC8000; i < 0xE8000; i += 0x4000) { iounmap(ha->brd); |
1fe6dbf4d [SCSI] gdth: Conv... |
1023 |
ha->brd = ioremap(i, sizeof(u16)); |
1da177e4c Linux-2.6.12-rc2 |
1024 1025 1026 1027 1028 |
if (ha->brd == NULL) { printk("GDT-PCI: Initialization error (DPMEM remap error) "); return 0; } |
a52667f3c [SCSI] gdth: kill... |
1029 |
if (readw(ha->brd) != 0xffff) { |
1da177e4c Linux-2.6.12-rc2 |
1030 1031 1032 1033 1034 |
TRACE2(("init_pci_plx() address 0x%x busy ", i)); continue; } iounmap(ha->brd); |
4c9c8d782 [SCSI] gdth: PCI ... |
1035 |
pci_write_config_dword(pdev, PCI_BASE_ADDRESS_2, i); |
1da177e4c Linux-2.6.12-rc2 |
1036 1037 1038 1039 1040 1041 1042 |
ha->brd = ioremap(i, sizeof(gdt6c_dpram_str)); if (ha->brd == NULL) { printk("GDT-PCI: Initialization error (DPMEM remap error) "); return 0; } dp6c_ptr = ha->brd; |
a52667f3c [SCSI] gdth: kill... |
1043 1044 |
writel(DPMEM_MAGIC, &dp6c_ptr->u); if (readl(&dp6c_ptr->u) == DPMEM_MAGIC) { |
1da177e4c Linux-2.6.12-rc2 |
1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 |
printk("GDT-PCI: Use free address at 0x%x ", i); found = TRUE; break; } } if (!found) { printk("GDT-PCI: No free address found! "); iounmap(ha->brd); return 0; } } memset_io(&dp6c_ptr->u, 0, sizeof(dp6c_ptr->u)); |
a52667f3c [SCSI] gdth: kill... |
1059 |
if (readl(&dp6c_ptr->u) != 0) { |
1da177e4c Linux-2.6.12-rc2 |
1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 |
printk("GDT-PCI: Initialization error (DPMEM write error) "); iounmap(ha->brd); return 0; } /* disable board interrupts, deinit services */ outb(0x00,PTR2USHORT(&ha->plx->control1)); outb(0xff,PTR2USHORT(&ha->plx->edoor_reg)); |
a52667f3c [SCSI] gdth: kill... |
1070 1071 |
writeb(0x00, &dp6c_ptr->u.ic.S_Status); writeb(0x00, &dp6c_ptr->u.ic.Cmd_Index); |
1da177e4c Linux-2.6.12-rc2 |
1072 |
|
a52667f3c [SCSI] gdth: kill... |
1073 1074 |
writel(pcistr->dpmem, &dp6c_ptr->u.ic.S_Info[0]); writeb(0xff, &dp6c_ptr->u.ic.S_Cmd_Indx); |
1da177e4c Linux-2.6.12-rc2 |
1075 1076 1077 1078 1079 |
outb(1,PTR2USHORT(&ha->plx->ldoor_reg)); retries = INIT_RETRIES; gdth_delay(20); |
a52667f3c [SCSI] gdth: kill... |
1080 |
while (readb(&dp6c_ptr->u.ic.S_Status) != 0xff) { |
1da177e4c Linux-2.6.12-rc2 |
1081 1082 1083 1084 1085 1086 1087 1088 |
if (--retries == 0) { printk("GDT-PCI: Initialization error (DEINIT failed) "); iounmap(ha->brd); return 0; } gdth_delay(1); } |
1fe6dbf4d [SCSI] gdth: Conv... |
1089 |
prot_ver = (u8)readl(&dp6c_ptr->u.ic.S_Info[0]); |
a52667f3c [SCSI] gdth: kill... |
1090 |
writeb(0, &dp6c_ptr->u.ic.Status); |
1da177e4c Linux-2.6.12-rc2 |
1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 |
if (prot_ver != PROTOCOL_VERSION) { printk("GDT-PCI: Illegal protocol version "); iounmap(ha->brd); return 0; } ha->type = GDT_PCINEW; ha->ic_all_size = sizeof(dp6c_ptr->u); /* special command to controller BIOS */ |
a52667f3c [SCSI] gdth: kill... |
1102 1103 1104 1105 1106 |
writel(0x00, &dp6c_ptr->u.ic.S_Info[0]); writel(0x00, &dp6c_ptr->u.ic.S_Info[1]); writel(0x00, &dp6c_ptr->u.ic.S_Info[2]); writel(0x00, &dp6c_ptr->u.ic.S_Info[3]); writeb(0xfe, &dp6c_ptr->u.ic.S_Cmd_Indx); |
1da177e4c Linux-2.6.12-rc2 |
1107 1108 1109 1110 1111 |
outb(1,PTR2USHORT(&ha->plx->ldoor_reg)); retries = INIT_RETRIES; gdth_delay(20); |
a52667f3c [SCSI] gdth: kill... |
1112 |
while (readb(&dp6c_ptr->u.ic.S_Status) != 0xfe) { |
1da177e4c Linux-2.6.12-rc2 |
1113 1114 1115 1116 1117 1118 1119 1120 |
if (--retries == 0) { printk("GDT-PCI: Initialization error "); iounmap(ha->brd); return 0; } gdth_delay(1); } |
a52667f3c [SCSI] gdth: kill... |
1121 |
writeb(0, &dp6c_ptr->u.ic.S_Status); |
1da177e4c Linux-2.6.12-rc2 |
1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 |
ha->dma64_support = 0; } else { /* MPR */ TRACE2(("init_pci_mpr() dpmem %lx irq %d ",pcistr->dpmem,ha->irq)); ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6m_dpram_str)); if (ha->brd == NULL) { printk("GDT-PCI: Initialization error (DPMEM remap error) "); return 0; } /* manipulate config. space to enable DPMEM, start RP controller */ |
4c9c8d782 [SCSI] gdth: PCI ... |
1136 |
pci_read_config_word(pdev, PCI_COMMAND, &command); |
1da177e4c Linux-2.6.12-rc2 |
1137 |
command |= 6; |
4c9c8d782 [SCSI] gdth: PCI ... |
1138 1139 1140 |
pci_write_config_word(pdev, PCI_COMMAND, command); if (pci_resource_start(pdev, 8) == 1UL) pci_resource_start(pdev, 8) = 0UL; |
1da177e4c Linux-2.6.12-rc2 |
1141 |
i = 0xFEFF0001UL; |
4c9c8d782 [SCSI] gdth: PCI ... |
1142 |
pci_write_config_dword(pdev, PCI_ROM_ADDRESS, i); |
1da177e4c Linux-2.6.12-rc2 |
1143 |
gdth_delay(1); |
4c9c8d782 [SCSI] gdth: PCI ... |
1144 1145 |
pci_write_config_dword(pdev, PCI_ROM_ADDRESS, pci_resource_start(pdev, 8)); |
1da177e4c Linux-2.6.12-rc2 |
1146 1147 1148 1149 1150 |
dp6m_ptr = ha->brd; /* Ensure that it is safe to access the non HW portions of DPMEM. * Aditional check needed for Xscale based RAID controllers */ |
a52667f3c [SCSI] gdth: kill... |
1151 |
while( ((int)readb(&dp6m_ptr->i960r.sema0_reg) ) & 3 ) |
1da177e4c Linux-2.6.12-rc2 |
1152 1153 1154 |
gdth_delay(1); /* check and reset interface area */ |
a52667f3c [SCSI] gdth: kill... |
1155 1156 |
writel(DPMEM_MAGIC, &dp6m_ptr->u); if (readl(&dp6m_ptr->u) != DPMEM_MAGIC) { |
1da177e4c Linux-2.6.12-rc2 |
1157 1158 1159 1160 1161 1162 |
printk("GDT-PCI: Cannot access DPMEM at 0x%lx (shadowed?) ", pcistr->dpmem); found = FALSE; for (i = 0xC8000; i < 0xE8000; i += 0x4000) { iounmap(ha->brd); |
1fe6dbf4d [SCSI] gdth: Conv... |
1163 |
ha->brd = ioremap(i, sizeof(u16)); |
1da177e4c Linux-2.6.12-rc2 |
1164 1165 1166 1167 1168 |
if (ha->brd == NULL) { printk("GDT-PCI: Initialization error (DPMEM remap error) "); return 0; } |
a52667f3c [SCSI] gdth: kill... |
1169 |
if (readw(ha->brd) != 0xffff) { |
1da177e4c Linux-2.6.12-rc2 |
1170 1171 1172 1173 1174 |
TRACE2(("init_pci_mpr() address 0x%x busy ", i)); continue; } iounmap(ha->brd); |
4c9c8d782 [SCSI] gdth: PCI ... |
1175 |
pci_write_config_dword(pdev, PCI_BASE_ADDRESS_0, i); |
1da177e4c Linux-2.6.12-rc2 |
1176 1177 1178 1179 1180 1181 1182 |
ha->brd = ioremap(i, sizeof(gdt6m_dpram_str)); if (ha->brd == NULL) { printk("GDT-PCI: Initialization error (DPMEM remap error) "); return 0; } dp6m_ptr = ha->brd; |
a52667f3c [SCSI] gdth: kill... |
1183 1184 |
writel(DPMEM_MAGIC, &dp6m_ptr->u); if (readl(&dp6m_ptr->u) == DPMEM_MAGIC) { |
1da177e4c Linux-2.6.12-rc2 |
1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 |
printk("GDT-PCI: Use free address at 0x%x ", i); found = TRUE; break; } } if (!found) { printk("GDT-PCI: No free address found! "); iounmap(ha->brd); return 0; } } memset_io(&dp6m_ptr->u, 0, sizeof(dp6m_ptr->u)); /* disable board interrupts, deinit services */ |
a52667f3c [SCSI] gdth: kill... |
1201 |
writeb(readb(&dp6m_ptr->i960r.edoor_en_reg) | 4, |
1da177e4c Linux-2.6.12-rc2 |
1202 |
&dp6m_ptr->i960r.edoor_en_reg); |
a52667f3c [SCSI] gdth: kill... |
1203 1204 1205 |
writeb(0xff, &dp6m_ptr->i960r.edoor_reg); writeb(0x00, &dp6m_ptr->u.ic.S_Status); writeb(0x00, &dp6m_ptr->u.ic.Cmd_Index); |
1da177e4c Linux-2.6.12-rc2 |
1206 |
|
a52667f3c [SCSI] gdth: kill... |
1207 1208 1209 |
writel(pcistr->dpmem, &dp6m_ptr->u.ic.S_Info[0]); writeb(0xff, &dp6m_ptr->u.ic.S_Cmd_Indx); writeb(1, &dp6m_ptr->i960r.ldoor_reg); |
1da177e4c Linux-2.6.12-rc2 |
1210 1211 |
retries = INIT_RETRIES; gdth_delay(20); |
a52667f3c [SCSI] gdth: kill... |
1212 |
while (readb(&dp6m_ptr->u.ic.S_Status) != 0xff) { |
1da177e4c Linux-2.6.12-rc2 |
1213 1214 1215 1216 1217 1218 1219 1220 |
if (--retries == 0) { printk("GDT-PCI: Initialization error (DEINIT failed) "); iounmap(ha->brd); return 0; } gdth_delay(1); } |
1fe6dbf4d [SCSI] gdth: Conv... |
1221 |
prot_ver = (u8)readl(&dp6m_ptr->u.ic.S_Info[0]); |
a52667f3c [SCSI] gdth: kill... |
1222 |
writeb(0, &dp6m_ptr->u.ic.S_Status); |
1da177e4c Linux-2.6.12-rc2 |
1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 |
if (prot_ver != PROTOCOL_VERSION) { printk("GDT-PCI: Illegal protocol version "); iounmap(ha->brd); return 0; } ha->type = GDT_PCIMPR; ha->ic_all_size = sizeof(dp6m_ptr->u); /* special command to controller BIOS */ |
a52667f3c [SCSI] gdth: kill... |
1234 1235 1236 1237 1238 1239 |
writel(0x00, &dp6m_ptr->u.ic.S_Info[0]); writel(0x00, &dp6m_ptr->u.ic.S_Info[1]); writel(0x00, &dp6m_ptr->u.ic.S_Info[2]); writel(0x00, &dp6m_ptr->u.ic.S_Info[3]); writeb(0xfe, &dp6m_ptr->u.ic.S_Cmd_Indx); writeb(1, &dp6m_ptr->i960r.ldoor_reg); |
1da177e4c Linux-2.6.12-rc2 |
1240 1241 |
retries = INIT_RETRIES; gdth_delay(20); |
a52667f3c [SCSI] gdth: kill... |
1242 |
while (readb(&dp6m_ptr->u.ic.S_Status) != 0xfe) { |
1da177e4c Linux-2.6.12-rc2 |
1243 1244 1245 1246 1247 1248 1249 1250 |
if (--retries == 0) { printk("GDT-PCI: Initialization error "); iounmap(ha->brd); return 0; } gdth_delay(1); } |
a52667f3c [SCSI] gdth: kill... |
1251 |
writeb(0, &dp6m_ptr->u.ic.S_Status); |
1da177e4c Linux-2.6.12-rc2 |
1252 1253 |
/* read FW version to detect 64-bit DMA support */ |
a52667f3c [SCSI] gdth: kill... |
1254 1255 |
writeb(0xfd, &dp6m_ptr->u.ic.S_Cmd_Indx); writeb(1, &dp6m_ptr->i960r.ldoor_reg); |
1da177e4c Linux-2.6.12-rc2 |
1256 1257 |
retries = INIT_RETRIES; gdth_delay(20); |
a52667f3c [SCSI] gdth: kill... |
1258 |
while (readb(&dp6m_ptr->u.ic.S_Status) != 0xfd) { |
1da177e4c Linux-2.6.12-rc2 |
1259 1260 1261 1262 1263 1264 1265 1266 |
if (--retries == 0) { printk("GDT-PCI: Initialization error (DEINIT failed) "); iounmap(ha->brd); return 0; } gdth_delay(1); } |
1fe6dbf4d [SCSI] gdth: Conv... |
1267 |
prot_ver = (u8)(readl(&dp6m_ptr->u.ic.S_Info[0]) >> 16); |
a52667f3c [SCSI] gdth: kill... |
1268 |
writeb(0, &dp6m_ptr->u.ic.S_Status); |
1da177e4c Linux-2.6.12-rc2 |
1269 1270 1271 1272 1273 1274 1275 1276 |
if (prot_ver < 0x2b) /* FW < x.43: no 64-bit DMA support */ ha->dma64_support = 0; else ha->dma64_support = 1; } return 1; } |
8514ef27e [SCSI] gdth: spli... |
1277 |
#endif /* CONFIG_PCI */ |
1da177e4c Linux-2.6.12-rc2 |
1278 1279 |
/* controller protocol functions */ |
ced7172ad gdth section fixes |
1280 |
static void __devinit gdth_enable_int(gdth_ha_str *ha) |
1da177e4c Linux-2.6.12-rc2 |
1281 |
{ |
1fe6dbf4d [SCSI] gdth: Conv... |
1282 |
unsigned long flags; |
1da177e4c Linux-2.6.12-rc2 |
1283 1284 1285 |
gdt2_dpram_str __iomem *dp2_ptr; gdt6_dpram_str __iomem *dp6_ptr; gdt6m_dpram_str __iomem *dp6m_ptr; |
45f1a41b2 [SCSI] gdth: clea... |
1286 1287 |
TRACE(("gdth_enable_int() hanum %d ",ha->hanum)); |
1da177e4c Linux-2.6.12-rc2 |
1288 1289 1290 1291 1292 1293 1294 1295 |
spin_lock_irqsave(&ha->smp_lock, flags); if (ha->type == GDT_EISA) { outb(0xff, ha->bmic + EDOORREG); outb(0xff, ha->bmic + EDENABREG); outb(0x01, ha->bmic + EINTENABREG); } else if (ha->type == GDT_ISA) { dp2_ptr = ha->brd; |
a52667f3c [SCSI] gdth: kill... |
1296 1297 1298 |
writeb(1, &dp2_ptr->io.irqdel); writeb(0, &dp2_ptr->u.ic.Cmd_Index); writeb(1, &dp2_ptr->io.irqen); |
1da177e4c Linux-2.6.12-rc2 |
1299 1300 |
} else if (ha->type == GDT_PCI) { dp6_ptr = ha->brd; |
a52667f3c [SCSI] gdth: kill... |
1301 1302 1303 |
writeb(1, &dp6_ptr->io.irqdel); writeb(0, &dp6_ptr->u.ic.Cmd_Index); writeb(1, &dp6_ptr->io.irqen); |
1da177e4c Linux-2.6.12-rc2 |
1304 1305 1306 1307 1308 |
} else if (ha->type == GDT_PCINEW) { outb(0xff, PTR2USHORT(&ha->plx->edoor_reg)); outb(0x03, PTR2USHORT(&ha->plx->control1)); } else if (ha->type == GDT_PCIMPR) { dp6m_ptr = ha->brd; |
a52667f3c [SCSI] gdth: kill... |
1309 1310 |
writeb(0xff, &dp6m_ptr->i960r.edoor_reg); writeb(readb(&dp6m_ptr->i960r.edoor_en_reg) & ~4, |
1da177e4c Linux-2.6.12-rc2 |
1311 1312 1313 1314 |
&dp6m_ptr->i960r.edoor_en_reg); } spin_unlock_irqrestore(&ha->smp_lock, flags); } |
10e1b4bc9 [SCSI] gdth: gdth... |
1315 |
/* return IStatus if interrupt was from this card else 0 */ |
1fe6dbf4d [SCSI] gdth: Conv... |
1316 |
static u8 gdth_get_status(gdth_ha_str *ha) |
1da177e4c Linux-2.6.12-rc2 |
1317 |
{ |
1fe6dbf4d [SCSI] gdth: Conv... |
1318 |
u8 IStatus = 0; |
10e1b4bc9 [SCSI] gdth: gdth... |
1319 |
|
230e886e7 [SCSI] gdth: kill... |
1320 1321 |
TRACE(("gdth_get_status() irq %d ctr_count %d ", ha->irq, gdth_ctr_count)); |
1da177e4c Linux-2.6.12-rc2 |
1322 |
|
1da177e4c Linux-2.6.12-rc2 |
1323 |
if (ha->type == GDT_EISA) |
1fe6dbf4d [SCSI] gdth: Conv... |
1324 |
IStatus = inb((u16)ha->bmic + EDOORREG); |
1da177e4c Linux-2.6.12-rc2 |
1325 |
else if (ha->type == GDT_ISA) |
10e1b4bc9 [SCSI] gdth: gdth... |
1326 |
IStatus = |
a52667f3c [SCSI] gdth: kill... |
1327 |
readb(&((gdt2_dpram_str __iomem *)ha->brd)->u.ic.Cmd_Index); |
1da177e4c Linux-2.6.12-rc2 |
1328 |
else if (ha->type == GDT_PCI) |
10e1b4bc9 [SCSI] gdth: gdth... |
1329 |
IStatus = |
a52667f3c [SCSI] gdth: kill... |
1330 |
readb(&((gdt6_dpram_str __iomem *)ha->brd)->u.ic.Cmd_Index); |
1da177e4c Linux-2.6.12-rc2 |
1331 |
else if (ha->type == GDT_PCINEW) |
10e1b4bc9 [SCSI] gdth: gdth... |
1332 |
IStatus = inb(PTR2USHORT(&ha->plx->edoor_reg)); |
1da177e4c Linux-2.6.12-rc2 |
1333 |
else if (ha->type == GDT_PCIMPR) |
10e1b4bc9 [SCSI] gdth: gdth... |
1334 |
IStatus = |
a52667f3c [SCSI] gdth: kill... |
1335 |
readb(&((gdt6m_dpram_str __iomem *)ha->brd)->i960r.edoor_reg); |
10e1b4bc9 [SCSI] gdth: gdth... |
1336 1337 |
return IStatus; |
1da177e4c Linux-2.6.12-rc2 |
1338 |
} |
10e1b4bc9 [SCSI] gdth: gdth... |
1339 |
|
45f1a41b2 [SCSI] gdth: clea... |
1340 |
static int gdth_test_busy(gdth_ha_str *ha) |
1da177e4c Linux-2.6.12-rc2 |
1341 |
{ |
1da177e4c Linux-2.6.12-rc2 |
1342 |
register int gdtsema0 = 0; |
45f1a41b2 [SCSI] gdth: clea... |
1343 1344 |
TRACE(("gdth_test_busy() hanum %d ", ha->hanum)); |
1da177e4c Linux-2.6.12-rc2 |
1345 1346 1347 |
if (ha->type == GDT_EISA) gdtsema0 = (int)inb(ha->bmic + SEMA0REG); else if (ha->type == GDT_ISA) |
a52667f3c [SCSI] gdth: kill... |
1348 |
gdtsema0 = (int)readb(&((gdt2_dpram_str __iomem *)ha->brd)->u.ic.Sema0); |
1da177e4c Linux-2.6.12-rc2 |
1349 |
else if (ha->type == GDT_PCI) |
a52667f3c [SCSI] gdth: kill... |
1350 |
gdtsema0 = (int)readb(&((gdt6_dpram_str __iomem *)ha->brd)->u.ic.Sema0); |
1da177e4c Linux-2.6.12-rc2 |
1351 1352 1353 1354 |
else if (ha->type == GDT_PCINEW) gdtsema0 = (int)inb(PTR2USHORT(&ha->plx->sema0_reg)); else if (ha->type == GDT_PCIMPR) gdtsema0 = |
a52667f3c [SCSI] gdth: kill... |
1355 |
(int)readb(&((gdt6m_dpram_str __iomem *)ha->brd)->i960r.sema0_reg); |
1da177e4c Linux-2.6.12-rc2 |
1356 1357 1358 |
return (gdtsema0 & 1); } |
45f1a41b2 [SCSI] gdth: clea... |
1359 |
static int gdth_get_cmd_index(gdth_ha_str *ha) |
1da177e4c Linux-2.6.12-rc2 |
1360 |
{ |
1da177e4c Linux-2.6.12-rc2 |
1361 |
int i; |
45f1a41b2 [SCSI] gdth: clea... |
1362 1363 |
TRACE(("gdth_get_cmd_index() hanum %d ", ha->hanum)); |
1da177e4c Linux-2.6.12-rc2 |
1364 |
|
1da177e4c Linux-2.6.12-rc2 |
1365 1366 1367 1368 |
for (i=0; i<GDTH_MAXCMDS; ++i) { if (ha->cmd_tab[i].cmnd == UNUSED_CMND) { ha->cmd_tab[i].cmnd = ha->pccb->RequestBuffer; ha->cmd_tab[i].service = ha->pccb->Service; |
1fe6dbf4d [SCSI] gdth: Conv... |
1369 |
ha->pccb->CommandIndex = (u32)i+2; |
1da177e4c Linux-2.6.12-rc2 |
1370 1371 1372 1373 1374 |
return (i+2); } } return 0; } |
45f1a41b2 [SCSI] gdth: clea... |
1375 |
static void gdth_set_sema0(gdth_ha_str *ha) |
1da177e4c Linux-2.6.12-rc2 |
1376 |
{ |
45f1a41b2 [SCSI] gdth: clea... |
1377 1378 |
TRACE(("gdth_set_sema0() hanum %d ", ha->hanum)); |
1da177e4c Linux-2.6.12-rc2 |
1379 |
|
1da177e4c Linux-2.6.12-rc2 |
1380 1381 1382 |
if (ha->type == GDT_EISA) { outb(1, ha->bmic + SEMA0REG); } else if (ha->type == GDT_ISA) { |
a52667f3c [SCSI] gdth: kill... |
1383 |
writeb(1, &((gdt2_dpram_str __iomem *)ha->brd)->u.ic.Sema0); |
1da177e4c Linux-2.6.12-rc2 |
1384 |
} else if (ha->type == GDT_PCI) { |
a52667f3c [SCSI] gdth: kill... |
1385 |
writeb(1, &((gdt6_dpram_str __iomem *)ha->brd)->u.ic.Sema0); |
1da177e4c Linux-2.6.12-rc2 |
1386 1387 1388 |
} else if (ha->type == GDT_PCINEW) { outb(1, PTR2USHORT(&ha->plx->sema0_reg)); } else if (ha->type == GDT_PCIMPR) { |
a52667f3c [SCSI] gdth: kill... |
1389 |
writeb(1, &((gdt6m_dpram_str __iomem *)ha->brd)->i960r.sema0_reg); |
1da177e4c Linux-2.6.12-rc2 |
1390 1391 |
} } |
45f1a41b2 [SCSI] gdth: clea... |
1392 |
static void gdth_copy_command(gdth_ha_str *ha) |
1da177e4c Linux-2.6.12-rc2 |
1393 |
{ |
1da177e4c Linux-2.6.12-rc2 |
1394 1395 1396 1397 1398 |
register gdth_cmd_str *cmd_ptr; register gdt6m_dpram_str __iomem *dp6m_ptr; register gdt6c_dpram_str __iomem *dp6c_ptr; gdt6_dpram_str __iomem *dp6_ptr; gdt2_dpram_str __iomem *dp2_ptr; |
1fe6dbf4d [SCSI] gdth: Conv... |
1399 |
u16 cp_count,dp_offset,cmd_no; |
1da177e4c Linux-2.6.12-rc2 |
1400 |
|
45f1a41b2 [SCSI] gdth: clea... |
1401 1402 |
TRACE(("gdth_copy_command() hanum %d ", ha->hanum)); |
1da177e4c Linux-2.6.12-rc2 |
1403 |
|
1da177e4c Linux-2.6.12-rc2 |
1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 |
cp_count = ha->cmd_len; dp_offset= ha->cmd_offs_dpmem; cmd_no = ha->cmd_cnt; cmd_ptr = ha->pccb; ++ha->cmd_cnt; if (ha->type == GDT_EISA) return; /* no DPMEM, no copy */ /* set cpcount dword aligned */ if (cp_count & 3) cp_count += (4 - (cp_count & 3)); ha->cmd_offs_dpmem += cp_count; /* set offset and service, copy command to DPMEM */ if (ha->type == GDT_ISA) { dp2_ptr = ha->brd; |
a52667f3c [SCSI] gdth: kill... |
1422 |
writew(dp_offset + DPMEM_COMMAND_OFFSET, |
1da177e4c Linux-2.6.12-rc2 |
1423 |
&dp2_ptr->u.ic.comm_queue[cmd_no].offset); |
1fe6dbf4d [SCSI] gdth: Conv... |
1424 |
writew((u16)cmd_ptr->Service, |
1da177e4c Linux-2.6.12-rc2 |
1425 1426 1427 1428 |
&dp2_ptr->u.ic.comm_queue[cmd_no].serv_id); memcpy_toio(&dp2_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count); } else if (ha->type == GDT_PCI) { dp6_ptr = ha->brd; |
a52667f3c [SCSI] gdth: kill... |
1429 |
writew(dp_offset + DPMEM_COMMAND_OFFSET, |
1da177e4c Linux-2.6.12-rc2 |
1430 |
&dp6_ptr->u.ic.comm_queue[cmd_no].offset); |
1fe6dbf4d [SCSI] gdth: Conv... |
1431 |
writew((u16)cmd_ptr->Service, |
1da177e4c Linux-2.6.12-rc2 |
1432 1433 1434 1435 |
&dp6_ptr->u.ic.comm_queue[cmd_no].serv_id); memcpy_toio(&dp6_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count); } else if (ha->type == GDT_PCINEW) { dp6c_ptr = ha->brd; |
a52667f3c [SCSI] gdth: kill... |
1436 |
writew(dp_offset + DPMEM_COMMAND_OFFSET, |
1da177e4c Linux-2.6.12-rc2 |
1437 |
&dp6c_ptr->u.ic.comm_queue[cmd_no].offset); |
1fe6dbf4d [SCSI] gdth: Conv... |
1438 |
writew((u16)cmd_ptr->Service, |
1da177e4c Linux-2.6.12-rc2 |
1439 1440 1441 1442 |
&dp6c_ptr->u.ic.comm_queue[cmd_no].serv_id); memcpy_toio(&dp6c_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count); } else if (ha->type == GDT_PCIMPR) { dp6m_ptr = ha->brd; |
a52667f3c [SCSI] gdth: kill... |
1443 |
writew(dp_offset + DPMEM_COMMAND_OFFSET, |
1da177e4c Linux-2.6.12-rc2 |
1444 |
&dp6m_ptr->u.ic.comm_queue[cmd_no].offset); |
1fe6dbf4d [SCSI] gdth: Conv... |
1445 |
writew((u16)cmd_ptr->Service, |
1da177e4c Linux-2.6.12-rc2 |
1446 1447 1448 1449 |
&dp6m_ptr->u.ic.comm_queue[cmd_no].serv_id); memcpy_toio(&dp6m_ptr->u.ic.gdt_dpr_cmd[dp_offset],cmd_ptr,cp_count); } } |
45f1a41b2 [SCSI] gdth: clea... |
1450 |
static void gdth_release_event(gdth_ha_str *ha) |
1da177e4c Linux-2.6.12-rc2 |
1451 |
{ |
45f1a41b2 [SCSI] gdth: clea... |
1452 1453 |
TRACE(("gdth_release_event() hanum %d ", ha->hanum)); |
1da177e4c Linux-2.6.12-rc2 |
1454 1455 1456 |
#ifdef GDTH_STATISTICS { |
1fe6dbf4d [SCSI] gdth: Conv... |
1457 |
u32 i,j; |
1da177e4c Linux-2.6.12-rc2 |
1458 1459 1460 1461 1462 1463 |
for (i=0,j=0; j<GDTH_MAXCMDS; ++j) { if (ha->cmd_tab[j].cmnd != UNUSED_CMND) ++i; } if (max_index < i) { max_index = i; |
1fe6dbf4d [SCSI] gdth: Conv... |
1464 1465 |
TRACE3(("GDT: max_index = %d ",(u16)i)); |
1da177e4c Linux-2.6.12-rc2 |
1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 |
} } #endif if (ha->pccb->OpCode == GDT_INIT) ha->pccb->Service |= 0x80; if (ha->type == GDT_EISA) { if (ha->pccb->OpCode == GDT_INIT) /* store DMA buffer */ outl(ha->ccb_phys, ha->bmic + MAILBOXREG); outb(ha->pccb->Service, ha->bmic + LDOORREG); } else if (ha->type == GDT_ISA) { |
a52667f3c [SCSI] gdth: kill... |
1478 |
writeb(0, &((gdt2_dpram_str __iomem *)ha->brd)->io.event); |
1da177e4c Linux-2.6.12-rc2 |
1479 |
} else if (ha->type == GDT_PCI) { |
a52667f3c [SCSI] gdth: kill... |
1480 |
writeb(0, &((gdt6_dpram_str __iomem *)ha->brd)->io.event); |
1da177e4c Linux-2.6.12-rc2 |
1481 1482 1483 |
} else if (ha->type == GDT_PCINEW) { outb(1, PTR2USHORT(&ha->plx->ldoor_reg)); } else if (ha->type == GDT_PCIMPR) { |
a52667f3c [SCSI] gdth: kill... |
1484 |
writeb(1, &((gdt6m_dpram_str __iomem *)ha->brd)->i960r.ldoor_reg); |
1da177e4c Linux-2.6.12-rc2 |
1485 1486 |
} } |
1fe6dbf4d [SCSI] gdth: Conv... |
1487 |
static int gdth_wait(gdth_ha_str *ha, int index, u32 time) |
1da177e4c Linux-2.6.12-rc2 |
1488 |
{ |
1da177e4c Linux-2.6.12-rc2 |
1489 |
int answer_found = FALSE; |
10e1b4bc9 [SCSI] gdth: gdth... |
1490 |
int wait_index = 0; |
1da177e4c Linux-2.6.12-rc2 |
1491 |
|
45f1a41b2 [SCSI] gdth: clea... |
1492 1493 |
TRACE(("gdth_wait() hanum %d index %d time %d ", ha->hanum, index, time)); |
1da177e4c Linux-2.6.12-rc2 |
1494 |
|
1da177e4c Linux-2.6.12-rc2 |
1495 1496 |
if (index == 0) return 1; /* no wait required */ |
1da177e4c Linux-2.6.12-rc2 |
1497 |
do { |
230e886e7 [SCSI] gdth: kill... |
1498 |
__gdth_interrupt(ha, true, &wait_index); |
10e1b4bc9 [SCSI] gdth: gdth... |
1499 |
if (wait_index == index) { |
1da177e4c Linux-2.6.12-rc2 |
1500 1501 1502 1503 1504 |
answer_found = TRUE; break; } gdth_delay(1); } while (--time); |
45f1a41b2 [SCSI] gdth: clea... |
1505 1506 |
while (gdth_test_busy(ha)) |
1da177e4c Linux-2.6.12-rc2 |
1507 1508 1509 1510 |
gdth_delay(0); return (answer_found); } |
1fe6dbf4d [SCSI] gdth: Conv... |
1511 1512 |
static int gdth_internal_cmd(gdth_ha_str *ha, u8 service, u16 opcode, u32 p1, u64 p2, u64 p3) |
1da177e4c Linux-2.6.12-rc2 |
1513 |
{ |
1da177e4c Linux-2.6.12-rc2 |
1514 1515 1516 1517 1518 |
register gdth_cmd_str *cmd_ptr; int retries,index; TRACE2(("gdth_internal_cmd() service %d opcode %d ",service,opcode)); |
1da177e4c Linux-2.6.12-rc2 |
1519 1520 1521 1522 1523 1524 1525 |
cmd_ptr = ha->pccb; memset((char*)cmd_ptr,0,sizeof(gdth_cmd_str)); /* make command */ for (retries = INIT_RETRIES;;) { cmd_ptr->Service = service; cmd_ptr->RequestBuffer = INTERNAL_CMND; |
45f1a41b2 [SCSI] gdth: clea... |
1526 |
if (!(index=gdth_get_cmd_index(ha))) { |
1da177e4c Linux-2.6.12-rc2 |
1527 1528 1529 1530 |
TRACE(("GDT: No free command index found ")); return 0; } |
45f1a41b2 [SCSI] gdth: clea... |
1531 |
gdth_set_sema0(ha); |
1da177e4c Linux-2.6.12-rc2 |
1532 1533 1534 1535 1536 |
cmd_ptr->OpCode = opcode; cmd_ptr->BoardNode = LOCALBOARD; if (service == CACHESERVICE) { if (opcode == GDT_IOCTL) { cmd_ptr->u.ioctl.subfunc = p1; |
1fe6dbf4d [SCSI] gdth: Conv... |
1537 1538 |
cmd_ptr->u.ioctl.channel = (u32)p2; cmd_ptr->u.ioctl.param_size = (u16)p3; |
1da177e4c Linux-2.6.12-rc2 |
1539 1540 1541 |
cmd_ptr->u.ioctl.p_param = ha->scratch_phys; } else { if (ha->cache_feat & GDT_64BIT) { |
1fe6dbf4d [SCSI] gdth: Conv... |
1542 |
cmd_ptr->u.cache64.DeviceNo = (u16)p1; |
1da177e4c Linux-2.6.12-rc2 |
1543 1544 |
cmd_ptr->u.cache64.BlockNo = p2; } else { |
1fe6dbf4d [SCSI] gdth: Conv... |
1545 1546 |
cmd_ptr->u.cache.DeviceNo = (u16)p1; cmd_ptr->u.cache.BlockNo = (u32)p2; |
1da177e4c Linux-2.6.12-rc2 |
1547 1548 1549 1550 1551 |
} } } else if (service == SCSIRAWSERVICE) { if (ha->raw_feat & GDT_64BIT) { cmd_ptr->u.raw64.direction = p1; |
1fe6dbf4d [SCSI] gdth: Conv... |
1552 1553 1554 |
cmd_ptr->u.raw64.bus = (u8)p2; cmd_ptr->u.raw64.target = (u8)p3; cmd_ptr->u.raw64.lun = (u8)(p3 >> 8); |
1da177e4c Linux-2.6.12-rc2 |
1555 1556 |
} else { cmd_ptr->u.raw.direction = p1; |
1fe6dbf4d [SCSI] gdth: Conv... |
1557 1558 1559 |
cmd_ptr->u.raw.bus = (u8)p2; cmd_ptr->u.raw.target = (u8)p3; cmd_ptr->u.raw.lun = (u8)(p3 >> 8); |
1da177e4c Linux-2.6.12-rc2 |
1560 1561 1562 |
} } else if (service == SCREENSERVICE) { if (opcode == GDT_REALTIME) { |
1fe6dbf4d [SCSI] gdth: Conv... |
1563 1564 1565 |
*(u32 *)&cmd_ptr->u.screen.su.data[0] = p1; *(u32 *)&cmd_ptr->u.screen.su.data[4] = (u32)p2; *(u32 *)&cmd_ptr->u.screen.su.data[8] = (u32)p3; |
1da177e4c Linux-2.6.12-rc2 |
1566 1567 1568 1569 1570 |
} } ha->cmd_len = sizeof(gdth_cmd_str); ha->cmd_offs_dpmem = 0; ha->cmd_cnt = 0; |
45f1a41b2 [SCSI] gdth: clea... |
1571 1572 |
gdth_copy_command(ha); gdth_release_event(ha); |
1da177e4c Linux-2.6.12-rc2 |
1573 |
gdth_delay(20); |
45f1a41b2 [SCSI] gdth: clea... |
1574 |
if (!gdth_wait(ha, index, INIT_TIMEOUT)) { |
1da177e4c Linux-2.6.12-rc2 |
1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 |
printk("GDT: Initialization error (timeout service %d) ",service); return 0; } if (ha->status != S_BSY || --retries == 0) break; gdth_delay(1); } return (ha->status != S_OK ? 0:1); } /* search for devices */ |
ced7172ad gdth section fixes |
1589 |
static int __devinit gdth_search_drives(gdth_ha_str *ha) |
1da177e4c Linux-2.6.12-rc2 |
1590 |
{ |
1fe6dbf4d [SCSI] gdth: Conv... |
1591 |
u16 cdev_cnt, i; |
1da177e4c Linux-2.6.12-rc2 |
1592 |
int ok; |
1fe6dbf4d [SCSI] gdth: Conv... |
1593 |
u32 bus_no, drv_cnt, drv_no, j; |
1da177e4c Linux-2.6.12-rc2 |
1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 |
gdth_getch_str *chn; gdth_drlist_str *drl; gdth_iochan_str *ioc; gdth_raw_iochan_str *iocr; gdth_arcdl_str *alst; gdth_alist_str *alst2; gdth_oem_str_ioctl *oemstr; #ifdef INT_COAL gdth_perf_modes *pmod; #endif #ifdef GDTH_RTC |
1fe6dbf4d [SCSI] gdth: Conv... |
1606 1607 |
u8 rtc[12]; unsigned long flags; |
1da177e4c Linux-2.6.12-rc2 |
1608 1609 |
#endif |
45f1a41b2 [SCSI] gdth: clea... |
1610 1611 |
TRACE(("gdth_search_drives() hanum %d ", ha->hanum)); |
1da177e4c Linux-2.6.12-rc2 |
1612 1613 1614 1615 1616 |
ok = 0; /* initialize controller services, at first: screen service */ ha->screen_feat = 0; if (!force_dma32) { |
45f1a41b2 [SCSI] gdth: clea... |
1617 |
ok = gdth_internal_cmd(ha, SCREENSERVICE, GDT_X_INIT_SCR, 0, 0, 0); |
1da177e4c Linux-2.6.12-rc2 |
1618 1619 1620 |
if (ok) ha->screen_feat = GDT_64BIT; } |
1fe6dbf4d [SCSI] gdth: Conv... |
1621 |
if (force_dma32 || (!ok && ha->status == (u16)S_NOFUNC)) |
45f1a41b2 [SCSI] gdth: clea... |
1622 |
ok = gdth_internal_cmd(ha, SCREENSERVICE, GDT_INIT, 0, 0, 0); |
1da177e4c Linux-2.6.12-rc2 |
1623 1624 1625 |
if (!ok) { printk("GDT-HA %d: Initialization error screen service (code %d) ", |
45f1a41b2 [SCSI] gdth: clea... |
1626 |
ha->hanum, ha->status); |
1da177e4c Linux-2.6.12-rc2 |
1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 |
return 0; } TRACE2(("gdth_search_drives(): SCREENSERVICE initialized ")); #ifdef GDTH_RTC /* read realtime clock info, send to controller */ /* 1. wait for the falling edge of update flag */ spin_lock_irqsave(&rtc_lock, flags); for (j = 0; j < 1000000; ++j) if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP) break; for (j = 0; j < 1000000; ++j) if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)) break; /* 2. read info */ do { for (j = 0; j < 12; ++j) rtc[j] = CMOS_READ(j); } while (rtc[0] != CMOS_READ(0)); |
7a960b76e [SCSI] gdth: Fix ... |
1647 |
spin_unlock_irqrestore(&rtc_lock, flags); |
1fe6dbf4d [SCSI] gdth: Conv... |
1648 1649 1650 |
TRACE2(("gdth_search_drives(): RTC: %x/%x/%x ",*(u32 *)&rtc[0], *(u32 *)&rtc[4], *(u32 *)&rtc[8])); |
1da177e4c Linux-2.6.12-rc2 |
1651 |
/* 3. send to controller firmware */ |
1fe6dbf4d [SCSI] gdth: Conv... |
1652 1653 |
gdth_internal_cmd(ha, SCREENSERVICE, GDT_REALTIME, *(u32 *)&rtc[0], *(u32 *)&rtc[4], *(u32 *)&rtc[8]); |
1da177e4c Linux-2.6.12-rc2 |
1654 1655 1656 |
#endif /* unfreeze all IOs */ |
45f1a41b2 [SCSI] gdth: clea... |
1657 |
gdth_internal_cmd(ha, CACHESERVICE, GDT_UNFREEZE_IO, 0, 0, 0); |
1da177e4c Linux-2.6.12-rc2 |
1658 1659 1660 1661 |
/* initialize cache service */ ha->cache_feat = 0; if (!force_dma32) { |
45f1a41b2 [SCSI] gdth: clea... |
1662 1663 |
ok = gdth_internal_cmd(ha, CACHESERVICE, GDT_X_INIT_HOST, LINUX_OS, 0, 0); |
1da177e4c Linux-2.6.12-rc2 |
1664 1665 1666 |
if (ok) ha->cache_feat = GDT_64BIT; } |
1fe6dbf4d [SCSI] gdth: Conv... |
1667 |
if (force_dma32 || (!ok && ha->status == (u16)S_NOFUNC)) |
45f1a41b2 [SCSI] gdth: clea... |
1668 |
ok = gdth_internal_cmd(ha, CACHESERVICE, GDT_INIT, LINUX_OS, 0, 0); |
1da177e4c Linux-2.6.12-rc2 |
1669 1670 1671 |
if (!ok) { printk("GDT-HA %d: Initialization error cache service (code %d) ", |
45f1a41b2 [SCSI] gdth: clea... |
1672 |
ha->hanum, ha->status); |
1da177e4c Linux-2.6.12-rc2 |
1673 1674 1675 1676 |
return 0; } TRACE2(("gdth_search_drives(): CACHESERVICE initialized ")); |
1fe6dbf4d [SCSI] gdth: Conv... |
1677 |
cdev_cnt = (u16)ha->info; |
1da177e4c Linux-2.6.12-rc2 |
1678 1679 1680 1681 1682 1683 1684 1685 |
ha->fw_vers = ha->service; #ifdef INT_COAL if (ha->type == GDT_PCIMPR) { /* set perf. modes */ pmod = (gdth_perf_modes *)ha->pscratch; pmod->version = 1; pmod->st_mode = 1; /* enable one status buffer */ |
1fe6dbf4d [SCSI] gdth: Conv... |
1686 |
*((u64 *)&pmod->st_buff_addr1) = ha->coal_stat_phys; |
1da177e4c Linux-2.6.12-rc2 |
1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 |
pmod->st_buff_indx1 = COALINDEX; pmod->st_buff_addr2 = 0; pmod->st_buff_u_addr2 = 0; pmod->st_buff_indx2 = 0; pmod->st_buff_size = sizeof(gdth_coal_status) * MAXOFFSETS; pmod->cmd_mode = 0; // disable all cmd buffers pmod->cmd_buff_addr1 = 0; pmod->cmd_buff_u_addr1 = 0; pmod->cmd_buff_indx1 = 0; pmod->cmd_buff_addr2 = 0; pmod->cmd_buff_u_addr2 = 0; pmod->cmd_buff_indx2 = 0; pmod->cmd_buff_size = 0; pmod->reserved1 = 0; pmod->reserved2 = 0; |
45f1a41b2 [SCSI] gdth: clea... |
1702 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, SET_PERF_MODES, |
1da177e4c Linux-2.6.12-rc2 |
1703 |
INVALID_CHANNEL,sizeof(gdth_perf_modes))) { |
45f1a41b2 [SCSI] gdth: clea... |
1704 1705 |
printk("GDT-HA %d: Interrupt coalescing activated ", ha->hanum); |
1da177e4c Linux-2.6.12-rc2 |
1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 |
} } #endif /* detect number of buses - try new IOCTL */ iocr = (gdth_raw_iochan_str *)ha->pscratch; iocr->hdr.version = 0xffffffff; iocr->hdr.list_entries = MAXBUS; iocr->hdr.first_chan = 0; iocr->hdr.last_chan = MAXBUS-1; iocr->hdr.list_offset = GDTOFFSOF(gdth_raw_iochan_str, list[0]); |
45f1a41b2 [SCSI] gdth: clea... |
1717 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, IOCHAN_RAW_DESC, |
1da177e4c Linux-2.6.12-rc2 |
1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 |
INVALID_CHANNEL,sizeof(gdth_raw_iochan_str))) { TRACE2(("IOCHAN_RAW_DESC supported! ")); ha->bus_cnt = iocr->hdr.chan_count; for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { if (iocr->list[bus_no].proc_id < MAXID) ha->bus_id[bus_no] = iocr->list[bus_no].proc_id; else ha->bus_id[bus_no] = 0xff; } } else { /* old method */ chn = (gdth_getch_str *)ha->pscratch; for (bus_no = 0; bus_no < MAXBUS; ++bus_no) { chn->channel_no = bus_no; |
45f1a41b2 [SCSI] gdth: clea... |
1733 |
if (!gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, |
1da177e4c Linux-2.6.12-rc2 |
1734 1735 1736 1737 1738 1739 |
SCSI_CHAN_CNT | L_CTRL_PATTERN, IO_CHANNEL | INVALID_CHANNEL, sizeof(gdth_getch_str))) { if (bus_no == 0) { printk("GDT-HA %d: Error detecting channel count (0x%x) ", |
45f1a41b2 [SCSI] gdth: clea... |
1740 |
ha->hanum, ha->status); |
1da177e4c Linux-2.6.12-rc2 |
1741 1742 1743 1744 1745 1746 1747 1748 1749 |
return 0; } break; } if (chn->siop_id < MAXID) ha->bus_id[bus_no] = chn->siop_id; else ha->bus_id[bus_no] = 0xff; } |
1fe6dbf4d [SCSI] gdth: Conv... |
1750 |
ha->bus_cnt = (u8)bus_no; |
1da177e4c Linux-2.6.12-rc2 |
1751 1752 1753 1754 1755 |
} TRACE2(("gdth_search_drives() %d channels ",ha->bus_cnt)); /* read cache configuration */ |
45f1a41b2 [SCSI] gdth: clea... |
1756 |
if (!gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, CACHE_INFO, |
1da177e4c Linux-2.6.12-rc2 |
1757 1758 1759 |
INVALID_CHANNEL,sizeof(gdth_cinfo_str))) { printk("GDT-HA %d: Initialization error cache service (code %d) ", |
45f1a41b2 [SCSI] gdth: clea... |
1760 |
ha->hanum, ha->status); |
1da177e4c Linux-2.6.12-rc2 |
1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 |
return 0; } ha->cpar = ((gdth_cinfo_str *)ha->pscratch)->cpar; TRACE2(("gdth_search_drives() cinfo: vs %x sta %d str %d dw %d b %d ", ha->cpar.version,ha->cpar.state,ha->cpar.strategy, ha->cpar.write_back,ha->cpar.block_size)); /* read board info and features */ ha->more_proc = FALSE; |
45f1a41b2 [SCSI] gdth: clea... |
1771 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, BOARD_INFO, |
1da177e4c Linux-2.6.12-rc2 |
1772 1773 1774 |
INVALID_CHANNEL,sizeof(gdth_binfo_str))) { memcpy(&ha->binfo, (gdth_binfo_str *)ha->pscratch, sizeof(gdth_binfo_str)); |
45f1a41b2 [SCSI] gdth: clea... |
1775 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, BOARD_FEATURES, |
1da177e4c Linux-2.6.12-rc2 |
1776 1777 1778 1779 1780 1781 1782 1783 1784 |
INVALID_CHANNEL,sizeof(gdth_bfeat_str))) { TRACE2(("BOARD_INFO/BOARD_FEATURES supported ")); ha->bfeat = *(gdth_bfeat_str *)ha->pscratch; ha->more_proc = TRUE; } } else { TRACE2(("BOARD_INFO requires firmware >= 1.10/2.08 ")); |
45f1a41b2 [SCSI] gdth: clea... |
1785 |
strcpy(ha->binfo.type_string, gdth_ctr_name(ha)); |
1da177e4c Linux-2.6.12-rc2 |
1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 |
} TRACE2(("Controller name: %s ",ha->binfo.type_string)); /* read more informations */ if (ha->more_proc) { /* physical drives, channel addresses */ ioc = (gdth_iochan_str *)ha->pscratch; ioc->hdr.version = 0xffffffff; ioc->hdr.list_entries = MAXBUS; ioc->hdr.first_chan = 0; ioc->hdr.last_chan = MAXBUS-1; ioc->hdr.list_offset = GDTOFFSOF(gdth_iochan_str, list[0]); |
45f1a41b2 [SCSI] gdth: clea... |
1799 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, IOCHAN_DESC, |
1da177e4c Linux-2.6.12-rc2 |
1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 |
INVALID_CHANNEL,sizeof(gdth_iochan_str))) { for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { ha->raw[bus_no].address = ioc->list[bus_no].address; ha->raw[bus_no].local_no = ioc->list[bus_no].local_no; } } else { for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { ha->raw[bus_no].address = IO_CHANNEL; ha->raw[bus_no].local_no = bus_no; } } for (bus_no = 0; bus_no < ha->bus_cnt; ++bus_no) { chn = (gdth_getch_str *)ha->pscratch; chn->channel_no = ha->raw[bus_no].local_no; |
45f1a41b2 [SCSI] gdth: clea... |
1814 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, |
1da177e4c Linux-2.6.12-rc2 |
1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 |
SCSI_CHAN_CNT | L_CTRL_PATTERN, ha->raw[bus_no].address | INVALID_CHANNEL, sizeof(gdth_getch_str))) { ha->raw[bus_no].pdev_cnt = chn->drive_cnt; TRACE2(("Channel %d: %d phys. drives ", bus_no,chn->drive_cnt)); } if (ha->raw[bus_no].pdev_cnt > 0) { drl = (gdth_drlist_str *)ha->pscratch; drl->sc_no = ha->raw[bus_no].local_no; drl->sc_cnt = ha->raw[bus_no].pdev_cnt; |
45f1a41b2 [SCSI] gdth: clea... |
1827 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, |
1da177e4c Linux-2.6.12-rc2 |
1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 |
SCSI_DR_LIST | L_CTRL_PATTERN, ha->raw[bus_no].address | INVALID_CHANNEL, sizeof(gdth_drlist_str))) { for (j = 0; j < ha->raw[bus_no].pdev_cnt; ++j) ha->raw[bus_no].id_list[j] = drl->sc_list[j]; } else { ha->raw[bus_no].pdev_cnt = 0; } } } /* logical drives */ |
45f1a41b2 [SCSI] gdth: clea... |
1840 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, CACHE_DRV_CNT, |
1fe6dbf4d [SCSI] gdth: Conv... |
1841 1842 |
INVALID_CHANNEL,sizeof(u32))) { drv_cnt = *(u32 *)ha->pscratch; |
45f1a41b2 [SCSI] gdth: clea... |
1843 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, CACHE_DRV_LIST, |
1fe6dbf4d [SCSI] gdth: Conv... |
1844 |
INVALID_CHANNEL,drv_cnt * sizeof(u32))) { |
1da177e4c Linux-2.6.12-rc2 |
1845 |
for (j = 0; j < drv_cnt; ++j) { |
1fe6dbf4d [SCSI] gdth: Conv... |
1846 |
drv_no = ((u32 *)ha->pscratch)[j]; |
1da177e4c Linux-2.6.12-rc2 |
1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 |
if (drv_no < MAX_LDRIVES) { ha->hdr[drv_no].is_logdrv = TRUE; TRACE2(("Drive %d is log. drive ",drv_no)); } } } alst = (gdth_arcdl_str *)ha->pscratch; alst->entries_avail = MAX_LDRIVES; alst->first_entry = 0; alst->list_offset = GDTOFFSOF(gdth_arcdl_str, list[0]); |
45f1a41b2 [SCSI] gdth: clea... |
1858 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, |
1da177e4c Linux-2.6.12-rc2 |
1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 |
ARRAY_DRV_LIST2 | LA_CTRL_PATTERN, INVALID_CHANNEL, sizeof(gdth_arcdl_str) + (alst->entries_avail-1) * sizeof(gdth_alist_str))) { for (j = 0; j < alst->entries_init; ++j) { ha->hdr[j].is_arraydrv = alst->list[j].is_arrayd; ha->hdr[j].is_master = alst->list[j].is_master; ha->hdr[j].is_parity = alst->list[j].is_parity; ha->hdr[j].is_hotfix = alst->list[j].is_hotfix; ha->hdr[j].master_no = alst->list[j].cd_handle; } |
45f1a41b2 [SCSI] gdth: clea... |
1869 |
} else if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, |
1da177e4c Linux-2.6.12-rc2 |
1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 |
ARRAY_DRV_LIST | LA_CTRL_PATTERN, 0, 35 * sizeof(gdth_alist_str))) { for (j = 0; j < 35; ++j) { alst2 = &((gdth_alist_str *)ha->pscratch)[j]; ha->hdr[j].is_arraydrv = alst2->is_arrayd; ha->hdr[j].is_master = alst2->is_master; ha->hdr[j].is_parity = alst2->is_parity; ha->hdr[j].is_hotfix = alst2->is_hotfix; ha->hdr[j].master_no = alst2->cd_handle; } } } } /* initialize raw service */ ha->raw_feat = 0; if (!force_dma32) { |
45f1a41b2 [SCSI] gdth: clea... |
1887 |
ok = gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_X_INIT_RAW, 0, 0, 0); |
1da177e4c Linux-2.6.12-rc2 |
1888 1889 1890 |
if (ok) ha->raw_feat = GDT_64BIT; } |
1fe6dbf4d [SCSI] gdth: Conv... |
1891 |
if (force_dma32 || (!ok && ha->status == (u16)S_NOFUNC)) |
45f1a41b2 [SCSI] gdth: clea... |
1892 |
ok = gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_INIT, 0, 0, 0); |
1da177e4c Linux-2.6.12-rc2 |
1893 1894 1895 |
if (!ok) { printk("GDT-HA %d: Initialization error raw service (code %d) ", |
45f1a41b2 [SCSI] gdth: clea... |
1896 |
ha->hanum, ha->status); |
1da177e4c Linux-2.6.12-rc2 |
1897 1898 1899 1900 1901 1902 |
return 0; } TRACE2(("gdth_search_drives(): RAWSERVICE initialized ")); /* set/get features raw service (scatter/gather) */ |
45f1a41b2 [SCSI] gdth: clea... |
1903 1904 |
if (gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_SET_FEAT, SCATTER_GATHER, 0, 0)) { |
1da177e4c Linux-2.6.12-rc2 |
1905 1906 |
TRACE2(("gdth_search_drives(): set features RAWSERVICE OK ")); |
45f1a41b2 [SCSI] gdth: clea... |
1907 |
if (gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_GET_FEAT, 0, 0, 0)) { |
1da177e4c Linux-2.6.12-rc2 |
1908 1909 1910 |
TRACE2(("gdth_search_dr(): get feat RAWSERVICE %d ", ha->info)); |
1fe6dbf4d [SCSI] gdth: Conv... |
1911 |
ha->raw_feat |= (u16)ha->info; |
1da177e4c Linux-2.6.12-rc2 |
1912 1913 1914 1915 |
} } /* set/get features cache service (equal to raw service) */ |
45f1a41b2 [SCSI] gdth: clea... |
1916 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_SET_FEAT, 0, |
1da177e4c Linux-2.6.12-rc2 |
1917 1918 1919 |
SCATTER_GATHER,0)) { TRACE2(("gdth_search_drives(): set features CACHESERVICE OK ")); |
45f1a41b2 [SCSI] gdth: clea... |
1920 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_GET_FEAT, 0, 0, 0)) { |
1da177e4c Linux-2.6.12-rc2 |
1921 1922 1923 |
TRACE2(("gdth_search_dr(): get feat CACHESERV. %d ", ha->info)); |
1fe6dbf4d [SCSI] gdth: Conv... |
1924 |
ha->cache_feat |= (u16)ha->info; |
1da177e4c Linux-2.6.12-rc2 |
1925 1926 1927 1928 1929 |
} } /* reserve drives for raw service */ if (reserve_mode != 0) { |
45f1a41b2 [SCSI] gdth: clea... |
1930 |
gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_RESERVE_ALL, |
1da177e4c Linux-2.6.12-rc2 |
1931 1932 1933 1934 1935 1936 |
reserve_mode == 1 ? 1 : 3, 0, 0); TRACE2(("gdth_search_drives(): RESERVE_ALL code %d ", ha->status)); } for (i = 0; i < MAX_RES_ARGS; i += 4) { |
45f1a41b2 [SCSI] gdth: clea... |
1937 |
if (reserve_list[i] == ha->hanum && reserve_list[i+1] < ha->bus_cnt && |
1da177e4c Linux-2.6.12-rc2 |
1938 1939 1940 1941 1942 |
reserve_list[i+2] < ha->tid_cnt && reserve_list[i+3] < MAXLUN) { TRACE2(("gdth_search_drives(): reserve ha %d bus %d id %d lun %d ", reserve_list[i], reserve_list[i+1], reserve_list[i+2], reserve_list[i+3])); |
45f1a41b2 [SCSI] gdth: clea... |
1943 |
if (!gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_RESERVE, 0, |
1da177e4c Linux-2.6.12-rc2 |
1944 1945 1946 1947 |
reserve_list[i+1], reserve_list[i+2] | (reserve_list[i+3] << 8))) { printk("GDT-HA %d: Error raw service (RESERVE, code %d) ", |
45f1a41b2 [SCSI] gdth: clea... |
1948 |
ha->hanum, ha->status); |
1da177e4c Linux-2.6.12-rc2 |
1949 1950 1951 1952 1953 1954 1955 1956 |
} } } /* Determine OEM string using IOCTL */ oemstr = (gdth_oem_str_ioctl *)ha->pscratch; oemstr->params.ctl_version = 0x01; oemstr->params.buffer_size = sizeof(oemstr->text); |
45f1a41b2 [SCSI] gdth: clea... |
1957 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_IOCTL, |
1da177e4c Linux-2.6.12-rc2 |
1958 1959 1960 1961 1962 1963 |
CACHE_READ_OEM_STRING_RECORD,INVALID_CHANNEL, sizeof(gdth_oem_str_ioctl))) { TRACE2(("gdth_search_drives(): CACHE_READ_OEM_STRING_RECORD OK ")); printk("GDT-HA %d: Vendor: %s Name: %s ", |
45f1a41b2 [SCSI] gdth: clea... |
1964 |
ha->hanum, oemstr->text.oem_company_name, ha->binfo.type_string); |
1da177e4c Linux-2.6.12-rc2 |
1965 |
/* Save the Host Drive inquiry data */ |
1da177e4c Linux-2.6.12-rc2 |
1966 1967 |
strlcpy(ha->oem_name,oemstr->text.scsi_host_drive_inquiry_vendor_id, sizeof(ha->oem_name)); |
1da177e4c Linux-2.6.12-rc2 |
1968 1969 1970 1971 1972 1973 |
} else { /* Old method, based on PCI ID */ TRACE2(("gdth_search_drives(): CACHE_READ_OEM_STRING_RECORD failed ")); printk("GDT-HA %d: Name: %s ", |
45f1a41b2 [SCSI] gdth: clea... |
1974 |
ha->hanum, ha->binfo.type_string); |
1da177e4c Linux-2.6.12-rc2 |
1975 1976 1977 1978 |
if (ha->oem_id == OEM_ID_INTEL) strlcpy(ha->oem_name,"Intel ", sizeof(ha->oem_name)); else strlcpy(ha->oem_name,"ICP ", sizeof(ha->oem_name)); |
1da177e4c Linux-2.6.12-rc2 |
1979 1980 1981 1982 |
} /* scanning for host drives */ for (i = 0; i < cdev_cnt; ++i) |
45f1a41b2 [SCSI] gdth: clea... |
1983 |
gdth_analyse_hdrive(ha, i); |
1da177e4c Linux-2.6.12-rc2 |
1984 1985 1986 1987 1988 |
TRACE(("gdth_search_drives() OK ")); return 1; } |
1fe6dbf4d [SCSI] gdth: Conv... |
1989 |
static int gdth_analyse_hdrive(gdth_ha_str *ha, u16 hdrive) |
1da177e4c Linux-2.6.12-rc2 |
1990 |
{ |
1fe6dbf4d [SCSI] gdth: Conv... |
1991 |
u32 drv_cyls; |
1da177e4c Linux-2.6.12-rc2 |
1992 |
int drv_hds, drv_secs; |
45f1a41b2 [SCSI] gdth: clea... |
1993 1994 |
TRACE(("gdth_analyse_hdrive() hanum %d drive %d ", ha->hanum, hdrive)); |
1da177e4c Linux-2.6.12-rc2 |
1995 1996 |
if (hdrive >= MAX_HDRIVES) return 0; |
1da177e4c Linux-2.6.12-rc2 |
1997 |
|
45f1a41b2 [SCSI] gdth: clea... |
1998 |
if (!gdth_internal_cmd(ha, CACHESERVICE, GDT_INFO, hdrive, 0, 0)) |
1da177e4c Linux-2.6.12-rc2 |
1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 |
return 0; ha->hdr[hdrive].present = TRUE; ha->hdr[hdrive].size = ha->info; /* evaluate mapping (sectors per head, heads per cylinder) */ ha->hdr[hdrive].size &= ~SECS32; if (ha->info2 == 0) { gdth_eval_mapping(ha->hdr[hdrive].size,&drv_cyls,&drv_hds,&drv_secs); } else { drv_hds = ha->info2 & 0xff; drv_secs = (ha->info2 >> 8) & 0xff; |
1fe6dbf4d [SCSI] gdth: Conv... |
2010 |
drv_cyls = (u32)ha->hdr[hdrive].size / drv_hds / drv_secs; |
1da177e4c Linux-2.6.12-rc2 |
2011 |
} |
1fe6dbf4d [SCSI] gdth: Conv... |
2012 2013 |
ha->hdr[hdrive].heads = (u8)drv_hds; ha->hdr[hdrive].secs = (u8)drv_secs; |
1da177e4c Linux-2.6.12-rc2 |
2014 2015 2016 2017 |
/* round size */ ha->hdr[hdrive].size = drv_cyls * drv_hds * drv_secs; if (ha->cache_feat & GDT_64BIT) { |
45f1a41b2 [SCSI] gdth: clea... |
2018 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_X_INFO, hdrive, 0, 0) |
1da177e4c Linux-2.6.12-rc2 |
2019 |
&& ha->info2 != 0) { |
1fe6dbf4d [SCSI] gdth: Conv... |
2020 |
ha->hdr[hdrive].size = ((u64)ha->info2 << 32) | ha->info; |
1da177e4c Linux-2.6.12-rc2 |
2021 2022 2023 2024 2025 2026 2027 |
} } TRACE2(("gdth_search_dr() cdr. %d size %d hds %d scs %d ", hdrive,ha->hdr[hdrive].size,drv_hds,drv_secs)); /* get informations about device */ |
45f1a41b2 [SCSI] gdth: clea... |
2028 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_DEVTYPE, hdrive, 0, 0)) { |
1da177e4c Linux-2.6.12-rc2 |
2029 2030 2031 |
TRACE2(("gdth_search_dr() cache drive %d devtype %d ", hdrive,ha->info)); |
1fe6dbf4d [SCSI] gdth: Conv... |
2032 |
ha->hdr[hdrive].devtype = (u16)ha->info; |
1da177e4c Linux-2.6.12-rc2 |
2033 2034 2035 |
} /* cluster info */ |
45f1a41b2 [SCSI] gdth: clea... |
2036 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_CLUST_INFO, hdrive, 0, 0)) { |
1da177e4c Linux-2.6.12-rc2 |
2037 2038 2039 2040 |
TRACE2(("gdth_search_dr() cache drive %d cluster info %d ", hdrive,ha->info)); if (!shared_access) |
1fe6dbf4d [SCSI] gdth: Conv... |
2041 |
ha->hdr[hdrive].cluster_type = (u8)ha->info; |
1da177e4c Linux-2.6.12-rc2 |
2042 2043 2044 |
} /* R/W attributes */ |
45f1a41b2 [SCSI] gdth: clea... |
2045 |
if (gdth_internal_cmd(ha, CACHESERVICE, GDT_RW_ATTRIBS, hdrive, 0, 0)) { |
1da177e4c Linux-2.6.12-rc2 |
2046 2047 2048 |
TRACE2(("gdth_search_dr() cache drive %d r/w attrib. %d ", hdrive,ha->info)); |
1fe6dbf4d [SCSI] gdth: Conv... |
2049 |
ha->hdr[hdrive].rw_attribs = (u8)ha->info; |
1da177e4c Linux-2.6.12-rc2 |
2050 2051 2052 2053 2054 2055 2056 |
} return 1; } /* command queueing/sending functions */ |
1fe6dbf4d [SCSI] gdth: Conv... |
2057 |
static void gdth_putq(gdth_ha_str *ha, Scsi_Cmnd *scp, u8 priority) |
1da177e4c Linux-2.6.12-rc2 |
2058 |
{ |
3058d5de4 [SCSI] gdth: Setu... |
2059 |
struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp); |
1da177e4c Linux-2.6.12-rc2 |
2060 2061 |
register Scsi_Cmnd *pscp; register Scsi_Cmnd *nscp; |
1fe6dbf4d [SCSI] gdth: Conv... |
2062 |
unsigned long flags; |
1da177e4c Linux-2.6.12-rc2 |
2063 2064 2065 |
TRACE(("gdth_putq() priority %d ",priority)); |
1da177e4c Linux-2.6.12-rc2 |
2066 |
spin_lock_irqsave(&ha->smp_lock, flags); |
242f9dcb8 block: unify requ... |
2067 |
if (!cmndinfo->internal_command) |
f842b64e0 [SCSI] gdth: Move... |
2068 |
cmndinfo->priority = priority; |
1da177e4c Linux-2.6.12-rc2 |
2069 2070 2071 2072 2073 2074 2075 2076 |
if (ha->req_first==NULL) { ha->req_first = scp; /* queue was empty */ scp->SCp.ptr = NULL; } else { /* queue not empty */ pscp = ha->req_first; nscp = (Scsi_Cmnd *)pscp->SCp.ptr; /* priority: 0-highest,..,0xff-lowest */ |
f842b64e0 [SCSI] gdth: Move... |
2077 |
while (nscp && gdth_cmnd_priv(nscp)->priority <= priority) { |
1da177e4c Linux-2.6.12-rc2 |
2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 |
pscp = nscp; nscp = (Scsi_Cmnd *)pscp->SCp.ptr; } pscp->SCp.ptr = (char *)scp; scp->SCp.ptr = (char *)nscp; } spin_unlock_irqrestore(&ha->smp_lock, flags); #ifdef GDTH_STATISTICS flags = 0; for (nscp=ha->req_first; nscp; nscp=(Scsi_Cmnd*)nscp->SCp.ptr) ++flags; if (max_rq < flags) { max_rq = flags; |
1fe6dbf4d [SCSI] gdth: Conv... |
2092 2093 |
TRACE3(("GDT: max_rq = %d ",(u16)max_rq)); |
1da177e4c Linux-2.6.12-rc2 |
2094 2095 2096 |
} #endif } |
45f1a41b2 [SCSI] gdth: clea... |
2097 |
static void gdth_next(gdth_ha_str *ha) |
1da177e4c Linux-2.6.12-rc2 |
2098 |
{ |
1da177e4c Linux-2.6.12-rc2 |
2099 2100 |
register Scsi_Cmnd *pscp; register Scsi_Cmnd *nscp; |
1fe6dbf4d [SCSI] gdth: Conv... |
2101 2102 2103 |
u8 b, t, l, firsttime; u8 this_cmd, next_cmd; unsigned long flags = 0; |
1da177e4c Linux-2.6.12-rc2 |
2104 |
int cmd_index; |
45f1a41b2 [SCSI] gdth: clea... |
2105 2106 |
TRACE(("gdth_next() hanum %d ", ha->hanum)); |
1da177e4c Linux-2.6.12-rc2 |
2107 2108 2109 2110 2111 2112 2113 2114 2115 |
if (!gdth_polling) spin_lock_irqsave(&ha->smp_lock, flags); ha->cmd_cnt = ha->cmd_offs_dpmem = 0; this_cmd = firsttime = TRUE; next_cmd = gdth_polling ? FALSE:TRUE; cmd_index = 0; for (nscp = pscp = ha->req_first; nscp; nscp = (Scsi_Cmnd *)nscp->SCp.ptr) { |
f842b64e0 [SCSI] gdth: Move... |
2116 |
struct gdth_cmndinfo *nscp_cmndinfo = gdth_cmnd_priv(nscp); |
1da177e4c Linux-2.6.12-rc2 |
2117 2118 |
if (nscp != pscp && nscp != (Scsi_Cmnd *)pscp->SCp.ptr) pscp = (Scsi_Cmnd *)pscp->SCp.ptr; |
f842b64e0 [SCSI] gdth: Move... |
2119 |
if (!nscp_cmndinfo->internal_command) { |
52759e6ab [SCSI] gdth: Remo... |
2120 |
b = nscp->device->channel; |
cbd5f69b9 [SCSI] remove the... |
2121 2122 |
t = nscp->device->id; l = nscp->device->lun; |
f842b64e0 [SCSI] gdth: Move... |
2123 |
if (nscp_cmndinfo->priority >= DEFAULT_PRI) { |
cbd5f69b9 [SCSI] remove the... |
2124 2125 2126 2127 2128 2129 |
if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha,b)].lock) || (b == ha->virt_bus && t < MAX_HDRIVES && ha->hdr[t].lock)) continue; } } else b = t = l = 0; |
1da177e4c Linux-2.6.12-rc2 |
2130 2131 |
if (firsttime) { |
45f1a41b2 [SCSI] gdth: clea... |
2132 2133 2134 |
if (gdth_test_busy(ha)) { /* controller busy ? */ TRACE(("gdth_next() controller %d busy ! ", ha->hanum)); |
1da177e4c Linux-2.6.12-rc2 |
2135 2136 2137 2138 |
if (!gdth_polling) { spin_unlock_irqrestore(&ha->smp_lock, flags); return; } |
45f1a41b2 [SCSI] gdth: clea... |
2139 |
while (gdth_test_busy(ha)) |
1da177e4c Linux-2.6.12-rc2 |
2140 2141 2142 2143 |
gdth_delay(1); } firsttime = FALSE; } |
f842b64e0 [SCSI] gdth: Move... |
2144 2145 2146 |
if (!nscp_cmndinfo->internal_command) { if (nscp_cmndinfo->phase == -1) { nscp_cmndinfo->phase = CACHESERVICE; /* default: cache svc. */ |
1da177e4c Linux-2.6.12-rc2 |
2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 |
if (nscp->cmnd[0] == TEST_UNIT_READY) { TRACE2(("TEST_UNIT_READY Bus %d Id %d LUN %d ", b, t, l)); /* TEST_UNIT_READY -> set scan mode */ if ((ha->scan_mode & 0x0f) == 0) { if (b == 0 && t == 0 && l == 0) { ha->scan_mode |= 1; TRACE2(("Scan mode: 0x%x ", ha->scan_mode)); } } else if ((ha->scan_mode & 0x0f) == 1) { if (b == 0 && ((t == 0 && l == 1) || (t == 1 && l == 0))) { |
f842b64e0 [SCSI] gdth: Move... |
2161 2162 |
nscp_cmndinfo->OpCode = GDT_SCAN_START; nscp_cmndinfo->phase = ((ha->scan_mode & 0x10 ? 1:0) << 8) |
1da177e4c Linux-2.6.12-rc2 |
2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 |
| SCSIRAWSERVICE; ha->scan_mode = 0x12; TRACE2(("Scan mode: 0x%x (SCAN_START) ", ha->scan_mode)); } else { ha->scan_mode &= 0x10; TRACE2(("Scan mode: 0x%x ", ha->scan_mode)); } } else if (ha->scan_mode == 0x12) { if (b == ha->bus_cnt && t == ha->tid_cnt-1) { |
f842b64e0 [SCSI] gdth: Move... |
2175 2176 |
nscp_cmndinfo->phase = SCSIRAWSERVICE; nscp_cmndinfo->OpCode = GDT_SCAN_END; |
1da177e4c Linux-2.6.12-rc2 |
2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 |
ha->scan_mode &= 0x10; TRACE2(("Scan mode: 0x%x (SCAN_END) ", ha->scan_mode)); } } } if (b == ha->virt_bus && nscp->cmnd[0] != INQUIRY && nscp->cmnd[0] != READ_CAPACITY && nscp->cmnd[0] != MODE_SENSE && (ha->hdr[t].cluster_type & CLUSTER_DRIVE)) { /* always GDT_CLUST_INFO! */ |
f842b64e0 [SCSI] gdth: Move... |
2188 |
nscp_cmndinfo->OpCode = GDT_CLUST_INFO; |
1da177e4c Linux-2.6.12-rc2 |
2189 2190 2191 |
} } } |
f842b64e0 [SCSI] gdth: Move... |
2192 2193 |
if (nscp_cmndinfo->OpCode != -1) { if ((nscp_cmndinfo->phase & 0xff) == CACHESERVICE) { |
45f1a41b2 [SCSI] gdth: clea... |
2194 |
if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) |
1da177e4c Linux-2.6.12-rc2 |
2195 2196 |
this_cmd = FALSE; next_cmd = FALSE; |
f842b64e0 [SCSI] gdth: Move... |
2197 |
} else if ((nscp_cmndinfo->phase & 0xff) == SCSIRAWSERVICE) { |
45f1a41b2 [SCSI] gdth: clea... |
2198 |
if (!(cmd_index=gdth_fill_raw_cmd(ha, nscp, BUS_L2P(ha, b)))) |
1da177e4c Linux-2.6.12-rc2 |
2199 2200 2201 2202 2203 2204 2205 |
this_cmd = FALSE; next_cmd = FALSE; } else { memset((char*)nscp->sense_buffer,0,16); nscp->sense_buffer[0] = 0x70; nscp->sense_buffer[2] = NOT_READY; nscp->result = (DID_OK << 16) | (CHECK_CONDITION << 1); |
f842b64e0 [SCSI] gdth: Move... |
2206 2207 |
if (!nscp_cmndinfo->wait_for_completion) nscp_cmndinfo->wait_for_completion++; |
1da177e4c Linux-2.6.12-rc2 |
2208 |
else |
b8bff2aea gdth: Make one ab... |
2209 |
gdth_scsi_done(nscp); |
1da177e4c Linux-2.6.12-rc2 |
2210 |
} |
3058d5de4 [SCSI] gdth: Setu... |
2211 |
} else if (gdth_cmnd_priv(nscp)->internal_command) { |
45f1a41b2 [SCSI] gdth: clea... |
2212 |
if (!(cmd_index=gdth_special_cmd(ha, nscp))) |
1da177e4c Linux-2.6.12-rc2 |
2213 2214 2215 2216 |
this_cmd = FALSE; next_cmd = FALSE; } else if (b != ha->virt_bus) { if (ha->raw[BUS_L2P(ha,b)].io_cnt[t] >= GDTH_MAX_RAW || |
45f1a41b2 [SCSI] gdth: clea... |
2217 |
!(cmd_index=gdth_fill_raw_cmd(ha, nscp, BUS_L2P(ha, b)))) |
1da177e4c Linux-2.6.12-rc2 |
2218 2219 2220 2221 2222 2223 2224 2225 |
this_cmd = FALSE; else ha->raw[BUS_L2P(ha,b)].io_cnt[t]++; } else if (t >= MAX_HDRIVES || !ha->hdr[t].present || l != 0) { TRACE2(("Command 0x%x to bus %d id %d lun %d -> IGNORE ", nscp->cmnd[0], b, t, l)); nscp->result = DID_BAD_TARGET << 16; |
f842b64e0 [SCSI] gdth: Move... |
2226 2227 |
if (!nscp_cmndinfo->wait_for_completion) nscp_cmndinfo->wait_for_completion++; |
1da177e4c Linux-2.6.12-rc2 |
2228 |
else |
b8bff2aea gdth: Make one ab... |
2229 |
gdth_scsi_done(nscp); |
1da177e4c Linux-2.6.12-rc2 |
2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 |
} else { switch (nscp->cmnd[0]) { case TEST_UNIT_READY: case INQUIRY: case REQUEST_SENSE: case READ_CAPACITY: case VERIFY: case START_STOP: case MODE_SENSE: case SERVICE_ACTION_IN: TRACE(("cache cmd %x/%x/%x/%x/%x/%x ",nscp->cmnd[0], nscp->cmnd[1],nscp->cmnd[2],nscp->cmnd[3], nscp->cmnd[4],nscp->cmnd[5])); if (ha->hdr[t].media_changed && nscp->cmnd[0] != INQUIRY) { /* return UNIT_ATTENTION */ TRACE2(("cmd 0x%x target %d: UNIT_ATTENTION ", nscp->cmnd[0], t)); ha->hdr[t].media_changed = FALSE; memset((char*)nscp->sense_buffer,0,16); nscp->sense_buffer[0] = 0x70; nscp->sense_buffer[2] = UNIT_ATTENTION; nscp->result = (DID_OK << 16) | (CHECK_CONDITION << 1); |
f842b64e0 [SCSI] gdth: Move... |
2254 2255 |
if (!nscp_cmndinfo->wait_for_completion) nscp_cmndinfo->wait_for_completion++; |
1da177e4c Linux-2.6.12-rc2 |
2256 |
else |
b8bff2aea gdth: Make one ab... |
2257 |
gdth_scsi_done(nscp); |
45f1a41b2 [SCSI] gdth: clea... |
2258 |
} else if (gdth_internal_cache_cmd(ha, nscp)) |
b8bff2aea gdth: Make one ab... |
2259 |
gdth_scsi_done(nscp); |
1da177e4c Linux-2.6.12-rc2 |
2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 |
break; case ALLOW_MEDIUM_REMOVAL: TRACE(("cache cmd %x/%x/%x/%x/%x/%x ",nscp->cmnd[0], nscp->cmnd[1],nscp->cmnd[2],nscp->cmnd[3], nscp->cmnd[4],nscp->cmnd[5])); if ( (nscp->cmnd[4]&1) && !(ha->hdr[t].devtype&1) ) { TRACE(("Prevent r. nonremov. drive->do nothing ")); nscp->result = DID_OK << 16; nscp->sense_buffer[0] = 0; |
f842b64e0 [SCSI] gdth: Move... |
2272 2273 |
if (!nscp_cmndinfo->wait_for_completion) nscp_cmndinfo->wait_for_completion++; |
1da177e4c Linux-2.6.12-rc2 |
2274 |
else |
b8bff2aea gdth: Make one ab... |
2275 |
gdth_scsi_done(nscp); |
1da177e4c Linux-2.6.12-rc2 |
2276 2277 2278 2279 2280 |
} else { nscp->cmnd[3] = (ha->hdr[t].devtype&1) ? 1:0; TRACE(("Prevent/allow r. %d rem. drive %d ", nscp->cmnd[4],nscp->cmnd[3])); |
45f1a41b2 [SCSI] gdth: clea... |
2281 |
if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) |
1da177e4c Linux-2.6.12-rc2 |
2282 2283 2284 2285 2286 2287 2288 2289 2290 |
this_cmd = FALSE; } break; case RESERVE: case RELEASE: TRACE2(("cache cmd %s ",nscp->cmnd[0] == RESERVE ? "RESERVE" : "RELEASE")); |
45f1a41b2 [SCSI] gdth: clea... |
2291 |
if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) |
1da177e4c Linux-2.6.12-rc2 |
2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 |
this_cmd = FALSE; break; case READ_6: case WRITE_6: case READ_10: case WRITE_10: case READ_16: case WRITE_16: if (ha->hdr[t].media_changed) { /* return UNIT_ATTENTION */ TRACE2(("cmd 0x%x target %d: UNIT_ATTENTION ", nscp->cmnd[0], t)); ha->hdr[t].media_changed = FALSE; memset((char*)nscp->sense_buffer,0,16); nscp->sense_buffer[0] = 0x70; nscp->sense_buffer[2] = UNIT_ATTENTION; nscp->result = (DID_OK << 16) | (CHECK_CONDITION << 1); |
f842b64e0 [SCSI] gdth: Move... |
2311 2312 |
if (!nscp_cmndinfo->wait_for_completion) nscp_cmndinfo->wait_for_completion++; |
1da177e4c Linux-2.6.12-rc2 |
2313 |
else |
b8bff2aea gdth: Make one ab... |
2314 |
gdth_scsi_done(nscp); |
45f1a41b2 [SCSI] gdth: clea... |
2315 |
} else if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t))) |
1da177e4c Linux-2.6.12-rc2 |
2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 |
this_cmd = FALSE; break; default: TRACE2(("cache cmd %x/%x/%x/%x/%x/%x unknown ",nscp->cmnd[0], nscp->cmnd[1],nscp->cmnd[2],nscp->cmnd[3], nscp->cmnd[4],nscp->cmnd[5])); printk("GDT-HA %d: Unknown SCSI command 0x%x to cache service ! ", |
45f1a41b2 [SCSI] gdth: clea... |
2326 |
ha->hanum, nscp->cmnd[0]); |
1da177e4c Linux-2.6.12-rc2 |
2327 |
nscp->result = DID_ABORT << 16; |
f842b64e0 [SCSI] gdth: Move... |
2328 2329 |
if (!nscp_cmndinfo->wait_for_completion) nscp_cmndinfo->wait_for_completion++; |
1da177e4c Linux-2.6.12-rc2 |
2330 |
else |
b8bff2aea gdth: Make one ab... |
2331 |
gdth_scsi_done(nscp); |
1da177e4c Linux-2.6.12-rc2 |
2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 |
break; } } if (!this_cmd) break; if (nscp == ha->req_first) ha->req_first = pscp = (Scsi_Cmnd *)nscp->SCp.ptr; else pscp->SCp.ptr = nscp->SCp.ptr; if (!next_cmd) break; } if (ha->cmd_cnt > 0) { |
45f1a41b2 [SCSI] gdth: clea... |
2347 |
gdth_release_event(ha); |
1da177e4c Linux-2.6.12-rc2 |
2348 2349 2350 2351 2352 2353 |
} if (!gdth_polling) spin_unlock_irqrestore(&ha->smp_lock, flags); if (gdth_polling && ha->cmd_cnt > 0) { |
45f1a41b2 [SCSI] gdth: clea... |
2354 |
if (!gdth_wait(ha, cmd_index, POLL_TIMEOUT)) |
1da177e4c Linux-2.6.12-rc2 |
2355 2356 |
printk("GDT-HA %d: Command %d timed out ! ", |
45f1a41b2 [SCSI] gdth: clea... |
2357 |
ha->hanum, cmd_index); |
1da177e4c Linux-2.6.12-rc2 |
2358 2359 |
} } |
3892d88ae [SCSI] gdth: !use... |
2360 2361 2362 2363 2364 |
/* * gdth_copy_internal_data() - copy to/from a buffer onto a scsi_cmnd's * buffers, kmap_atomic() as needed. */ |
45f1a41b2 [SCSI] gdth: clea... |
2365 |
static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp, |
1fe6dbf4d [SCSI] gdth: Conv... |
2366 |
char *buffer, u16 count) |
1da177e4c Linux-2.6.12-rc2 |
2367 |
{ |
1fe6dbf4d [SCSI] gdth: Conv... |
2368 2369 |
u16 cpcount,i, max_sg = scsi_sg_count(scp); u16 cpsum,cpnow; |
1da177e4c Linux-2.6.12-rc2 |
2370 |
struct scatterlist *sl; |
1da177e4c Linux-2.6.12-rc2 |
2371 |
char *address; |
1fe6dbf4d [SCSI] gdth: Conv... |
2372 |
cpcount = min_t(u16, count, scsi_bufflen(scp)); |
1da177e4c Linux-2.6.12-rc2 |
2373 |
|
3892d88ae [SCSI] gdth: !use... |
2374 2375 2376 |
if (cpcount) { cpsum=0; scsi_for_each_sg(scp, sl, max_sg, i) { |
cbd5f69b9 [SCSI] remove the... |
2377 |
unsigned long flags; |
1fe6dbf4d [SCSI] gdth: Conv... |
2378 |
cpnow = (u16)sl->length; |
1da177e4c Linux-2.6.12-rc2 |
2379 2380 |
TRACE(("copy_internal() now %d sum %d count %d %d ", |
d35055a0f [SCSI] gdth: remo... |
2381 |
cpnow, cpsum, cpcount, scsi_bufflen(scp))); |
1da177e4c Linux-2.6.12-rc2 |
2382 2383 2384 |
if (cpsum+cpnow > cpcount) cpnow = cpcount - cpsum; cpsum += cpnow; |
45711f1af [SG] Update drive... |
2385 |
if (!sg_page(sl)) { |
1da177e4c Linux-2.6.12-rc2 |
2386 2387 |
printk("GDT-HA %d: invalid sc/gt element in gdth_copy_internal_data() ", |
45f1a41b2 [SCSI] gdth: clea... |
2388 |
ha->hanum); |
1da177e4c Linux-2.6.12-rc2 |
2389 2390 |
return; } |
cbd5f69b9 [SCSI] remove the... |
2391 |
local_irq_save(flags); |
45711f1af [SG] Update drive... |
2392 |
address = kmap_atomic(sg_page(sl), KM_BIO_SRC_IRQ) + sl->offset; |
ee54cc6af [SCSI] gdth: fix ... |
2393 |
memcpy(address, buffer, cpnow); |
45711f1af [SG] Update drive... |
2394 |
flush_dcache_page(sg_page(sl)); |
cbd5f69b9 [SCSI] remove the... |
2395 |
kunmap_atomic(address, KM_BIO_SRC_IRQ); |
cbd5f69b9 [SCSI] remove the... |
2396 |
local_irq_restore(flags); |
1da177e4c Linux-2.6.12-rc2 |
2397 2398 2399 2400 |
if (cpsum == cpcount) break; buffer += cpnow; } |
3892d88ae [SCSI] gdth: !use... |
2401 2402 2403 2404 2405 |
} else if (count) { printk("GDT-HA %d: SCSI command with no buffers but data transfer expected! ", ha->hanum); WARN_ON(1); |
1da177e4c Linux-2.6.12-rc2 |
2406 2407 |
} } |
45f1a41b2 [SCSI] gdth: clea... |
2408 |
static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp) |
1da177e4c Linux-2.6.12-rc2 |
2409 |
{ |
1fe6dbf4d [SCSI] gdth: Conv... |
2410 |
u8 t; |
1da177e4c Linux-2.6.12-rc2 |
2411 2412 2413 2414 |
gdth_inq_data inq; gdth_rdcap_data rdc; gdth_sense_data sd; gdth_modep_data mpd; |
f842b64e0 [SCSI] gdth: Move... |
2415 |
struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp); |
1da177e4c Linux-2.6.12-rc2 |
2416 |
|
1da177e4c Linux-2.6.12-rc2 |
2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 |
t = scp->device->id; TRACE(("gdth_internal_cache_cmd() cmd 0x%x hdrive %d ", scp->cmnd[0],t)); scp->result = DID_OK << 16; scp->sense_buffer[0] = 0; switch (scp->cmnd[0]) { case TEST_UNIT_READY: case VERIFY: case START_STOP: TRACE2(("Test/Verify/Start hdrive %d ",t)); break; case INQUIRY: TRACE2(("Inquiry hdrive %d devtype %d ", t,ha->hdr[t].devtype)); inq.type_qual = (ha->hdr[t].devtype&4) ? TYPE_ROM:TYPE_DISK; /* you can here set all disks to removable, if you want to do a flush using the ALLOW_MEDIUM_REMOVAL command */ inq.modif_rmb = 0x00; if ((ha->hdr[t].devtype & 1) || (ha->hdr[t].cluster_type & CLUSTER_DRIVE)) inq.modif_rmb = 0x80; inq.version = 2; inq.resp_aenc = 2; inq.add_length= 32; strcpy(inq.vendor,ha->oem_name); sprintf(inq.product,"Host Drive #%02d",t); strcpy(inq.revision," "); |
ee54cc6af [SCSI] gdth: fix ... |
2450 |
gdth_copy_internal_data(ha, scp, (char*)&inq, sizeof(gdth_inq_data)); |
1da177e4c Linux-2.6.12-rc2 |
2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 |
break; case REQUEST_SENSE: TRACE2(("Request sense hdrive %d ",t)); sd.errorcode = 0x70; sd.segno = 0x00; sd.key = NO_SENSE; sd.info = 0; sd.add_length= 0; |
ee54cc6af [SCSI] gdth: fix ... |
2461 |
gdth_copy_internal_data(ha, scp, (char*)&sd, sizeof(gdth_sense_data)); |
1da177e4c Linux-2.6.12-rc2 |
2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 |
break; case MODE_SENSE: TRACE2(("Mode sense hdrive %d ",t)); memset((char*)&mpd,0,sizeof(gdth_modep_data)); mpd.hd.data_length = sizeof(gdth_modep_data); mpd.hd.dev_par = (ha->hdr[t].devtype&2) ? 0x80:0; mpd.hd.bd_length = sizeof(mpd.bd); mpd.bd.block_length[0] = (SECTOR_SIZE & 0x00ff0000) >> 16; mpd.bd.block_length[1] = (SECTOR_SIZE & 0x0000ff00) >> 8; mpd.bd.block_length[2] = (SECTOR_SIZE & 0x000000ff); |
ee54cc6af [SCSI] gdth: fix ... |
2474 |
gdth_copy_internal_data(ha, scp, (char*)&mpd, sizeof(gdth_modep_data)); |
1da177e4c Linux-2.6.12-rc2 |
2475 2476 2477 2478 2479 |
break; case READ_CAPACITY: TRACE2(("Read capacity hdrive %d ",t)); |
1fe6dbf4d [SCSI] gdth: Conv... |
2480 |
if (ha->hdr[t].size > (u64)0xffffffff) |
1da177e4c Linux-2.6.12-rc2 |
2481 2482 2483 2484 |
rdc.last_block_no = 0xffffffff; else rdc.last_block_no = cpu_to_be32(ha->hdr[t].size-1); rdc.block_length = cpu_to_be32(SECTOR_SIZE); |
ee54cc6af [SCSI] gdth: fix ... |
2485 |
gdth_copy_internal_data(ha, scp, (char*)&rdc, sizeof(gdth_rdcap_data)); |
1da177e4c Linux-2.6.12-rc2 |
2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 |
break; case SERVICE_ACTION_IN: if ((scp->cmnd[1] & 0x1f) == SAI_READ_CAPACITY_16 && (ha->cache_feat & GDT_64BIT)) { gdth_rdcap16_data rdc16; TRACE2(("Read capacity (16) hdrive %d ",t)); rdc16.last_block_no = cpu_to_be64(ha->hdr[t].size-1); rdc16.block_length = cpu_to_be32(SECTOR_SIZE); |
45f1a41b2 [SCSI] gdth: clea... |
2497 |
gdth_copy_internal_data(ha, scp, (char*)&rdc16, |
ee54cc6af [SCSI] gdth: fix ... |
2498 |
sizeof(gdth_rdcap16_data)); |
1da177e4c Linux-2.6.12-rc2 |
2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 |
} else { scp->result = DID_ABORT << 16; } break; default: TRACE2(("Internal cache cmd 0x%x unknown ",scp->cmnd[0])); break; } |
f842b64e0 [SCSI] gdth: Move... |
2509 2510 |
if (!cmndinfo->wait_for_completion) cmndinfo->wait_for_completion++; |
1da177e4c Linux-2.6.12-rc2 |
2511 2512 2513 2514 2515 |
else return 1; return 0; } |
45f1a41b2 [SCSI] gdth: clea... |
2516 |
|
1fe6dbf4d [SCSI] gdth: Conv... |
2517 |
static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, u16 hdrive) |
1da177e4c Linux-2.6.12-rc2 |
2518 |
{ |
1da177e4c Linux-2.6.12-rc2 |
2519 |
register gdth_cmd_str *cmdp; |
f842b64e0 [SCSI] gdth: Move... |
2520 |
struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp); |
1fe6dbf4d [SCSI] gdth: Conv... |
2521 2522 |
u32 cnt, blockcnt; u64 no, blockno; |
1da177e4c Linux-2.6.12-rc2 |
2523 |
int i, cmd_index, read_write, sgcnt, mode64; |
1da177e4c Linux-2.6.12-rc2 |
2524 |
|
1da177e4c Linux-2.6.12-rc2 |
2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 |
cmdp = ha->pccb; TRACE(("gdth_fill_cache_cmd() cmd 0x%x cmdsize %d hdrive %d ", scp->cmnd[0],scp->cmd_len,hdrive)); if (ha->type==GDT_EISA && ha->cmd_cnt>0) return 0; mode64 = (ha->cache_feat & GDT_64BIT) ? TRUE : FALSE; /* test for READ_16, WRITE_16 if !mode64 ? --- not required, should not occur due to error return on READ_CAPACITY_16 */ cmdp->Service = CACHESERVICE; cmdp->RequestBuffer = scp; /* search free command index */ |
45f1a41b2 [SCSI] gdth: clea... |
2541 |
if (!(cmd_index=gdth_get_cmd_index(ha))) { |
1da177e4c Linux-2.6.12-rc2 |
2542 2543 2544 2545 2546 2547 |
TRACE(("GDT: No free command index found ")); return 0; } /* if it's the first command, set command semaphore */ if (ha->cmd_cnt == 0) |
45f1a41b2 [SCSI] gdth: clea... |
2548 |
gdth_set_sema0(ha); |
1da177e4c Linux-2.6.12-rc2 |
2549 2550 2551 |
/* fill command */ read_write = 0; |
f842b64e0 [SCSI] gdth: Move... |
2552 2553 |
if (cmndinfo->OpCode != -1) cmdp->OpCode = cmndinfo->OpCode; /* special cache cmd. */ |
1da177e4c Linux-2.6.12-rc2 |
2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 |
else if (scp->cmnd[0] == RESERVE) cmdp->OpCode = GDT_RESERVE_DRV; else if (scp->cmnd[0] == RELEASE) cmdp->OpCode = GDT_RELEASE_DRV; else if (scp->cmnd[0] == ALLOW_MEDIUM_REMOVAL) { if (scp->cmnd[4] & 1) /* prevent ? */ cmdp->OpCode = GDT_MOUNT; else if (scp->cmnd[3] & 1) /* removable drive ? */ cmdp->OpCode = GDT_UNMOUNT; else cmdp->OpCode = GDT_FLUSH; } else if (scp->cmnd[0] == WRITE_6 || scp->cmnd[0] == WRITE_10 || scp->cmnd[0] == WRITE_12 || scp->cmnd[0] == WRITE_16 ) { read_write = 1; if (gdth_write_through || ((ha->hdr[hdrive].rw_attribs & 1) && (ha->cache_feat & GDT_WR_THROUGH))) cmdp->OpCode = GDT_WRITE_THR; else cmdp->OpCode = GDT_WRITE; } else { read_write = 2; cmdp->OpCode = GDT_READ; } cmdp->BoardNode = LOCALBOARD; if (mode64) { cmdp->u.cache64.DeviceNo = hdrive; cmdp->u.cache64.BlockNo = 1; cmdp->u.cache64.sg_canz = 0; } else { cmdp->u.cache.DeviceNo = hdrive; cmdp->u.cache.BlockNo = 1; cmdp->u.cache.sg_canz = 0; } if (read_write) { if (scp->cmd_len == 16) { |
1fe6dbf4d [SCSI] gdth: Conv... |
2592 |
memcpy(&no, &scp->cmnd[2], sizeof(u64)); |
1da177e4c Linux-2.6.12-rc2 |
2593 |
blockno = be64_to_cpu(no); |
1fe6dbf4d [SCSI] gdth: Conv... |
2594 |
memcpy(&cnt, &scp->cmnd[10], sizeof(u32)); |
1da177e4c Linux-2.6.12-rc2 |
2595 2596 |
blockcnt = be32_to_cpu(cnt); } else if (scp->cmd_len == 10) { |
1fe6dbf4d [SCSI] gdth: Conv... |
2597 |
memcpy(&no, &scp->cmnd[2], sizeof(u32)); |
1da177e4c Linux-2.6.12-rc2 |
2598 |
blockno = be32_to_cpu(no); |
1fe6dbf4d [SCSI] gdth: Conv... |
2599 |
memcpy(&cnt, &scp->cmnd[7], sizeof(u16)); |
1da177e4c Linux-2.6.12-rc2 |
2600 2601 |
blockcnt = be16_to_cpu(cnt); } else { |
1fe6dbf4d [SCSI] gdth: Conv... |
2602 |
memcpy(&no, &scp->cmnd[0], sizeof(u32)); |
1da177e4c Linux-2.6.12-rc2 |
2603 2604 2605 2606 2607 2608 2609 |
blockno = be32_to_cpu(no) & 0x001fffffUL; blockcnt= scp->cmnd[4]==0 ? 0x100 : scp->cmnd[4]; } if (mode64) { cmdp->u.cache64.BlockNo = blockno; cmdp->u.cache64.BlockCnt = blockcnt; } else { |
1fe6dbf4d [SCSI] gdth: Conv... |
2610 |
cmdp->u.cache.BlockNo = (u32)blockno; |
1da177e4c Linux-2.6.12-rc2 |
2611 2612 |
cmdp->u.cache.BlockCnt = blockcnt; } |
d35055a0f [SCSI] gdth: remo... |
2613 |
if (scsi_bufflen(scp)) { |
f842b64e0 [SCSI] gdth: Move... |
2614 |
cmndinfo->dma_dir = (read_write == 1 ? |
1da177e4c Linux-2.6.12-rc2 |
2615 |
PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE); |
d35055a0f [SCSI] gdth: remo... |
2616 |
sgcnt = pci_map_sg(ha->pdev, scsi_sglist(scp), scsi_sg_count(scp), |
3892d88ae [SCSI] gdth: !use... |
2617 |
cmndinfo->dma_dir); |
1da177e4c Linux-2.6.12-rc2 |
2618 |
if (mode64) { |
3892d88ae [SCSI] gdth: !use... |
2619 |
struct scatterlist *sl; |
1fe6dbf4d [SCSI] gdth: Conv... |
2620 |
cmdp->u.cache64.DestAddr= (u64)-1; |
1da177e4c Linux-2.6.12-rc2 |
2621 |
cmdp->u.cache64.sg_canz = sgcnt; |
3892d88ae [SCSI] gdth: !use... |
2622 |
scsi_for_each_sg(scp, sl, sgcnt, i) { |
1da177e4c Linux-2.6.12-rc2 |
2623 2624 |
cmdp->u.cache64.sg_lst[i].sg_ptr = sg_dma_address(sl); #ifdef GDTH_DMA_STATISTICS |
1fe6dbf4d [SCSI] gdth: Conv... |
2625 |
if (cmdp->u.cache64.sg_lst[i].sg_ptr > (u64)0xffffffff) |
1da177e4c Linux-2.6.12-rc2 |
2626 2627 2628 2629 2630 2631 2632 |
ha->dma64_cnt++; else ha->dma32_cnt++; #endif cmdp->u.cache64.sg_lst[i].sg_len = sg_dma_len(sl); } } else { |
3892d88ae [SCSI] gdth: !use... |
2633 |
struct scatterlist *sl; |
1da177e4c Linux-2.6.12-rc2 |
2634 2635 |
cmdp->u.cache.DestAddr= 0xffffffff; cmdp->u.cache.sg_canz = sgcnt; |
3892d88ae [SCSI] gdth: !use... |
2636 |
scsi_for_each_sg(scp, sl, sgcnt, i) { |
1da177e4c Linux-2.6.12-rc2 |
2637 2638 2639 2640 2641 2642 2643 2644 2645 |
cmdp->u.cache.sg_lst[i].sg_ptr = sg_dma_address(sl); #ifdef GDTH_DMA_STATISTICS ha->dma32_cnt++; #endif cmdp->u.cache.sg_lst[i].sg_len = sg_dma_len(sl); } } #ifdef GDTH_STATISTICS |
1fe6dbf4d [SCSI] gdth: Conv... |
2646 2647 |
if (max_sg < (u32)sgcnt) { max_sg = (u32)sgcnt; |
1da177e4c Linux-2.6.12-rc2 |
2648 2649 2650 2651 |
TRACE3(("GDT: max_sg = %d ",max_sg)); } #endif |
1da177e4c Linux-2.6.12-rc2 |
2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 |
} } /* evaluate command size, check space */ if (mode64) { TRACE(("cache cmd: addr. %x sganz %x sgptr0 %x sglen0 %x ", cmdp->u.cache64.DestAddr,cmdp->u.cache64.sg_canz, cmdp->u.cache64.sg_lst[0].sg_ptr, cmdp->u.cache64.sg_lst[0].sg_len)); TRACE(("cache cmd: cmd %d blockno. %d, blockcnt %d ", cmdp->OpCode,cmdp->u.cache64.BlockNo,cmdp->u.cache64.BlockCnt)); ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.cache64.sg_lst) + |
1fe6dbf4d [SCSI] gdth: Conv... |
2665 |
(u16)cmdp->u.cache64.sg_canz * sizeof(gdth_sg64_str); |
1da177e4c Linux-2.6.12-rc2 |
2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 |
} else { TRACE(("cache cmd: addr. %x sganz %x sgptr0 %x sglen0 %x ", cmdp->u.cache.DestAddr,cmdp->u.cache.sg_canz, cmdp->u.cache.sg_lst[0].sg_ptr, cmdp->u.cache.sg_lst[0].sg_len)); TRACE(("cache cmd: cmd %d blockno. %d, blockcnt %d ", cmdp->OpCode,cmdp->u.cache.BlockNo,cmdp->u.cache.BlockCnt)); ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.cache.sg_lst) + |
1fe6dbf4d [SCSI] gdth: Conv... |
2676 |
(u16)cmdp->u.cache.sg_canz * sizeof(gdth_sg_str); |
1da177e4c Linux-2.6.12-rc2 |
2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 |
} if (ha->cmd_len & 3) ha->cmd_len += (4 - (ha->cmd_len & 3)); if (ha->cmd_cnt > 0) { if ((ha->cmd_offs_dpmem + ha->cmd_len + DPMEM_COMMAND_OFFSET) > ha->ic_all_size) { TRACE2(("gdth_fill_cache() DPMEM overflow ")); ha->cmd_tab[cmd_index-2].cmnd = UNUSED_CMND; return 0; } } /* copy command */ |
45f1a41b2 [SCSI] gdth: clea... |
2692 |
gdth_copy_command(ha); |
1da177e4c Linux-2.6.12-rc2 |
2693 2694 |
return cmd_index; } |
1fe6dbf4d [SCSI] gdth: Conv... |
2695 |
static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, u8 b) |
1da177e4c Linux-2.6.12-rc2 |
2696 |
{ |
1da177e4c Linux-2.6.12-rc2 |
2697 |
register gdth_cmd_str *cmdp; |
1fe6dbf4d [SCSI] gdth: Conv... |
2698 |
u16 i; |
3892d88ae [SCSI] gdth: !use... |
2699 |
dma_addr_t sense_paddr; |
1da177e4c Linux-2.6.12-rc2 |
2700 |
int cmd_index, sgcnt, mode64; |
1fe6dbf4d [SCSI] gdth: Conv... |
2701 |
u8 t,l; |
1da177e4c Linux-2.6.12-rc2 |
2702 |
struct page *page; |
1fe6dbf4d [SCSI] gdth: Conv... |
2703 |
unsigned long offset; |
3058d5de4 [SCSI] gdth: Setu... |
2704 |
struct gdth_cmndinfo *cmndinfo; |
1da177e4c Linux-2.6.12-rc2 |
2705 |
|
1da177e4c Linux-2.6.12-rc2 |
2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 |
t = scp->device->id; l = scp->device->lun; cmdp = ha->pccb; TRACE(("gdth_fill_raw_cmd() cmd 0x%x bus %d ID %d LUN %d ", scp->cmnd[0],b,t,l)); if (ha->type==GDT_EISA && ha->cmd_cnt>0) return 0; mode64 = (ha->raw_feat & GDT_64BIT) ? TRUE : FALSE; cmdp->Service = SCSIRAWSERVICE; cmdp->RequestBuffer = scp; /* search free command index */ |
45f1a41b2 [SCSI] gdth: clea... |
2721 |
if (!(cmd_index=gdth_get_cmd_index(ha))) { |
1da177e4c Linux-2.6.12-rc2 |
2722 2723 2724 2725 2726 2727 |
TRACE(("GDT: No free command index found ")); return 0; } /* if it's the first command, set command semaphore */ if (ha->cmd_cnt == 0) |
45f1a41b2 [SCSI] gdth: clea... |
2728 |
gdth_set_sema0(ha); |
1da177e4c Linux-2.6.12-rc2 |
2729 |
|
3058d5de4 [SCSI] gdth: Setu... |
2730 |
cmndinfo = gdth_cmnd_priv(scp); |
1da177e4c Linux-2.6.12-rc2 |
2731 |
/* fill command */ |
f842b64e0 [SCSI] gdth: Move... |
2732 2733 |
if (cmndinfo->OpCode != -1) { cmdp->OpCode = cmndinfo->OpCode; /* special raw cmd. */ |
1da177e4c Linux-2.6.12-rc2 |
2734 2735 |
cmdp->BoardNode = LOCALBOARD; if (mode64) { |
f842b64e0 [SCSI] gdth: Move... |
2736 |
cmdp->u.raw64.direction = (cmndinfo->phase >> 8); |
1da177e4c Linux-2.6.12-rc2 |
2737 2738 2739 2740 2741 2742 |
TRACE2(("special raw cmd 0x%x param 0x%x ", cmdp->OpCode, cmdp->u.raw64.direction)); /* evaluate command size */ ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw64.sg_lst); } else { |
f842b64e0 [SCSI] gdth: Move... |
2743 |
cmdp->u.raw.direction = (cmndinfo->phase >> 8); |
1da177e4c Linux-2.6.12-rc2 |
2744 2745 2746 2747 2748 2749 2750 2751 2752 |
TRACE2(("special raw cmd 0x%x param 0x%x ", cmdp->OpCode, cmdp->u.raw.direction)); /* evaluate command size */ ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw.sg_lst); } } else { page = virt_to_page(scp->sense_buffer); |
1fe6dbf4d [SCSI] gdth: Conv... |
2753 |
offset = (unsigned long)scp->sense_buffer & ~PAGE_MASK; |
1da177e4c Linux-2.6.12-rc2 |
2754 2755 |
sense_paddr = pci_map_page(ha->pdev,page,offset, 16,PCI_DMA_FROMDEVICE); |
3058d5de4 [SCSI] gdth: Setu... |
2756 2757 |
cmndinfo->sense_paddr = sense_paddr; |
1da177e4c Linux-2.6.12-rc2 |
2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 |
cmdp->OpCode = GDT_WRITE; /* always */ cmdp->BoardNode = LOCALBOARD; if (mode64) { cmdp->u.raw64.reserved = 0; cmdp->u.raw64.mdisc_time = 0; cmdp->u.raw64.mcon_time = 0; cmdp->u.raw64.clen = scp->cmd_len; cmdp->u.raw64.target = t; cmdp->u.raw64.lun = l; cmdp->u.raw64.bus = b; cmdp->u.raw64.priority = 0; |
d35055a0f [SCSI] gdth: remo... |
2769 |
cmdp->u.raw64.sdlen = scsi_bufflen(scp); |
1da177e4c Linux-2.6.12-rc2 |
2770 2771 2772 2773 2774 |
cmdp->u.raw64.sense_len = 16; cmdp->u.raw64.sense_data = sense_paddr; cmdp->u.raw64.direction = gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN; memcpy(cmdp->u.raw64.cmd,scp->cmnd,16); |
bb9ba31ca [SCSI] gdth: fix ... |
2775 |
cmdp->u.raw64.sg_ranz = 0; |
1da177e4c Linux-2.6.12-rc2 |
2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 |
} else { cmdp->u.raw.reserved = 0; cmdp->u.raw.mdisc_time = 0; cmdp->u.raw.mcon_time = 0; cmdp->u.raw.clen = scp->cmd_len; cmdp->u.raw.target = t; cmdp->u.raw.lun = l; cmdp->u.raw.bus = b; cmdp->u.raw.priority = 0; cmdp->u.raw.link_p = 0; |
d35055a0f [SCSI] gdth: remo... |
2786 |
cmdp->u.raw.sdlen = scsi_bufflen(scp); |
1da177e4c Linux-2.6.12-rc2 |
2787 2788 2789 2790 2791 |
cmdp->u.raw.sense_len = 16; cmdp->u.raw.sense_data = sense_paddr; cmdp->u.raw.direction = gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN; memcpy(cmdp->u.raw.cmd,scp->cmnd,12); |
bb9ba31ca [SCSI] gdth: fix ... |
2792 |
cmdp->u.raw.sg_ranz = 0; |
1da177e4c Linux-2.6.12-rc2 |
2793 |
} |
d35055a0f [SCSI] gdth: remo... |
2794 |
if (scsi_bufflen(scp)) { |
f842b64e0 [SCSI] gdth: Move... |
2795 |
cmndinfo->dma_dir = PCI_DMA_BIDIRECTIONAL; |
d35055a0f [SCSI] gdth: remo... |
2796 |
sgcnt = pci_map_sg(ha->pdev, scsi_sglist(scp), scsi_sg_count(scp), |
3892d88ae [SCSI] gdth: !use... |
2797 |
cmndinfo->dma_dir); |
1da177e4c Linux-2.6.12-rc2 |
2798 |
if (mode64) { |
3892d88ae [SCSI] gdth: !use... |
2799 |
struct scatterlist *sl; |
1fe6dbf4d [SCSI] gdth: Conv... |
2800 |
cmdp->u.raw64.sdata = (u64)-1; |
1da177e4c Linux-2.6.12-rc2 |
2801 |
cmdp->u.raw64.sg_ranz = sgcnt; |
3892d88ae [SCSI] gdth: !use... |
2802 |
scsi_for_each_sg(scp, sl, sgcnt, i) { |
1da177e4c Linux-2.6.12-rc2 |
2803 2804 |
cmdp->u.raw64.sg_lst[i].sg_ptr = sg_dma_address(sl); #ifdef GDTH_DMA_STATISTICS |
1fe6dbf4d [SCSI] gdth: Conv... |
2805 |
if (cmdp->u.raw64.sg_lst[i].sg_ptr > (u64)0xffffffff) |
1da177e4c Linux-2.6.12-rc2 |
2806 2807 2808 2809 2810 2811 2812 |
ha->dma64_cnt++; else ha->dma32_cnt++; #endif cmdp->u.raw64.sg_lst[i].sg_len = sg_dma_len(sl); } } else { |
3892d88ae [SCSI] gdth: !use... |
2813 |
struct scatterlist *sl; |
1da177e4c Linux-2.6.12-rc2 |
2814 2815 |
cmdp->u.raw.sdata = 0xffffffff; cmdp->u.raw.sg_ranz = sgcnt; |
3892d88ae [SCSI] gdth: !use... |
2816 |
scsi_for_each_sg(scp, sl, sgcnt, i) { |
1da177e4c Linux-2.6.12-rc2 |
2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 |
cmdp->u.raw.sg_lst[i].sg_ptr = sg_dma_address(sl); #ifdef GDTH_DMA_STATISTICS ha->dma32_cnt++; #endif cmdp->u.raw.sg_lst[i].sg_len = sg_dma_len(sl); } } #ifdef GDTH_STATISTICS if (max_sg < sgcnt) { max_sg = sgcnt; TRACE3(("GDT: max_sg = %d ",sgcnt)); } #endif |
1da177e4c Linux-2.6.12-rc2 |
2832 2833 2834 2835 2836 2837 2838 2839 2840 |
} if (mode64) { TRACE(("raw cmd: addr. %x sganz %x sgptr0 %x sglen0 %x ", cmdp->u.raw64.sdata,cmdp->u.raw64.sg_ranz, cmdp->u.raw64.sg_lst[0].sg_ptr, cmdp->u.raw64.sg_lst[0].sg_len)); /* evaluate command size */ ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw64.sg_lst) + |
1fe6dbf4d [SCSI] gdth: Conv... |
2841 |
(u16)cmdp->u.raw64.sg_ranz * sizeof(gdth_sg64_str); |
1da177e4c Linux-2.6.12-rc2 |
2842 2843 2844 2845 2846 2847 2848 2849 |
} else { TRACE(("raw cmd: addr. %x sganz %x sgptr0 %x sglen0 %x ", cmdp->u.raw.sdata,cmdp->u.raw.sg_ranz, cmdp->u.raw.sg_lst[0].sg_ptr, cmdp->u.raw.sg_lst[0].sg_len)); /* evaluate command size */ ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw.sg_lst) + |
1fe6dbf4d [SCSI] gdth: Conv... |
2850 |
(u16)cmdp->u.raw.sg_ranz * sizeof(gdth_sg_str); |
1da177e4c Linux-2.6.12-rc2 |
2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 |
} } /* check space */ if (ha->cmd_len & 3) ha->cmd_len += (4 - (ha->cmd_len & 3)); if (ha->cmd_cnt > 0) { if ((ha->cmd_offs_dpmem + ha->cmd_len + DPMEM_COMMAND_OFFSET) > ha->ic_all_size) { TRACE2(("gdth_fill_raw() DPMEM overflow ")); ha->cmd_tab[cmd_index-2].cmnd = UNUSED_CMND; return 0; } } /* copy command */ |
45f1a41b2 [SCSI] gdth: clea... |
2868 |
gdth_copy_command(ha); |
1da177e4c Linux-2.6.12-rc2 |
2869 2870 |
return cmd_index; } |
45f1a41b2 [SCSI] gdth: clea... |
2871 |
static int gdth_special_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp) |
1da177e4c Linux-2.6.12-rc2 |
2872 |
{ |
1da177e4c Linux-2.6.12-rc2 |
2873 |
register gdth_cmd_str *cmdp; |
ee54cc6af [SCSI] gdth: fix ... |
2874 |
struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp); |
1da177e4c Linux-2.6.12-rc2 |
2875 |
int cmd_index; |
1da177e4c Linux-2.6.12-rc2 |
2876 2877 2878 2879 2880 |
cmdp= ha->pccb; TRACE2(("gdth_special_cmd(): ")); if (ha->type==GDT_EISA && ha->cmd_cnt>0) return 0; |
ee54cc6af [SCSI] gdth: fix ... |
2881 |
*cmdp = *cmndinfo->internal_cmd_str; |
1da177e4c Linux-2.6.12-rc2 |
2882 2883 2884 |
cmdp->RequestBuffer = scp; /* search free command index */ |
45f1a41b2 [SCSI] gdth: clea... |
2885 |
if (!(cmd_index=gdth_get_cmd_index(ha))) { |
1da177e4c Linux-2.6.12-rc2 |
2886 2887 2888 2889 2890 2891 2892 |
TRACE(("GDT: No free command index found ")); return 0; } /* if it's the first command, set command semaphore */ if (ha->cmd_cnt == 0) |
45f1a41b2 [SCSI] gdth: clea... |
2893 |
gdth_set_sema0(ha); |
1da177e4c Linux-2.6.12-rc2 |
2894 2895 2896 2897 2898 2899 |
/* evaluate command size, check space */ if (cmdp->OpCode == GDT_IOCTL) { TRACE2(("IOCTL ")); ha->cmd_len = |
1fe6dbf4d [SCSI] gdth: Conv... |
2900 |
GDTOFFSOF(gdth_cmd_str,u.ioctl.p_param) + sizeof(u64); |
1da177e4c Linux-2.6.12-rc2 |
2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 |
} else if (cmdp->Service == CACHESERVICE) { TRACE2(("cache command %d ",cmdp->OpCode)); if (ha->cache_feat & GDT_64BIT) ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.cache64.sg_lst) + sizeof(gdth_sg64_str); else ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.cache.sg_lst) + sizeof(gdth_sg_str); } else if (cmdp->Service == SCSIRAWSERVICE) { TRACE2(("raw command %d ",cmdp->OpCode)); if (ha->raw_feat & GDT_64BIT) ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw64.sg_lst) + sizeof(gdth_sg64_str); else ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.raw.sg_lst) + sizeof(gdth_sg_str); } if (ha->cmd_len & 3) ha->cmd_len += (4 - (ha->cmd_len & 3)); if (ha->cmd_cnt > 0) { if ((ha->cmd_offs_dpmem + ha->cmd_len + DPMEM_COMMAND_OFFSET) > ha->ic_all_size) { TRACE2(("gdth_special_cmd() DPMEM overflow ")); ha->cmd_tab[cmd_index-2].cmnd = UNUSED_CMND; return 0; } } /* copy command */ |
45f1a41b2 [SCSI] gdth: clea... |
2935 |
gdth_copy_command(ha); |
1da177e4c Linux-2.6.12-rc2 |
2936 2937 2938 2939 2940 |
return cmd_index; } /* Controller event handling functions */ |
1fe6dbf4d [SCSI] gdth: Conv... |
2941 2942 |
static gdth_evt_str *gdth_store_event(gdth_ha_str *ha, u16 source, u16 idx, gdth_evt_data *evt) |
1da177e4c Linux-2.6.12-rc2 |
2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 |
{ gdth_evt_str *e; struct timeval tv; /* no GDTH_LOCK_HA() ! */ TRACE2(("gdth_store_event() source %d idx %d ", source, idx)); if (source == 0) /* no source -> no event */ return NULL; if (ebuffer[elastidx].event_source == source && ebuffer[elastidx].event_idx == idx && ((evt->size != 0 && ebuffer[elastidx].event_data.size != 0 && !memcmp((char *)&ebuffer[elastidx].event_data.eu, (char *)&evt->eu, evt->size)) || (evt->size == 0 && ebuffer[elastidx].event_data.size == 0 && !strcmp((char *)&ebuffer[elastidx].event_data.event_string, (char *)&evt->event_string)))) { e = &ebuffer[elastidx]; do_gettimeofday(&tv); e->last_stamp = tv.tv_sec; ++e->same_count; } else { if (ebuffer[elastidx].event_source != 0) { /* entry not free ? */ ++elastidx; if (elastidx == MAX_EVENTS) elastidx = 0; if (elastidx == eoldidx) { /* reached mark ? */ ++eoldidx; if (eoldidx == MAX_EVENTS) eoldidx = 0; } } e = &ebuffer[elastidx]; e->event_source = source; e->event_idx = idx; do_gettimeofday(&tv); e->first_stamp = e->last_stamp = tv.tv_sec; e->same_count = 1; e->event_data = *evt; e->application = 0; } return e; } static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr) { gdth_evt_str *e; int eindex; |
1fe6dbf4d [SCSI] gdth: Conv... |
2992 |
unsigned long flags; |
1da177e4c Linux-2.6.12-rc2 |
2993 2994 2995 2996 2997 2998 2999 3000 3001 |
TRACE2(("gdth_read_event() handle %d ", handle)); spin_lock_irqsave(&ha->smp_lock, flags); if (handle == -1) eindex = eoldidx; else eindex = handle; estr->event_source = 0; |
690e74486 [SCSI] gdth: Prev... |
3002 |
if (eindex < 0 || eindex >= MAX_EVENTS) { |
1da177e4c Linux-2.6.12-rc2 |
3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 |
spin_unlock_irqrestore(&ha->smp_lock, flags); return eindex; } e = &ebuffer[eindex]; if (e->event_source != 0) { if (eindex != elastidx) { if (++eindex == MAX_EVENTS) eindex = 0; } else { eindex = -1; } memcpy(estr, e, sizeof(gdth_evt_str)); } spin_unlock_irqrestore(&ha->smp_lock, flags); return eindex; } static void gdth_readapp_event(gdth_ha_str *ha, |
1fe6dbf4d [SCSI] gdth: Conv... |
3021 |
u8 application, gdth_evt_str *estr) |
1da177e4c Linux-2.6.12-rc2 |
3022 3023 3024 |
{ gdth_evt_str *e; int eindex; |
1fe6dbf4d [SCSI] gdth: Conv... |
3025 3026 |
unsigned long flags; u8 found = FALSE; |
1da177e4c Linux-2.6.12-rc2 |
3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 |
TRACE2(("gdth_readapp_event() app. %d ", application)); spin_lock_irqsave(&ha->smp_lock, flags); eindex = eoldidx; for (;;) { e = &ebuffer[eindex]; if (e->event_source == 0) break; if ((e->application & application) == 0) { e->application |= application; found = TRUE; break; } if (eindex == elastidx) break; if (++eindex == MAX_EVENTS) eindex = 0; } if (found) memcpy(estr, e, sizeof(gdth_evt_str)); else estr->event_source = 0; spin_unlock_irqrestore(&ha->smp_lock, flags); } static void gdth_clear_events(void) { TRACE(("gdth_clear_events()")); eoldidx = elastidx = 0; ebuffer[0].event_source = 0; } /* SCSI interface functions */ |
230e886e7 [SCSI] gdth: kill... |
3063 |
static irqreturn_t __gdth_interrupt(gdth_ha_str *ha, |
10e1b4bc9 [SCSI] gdth: gdth... |
3064 |
int gdth_from_wait, int* pIndex) |
1da177e4c Linux-2.6.12-rc2 |
3065 |
{ |
1da177e4c Linux-2.6.12-rc2 |
3066 3067 3068 3069 |
gdt6m_dpram_str __iomem *dp6m_ptr = NULL; gdt6_dpram_str __iomem *dp6_ptr; gdt2_dpram_str __iomem *dp2_ptr; Scsi_Cmnd *scp; |
10e1b4bc9 [SCSI] gdth: gdth... |
3070 |
int rval, i; |
1fe6dbf4d [SCSI] gdth: Conv... |
3071 3072 3073 |
u8 IStatus; u16 Service; unsigned long flags = 0; |
1da177e4c Linux-2.6.12-rc2 |
3074 3075 3076 3077 3078 3079 |
#ifdef INT_COAL int coalesced = FALSE; int next = FALSE; gdth_coal_status *pcs = NULL; int act_int_coal = 0; #endif |
230e886e7 [SCSI] gdth: kill... |
3080 3081 |
TRACE(("gdth_interrupt() IRQ %d ", ha->irq)); |
1da177e4c Linux-2.6.12-rc2 |
3082 3083 3084 3085 3086 3087 3088 3089 3090 |
/* if polling and not from gdth_wait() -> return */ if (gdth_polling) { if (!gdth_from_wait) { return IRQ_HANDLED; } } if (!gdth_polling) |
10e1b4bc9 [SCSI] gdth: gdth... |
3091 |
spin_lock_irqsave(&ha->smp_lock, flags); |
1da177e4c Linux-2.6.12-rc2 |
3092 3093 |
/* search controller */ |
230e886e7 [SCSI] gdth: kill... |
3094 3095 |
IStatus = gdth_get_status(ha); if (IStatus == 0) { |
1da177e4c Linux-2.6.12-rc2 |
3096 3097 |
/* spurious interrupt */ if (!gdth_polling) |
10e1b4bc9 [SCSI] gdth: gdth... |
3098 3099 |
spin_unlock_irqrestore(&ha->smp_lock, flags); return IRQ_HANDLED; |
1da177e4c Linux-2.6.12-rc2 |
3100 |
} |
1da177e4c Linux-2.6.12-rc2 |
3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 |
#ifdef GDTH_STATISTICS ++act_ints; #endif #ifdef INT_COAL /* See if the fw is returning coalesced status */ if (IStatus == COALINDEX) { /* Coalesced status. Setup the initial status buffer pointer and flags */ pcs = ha->coal_stat; coalesced = TRUE; next = TRUE; } do { if (coalesced) { /* For coalesced requests all status information is found in the status buffer */ |
1fe6dbf4d [SCSI] gdth: Conv... |
3120 |
IStatus = (u8)(pcs->status & 0xff); |
1da177e4c Linux-2.6.12-rc2 |
3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 |
} #endif if (ha->type == GDT_EISA) { if (IStatus & 0x80) { /* error flag */ IStatus &= ~0x80; ha->status = inw(ha->bmic + MAILBOXREG+8); TRACE2(("gdth_interrupt() error %d/%d ",IStatus,ha->status)); } else /* no error */ ha->status = S_OK; ha->info = inl(ha->bmic + MAILBOXREG+12); ha->service = inw(ha->bmic + MAILBOXREG+10); ha->info2 = inl(ha->bmic + MAILBOXREG+4); outb(0xff, ha->bmic + EDOORREG); /* acknowledge interrupt */ outb(0x00, ha->bmic + SEMA1REG); /* reset status semaphore */ } else if (ha->type == GDT_ISA) { dp2_ptr = ha->brd; if (IStatus & 0x80) { /* error flag */ IStatus &= ~0x80; |
a52667f3c [SCSI] gdth: kill... |
3142 |
ha->status = readw(&dp2_ptr->u.ic.Status); |
1da177e4c Linux-2.6.12-rc2 |
3143 3144 3145 3146 |
TRACE2(("gdth_interrupt() error %d/%d ",IStatus,ha->status)); } else /* no error */ ha->status = S_OK; |
a52667f3c [SCSI] gdth: kill... |
3147 3148 3149 |
ha->info = readl(&dp2_ptr->u.ic.Info[0]); ha->service = readw(&dp2_ptr->u.ic.Service); ha->info2 = readl(&dp2_ptr->u.ic.Info[1]); |
1da177e4c Linux-2.6.12-rc2 |
3150 |
|
a52667f3c [SCSI] gdth: kill... |
3151 3152 3153 |
writeb(0xff, &dp2_ptr->io.irqdel); /* acknowledge interrupt */ writeb(0, &dp2_ptr->u.ic.Cmd_Index);/* reset command index */ writeb(0, &dp2_ptr->io.Sema1); /* reset status semaphore */ |
1da177e4c Linux-2.6.12-rc2 |
3154 3155 3156 3157 |
} else if (ha->type == GDT_PCI) { dp6_ptr = ha->brd; if (IStatus & 0x80) { /* error flag */ IStatus &= ~0x80; |
a52667f3c [SCSI] gdth: kill... |
3158 |
ha->status = readw(&dp6_ptr->u.ic.Status); |
1da177e4c Linux-2.6.12-rc2 |
3159 3160 3161 3162 |
TRACE2(("gdth_interrupt() error %d/%d ",IStatus,ha->status)); } else /* no error */ ha->status = S_OK; |
a52667f3c [SCSI] gdth: kill... |
3163 3164 3165 |
ha->info = readl(&dp6_ptr->u.ic.Info[0]); ha->service = readw(&dp6_ptr->u.ic.Service); ha->info2 = readl(&dp6_ptr->u.ic.Info[1]); |
1da177e4c Linux-2.6.12-rc2 |
3166 |
|
a52667f3c [SCSI] gdth: kill... |
3167 3168 3169 |
writeb(0xff, &dp6_ptr->io.irqdel); /* acknowledge interrupt */ writeb(0, &dp6_ptr->u.ic.Cmd_Index);/* reset command index */ writeb(0, &dp6_ptr->io.Sema1); /* reset status semaphore */ |
1da177e4c Linux-2.6.12-rc2 |
3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 |
} else if (ha->type == GDT_PCINEW) { if (IStatus & 0x80) { /* error flag */ IStatus &= ~0x80; ha->status = inw(PTR2USHORT(&ha->plx->status)); TRACE2(("gdth_interrupt() error %d/%d ",IStatus,ha->status)); } else ha->status = S_OK; ha->info = inl(PTR2USHORT(&ha->plx->info[0])); ha->service = inw(PTR2USHORT(&ha->plx->service)); ha->info2 = inl(PTR2USHORT(&ha->plx->info[1])); outb(0xff, PTR2USHORT(&ha->plx->edoor_reg)); outb(0x00, PTR2USHORT(&ha->plx->sema1_reg)); } else if (ha->type == GDT_PCIMPR) { dp6m_ptr = ha->brd; if (IStatus & 0x80) { /* error flag */ IStatus &= ~0x80; #ifdef INT_COAL if (coalesced) |
107e716b3 [SCSI] gdth: Fix ... |
3190 |
ha->status = pcs->ext_status & 0xffff; |
1da177e4c Linux-2.6.12-rc2 |
3191 3192 |
else #endif |
a52667f3c [SCSI] gdth: kill... |
3193 |
ha->status = readw(&dp6m_ptr->i960r.status); |
1da177e4c Linux-2.6.12-rc2 |
3194 3195 3196 3197 3198 3199 3200 3201 3202 |
TRACE2(("gdth_interrupt() error %d/%d ",IStatus,ha->status)); } else /* no error */ ha->status = S_OK; #ifdef INT_COAL /* get information */ if (coalesced) { ha->info = pcs->info0; ha->info2 = pcs->info1; |
107e716b3 [SCSI] gdth: Fix ... |
3203 |
ha->service = (pcs->ext_status >> 16) & 0xffff; |
1da177e4c Linux-2.6.12-rc2 |
3204 3205 3206 |
} else #endif { |
a52667f3c [SCSI] gdth: kill... |
3207 3208 3209 |
ha->info = readl(&dp6m_ptr->i960r.info[0]); ha->service = readw(&dp6m_ptr->i960r.service); ha->info2 = readl(&dp6m_ptr->i960r.info[1]); |
1da177e4c Linux-2.6.12-rc2 |
3210 3211 3212 3213 3214 |
} /* event string */ if (IStatus == ASYNCINDEX) { if (ha->service != SCREENSERVICE && (ha->fw_vers & 0xff) >= 0x1a) { |
a52667f3c [SCSI] gdth: kill... |
3215 |
ha->dvr.severity = readb |
1da177e4c Linux-2.6.12-rc2 |
3216 3217 |
(&((gdt6m_dpram_str __iomem *)ha->brd)->i960r.severity); for (i = 0; i < 256; ++i) { |
a52667f3c [SCSI] gdth: kill... |
3218 |
ha->dvr.event_string[i] = readb |
1da177e4c Linux-2.6.12-rc2 |
3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 |
(&((gdt6m_dpram_str __iomem *)ha->brd)->i960r.evt_str[i]); if (ha->dvr.event_string[i] == 0) break; } } } #ifdef INT_COAL /* Make sure that non coalesced interrupts get cleared before being handled by gdth_async_event/gdth_sync_event */ if (!coalesced) #endif { |
a52667f3c [SCSI] gdth: kill... |
3231 3232 |
writeb(0xff, &dp6m_ptr->i960r.edoor_reg); writeb(0, &dp6m_ptr->i960r.sema1_reg); |
1da177e4c Linux-2.6.12-rc2 |
3233 3234 3235 3236 3237 |
} } else { TRACE2(("gdth_interrupt() unknown controller type ")); if (!gdth_polling) |
10e1b4bc9 [SCSI] gdth: gdth... |
3238 |
spin_unlock_irqrestore(&ha->smp_lock, flags); |
1da177e4c Linux-2.6.12-rc2 |
3239 3240 3241 3242 3243 3244 3245 3246 |
return IRQ_HANDLED; } TRACE(("gdth_interrupt() index %d stat %d info %d ", IStatus,ha->status,ha->info)); if (gdth_from_wait) { |
10e1b4bc9 [SCSI] gdth: gdth... |
3247 |
*pIndex = (int)IStatus; |
1da177e4c Linux-2.6.12-rc2 |
3248 3249 3250 3251 3252 |
} if (IStatus == ASYNCINDEX) { TRACE2(("gdth_interrupt() async. event ")); |
45f1a41b2 [SCSI] gdth: clea... |
3253 |
gdth_async_event(ha); |
1da177e4c Linux-2.6.12-rc2 |
3254 |
if (!gdth_polling) |
10e1b4bc9 [SCSI] gdth: gdth... |
3255 |
spin_unlock_irqrestore(&ha->smp_lock, flags); |
45f1a41b2 [SCSI] gdth: clea... |
3256 |
gdth_next(ha); |
1da177e4c Linux-2.6.12-rc2 |
3257 3258 3259 3260 3261 3262 3263 |
return IRQ_HANDLED; } if (IStatus == SPEZINDEX) { TRACE2(("Service unknown or not initialized ! ")); ha->dvr.size = sizeof(ha->dvr.eu.driver); |
10e1b4bc9 [SCSI] gdth: gdth... |
3264 |
ha->dvr.eu.driver.ionode = ha->hanum; |
1da177e4c Linux-2.6.12-rc2 |
3265 3266 |
gdth_store_event(ha, ES_DRIVER, 4, &ha->dvr); if (!gdth_polling) |
10e1b4bc9 [SCSI] gdth: gdth... |
3267 |
spin_unlock_irqrestore(&ha->smp_lock, flags); |
1da177e4c Linux-2.6.12-rc2 |
3268 3269 3270 3271 3272 3273 3274 3275 3276 |
return IRQ_HANDLED; } scp = ha->cmd_tab[IStatus-2].cmnd; Service = ha->cmd_tab[IStatus-2].service; ha->cmd_tab[IStatus-2].cmnd = UNUSED_CMND; if (scp == UNUSED_CMND) { TRACE2(("gdth_interrupt() index to unused command (%d) ",IStatus)); ha->dvr.size = sizeof(ha->dvr.eu.driver); |
10e1b4bc9 [SCSI] gdth: gdth... |
3277 |
ha->dvr.eu.driver.ionode = ha->hanum; |
1da177e4c Linux-2.6.12-rc2 |
3278 3279 3280 |
ha->dvr.eu.driver.index = IStatus; gdth_store_event(ha, ES_DRIVER, 1, &ha->dvr); if (!gdth_polling) |
10e1b4bc9 [SCSI] gdth: gdth... |
3281 |
spin_unlock_irqrestore(&ha->smp_lock, flags); |
1da177e4c Linux-2.6.12-rc2 |
3282 3283 3284 3285 3286 3287 |
return IRQ_HANDLED; } if (scp == INTERNAL_CMND) { TRACE(("gdth_interrupt() answer to internal command ")); if (!gdth_polling) |
10e1b4bc9 [SCSI] gdth: gdth... |
3288 |
spin_unlock_irqrestore(&ha->smp_lock, flags); |
1da177e4c Linux-2.6.12-rc2 |
3289 3290 3291 3292 3293 |
return IRQ_HANDLED; } TRACE(("gdth_interrupt() sync. status ")); |
45f1a41b2 [SCSI] gdth: clea... |
3294 |
rval = gdth_sync_event(ha,Service,IStatus,scp); |
1da177e4c Linux-2.6.12-rc2 |
3295 |
if (!gdth_polling) |
10e1b4bc9 [SCSI] gdth: gdth... |
3296 |
spin_unlock_irqrestore(&ha->smp_lock, flags); |
1da177e4c Linux-2.6.12-rc2 |
3297 |
if (rval == 2) { |
f842b64e0 [SCSI] gdth: Move... |
3298 |
gdth_putq(ha, scp, gdth_cmnd_priv(scp)->priority); |
1da177e4c Linux-2.6.12-rc2 |
3299 |
} else if (rval == 1) { |
b8bff2aea gdth: Make one ab... |
3300 |
gdth_scsi_done(scp); |
1da177e4c Linux-2.6.12-rc2 |
3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 |
} #ifdef INT_COAL if (coalesced) { /* go to the next status in the status buffer */ ++pcs; #ifdef GDTH_STATISTICS ++act_int_coal; if (act_int_coal > max_int_coal) { max_int_coal = act_int_coal; |
1fe6dbf4d [SCSI] gdth: Conv... |
3311 3312 |
printk("GDT: max_int_coal = %d ",(u16)max_int_coal); |
1da177e4c Linux-2.6.12-rc2 |
3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 |
} #endif /* see if there is another status */ if (pcs->status == 0) /* Stop the coalesce loop */ next = FALSE; } } while (next); /* coalescing only for new GDT_PCIMPR controllers available */ if (ha->type == GDT_PCIMPR && coalesced) { |
a52667f3c [SCSI] gdth: kill... |
3324 3325 |
writeb(0xff, &dp6m_ptr->i960r.edoor_reg); writeb(0, &dp6m_ptr->i960r.sema1_reg); |
1da177e4c Linux-2.6.12-rc2 |
3326 3327 |
} #endif |
45f1a41b2 [SCSI] gdth: clea... |
3328 |
gdth_next(ha); |
1da177e4c Linux-2.6.12-rc2 |
3329 3330 |
return IRQ_HANDLED; } |
10e1b4bc9 [SCSI] gdth: gdth... |
3331 3332 |
static irqreturn_t gdth_interrupt(int irq, void *dev_id) { |
230e886e7 [SCSI] gdth: kill... |
3333 |
gdth_ha_str *ha = dev_id; |
10e1b4bc9 [SCSI] gdth: gdth... |
3334 |
|
230e886e7 [SCSI] gdth: kill... |
3335 |
return __gdth_interrupt(ha, false, NULL); |
10e1b4bc9 [SCSI] gdth: gdth... |
3336 |
} |
1fe6dbf4d [SCSI] gdth: Conv... |
3337 |
static int gdth_sync_event(gdth_ha_str *ha, int service, u8 index, |
45f1a41b2 [SCSI] gdth: clea... |
3338 |
Scsi_Cmnd *scp) |
1da177e4c Linux-2.6.12-rc2 |
3339 |
{ |
1da177e4c Linux-2.6.12-rc2 |
3340 3341 |
gdth_msg_str *msg; gdth_cmd_str *cmdp; |
1fe6dbf4d [SCSI] gdth: Conv... |
3342 |
u8 b, t; |
3058d5de4 [SCSI] gdth: Setu... |
3343 |
struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp); |
1da177e4c Linux-2.6.12-rc2 |
3344 |
|
1da177e4c Linux-2.6.12-rc2 |
3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 |
cmdp = ha->pccb; TRACE(("gdth_sync_event() serv %d status %d ", service,ha->status)); if (service == SCREENSERVICE) { msg = ha->pmsg; TRACE(("len: %d, answer: %d, ext: %d, alen: %d ", msg->msg_len,msg->msg_answer,msg->msg_ext,msg->msg_alen)); if (msg->msg_len > MSGLEN+1) msg->msg_len = MSGLEN+1; if (msg->msg_len) if (!(msg->msg_answer && msg->msg_ext)) { msg->msg_text[msg->msg_len] = '\0'; printk("%s",msg->msg_text); } if (msg->msg_ext && !msg->msg_answer) { |
45f1a41b2 [SCSI] gdth: clea... |
3364 |
while (gdth_test_busy(ha)) |
1da177e4c Linux-2.6.12-rc2 |
3365 3366 3367 |
gdth_delay(0); cmdp->Service = SCREENSERVICE; cmdp->RequestBuffer = SCREEN_CMND; |
45f1a41b2 [SCSI] gdth: clea... |
3368 3369 |
gdth_get_cmd_index(ha); gdth_set_sema0(ha); |
1da177e4c Linux-2.6.12-rc2 |
3370 3371 3372 3373 3374 3375 3376 |
cmdp->OpCode = GDT_READ; cmdp->BoardNode = LOCALBOARD; cmdp->u.screen.reserved = 0; cmdp->u.screen.su.msg.msg_handle= msg->msg_handle; cmdp->u.screen.su.msg.msg_addr = ha->msg_phys; ha->cmd_offs_dpmem = 0; ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) |
1fe6dbf4d [SCSI] gdth: Conv... |
3377 |
+ sizeof(u64); |
1da177e4c Linux-2.6.12-rc2 |
3378 |
ha->cmd_cnt = 0; |
45f1a41b2 [SCSI] gdth: clea... |
3379 3380 |
gdth_copy_command(ha); gdth_release_event(ha); |
1da177e4c Linux-2.6.12-rc2 |
3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 |
return 0; } if (msg->msg_answer && msg->msg_alen) { /* default answers (getchar() not possible) */ if (msg->msg_alen == 1) { msg->msg_alen = 0; msg->msg_len = 1; msg->msg_text[0] = 0; } else { msg->msg_alen -= 2; msg->msg_len = 2; msg->msg_text[0] = 1; msg->msg_text[1] = 0; } msg->msg_ext = 0; msg->msg_answer = 0; |
45f1a41b2 [SCSI] gdth: clea... |
3398 |
while (gdth_test_busy(ha)) |
1da177e4c Linux-2.6.12-rc2 |
3399 3400 3401 |
gdth_delay(0); cmdp->Service = SCREENSERVICE; cmdp->RequestBuffer = SCREEN_CMND; |
45f1a41b2 [SCSI] gdth: clea... |
3402 3403 |
gdth_get_cmd_index(ha); gdth_set_sema0(ha); |
1da177e4c Linux-2.6.12-rc2 |
3404 3405 3406 3407 3408 3409 3410 |
cmdp->OpCode = GDT_WRITE; cmdp->BoardNode = LOCALBOARD; cmdp->u.screen.reserved = 0; cmdp->u.screen.su.msg.msg_handle= msg->msg_handle; cmdp->u.screen.su.msg.msg_addr = ha->msg_phys; ha->cmd_offs_dpmem = 0; ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) |
1fe6dbf4d [SCSI] gdth: Conv... |
3411 |
+ sizeof(u64); |
1da177e4c Linux-2.6.12-rc2 |
3412 |
ha->cmd_cnt = 0; |
45f1a41b2 [SCSI] gdth: clea... |
3413 3414 |
gdth_copy_command(ha); gdth_release_event(ha); |
1da177e4c Linux-2.6.12-rc2 |
3415 3416 3417 3418 3419 3420 |
return 0; } printk(" "); } else { |
52759e6ab [SCSI] gdth: Remo... |
3421 |
b = scp->device->channel; |
1da177e4c Linux-2.6.12-rc2 |
3422 |
t = scp->device->id; |
f842b64e0 [SCSI] gdth: Move... |
3423 |
if (cmndinfo->OpCode == -1 && b != ha->virt_bus) { |
1da177e4c Linux-2.6.12-rc2 |
3424 3425 3426 3427 3428 3429 |
ha->raw[BUS_L2P(ha,b)].io_cnt[t]--; } /* cache or raw service */ if (ha->status == S_BSY) { TRACE2(("Controller busy -> retry ! ")); |
f842b64e0 [SCSI] gdth: Move... |
3430 3431 |
if (cmndinfo->OpCode == GDT_MOUNT) cmndinfo->OpCode = GDT_CLUST_INFO; |
1da177e4c Linux-2.6.12-rc2 |
3432 3433 3434 |
/* retry */ return 2; } |
d35055a0f [SCSI] gdth: remo... |
3435 3436 |
if (scsi_bufflen(scp)) pci_unmap_sg(ha->pdev, scsi_sglist(scp), scsi_sg_count(scp), |
3892d88ae [SCSI] gdth: !use... |
3437 |
cmndinfo->dma_dir); |
3058d5de4 [SCSI] gdth: Setu... |
3438 3439 3440 |
if (cmndinfo->sense_paddr) pci_unmap_page(ha->pdev, cmndinfo->sense_paddr, 16, PCI_DMA_FROMDEVICE); |
1da177e4c Linux-2.6.12-rc2 |
3441 3442 |
if (ha->status == S_OK) { |
f842b64e0 [SCSI] gdth: Move... |
3443 3444 3445 |
cmndinfo->status = S_OK; cmndinfo->info = ha->info; if (cmndinfo->OpCode != -1) { |
1da177e4c Linux-2.6.12-rc2 |
3446 3447 |
TRACE2(("gdth_sync_event(): special cmd 0x%x OK ", |
f842b64e0 [SCSI] gdth: Move... |
3448 |
cmndinfo->OpCode)); |
1da177e4c Linux-2.6.12-rc2 |
3449 |
/* special commands GDT_CLUST_INFO/GDT_MOUNT ? */ |
f842b64e0 [SCSI] gdth: Move... |
3450 |
if (cmndinfo->OpCode == GDT_CLUST_INFO) { |
1fe6dbf4d [SCSI] gdth: Conv... |
3451 |
ha->hdr[t].cluster_type = (u8)ha->info; |
1da177e4c Linux-2.6.12-rc2 |
3452 3453 3454 |
if (!(ha->hdr[t].cluster_type & CLUSTER_MOUNTED)) { /* NOT MOUNTED -> MOUNT */ |
f842b64e0 [SCSI] gdth: Move... |
3455 |
cmndinfo->OpCode = GDT_MOUNT; |
1da177e4c Linux-2.6.12-rc2 |
3456 3457 3458 |
if (ha->hdr[t].cluster_type & CLUSTER_RESERVED) { /* cluster drive RESERVED (on the other node) */ |
f842b64e0 [SCSI] gdth: Move... |
3459 |
cmndinfo->phase = -2; /* reservation conflict */ |
1da177e4c Linux-2.6.12-rc2 |
3460 3461 |
} } else { |
f842b64e0 [SCSI] gdth: Move... |
3462 |
cmndinfo->OpCode = -1; |
1da177e4c Linux-2.6.12-rc2 |
3463 3464 |
} } else { |
f842b64e0 [SCSI] gdth: Move... |
3465 |
if (cmndinfo->OpCode == GDT_MOUNT) { |
1da177e4c Linux-2.6.12-rc2 |
3466 3467 |
ha->hdr[t].cluster_type |= CLUSTER_MOUNTED; ha->hdr[t].media_changed = TRUE; |
f842b64e0 [SCSI] gdth: Move... |
3468 |
} else if (cmndinfo->OpCode == GDT_UNMOUNT) { |
1da177e4c Linux-2.6.12-rc2 |
3469 3470 3471 |
ha->hdr[t].cluster_type &= ~CLUSTER_MOUNTED; ha->hdr[t].media_changed = TRUE; } |
f842b64e0 [SCSI] gdth: Move... |
3472 |
cmndinfo->OpCode = -1; |
1da177e4c Linux-2.6.12-rc2 |
3473 3474 |
} /* retry */ |
f842b64e0 [SCSI] gdth: Move... |
3475 |
cmndinfo->priority = HIGH_PRI; |
1da177e4c Linux-2.6.12-rc2 |
3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 |
return 2; } else { /* RESERVE/RELEASE ? */ if (scp->cmnd[0] == RESERVE) { ha->hdr[t].cluster_type |= CLUSTER_RESERVED; } else if (scp->cmnd[0] == RELEASE) { ha->hdr[t].cluster_type &= ~CLUSTER_RESERVED; } scp->result = DID_OK << 16; scp->sense_buffer[0] = 0; } } else { |
f842b64e0 [SCSI] gdth: Move... |
3488 3489 |
cmndinfo->status = ha->status; cmndinfo->info = ha->info; |
1da177e4c Linux-2.6.12-rc2 |
3490 |
|
f842b64e0 [SCSI] gdth: Move... |
3491 |
if (cmndinfo->OpCode != -1) { |
1da177e4c Linux-2.6.12-rc2 |
3492 3493 |
TRACE2(("gdth_sync_event(): special cmd 0x%x error 0x%x ", |
f842b64e0 [SCSI] gdth: Move... |
3494 3495 3496 3497 |
cmndinfo->OpCode, ha->status)); if (cmndinfo->OpCode == GDT_SCAN_START || cmndinfo->OpCode == GDT_SCAN_END) { cmndinfo->OpCode = -1; |
1da177e4c Linux-2.6.12-rc2 |
3498 |
/* retry */ |
f842b64e0 [SCSI] gdth: Move... |
3499 |
cmndinfo->priority = HIGH_PRI; |
1da177e4c Linux-2.6.12-rc2 |
3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 |
return 2; } memset((char*)scp->sense_buffer,0,16); scp->sense_buffer[0] = 0x70; scp->sense_buffer[2] = NOT_READY; scp->result = (DID_OK << 16) | (CHECK_CONDITION << 1); } else if (service == CACHESERVICE) { if (ha->status == S_CACHE_UNKNOWN && (ha->hdr[t].cluster_type & CLUSTER_RESERVE_STATE) == CLUSTER_RESERVE_STATE) { /* bus reset -> force GDT_CLUST_INFO */ ha->hdr[t].cluster_type &= ~CLUSTER_RESERVED; } memset((char*)scp->sense_buffer,0,16); |
1fe6dbf4d [SCSI] gdth: Conv... |
3514 |
if (ha->status == (u16)S_CACHE_RESERV) { |
1da177e4c Linux-2.6.12-rc2 |
3515 3516 3517 3518 3519 3520 |
scp->result = (DID_OK << 16) | (RESERVATION_CONFLICT << 1); } else { scp->sense_buffer[0] = 0x70; scp->sense_buffer[2] = NOT_READY; scp->result = (DID_OK << 16) | (CHECK_CONDITION << 1); } |
3058d5de4 [SCSI] gdth: Setu... |
3521 |
if (!cmndinfo->internal_command) { |
1da177e4c Linux-2.6.12-rc2 |
3522 |
ha->dvr.size = sizeof(ha->dvr.eu.sync); |
45f1a41b2 [SCSI] gdth: clea... |
3523 |
ha->dvr.eu.sync.ionode = ha->hanum; |
1da177e4c Linux-2.6.12-rc2 |
3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 |
ha->dvr.eu.sync.service = service; ha->dvr.eu.sync.status = ha->status; ha->dvr.eu.sync.info = ha->info; ha->dvr.eu.sync.hostdrive = t; if (ha->status >= 0x8000) gdth_store_event(ha, ES_SYNC, 0, &ha->dvr); else gdth_store_event(ha, ES_SYNC, service, &ha->dvr); } } else { /* sense buffer filled from controller firmware (DMA) */ if (ha->status != S_RAW_SCSI || ha->info >= 0x100) { scp->result = DID_BAD_TARGET << 16; } else { scp->result = (DID_OK << 16) | ha->info; } } } |
f842b64e0 [SCSI] gdth: Move... |
3542 3543 |
if (!cmndinfo->wait_for_completion) cmndinfo->wait_for_completion++; |
1da177e4c Linux-2.6.12-rc2 |
3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 |
else return 1; } return 0; } static char *async_cache_tab[] = { /* 0*/ "\011\000\002\002\002\004\002\006\004" "GDT HA %u, service %u, async. status %u/%lu unknown", /* 1*/ "\011\000\002\002\002\004\002\006\004" "GDT HA %u, service %u, async. status %u/%lu unknown", /* 2*/ "\005\000\002\006\004" "GDT HA %u, Host Drive %lu not ready", /* 3*/ "\005\000\002\006\004" "GDT HA %u, Host Drive %lu: REASSIGN not successful and/or data error on reassigned blocks. Drive may crash in the future and should be replaced", /* 4*/ "\005\000\002\006\004" "GDT HA %u, mirror update on Host Drive %lu failed", /* 5*/ "\005\000\002\006\004" "GDT HA %u, Mirror Drive %lu failed", /* 6*/ "\005\000\002\006\004" "GDT HA %u, Mirror Drive %lu: REASSIGN not successful and/or data error on reassigned blocks. Drive may crash in the future and should be replaced", /* 7*/ "\005\000\002\006\004" "GDT HA %u, Host Drive %lu write protected", /* 8*/ "\005\000\002\006\004" "GDT HA %u, media changed in Host Drive %lu", /* 9*/ "\005\000\002\006\004" "GDT HA %u, Host Drive %lu is offline", /*10*/ "\005\000\002\006\004" "GDT HA %u, media change of Mirror Drive %lu", /*11*/ "\005\000\002\006\004" "GDT HA %u, Mirror Drive %lu is write protected", /*12*/ "\005\000\002\006\004" "GDT HA %u, general error on Host Drive %lu. Please check the devices of this drive!", /*13*/ "\007\000\002\006\002\010\002" "GDT HA %u, Array Drive %u: Cache Drive %u failed", /*14*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: FAIL state entered", /*15*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: error", /*16*/ "\007\000\002\006\002\010\002" "GDT HA %u, Array Drive %u: failed drive replaced by Cache Drive %u", /*17*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: parity build failed", /*18*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: drive rebuild failed", /*19*/ "\005\000\002\010\002" "GDT HA %u, Test of Hot Fix %u failed", /*20*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: drive build finished successfully", /*21*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: drive rebuild finished successfully", /*22*/ "\007\000\002\006\002\010\002" "GDT HA %u, Array Drive %u: Hot Fix %u activated", /*23*/ "\005\000\002\006\002" "GDT HA %u, Host Drive %u: processing of i/o aborted due to serious drive error", /*24*/ "\005\000\002\010\002" "GDT HA %u, mirror update on Cache Drive %u completed", /*25*/ "\005\000\002\010\002" "GDT HA %u, mirror update on Cache Drive %lu failed", /*26*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: drive rebuild started", /*27*/ "\005\000\002\012\001" "GDT HA %u, Fault bus %u: SHELF OK detected", /*28*/ "\005\000\002\012\001" "GDT HA %u, Fault bus %u: SHELF not OK detected", /*29*/ "\007\000\002\012\001\013\001" "GDT HA %u, Fault bus %u, ID %u: Auto Hot Plug started", /*30*/ "\007\000\002\012\001\013\001" "GDT HA %u, Fault bus %u, ID %u: new disk detected", /*31*/ "\007\000\002\012\001\013\001" "GDT HA %u, Fault bus %u, ID %u: old disk detected", /*32*/ "\007\000\002\012\001\013\001" "GDT HA %u, Fault bus %u, ID %u: plugging an active disk is invalid", /*33*/ "\007\000\002\012\001\013\001" "GDT HA %u, Fault bus %u, ID %u: invalid device detected", /*34*/ "\011\000\002\012\001\013\001\006\004" "GDT HA %u, Fault bus %u, ID %u: insufficient disk capacity (%lu MB required)", /*35*/ "\007\000\002\012\001\013\001" "GDT HA %u, Fault bus %u, ID %u: disk write protected", /*36*/ "\007\000\002\012\001\013\001" "GDT HA %u, Fault bus %u, ID %u: disk not available", /*37*/ "\007\000\002\012\001\006\004" "GDT HA %u, Fault bus %u: swap detected (%lu)", /*38*/ "\007\000\002\012\001\013\001" "GDT HA %u, Fault bus %u, ID %u: Auto Hot Plug finished successfully", /*39*/ "\007\000\002\012\001\013\001" "GDT HA %u, Fault bus %u, ID %u: Auto Hot Plug aborted due to user Hot Plug", /*40*/ "\007\000\002\012\001\013\001" "GDT HA %u, Fault bus %u, ID %u: Auto Hot Plug aborted", /*41*/ "\007\000\002\012\001\013\001" "GDT HA %u, Fault bus %u, ID %u: Auto Hot Plug for Hot Fix started", /*42*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: drive build started", /*43*/ "\003\000\002" "GDT HA %u, DRAM parity error detected", /*44*/ "\005\000\002\006\002" "GDT HA %u, Mirror Drive %u: update started", /*45*/ "\007\000\002\006\002\010\002" "GDT HA %u, Mirror Drive %u: Hot Fix %u activated", /*46*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: no matching Pool Hot Fix Drive available", /*47*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: Pool Hot Fix Drive available", /*48*/ "\005\000\002\006\002" "GDT HA %u, Mirror Drive %u: no matching Pool Hot Fix Drive available", /*49*/ "\005\000\002\006\002" "GDT HA %u, Mirror Drive %u: Pool Hot Fix Drive available", /*50*/ "\007\000\002\012\001\013\001" "GDT HA %u, SCSI bus %u, ID %u: IGNORE_WIDE_RESIDUE message received", /*51*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: expand started", /*52*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: expand finished successfully", /*53*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: expand failed", /*54*/ "\003\000\002" "GDT HA %u, CPU temperature critical", /*55*/ "\003\000\002" "GDT HA %u, CPU temperature OK", /*56*/ "\005\000\002\006\004" "GDT HA %u, Host drive %lu created", /*57*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: expand restarted", /*58*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: expand stopped", /*59*/ "\005\000\002\010\002" "GDT HA %u, Mirror Drive %u: drive build quited", /*60*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: parity build quited", /*61*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: drive rebuild quited", /*62*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: parity verify started", /*63*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: parity verify done", /*64*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: parity verify failed", /*65*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: parity error detected", /*66*/ "\005\000\002\006\002" "GDT HA %u, Array Drive %u: parity verify quited", /*67*/ "\005\000\002\006\002" "GDT HA %u, Host Drive %u reserved", /*68*/ "\005\000\002\006\002" "GDT HA %u, Host Drive %u mounted and released", /*69*/ "\005\000\002\006\002" "GDT HA %u, Host Drive %u released", /*70*/ "\003\000\002" "GDT HA %u, DRAM error detected and corrected with ECC", /*71*/ "\003\000\002" "GDT HA %u, Uncorrectable DRAM error detected with ECC", /*72*/ "\011\000\002\012\001\013\001\014\001" "GDT HA %u, SCSI bus %u, ID %u, LUN %u: reassigning block", /*73*/ "\005\000\002\006\002" "GDT HA %u, Host drive %u resetted locally", /*74*/ "\005\000\002\006\002" "GDT HA %u, Host drive %u resetted remotely", /*75*/ "\003\000\002" "GDT HA %u, async. status 75 unknown", }; |
45f1a41b2 [SCSI] gdth: clea... |
3705 |
static int gdth_async_event(gdth_ha_str *ha) |
1da177e4c Linux-2.6.12-rc2 |
3706 |
{ |
1da177e4c Linux-2.6.12-rc2 |
3707 3708 |
gdth_cmd_str *cmdp; int cmd_index; |
1da177e4c Linux-2.6.12-rc2 |
3709 3710 3711 |
cmdp= ha->pccb; TRACE2(("gdth_async_event() ha %d serv %d ", |
45f1a41b2 [SCSI] gdth: clea... |
3712 |
ha->hanum, ha->service)); |
1da177e4c Linux-2.6.12-rc2 |
3713 3714 3715 |
if (ha->service == SCREENSERVICE) { if (ha->status == MSG_REQUEST) { |
45f1a41b2 [SCSI] gdth: clea... |
3716 |
while (gdth_test_busy(ha)) |
1da177e4c Linux-2.6.12-rc2 |
3717 3718 3719 |
gdth_delay(0); cmdp->Service = SCREENSERVICE; cmdp->RequestBuffer = SCREEN_CMND; |
45f1a41b2 [SCSI] gdth: clea... |
3720 3721 |
cmd_index = gdth_get_cmd_index(ha); gdth_set_sema0(ha); |
1da177e4c Linux-2.6.12-rc2 |
3722 3723 3724 3725 3726 3727 3728 |
cmdp->OpCode = GDT_READ; cmdp->BoardNode = LOCALBOARD; cmdp->u.screen.reserved = 0; cmdp->u.screen.su.msg.msg_handle= MSG_INV_HANDLE; cmdp->u.screen.su.msg.msg_addr = ha->msg_phys; ha->cmd_offs_dpmem = 0; ha->cmd_len = GDTOFFSOF(gdth_cmd_str,u.screen.su.msg.msg_addr) |
1fe6dbf4d [SCSI] gdth: Conv... |
3729 |
+ sizeof(u64); |
1da177e4c Linux-2.6.12-rc2 |
3730 |
ha->cmd_cnt = 0; |
45f1a41b2 [SCSI] gdth: clea... |
3731 |
gdth_copy_command(ha); |
1da177e4c Linux-2.6.12-rc2 |
3732 |
if (ha->type == GDT_EISA) |
1fe6dbf4d [SCSI] gdth: Conv... |
3733 |
printk("[EISA slot %d] ",(u16)ha->brd_phys); |
1da177e4c Linux-2.6.12-rc2 |
3734 |
else if (ha->type == GDT_ISA) |
1fe6dbf4d [SCSI] gdth: Conv... |
3735 |
printk("[DPMEM 0x%4X] ",(u16)ha->brd_phys); |
1da177e4c Linux-2.6.12-rc2 |
3736 |
else |
1fe6dbf4d [SCSI] gdth: Conv... |
3737 3738 |
printk("[PCI %d/%d] ",(u16)(ha->brd_phys>>8), (u16)((ha->brd_phys>>3)&0x1f)); |
45f1a41b2 [SCSI] gdth: clea... |
3739 |
gdth_release_event(ha); |
1da177e4c Linux-2.6.12-rc2 |
3740 3741 3742 3743 3744 3745 |
} } else { if (ha->type == GDT_PCIMPR && (ha->fw_vers & 0xff) >= 0x1a) { ha->dvr.size = 0; |
45f1a41b2 [SCSI] gdth: clea... |
3746 |
ha->dvr.eu.async.ionode = ha->hanum; |
1da177e4c Linux-2.6.12-rc2 |
3747 3748 3749 3750 |
ha->dvr.eu.async.status = ha->status; /* severity and event_string already set! */ } else { ha->dvr.size = sizeof(ha->dvr.eu.async); |
45f1a41b2 [SCSI] gdth: clea... |
3751 |
ha->dvr.eu.async.ionode = ha->hanum; |
1da177e4c Linux-2.6.12-rc2 |
3752 3753 3754 |
ha->dvr.eu.async.service = ha->service; ha->dvr.eu.async.status = ha->status; ha->dvr.eu.async.info = ha->info; |
1fe6dbf4d [SCSI] gdth: Conv... |
3755 |
*(u32 *)ha->dvr.eu.async.scsi_coord = ha->info2; |
1da177e4c Linux-2.6.12-rc2 |
3756 3757 3758 3759 3760 3761 3762 3763 |
} gdth_store_event( ha, ES_ASYNC, ha->service, &ha->dvr ); gdth_log_event( &ha->dvr, NULL ); /* new host drive from expand? */ if (ha->service == CACHESERVICE && ha->status == 56) { TRACE2(("gdth_async_event(): new host drive %d created ", |
1fe6dbf4d [SCSI] gdth: Conv... |
3764 3765 |
(u16)ha->info)); /* gdth_analyse_hdrive(hanum, (u16)ha->info); */ |
1da177e4c Linux-2.6.12-rc2 |
3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 |
} } return 1; } static void gdth_log_event(gdth_evt_data *dvr, char *buffer) { gdth_stackframe stack; char *f = NULL; int i,j; TRACE2(("gdth_log_event() ")); if (dvr->size == 0) { if (buffer == NULL) { printk("Adapter %d: %s ",dvr->eu.async.ionode,dvr->event_string); } else { sprintf(buffer,"Adapter %d: %s ", dvr->eu.async.ionode,dvr->event_string); } } else if (dvr->eu.async.service == CACHESERVICE && INDEX_OK(dvr->eu.async.status, async_cache_tab)) { TRACE2(("GDT: Async. event cache service, event no.: %d ", dvr->eu.async.status)); f = async_cache_tab[dvr->eu.async.status]; /* i: parameter to push, j: stack element to fill */ for (j=0,i=1; i < f[0]; i+=2) { switch (f[i+1]) { case 4: |
1fe6dbf4d [SCSI] gdth: Conv... |
3800 |
stack.b[j++] = *(u32*)&dvr->eu.stream[(int)f[i]]; |
1da177e4c Linux-2.6.12-rc2 |
3801 3802 |
break; case 2: |
1fe6dbf4d [SCSI] gdth: Conv... |
3803 |
stack.b[j++] = *(u16*)&dvr->eu.stream[(int)f[i]]; |
1da177e4c Linux-2.6.12-rc2 |
3804 3805 |
break; case 1: |
1fe6dbf4d [SCSI] gdth: Conv... |
3806 |
stack.b[j++] = *(u8*)&dvr->eu.stream[(int)f[i]]; |
1da177e4c Linux-2.6.12-rc2 |
3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 |
break; default: break; } } if (buffer == NULL) { printk(&f[(int)f[0]],stack); printk(" "); } else { sprintf(buffer,&f[(int)f[0]],stack); } } else { if (buffer == NULL) { printk("GDT HA %u, Unknown async. event service %d event no. %d ", dvr->eu.async.ionode,dvr->eu.async.service,dvr->eu.async.status); } else { sprintf(buffer,"GDT HA %u, Unknown async. event service %d event no. %d", dvr->eu.async.ionode,dvr->eu.async.service,dvr->eu.async.status); } } } #ifdef GDTH_STATISTICS |
1fe6dbf4d [SCSI] gdth: Conv... |
3834 |
static u8 gdth_timer_running; |
2d6f0d0cd [SCSI] gdth: fix ... |
3835 |
|
1fe6dbf4d [SCSI] gdth: Conv... |
3836 |
static void gdth_timeout(unsigned long data) |
1da177e4c Linux-2.6.12-rc2 |
3837 |
{ |
1fe6dbf4d [SCSI] gdth: Conv... |
3838 |
u32 i; |
1da177e4c Linux-2.6.12-rc2 |
3839 3840 |
Scsi_Cmnd *nscp; gdth_ha_str *ha; |
1fe6dbf4d [SCSI] gdth: Conv... |
3841 |
unsigned long flags; |
1da177e4c Linux-2.6.12-rc2 |
3842 |
|
2d6f0d0cd [SCSI] gdth: fix ... |
3843 3844 3845 3846 |
if(unlikely(list_empty(&gdth_instances))) { gdth_timer_running = 0; return; } |
b31ddd31c [SCSI] gdth: bugf... |
3847 |
|
884f7fba0 [SCSI] gdth: Remo... |
3848 |
ha = list_first_entry(&gdth_instances, gdth_ha_str, list); |
1da177e4c Linux-2.6.12-rc2 |
3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 |
spin_lock_irqsave(&ha->smp_lock, flags); for (act_stats=0,i=0; i<GDTH_MAXCMDS; ++i) if (ha->cmd_tab[i].cmnd != UNUSED_CMND) ++act_stats; for (act_rq=0,nscp=ha->req_first; nscp; nscp=(Scsi_Cmnd*)nscp->SCp.ptr) ++act_rq; TRACE2(("gdth_to(): ints %d, ios %d, act_stats %d, act_rq %d ", act_ints, act_ios, act_stats, act_rq)); act_ints = act_ios = 0; gdth_timer.expires = jiffies + 30 * HZ; add_timer(&gdth_timer); spin_unlock_irqrestore(&ha->smp_lock, flags); } |
2d6f0d0cd [SCSI] gdth: fix ... |
3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 |
static void gdth_timer_init(void) { if (gdth_timer_running) return; gdth_timer_running = 1; TRACE2(("gdth_detect(): Initializing timer ! ")); gdth_timer.expires = jiffies + HZ; gdth_timer.data = 0L; gdth_timer.function = gdth_timeout; add_timer(&gdth_timer); } #else static inline void gdth_timer_init(void) { } |
1da177e4c Linux-2.6.12-rc2 |
3884 |
#endif |
8e8790415 [PATCH] drivers/s... |
3885 |
static void __init internal_setup(char *str,int *ints) |
1da177e4c Linux-2.6.12-rc2 |
3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 |
{ int i, argc; char *cur_str, *argv; TRACE2(("internal_setup() str %s ints[0] %d ", str ? str:"NULL", ints ? ints[0]:0)); /* read irq[] from ints[] */ if (ints) { argc = ints[0]; if (argc > 0) { if (argc > MAXHA) argc = MAXHA; for (i = 0; i < argc; ++i) irq[i] = ints[i+1]; } } /* analyse string */ argv = str; while (argv && (cur_str = strchr(argv, ':'))) { int val = 0, c = *++cur_str; if (c == 'n' || c == 'N') val = 0; else if (c == 'y' || c == 'Y') val = 1; else val = (int)simple_strtoul(cur_str, NULL, 0); if (!strncmp(argv, "disable:", 8)) disable = val; else if (!strncmp(argv, "reserve_mode:", 13)) reserve_mode = val; else if (!strncmp(argv, "reverse_scan:", 13)) reverse_scan = val; else if (!strncmp(argv, "hdr_channel:", 12)) hdr_channel = val; else if (!strncmp(argv, "max_ids:", 8)) max_ids = val; else if (!strncmp(argv, "rescan:", 7)) rescan = val; |
1da177e4c Linux-2.6.12-rc2 |
3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 |
else if (!strncmp(argv, "shared_access:", 14)) shared_access = val; else if (!strncmp(argv, "probe_eisa_isa:", 15)) probe_eisa_isa = val; else if (!strncmp(argv, "reserve_list:", 13)) { reserve_list[0] = val; for (i = 1; i < MAX_RES_ARGS; i++) { cur_str = strchr(cur_str, ','); if (!cur_str) break; if (!isdigit((int)*++cur_str)) { --cur_str; break; } reserve_list[i] = (int)simple_strtoul(cur_str, NULL, 0); } if (!cur_str) break; argv = ++cur_str; continue; } if ((argv = strchr(argv, ','))) ++argv; } } int __init option_setup(char *str) { int ints[MAXHA]; char *cur = str; int i = 1; TRACE2(("option_setup() str %s ", str ? str:"NULL")); |
6ce00cae6 [SCSI] gdth: fix ... |
3965 |
while (cur && isdigit(*cur) && i < MAXHA) { |
1da177e4c Linux-2.6.12-rc2 |
3966 3967 3968 3969 3970 3971 3972 3973 |
ints[i++] = simple_strtoul(cur, NULL, 0); if ((cur = strchr(cur, ',')) != NULL) cur++; } ints[0] = i - 1; internal_setup(cur, ints); return 1; } |
45f1a41b2 [SCSI] gdth: clea... |
3974 |
static const char *gdth_ctr_name(gdth_ha_str *ha) |
1da177e4c Linux-2.6.12-rc2 |
3975 |
{ |
1da177e4c Linux-2.6.12-rc2 |
3976 3977 |
TRACE2(("gdth_ctr_name() ")); |
1da177e4c Linux-2.6.12-rc2 |
3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 |
if (ha->type == GDT_EISA) { switch (ha->stype) { case GDT3_ID: return("GDT3000/3020"); case GDT3A_ID: return("GDT3000A/3020A/3050A"); case GDT3B_ID: return("GDT3000B/3010A"); } } else if (ha->type == GDT_ISA) { return("GDT2000/2020"); } else if (ha->type == GDT_PCI) { |
8e9a8a0d5 [SCSI] gdth: remo... |
3990 |
switch (ha->pdev->device) { |
1da177e4c Linux-2.6.12-rc2 |
3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 |
case PCI_DEVICE_ID_VORTEX_GDT60x0: return("GDT6000/6020/6050"); case PCI_DEVICE_ID_VORTEX_GDT6000B: return("GDT6000B/6010"); } } /* new controllers (GDT_PCINEW, GDT_PCIMPR, ..) use board_info IOCTL! */ return(""); } |
8e8790415 [PATCH] drivers/s... |
4001 |
static const char *gdth_info(struct Scsi_Host *shp) |
1da177e4c Linux-2.6.12-rc2 |
4002 |
{ |
45f1a41b2 [SCSI] gdth: clea... |
4003 |
gdth_ha_str *ha = shost_priv(shp); |
1da177e4c Linux-2.6.12-rc2 |
4004 4005 4006 |
TRACE2(("gdth_info() ")); |
1da177e4c Linux-2.6.12-rc2 |
4007 4008 |
return ((const char *)ha->binfo.type_string); } |
242f9dcb8 block: unify requ... |
4009 4010 4011 4012 |
static enum blk_eh_timer_return gdth_timed_out(struct scsi_cmnd *scp) { gdth_ha_str *ha = shost_priv(scp->device->host); struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp); |
1fe6dbf4d [SCSI] gdth: Conv... |
4013 4014 |
u8 b, t; unsigned long flags; |
242f9dcb8 block: unify requ... |
4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 |
enum blk_eh_timer_return retval = BLK_EH_NOT_HANDLED; TRACE(("%s() cmd 0x%x ", scp->cmnd[0], __func__)); b = scp->device->channel; t = scp->device->id; /* * We don't really honor the command timeout, but we try to * honor 6 times of the actual command timeout! So reset the * timer if this is less than 6th timeout on this command! */ if (++cmndinfo->timeout_count < 6) retval = BLK_EH_RESET_TIMER; /* Reset the timeout if it is locked IO */ spin_lock_irqsave(&ha->smp_lock, flags); if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha, b)].lock) || (b == ha->virt_bus && t < MAX_HDRIVES && ha->hdr[t].lock)) { TRACE2(("%s(): locked IO, reset timeout ", __func__)); retval = BLK_EH_RESET_TIMER; } spin_unlock_irqrestore(&ha->smp_lock, flags); return retval; } |
8e8790415 [PATCH] drivers/s... |
4042 |
static int gdth_eh_bus_reset(Scsi_Cmnd *scp) |
1da177e4c Linux-2.6.12-rc2 |
4043 |
{ |
45f1a41b2 [SCSI] gdth: clea... |
4044 4045 |
gdth_ha_str *ha = shost_priv(scp->device->host); int i; |
1fe6dbf4d [SCSI] gdth: Conv... |
4046 |
unsigned long flags; |
1da177e4c Linux-2.6.12-rc2 |
4047 |
Scsi_Cmnd *cmnd; |
1fe6dbf4d [SCSI] gdth: Conv... |
4048 |
u8 b; |
1da177e4c Linux-2.6.12-rc2 |
4049 4050 4051 |
TRACE2(("gdth_eh_bus_reset() ")); |
52759e6ab [SCSI] gdth: Remo... |
4052 |
b = scp->device->channel; |
1da177e4c Linux-2.6.12-rc2 |
4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 |
/* clear command tab */ spin_lock_irqsave(&ha->smp_lock, flags); for (i = 0; i < GDTH_MAXCMDS; ++i) { cmnd = ha->cmd_tab[i].cmnd; if (!SPECIAL_SCP(cmnd) && cmnd->device->channel == b) ha->cmd_tab[i].cmnd = UNUSED_CMND; } spin_unlock_irqrestore(&ha->smp_lock, flags); if (b == ha->virt_bus) { /* host drives */ for (i = 0; i < MAX_HDRIVES; ++i) { if (ha->hdr[i].present) { spin_lock_irqsave(&ha->smp_lock, flags); gdth_polling = TRUE; |
45f1a41b2 [SCSI] gdth: clea... |
4069 |
while (gdth_test_busy(ha)) |
1da177e4c Linux-2.6.12-rc2 |
4070 |
gdth_delay(0); |
45f1a41b2 [SCSI] gdth: clea... |
4071 |
if (gdth_internal_cmd(ha, CACHESERVICE, |
1da177e4c Linux-2.6.12-rc2 |
4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 |
GDT_CLUST_RESET, i, 0, 0)) ha->hdr[i].cluster_type &= ~CLUSTER_RESERVED; gdth_polling = FALSE; spin_unlock_irqrestore(&ha->smp_lock, flags); } } } else { /* raw devices */ spin_lock_irqsave(&ha->smp_lock, flags); for (i = 0; i < MAXID; ++i) ha->raw[BUS_L2P(ha,b)].io_cnt[i] = 0; gdth_polling = TRUE; |
45f1a41b2 [SCSI] gdth: clea... |
4084 |
while (gdth_test_busy(ha)) |
1da177e4c Linux-2.6.12-rc2 |
4085 |
gdth_delay(0); |
45f1a41b2 [SCSI] gdth: clea... |
4086 |
gdth_internal_cmd(ha, SCSIRAWSERVICE, GDT_RESET_BUS, |
1da177e4c Linux-2.6.12-rc2 |
4087 4088 |
BUS_L2P(ha,b), 0, 0); gdth_polling = FALSE; |
cbd5f69b9 [SCSI] remove the... |
4089 |
spin_unlock_irqrestore(&ha->smp_lock, flags); |
1da177e4c Linux-2.6.12-rc2 |
4090 4091 4092 |
} return SUCCESS; } |
8e8790415 [PATCH] drivers/s... |
4093 |
static int gdth_bios_param(struct scsi_device *sdev,struct block_device *bdev,sector_t cap,int *ip) |
1da177e4c Linux-2.6.12-rc2 |
4094 |
{ |
1fe6dbf4d [SCSI] gdth: Conv... |
4095 |
u8 b, t; |
45f1a41b2 [SCSI] gdth: clea... |
4096 |
gdth_ha_str *ha = shost_priv(sdev->host); |
1da177e4c Linux-2.6.12-rc2 |
4097 4098 |
struct scsi_device *sd; unsigned capacity; |
1da177e4c Linux-2.6.12-rc2 |
4099 4100 |
sd = sdev; capacity = cap; |
52759e6ab [SCSI] gdth: Remo... |
4101 |
b = sd->channel; |
1da177e4c Linux-2.6.12-rc2 |
4102 |
t = sd->id; |
45f1a41b2 [SCSI] gdth: clea... |
4103 4104 |
TRACE2(("gdth_bios_param() ha %d bus %d target %d ", ha->hanum, b, t)); |
1da177e4c Linux-2.6.12-rc2 |
4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 |
if (b != ha->virt_bus || ha->hdr[t].heads == 0) { /* raw device or host drive without mapping information */ TRACE2(("Evaluate mapping ")); gdth_eval_mapping(capacity,&ip[2],&ip[0],&ip[1]); } else { ip[0] = ha->hdr[t].heads; ip[1] = ha->hdr[t].secs; ip[2] = capacity / ip[0] / ip[1]; } TRACE2(("gdth_bios_param(): %d heads, %d secs, %d cyls ", ip[0],ip[1],ip[2])); return 0; } |
f281233d3 SCSI host lock pu... |
4122 |
static int gdth_queuecommand_lck(struct scsi_cmnd *scp, |
b8bff2aea gdth: Make one ab... |
4123 |
void (*done)(struct scsi_cmnd *)) |
1da177e4c Linux-2.6.12-rc2 |
4124 |
{ |
45f1a41b2 [SCSI] gdth: clea... |
4125 |
gdth_ha_str *ha = shost_priv(scp->device->host); |
3058d5de4 [SCSI] gdth: Setu... |
4126 |
struct gdth_cmndinfo *cmndinfo; |
1da177e4c Linux-2.6.12-rc2 |
4127 4128 4129 |
TRACE(("gdth_queuecommand() cmd 0x%x ", scp->cmnd[0])); |
3058d5de4 [SCSI] gdth: Setu... |
4130 4131 4132 |
cmndinfo = gdth_get_cmndinfo(ha); BUG_ON(!cmndinfo); |
b8bff2aea gdth: Make one ab... |
4133 |
scp->scsi_done = done; |
242f9dcb8 block: unify requ... |
4134 |
cmndinfo->timeout_count = 0; |
f842b64e0 [SCSI] gdth: Move... |
4135 |
cmndinfo->priority = DEFAULT_PRI; |
3892d88ae [SCSI] gdth: !use... |
4136 |
|
3058d5de4 [SCSI] gdth: Setu... |
4137 4138 |
return __gdth_queuecommand(ha, scp, cmndinfo); } |
f281233d3 SCSI host lock pu... |
4139 |
static DEF_SCSI_QCMD(gdth_queuecommand) |
3058d5de4 [SCSI] gdth: Setu... |
4140 4141 4142 4143 |
static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp, struct gdth_cmndinfo *cmndinfo) { scp->host_scribble = (unsigned char *)cmndinfo; |
f842b64e0 [SCSI] gdth: Move... |
4144 4145 4146 |
cmndinfo->wait_for_completion = 1; cmndinfo->phase = -1; cmndinfo->OpCode = -1; |
1da177e4c Linux-2.6.12-rc2 |
4147 |
|
1da177e4c Linux-2.6.12-rc2 |
4148 4149 4150 |
#ifdef GDTH_STATISTICS ++act_ios; #endif |
f842b64e0 [SCSI] gdth: Move... |
4151 |
gdth_putq(ha, scp, cmndinfo->priority); |
45f1a41b2 [SCSI] gdth: clea... |
4152 |
gdth_next(ha); |
1da177e4c Linux-2.6.12-rc2 |
4153 4154 4155 4156 4157 4158 4159 |
return 0; } static int gdth_open(struct inode *inode, struct file *filep) { gdth_ha_str *ha; |
1da177e4c Linux-2.6.12-rc2 |
4160 |
|
c45d15d24 scsi: autoconvert... |
4161 |
mutex_lock(&gdth_mutex); |
884f7fba0 [SCSI] gdth: Remo... |
4162 |
list_for_each_entry(ha, &gdth_instances, list) { |
1da177e4c Linux-2.6.12-rc2 |
4163 |
if (!ha->sdev) |
884f7fba0 [SCSI] gdth: Remo... |
4164 |
ha->sdev = scsi_get_host_dev(ha->shost); |
1da177e4c Linux-2.6.12-rc2 |
4165 |
} |
c45d15d24 scsi: autoconvert... |
4166 |
mutex_unlock(&gdth_mutex); |
1da177e4c Linux-2.6.12-rc2 |
4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 |
TRACE(("gdth_open() ")); return 0; } static int gdth_close(struct inode *inode, struct file *filep) { TRACE(("gdth_close() ")); return 0; } static int ioc_event(void __user *arg) { gdth_ioctl_event evt; gdth_ha_str *ha; |
1fe6dbf4d [SCSI] gdth: Conv... |
4184 |
unsigned long flags; |
1da177e4c Linux-2.6.12-rc2 |
4185 |
|
884f7fba0 [SCSI] gdth: Remo... |
4186 4187 4188 4189 |
if (copy_from_user(&evt, arg, sizeof(gdth_ioctl_event))) return -EFAULT; ha = gdth_find_ha(evt.ionode); if (!ha) |
1da177e4c Linux-2.6.12-rc2 |
4190 |
return -EFAULT; |
1da177e4c Linux-2.6.12-rc2 |
4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 |
if (evt.erase == 0xff) { if (evt.event.event_source == ES_TEST) evt.event.event_data.size=sizeof(evt.event.event_data.eu.test); else if (evt.event.event_source == ES_DRIVER) evt.event.event_data.size=sizeof(evt.event.event_data.eu.driver); else if (evt.event.event_source == ES_SYNC) evt.event.event_data.size=sizeof(evt.event.event_data.eu.sync); else evt.event.event_data.size=sizeof(evt.event.event_data.eu.async); spin_lock_irqsave(&ha->smp_lock, flags); gdth_store_event(ha, evt.event.event_source, evt.event.event_idx, &evt.event.event_data); spin_unlock_irqrestore(&ha->smp_lock, flags); } else if (evt.erase == 0xfe) { gdth_clear_events(); } else if (evt.erase == 0) { evt.handle = gdth_read_event(ha, evt.handle, &evt.event); } else { gdth_readapp_event(ha, evt.erase, &evt.event); } if (copy_to_user(arg, &evt, sizeof(gdth_ioctl_event))) return -EFAULT; return 0; } static int ioc_lockdrv(void __user *arg) { gdth_ioctl_lockdrv ldrv; |
1fe6dbf4d [SCSI] gdth: Conv... |
4220 4221 |
u8 i, j; unsigned long flags; |
1da177e4c Linux-2.6.12-rc2 |
4222 |
gdth_ha_str *ha; |
884f7fba0 [SCSI] gdth: Remo... |
4223 |
if (copy_from_user(&ldrv, arg, sizeof(gdth_ioctl_lockdrv))) |
1da177e4c Linux-2.6.12-rc2 |
4224 |
return -EFAULT; |
884f7fba0 [SCSI] gdth: Remo... |
4225 4226 4227 |
ha = gdth_find_ha(ldrv.ionode); if (!ha) return -EFAULT; |
1da177e4c Linux-2.6.12-rc2 |
4228 4229 4230 4231 4232 4233 4234 4235 |
for (i = 0; i < ldrv.drive_cnt && i < MAX_HDRIVES; ++i) { j = ldrv.drives[i]; if (j >= MAX_HDRIVES || !ha->hdr[j].present) continue; if (ldrv.lock) { spin_lock_irqsave(&ha->smp_lock, flags); ha->hdr[j].lock = 1; spin_unlock_irqrestore(&ha->smp_lock, flags); |
45f1a41b2 [SCSI] gdth: clea... |
4236 |
gdth_wait_completion(ha, ha->bus_cnt, j); |
1da177e4c Linux-2.6.12-rc2 |
4237 4238 4239 4240 |
} else { spin_lock_irqsave(&ha->smp_lock, flags); ha->hdr[j].lock = 0; spin_unlock_irqrestore(&ha->smp_lock, flags); |
45f1a41b2 [SCSI] gdth: clea... |
4241 |
gdth_next(ha); |
1da177e4c Linux-2.6.12-rc2 |
4242 4243 4244 4245 4246 4247 4248 4249 4250 |
} } return 0; } static int ioc_resetdrv(void __user *arg, char *cmnd) { gdth_ioctl_reset res; gdth_cmd_str cmd; |
1da177e4c Linux-2.6.12-rc2 |
4251 |
gdth_ha_str *ha; |
cbd5f69b9 [SCSI] remove the... |
4252 |
int rval; |
1da177e4c Linux-2.6.12-rc2 |
4253 4254 |
if (copy_from_user(&res, arg, sizeof(gdth_ioctl_reset)) || |
884f7fba0 [SCSI] gdth: Remo... |
4255 4256 4257 4258 |
res.number >= MAX_HDRIVES) return -EFAULT; ha = gdth_find_ha(res.ionode); if (!ha) |
1da177e4c Linux-2.6.12-rc2 |
4259 |
return -EFAULT; |
45f1a41b2 [SCSI] gdth: clea... |
4260 |
|
1da177e4c Linux-2.6.12-rc2 |
4261 4262 4263 4264 4265 4266 4267 4268 4269 |
if (!ha->hdr[res.number].present) return 0; memset(&cmd, 0, sizeof(gdth_cmd_str)); cmd.Service = CACHESERVICE; cmd.OpCode = GDT_CLUST_RESET; if (ha->cache_feat & GDT_64BIT) cmd.u.cache64.DeviceNo = res.number; else cmd.u.cache.DeviceNo = res.number; |
cbd5f69b9 [SCSI] remove the... |
4270 4271 4272 4273 4274 |
rval = __gdth_execute(ha->sdev, &cmd, cmnd, 30, NULL); if (rval < 0) return rval; res.status = rval; |
1da177e4c Linux-2.6.12-rc2 |
4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 |
if (copy_to_user(arg, &res, sizeof(gdth_ioctl_reset))) return -EFAULT; return 0; } static int ioc_general(void __user *arg, char *cmnd) { gdth_ioctl_general gen; char *buf = NULL; |
1fe6dbf4d [SCSI] gdth: Conv... |
4285 |
u64 paddr; |
cbd5f69b9 [SCSI] remove the... |
4286 4287 |
gdth_ha_str *ha; int rval; |
884f7fba0 [SCSI] gdth: Remo... |
4288 4289 4290 4291 4292 |
if (copy_from_user(&gen, arg, sizeof(gdth_ioctl_general))) return -EFAULT; ha = gdth_find_ha(gen.ionode); if (!ha) |
1da177e4c Linux-2.6.12-rc2 |
4293 |
return -EFAULT; |
f63ae56e4 [SCSI] gdth: inte... |
4294 4295 4296 4297 4298 4299 4300 |
if (gen.data_len > INT_MAX) return -EINVAL; if (gen.sense_len > INT_MAX) return -EINVAL; if (gen.data_len + gen.sense_len > INT_MAX) return -EINVAL; |
1da177e4c Linux-2.6.12-rc2 |
4301 |
if (gen.data_len + gen.sense_len != 0) { |
45f1a41b2 [SCSI] gdth: clea... |
4302 |
if (!(buf = gdth_ioctl_alloc(ha, gen.data_len + gen.sense_len, |
1da177e4c Linux-2.6.12-rc2 |
4303 4304 4305 4306 |
FALSE, &paddr))) return -EFAULT; if (copy_from_user(buf, arg + sizeof(gdth_ioctl_general), gen.data_len + gen.sense_len)) { |
45f1a41b2 [SCSI] gdth: clea... |
4307 |
gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); |
1da177e4c Linux-2.6.12-rc2 |
4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 |
return -EFAULT; } if (gen.command.OpCode == GDT_IOCTL) { gen.command.u.ioctl.p_param = paddr; } else if (gen.command.Service == CACHESERVICE) { if (ha->cache_feat & GDT_64BIT) { /* copy elements from 32-bit IOCTL structure */ gen.command.u.cache64.BlockCnt = gen.command.u.cache.BlockCnt; gen.command.u.cache64.BlockNo = gen.command.u.cache.BlockNo; gen.command.u.cache64.DeviceNo = gen.command.u.cache.DeviceNo; /* addresses */ if (ha->cache_feat & SCATTER_GATHER) { |
1fe6dbf4d [SCSI] gdth: Conv... |
4321 |
gen.command.u.cache64.DestAddr = (u64)-1; |
1da177e4c Linux-2.6.12-rc2 |
4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 |
gen.command.u.cache64.sg_canz = 1; gen.command.u.cache64.sg_lst[0].sg_ptr = paddr; gen.command.u.cache64.sg_lst[0].sg_len = gen.data_len; gen.command.u.cache64.sg_lst[1].sg_len = 0; } else { gen.command.u.cache64.DestAddr = paddr; gen.command.u.cache64.sg_canz = 0; } } else { if (ha->cache_feat & SCATTER_GATHER) { gen.command.u.cache.DestAddr = 0xffffffff; gen.command.u.cache.sg_canz = 1; |
1fe6dbf4d [SCSI] gdth: Conv... |
4334 |
gen.command.u.cache.sg_lst[0].sg_ptr = (u32)paddr; |
1da177e4c Linux-2.6.12-rc2 |
4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 |
gen.command.u.cache.sg_lst[0].sg_len = gen.data_len; gen.command.u.cache.sg_lst[1].sg_len = 0; } else { gen.command.u.cache.DestAddr = paddr; gen.command.u.cache.sg_canz = 0; } } } else if (gen.command.Service == SCSIRAWSERVICE) { if (ha->raw_feat & GDT_64BIT) { /* copy elements from 32-bit IOCTL structure */ char cmd[16]; gen.command.u.raw64.sense_len = gen.command.u.raw.sense_len; gen.command.u.raw64.bus = gen.command.u.raw.bus; gen.command.u.raw64.lun = gen.command.u.raw.lun; gen.command.u.raw64.target = gen.command.u.raw.target; memcpy(cmd, gen.command.u.raw.cmd, 16); memcpy(gen.command.u.raw64.cmd, cmd, 16); gen.command.u.raw64.clen = gen.command.u.raw.clen; gen.command.u.raw64.sdlen = gen.command.u.raw.sdlen; gen.command.u.raw64.direction = gen.command.u.raw.direction; /* addresses */ if (ha->raw_feat & SCATTER_GATHER) { |
1fe6dbf4d [SCSI] gdth: Conv... |
4357 |
gen.command.u.raw64.sdata = (u64)-1; |
1da177e4c Linux-2.6.12-rc2 |
4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 |
gen.command.u.raw64.sg_ranz = 1; gen.command.u.raw64.sg_lst[0].sg_ptr = paddr; gen.command.u.raw64.sg_lst[0].sg_len = gen.data_len; gen.command.u.raw64.sg_lst[1].sg_len = 0; } else { gen.command.u.raw64.sdata = paddr; gen.command.u.raw64.sg_ranz = 0; } gen.command.u.raw64.sense_data = paddr + gen.data_len; } else { if (ha->raw_feat & SCATTER_GATHER) { gen.command.u.raw.sdata = 0xffffffff; gen.command.u.raw.sg_ranz = 1; |
1fe6dbf4d [SCSI] gdth: Conv... |
4371 |
gen.command.u.raw.sg_lst[0].sg_ptr = (u32)paddr; |
1da177e4c Linux-2.6.12-rc2 |
4372 4373 4374 4375 4376 4377 |
gen.command.u.raw.sg_lst[0].sg_len = gen.data_len; gen.command.u.raw.sg_lst[1].sg_len = 0; } else { gen.command.u.raw.sdata = paddr; gen.command.u.raw.sg_ranz = 0; } |
1fe6dbf4d [SCSI] gdth: Conv... |
4378 |
gen.command.u.raw.sense_data = (u32)paddr + gen.data_len; |
1da177e4c Linux-2.6.12-rc2 |
4379 4380 |
} } else { |
45f1a41b2 [SCSI] gdth: clea... |
4381 |
gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); |
1da177e4c Linux-2.6.12-rc2 |
4382 4383 4384 |
return -EFAULT; } } |
cbd5f69b9 [SCSI] remove the... |
4385 |
rval = __gdth_execute(ha->sdev, &gen.command, cmnd, gen.timeout, &gen.info); |
5c1000756 [SCSI] gdth: Add ... |
4386 4387 |
if (rval < 0) { gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); |
cbd5f69b9 [SCSI] remove the... |
4388 |
return rval; |
5c1000756 [SCSI] gdth: Add ... |
4389 |
} |
cbd5f69b9 [SCSI] remove the... |
4390 |
gen.status = rval; |
1da177e4c Linux-2.6.12-rc2 |
4391 4392 4393 |
if (copy_to_user(arg + sizeof(gdth_ioctl_general), buf, gen.data_len + gen.sense_len)) { |
45f1a41b2 [SCSI] gdth: clea... |
4394 |
gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); |
1da177e4c Linux-2.6.12-rc2 |
4395 4396 4397 4398 |
return -EFAULT; } if (copy_to_user(arg, &gen, sizeof(gdth_ioctl_general) - sizeof(gdth_cmd_str))) { |
45f1a41b2 [SCSI] gdth: clea... |
4399 |
gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); |
1da177e4c Linux-2.6.12-rc2 |
4400 4401 |
return -EFAULT; } |
45f1a41b2 [SCSI] gdth: clea... |
4402 |
gdth_ioctl_free(ha, gen.data_len+gen.sense_len, buf, paddr); |
1da177e4c Linux-2.6.12-rc2 |
4403 4404 4405 4406 4407 4408 4409 4410 |
return 0; } static int ioc_hdrlist(void __user *arg, char *cmnd) { gdth_ioctl_rescan *rsc; gdth_cmd_str *cmd; gdth_ha_str *ha; |
1fe6dbf4d [SCSI] gdth: Conv... |
4411 |
u8 i; |
45f1a41b2 [SCSI] gdth: clea... |
4412 |
int rc = -ENOMEM; |
cbd5f69b9 [SCSI] remove the... |
4413 |
u32 cluster_type = 0; |
1da177e4c Linux-2.6.12-rc2 |
4414 4415 4416 |
rsc = kmalloc(sizeof(*rsc), GFP_KERNEL); cmd = kmalloc(sizeof(*cmd), GFP_KERNEL); if (!rsc || !cmd) |
cbd5f69b9 [SCSI] remove the... |
4417 |
goto free_fail; |
1da177e4c Linux-2.6.12-rc2 |
4418 4419 |
if (copy_from_user(rsc, arg, sizeof(gdth_ioctl_rescan)) || |
884f7fba0 [SCSI] gdth: Remo... |
4420 |
(NULL == (ha = gdth_find_ha(rsc->ionode)))) { |
1da177e4c Linux-2.6.12-rc2 |
4421 |
rc = -EFAULT; |
cbd5f69b9 [SCSI] remove the... |
4422 |
goto free_fail; |
1da177e4c Linux-2.6.12-rc2 |
4423 |
} |
1da177e4c Linux-2.6.12-rc2 |
4424 4425 |
memset(cmd, 0, sizeof(gdth_cmd_str)); |
1da177e4c Linux-2.6.12-rc2 |
4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 |
for (i = 0; i < MAX_HDRIVES; ++i) { if (!ha->hdr[i].present) { rsc->hdr_list[i].bus = 0xff; continue; } rsc->hdr_list[i].bus = ha->virt_bus; rsc->hdr_list[i].target = i; rsc->hdr_list[i].lun = 0; rsc->hdr_list[i].cluster_type = ha->hdr[i].cluster_type; if (ha->hdr[i].cluster_type & CLUSTER_DRIVE) { cmd->Service = CACHESERVICE; cmd->OpCode = GDT_CLUST_INFO; if (ha->cache_feat & GDT_64BIT) cmd->u.cache64.DeviceNo = i; else cmd->u.cache.DeviceNo = i; |
cbd5f69b9 [SCSI] remove the... |
4442 4443 |
if (__gdth_execute(ha->sdev, cmd, cmnd, 30, &cluster_type) == S_OK) rsc->hdr_list[i].cluster_type = cluster_type; |
1da177e4c Linux-2.6.12-rc2 |
4444 4445 |
} } |
cbd5f69b9 [SCSI] remove the... |
4446 |
|
1da177e4c Linux-2.6.12-rc2 |
4447 4448 4449 |
if (copy_to_user(arg, rsc, sizeof(gdth_ioctl_rescan))) rc = -EFAULT; else |
cbd5f69b9 [SCSI] remove the... |
4450 |
rc = 0; |
1da177e4c Linux-2.6.12-rc2 |
4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 |
free_fail: kfree(rsc); kfree(cmd); return rc; } static int ioc_rescan(void __user *arg, char *cmnd) { gdth_ioctl_rescan *rsc; gdth_cmd_str *cmd; |
1fe6dbf4d [SCSI] gdth: Conv... |
4462 4463 |
u16 i, status, hdr_cnt; u32 info; |
45f1a41b2 [SCSI] gdth: clea... |
4464 |
int cyls, hds, secs; |
1da177e4c Linux-2.6.12-rc2 |
4465 |
int rc = -ENOMEM; |
1fe6dbf4d [SCSI] gdth: Conv... |
4466 |
unsigned long flags; |
1da177e4c Linux-2.6.12-rc2 |
4467 |
gdth_ha_str *ha; |
1da177e4c Linux-2.6.12-rc2 |
4468 4469 4470 4471 |
rsc = kmalloc(sizeof(*rsc), GFP_KERNEL); cmd = kmalloc(sizeof(*cmd), GFP_KERNEL); if (!cmd || !rsc) |
cbd5f69b9 [SCSI] remove the... |
4472 |
goto free_fail; |
1da177e4c Linux-2.6.12-rc2 |
4473 4474 |
if (copy_from_user(rsc, arg, sizeof(gdth_ioctl_rescan)) || |
884f7fba0 [SCSI] gdth: Remo... |
4475 |
(NULL == (ha = gdth_find_ha(rsc->ionode)))) { |
cbd5f69b9 [SCSI] remove the... |
4476 4477 |
rc = -EFAULT; goto free_fail; |
1da177e4c Linux-2.6.12-rc2 |
4478 |
} |
1da177e4c Linux-2.6.12-rc2 |
4479 |
memset(cmd, 0, sizeof(gdth_cmd_str)); |
1da177e4c Linux-2.6.12-rc2 |
4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 |
if (rsc->flag == 0) { /* old method: re-init. cache service */ cmd->Service = CACHESERVICE; if (ha->cache_feat & GDT_64BIT) { cmd->OpCode = GDT_X_INIT_HOST; cmd->u.cache64.DeviceNo = LINUX_OS; } else { cmd->OpCode = GDT_INIT; cmd->u.cache.DeviceNo = LINUX_OS; } |
cbd5f69b9 [SCSI] remove the... |
4490 4491 |
status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); |
1da177e4c Linux-2.6.12-rc2 |
4492 |
i = 0; |
1fe6dbf4d [SCSI] gdth: Conv... |
4493 |
hdr_cnt = (status == S_OK ? (u16)info : 0); |
1da177e4c Linux-2.6.12-rc2 |
4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 |
} else { i = rsc->hdr_no; hdr_cnt = i + 1; } for (; i < hdr_cnt && i < MAX_HDRIVES; ++i) { cmd->Service = CACHESERVICE; cmd->OpCode = GDT_INFO; if (ha->cache_feat & GDT_64BIT) cmd->u.cache64.DeviceNo = i; else cmd->u.cache.DeviceNo = i; |
cbd5f69b9 [SCSI] remove the... |
4506 4507 |
status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); |
1da177e4c Linux-2.6.12-rc2 |
4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 |
spin_lock_irqsave(&ha->smp_lock, flags); rsc->hdr_list[i].bus = ha->virt_bus; rsc->hdr_list[i].target = i; rsc->hdr_list[i].lun = 0; if (status != S_OK) { ha->hdr[i].present = FALSE; } else { ha->hdr[i].present = TRUE; ha->hdr[i].size = info; /* evaluate mapping */ ha->hdr[i].size &= ~SECS32; gdth_eval_mapping(ha->hdr[i].size,&cyls,&hds,&secs); ha->hdr[i].heads = hds; ha->hdr[i].secs = secs; /* round size */ ha->hdr[i].size = cyls * hds * secs; } spin_unlock_irqrestore(&ha->smp_lock, flags); if (status != S_OK) continue; /* extended info, if GDT_64BIT, for drives > 2 TB */ /* but we need ha->info2, not yet stored in scp->SCp */ /* devtype, cluster info, R/W attribs */ cmd->Service = CACHESERVICE; cmd->OpCode = GDT_DEVTYPE; if (ha->cache_feat & GDT_64BIT) cmd->u.cache64.DeviceNo = i; else cmd->u.cache.DeviceNo = i; |
cbd5f69b9 [SCSI] remove the... |
4539 4540 |
status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); |
1da177e4c Linux-2.6.12-rc2 |
4541 |
spin_lock_irqsave(&ha->smp_lock, flags); |
1fe6dbf4d [SCSI] gdth: Conv... |
4542 |
ha->hdr[i].devtype = (status == S_OK ? (u16)info : 0); |
1da177e4c Linux-2.6.12-rc2 |
4543 4544 4545 4546 4547 4548 4549 4550 |
spin_unlock_irqrestore(&ha->smp_lock, flags); cmd->Service = CACHESERVICE; cmd->OpCode = GDT_CLUST_INFO; if (ha->cache_feat & GDT_64BIT) cmd->u.cache64.DeviceNo = i; else cmd->u.cache.DeviceNo = i; |
cbd5f69b9 [SCSI] remove the... |
4551 4552 |
status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); |
1da177e4c Linux-2.6.12-rc2 |
4553 4554 |
spin_lock_irqsave(&ha->smp_lock, flags); ha->hdr[i].cluster_type = |
1fe6dbf4d [SCSI] gdth: Conv... |
4555 |
((status == S_OK && !shared_access) ? (u16)info : 0); |
1da177e4c Linux-2.6.12-rc2 |
4556 4557 4558 4559 4560 4561 4562 4563 4564 |
spin_unlock_irqrestore(&ha->smp_lock, flags); rsc->hdr_list[i].cluster_type = ha->hdr[i].cluster_type; cmd->Service = CACHESERVICE; cmd->OpCode = GDT_RW_ATTRIBS; if (ha->cache_feat & GDT_64BIT) cmd->u.cache64.DeviceNo = i; else cmd->u.cache.DeviceNo = i; |
cbd5f69b9 [SCSI] remove the... |
4565 4566 |
status = __gdth_execute(ha->sdev, cmd, cmnd, 30, &info); |
1da177e4c Linux-2.6.12-rc2 |
4567 |
spin_lock_irqsave(&ha->smp_lock, flags); |
1fe6dbf4d [SCSI] gdth: Conv... |
4568 |
ha->hdr[i].rw_attribs = (status == S_OK ? (u16)info : 0); |
1da177e4c Linux-2.6.12-rc2 |
4569 4570 |
spin_unlock_irqrestore(&ha->smp_lock, flags); } |
1da177e4c Linux-2.6.12-rc2 |
4571 4572 4573 4574 |
if (copy_to_user(arg, rsc, sizeof(gdth_ioctl_rescan))) rc = -EFAULT; else |
cbd5f69b9 [SCSI] remove the... |
4575 |
rc = 0; |
1da177e4c Linux-2.6.12-rc2 |
4576 4577 4578 4579 4580 4581 4582 |
free_fail: kfree(rsc); kfree(cmd); return rc; } |
f4927c45b scsi: Push down B... |
4583 |
static int gdth_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) |
1da177e4c Linux-2.6.12-rc2 |
4584 4585 4586 |
{ gdth_ha_str *ha; Scsi_Cmnd *scp; |
1fe6dbf4d [SCSI] gdth: Conv... |
4587 |
unsigned long flags; |
1da177e4c Linux-2.6.12-rc2 |
4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 |
char cmnd[MAX_COMMAND_SIZE]; void __user *argp = (void __user *)arg; memset(cmnd, 0xff, 12); TRACE(("gdth_ioctl() cmd 0x%x ", cmd)); switch (cmd) { case GDTIOCTL_CTRCNT: { int cnt = gdth_ctr_count; if (put_user(cnt, (int __user *)argp)) return -EFAULT; break; } case GDTIOCTL_DRVERS: { int ver = (GDTH_VERSION<<8) | GDTH_SUBVERSION; if (put_user(ver, (int __user *)argp)) return -EFAULT; break; } case GDTIOCTL_OSVERS: { gdth_ioctl_osvers osv; |
1fe6dbf4d [SCSI] gdth: Conv... |
4616 4617 4618 |
osv.version = (u8)(LINUX_VERSION_CODE >> 16); osv.subversion = (u8)(LINUX_VERSION_CODE >> 8); osv.revision = (u16)(LINUX_VERSION_CODE & 0xff); |
1da177e4c Linux-2.6.12-rc2 |
4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 |
if (copy_to_user(argp, &osv, sizeof(gdth_ioctl_osvers))) return -EFAULT; break; } case GDTIOCTL_CTRTYPE: { gdth_ioctl_ctrtype ctrt; if (copy_from_user(&ctrt, argp, sizeof(gdth_ioctl_ctrtype)) || |
884f7fba0 [SCSI] gdth: Remo... |
4629 |
(NULL == (ha = gdth_find_ha(ctrt.ionode)))) |
1da177e4c Linux-2.6.12-rc2 |
4630 |
return -EFAULT; |
884f7fba0 [SCSI] gdth: Remo... |
4631 |
|
1da177e4c Linux-2.6.12-rc2 |
4632 |
if (ha->type == GDT_ISA || ha->type == GDT_EISA) { |
1fe6dbf4d [SCSI] gdth: Conv... |
4633 |
ctrt.type = (u8)((ha->stype>>20) - 0x10); |
1da177e4c Linux-2.6.12-rc2 |
4634 4635 |
} else { if (ha->type != GDT_PCIMPR) { |
1fe6dbf4d [SCSI] gdth: Conv... |
4636 |
ctrt.type = (u8)((ha->stype<<4) + 6); |
1da177e4c Linux-2.6.12-rc2 |
4637 4638 4639 4640 |
} else { ctrt.type = (ha->oem_id == OEM_ID_INTEL ? 0xfd : 0xfe); if (ha->stype >= 0x300) |
8e9a8a0d5 [SCSI] gdth: remo... |
4641 |
ctrt.ext_type = 0x6000 | ha->pdev->subsystem_device; |
1da177e4c Linux-2.6.12-rc2 |
4642 4643 4644 |
else ctrt.ext_type = 0x6000 | ha->stype; } |
8e9a8a0d5 [SCSI] gdth: remo... |
4645 4646 |
ctrt.device_id = ha->pdev->device; ctrt.sub_device_id = ha->pdev->subsystem_device; |
1da177e4c Linux-2.6.12-rc2 |
4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 |
} ctrt.info = ha->brd_phys; ctrt.oem_id = ha->oem_id; if (copy_to_user(argp, &ctrt, sizeof(gdth_ioctl_ctrtype))) return -EFAULT; break; } case GDTIOCTL_GENERAL: return ioc_general(argp, cmnd); case GDTIOCTL_EVENT: return ioc_event(argp); case GDTIOCTL_LOCKDRV: return ioc_lockdrv(argp); case GDTIOCTL_LOCKCHN: { gdth_ioctl_lockchn lchn; |
1fe6dbf4d [SCSI] gdth: Conv... |
4667 |
u8 i, j; |
1da177e4c Linux-2.6.12-rc2 |
4668 4669 |
if (copy_from_user(&lchn, argp, sizeof(gdth_ioctl_lockchn)) || |
884f7fba0 [SCSI] gdth: Remo... |
4670 |
(NULL == (ha = gdth_find_ha(lchn.ionode)))) |
1da177e4c Linux-2.6.12-rc2 |
4671 |
return -EFAULT; |
884f7fba0 [SCSI] gdth: Remo... |
4672 |
|
1da177e4c Linux-2.6.12-rc2 |
4673 4674 4675 4676 4677 4678 |
i = lchn.channel; if (i < ha->bus_cnt) { if (lchn.lock) { spin_lock_irqsave(&ha->smp_lock, flags); ha->raw[i].lock = 1; spin_unlock_irqrestore(&ha->smp_lock, flags); |
242f9dcb8 block: unify requ... |
4679 |
for (j = 0; j < ha->tid_cnt; ++j) |
45f1a41b2 [SCSI] gdth: clea... |
4680 |
gdth_wait_completion(ha, i, j); |
1da177e4c Linux-2.6.12-rc2 |
4681 4682 4683 4684 |
} else { spin_lock_irqsave(&ha->smp_lock, flags); ha->raw[i].lock = 0; spin_unlock_irqrestore(&ha->smp_lock, flags); |
242f9dcb8 block: unify requ... |
4685 |
for (j = 0; j < ha->tid_cnt; ++j) |
45f1a41b2 [SCSI] gdth: clea... |
4686 |
gdth_next(ha); |
1da177e4c Linux-2.6.12-rc2 |
4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 |
} } break; } case GDTIOCTL_RESCAN: return ioc_rescan(argp, cmnd); case GDTIOCTL_HDRLIST: return ioc_hdrlist(argp, cmnd); case GDTIOCTL_RESET_BUS: { gdth_ioctl_reset res; |
45f1a41b2 [SCSI] gdth: clea... |
4701 |
int rval; |
1da177e4c Linux-2.6.12-rc2 |
4702 4703 |
if (copy_from_user(&res, argp, sizeof(gdth_ioctl_reset)) || |
884f7fba0 [SCSI] gdth: Remo... |
4704 |
(NULL == (ha = gdth_find_ha(res.ionode)))) |
1da177e4c Linux-2.6.12-rc2 |
4705 |
return -EFAULT; |
1da177e4c Linux-2.6.12-rc2 |
4706 |
|
bbfbbbc11 [SCSI] kmalloc + ... |
4707 |
scp = kzalloc(sizeof(*scp), GFP_KERNEL); |
1da177e4c Linux-2.6.12-rc2 |
4708 4709 |
if (!scp) return -ENOMEM; |
cbd5f69b9 [SCSI] remove the... |
4710 |
scp->device = ha->sdev; |
1da177e4c Linux-2.6.12-rc2 |
4711 |
scp->cmd_len = 12; |
52759e6ab [SCSI] gdth: Remo... |
4712 |
scp->device->channel = res.number; |
1da177e4c Linux-2.6.12-rc2 |
4713 4714 |
rval = gdth_eh_bus_reset(scp); res.status = (rval == SUCCESS ? S_OK : S_GENERR); |
cbd5f69b9 [SCSI] remove the... |
4715 |
kfree(scp); |
8d7a5da4f [SCSI] gdth: Remo... |
4716 |
|
1da177e4c Linux-2.6.12-rc2 |
4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 |
if (copy_to_user(argp, &res, sizeof(gdth_ioctl_reset))) return -EFAULT; break; } case GDTIOCTL_RESET_DRV: return ioc_resetdrv(argp, cmnd); default: break; } return 0; } |
f4927c45b scsi: Push down B... |
4730 4731 4732 4733 |
static long gdth_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int ret; |
c45d15d24 scsi: autoconvert... |
4734 |
mutex_lock(&gdth_mutex); |
f4927c45b scsi: Push down B... |
4735 |
ret = gdth_ioctl(file, cmd, arg); |
c45d15d24 scsi: autoconvert... |
4736 |
mutex_unlock(&gdth_mutex); |
f4927c45b scsi: Push down B... |
4737 4738 4739 |
return ret; } |
1da177e4c Linux-2.6.12-rc2 |
4740 4741 |
/* flush routine */ |
45f1a41b2 [SCSI] gdth: clea... |
4742 |
static void gdth_flush(gdth_ha_str *ha) |
1da177e4c Linux-2.6.12-rc2 |
4743 4744 |
{ int i; |
1da177e4c Linux-2.6.12-rc2 |
4745 |
gdth_cmd_str gdtcmd; |
1da177e4c Linux-2.6.12-rc2 |
4746 4747 |
char cmnd[MAX_COMMAND_SIZE]; memset(cmnd, 0xff, MAX_COMMAND_SIZE); |
45f1a41b2 [SCSI] gdth: clea... |
4748 4749 |
TRACE2(("gdth_flush() hanum %d ", ha->hanum)); |
1da177e4c Linux-2.6.12-rc2 |
4750 |
|
1da177e4c Linux-2.6.12-rc2 |
4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 |
for (i = 0; i < MAX_HDRIVES; ++i) { if (ha->hdr[i].present) { gdtcmd.BoardNode = LOCALBOARD; gdtcmd.Service = CACHESERVICE; gdtcmd.OpCode = GDT_FLUSH; if (ha->cache_feat & GDT_64BIT) { gdtcmd.u.cache64.DeviceNo = i; gdtcmd.u.cache64.BlockNo = 1; gdtcmd.u.cache64.sg_canz = 0; } else { gdtcmd.u.cache.DeviceNo = i; gdtcmd.u.cache.BlockNo = 1; gdtcmd.u.cache.sg_canz = 0; } |
45f1a41b2 [SCSI] gdth: clea... |
4765 4766 |
TRACE2(("gdth_flush(): flush ha %d drive %d ", ha->hanum, i)); |
cbd5f69b9 [SCSI] remove the... |
4767 |
|
45f1a41b2 [SCSI] gdth: clea... |
4768 |
gdth_execute(ha->shost, &gdtcmd, cmnd, 30, NULL); |
1da177e4c Linux-2.6.12-rc2 |
4769 4770 |
} } |
1da177e4c Linux-2.6.12-rc2 |
4771 |
} |
cbd5f69b9 [SCSI] remove the... |
4772 4773 4774 4775 4776 4777 4778 4779 |
/* configure lun */ static int gdth_slave_configure(struct scsi_device *sdev) { scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); sdev->skip_ms_page_3f = 1; sdev->skip_ms_page_8 = 1; return 0; } |
cbd5f69b9 [SCSI] remove the... |
4780 |
|
835cc24af [SCSI] gdth: swit... |
4781 |
static struct scsi_host_template gdth_template = { |
1da177e4c Linux-2.6.12-rc2 |
4782 |
.name = "GDT SCSI Disk Array Controller", |
1da177e4c Linux-2.6.12-rc2 |
4783 4784 |
.info = gdth_info, .queuecommand = gdth_queuecommand, |
1da177e4c Linux-2.6.12-rc2 |
4785 |
.eh_bus_reset_handler = gdth_eh_bus_reset, |
69916b7ce [SCSI] gdth: Reor... |
4786 |
.slave_configure = gdth_slave_configure, |
1da177e4c Linux-2.6.12-rc2 |
4787 |
.bios_param = gdth_bios_param, |
69916b7ce [SCSI] gdth: Reor... |
4788 |
.proc_info = gdth_proc_info, |
242f9dcb8 block: unify requ... |
4789 |
.eh_timed_out = gdth_timed_out, |
69916b7ce [SCSI] gdth: Reor... |
4790 |
.proc_name = "gdth", |
1da177e4c Linux-2.6.12-rc2 |
4791 4792 4793 4794 4795 4796 |
.can_queue = GDTH_MAXCMDS, .this_id = -1, .sg_tablesize = GDTH_MAXSG, .cmd_per_lun = GDTH_MAXC_P_L, .unchecked_isa_dma = 1, .use_clustering = ENABLE_CLUSTERING, |
1da177e4c Linux-2.6.12-rc2 |
4797 |
}; |
aed91cb52 [SCSI] gdth: spli... |
4798 |
#ifdef CONFIG_ISA |
1fe6dbf4d [SCSI] gdth: Conv... |
4799 |
static int __init gdth_isa_probe_one(u32 isa_bios) |
aed91cb52 [SCSI] gdth: spli... |
4800 4801 4802 4803 |
{ struct Scsi_Host *shp; gdth_ha_str *ha; dma_addr_t scratch_dma_handle = 0; |
884f7fba0 [SCSI] gdth: Remo... |
4804 |
int error, i; |
aed91cb52 [SCSI] gdth: spli... |
4805 4806 4807 |
if (!gdth_search_isa(isa_bios)) return -ENXIO; |
835cc24af [SCSI] gdth: swit... |
4808 |
shp = scsi_host_alloc(&gdth_template, sizeof(gdth_ha_str)); |
aed91cb52 [SCSI] gdth: spli... |
4809 4810 |
if (!shp) return -ENOMEM; |
45f1a41b2 [SCSI] gdth: clea... |
4811 |
ha = shost_priv(shp); |
aed91cb52 [SCSI] gdth: spli... |
4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 |
error = -ENODEV; if (!gdth_init_isa(isa_bios,ha)) goto out_host_put; /* controller found and initialized */ printk("Configuring GDT-ISA HA at BIOS 0x%05X IRQ %u DRQ %u ", isa_bios, ha->irq, ha->drq); error = request_irq(ha->irq, gdth_interrupt, IRQF_DISABLED, "gdth", ha); if (error) { printk("GDT-ISA: Unable to allocate IRQ "); goto out_host_put; } error = request_dma(ha->drq, "gdth"); if (error) { printk("GDT-ISA: Unable to allocate DMA channel "); goto out_free_irq; } set_dma_mode(ha->drq,DMA_MODE_CASCADE); enable_dma(ha->drq); shp->unchecked_isa_dma = 1; shp->irq = ha->irq; shp->dma_channel = ha->drq; |
aed91cb52 [SCSI] gdth: spli... |
4841 |
|
884f7fba0 [SCSI] gdth: Remo... |
4842 |
ha->hanum = gdth_ctr_count++; |
45f1a41b2 [SCSI] gdth: clea... |
4843 |
ha->shost = shp; |
aed91cb52 [SCSI] gdth: spli... |
4844 |
|
45f1a41b2 [SCSI] gdth: clea... |
4845 |
ha->pccb = &ha->cmdext; |
aed91cb52 [SCSI] gdth: spli... |
4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 |
ha->ccb_phys = 0L; ha->pdev = NULL; error = -ENOMEM; ha->pscratch = pci_alloc_consistent(ha->pdev, GDTH_SCRATCH, &scratch_dma_handle); if (!ha->pscratch) goto out_dec_counters; ha->scratch_phys = scratch_dma_handle; ha->pmsg = pci_alloc_consistent(ha->pdev, sizeof(gdth_msg_str), &scratch_dma_handle); if (!ha->pmsg) goto out_free_pscratch; ha->msg_phys = scratch_dma_handle; #ifdef INT_COAL ha->coal_stat = pci_alloc_consistent(ha->pdev, sizeof(gdth_coal_status) * MAXOFFSETS, &scratch_dma_handle); if (!ha->coal_stat) goto out_free_pmsg; ha->coal_stat_phys = scratch_dma_handle; #endif ha->scratch_busy = FALSE; ha->req_first = NULL; ha->tid_cnt = MAX_HDRIVES; if (max_ids > 0 && max_ids < ha->tid_cnt) ha->tid_cnt = max_ids; for (i = 0; i < GDTH_MAXCMDS; ++i) ha->cmd_tab[i].cmnd = UNUSED_CMND; ha->scan_mode = rescan ? 0x10 : 0; error = -ENODEV; |
45f1a41b2 [SCSI] gdth: clea... |
4882 |
if (!gdth_search_drives(ha)) { |
aed91cb52 [SCSI] gdth: spli... |
4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 |
printk("GDT-ISA: Error during device scan "); goto out_free_coal_stat; } if (hdr_channel < 0 || hdr_channel > ha->bus_cnt) hdr_channel = ha->bus_cnt; ha->virt_bus = hdr_channel; if (ha->cache_feat & ha->raw_feat & ha->screen_feat & GDT_64BIT) shp->max_cmd_len = 16; shp->max_id = ha->tid_cnt; shp->max_lun = MAXLUN; |
52759e6ab [SCSI] gdth: Remo... |
4897 |
shp->max_channel = ha->bus_cnt; |
aed91cb52 [SCSI] gdth: spli... |
4898 4899 |
spin_lock_init(&ha->smp_lock); |
45f1a41b2 [SCSI] gdth: clea... |
4900 |
gdth_enable_int(ha); |
aed91cb52 [SCSI] gdth: spli... |
4901 |
|
835cc24af [SCSI] gdth: swit... |
4902 4903 4904 4905 |
error = scsi_add_host(shp, NULL); if (error) goto out_free_coal_stat; list_add_tail(&ha->list, &gdth_instances); |
2d6f0d0cd [SCSI] gdth: fix ... |
4906 |
gdth_timer_init(); |
61c92814d [SCSI] gdth: scan... |
4907 4908 |
scsi_scan_host(shp); |
aed91cb52 [SCSI] gdth: spli... |
4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 |
return 0; out_free_coal_stat: #ifdef INT_COAL pci_free_consistent(ha->pdev, sizeof(gdth_coal_status) * MAXOFFSETS, ha->coal_stat, ha->coal_stat_phys); out_free_pmsg: #endif pci_free_consistent(ha->pdev, sizeof(gdth_msg_str), ha->pmsg, ha->msg_phys); out_free_pscratch: pci_free_consistent(ha->pdev, GDTH_SCRATCH, ha->pscratch, ha->scratch_phys); out_dec_counters: gdth_ctr_count--; |
aed91cb52 [SCSI] gdth: spli... |
4924 4925 4926 |
out_free_irq: free_irq(ha->irq, ha); out_host_put: |
835cc24af [SCSI] gdth: swit... |
4927 |
scsi_host_put(shp); |
aed91cb52 [SCSI] gdth: spli... |
4928 4929 4930 |
return error; } #endif /* CONFIG_ISA */ |
706a5d456 [SCSI] gdth: spli... |
4931 |
#ifdef CONFIG_EISA |
1fe6dbf4d [SCSI] gdth: Conv... |
4932 |
static int __init gdth_eisa_probe_one(u16 eisa_slot) |
706a5d456 [SCSI] gdth: spli... |
4933 4934 4935 4936 |
{ struct Scsi_Host *shp; gdth_ha_str *ha; dma_addr_t scratch_dma_handle = 0; |
884f7fba0 [SCSI] gdth: Remo... |
4937 |
int error, i; |
706a5d456 [SCSI] gdth: spli... |
4938 4939 4940 |
if (!gdth_search_eisa(eisa_slot)) return -ENXIO; |
835cc24af [SCSI] gdth: swit... |
4941 |
shp = scsi_host_alloc(&gdth_template, sizeof(gdth_ha_str)); |
706a5d456 [SCSI] gdth: spli... |
4942 4943 |
if (!shp) return -ENOMEM; |
45f1a41b2 [SCSI] gdth: clea... |
4944 |
ha = shost_priv(shp); |
706a5d456 [SCSI] gdth: spli... |
4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 |
error = -ENODEV; if (!gdth_init_eisa(eisa_slot,ha)) goto out_host_put; /* controller found and initialized */ printk("Configuring GDT-EISA HA at Slot %d IRQ %u ", eisa_slot >> 12, ha->irq); error = request_irq(ha->irq, gdth_interrupt, IRQF_DISABLED, "gdth", ha); if (error) { printk("GDT-EISA: Unable to allocate IRQ "); goto out_host_put; } shp->unchecked_isa_dma = 0; shp->irq = ha->irq; shp->dma_channel = 0xff; |
706a5d456 [SCSI] gdth: spli... |
4965 |
|
884f7fba0 [SCSI] gdth: Remo... |
4966 |
ha->hanum = gdth_ctr_count++; |
45f1a41b2 [SCSI] gdth: clea... |
4967 4968 4969 4970 |
ha->shost = shp; TRACE2(("EISA detect Bus 0: hanum %d ", ha->hanum)); |
706a5d456 [SCSI] gdth: spli... |
4971 |
|
45f1a41b2 [SCSI] gdth: clea... |
4972 |
ha->pccb = &ha->cmdext; |
706a5d456 [SCSI] gdth: spli... |
4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 |
ha->ccb_phys = 0L; error = -ENOMEM; ha->pdev = NULL; ha->pscratch = pci_alloc_consistent(ha->pdev, GDTH_SCRATCH, &scratch_dma_handle); if (!ha->pscratch) goto out_free_irq; ha->scratch_phys = scratch_dma_handle; ha->pmsg = pci_alloc_consistent(ha->pdev, sizeof(gdth_msg_str), &scratch_dma_handle); if (!ha->pmsg) goto out_free_pscratch; ha->msg_phys = scratch_dma_handle; #ifdef INT_COAL ha->coal_stat = pci_alloc_consistent(ha->pdev, sizeof(gdth_coal_status) * MAXOFFSETS, &scratch_dma_handle); if (!ha->coal_stat) goto out_free_pmsg; ha->coal_stat_phys = scratch_dma_handle; #endif ha->ccb_phys = pci_map_single(ha->pdev,ha->pccb, sizeof(gdth_cmd_str), PCI_DMA_BIDIRECTIONAL); if (!ha->ccb_phys) goto out_free_coal_stat; ha->scratch_busy = FALSE; ha->req_first = NULL; ha->tid_cnt = MAX_HDRIVES; if (max_ids > 0 && max_ids < ha->tid_cnt) ha->tid_cnt = max_ids; for (i = 0; i < GDTH_MAXCMDS; ++i) ha->cmd_tab[i].cmnd = UNUSED_CMND; ha->scan_mode = rescan ? 0x10 : 0; |
45f1a41b2 [SCSI] gdth: clea... |
5012 |
if (!gdth_search_drives(ha)) { |
706a5d456 [SCSI] gdth: spli... |
5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 |
printk("GDT-EISA: Error during device scan "); error = -ENODEV; goto out_free_ccb_phys; } if (hdr_channel < 0 || hdr_channel > ha->bus_cnt) hdr_channel = ha->bus_cnt; ha->virt_bus = hdr_channel; if (ha->cache_feat & ha->raw_feat & ha->screen_feat & GDT_64BIT) shp->max_cmd_len = 16; shp->max_id = ha->tid_cnt; shp->max_lun = MAXLUN; |
52759e6ab [SCSI] gdth: Remo... |
5028 |
shp->max_channel = ha->bus_cnt; |
706a5d456 [SCSI] gdth: spli... |
5029 5030 |
spin_lock_init(&ha->smp_lock); |
45f1a41b2 [SCSI] gdth: clea... |
5031 |
gdth_enable_int(ha); |
835cc24af [SCSI] gdth: swit... |
5032 5033 5034 |
error = scsi_add_host(shp, NULL); if (error) |
2c076eea6 gdth: unmap ccb_p... |
5035 |
goto out_free_ccb_phys; |
835cc24af [SCSI] gdth: swit... |
5036 |
list_add_tail(&ha->list, &gdth_instances); |
2d6f0d0cd [SCSI] gdth: fix ... |
5037 |
gdth_timer_init(); |
61c92814d [SCSI] gdth: scan... |
5038 5039 |
scsi_scan_host(shp); |
706a5d456 [SCSI] gdth: spli... |
5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 |
return 0; out_free_ccb_phys: pci_unmap_single(ha->pdev,ha->ccb_phys, sizeof(gdth_cmd_str), PCI_DMA_BIDIRECTIONAL); out_free_coal_stat: #ifdef INT_COAL pci_free_consistent(ha->pdev, sizeof(gdth_coal_status) * MAXOFFSETS, ha->coal_stat, ha->coal_stat_phys); out_free_pmsg: #endif pci_free_consistent(ha->pdev, sizeof(gdth_msg_str), ha->pmsg, ha->msg_phys); out_free_pscratch: pci_free_consistent(ha->pdev, GDTH_SCRATCH, ha->pscratch, ha->scratch_phys); out_free_irq: free_irq(ha->irq, ha); gdth_ctr_count--; |
706a5d456 [SCSI] gdth: spli... |
5059 |
out_host_put: |
835cc24af [SCSI] gdth: swit... |
5060 |
scsi_host_put(shp); |
706a5d456 [SCSI] gdth: spli... |
5061 5062 5063 |
return error; } #endif /* CONFIG_EISA */ |
aed91cb52 [SCSI] gdth: spli... |
5064 |
|
8514ef27e [SCSI] gdth: spli... |
5065 |
#ifdef CONFIG_PCI |
ced7172ad gdth section fixes |
5066 |
static int __devinit gdth_pci_probe_one(gdth_pci_str *pcistr, |
cff268064 [SCSI] gdth: conv... |
5067 |
gdth_ha_str **ha_out) |
8514ef27e [SCSI] gdth: spli... |
5068 5069 5070 5071 |
{ struct Scsi_Host *shp; gdth_ha_str *ha; dma_addr_t scratch_dma_handle = 0; |
884f7fba0 [SCSI] gdth: Remo... |
5072 |
int error, i; |
4c9c8d782 [SCSI] gdth: PCI ... |
5073 |
struct pci_dev *pdev = pcistr->pdev; |
8514ef27e [SCSI] gdth: spli... |
5074 |
|
cff268064 [SCSI] gdth: conv... |
5075 |
*ha_out = NULL; |
835cc24af [SCSI] gdth: swit... |
5076 |
shp = scsi_host_alloc(&gdth_template, sizeof(gdth_ha_str)); |
8514ef27e [SCSI] gdth: spli... |
5077 5078 |
if (!shp) return -ENOMEM; |
45f1a41b2 [SCSI] gdth: clea... |
5079 |
ha = shost_priv(shp); |
8514ef27e [SCSI] gdth: spli... |
5080 5081 |
error = -ENODEV; |
4c9c8d782 [SCSI] gdth: PCI ... |
5082 |
if (!gdth_init_pci(pdev, pcistr, ha)) |
8514ef27e [SCSI] gdth: spli... |
5083 5084 5085 5086 5087 |
goto out_host_put; /* controller found and initialized */ printk("Configuring GDT-PCI HA at %d/%d IRQ %u ", |
4c9c8d782 [SCSI] gdth: PCI ... |
5088 5089 |
pdev->bus->number, PCI_SLOT(pdev->devfn), |
8514ef27e [SCSI] gdth: spli... |
5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 |
ha->irq); error = request_irq(ha->irq, gdth_interrupt, IRQF_DISABLED|IRQF_SHARED, "gdth", ha); if (error) { printk("GDT-PCI: Unable to allocate IRQ "); goto out_host_put; } shp->unchecked_isa_dma = 0; shp->irq = ha->irq; shp->dma_channel = 0xff; |
8514ef27e [SCSI] gdth: spli... |
5103 |
|
884f7fba0 [SCSI] gdth: Remo... |
5104 |
ha->hanum = gdth_ctr_count++; |
45f1a41b2 [SCSI] gdth: clea... |
5105 |
ha->shost = shp; |
8514ef27e [SCSI] gdth: spli... |
5106 |
|
45f1a41b2 [SCSI] gdth: clea... |
5107 |
ha->pccb = &ha->cmdext; |
8514ef27e [SCSI] gdth: spli... |
5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 |
ha->ccb_phys = 0L; error = -ENOMEM; ha->pscratch = pci_alloc_consistent(ha->pdev, GDTH_SCRATCH, &scratch_dma_handle); if (!ha->pscratch) goto out_free_irq; ha->scratch_phys = scratch_dma_handle; ha->pmsg = pci_alloc_consistent(ha->pdev, sizeof(gdth_msg_str), &scratch_dma_handle); if (!ha->pmsg) goto out_free_pscratch; ha->msg_phys = scratch_dma_handle; #ifdef INT_COAL ha->coal_stat = pci_alloc_consistent(ha->pdev, sizeof(gdth_coal_status) * MAXOFFSETS, &scratch_dma_handle); if (!ha->coal_stat) goto out_free_pmsg; ha->coal_stat_phys = scratch_dma_handle; #endif ha->scratch_busy = FALSE; ha->req_first = NULL; |
4c9c8d782 [SCSI] gdth: PCI ... |
5135 |
ha->tid_cnt = pdev->device >= 0x200 ? MAXID : MAX_HDRIVES; |
8514ef27e [SCSI] gdth: spli... |
5136 5137 5138 5139 5140 5141 5142 |
if (max_ids > 0 && max_ids < ha->tid_cnt) ha->tid_cnt = max_ids; for (i = 0; i < GDTH_MAXCMDS; ++i) ha->cmd_tab[i].cmnd = UNUSED_CMND; ha->scan_mode = rescan ? 0x10 : 0; error = -ENODEV; |
45f1a41b2 [SCSI] gdth: clea... |
5143 5144 5145 |
if (!gdth_search_drives(ha)) { printk("GDT-PCI %d: Error during device scan ", ha->hanum); |
8514ef27e [SCSI] gdth: spli... |
5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 |
goto out_free_coal_stat; } if (hdr_channel < 0 || hdr_channel > ha->bus_cnt) hdr_channel = ha->bus_cnt; ha->virt_bus = hdr_channel; /* 64-bit DMA only supported from FW >= x.43 */ if (!(ha->cache_feat & ha->raw_feat & ha->screen_feat & GDT_64BIT) || !ha->dma64_support) { |
284901a90 dma-mapping: repl... |
5156 |
if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { |
8514ef27e [SCSI] gdth: spli... |
5157 |
printk(KERN_WARNING "GDT-PCI %d: " |
45f1a41b2 [SCSI] gdth: clea... |
5158 5159 |
"Unable to set 32-bit DMA ", ha->hanum); |
8514ef27e [SCSI] gdth: spli... |
5160 5161 5162 5163 |
goto out_free_coal_stat; } } else { shp->max_cmd_len = 16; |
6a35528a8 dma-mapping: repl... |
5164 |
if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { |
45f1a41b2 [SCSI] gdth: clea... |
5165 5166 |
printk("GDT-PCI %d: 64-bit DMA enabled ", ha->hanum); |
284901a90 dma-mapping: repl... |
5167 |
} else if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { |
8514ef27e [SCSI] gdth: spli... |
5168 |
printk(KERN_WARNING "GDT-PCI %d: " |
45f1a41b2 [SCSI] gdth: clea... |
5169 5170 |
"Unable to set 64/32-bit DMA ", ha->hanum); |
8514ef27e [SCSI] gdth: spli... |
5171 5172 5173 5174 5175 5176 |
goto out_free_coal_stat; } } shp->max_id = ha->tid_cnt; shp->max_lun = MAXLUN; |
52759e6ab [SCSI] gdth: Remo... |
5177 |
shp->max_channel = ha->bus_cnt; |
8514ef27e [SCSI] gdth: spli... |
5178 5179 |
spin_lock_init(&ha->smp_lock); |
45f1a41b2 [SCSI] gdth: clea... |
5180 |
gdth_enable_int(ha); |
835cc24af [SCSI] gdth: swit... |
5181 |
|
4c9c8d782 [SCSI] gdth: PCI ... |
5182 |
error = scsi_add_host(shp, &pdev->dev); |
835cc24af [SCSI] gdth: swit... |
5183 5184 5185 |
if (error) goto out_free_coal_stat; list_add_tail(&ha->list, &gdth_instances); |
61c92814d [SCSI] gdth: scan... |
5186 |
|
cff268064 [SCSI] gdth: conv... |
5187 |
pci_set_drvdata(ha->pdev, ha); |
2d6f0d0cd [SCSI] gdth: fix ... |
5188 |
gdth_timer_init(); |
cff268064 [SCSI] gdth: conv... |
5189 |
|
61c92814d [SCSI] gdth: scan... |
5190 |
scsi_scan_host(shp); |
cff268064 [SCSI] gdth: conv... |
5191 |
*ha_out = ha; |
8514ef27e [SCSI] gdth: spli... |
5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 |
return 0; out_free_coal_stat: #ifdef INT_COAL pci_free_consistent(ha->pdev, sizeof(gdth_coal_status) * MAXOFFSETS, ha->coal_stat, ha->coal_stat_phys); out_free_pmsg: #endif pci_free_consistent(ha->pdev, sizeof(gdth_msg_str), ha->pmsg, ha->msg_phys); out_free_pscratch: pci_free_consistent(ha->pdev, GDTH_SCRATCH, ha->pscratch, ha->scratch_phys); out_free_irq: free_irq(ha->irq, ha); gdth_ctr_count--; |
8514ef27e [SCSI] gdth: spli... |
5208 |
out_host_put: |
835cc24af [SCSI] gdth: swit... |
5209 |
scsi_host_put(shp); |
8514ef27e [SCSI] gdth: spli... |
5210 5211 5212 |
return error; } #endif /* CONFIG_PCI */ |
835cc24af [SCSI] gdth: swit... |
5213 5214 5215 5216 5217 5218 5219 5220 |
static void gdth_remove_one(gdth_ha_str *ha) { struct Scsi_Host *shp = ha->shost; TRACE2(("gdth_remove_one() ")); scsi_remove_host(shp); |
b31ddd31c [SCSI] gdth: bugf... |
5221 |
gdth_flush(ha); |
835cc24af [SCSI] gdth: swit... |
5222 5223 5224 5225 |
if (ha->sdev) { scsi_free_host_dev(ha->sdev); ha->sdev = NULL; } |
835cc24af [SCSI] gdth: swit... |
5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 |
if (shp->irq) free_irq(shp->irq,ha); #ifdef CONFIG_ISA if (shp->dma_channel != 0xff) free_dma(shp->dma_channel); #endif #ifdef INT_COAL if (ha->coal_stat) pci_free_consistent(ha->pdev, sizeof(gdth_coal_status) * MAXOFFSETS, ha->coal_stat, ha->coal_stat_phys); #endif if (ha->pscratch) pci_free_consistent(ha->pdev, GDTH_SCRATCH, ha->pscratch, ha->scratch_phys); if (ha->pmsg) pci_free_consistent(ha->pdev, sizeof(gdth_msg_str), ha->pmsg, ha->msg_phys); if (ha->ccb_phys) pci_unmap_single(ha->pdev,ha->ccb_phys, sizeof(gdth_cmd_str),PCI_DMA_BIDIRECTIONAL); scsi_host_put(shp); } |
1fe6dbf4d [SCSI] gdth: Conv... |
5250 |
static int gdth_halt(struct notifier_block *nb, unsigned long event, void *buf) |
b31ddd31c [SCSI] gdth: bugf... |
5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 |
{ gdth_ha_str *ha; TRACE2(("gdth_halt() event %d ", (int)event)); if (event != SYS_RESTART && event != SYS_HALT && event != SYS_POWER_OFF) return NOTIFY_DONE; list_for_each_entry(ha, &gdth_instances, list) gdth_flush(ha); return NOTIFY_OK; } static struct notifier_block gdth_notifier = { gdth_halt, NULL, 0 }; |
835cc24af [SCSI] gdth: swit... |
5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 |
static int __init gdth_init(void) { if (disable) { printk("GDT-HA: Controller driver disabled from" " command line ! "); return 0; } printk("GDT-HA: Storage RAID Controller Driver. Version: %s ", GDTH_VERSION_STR); /* initializations */ gdth_polling = TRUE; gdth_clear_events(); |
2d6f0d0cd [SCSI] gdth: fix ... |
5284 |
init_timer(&gdth_timer); |
835cc24af [SCSI] gdth: swit... |
5285 5286 5287 5288 5289 |
/* As default we do not probe for EISA or ISA controllers */ if (probe_eisa_isa) { /* scanning for controllers, at first: ISA controller */ #ifdef CONFIG_ISA |
1fe6dbf4d [SCSI] gdth: Conv... |
5290 |
u32 isa_bios; |
835cc24af [SCSI] gdth: swit... |
5291 |
for (isa_bios = 0xc8000UL; isa_bios <= 0xd8000UL; |
884f7fba0 [SCSI] gdth: Remo... |
5292 |
isa_bios += 0x8000UL) |
835cc24af [SCSI] gdth: swit... |
5293 |
gdth_isa_probe_one(isa_bios); |
835cc24af [SCSI] gdth: swit... |
5294 5295 5296 |
#endif #ifdef CONFIG_EISA { |
1fe6dbf4d [SCSI] gdth: Conv... |
5297 |
u16 eisa_slot; |
835cc24af [SCSI] gdth: swit... |
5298 |
for (eisa_slot = 0x1000; eisa_slot <= 0x8000; |
884f7fba0 [SCSI] gdth: Remo... |
5299 |
eisa_slot += 0x1000) |
835cc24af [SCSI] gdth: swit... |
5300 |
gdth_eisa_probe_one(eisa_slot); |
835cc24af [SCSI] gdth: swit... |
5301 5302 5303 5304 5305 5306 |
} #endif } #ifdef CONFIG_PCI /* scanning for PCI controllers */ |
a85591fd0 [SCSI] gdth: fix ... |
5307 5308 5309 5310 5311 5312 5313 |
if (pci_register_driver(&gdth_pci_driver)) { gdth_ha_str *ha; list_for_each_entry(ha, &gdth_instances, list) gdth_remove_one(ha); return -ENODEV; } |
835cc24af [SCSI] gdth: swit... |
5314 5315 5316 5317 |
#endif /* CONFIG_PCI */ TRACE2(("gdth_detect() %d controller detected ", gdth_ctr_count)); |
c596cc46b scsi/gdth: fix cr... |
5318 |
|
835cc24af [SCSI] gdth: swit... |
5319 |
major = register_chrdev(0,"gdth", &gdth_fops); |
835cc24af [SCSI] gdth: swit... |
5320 5321 5322 5323 5324 5325 5326 5327 |
register_reboot_notifier(&gdth_notifier); gdth_polling = FALSE; return 0; } static void __exit gdth_exit(void) { gdth_ha_str *ha; |
b31ddd31c [SCSI] gdth: bugf... |
5328 5329 |
unregister_chrdev(major, "gdth"); unregister_reboot_notifier(&gdth_notifier); |
835cc24af [SCSI] gdth: swit... |
5330 5331 |
#ifdef GDTH_STATISTICS |
b31ddd31c [SCSI] gdth: bugf... |
5332 |
del_timer_sync(&gdth_timer); |
835cc24af [SCSI] gdth: swit... |
5333 |
#endif |
b31ddd31c [SCSI] gdth: bugf... |
5334 |
|
cff268064 [SCSI] gdth: conv... |
5335 |
#ifdef CONFIG_PCI |
a85591fd0 [SCSI] gdth: fix ... |
5336 |
pci_unregister_driver(&gdth_pci_driver); |
cff268064 [SCSI] gdth: conv... |
5337 |
#endif |
b31ddd31c [SCSI] gdth: bugf... |
5338 5339 |
list_for_each_entry(ha, &gdth_instances, list) gdth_remove_one(ha); |
835cc24af [SCSI] gdth: swit... |
5340 5341 5342 5343 |
} module_init(gdth_init); module_exit(gdth_exit); |
1da177e4c Linux-2.6.12-rc2 |
5344 5345 5346 |
#ifndef MODULE __setup("gdth=", option_setup); #endif |