Annotation of sys/arch/mvmeppc/dev/raven.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: raven.c,v 1.6 2004/05/14 20:38:32 miod Exp $ */
2:
3: /*
4: * Copyright (c) 2001 Steve Murphree, Jr.
5: *
6: * Redistribution and use in source and binary forms, with or without
7: * modification, are permitted provided that the following conditions
8: * are met:
9: * 1. Redistributions of source code must retain the above copyright
10: * notice, this list of conditions and the following disclaimer.
11: * 2. Redistributions in binary form must reproduce the above copyright
12: * notice, this list of conditions and the following disclaimer in the
13: * documentation and/or other materials provided with the distribution.
14: * 3. All advertising materials mentioning features or use of this software
15: * must display the following acknowledgement:
16: * This product includes software developed under OpenBSD for RTMX Inc
17: * by Per Fogelstrom, Opsycon AB.
18: * 4. The name of the author may not be used to endorse or promote products
19: * derived from this software without specific prior written permission.
20: *
21: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
22: * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
25: * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31: * SUCH DAMAGE.
32: *
33: */
34:
35: /*
36: * Motorola 'Raven' ASIC driver.
37: */
38:
39: #include <sys/param.h>
40: #include <sys/systm.h>
41: #include <sys/kernel.h>
42: #include <sys/malloc.h>
43: #include <sys/device.h>
44: #include <sys/proc.h>
45: #include <uvm/uvm_extern.h>
46:
47: #include <machine/autoconf.h>
48:
49: #include <mvmeppc/dev/ravenreg.h>
50: #include <mvmeppc/dev/ravenvar.h>
51:
52: int raven_match(struct device *, void *, void *);
53: void raven_attach(struct device *, struct device *, void *);
54:
55: struct cfattach raven_ca = {
56: sizeof(struct raven_softc), raven_match, raven_attach,
57: };
58:
59: struct cfdriver raven_cd = {
60: NULL, "raven", DV_DULL,
61: };
62:
63: int
64: raven_match(struct device *parent, void *match, void *aux)
65: {
66: struct confargs *ca = aux;
67: void *va;
68: u_int32_t probe;
69:
70: if (strcmp(ca->ca_name, raven_cd.cd_name) != 0)
71: return 0;
72:
73: if ((va = mapiodev((paddr_t)RAVEN_BASE, RAVEN_SIZE)) == NULL)
74: return 0;
75:
76: /* check for a live address */
77: if (badaddr(va, 4) != 0) {
78: unmapiodev(va, RAVEN_SIZE);
79: return 0;
80: }
81:
82: /* now check and see if it's a raven ASIC */
83: probe = *(u_int32_t*)va;
84: unmapiodev((void *)va, RAVEN_SIZE);
85:
86: if (probe != RAVEN_MAGIC)
87: return 0;
88:
89: return 1;
90: }
91:
92: /* need to be global for mpcpcibr.c - XXX */
93: u_int8_t *ravenregs;
94:
95: void
96: raven_attach(struct device *parent, struct device *self, void *aux)
97: {
98: struct raven_softc *sc = (void *)self;
99:
100: /*
101: * Map Raven registers and MPCIC
102: *
103: * XXX steal them from devio_ex as well!
104: */
105: ravenregs = sc->sc_regs = mapiodev((paddr_t)RAVEN_BASE, RAVEN_SIZE);
106: if (sc->sc_regs == NULL) {
107: printf(": can't map registers!\n");
108: return;
109: }
110:
111: /* set system type */
112: system_type = MVME; /* We are a Motorola MVME SBC */
113:
114: printf(": version 0x%x\n", sc->sc_regs[RAVEN_REVID]);
115:
116: while (config_found(self, NULL, NULL))
117: ;
118: }
CVSweb