2 * Copyright (c) 1998 - 2006 Søren Schmidt <sos@FreeBSD.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer,
10 * without modification, immediately at the beginning of the file.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * $FreeBSD: src/sys/dev/ata/ata-pci.c,v 1.121 2007/02/23 12:18:33 piso Exp $
27 * $DragonFly: src/sys/dev/disk/nata/ata-pci.c,v 1.10 2008/03/28 11:03:44 sephe Exp $
32 #include <sys/param.h>
34 #include <sys/bus_resource.h>
35 #include <sys/malloc.h>
36 #include <sys/module.h>
39 #include <sys/systm.h>
41 #include <bus/pci/pcireg.h>
42 #include <bus/pci/pcivar.h>
49 static MALLOC_DEFINE(M_ATAPCI
, "ata_pci", "ATA driver PCI");
52 #define IOMASK 0xfffffffc
53 #define ATA_PROBE_OK -10
55 static const struct none_atapci
{
60 } none_atapci_table
[] = {
61 /* Appears on Intel PRO/1000 PM */
62 { ATA_INTEL_ID
, 0x108d, ATA_INTEL_ID
, 0x0000 },
67 ata_legacy(device_t dev
)
69 return (((pci_read_config(dev
, PCIR_PROGIF
, 1)&PCIP_STORAGE_IDE_MASTERDEV
)&&
70 ((pci_read_config(dev
, PCIR_PROGIF
, 1) &
71 (PCIP_STORAGE_IDE_MODEPRIM
| PCIP_STORAGE_IDE_MODESEC
)) !=
72 (PCIP_STORAGE_IDE_MODEPRIM
| PCIP_STORAGE_IDE_MODESEC
))) ||
73 (!pci_read_config(dev
, PCIR_BAR(0), 4) &&
74 !pci_read_config(dev
, PCIR_BAR(1), 4) &&
75 !pci_read_config(dev
, PCIR_BAR(2), 4) &&
76 !pci_read_config(dev
, PCIR_BAR(3), 4) &&
77 !pci_read_config(dev
, PCIR_BAR(5), 4)));
81 ata_pci_probe(device_t dev
)
83 if (pci_get_class(dev
) != PCIC_STORAGE
)
86 /* if this is an AHCI chipset grab it */
87 if (pci_get_subclass(dev
) == PCIS_STORAGE_SATA
) {
88 if (!ata_ahci_ident(dev
))
92 /* run through the vendor specific drivers */
93 switch (pci_get_vendor(dev
)) {
95 if (!ata_acard_ident(dev
))
98 case ATA_ACER_LABS_ID
:
99 if (!ata_ali_ident(dev
))
103 if (!ata_amd_ident(dev
))
107 if (!ata_ati_ident(dev
))
111 if (!ata_cyrix_ident(dev
))
115 if (!ata_cypress_ident(dev
))
118 case ATA_HIGHPOINT_ID
:
119 if (!ata_highpoint_ident(dev
))
123 if (!ata_intel_ident(dev
))
127 if (!ata_ite_ident(dev
))
131 if (!ata_jmicron_ident(dev
))
135 if (!ata_marvell_ident(dev
))
138 case ATA_NATIONAL_ID
:
139 if (!ata_national_ident(dev
))
143 if (!ata_netcell_ident(dev
))
147 if (!ata_nvidia_ident(dev
))
151 if (!ata_promise_ident(dev
))
154 case ATA_SERVERWORKS_ID
:
155 if (!ata_serverworks_ident(dev
))
158 case ATA_SILICON_IMAGE_ID
:
159 if (!ata_sii_ident(dev
))
163 if (!ata_sis_ident(dev
))
167 if (!ata_via_ident(dev
))
171 if (pci_get_devid(dev
) == ATA_CENATEK_ROCKET
) {
172 ata_generic_ident(dev
);
173 device_set_desc(dev
, "Cenatek Rocket Drive controller");
178 if (pci_get_devid(dev
) == ATA_MICRON_RZ1000
||
179 pci_get_devid(dev
) == ATA_MICRON_RZ1001
) {
180 ata_generic_ident(dev
);
182 "RZ 100? ATA controller !WARNING! data loss/corruption risk");
188 /* unknown chipset, try generic AHCI or DMA if it seems possible */
189 if (pci_get_subclass(dev
) == PCIS_STORAGE_IDE
) {
190 uint16_t vendor
, device
, subvendor
, subdevice
;
191 const struct none_atapci
*e
;
193 vendor
= pci_get_vendor(dev
);
194 device
= pci_get_device(dev
);
195 subvendor
= pci_get_subvendor(dev
);
196 subdevice
= pci_get_subdevice(dev
);
197 for (e
= none_atapci_table
; e
->vendor
!= 0xffff; ++e
) {
198 if (e
->vendor
== vendor
&& e
->device
== device
&&
199 e
->subvendor
== subvendor
&& e
->subdevice
== subdevice
)
203 if (!ata_generic_ident(dev
))
210 ata_pci_attach(device_t dev
)
212 struct ata_pci_controller
*ctlr
= device_get_softc(dev
);
216 /* do chipset specific setups only needed once */
217 if (ata_legacy(dev
) || pci_read_config(dev
, PCIR_BAR(2), 4) & IOMASK
)
221 ctlr
->allocate
= ata_pci_allocate
;
224 /* if needed try to enable busmastering */
225 cmd
= pci_read_config(dev
, PCIR_COMMAND
, 2);
226 if (!(cmd
& PCIM_CMD_BUSMASTEREN
)) {
227 pci_write_config(dev
, PCIR_COMMAND
, cmd
| PCIM_CMD_BUSMASTEREN
, 2);
228 cmd
= pci_read_config(dev
, PCIR_COMMAND
, 2);
231 /* if busmastering mode "stuck" use it */
232 if ((cmd
& PCIM_CMD_BUSMASTEREN
) == PCIM_CMD_BUSMASTEREN
) {
233 ctlr
->r_type1
= SYS_RES_IOPORT
;
234 ctlr
->r_rid1
= ATA_BMADDR_RID
;
235 ctlr
->r_res1
= bus_alloc_resource_any(dev
, ctlr
->r_type1
, &ctlr
->r_rid1
,
237 /* Only set a dma init function if the device actually supports it. */
238 ctlr
->dmainit
= ata_pci_dmainit
;
241 if (ctlr
->chipinit(dev
))
244 /* attach all channels on this controller */
245 for (unit
= 0; unit
< ctlr
->channels
; unit
++) {
247 if ((unit
== 0 || unit
== 1) && ata_legacy(dev
)) {
248 device_add_child(dev
, "ata", unit
);
251 /* XXX TGEN devclass_find_free_unit() implementation */
252 while (freeunit
< devclass_get_maxunit(ata_devclass
) &&
253 devclass_get_device(ata_devclass
, freeunit
) != NULL
)
255 device_add_child(dev
, "ata", freeunit
);
257 bus_generic_attach(dev
);
262 ata_pci_detach(device_t dev
)
264 struct ata_pci_controller
*ctlr
= device_get_softc(dev
);
268 /* detach & delete all children */
269 if (!device_get_children(dev
, &children
, &nchildren
)) {
270 for (i
= 0; i
< nchildren
; i
++)
271 device_delete_child(dev
, children
[i
]);
272 kfree(children
, M_TEMP
);
276 bus_teardown_intr(dev
, ctlr
->r_irq
, ctlr
->handle
);
277 bus_release_resource(dev
, SYS_RES_IRQ
, ATA_IRQ_RID
, ctlr
->r_irq
);
280 bus_release_resource(dev
, ctlr
->r_type2
, ctlr
->r_rid2
, ctlr
->r_res2
);
282 bus_release_resource(dev
, ctlr
->r_type1
, ctlr
->r_rid1
, ctlr
->r_res1
);
288 ata_pci_alloc_resource(device_t dev
, device_t child
, int type
, int *rid
,
289 u_long start
, u_long end
, u_long count
, u_int flags
)
291 struct ata_pci_controller
*controller
= device_get_softc(dev
);
292 int unit
= ((struct ata_channel
*)device_get_softc(child
))->unit
;
293 struct resource
*res
= NULL
;
296 if (type
== SYS_RES_IOPORT
) {
299 if (ata_legacy(dev
)) {
300 start
= (unit
? ATA_SECONDARY
: ATA_PRIMARY
);
302 end
= start
+ count
- 1;
304 myrid
= PCIR_BAR(0) + (unit
<< 3);
305 res
= BUS_ALLOC_RESOURCE(device_get_parent(dev
), dev
,
306 SYS_RES_IOPORT
, &myrid
,
307 start
, end
, count
, flags
);
310 case ATA_CTLADDR_RID
:
311 if (ata_legacy(dev
)) {
312 start
= (unit
? ATA_SECONDARY
: ATA_PRIMARY
) + ATA_CTLOFFSET
;
313 count
= ATA_CTLIOSIZE
;
314 end
= start
+ count
- 1;
316 myrid
= PCIR_BAR(1) + (unit
<< 3);
317 res
= BUS_ALLOC_RESOURCE(device_get_parent(dev
), dev
,
318 SYS_RES_IOPORT
, &myrid
,
319 start
, end
, count
, flags
);
323 if (type
== SYS_RES_IRQ
&& *rid
== ATA_IRQ_RID
) {
324 if (ata_legacy(dev
)) {
325 int irq
= (unit
== 0 ? 14 : 15);
327 res
= BUS_ALLOC_RESOURCE(device_get_parent(dev
), child
,
328 SYS_RES_IRQ
, rid
, irq
, irq
, 1, flags
);
331 res
= controller
->r_irq
;
337 ata_pci_release_resource(device_t dev
, device_t child
, int type
, int rid
,
340 int unit
= ((struct ata_channel
*)device_get_softc(child
))->unit
;
342 if (type
== SYS_RES_IOPORT
) {
345 return BUS_RELEASE_RESOURCE(device_get_parent(dev
), dev
,
347 PCIR_BAR(0) + (unit
<< 3), r
);
350 case ATA_CTLADDR_RID
:
351 return BUS_RELEASE_RESOURCE(device_get_parent(dev
), dev
,
353 PCIR_BAR(1) + (unit
<< 3), r
);
359 if (type
== SYS_RES_IRQ
) {
360 if (rid
!= ATA_IRQ_RID
)
363 if (ata_legacy(dev
)) {
364 return BUS_RELEASE_RESOURCE(device_get_parent(dev
), child
,
365 SYS_RES_IRQ
, rid
, r
);
374 ata_pci_setup_intr(device_t dev
, device_t child
, struct resource
*irq
,
375 int flags
, driver_intr_t
*function
, void *argument
,
378 if (ata_legacy(dev
)) {
379 return BUS_SETUP_INTR(device_get_parent(dev
), child
, irq
,
380 flags
, function
, argument
, cookiep
, NULL
);
383 struct ata_pci_controller
*controller
= device_get_softc(dev
);
384 int unit
= ((struct ata_channel
*)device_get_softc(child
))->unit
;
386 controller
->interrupt
[unit
].function
= function
;
387 controller
->interrupt
[unit
].argument
= argument
;
388 *cookiep
= controller
;
394 ata_pci_teardown_intr(device_t dev
, device_t child
, struct resource
*irq
,
397 if (ata_legacy(dev
)) {
398 return BUS_TEARDOWN_INTR(device_get_parent(dev
), child
, irq
, cookie
);
401 struct ata_pci_controller
*controller
= device_get_softc(dev
);
402 int unit
= ((struct ata_channel
*)device_get_softc(child
))->unit
;
404 controller
->interrupt
[unit
].function
= NULL
;
405 controller
->interrupt
[unit
].argument
= NULL
;
411 ata_pci_allocate(device_t dev
)
413 struct ata_pci_controller
*ctlr
= device_get_softc(device_get_parent(dev
));
414 struct ata_channel
*ch
= device_get_softc(dev
);
415 struct resource
*io
= NULL
, *ctlio
= NULL
;
418 rid
= ATA_IOADDR_RID
;
419 if (!(io
= bus_alloc_resource_any(dev
, SYS_RES_IOPORT
, &rid
, RF_ACTIVE
)))
422 rid
= ATA_CTLADDR_RID
;
423 if (!(ctlio
= bus_alloc_resource_any(dev
, SYS_RES_IOPORT
, &rid
,RF_ACTIVE
))){
424 bus_release_resource(dev
, SYS_RES_IOPORT
, ATA_IOADDR_RID
, io
);
428 for (i
= ATA_DATA
; i
<= ATA_COMMAND
; i
++) {
429 ch
->r_io
[i
].res
= io
;
430 ch
->r_io
[i
].offset
= i
;
432 ch
->r_io
[ATA_CONTROL
].res
= ctlio
;
433 ch
->r_io
[ATA_CONTROL
].offset
= ata_legacy(device_get_parent(dev
)) ? 0 : 2;
434 ch
->r_io
[ATA_IDX_ADDR
].res
= io
;
435 ata_default_registers(dev
);
437 for (i
= ATA_BMCMD_PORT
; i
<= ATA_BMDTP_PORT
; i
++) {
438 ch
->r_io
[i
].res
= ctlr
->r_res1
;
439 ch
->r_io
[i
].offset
= (i
- ATA_BMCMD_PORT
) + (ch
->unit
*ATA_BMIOSIZE
);
448 ata_pci_hw(device_t dev
)
450 struct ata_channel
*ch
= device_get_softc(dev
);
453 ch
->hw
.status
= ata_pci_status
;
457 ata_pci_status(device_t dev
)
459 struct ata_channel
*ch
= device_get_softc(dev
);
461 if ((dumping
|| !ata_legacy(device_get_parent(dev
))) &&
462 ch
->dma
&& ((ch
->flags
& ATA_ALWAYS_DMASTAT
) ||
463 (ch
->dma
->flags
& ATA_DMA_ACTIVE
))) {
464 int bmstat
= ATA_IDX_INB(ch
, ATA_BMSTAT_PORT
) & ATA_BMSTAT_MASK
;
466 if ((bmstat
& (ATA_BMSTAT_ACTIVE
| ATA_BMSTAT_INTERRUPT
)) !=
467 ATA_BMSTAT_INTERRUPT
)
469 ATA_IDX_OUTB(ch
, ATA_BMSTAT_PORT
, bmstat
& ~ATA_BMSTAT_ERROR
);
472 if (ATA_IDX_INB(ch
, ATA_ALTSTAT
) & ATA_S_BUSY
) {
474 if (ATA_IDX_INB(ch
, ATA_ALTSTAT
) & ATA_S_BUSY
)
481 ata_pci_dmastart(device_t dev
)
483 struct ata_channel
*ch
= device_get_softc(device_get_parent(dev
));
486 ATA_IDX_OUTB(ch
, ATA_BMSTAT_PORT
, (ATA_IDX_INB(ch
, ATA_BMSTAT_PORT
) |
487 (ATA_BMSTAT_INTERRUPT
| ATA_BMSTAT_ERROR
)));
488 ATA_IDX_OUTL(ch
, ATA_BMDTP_PORT
, ch
->dma
->sg_bus
);
489 ch
->dma
->flags
|= ATA_DMA_ACTIVE
;
490 val
= ATA_IDX_INB(ch
, ATA_BMCMD_PORT
);
491 if (ch
->dma
->flags
& ATA_DMA_READ
)
492 val
|= ATA_BMCMD_WRITE_READ
;
494 val
&= ~ATA_BMCMD_WRITE_READ
;
495 ATA_IDX_OUTB(ch
, ATA_BMCMD_PORT
, val
);
498 * Issue the start command separately from configuration setup,
499 * in case the hardware latches portions of the configuration.
501 ATA_IDX_OUTB(ch
, ATA_BMCMD_PORT
, val
| ATA_BMCMD_START_STOP
);
507 ata_pci_dmastop(device_t dev
)
509 struct ata_channel
*ch
= device_get_softc(device_get_parent(dev
));
512 ATA_IDX_OUTB(ch
, ATA_BMCMD_PORT
,
513 ATA_IDX_INB(ch
, ATA_BMCMD_PORT
) & ~ATA_BMCMD_START_STOP
);
514 ch
->dma
->flags
&= ~ATA_DMA_ACTIVE
;
515 error
= ATA_IDX_INB(ch
, ATA_BMSTAT_PORT
) & ATA_BMSTAT_MASK
;
516 ATA_IDX_OUTB(ch
, ATA_BMSTAT_PORT
, ATA_BMSTAT_INTERRUPT
| ATA_BMSTAT_ERROR
);
521 ata_pci_dmareset(device_t dev
)
523 struct ata_channel
*ch
= device_get_softc(dev
);
525 ATA_IDX_OUTB(ch
, ATA_BMCMD_PORT
,
526 ATA_IDX_INB(ch
, ATA_BMCMD_PORT
) & ~ATA_BMCMD_START_STOP
);
527 ch
->dma
->flags
&= ~ATA_DMA_ACTIVE
;
528 ATA_IDX_OUTB(ch
, ATA_BMSTAT_PORT
, ATA_BMSTAT_INTERRUPT
| ATA_BMSTAT_ERROR
);
529 ch
->dma
->unload(dev
);
533 ata_pci_dmainit(device_t dev
)
535 struct ata_channel
*ch
= device_get_softc(dev
);
539 ch
->dma
->start
= ata_pci_dmastart
;
540 ch
->dma
->stop
= ata_pci_dmastop
;
541 ch
->dma
->reset
= ata_pci_dmareset
;
546 ata_pcivendor2str(device_t dev
)
548 switch (pci_get_vendor(dev
)) {
549 case ATA_ACARD_ID
: return "Acard";
550 case ATA_ACER_LABS_ID
: return "AcerLabs";
551 case ATA_AMD_ID
: return "AMD";
552 case ATA_ATI_ID
: return "ATI";
553 case ATA_CYRIX_ID
: return "Cyrix";
554 case ATA_CYPRESS_ID
: return "Cypress";
555 case ATA_HIGHPOINT_ID
: return "HighPoint";
556 case ATA_INTEL_ID
: return "Intel";
557 case ATA_ITE_ID
: return "ITE";
558 case ATA_JMICRON_ID
: return "JMicron";
559 case ATA_MARVELL_ID
: return "Marvell";
560 case ATA_NATIONAL_ID
: return "National";
561 case ATA_NETCELL_ID
: return "Netcell";
562 case ATA_NVIDIA_ID
: return "nVidia";
563 case ATA_PROMISE_ID
: return "Promise";
564 case ATA_SERVERWORKS_ID
: return "ServerWorks";
565 case ATA_SILICON_IMAGE_ID
: return "SiI";
566 case ATA_SIS_ID
: return "SiS";
567 case ATA_VIA_ID
: return "VIA";
568 case ATA_CENATEK_ID
: return "Cenatek";
569 case ATA_MICRON_ID
: return "Micron";
570 default: return "Generic";
574 static device_method_t ata_pci_methods
[] = {
575 /* device interface */
576 DEVMETHOD(device_probe
, ata_pci_probe
),
577 DEVMETHOD(device_attach
, ata_pci_attach
),
578 DEVMETHOD(device_detach
, ata_pci_detach
),
579 DEVMETHOD(device_shutdown
, bus_generic_shutdown
),
580 DEVMETHOD(device_suspend
, bus_generic_suspend
),
581 DEVMETHOD(device_resume
, bus_generic_resume
),
584 DEVMETHOD(bus_alloc_resource
, ata_pci_alloc_resource
),
585 DEVMETHOD(bus_release_resource
, ata_pci_release_resource
),
586 DEVMETHOD(bus_activate_resource
, bus_generic_activate_resource
),
587 DEVMETHOD(bus_deactivate_resource
, bus_generic_deactivate_resource
),
588 DEVMETHOD(bus_setup_intr
, ata_pci_setup_intr
),
589 DEVMETHOD(bus_teardown_intr
, ata_pci_teardown_intr
),
594 devclass_t atapci_devclass
;
596 static driver_t ata_pci_driver
= {
599 sizeof(struct ata_pci_controller
),
602 DRIVER_MODULE(atapci
, pci
, ata_pci_driver
, atapci_devclass
, 0, 0);
603 MODULE_VERSION(atapci
, 1);
604 MODULE_DEPEND(atapci
, ata
, 1, 1, 1);
607 ata_pcichannel_probe(device_t dev
)
609 struct ata_channel
*ch
= device_get_softc(dev
);
614 /* take care of green memory */
615 bzero(ch
, sizeof(struct ata_channel
));
617 /* find channel number on this controller */
618 device_get_children(device_get_parent(dev
), &children
, &count
);
619 for (i
= 0; i
< count
; i
++) {
620 if (children
[i
] == dev
)
623 kfree(children
, M_TEMP
);
625 ksprintf(buffer
, "ATA channel %d", ch
->unit
);
626 device_set_desc_copy(dev
, buffer
);
628 return ata_probe(dev
);
632 ata_pcichannel_attach(device_t dev
)
634 struct ata_pci_controller
*ctlr
= device_get_softc(device_get_parent(dev
));
635 struct ata_channel
*ch
= device_get_softc(dev
);
643 if ((error
= ctlr
->allocate(dev
))) {
649 return ata_attach(dev
);
653 ata_pcichannel_detach(device_t dev
)
655 struct ata_channel
*ch
= device_get_softc(dev
);
658 if ((error
= ata_detach(dev
)))
664 /* XXX SOS free resources for io and ctlio ?? */
670 ata_pcichannel_locking(device_t dev
, int mode
)
672 struct ata_pci_controller
*ctlr
= device_get_softc(device_get_parent(dev
));
673 struct ata_channel
*ch
= device_get_softc(dev
);
676 return ctlr
->locking(dev
, mode
);
682 ata_pcichannel_reset(device_t dev
)
684 struct ata_pci_controller
*ctlr
= device_get_softc(device_get_parent(dev
));
685 struct ata_channel
*ch
= device_get_softc(dev
);
687 /* if DMA engine present reset it */
691 ch
->dma
->unload(dev
);
694 /* reset the controller HW */
698 ata_generic_reset(dev
);
702 ata_pcichannel_setmode(device_t parent
, device_t dev
)
704 struct ata_pci_controller
*ctlr
= device_get_softc(GRANDPARENT(dev
));
705 struct ata_device
*atadev
= device_get_softc(dev
);
706 int mode
= atadev
->mode
;
708 ctlr
->setmode(dev
, ATA_PIO_MAX
);
710 ctlr
->setmode(dev
, mode
);
713 static device_method_t ata_pcichannel_methods
[] = {
714 /* device interface */
715 DEVMETHOD(device_probe
, ata_pcichannel_probe
),
716 DEVMETHOD(device_attach
, ata_pcichannel_attach
),
717 DEVMETHOD(device_detach
, ata_pcichannel_detach
),
718 DEVMETHOD(device_shutdown
, bus_generic_shutdown
),
719 DEVMETHOD(device_suspend
, ata_suspend
),
720 DEVMETHOD(device_resume
, ata_resume
),
723 DEVMETHOD(ata_setmode
, ata_pcichannel_setmode
),
724 DEVMETHOD(ata_locking
, ata_pcichannel_locking
),
725 DEVMETHOD(ata_reset
, ata_pcichannel_reset
),
730 driver_t ata_pcichannel_driver
= {
732 ata_pcichannel_methods
,
733 sizeof(struct ata_channel
),
736 DRIVER_MODULE(ata
, atapci
, ata_pcichannel_driver
, ata_devclass
, 0, 0);