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