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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [drivers/] [scsi/] [ini9100u.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1626 jcastillo
/**************************************************************************
2
 * Initio 9100 device driver for Linux.
3
 *
4
 * Copyright (c) 1994-1998 Initio Corporation
5
 * Copyright (c) 1998 Bas Vermeulen <bvermeul@blackstar.xs4all.nl>
6
 * All rights reserved.
7
 *
8
 * This program is free software; you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation; either version 2, or (at your option)
11
 * any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; see the file COPYING.  If not, write to
20
 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21
 *
22
 * --------------------------------------------------------------------------
23
 *
24
 * Redistribution and use in source and binary forms, with or without
25
 * modification, are permitted provided that the following conditions
26
 * are met:
27
 * 1. Redistributions of source code must retain the above copyright
28
 *    notice, this list of conditions, and the following disclaimer,
29
 *    without modification, immediately at the beginning of the file.
30
 * 2. Redistributions in binary form must reproduce the above copyright
31
 *    notice, this list of conditions and the following disclaimer in the
32
 *    documentation and/or other materials provided with the distribution.
33
 * 3. The name of the author may not be used to endorse or promote products
34
 *    derived from this software without specific prior written permission.
35
 *
36
 * Where this Software is combined with software released under the terms of
37
 * the GNU Public License ("GPL") and the terms of the GPL would require the
38
 * combined work to also be released under the terms of the GPL, the terms
39
 * and conditions of this License will apply in addition to those of the
40
 * GPL with the exception of any terms or conditions of this License that
41
 * conflict with, or are expressly prohibited by, the GPL.
42
 *
43
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
44
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
47
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53
 * SUCH DAMAGE.
54
 *
55
 *************************************************************************
56
 *
57
 * DESCRIPTION:
58
 *
59
 * This is the Linux low-level SCSI driver for Initio INI-9X00U/UW SCSI host
60
 * adapters
61
 *
62
 * 08/06/97 hc  - v1.01h
63
 *              - Support inic-940 and inic-935
64
 * 09/26/97 hc  - v1.01i
65
 *              - Make correction from J.W. Schultz suggestion
66
 * 10/13/97 hc  - Support reset function
67
 * 10/21/97 hc  - v1.01j
68
 *              - Support 32 LUN (SCSI 3)
69
 * 01/14/98 hc  - v1.01k
70
 *              - Fix memory allocation problem
71
 * 03/04/98 hc  - v1.01l
72
 *              - Fix tape rewind which will hang the system problem
73
 *              - Set can_queue to tul_num_scb
74
 * 06/25/98 hc  - v1.01m
75
 *              - Get it work for kernel version >= 2.1.75
76
 *              - Dynamic assign SCSI bus reset holding time in init_tulip()
77
 * 07/02/98 hc  - v1.01n
78
 *              - Support 0002134A
79
 * 08/07/98 hc  - v1.01o
80
 *              - Change the tul_abort_srb routine to use scsi_done. <01>
81
 * 09/07/98 hl  - v1.02
82
 *              - Change the INI9100U define and proc_dir_entry to
83
 *                reflect the newer Kernel 2.1.118, but the v1.o1o
84
 *                should work with Kernel 2.1.118.
85
 * 09/20/98 wh  - v1.02a
86
 *              - Support Abort command.
87
 *              - Handle reset routine.
88
 * 09/21/98 hl  - v1.03
89
 *              - remove comments.
90
 * 12/09/98 bv  - v1.03a
91
 *              - Removed unused code
92
 * 12/13/98 bv  - v1.03b
93
 *              - Remove cli() locking for kernels >= 2.1.95. This uses
94
 *                spinlocks to serialize access to the pSRB_head and
95
 *                pSRB_tail members of the HCS structure.
96
 * 09/01/99 bv  - v1.03d
97
 *              - Fixed a deadlock problem in SMP.
98
 * 21/01/99 bv  - v1.03e
99
 *              - Add support for the Domex 3192U PCI SCSI
100
 *                This is a slightly modified patch by
101
 *                Brian Macy <bmacy@sunshinecomputing.com>
102
 * 22/02/99 bv  - v1.03f
103
 *              - Didn't detect the INIC-950 in 2.0.x correctly.
104
 *                Now fixed.
105
 **************************************************************************/
106
 
107
#define CVT_LINUX_VERSION(V,P,S)        (V * 65536 + P * 256 + S)
108
 
109
#ifndef LINUX_VERSION_CODE
110
#include <linux/version.h>
111
#endif
112
 
113
#ifdef MODULE
114
#include <linux/module.h>
115
#endif
116
 
117
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
118
#include <stdarg.h>
119
#include <asm/io.h>
120
#include <asm/irq.h>
121
#include <linux/string.h>
122
#include <linux/errno.h>
123
#include <linux/kernel.h>
124
#include <linux/ioport.h>
125
#if LINUX_VERSION_CODE <= CVT_LINUX_VERSION(2,1,92)
126
#include <linux/bios32.h>
127
#endif
128
#include <linux/delay.h>
129
#include <linux/sched.h>
130
#include <linux/pci.h>
131
#include <linux/proc_fs.h>
132
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,23)
133
#include <linux/init.h>
134
#endif
135
#include <linux/blk.h>
136
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
137
#include <asm/spinlock.h>
138
#endif
139
#include "sd.h"
140
#include "scsi.h"
141
#include "hosts.h"
142
#include "ini9100u.h"
143
#include <linux/stat.h>
144
#include <linux/malloc.h>
145
#include <linux/config.h>
146
 
147
#else
148
 
149
#include <linux/kernel.h>
150
#include <linux/head.h>
151
#include <linux/types.h>
152
#include <linux/string.h>
153
#include <linux/ioport.h>
154
 
155
#include <linux/sched.h>
156
#include <linux/proc_fs.h>
157
#include <asm/system.h>
158
#include <asm/io.h>
159
#include "../block/blk.h"
160
#include "scsi.h"
161
#include "sd.h"
162
#include "hosts.h"
163
#include <linux/malloc.h>
164
#include "ini9100u.h"
165
#endif
166
 
167
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,93)
168
#ifdef CONFIG_PCI
169
#include <linux/pci.h>
170
#endif
171
#endif
172
 
173
#ifdef DEBUG_i91u
174
unsigned int i91u_debug = DEBUG_DEFAULT;
175
#endif
176
 
177
#ifdef MODULE
178
Scsi_Host_Template driver_template = INI9100U;
179
#include "scsi_module.c"
180
#endif
181
 
182
char *i91uCopyright = "Copyright (C) 1996-98";
183
char *i91uInitioName = "by Initio Corporation";
184
char *i91uProductName = "INI-9X00U/UW";
185
char *i91uVersion = "v1.03f";
186
 
187
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
188
struct proc_dir_entry proc_scsi_ini9100u =
189
{
190
        PROC_SCSI_INI9100U, 7, "INI9100U",
191
        S_IFDIR | S_IRUGO | S_IXUGO, 2,
192
        0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL
193
};
194
#endif
195
 
196
#define TULSZ(sz)     (sizeof(sz) / sizeof(sz[0]))
197
#define TUL_RDWORD(x,y)         (short)(inl((int)((ULONG)((ULONG)x+(UCHAR)y)) ))
198
 
199
/* set by i91_setup according to the command line */
200
static int setup_called = 0;
201
 
202
static int tul_num_ch = 4;      /* Maximum 4 adapters           */
203
static int tul_num_scb;
204
static int tul_tag_enable = 1;
205
static SCB *tul_scb;
206
 
207
#ifdef DEBUG_i91u
208
static int setup_debug = 0;
209
#endif
210
 
211
static char *setup_str = (char *) NULL;
212
 
213
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
214
static void i91u_intr0(int irq, void *dev_id, struct pt_regs *);
215
static void i91u_intr1(int irq, void *dev_id, struct pt_regs *);
216
static void i91u_intr2(int irq, void *dev_id, struct pt_regs *);
217
static void i91u_intr3(int irq, void *dev_id, struct pt_regs *);
218
static void i91u_intr4(int irq, void *dev_id, struct pt_regs *);
219
static void i91u_intr5(int irq, void *dev_id, struct pt_regs *);
220
static void i91u_intr6(int irq, void *dev_id, struct pt_regs *);
221
static void i91u_intr7(int irq, void *dev_id, struct pt_regs *);
222
#else
223
static void i91u_intr0(int irq, struct pt_regs *);
224
static void i91u_intr1(int irq, struct pt_regs *);
225
static void i91u_intr2(int irq, struct pt_regs *);
226
static void i91u_intr3(int irq, struct pt_regs *);
227
static void i91u_intr4(int irq, struct pt_regs *);
228
static void i91u_intr5(int irq, struct pt_regs *);
229
static void i91u_intr6(int irq, struct pt_regs *);
230
static void i91u_intr7(int irq, struct pt_regs *);
231
#endif
232
 
233
static void i91u_panic(char *msg);
234
 
235
static void i91uSCBPost(BYTE * pHcb, BYTE * pScb);
236
 
237
                                /* ---- EXTERNAL FUNCTIONS ---- */
238
                                        /* Get total number of adapters */
239
extern void init_i91uAdapter_table(void);
240
extern int Addi91u_into_Adapter_table(WORD, WORD, BYTE, BYTE, BYTE);
241
extern int tul_ReturnNumberOfAdapters(void);
242
extern void get_tulipPCIConfig(HCS * pHCB, int iChannel_index);
243
extern int init_tulip(HCS * pHCB, SCB * pSCB, int tul_num_scb, BYTE * pbBiosAdr, int reset_time);
244
extern SCB *tul_alloc_scb(HCS * pHCB);
245
extern int tul_abort_srb(HCS * pHCB, Scsi_Cmnd * pSRB);
246
extern void tul_exec_scb(HCS * pHCB, SCB * pSCB);
247
extern void tul_release_scb(HCS * pHCB, SCB * pSCB);
248
extern void tul_stop_bm(HCS * pHCB);
249
extern int tul_reset_scsi(HCS * pCurHcb, int seconds);
250
extern int tul_isr(HCS * pHCB);
251
extern int tul_reset(HCS * pHCB, Scsi_Cmnd * pSRB, unsigned char target);
252
extern int tul_reset_scsi_bus(HCS * pCurHcb);
253
extern int tul_device_reset(HCS * pCurHcb, ULONG pSrb, unsigned int target, unsigned int ResetFlags);
254
                                /* ---- EXTERNAL VARIABLES ---- */
255
extern HCS tul_hcs[];
256
 
257
const PCI_ID i91u_pci_devices[] = {
258
        { INI_VENDOR_ID, I950_DEVICE_ID },
259
        { INI_VENDOR_ID, I940_DEVICE_ID },
260
        { INI_VENDOR_ID, I935_DEVICE_ID },
261
        { INI_VENDOR_ID, I920_DEVICE_ID },
262
        { DMX_VENDOR_ID, I920_DEVICE_ID },
263
};
264
 
265
/*
266
 *  queue services:
267
 */
268
/*****************************************************************************
269
 Function name  : i91uAppendSRBToQueue
270
 Description    : This function will push current request into save list
271
 Input          : pSRB  -       Pointer to SCSI request block.
272
                  pHCB  -       Pointer to host adapter structure
273
 Output         : None.
274
 Return         : None.
275
*****************************************************************************/
276
static void i91uAppendSRBToQueue(HCS * pHCB, Scsi_Cmnd * pSRB)
277
{
278
        ULONG flags;
279
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
280
        spin_lock_irqsave(&(pHCB->pSRB_lock), flags);
281
#else
282
        save_flags(flags);
283
        cli();
284
#endif
285
 
286
        pSRB->next = NULL;      /* Pointer to next              */
287
 
288
        if (pHCB->pSRB_head == NULL)
289
                pHCB->pSRB_head = pSRB;
290
        else
291
                pHCB->pSRB_tail->next = pSRB;   /* Pointer to next              */
292
        pHCB->pSRB_tail = pSRB;
293
 
294
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
295
        spin_unlock_irqrestore(&(pHCB->pSRB_lock), flags);
296
#else
297
        restore_flags(flags);
298
#endif
299
        return;
300
}
301
 
302
/*****************************************************************************
303
 Function name  : i91uPopSRBFromQueue
304
 Description    : This function will pop current request from save list
305
 Input          : pHCB  -       Pointer to host adapter structure
306
 Output         : None.
307
 Return         : pSRB  -       Pointer to SCSI request block.
308
*****************************************************************************/
309
static Scsi_Cmnd *i91uPopSRBFromQueue(HCS * pHCB)
310
{
311
        Scsi_Cmnd *pSRB;
312
        ULONG flags;
313
 
314
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
315
        spin_lock_irqsave(&(pHCB->pSRB_lock), flags);
316
#else
317
        save_flags(flags);
318
        cli();
319
#endif
320
 
321
        if ((pSRB = pHCB->pSRB_head) != NULL) {
322
                pHCB->pSRB_head = pHCB->pSRB_head->next;
323
                pSRB->next = NULL;
324
        }
325
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
326
        spin_unlock_irqrestore(&(pHCB->pSRB_lock), flags);
327
#else
328
        restore_flags(flags);
329
#endif
330
 
331
        return (pSRB);
332
}
333
 
334
/* called from init/main.c */
335
 
336
void i91u_setup(char *str, int *ints)
337
{
338
        if (setup_called)
339
                i91u_panic("i91u: i91u_setup called twice.\n");
340
 
341
        setup_called = ints[0];
342
        setup_str = str;
343
 
344
#ifdef DEBUG_i91u
345
        setup_debug = ints[0] >= 1 ? ints[1] : DEBUG_DEFAULT;
346
#endif
347
}
348
 
349
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,93)
350
int tul_NewReturnNumberOfAdapters(void)
351
{
352
        struct pci_dev *pDev = NULL;    /* Start from none              */
353
        int iAdapters = 0;
354
        long dRegValue;
355
        WORD wBIOS;
356
        int i = 0;
357
 
358
        init_i91uAdapter_table();
359
 
360
        for (i = 0; i < TULSZ(i91u_pci_devices); i++)
361
        {
362
                while ((pDev = pci_find_device(i91u_pci_devices[i].vendor_id, i91u_pci_devices[i].device_id, pDev)) != NULL) {
363
                        pci_read_config_dword(pDev, 0x44, (u32 *) & dRegValue);
364
                        wBIOS = (UWORD) (dRegValue & 0xFF);
365
                        if (((dRegValue & 0xFF00) >> 8) == 0xFF)
366
                                dRegValue = 0;
367
                        wBIOS = (wBIOS << 8) + ((UWORD) ((dRegValue & 0xFF00) >> 8));
368
                        if (Addi91u_into_Adapter_table(wBIOS,
369
                                                        (pDev->base_address[0] & 0xFFFE),
370
                                                        pDev->irq,
371
                                                        pDev->bus->number,
372
                                                        (pDev->devfn >> 3)
373
                                ) == 0)
374
                                iAdapters++;
375
                }
376
        }
377
 
378
        return (iAdapters);
379
}
380
 
381
#else                           /* <01> */
382
 
383
/*****************************************************************************
384
 Function name  : tul_ReturnNumberOfAdapters
385
 Description    : This function will scan PCI bus to get all Orchid card
386
 Input          : None.
387
 Output         : None.
388
 Return         : SUCCESSFUL    - Successful scan
389
                  ohterwise     - No drives founded
390
*****************************************************************************/
391
int tul_ReturnNumberOfAdapters(void)
392
{
393
        unsigned int i, iAdapters;
394
        unsigned int dRegValue;
395
        unsigned short command;
396
        WORD wBIOS, wBASE;
397
        BYTE bPCIBusNum, bInterrupt, bPCIDeviceNum;
398
 
399
        iAdapters = 0;
400
        /*
401
         * PCI-bus probe.
402
         */
403
        if (pcibios_present()) {
404
#ifdef MMAPIO
405
                unsigned long page_offset, base;
406
#endif
407
 
408
                int index;
409
                unsigned char pci_bus, pci_devfn;
410
 
411
                bPCIBusNum = 0;
412
                bPCIDeviceNum = 0;
413
                init_i91uAdapter_table();
414
                for (i = 0; i < TULSZ(i91u_pci_devices); i++) {
415
                        index = 0;
416
                        while (!(pcibios_find_device(i91u_pci_devices[i].vendor_id,
417
                                           i91u_pci_devices[i].device_id,
418
                                         index++, &pci_bus, &pci_devfn)))
419
                        {
420
                                if (i == 2) {
421
                                           printk("i91u: The RAID controller is not supported by\n");
422
                                           printk("i91u:         this driver, we are ignoring it.\n");
423
                                } else {
424
                                        /*
425
                                         * Read sundry information from PCI BIOS.
426
                                         */
427
                                        bPCIBusNum = pci_bus;
428
                                        bPCIDeviceNum = pci_devfn;
429
                                        pcibios_read_config_dword(pci_bus, pci_devfn, PCI_BASE_ADDRESS_0,
430
                                                             &dRegValue);
431
                                        if (dRegValue == -1) {  /* Check return code            */
432
                                                printk("\n\ri91u: tulip read configuration error.\n");
433
                                                return (0);      /* Read configuration space error  */
434
                                        }
435
                                        /* <02> read from base address + 0x50 offset to get the wBIOS balue. */
436
                                        wBASE = (WORD) dRegValue;
437
 
438
                                        /* Now read the interrupt line  */
439
                                        pcibios_read_config_dword(pci_bus, pci_devfn, PCI_INTERRUPT_LINE,
440
                                                             &dRegValue);
441
                                        bInterrupt = dRegValue & 0xFF;  /* Assign interrupt line      */
442
                                        pcibios_read_config_word(pci_bus, pci_devfn, PCI_COMMAND, &command);
443
                                        pcibios_write_config_word(pci_bus, pci_devfn, PCI_COMMAND,
444
                                                                  command | PCI_COMMAND_MASTER | PCI_COMMAND_IO);
445
                                        wBASE &= PCI_BASE_ADDRESS_IO_MASK;
446
                                        wBIOS = TUL_RDWORD(wBASE, 0x50);
447
 
448
#ifdef MMAPIO
449
                                        base = wBASE & PAGE_MASK;
450
                                        page_offset = wBASE - base;
451
 
452
                                        /*
453
                                         * replace the next line with this one if you are using 2.1.x:
454
                                         * temp_p->maddr = ioremap(base, page_offset + 256);
455
                                         */
456
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,0)
457
                                        wBASE = ioremap(base, page_offset + 256);
458
#else
459
                                        wBASE = (WORD) vremap(base, page_offset + 256);
460
#endif
461
                                        if (wBASE) {
462
                                                wBASE += page_offset;
463
                                        }
464
#endif
465
 
466
                                        if (Addi91u_into_Adapter_table(wBIOS, wBASE, bInterrupt, bPCIBusNum,
467
                                                   bPCIDeviceNum) == 0x0)
468
                                                iAdapters++;
469
                                }
470
                        }       /* while(pdev=....) */
471
                }               /* for PCI_DEVICES */
472
        }                       /* PCI BIOS present */
473
        return (iAdapters);
474
}
475
#endif
476
 
477
int i91u_detect(Scsi_Host_Template * tpnt)
478
{
479
        SCB *pSCB;
480
        HCS *pHCB;
481
        struct Scsi_Host *hreg;
482
        unsigned long i;        /* 01/14/98                     */
483
        int ok = 0, iAdapters;
484
        ULONG dBiosAdr;
485
        BYTE *pbBiosAdr;
486
 
487
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
488
        tpnt->proc_dir = &proc_scsi_ini9100u;
489
#endif
490
 
491
        if (setup_called) {     /* Setup by i91u_setup          */
492
                printk("i91u: processing commandline: ");
493
 
494
#ifdef DEBUG_i91u
495
                if (setup_called > 1) {
496
                        printk("\ni91u: %s\n", setup_str);
497
                        printk("i91u: usage: i91u[=<DEBUG>]\n");
498
                        i91u_panic("i91u panics in line %d", __LINE__);
499
                }
500
                i91u_debug = setup_debug;
501
#endif
502
        }
503
        /* Get total number of adapters in the motherboard */
504
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,93)
505
#ifdef CONFIG_PCI
506
        iAdapters = tul_NewReturnNumberOfAdapters();
507
#else
508
        iAdapters = tul_ReturnNumberOfAdapters();
509
#endif
510
#else
511
        iAdapters = tul_ReturnNumberOfAdapters();
512
#endif
513
 
514
        if (iAdapters == 0)      /* If no tulip founded, return */
515
                return (0);
516
 
517
        tul_num_ch = (iAdapters > tul_num_ch) ? tul_num_ch : iAdapters;
518
        /* Update actually channel number */
519
        if (tul_tag_enable) {   /* 1.01i                  */
520
                tul_num_scb = MAX_TARGETS * i91u_MAXQUEUE;
521
        } else {
522
                tul_num_scb = MAX_TARGETS + 3;  /* 1-tape, 1-CD_ROM, 1- extra */
523
        }                       /* Update actually SCBs per adapter */
524
 
525
        /* Get total memory needed for HCS */
526
        i = tul_num_ch * sizeof(HCS);
527
        memset((unsigned char *) &tul_hcs[0], 0, i);      /* Initialize tul_hcs 0 */
528
        /* Get total memory needed for SCB */
529
 
530
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
531
        for (; tul_num_scb >= MAX_TARGETS + 3; tul_num_scb--) {
532
                i = tul_num_ch * tul_num_scb * sizeof(SCB);
533
                if ((tul_scb = (SCB *) kmalloc(i, GFP_ATOMIC | GFP_DMA)) != NULL)
534
                        break;
535
        }
536
#else
537
        i = tul_num_ch * tul_num_scb * sizeof(SCB);
538
        tul_scb = (SCB *) scsi_init_malloc(i, GFP_ATOMIC | GFP_DMA);
539
#endif
540
        if (tul_scb == NULL) {
541
                printk("i91u: SCB memory allocation error\n");
542
                return (0);
543
        }
544
        memset((unsigned char *) tul_scb, 0, i);
545
 
546
        pSCB = tul_scb;
547
        for (i = 0; i < tul_num_ch * tul_num_scb; i++, pSCB++) {
548
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
549
                pSCB->SCB_SGPAddr = (U32) VIRT_TO_BUS(&pSCB->SCB_SGList[0]);
550
#else
551
                pSCB->SCB_SGPAddr = (U32) (&pSCB->SCB_SGList[0]);
552
#endif
553
        }
554
 
555
        for (i = 0, pHCB = &tul_hcs[0];           /* Get pointer for control block */
556
             i < tul_num_ch;
557
             i++, pHCB++) {
558
                pHCB->pSRB_head = NULL;         /* Initial SRB save queue       */
559
                pHCB->pSRB_tail = NULL;         /* Initial SRB save queue       */
560
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
561
                pHCB->pSRB_lock = SPIN_LOCK_UNLOCKED;   /* SRB save queue lock */
562
#endif
563
                request_region(pHCB->HCS_Base, 0x100, "i91u");  /* Register */
564
 
565
                get_tulipPCIConfig(pHCB, i);
566
 
567
                dBiosAdr = pHCB->HCS_BIOS;
568
                dBiosAdr = (dBiosAdr << 4);
569
 
570
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
571
                pbBiosAdr = phys_to_virt(dBiosAdr);
572
#endif
573
 
574
                init_tulip(pHCB, tul_scb + (i * tul_num_scb), tul_num_scb, pbBiosAdr, 10);
575
                pHCB->HCS_Index = i;    /* 7/29/98 */
576
                hreg = scsi_register(tpnt, sizeof(HCS));
577
                hreg->io_port = pHCB->HCS_Base;
578
                hreg->n_io_port = 0xff;
579
                hreg->can_queue = tul_num_scb;  /* 03/05/98                      */
580
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
581
                hreg->unique_id = pHCB->HCS_Base;
582
                hreg->max_id = pHCB->HCS_MaxTar;
583
#endif
584
                hreg->max_lun = 32;     /* 10/21/97                     */
585
                hreg->irq = pHCB->HCS_Intr;
586
                hreg->this_id = pHCB->HCS_SCSI_ID;      /* Assign HCS index           */
587
                hreg->base = (UCHAR *) pHCB;
588
                hreg->sg_tablesize = TOTAL_SG_ENTRY;    /* Maximun support is 32 */
589
 
590
                /* Initial tulip chip           */
591
                switch (i) {
592
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
593
                case 0:
594
                        ok = request_irq(pHCB->HCS_Intr, i91u_intr0, SA_INTERRUPT | SA_SHIRQ, "i91u", NULL);
595
                        break;
596
                case 1:
597
                        ok = request_irq(pHCB->HCS_Intr, i91u_intr1, SA_INTERRUPT | SA_SHIRQ, "i91u", NULL);
598
                        break;
599
                case 2:
600
                        ok = request_irq(pHCB->HCS_Intr, i91u_intr2, SA_INTERRUPT | SA_SHIRQ, "i91u", NULL);
601
                        break;
602
                case 3:
603
                        ok = request_irq(pHCB->HCS_Intr, i91u_intr3, SA_INTERRUPT | SA_SHIRQ, "i91u", NULL);
604
                        break;
605
                case 4:
606
                        ok = request_irq(pHCB->HCS_Intr, i91u_intr4, SA_INTERRUPT | SA_SHIRQ, "i91u", NULL);
607
                        break;
608
                case 5:
609
                        ok = request_irq(pHCB->HCS_Intr, i91u_intr5, SA_INTERRUPT | SA_SHIRQ, "i91u", NULL);
610
                        break;
611
                case 6:
612
                        ok = request_irq(pHCB->HCS_Intr, i91u_intr6, SA_INTERRUPT | SA_SHIRQ, "i91u", NULL);
613
                        break;
614
                case 7:
615
                        ok = request_irq(pHCB->HCS_Intr, i91u_intr7, SA_INTERRUPT | SA_SHIRQ, "i91u", NULL);
616
                        break;
617
                default:
618
                        i91u_panic("i91u: Too many host adapters\n");
619
                        break;
620
                }
621
                if (ok < 0) {
622
                        if (ok == -EINVAL) {
623
                                printk("i91u: bad IRQ %d.\n", pHCB->HCS_Intr);
624
                                printk("         Contact author.\n");
625
                        } else if (ok == -EBUSY)
626
                                printk("i91u: IRQ %d already in use. Configure another.\n",
627
                                       pHCB->HCS_Intr);
628
                        else {
629
                                printk("\ni91u: Unexpected error code on requesting IRQ %d.\n",
630
                                       pHCB->HCS_Intr);
631
                                printk("         Contact author.\n");
632
                        }
633
                        i91u_panic("i91u: driver needs an IRQ.\n");
634
                }
635
#endif
636
        }
637
 
638
        tpnt->this_id = -1;
639
        tpnt->can_queue = 1;
640
 
641
        return 1;
642
}
643
 
644
static void i91uBuildSCB(HCS * pHCB, SCB * pSCB, Scsi_Cmnd * SCpnt)
645
{                               /* Create corresponding SCB     */
646
        struct scatterlist *pSrbSG;
647
        SG *pSG;                /* Pointer to SG list           */
648
        int i;
649
        long TotalLen;
650
 
651
        pSCB->SCB_Post = i91uSCBPost;   /* i91u's callback routine      */
652
        pSCB->SCB_Srb = SCpnt;
653
        pSCB->SCB_Opcode = ExecSCSI;
654
        pSCB->SCB_Flags = SCF_POST;     /* After SCSI done, call post routine */
655
        pSCB->SCB_Target = SCpnt->target;
656
        pSCB->SCB_Lun = SCpnt->lun;
657
        pSCB->SCB_Ident = SCpnt->lun | DISC_ALLOW;
658
        pSCB->SCB_Flags |= SCF_SENSE;   /* Turn on auto request sense   */
659
 
660
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
661
        pSCB->SCB_SensePtr = (U32) VIRT_TO_BUS(SCpnt->sense_buffer);
662
#else
663
        pSCB->SCB_SensePtr = (U32) (SCpnt->sense_buffer);
664
#endif
665
 
666
        pSCB->SCB_SenseLen = SENSE_SIZE;
667
 
668
        pSCB->SCB_CDBLen = SCpnt->cmd_len;
669
        pSCB->SCB_HaStat = 0;
670
        pSCB->SCB_TaStat = 0;
671
        memcpy(&pSCB->SCB_CDB[0], &SCpnt->cmnd, SCpnt->cmd_len);
672
 
673
        if (SCpnt->device->tagged_supported) {  /* Tag Support                  */
674
                pSCB->SCB_TagMsg = SIMPLE_QUEUE_TAG;    /* Do simple tag only   */
675
        } else {
676
                pSCB->SCB_TagMsg = 0;    /* No tag support               */
677
        }
678
 
679
        if (SCpnt->use_sg) {
680
                pSrbSG = (struct scatterlist *) SCpnt->request_buffer;
681
                if (SCpnt->use_sg == 1) {       /* If only one entry in the list *//*      treat it as regular I/O */
682
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
683
                        pSCB->SCB_BufPtr = (U32) VIRT_TO_BUS(pSrbSG->address);
684
#else
685
                        pSCB->SCB_BufPtr = (U32) (pSrbSG->address);
686
#endif
687
                        TotalLen = pSrbSG->length;
688
                        pSCB->SCB_SGLen = 0;
689
                } else {        /* Assign SG physical address   */
690
                        pSCB->SCB_BufPtr = pSCB->SCB_SGPAddr;
691
                        pSCB->SCB_Flags |= SCF_SG;      /* Turn on SG list flag       */
692
                        for (i = 0, TotalLen = 0, pSG = &pSCB->SCB_SGList[0];      /* 1.01g */
693
                             i < SCpnt->use_sg;
694
                             i++, pSG++, pSrbSG++) {
695
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
696
                                pSG->SG_Ptr = (U32) VIRT_TO_BUS(pSrbSG->address);
697
#else
698
                                pSG->SG_Ptr = (U32) (pSrbSG->address);
699
#endif
700
                                TotalLen += pSG->SG_Len = pSrbSG->length;
701
                        }
702
                        pSCB->SCB_SGLen = i;
703
                }
704
                pSCB->SCB_BufLen = (SCpnt->request_bufflen > TotalLen) ?
705
                    TotalLen : SCpnt->request_bufflen;
706
        } else {                /* Non SG                       */
707
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
708
                pSCB->SCB_BufPtr = (U32) VIRT_TO_BUS(SCpnt->request_buffer);
709
#else
710
                pSCB->SCB_BufPtr = (U32) (SCpnt->request_buffer);
711
#endif
712
                pSCB->SCB_BufLen = SCpnt->request_bufflen;
713
                pSCB->SCB_SGLen = 0;
714
        }
715
 
716
        return;
717
}
718
 
719
/*
720
 *  Queue a command and setup interrupts for a free bus.
721
 */
722
int i91u_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
723
{
724
        register SCB *pSCB;
725
        HCS *pHCB;              /* Point to Host adapter control block */
726
 
727
        if (SCpnt->lun > 16) {  /* 07/22/98 */
728
 
729
                SCpnt->result = (DID_TIME_OUT << 16);
730
                done(SCpnt);    /* Notify system DONE           */
731
                return (0);
732
        }
733
        pHCB = (HCS *) SCpnt->host->base;
734
 
735
        SCpnt->scsi_done = done;
736
        /* Get free SCSI control block  */
737
        if ((pSCB = tul_alloc_scb(pHCB)) == NULL) {
738
                i91uAppendSRBToQueue(pHCB, SCpnt);      /* Buffer this request  */
739
                return (0);
740
        }
741
        i91uBuildSCB(pHCB, pSCB, SCpnt);
742
        tul_exec_scb(pHCB, pSCB);       /* Start execute SCB            */
743
        return (0);
744
}
745
 
746
/*
747
 *  We only support command in interrupt-driven fashion
748
 */
749
int i91u_command(Scsi_Cmnd * SCpnt)
750
{
751
        printk("i91u: interrupt driven driver; use i91u_queue()\n");
752
        return -1;
753
}
754
 
755
/*
756
 *  Abort a queued command
757
 *  (commands that are on the bus can't be aborted easily)
758
 */
759
int i91u_abort(Scsi_Cmnd * SCpnt)
760
{
761
        HCS *pHCB;
762
 
763
        pHCB = (HCS *) SCpnt->host->base;
764
        return tul_abort_srb(pHCB, SCpnt);
765
}
766
 
767
/*
768
 *  Reset registers, reset a hanging bus and
769
 *  kill active and disconnected commands for target w/o soft reset
770
 */
771
int i91u_reset(Scsi_Cmnd * SCpnt, unsigned int reset_flags)
772
{                               /* I need Host Control Block Information */
773
        HCS *pHCB;
774
 
775
        pHCB = (HCS *) SCpnt->host->base;
776
 
777
        if (reset_flags & (SCSI_RESET_SUGGEST_BUS_RESET | SCSI_RESET_SUGGEST_HOST_RESET))
778
                return tul_reset_scsi_bus(pHCB);
779
        else
780
                return tul_device_reset(pHCB, (ULONG) SCpnt, SCpnt->target, reset_flags);
781
}
782
 
783
/*
784
 * Return the "logical geometry"
785
 */
786
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
787
int i91u_biosparam(Scsi_Disk * disk, kdev_t dev, int *info_array)
788
#else
789
int i91u_biosparam(Scsi_Disk * disk, int dev, int *info_array)
790
#endif
791
{
792
        HCS *pHcb;              /* Point to Host adapter control block */
793
        TCS *pTcb;
794
 
795
        pHcb = (HCS *) disk->device->host->base;
796
        pTcb = &pHcb->HCS_Tcs[disk->device->id];
797
 
798
        if (pTcb->TCS_DrvHead) {
799
                info_array[0] = pTcb->TCS_DrvHead;
800
                info_array[1] = pTcb->TCS_DrvSector;
801
                info_array[2] = disk->capacity / pTcb->TCS_DrvHead / pTcb->TCS_DrvSector;
802
        } else {
803
                if (pTcb->TCS_DrvFlags & TCF_DRV_255_63) {
804
                        info_array[0] = 255;
805
                        info_array[1] = 63;
806
                        info_array[2] = disk->capacity / 255 / 63;
807
                } else {
808
                        info_array[0] = 64;
809
                        info_array[1] = 32;
810
                        info_array[2] = disk->capacity >> 11;
811
                }
812
        }
813
 
814
#if defined(DEBUG_BIOSPARAM)
815
        if (i91u_debug & debug_biosparam) {
816
                printk("bios geometry: head=%d, sec=%d, cyl=%d\n",
817
                       info_array[0], info_array[1], info_array[2]);
818
                printk("WARNING: check, if the bios geometry is correct.\n");
819
        }
820
#endif
821
 
822
        return 0;
823
}
824
 
825
/*****************************************************************************
826
 Function name  : i91uSCBPost
827
 Description    : This is callback routine be called when tulip finish one
828
                        SCSI command.
829
 Input          : pHCB  -       Pointer to host adapter control block.
830
                  pSCB  -       Pointer to SCSI control block.
831
 Output         : None.
832
 Return         : None.
833
*****************************************************************************/
834
static void i91uSCBPost(BYTE * pHcb, BYTE * pScb)
835
{
836
        Scsi_Cmnd *pSRB;        /* Pointer to SCSI request block */
837
        HCS *pHCB;
838
        SCB *pSCB;
839
 
840
        pHCB = (HCS *) pHcb;
841
        pSCB = (SCB *) pScb;
842
        if ((pSRB = pSCB->SCB_Srb) == 0) {
843
                printk("i91uSCBPost: SRB pointer is empty\n");
844
 
845
                tul_release_scb(pHCB, pSCB);    /* Release SCB for current channel */
846
                return;
847
        }
848
        switch (pSCB->SCB_HaStat) {
849
        case 0x0:
850
        case 0xa:               /* Linked command complete without error and linked normally */
851
        case 0xb:               /* Linked command complete without error interrupt generated */
852
                pSCB->SCB_HaStat = 0;
853
                break;
854
 
855
        case 0x11:              /* Selection time out-The initiator selection or target
856
                                   reselection was not complete within the SCSI Time out period */
857
                pSCB->SCB_HaStat = DID_TIME_OUT;
858
                break;
859
 
860
        case 0x14:              /* Target bus phase sequence failure-An invalid bus phase or bus
861
                                   phase sequence was requested by the target. The host adapter
862
                                   will generate a SCSI Reset Condition, notifying the host with
863
                                   a SCRD interrupt */
864
                pSCB->SCB_HaStat = DID_RESET;
865
                break;
866
 
867
        case 0x1a:              /* SCB Aborted. 07/21/98 */
868
                pSCB->SCB_HaStat = DID_ABORT;
869
                break;
870
 
871
        case 0x12:              /* Data overrun/underrun-The target attempted to transfer more data
872
                                   than was allocated by the Data Length field or the sum of the
873
                                   Scatter / Gather Data Length fields. */
874
        case 0x13:              /* Unexpected bus free-The target dropped the SCSI BSY at an unexpected time. */
875
        case 0x16:              /* Invalid SCB Operation Code. */
876
 
877
        default:
878
                printk("ini9100u: %x %x\n", pSCB->SCB_HaStat, pSCB->SCB_TaStat);
879
                pSCB->SCB_HaStat = DID_ERROR;   /* Couldn't find any better */
880
                break;
881
        }
882
 
883
        pSRB->result = pSCB->SCB_TaStat | (pSCB->SCB_HaStat << 16);
884
 
885
        if (pSRB == NULL) {
886
                printk("pSRB is NULL\n");
887
        }
888
        pSRB->scsi_done(pSRB);  /* Notify system DONE           */
889
        if ((pSRB = i91uPopSRBFromQueue(pHCB)) != NULL)
890
                /* Find the next pending SRB    */
891
        {                       /* Assume resend will success   */
892
                /* Reuse old SCB                */
893
                i91uBuildSCB(pHCB, pSCB, pSRB);         /* Create corresponding SCB     */
894
 
895
                tul_exec_scb(pHCB, pSCB);       /* Start execute SCB            */
896
        } else {                /* No Pending SRB               */
897
                tul_release_scb(pHCB, pSCB);    /* Release SCB for current channel */
898
        }
899
        return;
900
}
901
 
902
/*
903
 * Interrupts handler (main routine of the driver)
904
 */
905
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
906
static void i91u_intr0(int irqno, void *dev_id, struct pt_regs *regs)
907
#else
908
static void i91u_intr0(int irqno, struct pt_regs *regs)
909
#endif
910
{
911
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
912
        unsigned long flags;
913
#endif
914
 
915
        if (tul_hcs[0].HCS_Intr != irqno)
916
                return;
917
 
918
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
919
        spin_lock_irqsave(&io_request_lock, flags);
920
#endif
921
 
922
        tul_isr(&tul_hcs[0]);
923
 
924
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
925
        spin_unlock_irqrestore(&io_request_lock, flags);
926
#endif
927
}
928
 
929
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
930
static void i91u_intr1(int irqno, void *dev_id, struct pt_regs *regs)
931
#else
932
static void i91u_intr1(int irqno, struct pt_regs *regs)
933
#endif
934
{
935
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
936
        unsigned long flags;
937
#endif
938
 
939
        if (tul_hcs[1].HCS_Intr != irqno)
940
                return;
941
 
942
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
943
        spin_lock_irqsave(&io_request_lock, flags);
944
#endif
945
 
946
        tul_isr(&tul_hcs[1]);
947
 
948
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
949
        spin_unlock_irqrestore(&io_request_lock, flags);
950
#endif
951
}
952
 
953
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
954
static void i91u_intr2(int irqno, void *dev_id, struct pt_regs *regs)
955
#else
956
static void i91u_intr2(int irqno, struct pt_regs *regs)
957
#endif
958
{
959
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
960
        unsigned long flags;
961
#endif
962
 
963
        if (tul_hcs[2].HCS_Intr != irqno)
964
                return;
965
 
966
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
967
        spin_lock_irqsave(&io_request_lock, flags);
968
#endif
969
 
970
        tul_isr(&tul_hcs[2]);
971
 
972
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
973
        spin_unlock_irqrestore(&io_request_lock, flags);
974
#endif
975
}
976
 
977
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
978
static void i91u_intr3(int irqno, void *dev_id, struct pt_regs *regs)
979
#else
980
static void i91u_intr3(int irqno, struct pt_regs *regs)
981
#endif
982
{
983
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
984
        unsigned long flags;
985
#endif
986
 
987
        if (tul_hcs[3].HCS_Intr != irqno)
988
                return;
989
 
990
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
991
        spin_lock_irqsave(&io_request_lock, flags);
992
#endif
993
 
994
        tul_isr(&tul_hcs[3]);
995
 
996
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
997
        spin_unlock_irqrestore(&io_request_lock, flags);
998
#endif
999
}
1000
 
1001
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
1002
static void i91u_intr4(int irqno, void *dev_id, struct pt_regs *regs)
1003
#else
1004
static void i91u_intr4(int irqno, struct pt_regs *regs)
1005
#endif
1006
{
1007
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
1008
        unsigned long flags;
1009
#endif
1010
 
1011
        if (tul_hcs[4].HCS_Intr != irqno)
1012
                return;
1013
 
1014
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
1015
        spin_lock_irqsave(&io_request_lock, flags);
1016
#endif
1017
 
1018
        tul_isr(&tul_hcs[4]);
1019
 
1020
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
1021
        spin_unlock_irqrestore(&io_request_lock, flags);
1022
#endif
1023
}
1024
 
1025
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
1026
static void i91u_intr5(int irqno, void *dev_id, struct pt_regs *regs)
1027
#else
1028
static void i91u_intr5(int irqno, struct pt_regs *regs)
1029
#endif
1030
{
1031
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
1032
        unsigned long flags;
1033
#endif
1034
 
1035
        if (tul_hcs[5].HCS_Intr != irqno)
1036
                return;
1037
 
1038
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
1039
        spin_lock_irqsave(&io_request_lock, flags);
1040
#endif
1041
 
1042
        tul_isr(&tul_hcs[5]);
1043
 
1044
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
1045
        spin_unlock_irqrestore(&io_request_lock, flags);
1046
#endif
1047
}
1048
 
1049
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
1050
static void i91u_intr6(int irqno, void *dev_id, struct pt_regs *regs)
1051
#else
1052
static void i91u_intr6(int irqno, struct pt_regs *regs)
1053
#endif
1054
{
1055
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
1056
        unsigned long flags;
1057
#endif
1058
 
1059
        if (tul_hcs[6].HCS_Intr != irqno)
1060
                return;
1061
 
1062
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
1063
        spin_lock_irqsave(&io_request_lock, flags);
1064
#endif
1065
 
1066
        tul_isr(&tul_hcs[6]);
1067
 
1068
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
1069
        spin_unlock_irqrestore(&io_request_lock, flags);
1070
#endif
1071
}
1072
 
1073
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(1,3,0)
1074
static void i91u_intr7(int irqno, void *dev_id, struct pt_regs *regs)
1075
#else
1076
static void i91u_intr7(int irqno, struct pt_regs *regs)
1077
#endif
1078
{
1079
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
1080
        unsigned long flags;
1081
#endif
1082
 
1083
        if (tul_hcs[7].HCS_Intr != irqno)
1084
                return;
1085
 
1086
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
1087
        spin_lock_irqsave(&io_request_lock, flags);
1088
#endif
1089
 
1090
        tul_isr(&tul_hcs[7]);
1091
 
1092
#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
1093
        spin_unlock_irqrestore(&io_request_lock, flags);
1094
#endif
1095
}
1096
 
1097
/*
1098
 * Dump the current driver status and panic...
1099
 */
1100
static void i91u_panic(char *msg)
1101
{
1102
        printk("\ni91u_panic: %s\n", msg);
1103
        panic("i91u panic");
1104
}

powered by: WebSVN 2.1.0

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