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