xref: /freebsd/sys/dev/aac/aac_pci.c (revision db612abe8df3355d1eb23bb3b50fdd97bc21e979)
1 /*-
2  * Copyright (c) 2000 Michael Smith
3  * Copyright (c) 2001 Scott Long
4  * Copyright (c) 2000 BSDi
5  * Copyright (c) 2001 Adaptec, Inc.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  */
29 
30 #include <sys/cdefs.h>
31 __FBSDID("$FreeBSD$");
32 
33 /*
34  * PCI bus interface and resource allocation.
35  */
36 
37 #include "opt_aac.h"
38 
39 #include <sys/param.h>
40 #include <sys/systm.h>
41 #include <sys/kernel.h>
42 #include <sys/module.h>
43 
44 #include <sys/bio.h>
45 #include <sys/bus.h>
46 #include <sys/conf.h>
47 #include <sys/disk.h>
48 
49 #include <machine/bus.h>
50 #include <machine/resource.h>
51 #include <sys/rman.h>
52 
53 #include <dev/pci/pcireg.h>
54 #include <dev/pci/pcivar.h>
55 
56 #include <dev/aac/aacreg.h>
57 #include <sys/aac_ioctl.h>
58 #include <dev/aac/aacvar.h>
59 
60 static int	aac_pci_probe(device_t dev);
61 static int	aac_pci_attach(device_t dev);
62 
63 static device_method_t aac_methods[] = {
64 	/* Device interface */
65 	DEVMETHOD(device_probe,		aac_pci_probe),
66 	DEVMETHOD(device_attach,	aac_pci_attach),
67 	DEVMETHOD(device_detach,	aac_detach),
68 	DEVMETHOD(device_suspend,	aac_suspend),
69 	DEVMETHOD(device_resume,	aac_resume),
70 
71 	DEVMETHOD(bus_print_child,	bus_generic_print_child),
72 	DEVMETHOD(bus_driver_added,	bus_generic_driver_added),
73 	{ 0, 0 }
74 };
75 
76 static driver_t aac_pci_driver = {
77 	"aac",
78 	aac_methods,
79 	sizeof(struct aac_softc)
80 };
81 
82 static devclass_t	aac_devclass;
83 
84 DRIVER_MODULE(aac, pci, aac_pci_driver, aac_devclass, 0, 0);
85 MODULE_DEPEND(aac, pci, 1, 1, 1);
86 
87 
88 struct aac_ident
89 {
90 	u_int16_t		vendor;
91 	u_int16_t		device;
92 	u_int16_t		subvendor;
93 	u_int16_t		subdevice;
94 	int			hwif;
95 	int			quirks;
96 	char			*desc;
97 } aac_identifiers[] = {
98 	{0x1028, 0x0001, 0x1028, 0x0001, AAC_HWIF_I960RX, 0,
99 	"Dell PERC 2/Si"},
100 	{0x1028, 0x0002, 0x1028, 0x0002, AAC_HWIF_I960RX, 0,
101 	"Dell PERC 3/Di"},
102 	{0x1028, 0x0003, 0x1028, 0x0003, AAC_HWIF_I960RX, 0,
103 	"Dell PERC 3/Si"},
104 	{0x1028, 0x0004, 0x1028, 0x00d0, AAC_HWIF_I960RX, 0,
105 	"Dell PERC 3/Si"},
106 	{0x1028, 0x0002, 0x1028, 0x00d1, AAC_HWIF_I960RX, 0,
107 	"Dell PERC 3/Di"},
108 	{0x1028, 0x0002, 0x1028, 0x00d9, AAC_HWIF_I960RX, 0,
109 	"Dell PERC 3/Di"},
110 	{0x1028, 0x000a, 0x1028, 0x0106, AAC_HWIF_I960RX, 0,
111 	"Dell PERC 3/Di"},
112 	{0x1028, 0x000a, 0x1028, 0x011b, AAC_HWIF_I960RX, 0,
113 	"Dell PERC 3/Di"},
114 	{0x1028, 0x000a, 0x1028, 0x0121, AAC_HWIF_I960RX, 0,
115 	"Dell PERC 3/Di"},
116 	{0x1011, 0x0046, 0x9005, 0x0364, AAC_HWIF_STRONGARM, 0,
117 	"Adaptec AAC-364"},
118 	{0x1011, 0x0046, 0x9005, 0x0365, AAC_HWIF_STRONGARM,
119 	 AAC_FLAGS_BROKEN_MEMMAP, "Adaptec SCSI RAID 5400S"},
120 	{0x1011, 0x0046, 0x9005, 0x1364, AAC_HWIF_STRONGARM, AAC_FLAGS_PERC2QC,
121 	 "Dell PERC 2/QC"},
122 	{0x1011, 0x0046, 0x103c, 0x10c2, AAC_HWIF_STRONGARM, 0,
123 	 "HP NetRaid-4M"},
124 	{0x9005, 0x0285, 0x9005, 0x0285, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB |
125 	 AAC_FLAGS_256FIBS, "Adaptec SCSI RAID 2200S"},
126 	{0x9005, 0x0285, 0x1028, 0x0287, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB |
127 	 AAC_FLAGS_256FIBS, "Dell PERC 320/DC"},
128 	{0x9005, 0x0285, 0x9005, 0x0286, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB |
129 	 AAC_FLAGS_256FIBS, "Adaptec SCSI RAID 2120S"},
130 	{0x9005, 0x0285, 0x9005, 0x0290, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB,
131 	 "Adaptec SATA RAID 2410SA"},
132 	{0x9005, 0x0285, 0x1028, 0x0291, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB,
133 	 "Dell CERC SATA RAID 2"},
134 	{0x9005, 0x0285, 0x9005, 0x0292, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB,
135 	 "Adaptec SATA RAID 2810SA"},
136 	{0x9005, 0x0285, 0x9005, 0x0293, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB,
137 	 "Adaptec SATA RAID 21610SA"},
138 	{0x9005, 0x0285, 0x103c, 0x3227, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB,
139 	 "HP ML110 G2 (Adaptec 2610SA)"},
140 	{0x9005, 0x0286, 0x9005, 0x028c, AAC_HWIF_RKT, 0,
141 	 "Adaptec SCSI RAID 2230S"},
142 	{0x9005, 0x0286, 0x9005, 0x028d, AAC_HWIF_RKT, 0,
143 	 "Adaptec SCSI RAID 2130S"},
144 
145 	{0x9005, 0x0285, 0x9005, 0x0287, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB |
146 	 AAC_FLAGS_256FIBS, "Adaptec SCSI RAID 2200S"},
147 	{0x9005, 0x0285, 0x17aa, 0x0286, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB |
148 	 AAC_FLAGS_256FIBS, "Legend S220"},
149 	{0x9005, 0x0285, 0x17aa, 0x0287, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB |
150 	 AAC_FLAGS_256FIBS, "Legend S230"},
151 	{0x9005, 0x0285, 0x9005, 0x0288, AAC_HWIF_I960RX, 0,
152 	 "Adaptec SCSI RAID 3230S"},
153 	{0x9005, 0x0285, 0x9005, 0x0289, AAC_HWIF_I960RX, 0,
154 	 "Adaptec SCSI RAID 3240S"},
155 	{0x9005, 0x0285, 0x9005, 0x028a, AAC_HWIF_I960RX, 0,
156 	 "Adaptec SCSI RAID 2020ZCR"},
157 	{0x9005, 0x0285, 0x9005, 0x028b, AAC_HWIF_I960RX, 0,
158 	 "Adaptec SCSI RAID 2025ZCR"},
159 	{0x9005, 0x0286, 0x9005, 0x029b, AAC_HWIF_RKT, 0,
160 	 "Adaptec SATA RAID 2820SA"},
161 	{0x9005, 0x0286, 0x9005, 0x029c, AAC_HWIF_RKT, 0,
162 	 "Adaptec SATA RAID 2620SA"},
163 	{0x9005, 0x0286, 0x9005, 0x029d, AAC_HWIF_RKT, 0,
164 	 "Adaptec SATA RAID 2420SA"},
165 	{0x9005, 0x0286, 0x9005, 0x029e, AAC_HWIF_RKT, 0,
166 	 "ICP ICP9024RO SCSI RAID"},
167 	{0x9005, 0x0286, 0x9005, 0x029f, AAC_HWIF_RKT, 0,
168 	 "ICP ICP9014RO SCSI RAID"},
169 	{0x9005, 0x0285, 0x9005, 0x0294, AAC_HWIF_I960RX, 0,
170 	 "Adaptec SATA RAID 2026ZCR"},
171 	{0x9005, 0x0285, 0x103c, 0x3227, AAC_HWIF_I960RX, 0,
172 	 "Adaptec SATA RAID 2610SA"},
173 	{0x9005, 0x0285, 0x9005, 0x0296, AAC_HWIF_I960RX, 0,
174 	 "Adaptec SCSI RAID 2240S"},
175 	{0x9005, 0x0285, 0x9005, 0x0297, AAC_HWIF_I960RX, 0,
176 	 "Adaptec SAS RAID 4005SAS"},
177 	{0x9005, 0x0285, 0x1014, 0x02f2, AAC_HWIF_I960RX, 0,
178 	 "IBM ServeRAID 8i"},
179 	{0x9005, 0x0285, 0x1014, 0x0312, AAC_HWIF_I960RX, 0,
180 	 "IBM ServeRAID 8i"},
181 	{0x9005, 0x0285, 0x9005, 0x0298, AAC_HWIF_I960RX, 0,
182 	 "Adaptec SAS RAID 4000SAS"},
183 	{0x9005, 0x0285, 0x9005, 0x0299, AAC_HWIF_I960RX, 0,
184 	 "Adaptec SAS RAID 4800SAS"},
185 	{0x9005, 0x0285, 0x9005, 0x029a, AAC_HWIF_I960RX, 0,
186 	 "Adaptec SAS RAID 4805SAS"},
187 	{0x9005, 0x0285, 0x9005, 0x028e, AAC_HWIF_I960RX, 0,
188 	 "Adaptec SATA RAID 2020SA ZCR"},
189 	{0x9005, 0x0285, 0x9005, 0x028f, AAC_HWIF_I960RX, 0,
190 	 "Adaptec SATA RAID 2025SA ZCR"},
191 	{0x9005, 0x0285, 0x9005, 0x02a4, AAC_HWIF_I960RX, 0,
192 	 "ICP ICP9085LI SAS RAID"},
193 	{0x9005, 0x0285, 0x9005, 0x02a5, AAC_HWIF_I960RX, 0,
194 	 "ICP ICP5085BR SAS RAID"},
195 	{0x9005, 0x0286, 0x9005, 0x02a0, AAC_HWIF_RKT, 0,
196 	 "ICP ICP9047MA SATA RAID"},
197 	{0x9005, 0x0286, 0x9005, 0x02a1, AAC_HWIF_RKT, 0,
198 	 "ICP ICP9087MA SATA RAID"},
199 	{0x9005, 0x0286, 0x9005, 0x02a6, AAC_HWIF_RKT, 0,
200 	 "ICP9067MA SATA RAID"},
201 	{0x9005, 0x0285, 0x9005, 0x02b5, AAC_HWIF_I960RX, 0,
202 	 "Adaptec RAID 5445"},
203 	{0x9005, 0x0285, 0x9005, 0x02b6, AAC_HWIF_I960RX, 0,
204 	 "Adaptec RAID 5805"},
205 	{0x9005, 0x0285, 0x9005, 0x02b7, AAC_HWIF_I960RX, 0,
206 	 "Adaptec RAID 5085"},
207 	{0x9005, 0x0285, 0x9005, 0x02b8, AAC_HWIF_I960RX, 0,
208 	 "ICP RAID ICP5445SL"},
209 	{0x9005, 0x0285, 0x9005, 0x02b9, AAC_HWIF_I960RX, 0,
210 	 "ICP RAID ICP5085SL"},
211 	{0x9005, 0x0285, 0x9005, 0x02ba, AAC_HWIF_I960RX, 0,
212 	 "ICP RAID ICP5805SL"},
213 	{0x9005, 0x0285, 0x9005, 0x02bb, AAC_HWIF_I960RX, 0,
214 	 "Adaptec RAID 3405"},
215 	{0x9005, 0x0285, 0x9005, 0x02bc, AAC_HWIF_I960RX, 0,
216 	 "Adaptec RAID 3805"},
217 	{0x9005, 0x0285, 0x9005, 0x02bd, AAC_HWIF_I960RX, 0,
218 	 "Adaptec RAID 31205"},
219 	{0x9005, 0x0285, 0x9005, 0x02be, AAC_HWIF_I960RX, 0,
220 	 "Adaptec RAID 31605"},
221 	{0x9005, 0x0285, 0x9005, 0x02bf, AAC_HWIF_I960RX, 0,
222 	 "ICP RAID ICP5045BL"},
223 	{0x9005, 0x0285, 0x9005, 0x02c0, AAC_HWIF_I960RX, 0,
224 	 "ICP RAID ICP5085BL"},
225 	{0x9005, 0x0285, 0x9005, 0x02c1, AAC_HWIF_I960RX, 0,
226 	 "ICP RAID ICP5125BR"},
227 	{0x9005, 0x0285, 0x9005, 0x02c2, AAC_HWIF_I960RX, 0,
228 	 "ICP RAID ICP5165BR"},
229 	{0x9005, 0x0285, 0x9005, 0x02c3, AAC_HWIF_I960RX, 0,
230 	 "Adaptec RAID 51205"},
231 	{0x9005, 0x0285, 0x9005, 0x02c4, AAC_HWIF_I960RX, 0,
232 	 "Adaptec RAID 51605"},
233 	{0x9005, 0x0285, 0x9005, 0x02c5, AAC_HWIF_I960RX, 0,
234 	 "ICP RAID ICP5125SL"},
235 	{0x9005, 0x0285, 0x9005, 0x02c6, AAC_HWIF_I960RX, 0,
236 	 "ICP RAID ICP5165SL"},
237 	{0x9005, 0x0285, 0x9005, 0x02c7, AAC_HWIF_I960RX, 0,
238 	 "Adaptec RAID 3085"},
239 	{0x9005, 0x0285, 0x9005, 0x02c8, AAC_HWIF_I960RX, 0,
240 	 "ICP RAID ICP5805BL"},
241 	{0x9005, 0x0285, 0x9005, 0x02ce, AAC_HWIF_I960RX, 0,
242 	 "Adaptec RAID 51245"},
243 	{0x9005, 0x0285, 0x9005, 0x02cf, AAC_HWIF_I960RX, 0,
244 	 "Adaptec RAID 51645"},
245 	{0x9005, 0x0285, 0x9005, 0x02d0, AAC_HWIF_I960RX, 0,
246 	 "Adaptec RAID 52445"},
247 	{0x9005, 0x0285, 0x9005, 0x02d1, AAC_HWIF_I960RX, 0,
248         "Adaptec RAID 5405"},
249 	{0x9005, 0x0286, 0x1014, 0x9580, AAC_HWIF_RKT, 0,
250 	 "IBM ServeRAID-8k"},
251 	{0x9005, 0x0285, 0x1014, 0x034d, AAC_HWIF_I960RX, 0,
252 	 "IBM ServeRAID 8s"},
253 	{0x9005, 0x0285, 0x108e, 0x7aac, AAC_HWIF_I960RX, 0,
254 	 "Sun STK RAID REM"},
255 	{0x9005, 0x0285, 0x108e, 0x7aae, AAC_HWIF_I960RX, 0,
256 	 "Sun STK RAID EM"},
257 	{0x9005, 0x0285, 0x108e, 0x286, AAC_HWIF_I960RX, 0,
258 	 "SG-XPCIESAS-R-IN"},
259 	{0x9005, 0x0285, 0x108e, 0x287, AAC_HWIF_I960RX, 0,
260 	 "SG-XPCIESAS-R-EX"},
261 	{0x9005, 0x0285, 0x15d9, 0x2b5, AAC_HWIF_I960RX, 0,
262 	 "AOC-USAS-S4i"},
263 	{0x9005, 0x0285, 0x15d9, 0x2b6, AAC_HWIF_I960RX, 0,
264 	 "AOC-USAS-S8i"},
265 	{0x9005, 0x0285, 0x15d9, 0x2c9, AAC_HWIF_I960RX, 0,
266 	 "AOC-USAS-S4iR"},
267 	{0x9005, 0x0285, 0x15d9, 0x2ca, AAC_HWIF_I960RX, 0,
268 	 "AOC-USAS-S8iR"},
269 	{0x9005, 0x0285, 0x15d9, 0x2d2, AAC_HWIF_I960RX, 0,
270 	 "AOC-USAS-S8i-LP"},
271 	{0x9005, 0x0285, 0x15d9, 0x2d3, AAC_HWIF_I960RX, 0,
272 	 "AOC-USAS-S8iR-LP"},
273 	{0, 0, 0, 0, 0, 0, 0}
274 };
275 struct aac_ident
276 aac_family_identifiers[] = {
277 	{0x9005, 0x0285, 0, 0, AAC_HWIF_I960RX, 0,
278 	 "Adaptec RAID Controller"},
279 	{0x9005, 0x0286, 0, 0, AAC_HWIF_RKT, 0,
280 	 "Adaptec RAID Controller"},
281 	{0, 0, 0, 0, 0, 0, 0}
282 };
283 
284 static struct aac_ident *
285 aac_find_ident(device_t dev)
286 {
287 	struct aac_ident *m;
288 	u_int16_t vendid, devid, sub_vendid, sub_devid;
289 
290 	vendid = pci_get_vendor(dev);
291 	devid = pci_get_device(dev);
292 	sub_vendid = pci_get_subvendor(dev);
293 	sub_devid = pci_get_subdevice(dev);
294 
295 	for (m = aac_identifiers; m->vendor != 0; m++) {
296 		if ((m->vendor == vendid) && (m->device == devid) &&
297 		    (m->subvendor == sub_vendid) &&
298 		    (m->subdevice == sub_devid))
299 			return (m);
300 	}
301 
302 	for (m = aac_family_identifiers; m->vendor != 0; m++) {
303 		if ((m->vendor == vendid) && (m->device == devid))
304 			return (m);
305 	}
306 
307 	return (NULL);
308 }
309 
310 /*
311  * Determine whether this is one of our supported adapters.
312  */
313 static int
314 aac_pci_probe(device_t dev)
315 {
316 	struct aac_ident *id;
317 
318 	fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
319 
320 	if ((id = aac_find_ident(dev)) != NULL) {
321 		device_set_desc(dev, id->desc);
322 		return(BUS_PROBE_DEFAULT);
323 	}
324 	return(ENXIO);
325 }
326 
327 /*
328  * Allocate resources for our device, set up the bus interface.
329  */
330 static int
331 aac_pci_attach(device_t dev)
332 {
333 	struct aac_softc *sc;
334 	struct aac_ident *id;
335 	int error;
336 	u_int32_t command;
337 
338 	fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
339 
340 	/*
341 	 * Initialise softc.
342 	 */
343 	sc = device_get_softc(dev);
344 	bzero(sc, sizeof(*sc));
345 	sc->aac_dev = dev;
346 
347 	/* assume failure is 'not configured' */
348 	error = ENXIO;
349 
350 	/*
351 	 * Verify that the adapter is correctly set up in PCI space.
352 	 */
353 	command = pci_read_config(sc->aac_dev, PCIR_COMMAND, 2);
354 	command |= PCIM_CMD_BUSMASTEREN;
355 	pci_write_config(dev, PCIR_COMMAND, command, 2);
356 	command = pci_read_config(sc->aac_dev, PCIR_COMMAND, 2);
357 	if (!(command & PCIM_CMD_BUSMASTEREN)) {
358 		device_printf(sc->aac_dev, "can't enable bus-master feature\n");
359 		goto out;
360 	}
361 	if ((command & PCIM_CMD_MEMEN) == 0) {
362 		device_printf(sc->aac_dev, "memory window not available\n");
363 		goto out;
364 	}
365 
366 	/*
367 	 * Allocate the PCI register window.
368 	 */
369 	sc->aac_regs_rid = PCIR_BAR(0);
370 	if ((sc->aac_regs_resource = bus_alloc_resource_any(sc->aac_dev,
371 							    SYS_RES_MEMORY,
372 							    &sc->aac_regs_rid,
373 							    RF_ACTIVE)) ==
374 							    NULL) {
375 		device_printf(sc->aac_dev,
376 			      "couldn't allocate register window\n");
377 		goto out;
378 	}
379 	sc->aac_btag = rman_get_bustag(sc->aac_regs_resource);
380 	sc->aac_bhandle = rman_get_bushandle(sc->aac_regs_resource);
381 
382 	/* assume failure is 'out of memory' */
383 	error = ENOMEM;
384 
385 	/*
386 	 * Allocate the parent bus DMA tag appropriate for our PCI interface.
387 	 *
388 	 * Note that some of these controllers are 64-bit capable.
389 	 */
390 	if (bus_dma_tag_create(NULL, 			/* parent */
391 			       PAGE_SIZE, 0,		/* algnmnt, boundary */
392 			       BUS_SPACE_MAXADDR,	/* lowaddr */
393 			       BUS_SPACE_MAXADDR, 	/* highaddr */
394 			       NULL, NULL, 		/* filter, filterarg */
395 			       BUS_SPACE_MAXSIZE_32BIT,	/* maxsize */
396 			       BUS_SPACE_UNRESTRICTED,	/* nsegments */
397 			       BUS_SPACE_MAXSIZE_32BIT,	/* maxsegsize */
398 			       0,			/* flags */
399 			       NULL, NULL,		/* No locking needed */
400 			       &sc->aac_parent_dmat)) {
401 		device_printf(sc->aac_dev, "can't allocate parent DMA tag\n");
402 		goto out;
403 	}
404 
405 	/*
406 	 * Detect the hardware interface version, set up the bus interface
407 	 * indirection.
408 	 */
409 	id = aac_find_ident(dev);
410 	sc->aac_hwif = id->hwif;
411 	switch(sc->aac_hwif) {
412 	case AAC_HWIF_I960RX:
413 		fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for i960Rx");
414 		sc->aac_if = aac_rx_interface;
415 		break;
416 	case AAC_HWIF_STRONGARM:
417 		fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for StrongARM");
418 		sc->aac_if = aac_sa_interface;
419 		break;
420 	case AAC_HWIF_FALCON:
421 		fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for Falcon/PPC");
422 		sc->aac_if = aac_fa_interface;
423 		break;
424 	case AAC_HWIF_RKT:
425 		fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for Rocket/MIPS");
426 		sc->aac_if = aac_rkt_interface;
427 		break;
428 	default:
429 		sc->aac_hwif = AAC_HWIF_UNKNOWN;
430 		device_printf(sc->aac_dev, "unknown hardware type\n");
431 		error = ENXIO;
432 		goto out;
433 	}
434 
435 	/* Set up quirks */
436 	sc->flags = id->quirks;
437 
438 	/*
439 	 * Do bus-independent initialisation.
440 	 */
441 	error = aac_attach(sc);
442 
443 out:
444 	if (error)
445 		aac_free(sc);
446 	return(error);
447 }
448 
449 /*
450  * Do nothing driver that will attach to the SCSI channels of a Dell PERC
451  * controller.  This is needed to keep the power management subsystem from
452  * trying to power down these devices.
453  */
454 static int aacch_probe(device_t dev);
455 static int aacch_attach(device_t dev);
456 static int aacch_detach(device_t dev);
457 
458 static device_method_t aacch_methods[] = {
459 	/* Device interface */
460 	DEVMETHOD(device_probe,		aacch_probe),
461 	DEVMETHOD(device_attach,	aacch_attach),
462 	DEVMETHOD(device_detach,	aacch_detach),
463 	{ 0, 0 }
464 };
465 
466 struct aacch_softc {
467 	device_t	dev;
468 };
469 
470 static driver_t aacch_driver = {
471 	"aacch",
472 	aacch_methods,
473 	sizeof(struct aacch_softc)
474 };
475 
476 static devclass_t	aacch_devclass;
477 DRIVER_MODULE(aacch, pci, aacch_driver, aacch_devclass, 0, 0);
478 
479 static int
480 aacch_probe(device_t dev)
481 {
482 
483 	if ((pci_get_vendor(dev) != 0x9005) ||
484 	    (pci_get_device(dev) != 0x00c5))
485 		return (ENXIO);
486 
487 	device_set_desc(dev, "AAC RAID Channel");
488 	return (-10);
489 }
490 
491 static int
492 aacch_attach(device_t dev)
493 {
494 	struct aacch_softc *sc;
495 
496 	sc = device_get_softc(dev);
497 
498 	sc->dev = dev;
499 
500 	return (0);
501 }
502 
503 static int
504 aacch_detach(device_t dev)
505 {
506 
507 	return (0);
508 }
509