xref: /csrg-svn/sys/vax/stand/conf.c (revision 33408)
1 /*
2  * Copyright (c) 1982, 1986 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)conf.c	7.4 (Berkeley) 01/28/88
7  */
8 
9 #include "../machine/pte.h"
10 
11 #include "param.h"
12 #include "inode.h"
13 #include "fs.h"
14 
15 #include "saio.h"
16 
17 devread(io)
18 	register struct iob *io;
19 {
20 	int cc;
21 
22 	io->i_flgs |= F_RDDATA;
23 	io->i_error = 0;
24 	cc = (*devsw[io->i_ino.i_dev].dv_strategy)(io, READ);
25 	io->i_flgs &= ~F_TYPEMASK;
26 	return (cc);
27 }
28 
29 devwrite(io)
30 	register struct iob *io;
31 {
32 	int cc;
33 
34 	io->i_flgs |= F_WRDATA;
35 	io->i_error = 0;
36 	cc = (*devsw[io->i_ino.i_dev].dv_strategy)(io, WRITE);
37 	io->i_flgs &= ~F_TYPEMASK;
38 	return (cc);
39 }
40 
41 devopen(io)
42 	register struct iob *io;
43 {
44 
45 	return (*devsw[io->i_ino.i_dev].dv_open)(io);
46 }
47 
48 devclose(io)
49 	register struct iob *io;
50 {
51 
52 	(*devsw[io->i_ino.i_dev].dv_close)(io);
53 }
54 
55 devioctl(io, cmd, arg)
56 	register struct iob *io;
57 	int cmd;
58 	caddr_t arg;
59 {
60 
61 	return ((*devsw[io->i_ino.i_dev].dv_ioctl)(io, cmd, arg));
62 }
63 
64 /*ARGSUSED*/
65 nullsys(io)
66 	struct iob *io;
67 {
68 
69 	;
70 }
71 
72 /*ARGSUSED*/
73 nodev(io)
74 	struct iob *io;
75 {
76 
77 	errno = EBADF;
78 }
79 
80 /*ARGSUSED*/
81 noioctl(io, cmd, arg)
82 	struct iob *io;
83 	int cmd;
84 	caddr_t arg;
85 {
86 
87 	return (ECMD);
88 }
89 
90 #if defined(VAX780) || defined(VAX750) || defined(VAX8600)
91 #define	HP		"hp"
92 int	hpstrategy(), hpopen(), hpioctl();
93 #else
94 #define	HP		0
95 #define	hpstrategy	nodev
96 #define	hpopen		nodev
97 #define	hpioctl		noioctl
98 #endif
99 int	upstrategy(), upopen(), upioctl();
100 int	rkstrategy(), rkopen(), rkioctl();
101 int	rastrategy(), raopen(), raioctl();
102 #if defined(VAX730)
103 #define	RB		"rb"
104 int	idcstrategy(), idcopen(), idcioctl();
105 #else
106 #define	RB		0
107 #define	idcstrategy	nodev
108 #define	idcopen		nodev
109 #define	idcioctl	noioctl
110 #endif
111 int	rlstrategy(), rlopen(), rlioctl();
112 
113 #ifndef BOOT
114 #define	TM		"tm"
115 int	tmstrategy(), tmopen(), tmclose();
116 #define	TS		"ts"
117 int	tsstrategy(), tsopen(), tsclose();
118 #if defined(VAX780) || defined(VAX750) || defined(VAX8600)
119 #define	HT		"ht"
120 int	htstrategy(), htopen(), htclose();
121 #define	MT		"mt"
122 int	mtstrategy(), mtopen(), mtclose();
123 
124 #else massbus vax
125 #define	HT		0
126 #define	htstrategy	nodev
127 #define	htopen		nodev
128 #define	htclose		nodev
129 #define	MT		0
130 #define	mtstrategy	nodev
131 #define	mtopen		nodev
132 #define	mtclose		nodev
133 #endif massbus vax
134 
135 #define	UT		"ut"
136 int	utstrategy(), utopen(), utclose();
137 #define	TMSCP		"tms"
138 int	tmscpstrategy(), tmscpopen(), tmscpclose();
139 #else BOOT
140 #define	TM		0
141 #define	tmstrategy	nodev
142 #define	tmopen		nodev
143 #define	tmclose		nodev
144 #define	TS		0
145 #define	tsstrategy	nodev
146 #define	tsopen		nodev
147 #define	tsclose		nodev
148 #define	HT		0
149 #define	htstrategy	nodev
150 #define	htopen		nodev
151 #define	htclose		nodev
152 #define	MT		0
153 #define	mtstrategy	nodev
154 #define	mtopen		nodev
155 #define	mtclose		nodev
156 #define	UT		0
157 #define	utstrategy	nodev
158 #define	utopen		nodev
159 #define	utclose		nodev
160 #define	TMSCP		0
161 #define	tmscpstrategy	nodev
162 #define	tmscpopen	nodev
163 #define	tmscpclose	nodev
164 #endif BOOT
165 
166 #ifdef VAX8200
167 #define	KRA		"kra"
168 int	krastrategy(), kraopen(), kraioctl();
169 #else
170 #define	KRA		0
171 #define	krastrategy	nodev
172 #define	kraopen		nodev
173 #define	kraioctl	noioctl
174 #endif
175 
176 struct devsw devsw[] = {
177 	{ HP,	hpstrategy,	hpopen,	nullsys, hpioctl }, /* 0 = hp */
178 	{ HT,	htstrategy,	htopen,	htclose, noioctl }, /* 1 = ht */
179 	{ "up",	upstrategy,	upopen,	nullsys, upioctl }, /* 2 = up */
180 	{ "hk",	rkstrategy,	rkopen,	nullsys, rkioctl }, /* 3 = hk */
181 	{ 0,	nodev,		nodev,	nullsys, noioctl }, /* 4 = sw */
182 	{ TM,	tmstrategy,	tmopen,	tmclose, noioctl }, /* 5 = tm */
183 	{ TS,	tsstrategy,	tsopen,	tsclose, noioctl }, /* 6 = ts */
184 	{ MT,	mtstrategy,	mtopen,	mtclose, noioctl }, /* 7 = mt */
185 	{ 0,	nodev,		nodev,	nullsys, noioctl }, /* 8 = tu */
186 	{ "ra",	rastrategy,	raopen,	nullsys, raioctl }, /* 9 = ra */
187 	{ UT,	utstrategy,	utopen,	utclose, noioctl }, /* 10 = ut */
188 	{ RB,	idcstrategy,	idcopen,nullsys, idcioctl },/* 11 = rb */
189 	{ 0,	nodev,		nodev,	nullsys, noioctl }, /* 12 = uu */
190 	{ 0,	nodev,		nodev,	nullsys, noioctl }, /* 13 = rx */
191 	{ "rl",	rlstrategy,	rlopen,	nullsys, rlioctl }, /* 14 = rl */
192 	{ TMSCP,tmscpstrategy,tmscpopen,tmscpclose,noioctl},/* 15 = tmscp */
193 	{ KRA,	krastrategy,	kraopen,nullsys, kraioctl}, /* 16 = kra */
194 };
195 
196 int	ndevs = (sizeof(devsw) / sizeof(devsw[0]));
197