Home | History | Annotate | Line # | Download | only in common
conf.c revision 1.1
      1 /*	$NetBSD: conf.c,v 1.1 1997/02/04 03:52:16 thorpej 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/if_ether.h>
     44 #include <netinet/in_systm.h>
     45 
     46 #include <lib/libsa/stand.h>
     47 #include <lib/libsa/nfs.h>
     48 #include <lib/libsa/ufs.h>
     49 
     50 #include <hp300/stand/common/rawfs.h>
     51 #include <hp300/stand/common/samachdep.h>
     52 
     53 int	debug = 0;	/* XXX */
     54 
     55 /*
     56  * Device configuration
     57  */
     58 int	netstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
     59 int	netopen __P((struct open_file *, ...));
     60 int	netclose __P((struct open_file *));
     61 #define netioctl	noioctl
     62 
     63 int	ctstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
     64 int	ctopen __P((struct open_file *, ...));
     65 int	ctclose __P((struct open_file *));
     66 #define	ctioctl		noioctl
     67 
     68 int	rdstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
     69 int	rdopen __P((struct open_file *, ...));
     70 int	rdclose __P((struct open_file *));
     71 #define rdioctl		noioctl
     72 
     73 int	sdstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
     74 int	sdopen __P((struct open_file *, ...));
     75 int	sdclose __P((struct open_file *));
     76 #define	sdioctl		noioctl
     77 
     78 #define xxstrategy	\
     79 	(int (*) __P((void *, int, daddr_t, size_t, void *, size_t *)))nullsys
     80 #define xxopen		(int (*) __P((struct open_file *, ...)))nodev
     81 #define xxclose		(int (*) __P((struct open_file *)))nullsys
     82 
     83 /*
     84  * Note: "le" isn't a major offset.
     85  */
     86 struct devsw devsw[] = {
     87 	{ "ct",	ctstrategy,	ctopen,	ctclose,	ctioctl }, /*0*/
     88 	{ "??",	xxstrategy,	xxopen,	xxclose,	noioctl }, /*1*/
     89 	{ "rd",	rdstrategy,	rdopen,	rdclose,	rdioctl }, /*2*/
     90 	{ "??",	xxstrategy,	xxopen,	xxclose,	noioctl }, /*3*/
     91 	{ "sd",	sdstrategy,	sdopen,	sdclose,	sdioctl }, /*4*/
     92 	{ "??",	xxstrategy,	xxopen,	xxclose,	noioctl }, /*5*/
     93 	{ "le",	netstrategy,	netopen, netclose,	netioctl },/*6*/
     94 };
     95 int	ndevs = (sizeof(devsw) / sizeof(devsw[0]));
     96 
     97 extern struct netif_driver le_driver;
     98 
     99 struct netif_driver *netif_drivers[] = {
    100 	&le_driver,
    101 };
    102 int	n_netif_drivers = (sizeof(netif_drivers) / sizeof(netif_drivers[0]));
    103 
    104 /*
    105  * Physical unit/lun detection.
    106  */
    107 int	punitzero __P((int, int, int *));
    108 
    109 int
    110 punitzero(ctlr, slave, punit)
    111 	int ctlr, slave, *punit;
    112 {
    113 
    114 	*punit = 0;
    115 	return (0);
    116 }
    117 
    118 extern	int ctpunit __P((int, int, int *));
    119 #define	xxpunit		punitzero
    120 #define	rdpunit		punitzero
    121 #define	sdpunit		punitzero
    122 #define	lepunit		punitzero
    123 
    124 struct punitsw punitsw[] = {
    125 	{ ctpunit },
    126 	{ xxpunit },
    127 	{ rdpunit },
    128 	{ xxpunit },
    129 	{ sdpunit },
    130 	{ xxpunit },
    131 	{ lepunit },
    132 };
    133 int	npunit = (sizeof(punitsw) / sizeof(punitsw[0]));
    134 
    135 /*
    136  * Filesystem configuration
    137  */
    138 struct fs_ops file_system_rawfs[] = {
    139 	{ rawfs_open, rawfs_close, rawfs_read, rawfs_write, rawfs_seek,
    140 	    rawfs_stat },
    141 };
    142 
    143 struct fs_ops file_system_ufs[] = {
    144 	{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
    145 };
    146 
    147 struct fs_ops file_system_nfs[] = {
    148 	{ nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
    149 };
    150 
    151 struct fs_ops file_system[1];
    152 int	nfsys = 1;		/* we always know which one we want */
    153 
    154 
    155 /*
    156  * Inititalize controllers
    157  *
    158  * XXX this should be a table
    159  */
    160 void ctlrinit()
    161 {
    162 	leinit();
    163 	hpibinit();
    164 	scsiinit();
    165 }
    166