xref: /netbsd-src/sys/arch/i386/pci/pcic_pci_machdep.c (revision cbab9cadce21ae72fac13910001079fff214cc29)
1*cbab9cadSchs /*	$NetBSD: pcic_pci_machdep.c,v 1.10 2012/10/27 17:17:57 chs Exp $	*/
2788ff053Snathanw 
3788ff053Snathanw /*
4788ff053Snathanw  * Copyright (c) 1998 The NetBSD Foundation, Inc.
5788ff053Snathanw  * All rights reserved.
6788ff053Snathanw  *
7788ff053Snathanw  * Redistribution and use in source and binary forms, with or without
8788ff053Snathanw  * modification, are permitted provided that the following conditions
9788ff053Snathanw  * are met:
10788ff053Snathanw  * 1. Redistributions of source code must retain the above copyright
11788ff053Snathanw  *    notice, this list of conditions and the following disclaimer.
12788ff053Snathanw  * 2. Redistributions in binary form must reproduce the above copyright
13788ff053Snathanw  *    notice, this list of conditions and the following disclaimer in the
14788ff053Snathanw  *    documentation and/or other materials provided with the distribution.
15788ff053Snathanw  *
16788ff053Snathanw  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17788ff053Snathanw  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18788ff053Snathanw  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19788ff053Snathanw  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20788ff053Snathanw  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21788ff053Snathanw  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22788ff053Snathanw  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23788ff053Snathanw  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24788ff053Snathanw  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25788ff053Snathanw  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26788ff053Snathanw  * POSSIBILITY OF SUCH DAMAGE.
27788ff053Snathanw  */
28788ff053Snathanw 
2995c969f2Slukem #include <sys/cdefs.h>
30*cbab9cadSchs __KERNEL_RCSID(0, "$NetBSD: pcic_pci_machdep.c,v 1.10 2012/10/27 17:17:57 chs Exp $");
3195c969f2Slukem 
32788ff053Snathanw #include <sys/param.h>
33788ff053Snathanw #include <sys/systm.h>
34788ff053Snathanw #include <sys/device.h>
35788ff053Snathanw 
36788ff053Snathanw #include <dev/pcmcia/pcmciachip.h>
37788ff053Snathanw #include <dev/ic/i82365reg.h>
38788ff053Snathanw #include <dev/ic/i82365var.h>
39788ff053Snathanw 
40788ff053Snathanw #include <dev/isa/isavar.h>
41788ff053Snathanw #include <dev/isa/i82365_isavar.h>
42788ff053Snathanw 
43788ff053Snathanw #include <dev/pci/pcivar.h>
44788ff053Snathanw #include <dev/pci/i82365_pcivar.h>
45788ff053Snathanw 
46788ff053Snathanw extern int pcic_isa_intr_alloc_mask;
47788ff053Snathanw 
48788ff053Snathanw void *
pcic_pci_machdep_intr_est(pci_chipset_tag_t pc)49168cd830Schristos pcic_pci_machdep_intr_est(pci_chipset_tag_t pc)
50788ff053Snathanw {
51788ff053Snathanw 	return NULL;
52788ff053Snathanw }
53788ff053Snathanw 
54788ff053Snathanw void *
pcic_pci_machdep_pcic_intr_establish(struct pcic_softc * sc,int (* fct)(void *))5535adf403Sperry pcic_pci_machdep_pcic_intr_establish(struct pcic_softc *sc, int (*fct)(void *))
56788ff053Snathanw {
57788ff053Snathanw 	if (isa_intr_alloc(NULL, PCIC_CSC_INTR_IRQ_VALIDMASK &
58788ff053Snathanw 			   pcic_isa_intr_alloc_mask, IST_EDGE, &(sc->irq)))
59788ff053Snathanw 		return (NULL);
60*cbab9cadSchs 	aprint_normal_dev(sc->dev, "interrupting at irq %d\n", sc->irq);
61788ff053Snathanw 	return (isa_intr_establish(NULL, sc->irq, IST_EDGE, IPL_TTY,
62788ff053Snathanw 				   fct, sc));
63788ff053Snathanw }
64788ff053Snathanw 
65788ff053Snathanw void *
pcic_pci_machdep_chip_intr_establish(pcmcia_chipset_handle_t pch,struct pcmcia_function * pf,int ipl,int (* fct)(void *),void * arg)6635adf403Sperry pcic_pci_machdep_chip_intr_establish(pcmcia_chipset_handle_t pch,
6735adf403Sperry     struct pcmcia_function *pf, int ipl, int (*fct)(void *), void *arg)
68788ff053Snathanw {
69788ff053Snathanw 	return (pcic_isa_chip_intr_establish(pch, pf, ipl, fct, arg));
70788ff053Snathanw }
71788ff053Snathanw 
72788ff053Snathanw void
pcic_pci_machdep_chip_intr_disestablish(pcmcia_chipset_handle_t pch,void * ih)7335adf403Sperry pcic_pci_machdep_chip_intr_disestablish(pcmcia_chipset_handle_t pch, void *ih)
74788ff053Snathanw {
75788ff053Snathanw 	pcic_isa_chip_intr_disestablish(pch, ih);
76788ff053Snathanw }
77