Home | History | Annotate | Line # | Download | only in boot
conf.c revision 1.3.2.3
      1  1.3.2.3  yamt /*	$NetBSD: conf.c,v 1.3.2.3 2014/05/22 11:39:55 yamt Exp $	*/
      2  1.3.2.2  yamt 
      3  1.3.2.2  yamt /*
      4  1.3.2.2  yamt  * Copyright (c) 1982, 1986, 1990, 1993
      5  1.3.2.2  yamt  *	The Regents of the University of California.  All rights reserved.
      6  1.3.2.2  yamt  *
      7  1.3.2.2  yamt  * Redistribution and use in source and binary forms, with or without
      8  1.3.2.2  yamt  * modification, are permitted provided that the following conditions
      9  1.3.2.2  yamt  * are met:
     10  1.3.2.2  yamt  * 1. Redistributions of source code must retain the above copyright
     11  1.3.2.2  yamt  *    notice, this list of conditions and the following disclaimer.
     12  1.3.2.2  yamt  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.3.2.2  yamt  *    notice, this list of conditions and the following disclaimer in the
     14  1.3.2.2  yamt  *    documentation and/or other materials provided with the distribution.
     15  1.3.2.2  yamt  * 3. Neither the name of the University nor the names of its contributors
     16  1.3.2.2  yamt  *    may be used to endorse or promote products derived from this software
     17  1.3.2.2  yamt  *    without specific prior written permission.
     18  1.3.2.2  yamt  *
     19  1.3.2.2  yamt  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     20  1.3.2.2  yamt  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21  1.3.2.2  yamt  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22  1.3.2.2  yamt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23  1.3.2.2  yamt  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24  1.3.2.2  yamt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25  1.3.2.2  yamt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26  1.3.2.2  yamt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27  1.3.2.2  yamt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28  1.3.2.2  yamt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29  1.3.2.2  yamt  * SUCH DAMAGE.
     30  1.3.2.2  yamt  *
     31  1.3.2.2  yamt  *	@(#)conf.c	8.1 (Berkeley) 6/10/93
     32  1.3.2.2  yamt  */
     33  1.3.2.2  yamt 
     34  1.3.2.2  yamt #include <sys/param.h>
     35  1.3.2.2  yamt #include <sys/socket.h>
     36  1.3.2.2  yamt 
     37  1.3.2.2  yamt #include <net/if.h>
     38  1.3.2.2  yamt #include <netinet/in.h>
     39  1.3.2.2  yamt #include <netinet/in_systm.h>
     40  1.3.2.2  yamt 
     41  1.3.2.2  yamt #include <lib/libsa/stand.h>
     42  1.3.2.2  yamt #include <lib/libsa/dev_net.h>
     43  1.3.2.2  yamt #include <lib/libsa/nfs.h>
     44  1.3.2.2  yamt #include <lib/libsa/ufs.h>
     45  1.3.2.2  yamt 
     46  1.3.2.3  yamt #include <machine/bootinfo.h>
     47  1.3.2.2  yamt #include <luna68k/stand/boot/samachdep.h>
     48  1.3.2.2  yamt 
     49  1.3.2.2  yamt #define xxstrategy	\
     50  1.3.2.2  yamt 	(int (*)(void *, int, daddr_t, size_t, void *, size_t *))nullsys
     51  1.3.2.2  yamt #define xxopen		(int (*)(struct open_file *, ...))nodev
     52  1.3.2.2  yamt #define xxclose		(int (*)(struct open_file *))nullsys
     53  1.3.2.2  yamt 
     54  1.3.2.2  yamt /*
     55  1.3.2.2  yamt  * Device configuration
     56  1.3.2.2  yamt  */
     57  1.3.2.2  yamt #ifndef SUPPORT_ETHERNET
     58  1.3.2.2  yamt #define	netstrategy	xxstrategy
     59  1.3.2.2  yamt #define	netopen		xxopen
     60  1.3.2.2  yamt #define	netclose	xxclose
     61  1.3.2.2  yamt #else
     62  1.3.2.2  yamt #define	netstrategy	net_strategy
     63  1.3.2.2  yamt #define	netopen		net_open
     64  1.3.2.2  yamt #define	netclose	net_close
     65  1.3.2.2  yamt #endif
     66  1.3.2.2  yamt #define	netioctl	noioctl
     67  1.3.2.2  yamt 
     68  1.3.2.2  yamt #ifndef SUPPORT_DISK
     69  1.3.2.2  yamt #define	sdstrategy	xxstrategy
     70  1.3.2.2  yamt #define	sdopen		xxopen
     71  1.3.2.2  yamt #define	sdclose		xxclose
     72  1.3.2.2  yamt #endif
     73  1.3.2.2  yamt #define	sdioctl		noioctl
     74  1.3.2.2  yamt 
     75  1.3.2.2  yamt /*
     76  1.3.2.2  yamt  * Note: "le" isn't a major offset.
     77  1.3.2.2  yamt  */
     78  1.3.2.2  yamt struct devsw devsw[] = {
     79  1.3.2.2  yamt 	{ "sd",	sdstrategy,	sdopen,	sdclose,	sdioctl },
     80  1.3.2.2  yamt 	{ "le",	netstrategy,	netopen, netclose,	netioctl },
     81  1.3.2.2  yamt };
     82  1.3.2.2  yamt int	ndevs = __arraycount(devsw);
     83  1.3.2.2  yamt 
     84  1.3.2.3  yamt /* XXX: These indices must sync with the above devsw */
     85  1.3.2.3  yamt const int dev2adpt[] = {
     86  1.3.2.3  yamt 	LUNA68K_BOOTADPT_SPC,
     87  1.3.2.3  yamt 	LUNA68K_BOOTADPT_LANCE,
     88  1.3.2.3  yamt };
     89  1.3.2.3  yamt 
     90  1.3.2.2  yamt #ifdef SUPPORT_ETHERNET
     91  1.3.2.2  yamt extern struct netif_driver le_netif_driver;
     92  1.3.2.2  yamt struct netif_driver *netif_drivers[] = {
     93  1.3.2.2  yamt 	&le_netif_driver,
     94  1.3.2.2  yamt };
     95  1.3.2.2  yamt int	n_netif_drivers = __arraycount(netif_drivers);
     96  1.3.2.2  yamt #endif
     97  1.3.2.2  yamt 
     98  1.3.2.2  yamt /*
     99  1.3.2.2  yamt  * Filesystem configuration
    100  1.3.2.2  yamt  */
    101  1.3.2.2  yamt #ifdef SUPPORT_DISK
    102  1.3.2.2  yamt struct fs_ops file_system_disk[] = {
    103  1.3.2.2  yamt 	FS_OPS(ffsv1),
    104  1.3.2.2  yamt 	FS_OPS(ffsv2)
    105  1.3.2.2  yamt };
    106  1.3.2.2  yamt int	nfsys_disk = __arraycount(file_system_disk);
    107  1.3.2.2  yamt #endif
    108  1.3.2.2  yamt #ifdef SUPPORT_ETHERNET
    109  1.3.2.2  yamt struct fs_ops file_system_nfs[] = { FS_OPS(nfs) };
    110  1.3.2.2  yamt #endif
    111  1.3.2.2  yamt 
    112  1.3.2.2  yamt #define MAX_NFSYS	5
    113  1.3.2.2  yamt struct fs_ops file_system[MAX_NFSYS];
    114  1.3.2.2  yamt int	nfsys = 1;		/* we always know which one we want */
    115