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