1 /* $NetBSD: conf.c,v 1.5 2001/01/02 04:14:34 simonb 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 #define xxstrategy \ 55 (int (*) __P((void *, int, daddr_t, size_t, void *, size_t *)))nullsys 56 #define xxopen (int (*) __P((struct open_file *, ...)))nodev 57 #define xxclose (int (*) __P((struct open_file *)))nullsys 58 59 /* 60 * Device configuration 61 */ 62 #ifdef SUPPORT_ETHERNET 63 int netstrategy __P((void *, int, daddr_t, size_t, void *, size_t *)); 64 int netopen __P((struct open_file *, ...)); 65 int netclose __P((struct open_file *)); 66 #define netioctl noioctl 67 #else 68 #define netstrategy xxstrategy 69 #define netopen xxopen 70 #define netclose xxclose 71 #define netioctl noioctl 72 #endif 73 74 #ifdef SUPPORT_TAPE 75 int ctstrategy __P((void *, int, daddr_t, size_t, void *, size_t *)); 76 int ctopen __P((struct open_file *, ...)); 77 int ctclose __P((struct open_file *)); 78 #define ctioctl noioctl 79 #else 80 #define ctstrategy xxstrategy 81 #define ctopen xxopen 82 #define ctclose xxclose 83 #define ctioctl noioctl 84 #endif 85 86 #ifdef SUPPORT_DISK 87 int rdstrategy __P((void *, int, daddr_t, size_t, void *, size_t *)); 88 int rdopen __P((struct open_file *, ...)); 89 int rdclose __P((struct open_file *)); 90 #define rdioctl noioctl 91 #else 92 #define rdstrategy xxstrategy 93 #define rdopen xxopen 94 #define rdclose xxclose 95 #define rdioctl noioctl 96 #endif 97 98 #ifdef SUPPORT_DISK 99 int sdstrategy __P((void *, int, daddr_t, size_t, void *, size_t *)); 100 int sdopen __P((struct open_file *, ...)); 101 int sdclose __P((struct open_file *)); 102 #define sdioctl noioctl 103 #else 104 #define sdstrategy xxstrategy 105 #define sdopen xxopen 106 #define sdclose xxclose 107 #define sdioctl noioctl 108 #endif 109 110 /* 111 * Note: "le" isn't a major offset. 112 */ 113 struct devsw devsw[] = { 114 { "ct", ctstrategy, ctopen, ctclose, ctioctl }, /*0*/ 115 { "??", xxstrategy, xxopen, xxclose, noioctl }, /*1*/ 116 { "rd", rdstrategy, rdopen, rdclose, rdioctl }, /*2*/ 117 { "??", xxstrategy, xxopen, xxclose, noioctl }, /*3*/ 118 { "sd", sdstrategy, sdopen, sdclose, sdioctl }, /*4*/ 119 { "??", xxstrategy, xxopen, xxclose, noioctl }, /*5*/ 120 { "le", netstrategy, netopen, netclose, netioctl },/*6*/ 121 }; 122 int ndevs = (sizeof(devsw) / sizeof(devsw[0])); 123 124 #ifdef SUPPORT_ETHERNET 125 extern struct netif_driver le_driver; 126 127 struct netif_driver *netif_drivers[] = { 128 &le_driver, 129 }; 130 int n_netif_drivers = (sizeof(netif_drivers) / sizeof(netif_drivers[0])); 131 #endif 132 133 /* 134 * Physical unit/lun detection. 135 */ 136 int punitzero __P((int, int, int *)); 137 138 int 139 punitzero(ctlr, slave, punit) 140 int ctlr, slave, *punit; 141 { 142 143 *punit = 0; 144 return (0); 145 } 146 147 #define xxpunit punitzero 148 #ifdef SUPPORT_TAPE 149 int ctpunit __P((int, int, int *)); 150 #else 151 #define ctpunit xxpunit 152 #endif 153 #define rdpunit punitzero 154 #define sdpunit punitzero 155 #define lepunit punitzero 156 157 struct punitsw punitsw[] = { 158 { ctpunit }, 159 { xxpunit }, 160 { rdpunit }, 161 { xxpunit }, 162 { sdpunit }, 163 { xxpunit }, 164 { lepunit }, 165 }; 166 int npunit = (sizeof(punitsw) / sizeof(punitsw[0])); 167 168 /* 169 * Filesystem configuration 170 */ 171 struct fs_ops file_system_rawfs[] = { 172 { rawfs_open, rawfs_close, rawfs_read, rawfs_write, rawfs_seek, 173 rawfs_stat }, 174 }; 175 176 struct fs_ops file_system_ufs[] = { 177 { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat }, 178 }; 179 180 struct fs_ops file_system_nfs[] = { 181 { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat }, 182 }; 183 184 struct fs_ops file_system[1]; 185 int nfsys = 1; /* we always know which one we want */ 186 187 188 /* 189 * Inititalize controllers 190 * 191 * XXX this should be a table 192 */ 193 void ctlrinit() 194 { 195 #ifdef SUPPORT_ETHERNET 196 leinit(); 197 #endif 198 #if defined(SUPPORT_DISK) || defined(SUPPORT_TAPE) 199 hpibinit(); 200 scsiinit(); 201 #endif 202 } 203