conf.c revision 1.14 1 1.14 tsutsui /* $NetBSD: conf.c,v 1.14 2022/12/11 07:39:30 tsutsui 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.6 agc * 3. Neither the name of the University nor the names of its contributors
16 1.1 thorpej * may be used to endorse or promote products derived from this software
17 1.1 thorpej * without specific prior written permission.
18 1.1 thorpej *
19 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 1.1 thorpej * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 1.1 thorpej * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 1.1 thorpej * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 1.1 thorpej * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 1.1 thorpej * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 1.1 thorpej * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 1.1 thorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 1.1 thorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 1.1 thorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 1.1 thorpej * SUCH DAMAGE.
30 1.1 thorpej *
31 1.1 thorpej * @(#)conf.c 8.1 (Berkeley) 6/10/93
32 1.1 thorpej */
33 1.1 thorpej
34 1.1 thorpej #include <sys/param.h>
35 1.1 thorpej #include <sys/socket.h>
36 1.1 thorpej
37 1.1 thorpej #include <net/if.h>
38 1.1 thorpej #include <netinet/in.h>
39 1.1 thorpej #include <netinet/in_systm.h>
40 1.1 thorpej
41 1.1 thorpej #include <lib/libsa/stand.h>
42 1.1 thorpej #include <lib/libsa/nfs.h>
43 1.1 thorpej #include <lib/libsa/ufs.h>
44 1.1 thorpej
45 1.7 tsutsui #include <hp300/stand/common/conf.h>
46 1.1 thorpej #include <hp300/stand/common/rawfs.h>
47 1.1 thorpej #include <hp300/stand/common/samachdep.h>
48 1.1 thorpej
49 1.1 thorpej int debug = 0; /* XXX */
50 1.1 thorpej
51 1.4 thorpej #define xxstrategy \
52 1.7 tsutsui (int (*)(void *, int, daddr_t, size_t, void *, size_t *))nullsys
53 1.7 tsutsui #define xxopen (int (*)(struct open_file *, ...))nodev
54 1.7 tsutsui #define xxclose (int (*)(struct open_file *))nullsys
55 1.4 thorpej
56 1.1 thorpej /*
57 1.1 thorpej * Device configuration
58 1.1 thorpej */
59 1.7 tsutsui #ifndef SUPPORT_ETHERNET
60 1.4 thorpej #define netstrategy xxstrategy
61 1.4 thorpej #define netopen xxopen
62 1.4 thorpej #define netclose xxclose
63 1.7 tsutsui #endif
64 1.4 thorpej #define netioctl noioctl
65 1.1 thorpej
66 1.7 tsutsui #ifndef SUPPORT_TAPE
67 1.4 thorpej #define ctstrategy xxstrategy
68 1.4 thorpej #define ctopen xxopen
69 1.4 thorpej #define ctclose xxclose
70 1.7 tsutsui #endif
71 1.4 thorpej #define ctioctl noioctl
72 1.1 thorpej
73 1.7 tsutsui #ifndef SUPPORT_DISK
74 1.4 thorpej #define rdstrategy xxstrategy
75 1.4 thorpej #define rdopen xxopen
76 1.4 thorpej #define rdclose xxclose
77 1.4 thorpej #define sdstrategy xxstrategy
78 1.4 thorpej #define sdopen xxopen
79 1.4 thorpej #define sdclose xxclose
80 1.7 tsutsui #endif
81 1.7 tsutsui #define rdioctl noioctl
82 1.4 thorpej #define sdioctl noioctl
83 1.1 thorpej
84 1.1 thorpej /*
85 1.1 thorpej * Note: "le" isn't a major offset.
86 1.1 thorpej */
87 1.1 thorpej struct devsw devsw[] = {
88 1.1 thorpej { "ct", ctstrategy, ctopen, ctclose, ctioctl }, /*0*/
89 1.1 thorpej { "??", xxstrategy, xxopen, xxclose, noioctl }, /*1*/
90 1.1 thorpej { "rd", rdstrategy, rdopen, rdclose, rdioctl }, /*2*/
91 1.1 thorpej { "??", xxstrategy, xxopen, xxclose, noioctl }, /*3*/
92 1.1 thorpej { "sd", sdstrategy, sdopen, sdclose, sdioctl }, /*4*/
93 1.1 thorpej { "??", xxstrategy, xxopen, xxclose, noioctl }, /*5*/
94 1.1 thorpej { "le", netstrategy, netopen, netclose, netioctl },/*6*/
95 1.1 thorpej };
96 1.12 tsutsui int ndevs = __arraycount(devsw);
97 1.1 thorpej
98 1.4 thorpej #ifdef SUPPORT_ETHERNET
99 1.1 thorpej struct netif_driver *netif_drivers[] = {
100 1.1 thorpej &le_driver,
101 1.1 thorpej };
102 1.12 tsutsui int n_netif_drivers = __arraycount(netif_drivers);
103 1.4 thorpej #endif
104 1.1 thorpej
105 1.1 thorpej /*
106 1.1 thorpej * Physical unit/lun detection.
107 1.1 thorpej */
108 1.7 tsutsui static int punitzero(int, int, int *);
109 1.1 thorpej
110 1.7 tsutsui static int
111 1.8 tsutsui punitzero(int ctlr, int slave, int *punit)
112 1.1 thorpej {
113 1.1 thorpej
114 1.1 thorpej *punit = 0;
115 1.7 tsutsui return 0;
116 1.1 thorpej }
117 1.1 thorpej
118 1.1 thorpej #define xxpunit punitzero
119 1.7 tsutsui #ifndef SUPPORT_TAPE
120 1.4 thorpej #define ctpunit xxpunit
121 1.4 thorpej #endif
122 1.1 thorpej #define rdpunit punitzero
123 1.1 thorpej #define sdpunit punitzero
124 1.1 thorpej #define lepunit punitzero
125 1.1 thorpej
126 1.1 thorpej struct punitsw punitsw[] = {
127 1.1 thorpej { ctpunit },
128 1.1 thorpej { xxpunit },
129 1.1 thorpej { rdpunit },
130 1.1 thorpej { xxpunit },
131 1.1 thorpej { sdpunit },
132 1.1 thorpej { xxpunit },
133 1.1 thorpej { lepunit },
134 1.1 thorpej };
135 1.12 tsutsui int npunit = __arraycount(punitsw);
136 1.1 thorpej
137 1.1 thorpej /*
138 1.1 thorpej * Filesystem configuration
139 1.1 thorpej */
140 1.14 tsutsui struct fs_ops file_system_rawfs[1] = { FS_OPS(rawfs) };
141 1.14 tsutsui struct fs_ops file_system_ufs[NFSYS_UFS] = {
142 1.14 tsutsui FS_OPS(ffsv1),
143 1.14 tsutsui #ifdef SUPPORT_UFS2
144 1.14 tsutsui FS_OPS(ffsv2),
145 1.14 tsutsui #endif
146 1.14 tsutsui };
147 1.14 tsutsui struct fs_ops file_system_nfs[1] = { FS_OPS(nfs) };
148 1.1 thorpej
149 1.14 tsutsui struct fs_ops file_system[NFSYS_UFS];
150 1.14 tsutsui int nfsys = 1; /* default value; should be overrieded */
151