Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / evbarm / ixm1200 / ixm1200_pci.c
blob92832e3375578ec5accb1935e4980a7c6a66edce
1 /* $NetBSD: ixm1200_pci.c,v 1.6 2009/03/16 23:11:11 dsl Exp $ */
2 #define PCI_DEBUG
3 /*
4 * Copyright (c) 2002, 2003
5 * Ichiro FUKUHARA <ichiro@ichiro.org>.
6 * All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR
21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
30 #include <sys/cdefs.h>
31 __KERNEL_RCSID(0, "$NetBSD: ixm1200_pci.c,v 1.6 2009/03/16 23:11:11 dsl Exp $");
34 * IXM1200 PCI interrupt support.
37 #include <sys/param.h>
38 #include <sys/systm.h>
39 #include <sys/device.h>
41 #include <machine/autoconf.h>
42 #include <machine/bus.h>
44 #include <evbarm/ixm1200/ixm1200reg.h>
45 #include <evbarm/ixm1200/ixm1200var.h>
47 #include <arm/ixp12x0/ixp12x0reg.h>
48 #include <arm/ixp12x0/ixp12x0var.h>
50 #include <arm/ixp12x0/ixp12x0_pcireg.h>
52 #include <dev/pci/pcidevs.h>
53 #include <dev/pci/ppbreg.h>
55 int ixm1200_pci_intr_map(struct pci_attach_args *, pci_intr_handle_t *);
56 const char *ixm1200_pci_intr_string(void *, pci_intr_handle_t);
57 const struct evcnt *ixm1200_pci_intr_evcnt(void *, pci_intr_handle_t);
58 void *ixm1200_pci_intr_establish(void *, pci_intr_handle_t, int,
59 int (*func)(void *), void *);
60 void ixm1200_pci_intr_disestablish(void *, void *);
62 void
63 ixm1200_pci_init(pci_chipset_tag_t pc, void *cookie)
65 pc->pc_intr_v = cookie;
66 pc->pc_intr_map = ixm1200_pci_intr_map;
67 pc->pc_intr_string = ixm1200_pci_intr_string;
68 pc->pc_intr_evcnt = ixm1200_pci_intr_evcnt;
69 pc->pc_intr_establish = ixm1200_pci_intr_establish;
70 pc->pc_intr_disestablish = ixm1200_pci_intr_disestablish;
73 int
74 ixm1200_pci_intr_map(struct pci_attach_args *pa, pci_intr_handle_t *ihp)
76 #ifdef PCI_DEBUG
77 void *v = pa->pa_pc;
78 int pin = pa->pa_intrpin;
79 int line = pa->pa_intrline;
80 int dev=pa->pa_device;
81 pcitag_t intrtag = pa->pa_intrtag;
83 printf("ixm1200_pci_intr_map: v=%p, tag=%08lx intrpin=%d line=%d dev=%d\n",
84 v, intrtag, pin, line, dev);
85 #endif
87 /* ixp12x0 has only one interrupt line for PCI */
88 *ihp = IXPPCI_INTR_PIL;
89 return (0);
92 const char *
93 ixm1200_pci_intr_string(void *v, pci_intr_handle_t ih)
95 static char irqstr[IRQNAMESIZE];
97 sprintf(irqstr, "IXM1200 irq %ld", ih);
98 return (irqstr);
101 const struct evcnt *
102 ixm1200_pci_intr_evcnt(void *v, pci_intr_handle_t ih)
104 return (NULL);
107 void *
108 ixm1200_pci_intr_establish(void *v, pci_intr_handle_t ih, int ipl, int (*func)(void *), void *arg)
110 #ifdef PCI_DEBUG
111 printf("ixm1200_pci_intr_establish(v=%p, irq=%d, ipl=%d, func=%p, arg=%p)\n",
112 v, (int) ih, ipl, func, arg);
113 #endif
115 return (ixp12x0_intr_establish(ih, ipl, func, arg));
118 void
119 ixm1200_pci_intr_disestablish(void *v, void *cookie)
121 #ifdef PCI_DEBUG
122 printf("ixm1200_pci_intr_disestablish(v=%p, cookie=%p)\n",
123 v, cookie);
124 #endif
126 ixp12x0_intr_disestablish(cookie);