1*cbab9cadSchs /* $NetBSD: pciide_machdep.c,v 1.10 2012/10/27 17:17:44 chs Exp $ */
24c547143Ssoren
34c547143Ssoren /*
44c547143Ssoren * Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
54c547143Ssoren *
64c547143Ssoren * Redistribution and use in source and binary forms, with or without
74c547143Ssoren * modification, are permitted provided that the following conditions
84c547143Ssoren * are met:
94c547143Ssoren * 1. Redistributions of source code must retain the above copyright
104c547143Ssoren * notice, this list of conditions, and the following disclaimer.
114c547143Ssoren * 2. Redistributions in binary form must reproduce the above copyright
124c547143Ssoren * notice, this list of conditions and the following disclaimer in the
134c547143Ssoren * documentation and/or other materials provided with the distribution.
144c547143Ssoren *
154c547143Ssoren * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
164c547143Ssoren * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
174c547143Ssoren * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
184c547143Ssoren * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
194c547143Ssoren * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
204c547143Ssoren * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
214c547143Ssoren * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
224c547143Ssoren * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
234c547143Ssoren * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
244c547143Ssoren * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
254c547143Ssoren * SUCH DAMAGE.
264c547143Ssoren */
274c547143Ssoren
28e803bea7Slukem #include <sys/cdefs.h>
29*cbab9cadSchs __KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.10 2012/10/27 17:17:44 chs Exp $");
30e803bea7Slukem
314c547143Ssoren #include <sys/param.h>
324c547143Ssoren #include <sys/device.h>
33f93ad4c3Smatt #include <sys/intr.h>
34f93ad4c3Smatt #include <sys/systm.h>
354c547143Ssoren
364c547143Ssoren #include <dev/pci/pcireg.h>
374c547143Ssoren #include <dev/pci/pcivar.h>
384c547143Ssoren #include <dev/pci/pciidereg.h>
394c547143Ssoren #include <dev/pci/pciidevar.h>
404c547143Ssoren
414c547143Ssoren void *
pciide_machdep_compat_intr_establish(device_t dev,const struct pci_attach_args * pa,int chan,int (* func)(void *),void * arg)42*cbab9cadSchs pciide_machdep_compat_intr_establish(device_t dev,
43a184f1f4Sdyoung const struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg)
444c547143Ssoren {
454c547143Ssoren int irq;
464c547143Ssoren void *cookie;
474c547143Ssoren
484c547143Ssoren irq = PCIIDE_COMPAT_IRQ(chan);
49278498c0Ssoren cookie = icu_intr_establish(irq, IST_EDGE, IPL_BIO, func, arg);
504c547143Ssoren if (cookie == NULL)
51f8b22821Stsutsui return NULL;
52*cbab9cadSchs printf("%s: %s channel interrupting at irq %d\n", device_xname(dev),
534c547143Ssoren PCIIDE_CHANNEL_NAME(chan), irq);
54f8b22821Stsutsui return cookie;
554c547143Ssoren }
56