Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / arm / xscale / ixp425_sip.c
blob96d79b6effc9e0f39966e36a5e8a6bd2a455d691
1 /* $NetBSD: ixp425_sip.c,v 1.10 2006/04/10 03:36:03 simonb Exp $ */
3 /*
4 * Copyright (c) 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: ixp425_sip.c,v 1.10 2006/04/10 03:36:03 simonb Exp $");
34 * Slow peripheral bus of IXP425 Processor
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 <arm/xscale/ixp425var.h>
45 #include <arm/xscale/ixp425_sipvar.h>
47 #include "locators.h"
49 static int ixpsip_match(struct device *, struct cfdata *, void *);
50 static void ixpsip_attach(struct device *, struct device *, void *);
51 static int ixpsip_search(struct device *, struct cfdata *,
52 const int *, void *);
53 static int ixpsip_print(void *, const char *);
55 CFATTACH_DECL(ixpsip, sizeof(struct ixpsip_softc),
56 ixpsip_match, ixpsip_attach, NULL, NULL);
58 struct ixpsip_softc *ixpsip_softc;
60 int
61 ixpsip_match(struct device *parent, struct cfdata *cf, void *aux)
63 return (1);
66 void
67 ixpsip_attach(struct device *parent, struct device *self, void *aux)
69 struct ixpsip_softc *sc = (void *) self;
70 sc->sc_iot = &ixp425_bs_tag;
72 ixpsip_softc = sc;
74 printf("\n");
76 if (bus_space_map(sc->sc_iot, IXP425_EXP_HWBASE, IXP425_EXP_SIZE,
77 0, &sc->sc_ioh)) {
78 printf("%s: Can't map expansion bus control registers!\n",
79 sc->sc_dev.dv_xname);
80 return;
84 * Attach each devices
86 config_search_ia(ixpsip_search, self, "ixpsip", NULL);
89 int
90 ixpsip_search(struct device *parent, struct cfdata *cf,
91 const int *ldesc, void *aux)
93 struct ixpsip_softc *sc = (struct ixpsip_softc *)parent;
94 struct ixpsip_attach_args sa;
96 sa.sa_iot = sc->sc_iot;
97 sa.sa_addr = cf->cf_loc[IXPSIPCF_ADDR];
98 sa.sa_size = cf->cf_loc[IXPSIPCF_SIZE];
99 sa.sa_index = cf->cf_loc[IXPSIPCF_INDEX];
100 sa.sa_intr = cf->cf_loc[IXPSIPCF_INTR];
102 if (config_match(parent, cf, &sa) > 0)
103 config_attach(parent, cf, &sa, ixpsip_print);
105 return (0);
108 static int
109 ixpsip_print(void *aux, const char *name)
111 struct ixpsip_attach_args *sa = (struct ixpsip_attach_args*)aux;
113 if (sa->sa_size)
114 aprint_normal(" addr 0x%lx", sa->sa_addr);
115 if (sa->sa_size > 1)
116 aprint_normal("-0x%lx", sa->sa_addr + sa->sa_size - 1);
117 if (sa->sa_index > 1)
118 aprint_normal(" index %d", sa->sa_index);
119 if (sa->sa_intr > 1)
120 aprint_normal(" intr %d", sa->sa_intr);
122 return (UNCONF);