1*cbab9cadSchs /* $NetBSD: pciide_machdep.c,v 1.8 2012/10/27 17:18:05 chs Exp $ */
2dba1f1b7Smatt
3dba1f1b7Smatt /*
4dba1f1b7Smatt * Copyright (c) 1998 Christopher G. Demetriou. All rights reserved.
5dba1f1b7Smatt *
6dba1f1b7Smatt * Redistribution and use in source and binary forms, with or without
7dba1f1b7Smatt * modification, are permitted provided that the following conditions
8dba1f1b7Smatt * are met:
9dba1f1b7Smatt * 1. Redistributions of source code must retain the above copyright
10dba1f1b7Smatt * notice, this list of conditions and the following disclaimer.
11dba1f1b7Smatt * 2. Redistributions in binary form must reproduce the above copyright
12dba1f1b7Smatt * notice, this list of conditions and the following disclaimer in the
13dba1f1b7Smatt * documentation and/or other materials provided with the distribution.
14dba1f1b7Smatt * 3. All advertising materials mentioning features or use of this software
15dba1f1b7Smatt * must display the following acknowledgement:
16dba1f1b7Smatt * This product includes software developed by Christopher G. Demetriou
17dba1f1b7Smatt * for the NetBSD Project.
18dba1f1b7Smatt * 4. The name of the author may not be used to endorse or promote products
19dba1f1b7Smatt * derived from this software without specific prior written permission
20dba1f1b7Smatt *
21dba1f1b7Smatt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22dba1f1b7Smatt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23dba1f1b7Smatt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24dba1f1b7Smatt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25dba1f1b7Smatt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26dba1f1b7Smatt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27dba1f1b7Smatt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28dba1f1b7Smatt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29dba1f1b7Smatt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30dba1f1b7Smatt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31dba1f1b7Smatt */
32dba1f1b7Smatt
33dba1f1b7Smatt /*
34dba1f1b7Smatt * PCI IDE controller driver (arm32 machine-dependent portion).
35dba1f1b7Smatt *
36dba1f1b7Smatt * Author: Christopher G. Demetriou, March 2, 1998 (derived from NetBSD
37dba1f1b7Smatt * sys/dev/pci/ppb.c, revision 1.16).
38dba1f1b7Smatt *
39dba1f1b7Smatt * See "PCI IDE Controller Specification, Revision 1.0 3/4/94" from the
40dba1f1b7Smatt * PCI SIG.
41dba1f1b7Smatt */
42dba1f1b7Smatt
43ed517291Slukem #include <sys/cdefs.h>
44*cbab9cadSchs __KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.8 2012/10/27 17:18:05 chs Exp $");
45ed517291Slukem
46dba1f1b7Smatt #include <sys/param.h>
47dba1f1b7Smatt #include <sys/systm.h>
48dba1f1b7Smatt #include <sys/device.h>
49dba1f1b7Smatt
50dba1f1b7Smatt #include <dev/pci/pcireg.h>
51dba1f1b7Smatt #include <dev/pci/pcivar.h>
52dba1f1b7Smatt #include <dev/pci/pciidereg.h>
53dba1f1b7Smatt #include <dev/pci/pciidevar.h>
54dba1f1b7Smatt
55dba1f1b7Smatt #include <dev/isa/isavar.h>
56dba1f1b7Smatt #include <machine/intr.h>
57dba1f1b7Smatt #include "isa.h"
58dba1f1b7Smatt
59dba1f1b7Smatt void *
pciide_machdep_compat_intr_establish(device_t dev,const struct pci_attach_args * pa,int chan,int (* func)(void *),void * arg)60*cbab9cadSchs pciide_machdep_compat_intr_establish(device_t dev,
61d3e53912Sdyoung const struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg)
62dba1f1b7Smatt {
63dba1f1b7Smatt #if NISA > 0
64dba1f1b7Smatt int irq;
65dba1f1b7Smatt void *cookie;
66dba1f1b7Smatt
67dba1f1b7Smatt irq = PCIIDE_COMPAT_IRQ(chan);
68dba1f1b7Smatt cookie = isa_intr_establish(NULL, irq, IST_EDGE, IPL_BIO, func, arg);
69dba1f1b7Smatt if (cookie == NULL)
70dba1f1b7Smatt return (NULL);
71*cbab9cadSchs printf("%s: %s channel interrupting at irq %d\n", device_xname(dev),
72dba1f1b7Smatt PCIIDE_CHANNEL_NAME(chan), irq);
73dba1f1b7Smatt return (cookie);
74dba1f1b7Smatt #else
750f09ed48Sprovos panic("pciide_machdep_compat_intr_establish() called");
76dba1f1b7Smatt #endif
77dba1f1b7Smatt }
78