Commit | Line | Data |
---|---|---|
15637ed4 RG |
1 | /*- |
2 | * Copyright (c) 1990 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * This code is derived from software contributed to Berkeley by | |
6 | * William Jolitz. | |
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. All advertising materials mentioning features or use of this software | |
17 | * must display the following acknowledgement: | |
18 | * This product includes software developed by the University of | |
19 | * California, Berkeley and its contributors. | |
20 | * 4. Neither the name of the University nor the names of its contributors | |
21 | * may be used to endorse or promote products derived from this software | |
22 | * without specific prior written permission. | |
23 | * | |
24 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
34 | * SUCH DAMAGE. | |
35 | * | |
78ed81a3 | 36 | * from: @(#)swapgeneric.c 5.5 (Berkeley) 5/9/91 |
37 | * $Id$ | |
15637ed4 RG |
38 | */ |
39 | ||
40 | #include "machine/pte.h" | |
41 | ||
42 | #include "sys/param.h" | |
43 | #include "sys/conf.h" | |
44 | #include "sys/buf.h" | |
45 | #include "sys/vm.h" | |
46 | #include "sys/systm.h" | |
47 | #include "sys/reboot.h" | |
48 | ||
49 | /* | |
50 | * Generic configuration; all in one | |
51 | */ | |
52 | dev_t rootdev = makedev(0,0); | |
53 | dev_t dumpdev = makedev(0,1); | |
54 | int nswap; | |
55 | struct swdevt swdevt[] = { | |
56 | { 1, 0, 0 }, | |
57 | { 0, 1, 0 }, | |
58 | }; | |
59 | long dumplo; | |
60 | int dmmin, dmmax, dmtext; | |
61 | ||
62 | extern struct driver wddriver; | |
63 | ||
64 | struct genericconf { | |
65 | caddr_t gc_driver; | |
66 | char *gc_name; | |
67 | dev_t gc_root; | |
68 | } genericconf[] = { | |
69 | { (caddr_t)&wddriver, "wd", makedev(0, 0), }, | |
70 | { 0 }, | |
71 | }; | |
72 | ||
73 | setconf() | |
74 | { | |
75 | #ifdef notdef | |
76 | register struct genericconf *gc; | |
77 | int unit, swaponroot = 0; | |
78 | ||
79 | if (rootdev != NODEV) | |
80 | goto doswap; | |
81 | if (boothowto & RB_ASKNAME) { | |
82 | char name[128]; | |
83 | retry: | |
84 | printf("root device? "); | |
85 | gets(name); | |
86 | for (gc = genericconf; gc->gc_driver; gc++) | |
87 | if (gc->gc_name[0] == name[0] && | |
88 | gc->gc_name[1] == name[1]) | |
89 | goto gotit; | |
90 | goto bad; | |
91 | gotit: | |
92 | if (name[3] == '*') { | |
93 | name[3] = name[4]; | |
94 | swaponroot++; | |
95 | } | |
96 | if (name[2] >= '0' && name[2] <= '7' && name[3] == 0) { | |
97 | unit = name[2] - '0'; | |
98 | goto found; | |
99 | } | |
100 | printf("bad/missing unit number\n"); | |
101 | bad: | |
102 | printf("use dk%%d\n"); | |
103 | goto retry; | |
104 | } | |
105 | unit = 0; | |
106 | for (gc = genericconf; gc->gc_driver; gc++) { | |
107 | for (ui = vbdinit; ui->ui_driver; ui++) { | |
108 | if (ui->ui_alive == 0) | |
109 | continue; | |
110 | if (ui->ui_unit == 0 && ui->ui_driver == | |
111 | (struct vba_driver *)gc->gc_driver) { | |
112 | printf("root on %s0\n", | |
113 | ui->ui_driver->ud_dname); | |
114 | goto found; | |
115 | } | |
116 | } | |
117 | } | |
118 | printf("no suitable root\n"); | |
119 | asm("halt"); | |
120 | found: | |
121 | gc->gc_root = makedev(major(gc->gc_root), unit*8); | |
122 | rootdev = gc->gc_root; | |
123 | doswap: | |
124 | swdevt[0].sw_dev = argdev = dumpdev = | |
125 | makedev(major(rootdev), minor(rootdev)+1); | |
126 | /* swap size and dumplo set during autoconfigure */ | |
127 | if (swaponroot) | |
128 | rootdev = dumpdev; | |
129 | #endif | |
130 | } | |
131 | ||
132 | gets(cp) | |
133 | char *cp; | |
134 | { | |
135 | register char *lp; | |
136 | register c; | |
137 | ||
138 | lp = cp; | |
139 | for (;;) { | |
140 | printf("%c", c = cngetc()&0177); | |
141 | switch (c) { | |
142 | case '\n': | |
143 | case '\r': | |
144 | *lp++ = '\0'; | |
145 | return; | |
146 | case '\b': | |
147 | case '\177': | |
148 | if (lp > cp) { | |
149 | printf(" \b"); | |
150 | lp--; | |
151 | } | |
152 | continue; | |
153 | case '#': | |
154 | lp--; | |
155 | if (lp < cp) | |
156 | lp = cp; | |
157 | continue; | |
158 | case '@': | |
159 | case 'u'&037: | |
160 | lp = cp; | |
161 | printf("%c", '\n'); | |
162 | continue; | |
163 | default: | |
164 | *lp++ = c; | |
165 | } | |
166 | } | |
167 | } |