xref: /netbsd-src/sys/arch/cats/pci/pciide_machdep.c (revision cbab9cadce21ae72fac13910001079fff214cc29)
1*cbab9cadSchs /*	$NetBSD: pciide_machdep.c,v 1.8 2012/10/27 17:17:43 chs Exp $	*/
20a162278Schris 
30a162278Schris /*
40a162278Schris  * Copyright (c) 1998 Christopher G. Demetriou.  All rights reserved.
50a162278Schris  *
60a162278Schris  * Redistribution and use in source and binary forms, with or without
70a162278Schris  * modification, are permitted provided that the following conditions
80a162278Schris  * are met:
90a162278Schris  * 1. Redistributions of source code must retain the above copyright
100a162278Schris  *    notice, this list of conditions and the following disclaimer.
110a162278Schris  * 2. Redistributions in binary form must reproduce the above copyright
120a162278Schris  *    notice, this list of conditions and the following disclaimer in the
130a162278Schris  *    documentation and/or other materials provided with the distribution.
140a162278Schris  * 3. All advertising materials mentioning features or use of this software
150a162278Schris  *    must display the following acknowledgement:
160a162278Schris  *      This product includes software developed by Christopher G. Demetriou
170a162278Schris  *	for the NetBSD Project.
180a162278Schris  * 4. The name of the author may not be used to endorse or promote products
190a162278Schris  *    derived from this software without specific prior written permission
200a162278Schris  *
210a162278Schris  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
220a162278Schris  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
230a162278Schris  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
240a162278Schris  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
250a162278Schris  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
260a162278Schris  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
270a162278Schris  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
280a162278Schris  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
290a162278Schris  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
300a162278Schris  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
310a162278Schris  */
320a162278Schris 
330a162278Schris /*
340a162278Schris  * PCI IDE controller driver (arm32 machine-dependent portion).
350a162278Schris  *
360a162278Schris  * Author: Christopher G. Demetriou, March 2, 1998 (derived from NetBSD
370a162278Schris  * sys/dev/pci/ppb.c, revision 1.16).
380a162278Schris  *
390a162278Schris  * See "PCI IDE Controller Specification, Revision 1.0 3/4/94" from the
400a162278Schris  * PCI SIG.
410a162278Schris  */
420a162278Schris 
43e803bea7Slukem #include <sys/cdefs.h>
44*cbab9cadSchs __KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.8 2012/10/27 17:17:43 chs Exp $");
45e803bea7Slukem 
460a162278Schris #include <sys/param.h>
470a162278Schris #include <sys/systm.h>
480a162278Schris #include <sys/device.h>
490a162278Schris 
500a162278Schris #include <dev/pci/pcireg.h>
510a162278Schris #include <dev/pci/pcivar.h>
520a162278Schris #include <dev/pci/pciidereg.h>
530a162278Schris #include <dev/pci/pciidevar.h>
540a162278Schris 
550a162278Schris #include <dev/isa/isavar.h>
560a162278Schris #include <machine/intr.h>
570a162278Schris #include "isa.h"
580a162278Schris 
590a162278Schris 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,
61a184f1f4Sdyoung     const struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg)
620a162278Schris {
630a162278Schris #if NISA > 0
640a162278Schris 	int irq;
650a162278Schris 	void *cookie;
660a162278Schris 
670a162278Schris 	irq = PCIIDE_COMPAT_IRQ(chan);
680a162278Schris 	cookie = isa_intr_establish(NULL, irq, IST_EDGE, IPL_BIO, func, arg);
690a162278Schris 	if (cookie == NULL)
700a162278Schris 		return (NULL);
71*cbab9cadSchs 	printf("%s: %s channel interrupting at irq %d\n", device_xname(dev),
720a162278Schris 	    PCIIDE_CHANNEL_NAME(chan), irq);
730a162278Schris 	return (cookie);
740a162278Schris #else
750f09ed48Sprovos 	panic("pciide_machdep_compat_intr_establish() called");
760a162278Schris #endif
770a162278Schris }
78