1 /* $NetBSD: ixm1200_pci.c,v 1.6 2009/03/16 23:11:11 dsl Exp $ */
4 * Copyright (c) 2002, 2003
5 * Ichiro FUKUHARA <ichiro@ichiro.org>.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
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
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 *);
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
;
74 ixm1200_pci_intr_map(struct pci_attach_args
*pa
, pci_intr_handle_t
*ihp
)
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
);
87 /* ixp12x0 has only one interrupt line for PCI */
88 *ihp
= IXPPCI_INTR_PIL
;
93 ixm1200_pci_intr_string(void *v
, pci_intr_handle_t ih
)
95 static char irqstr
[IRQNAMESIZE
];
97 sprintf(irqstr
, "IXM1200 irq %ld", ih
);
102 ixm1200_pci_intr_evcnt(void *v
, pci_intr_handle_t ih
)
108 ixm1200_pci_intr_establish(void *v
, pci_intr_handle_t ih
, int ipl
, int (*func
)(void *), void *arg
)
111 printf("ixm1200_pci_intr_establish(v=%p, irq=%d, ipl=%d, func=%p, arg=%p)\n",
112 v
, (int) ih
, ipl
, func
, arg
);
115 return (ixp12x0_intr_establish(ih
, ipl
, func
, arg
));
119 ixm1200_pci_intr_disestablish(void *v
, void *cookie
)
122 printf("ixm1200_pci_intr_disestablish(v=%p, cookie=%p)\n",
126 ixp12x0_intr_disestablish(cookie
);