conf.c revision 1.5 1 1.5 simonb /* $NetBSD: conf.c,v 1.5 2001/01/02 04:14:34 simonb Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*
4 1.1 thorpej * Copyright (c) 1982, 1986, 1990, 1993
5 1.1 thorpej * The Regents of the University of California. All rights reserved.
6 1.1 thorpej *
7 1.1 thorpej * Redistribution and use in source and binary forms, with or without
8 1.1 thorpej * modification, are permitted provided that the following conditions
9 1.1 thorpej * are met:
10 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
11 1.1 thorpej * notice, this list of conditions and the following disclaimer.
12 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
14 1.1 thorpej * documentation and/or other materials provided with the distribution.
15 1.1 thorpej * 3. All advertising materials mentioning features or use of this software
16 1.1 thorpej * must display the following acknowledgement:
17 1.1 thorpej * This product includes software developed by the University of
18 1.1 thorpej * California, Berkeley and its contributors.
19 1.1 thorpej * 4. Neither the name of the University nor the names of its contributors
20 1.1 thorpej * may be used to endorse or promote products derived from this software
21 1.1 thorpej * without specific prior written permission.
22 1.1 thorpej *
23 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 1.1 thorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 1.1 thorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 1.1 thorpej * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 1.1 thorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 1.1 thorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 1.1 thorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 1.1 thorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 1.1 thorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 1.1 thorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 1.1 thorpej * SUCH DAMAGE.
34 1.1 thorpej *
35 1.1 thorpej * @(#)conf.c 8.1 (Berkeley) 6/10/93
36 1.1 thorpej */
37 1.1 thorpej
38 1.1 thorpej #include <sys/param.h>
39 1.1 thorpej #include <sys/socket.h>
40 1.1 thorpej
41 1.1 thorpej #include <net/if.h>
42 1.1 thorpej #include <netinet/in.h>
43 1.1 thorpej #include <netinet/in_systm.h>
44 1.1 thorpej
45 1.1 thorpej #include <lib/libsa/stand.h>
46 1.1 thorpej #include <lib/libsa/nfs.h>
47 1.1 thorpej #include <lib/libsa/ufs.h>
48 1.1 thorpej
49 1.1 thorpej #include <hp300/stand/common/rawfs.h>
50 1.1 thorpej #include <hp300/stand/common/samachdep.h>
51 1.1 thorpej
52 1.1 thorpej int debug = 0; /* XXX */
53 1.1 thorpej
54 1.4 thorpej #define xxstrategy \
55 1.4 thorpej (int (*) __P((void *, int, daddr_t, size_t, void *, size_t *)))nullsys
56 1.4 thorpej #define xxopen (int (*) __P((struct open_file *, ...)))nodev
57 1.4 thorpej #define xxclose (int (*) __P((struct open_file *)))nullsys
58 1.4 thorpej
59 1.1 thorpej /*
60 1.1 thorpej * Device configuration
61 1.1 thorpej */
62 1.4 thorpej #ifdef SUPPORT_ETHERNET
63 1.1 thorpej int netstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
64 1.1 thorpej int netopen __P((struct open_file *, ...));
65 1.1 thorpej int netclose __P((struct open_file *));
66 1.1 thorpej #define netioctl noioctl
67 1.4 thorpej #else
68 1.4 thorpej #define netstrategy xxstrategy
69 1.4 thorpej #define netopen xxopen
70 1.4 thorpej #define netclose xxclose
71 1.4 thorpej #define netioctl noioctl
72 1.4 thorpej #endif
73 1.1 thorpej
74 1.4 thorpej #ifdef SUPPORT_TAPE
75 1.1 thorpej int ctstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
76 1.1 thorpej int ctopen __P((struct open_file *, ...));
77 1.1 thorpej int ctclose __P((struct open_file *));
78 1.1 thorpej #define ctioctl noioctl
79 1.4 thorpej #else
80 1.4 thorpej #define ctstrategy xxstrategy
81 1.4 thorpej #define ctopen xxopen
82 1.4 thorpej #define ctclose xxclose
83 1.4 thorpej #define ctioctl noioctl
84 1.4 thorpej #endif
85 1.1 thorpej
86 1.4 thorpej #ifdef SUPPORT_DISK
87 1.1 thorpej int rdstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
88 1.1 thorpej int rdopen __P((struct open_file *, ...));
89 1.1 thorpej int rdclose __P((struct open_file *));
90 1.1 thorpej #define rdioctl noioctl
91 1.4 thorpej #else
92 1.4 thorpej #define rdstrategy xxstrategy
93 1.4 thorpej #define rdopen xxopen
94 1.4 thorpej #define rdclose xxclose
95 1.4 thorpej #define rdioctl noioctl
96 1.4 thorpej #endif
97 1.1 thorpej
98 1.4 thorpej #ifdef SUPPORT_DISK
99 1.1 thorpej int sdstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
100 1.1 thorpej int sdopen __P((struct open_file *, ...));
101 1.1 thorpej int sdclose __P((struct open_file *));
102 1.1 thorpej #define sdioctl noioctl
103 1.4 thorpej #else
104 1.4 thorpej #define sdstrategy xxstrategy
105 1.4 thorpej #define sdopen xxopen
106 1.4 thorpej #define sdclose xxclose
107 1.4 thorpej #define sdioctl noioctl
108 1.4 thorpej #endif
109 1.1 thorpej
110 1.1 thorpej /*
111 1.1 thorpej * Note: "le" isn't a major offset.
112 1.1 thorpej */
113 1.1 thorpej struct devsw devsw[] = {
114 1.1 thorpej { "ct", ctstrategy, ctopen, ctclose, ctioctl }, /*0*/
115 1.1 thorpej { "??", xxstrategy, xxopen, xxclose, noioctl }, /*1*/
116 1.1 thorpej { "rd", rdstrategy, rdopen, rdclose, rdioctl }, /*2*/
117 1.1 thorpej { "??", xxstrategy, xxopen, xxclose, noioctl }, /*3*/
118 1.1 thorpej { "sd", sdstrategy, sdopen, sdclose, sdioctl }, /*4*/
119 1.1 thorpej { "??", xxstrategy, xxopen, xxclose, noioctl }, /*5*/
120 1.1 thorpej { "le", netstrategy, netopen, netclose, netioctl },/*6*/
121 1.1 thorpej };
122 1.1 thorpej int ndevs = (sizeof(devsw) / sizeof(devsw[0]));
123 1.1 thorpej
124 1.4 thorpej #ifdef SUPPORT_ETHERNET
125 1.1 thorpej extern struct netif_driver le_driver;
126 1.1 thorpej
127 1.1 thorpej struct netif_driver *netif_drivers[] = {
128 1.1 thorpej &le_driver,
129 1.1 thorpej };
130 1.1 thorpej int n_netif_drivers = (sizeof(netif_drivers) / sizeof(netif_drivers[0]));
131 1.4 thorpej #endif
132 1.1 thorpej
133 1.1 thorpej /*
134 1.1 thorpej * Physical unit/lun detection.
135 1.1 thorpej */
136 1.1 thorpej int punitzero __P((int, int, int *));
137 1.1 thorpej
138 1.1 thorpej int
139 1.1 thorpej punitzero(ctlr, slave, punit)
140 1.1 thorpej int ctlr, slave, *punit;
141 1.1 thorpej {
142 1.1 thorpej
143 1.1 thorpej *punit = 0;
144 1.1 thorpej return (0);
145 1.1 thorpej }
146 1.1 thorpej
147 1.1 thorpej #define xxpunit punitzero
148 1.4 thorpej #ifdef SUPPORT_TAPE
149 1.5 simonb int ctpunit __P((int, int, int *));
150 1.4 thorpej #else
151 1.4 thorpej #define ctpunit xxpunit
152 1.4 thorpej #endif
153 1.1 thorpej #define rdpunit punitzero
154 1.1 thorpej #define sdpunit punitzero
155 1.1 thorpej #define lepunit punitzero
156 1.1 thorpej
157 1.1 thorpej struct punitsw punitsw[] = {
158 1.1 thorpej { ctpunit },
159 1.1 thorpej { xxpunit },
160 1.1 thorpej { rdpunit },
161 1.1 thorpej { xxpunit },
162 1.1 thorpej { sdpunit },
163 1.1 thorpej { xxpunit },
164 1.1 thorpej { lepunit },
165 1.1 thorpej };
166 1.1 thorpej int npunit = (sizeof(punitsw) / sizeof(punitsw[0]));
167 1.1 thorpej
168 1.1 thorpej /*
169 1.1 thorpej * Filesystem configuration
170 1.1 thorpej */
171 1.1 thorpej struct fs_ops file_system_rawfs[] = {
172 1.1 thorpej { rawfs_open, rawfs_close, rawfs_read, rawfs_write, rawfs_seek,
173 1.1 thorpej rawfs_stat },
174 1.1 thorpej };
175 1.1 thorpej
176 1.1 thorpej struct fs_ops file_system_ufs[] = {
177 1.1 thorpej { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
178 1.1 thorpej };
179 1.1 thorpej
180 1.1 thorpej struct fs_ops file_system_nfs[] = {
181 1.1 thorpej { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
182 1.1 thorpej };
183 1.1 thorpej
184 1.1 thorpej struct fs_ops file_system[1];
185 1.1 thorpej int nfsys = 1; /* we always know which one we want */
186 1.1 thorpej
187 1.1 thorpej
188 1.1 thorpej /*
189 1.1 thorpej * Inititalize controllers
190 1.1 thorpej *
191 1.1 thorpej * XXX this should be a table
192 1.1 thorpej */
193 1.1 thorpej void ctlrinit()
194 1.1 thorpej {
195 1.4 thorpej #ifdef SUPPORT_ETHERNET
196 1.1 thorpej leinit();
197 1.4 thorpej #endif
198 1.4 thorpej #if defined(SUPPORT_DISK) || defined(SUPPORT_TAPE)
199 1.1 thorpej hpibinit();
200 1.1 thorpej scsiinit();
201 1.4 thorpej #endif
202 1.1 thorpej }
203