xref: /netbsd-src/sys/arch/evbarm/integrator/pci_machdep.c (revision 934f5fa97ba9f772a8caecfcac7ee201f35bb856)
1*934f5fa9Sthorpej /*	$NetBSD: pci_machdep.c,v 1.7 2020/06/17 06:55:42 thorpej Exp $ */
265f54d13Srearnsha 
365f54d13Srearnsha /*-
465f54d13Srearnsha  * Copyright (c) 2001 ARM Ltd
565f54d13Srearnsha  * All rights reserved.
665f54d13Srearnsha  *
765f54d13Srearnsha  * Redistribution and use in source and binary forms, with or without
865f54d13Srearnsha  * modification, are permitted provided that the following conditions
965f54d13Srearnsha  * are met:
1065f54d13Srearnsha  * 1. Redistributions of source code must retain the above copyright
1165f54d13Srearnsha  *    notice, this list of conditions and the following disclaimer.
1265f54d13Srearnsha  * 2. Redistributions in binary form must reproduce the above copyright
1365f54d13Srearnsha  *    notice, this list of conditions and the following disclaimer in the
1465f54d13Srearnsha  *    documentation and/or other materials provided with the distribution.
1565f54d13Srearnsha  * 3. The name of the company may not be used to endorse or promote
1665f54d13Srearnsha  *    products derived from this software without specific prior written
1765f54d13Srearnsha  *    permission.
1865f54d13Srearnsha  *
1965f54d13Srearnsha  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
2065f54d13Srearnsha  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
2165f54d13Srearnsha  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2265f54d13Srearnsha  * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
2365f54d13Srearnsha  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2465f54d13Srearnsha  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2565f54d13Srearnsha  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2665f54d13Srearnsha  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2765f54d13Srearnsha  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2865f54d13Srearnsha  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2965f54d13Srearnsha  * SUCH DAMAGE.
3065f54d13Srearnsha  */
3165f54d13Srearnsha 
3208716eaeSlukem #include <sys/cdefs.h>
33*934f5fa9Sthorpej __KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.7 2020/06/17 06:55:42 thorpej Exp $");
3408716eaeSlukem 
35825088edSmatt #include <sys/param.h>
3665f54d13Srearnsha #include <sys/types.h>
3765f54d13Srearnsha #include <sys/device.h>
3865f54d13Srearnsha #include <sys/systm.h>
39825088edSmatt #include <sys/cpu.h>
4065f54d13Srearnsha 
4165f54d13Srearnsha #include <dev/pci/pcivar.h>
4265f54d13Srearnsha #include <dev/pci/pciconf.h>
4365f54d13Srearnsha 
4465f54d13Srearnsha #include <evbarm/ifpga/ifpgareg.h>
45543f108cSmatt #include <evbarm/ifpga/ifpga_pcivar.h>
4665f54d13Srearnsha 
4765f54d13Srearnsha void
ifpga_pci_conf_interrupt(void * v,int bus,int dev,int ipin,int swiz,int * iline)48543f108cSmatt ifpga_pci_conf_interrupt(void *v, int bus, int dev, int ipin, int swiz, int *iline)
4965f54d13Srearnsha {
501bf0c8b1Smatt 	printf("pci_conf_interrupt(v(%p), bus(%d), dev(%d), ipin(%d), swiz(%d), *iline(%p)\n", v, bus, dev, ipin, swiz, iline);
5165f54d13Srearnsha         if (dev >= 9)
5265f54d13Srearnsha 		*iline = IFPGA_INTRNUM_PCIINT0
531bf0c8b1Smatt 		    + (((dev - 9) + (ipin - 1)) & 3);
5465f54d13Srearnsha }
55