1 /*
2 * Written by Julian Elischer (julian@tfs.com)
3 * for TRW Financial Systems for use under the MACH(2.5) operating system.
4 *
5 * TRW Financial Systems, in accordance with their agreement with Carnegie
6 * Mellon University, makes this software available to CMU to distribute
7 * or use in any manner that they see fit as long as this message is kept with
8 * the software. For this reason TFS also grants any other persons or
9 * organisations permission to use or modify this software.
10 *
11 * TFS supplies this software to be publicly redistributed
12 * on the understanding that TFS is not responsible for the correct
13 * functioning of this software in any circumstances.
14 *
15 * $FreeBSD: src/sys/i386/isa/bt5xx-445.c,v 1.4.2.1 1999/09/05 08:12:27 peter Exp $
16 */
17
18 /*
19 * Bulogic/Bustek 32 bit Addressing Mode SCSI driver.
20 *
21 * NOTE: 1. Some bt5xx card can NOT handle 32 bit addressing mode.
22 * 2. OLD bt445s Revision A,B,C,D(nowired) + any firmware version
23 * has broken busmaster for handling 32 bit addressing on H/W bus
24 * side.
25 *
26 * 3. Extended probing still needs confirmation from our user base, due
27 * to several H/W and firmware dependencies. If you have a problem
28 * with extended probing, please contact 'amurai@spec.co.jp'
29 *
30 * amurai@spec.co.jp 94/6/16
31 */
32
33 #include <sys/param.h>
34 #include <sys/systm.h>
35 #include <sys/kernel.h>
36
37 #include <scsi/scsi_all.h>
38 #include <scsi/scsiconf.h>
39
40 #include <i386/isa/isa_device.h>
41 #include <i386/scsi/btreg.h>
42
43 static int bt_isa_probe __P((struct isa_device *dev));
44 static int bt_isa_attach __P((struct isa_device *dev));
45
46 struct isa_driver btdriver =
47 {
48 bt_isa_probe,
49 bt_isa_attach,
50 "bt"
51 };
52
53 /*
54 * Check if the device can be found at the port given
55 * and if so, set it up ready for further work
56 * as an argument, takes the isa_device structure from
57 * autoconf.c
58 */
59 static int
60 bt_isa_probe(dev)
61 struct isa_device *dev;
62 {
63 /*
64 * find unit and check we have that many defined
65 */
66 int unit = bt_unit;
67 struct bt_data *bt;
68
69 /*
70 * We ignore the unit number assigned by config to allow
71 * consistant numbering between PCI/EISA/ISA devices.
72 * This is a total kludge until we have a configuration
73 * manager.
74 */
75 dev->id_unit = bt_unit;
76 /*
77 * Allocate a storage area for us
78 */
79 bt = bt_alloc(unit, dev->id_iobase);
80 if (!bt)
81 return 0;
82
83 /*
84 * Try initialise a unit at this location
85 * sets up dma and bus speed, loads bt->bt_int
86 */
87 if (bt_init(bt) != 0) {
88 bt_free(bt);
89 return 0;
90 }
91 /*
92 * If it's there, put in it's interrupt vectors
93 */
94 dev->id_unit = unit;
95 dev->id_irq = (1 << bt->bt_int);
96 dev->id_drq = bt->bt_dma;
97
98 bt_unit++;
99 return 1;
100 }
101
102 /*
103 * Attach all the sub-devices we can find
104 */
105 static int
106 bt_isa_attach(dev)
107 struct isa_device *dev;
108 {
109 int unit = dev->id_unit;
110 struct bt_data *bt = btdata[unit];
111
112 return( bt_attach(bt) );
113 }
114
115 /*
116 * Handle an ISA interrupt.
117 * XXX should go away as soon as ISA interrupt handlers
118 * take a (void *) arg.
119 */
120 void
121 bt_isa_intr(unit)
122 int unit;
123 {
124 struct bt_data* arg = btdata[unit];
125 bt_intr((void *)arg);
126 }
Cache object: 2ee2e5cee542605c36daac8605bb1958
|