Annotation of sys/arch/hp300/dev/intio.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: intio.c,v 1.6 2007/01/06 20:10:57 miod Exp $ */
2: /* $NetBSD: intio.c,v 1.2 1997/01/30 09:18:54 thorpej Exp $ */
3:
4: /*-
5: * Copyright (c) 1996 The NetBSD Foundation, Inc.
6: * All rights reserved.
7: *
8: * This code is derived from software contributed to The NetBSD Foundation
9: * by Jason R. Thorpe.
10: *
11: * Redistribution and use in source and binary forms, with or without
12: * modification, are permitted provided that the following conditions
13: * are met:
14: * 1. Redistributions of source code must retain the above copyright
15: * notice, this list of conditions and the following disclaimer.
16: * 2. Redistributions in binary form must reproduce the above copyright
17: * notice, this list of conditions and the following disclaimer in the
18: * documentation and/or other materials provided with the distribution.
19: * 3. All advertising materials mentioning features or use of this software
20: * must display the following acknowledgement:
21: * This product includes software developed by the NetBSD
22: * Foundation, Inc. and its contributors.
23: * 4. Neither the name of The NetBSD Foundation nor the names of its
24: * contributors may be used to endorse or promote products derived
25: * from this software without specific prior written permission.
26: *
27: * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
31: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37: * POSSIBILITY OF SUCH DAMAGE.
38: */
39:
40: /*
41: * Autoconfiguration support for hp300 internal i/o space.
42: */
43:
44: #include <sys/param.h>
45: #include <sys/systm.h>
46: #include <sys/device.h>
47:
48: #include <machine/bus.h>
49:
50: #include <hp300/dev/intiovar.h>
51:
52: int intiomatch(struct device *, void *, void *);
53: void intioattach(struct device *, struct device *, void *);
54: int intioprint(void *, const char *);
55: int intiosearch(struct device *, void *, void *);
56:
57: struct cfattach intio_ca = {
58: sizeof(struct device), intiomatch, intioattach
59: };
60:
61: struct cfdriver intio_cd = {
62: NULL, "intio", DV_DULL
63: };
64:
65: int
66: intiomatch(parent, match, aux)
67: struct device *parent;
68: void *match, *aux;
69: {
70: static int intio_matched = 0;
71:
72: /* Allow only one instance. */
73: if (intio_matched)
74: return (0);
75:
76: intio_matched = 1;
77: return (1);
78: }
79:
80: void
81: intioattach(parent, self, aux)
82: struct device *parent, *self;
83: void *aux;
84: {
85:
86: printf("\n");
87:
88: /* Search for and attach children. */
89: config_search(intiosearch, self, NULL);
90: }
91:
92: int
93: intioprint(aux, pnp)
94: void *aux;
95: const char *pnp;
96: {
97: struct intio_attach_args *ia = aux;
98:
99: if (ia->ia_addr != 0)
100: printf(" addr %p", ia->ia_addr);
101: return (UNCONF);
102: }
103:
104: int
105: intiosearch(parent, match, aux)
106: struct device *parent;
107: void *match, *aux;
108: {
109: struct cfdata *cf = match;
110: struct intio_attach_args ia;
111: extern struct hp300_bus_space_tag hp300_mem_tag;
112:
113: bzero(&ia, sizeof(ia));
114: ia.ia_tag = &hp300_mem_tag;
115:
116: if ((*cf->cf_attach->ca_match)(parent, cf, &ia) > 0)
117: config_attach(parent, cf, &ia, intioprint);
118:
119: return (0);
120: }
CVSweb