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