Sun Dec 14 17:03:43 2008 UTC ()
ANSI and KNF from Anon Ymous


(christos)
diff -r1.6 -r1.7 src/sys/arch/i386/stand/lib/biosdisk.h
diff -r1.6 -r1.7 src/sys/arch/i386/stand/lib/pread.c
diff -r1.2 -r1.3 src/sys/arch/i386/stand/lib/biosmca.h
diff -r1.2 -r1.3 src/sys/arch/i386/stand/lib/bootmenu.c
diff -r1.2 -r1.3 src/sys/arch/i386/stand/lib/getsecs.c
diff -r1.4 -r1.5 src/sys/arch/i386/stand/lib/biospci.c
diff -r1.4 -r1.5 src/sys/arch/i386/stand/lib/bootinfo_memmap.c
diff -r1.4 -r1.5 src/sys/arch/i386/stand/lib/isapnp.c
diff -r1.4 -r1.5 src/sys/arch/i386/stand/lib/parseutils.c
diff -r1.3 -r1.4 src/sys/arch/i386/stand/lib/bootinfo.c
diff -r1.3 -r1.4 src/sys/arch/i386/stand/lib/isapnpvar.h
diff -r1.3 -r1.4 src/sys/arch/i386/stand/lib/pcivar.h
diff -r1.8 -r1.9 src/sys/arch/i386/stand/lib/comio_direct.c
diff -r1.8 -r1.9 src/sys/arch/i386/stand/lib/getextmemx.c
diff -r1.13 -r1.14 src/sys/arch/i386/stand/lib/dosfile.c
diff -r1.35 -r1.36 src/sys/arch/i386/stand/lib/exec.c
diff -r1.1.1.1 -r1.2 src/sys/arch/i386/stand/lib/isadma.c
diff -r1.1.1.1 -r1.2 src/sys/arch/i386/stand/lib/isadmavar.h
diff -r1.1 -r1.2 src/sys/arch/i386/stand/lib/menuutils.c
diff -r1.1 -r1.2 src/sys/arch/i386/stand/lib/printmemlist.c

cvs diff -r1.6 -r1.7 src/sys/arch/i386/stand/lib/biosdisk.h (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/biosdisk.h 2005/12/11 12:17:48 1.6
+++ src/sys/arch/i386/stand/lib/biosdisk.h 2008/12/14 17:03:43 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: biosdisk.h,v 1.6 2005/12/11 12:17:48 christos Exp $ */ 1/* $NetBSD: biosdisk.h,v 1.7 2008/12/14 17:03:43 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 4 * Copyright (c) 1996
5 * Matthias Drochner. All rights reserved. 5 * Matthias Drochner. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -20,14 +20,13 @@ @@ -20,14 +20,13 @@
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28int biosdisk_strategy(void *, int, daddr_t, size_t, void *, size_t *); 28int biosdisk_strategy(void *, int, daddr_t, size_t, void *, size_t *);
29int biosdisk_open(struct open_file *, ...); 29int biosdisk_open(struct open_file *, ...);
30int biosdisk_close(struct open_file *); 30int biosdisk_close(struct open_file *);
31int biosdisk_ioctl(struct open_file *, u_long, void *); 31int biosdisk_ioctl(struct open_file *, u_long, void *);
32int biosdisk_findpartition(int, u_int); 32int biosdisk_findpartition(int, u_int);
33 

cvs diff -r1.6 -r1.7 src/sys/arch/i386/stand/lib/pread.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/pread.c 2005/12/11 12:17:48 1.6
+++ src/sys/arch/i386/stand/lib/pread.c 2008/12/14 17:03:43 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pread.c,v 1.6 2005/12/11 12:17:48 christos Exp $ */ 1/* $NetBSD: pread.c,v 1.7 2008/12/14 17:03:43 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 4 * Copyright (c) 1996
5 * Matthias Drochner. All rights reserved. 5 * Matthias Drochner. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -30,44 +30,41 @@ @@ -30,44 +30,41 @@
30 30
31#include <lib/libsa/stand.h> 31#include <lib/libsa/stand.h>
32 32
33#include "libi386.h" 33#include "libi386.h"
34 34
35#ifdef SAVE_MEMORY 35#ifdef SAVE_MEMORY
36#define BUFSIZE (1*1024) 36#define BUFSIZE (1*1024)
37#else 37#else
38#define BUFSIZE (4*1024) 38#define BUFSIZE (4*1024)
39#endif 39#endif
40 40
41static char *buf; 41static char *buf;
42 42
43ssize_t  43ssize_t
44pread(fd, dest, size) 44pread(int fd, void *dest, size_t size)
45 int fd; 
46 void *dest; 
47 size_t size; 
48{ 45{
49 int rsize; 46 int rsize;
50 47
51 if (!buf) 48 if (!buf)
52 buf = alloc(BUFSIZE); 49 buf = alloc(BUFSIZE);
53 50
54 rsize = size; 51 rsize = size;
55 while (rsize > 0) { 52 while (rsize > 0) {
56 int count, got; 53 int count, got;
57 54
58 count = (rsize < BUFSIZE ? rsize : BUFSIZE); 55 count = (rsize < BUFSIZE ? rsize : BUFSIZE);
59 56
60 got = read(fd, buf, count); 57 got = read(fd, buf, count);
61 if (got < 0) 58 if (got < 0)
62 return (-1); 59 return -1;
63 60
64 /* put to physical space */ 61 /* put to physical space */
65 vpbcopy(buf, dest, got); 62 vpbcopy(buf, dest, got);
66 63
67 dest += got; 64 dest += got;
68 rsize -= got; 65 rsize -= got;
69 if (got < count) 66 if (got < count)
70 break; /* EOF */ 67 break; /* EOF */
71 } 68 }
72 return (size - rsize); 69 return size - rsize;
73} 70}

cvs diff -r1.2 -r1.3 src/sys/arch/i386/stand/lib/biosmca.h (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/biosmca.h 2008/04/28 20:23:25 1.2
+++ src/sys/arch/i386/stand/lib/biosmca.h 2008/12/14 17:03:43 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: biosmca.h,v 1.2 2008/04/28 20:23:25 martin Exp $ */ 1/* $NetBSD: biosmca.h,v 1.3 2008/12/14 17:03:43 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2001 The NetBSD Foundation, Inc. 4 * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -16,16 +16,16 @@ @@ -16,16 +16,16 @@
16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29void biosmca __P((void)); 29void biosmca(void);
30 30
31extern int biosmca_ps2model; 31extern int biosmca_ps2model;

cvs diff -r1.2 -r1.3 src/sys/arch/i386/stand/lib/bootmenu.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/bootmenu.c 2008/12/13 23:30:54 1.2
+++ src/sys/arch/i386/stand/lib/bootmenu.c 2008/12/14 17:03:43 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bootmenu.c,v 1.2 2008/12/13 23:30:54 christos Exp $ */ 1/* $NetBSD: bootmenu.c,v 1.3 2008/12/14 17:03:43 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -59,27 +59,27 @@ atoi(const char *in) @@ -59,27 +59,27 @@ atoi(const char *in)
59 ret = 0; 59 ret = 0;
60 c = (char *)in; 60 c = (char *)in;
61 if (*c == '-') 61 if (*c == '-')
62 c++; 62 c++;
63 for (; isnum(*c); c++) 63 for (; isnum(*c); c++)
64 ret = (ret * 10) + (*c - '0'); 64 ret = (ret * 10) + (*c - '0');
65 65
66 return (*in == '-') ? -ret : ret; 66 return (*in == '-') ? -ret : ret;
67} 67}
68 68
69/* 69/*
70 * This function parses a boot.cfg file in the root of the filesystem 70 * This function parses a boot.cfg file in the root of the filesystem
71 * (if present) and populates the global boot configuration. 71 * (if present) and populates the global boot configuration.
72 *  72 *
73 * The file consists of a number of lines each terminated by \n 73 * The file consists of a number of lines each terminated by \n
74 * The lines are in the format keyword=value. There should not be spaces 74 * The lines are in the format keyword=value. There should not be spaces
75 * around the = sign. 75 * around the = sign.
76 * 76 *
77 * The recognised keywords are: 77 * The recognised keywords are:
78 * banner: text displayed instead of the normal welcome text 78 * banner: text displayed instead of the normal welcome text
79 * menu: Descriptive text:command to use 79 * menu: Descriptive text:command to use
80 * timeout: Timeout in seconds (overrides that set by installboot) 80 * timeout: Timeout in seconds (overrides that set by installboot)
81 * default: the default menu option to use if Return is pressed 81 * default: the default menu option to use if Return is pressed
82 * consdev: the console device to use 82 * consdev: the console device to use
83 * format: how menu choices are displayed: (a)utomatic, (n)umbers or (l)etters 83 * format: how menu choices are displayed: (a)utomatic, (n)umbers or (l)etters
84 * clear: whether to clear the screen or not 84 * clear: whether to clear the screen or not
85 * 85 *
@@ -95,79 +95,79 @@ atoi(const char *in) @@ -95,79 +95,79 @@ atoi(const char *in)
95 * default=1 95 * default=1
96*/ 96*/
97void 97void
98parsebootconf(const char *conf) 98parsebootconf(const char *conf)
99{ 99{
100 char *bc, *c; 100 char *bc, *c;
101 int cmenu, cbanner, len; 101 int cmenu, cbanner, len;
102 int fd, err, off; 102 int fd, err, off;
103 struct stat st; 103 struct stat st;
104 char *key, *value, *v2; 104 char *key, *value, *v2;
105 105
106 /* Clear bootconf structure */ 106 /* Clear bootconf structure */
107 bzero((void *)&bootconf, sizeof(bootconf)); 107 bzero((void *)&bootconf, sizeof(bootconf));
108  108
109 /* Set timeout to configured */ 109 /* Set timeout to configured */
110 bootconf.timeout = boot_params.bp_timeout; 110 bootconf.timeout = boot_params.bp_timeout;
111 111
112 /* automatically switch between letter and numbers on menu */ 112 /* automatically switch between letter and numbers on menu */
113 bootconf.menuformat = MENUFORMAT_AUTO; 113 bootconf.menuformat = MENUFORMAT_AUTO;
114 114
115 fd = open(BOOTCONF, 0); 115 fd = open(BOOTCONF, 0);
116 if (fd < 0) 116 if (fd < 0)
117 return; 117 return;
118  118
119 err = fstat(fd, &st); 119 err = fstat(fd, &st);
120 if (err == -1) { 120 if (err == -1) {
121 close(fd); 121 close(fd);
122 return; 122 return;
123 } 123 }
124 124
125 bc = alloc(st.st_size + 1); 125 bc = alloc(st.st_size + 1);
126 if (bc == NULL) { 126 if (bc == NULL) {
127 printf("Could not allocate memory for boot configuration\n"); 127 printf("Could not allocate memory for boot configuration\n");
128 return; 128 return;
129 } 129 }
130  130
131 off = 0; 131 off = 0;
132 do { 132 do {
133 len = read(fd, bc + off, 1024); 133 len = read(fd, bc + off, 1024);
134 if (len <= 0) 134 if (len <= 0)
135 break; 135 break;
136 off += len; 136 off += len;
137 } while (len > 0); 137 } while (len > 0);
138 bc[off] = '\0'; 138 bc[off] = '\0';
139  139
140 close(fd); 140 close(fd);
141 /* bc now contains the whole boot.cfg file */ 141 /* bc now contains the whole boot.cfg file */
142  142
143 cmenu = 0; 143 cmenu = 0;
144 cbanner = 0; 144 cbanner = 0;
145 for(c = bc; *c; c++) { 145 for(c = bc; *c; c++) {
146 key = c; 146 key = c;
147 /* Look for = separator between key and value */ 147 /* Look for = separator between key and value */
148 for (; *c && *c != '='; c++) 148 for (; *c && *c != '='; c++)
149 continue; 149 continue;
150 if (*c == '\0') 150 if (*c == '\0')
151 break; /* break if at end of data */ 151 break; /* break if at end of data */
152  152
153 /* zero terminate key which points to keyword */ 153 /* zero terminate key which points to keyword */
154 *c++ = 0; 154 *c++ = 0;
155 value = c; 155 value = c;
156 /* Look for end of line (or file) and zero terminate value */ 156 /* Look for end of line (or file) and zero terminate value */
157 for (; *c && *c != '\n'; c++) 157 for (; *c && *c != '\n'; c++)
158 continue; 158 continue;
159 *c = 0; 159 *c = 0;
160  160
161 if (!strncmp(key, "menu", 4)) { 161 if (!strncmp(key, "menu", 4)) {
162 /* 162 /*
163 * Parse "menu=<description>:<command>". If the 163 * Parse "menu=<description>:<command>". If the
164 * description is empty ("menu=:<command>)", 164 * description is empty ("menu=:<command>)",
165 * then re-use the command as the description. 165 * then re-use the command as the description.
166 * Note that the command may contain embedded 166 * Note that the command may contain embedded
167 * colons. 167 * colons.
168 */ 168 */
169 if (cmenu >= MAXMENU) 169 if (cmenu >= MAXMENU)
170 continue; 170 continue;
171 bootconf.desc[cmenu] = value; 171 bootconf.desc[cmenu] = value;
172 for (v2=value; *v2 && *v2 != ':'; v2++) 172 for (v2=value; *v2 && *v2 != ':'; v2++)
173 continue; 173 continue;
@@ -216,33 +216,33 @@ parsebootconf(const char *conf) @@ -216,33 +216,33 @@ parsebootconf(const char *conf)
216 break; 216 break;
217 } 217 }
218 } else if (!strncmp(key, "clear", 5)) { 218 } else if (!strncmp(key, "clear", 5)) {
219 bootconf.clear = !!atoi(value); 219 bootconf.clear = !!atoi(value);
220 } 220 }
221 } 221 }
222 switch (bootconf.menuformat) { 222 switch (bootconf.menuformat) {
223 case MENUFORMAT_AUTO: 223 case MENUFORMAT_AUTO:
224 if (cmenu > 9 && bootconf.timeout > 0) 224 if (cmenu > 9 && bootconf.timeout > 0)
225 bootconf.menuformat = MENUFORMAT_LETTER; 225 bootconf.menuformat = MENUFORMAT_LETTER;
226 else 226 else
227 bootconf.menuformat = MENUFORMAT_NUMBER; 227 bootconf.menuformat = MENUFORMAT_NUMBER;
228 break; 228 break;
229  229
230 case MENUFORMAT_NUMBER: 230 case MENUFORMAT_NUMBER:
231 if (cmenu > 9 && bootconf.timeout > 0) 231 if (cmenu > 9 && bootconf.timeout > 0)
232 cmenu = 9; 232 cmenu = 9;
233 break; 233 break;
234 } 234 }
235  235
236 bootconf.nummenu = cmenu; 236 bootconf.nummenu = cmenu;
237 if (bootconf.def < 0) 237 if (bootconf.def < 0)
238 bootconf.def = 0; 238 bootconf.def = 0;
239 if (bootconf.def >= cmenu) 239 if (bootconf.def >= cmenu)
240 bootconf.def = cmenu - 1; 240 bootconf.def = cmenu - 1;
241} 241}
242 242
243/* 243/*
244 * doboottypemenu will render the menu and parse any user input 244 * doboottypemenu will render the menu and parse any user input
245 */ 245 */
246static int 246static int
247getchoicefrominput(char *input, int def) 247getchoicefrominput(char *input, int def)
248{ 248{
@@ -257,76 +257,76 @@ getchoicefrominput(char *input, int def) @@ -257,76 +257,76 @@ getchoicefrominput(char *input, int def)
257 else if (isnum(*input)) { 257 else if (isnum(*input)) {
258 choice = atoi(input) - 1; 258 choice = atoi(input) - 1;
259 if (choice < 0 || choice >= bootconf.nummenu) 259 if (choice < 0 || choice >= bootconf.nummenu)
260 choice = -1; 260 choice = -1;
261 } 261 }
262 return choice; 262 return choice;
263} 263}
264 264
265void 265void
266doboottypemenu(void) 266doboottypemenu(void)
267{ 267{
268 int choice; 268 int choice;
269 char input[80], *ic, *oc; 269 char input[80], *ic, *oc;
270  270
271 printf("\n"); 271 printf("\n");
272 /* Display menu */ 272 /* Display menu */
273 if (bootconf.menuformat == MENUFORMAT_LETTER) { 273 if (bootconf.menuformat == MENUFORMAT_LETTER) {
274 for (choice = 0; choice < bootconf.nummenu; choice++) 274 for (choice = 0; choice < bootconf.nummenu; choice++)
275 printf(" %c. %s\n", choice + 'A', 275 printf(" %c. %s\n", choice + 'A',
276 bootconf.desc[choice]); 276 bootconf.desc[choice]);
277 } else { 277 } else {
278 /* Can't use %2d format string with libsa */ 278 /* Can't use %2d format string with libsa */
279 for (choice = 0; choice < bootconf.nummenu; choice++) 279 for (choice = 0; choice < bootconf.nummenu; choice++)
280 printf(" %s%d. %s\n", 280 printf(" %s%d. %s\n",
281 (choice < 9) ? " " : "", 281 (choice < 9) ? " " : "",
282 choice + 1, 282 choice + 1,
283 bootconf.desc[choice]); 283 bootconf.desc[choice]);
284 }  284 }
285 choice = -1; 285 choice = -1;
286 for(;;) { 286 for(;;) {
287 input[0] = '\0'; 287 input[0] = '\0';
288  288
289 if (bootconf.timeout < 0) { 289 if (bootconf.timeout < 0) {
290 if (bootconf.menuformat == MENUFORMAT_LETTER) 290 if (bootconf.menuformat == MENUFORMAT_LETTER)
291 printf("\nOption: [%c]:", 291 printf("\nOption: [%c]:",
292 bootconf.def + 'A'); 292 bootconf.def + 'A');
293 else 293 else
294 printf("\nOption: [%d]:", 294 printf("\nOption: [%d]:",
295 bootconf.def + 1); 295 bootconf.def + 1);
296  296
297 gets(input); 297 gets(input);
298 choice = getchoicefrominput(input, bootconf.def); 298 choice = getchoicefrominput(input, bootconf.def);
299 } else if (bootconf.timeout == 0) 299 } else if (bootconf.timeout == 0)
300 choice = bootconf.def; 300 choice = bootconf.def;
301 else { 301 else {
302 printf("\nChoose an option; RETURN for default; " 302 printf("\nChoose an option; RETURN for default; "
303 "SPACE to stop countdown.\n"); 303 "SPACE to stop countdown.\n");
304 if (bootconf.menuformat == MENUFORMAT_LETTER) 304 if (bootconf.menuformat == MENUFORMAT_LETTER)
305 printf("Option %c will be chosen in ", 305 printf("Option %c will be chosen in ",
306 bootconf.def + 'A'); 306 bootconf.def + 'A');
307 else 307 else
308 printf("Option %d will be chosen in ", 308 printf("Option %d will be chosen in ",
309 bootconf.def + 1); 309 bootconf.def + 1);
310 input[0] = awaitkey(bootconf.timeout, 1); 310 input[0] = awaitkey(bootconf.timeout, 1);
311 input[1] = '\0'; 311 input[1] = '\0';
312 choice = getchoicefrominput(input, bootconf.def); 312 choice = getchoicefrominput(input, bootconf.def);
313 /* If invalid key pressed, drop to menu */ 313 /* If invalid key pressed, drop to menu */
314 if (choice == -1) 314 if (choice == -1)
315 bootconf.timeout = -1; 315 bootconf.timeout = -1;
316 } 316 }
317 if (choice < 0) 317 if (choice < 0)
318 continue; 318 continue;
319 if (!strcmp(bootconf.command[choice], "prompt") &&  319 if (!strcmp(bootconf.command[choice], "prompt") &&
320 ((boot_params.bp_flags & X86_BP_FLAGS_PASSWORD) == 0 || 320 ((boot_params.bp_flags & X86_BP_FLAGS_PASSWORD) == 0 ||
321 check_password((char *)boot_params.bp_password))) { 321 check_password((char *)boot_params.bp_password))) {
322 printf("type \"?\" or \"help\" for help.\n"); 322 printf("type \"?\" or \"help\" for help.\n");
323 bootmenu(); /* does not return */ 323 bootmenu(); /* does not return */
324 } else { 324 } else {
325 ic = bootconf.command[choice]; 325 ic = bootconf.command[choice];
326 /* Split command string at ; into separate commands */ 326 /* Split command string at ; into separate commands */
327 do { 327 do {
328 oc = input; 328 oc = input;
329 /* Look for ; separator */ 329 /* Look for ; separator */
330 for (; *ic && *ic != COMMAND_SEPARATOR; ic++) 330 for (; *ic && *ic != COMMAND_SEPARATOR; ic++)
331 *oc++ = *ic; 331 *oc++ = *ic;
332 if (*input == '\0') 332 if (*input == '\0')
@@ -334,18 +334,18 @@ doboottypemenu(void) @@ -334,18 +334,18 @@ doboottypemenu(void)
334 /* Strip out any trailing spaces */ 334 /* Strip out any trailing spaces */
335 oc--; 335 oc--;
336 for (; *oc ==' ' && oc > input; oc--); 336 for (; *oc ==' ' && oc > input; oc--);
337 *++oc = '\0'; 337 *++oc = '\0';
338 if (*ic == COMMAND_SEPARATOR) 338 if (*ic == COMMAND_SEPARATOR)
339 ic++; 339 ic++;
340 /* Stop silly command strings like ;;; */ 340 /* Stop silly command strings like ;;; */
341 if (*input != '\0') 341 if (*input != '\0')
342 docommand(input); 342 docommand(input);
343 /* Skip leading spaces */ 343 /* Skip leading spaces */
344 for (; *ic == ' '; ic++); 344 for (; *ic == ' '; ic++);
345 } while (*ic); 345 } while (*ic);
346 } 346 }
347  347
348 } 348 }
349} 349}
350 350
351#endif /* !SMALL */ 351#endif /* !SMALL */

cvs diff -r1.2 -r1.3 src/sys/arch/i386/stand/lib/getsecs.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/getsecs.c 1999/04/14 11:17:05 1.2
+++ src/sys/arch/i386/stand/lib/getsecs.c 2008/12/14 17:03:43 1.3
@@ -1,43 +1,42 @@ @@ -1,43 +1,42 @@
1/* $NetBSD: getsecs.c,v 1.2 1999/04/14 11:17:05 drochner Exp $ */ 1/* $NetBSD: getsecs.c,v 1.3 2008/12/14 17:03:43 christos Exp $ */
2 2
3/* extracted from netbsd:sys/arch/i386/netboot/misc.c */ 3/* extracted from netbsd:sys/arch/i386/netboot/misc.c */
4 4
5#include <sys/types.h> 5#include <sys/types.h>
6 6
7#include <lib/libsa/stand.h> 7#include <lib/libsa/stand.h>
8 8
9#include "libi386.h" 9#include "libi386.h"
10 10
11extern int biosgetrtc __P((u_long*)); 11extern int biosgetrtc(u_long*);
12 12
13static inline u_long bcd2dec __P((u_long)); 13static inline u_long bcd2dec(u_long);
14 14
15static inline u_long 15static inline u_long
16bcd2dec(arg) 16bcd2dec(u_long arg)
17 u_long arg; 
18{ 17{
19 return ((arg >> 4) * 10 + (arg & 0x0f)); 18 return (arg >> 4) * 10 + (arg & 0x0f);
20} 19}
21 20
22time_t 21time_t
23getsecs() { 22getsecs(void) {
24 /* 23 /*
25 * Return the current time in seconds 24 * Return the current time in seconds
26 */ 25 */
27 26
28 u_long t; 27 u_long t;
29 time_t sec; 28 time_t sec;
30 29
31 if (biosgetrtc(&t)) 30 if (biosgetrtc(&t))
32 panic("RTC invalid"); 31 panic("RTC invalid");
33 32
34 sec = bcd2dec(t & 0xff); 33 sec = bcd2dec(t & 0xff);
35 sec *= 60; 34 sec *= 60;
36 t >>= 8; 35 t >>= 8;
37 sec += bcd2dec(t & 0xff); 36 sec += bcd2dec(t & 0xff);
38 sec *= 60; 37 sec *= 60;
39 t >>= 8; 38 t >>= 8;
40 sec += bcd2dec(t & 0xff); 39 sec += bcd2dec(t & 0xff);
41 40
42 return (sec); 41 return sec;
43} 42}

cvs diff -r1.4 -r1.5 src/sys/arch/i386/stand/lib/biospci.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/biospci.c 2005/12/11 12:17:48 1.4
+++ src/sys/arch/i386/stand/lib/biospci.c 2008/12/14 17:03:43 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: biospci.c,v 1.4 2005/12/11 12:17:48 christos Exp $ */ 1/* $NetBSD: biospci.c,v 1.5 2008/12/14 17:03:43 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 4 * Copyright (c) 1996
5 * Matthias Drochner. All rights reserved. 5 * Matthias Drochner. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -24,81 +24,73 @@ @@ -24,81 +24,73 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * 26 *
27 */ 27 */
28 28
29/* 29/*
30 * basic PCI functions for libsa needs lowlevel parts from bios_pci.S 30 * basic PCI functions for libsa needs lowlevel parts from bios_pci.S
31 */ 31 */
32 32
33#include <lib/libsa/stand.h> 33#include <lib/libsa/stand.h>
34 34
35#include "pcivar.h" 35#include "pcivar.h"
36 36
37extern int pcibios_present __P((int *)); 37extern int pcibios_present(int *);
38extern int pcibios_finddev __P((int, int, int, unsigned int *)); 38extern int pcibios_finddev(int, int, int, unsigned int *);
39extern int pcibios_cfgread __P((unsigned int, int, int *)); 39extern int pcibios_cfgread(unsigned int, int, int *);
40extern int pcibios_cfgwrite __P((unsigned int, int, int)); 40extern int pcibios_cfgwrite(unsigned int, int, int);
41 41
42#define PCISIG ('P' | ('C' << 8) | ('I' << 16) | (' ' << 24)) 42#define PCISIG ('P' | ('C' << 8) | ('I' << 16) | (' ' << 24))
43 43
44int  44int
45pcicheck() 45pcicheck(void)
46{ 46{
47 int ret, sig; 47 int ret, sig;
48 48
49 ret = pcibios_present(&sig); 49 ret = pcibios_present(&sig);
50 50
51 if ((ret & 0xff00) || (sig != PCISIG)) 51 if ((ret & 0xff00) || (sig != PCISIG))
52 return (-1); 52 return -1;
53 53
54 return (0); 54 return 0;
55} 55}
56 56
57int  57int
58pcifinddev(vid, did, handle) 58pcifinddev(int vid, int did, pcihdl_t *handle)
59 int vid, did; 
60 pcihdl_t *handle; 
61{ 59{
62 int ret; 60 int ret;
63 61
64 *handle = 0; 62 *handle = 0;
65 63
66 ret = pcibios_finddev(vid, did, 0, handle); 64 ret = pcibios_finddev(vid, did, 0, handle);
67 65
68 if (ret) 66 if (ret)
69 return (-1); 67 return -1;
70 68
71 return (0); 69 return 0;
72} 70}
73 71
74int  72int
75pcicfgread(handle, off, val) 73pcicfgread(pcihdl_t *handle, int off, int *val)
76 pcihdl_t *handle; 
77 int off; 
78 int *val; 
79{ 74{
80 int ret; 75 int ret;
81 76
82 ret = pcibios_cfgread(*handle, off, val); 77 ret = pcibios_cfgread(*handle, off, val);
83 78
84 if (ret) 79 if (ret)
85 return (-1); 80 return -1;
86 81
87 return (0); 82 return 0;
88} 83}
89 84
90int  85int
91pcicfgwrite(handle, off, val) 86pcicfgwrite(pcihdl_t *handle, int off, int val)
92 pcihdl_t *handle; 
93 int off; 
94 int val; 
95{ 87{
96 int ret; 88 int ret;
97 89
98 ret = pcibios_cfgwrite(*handle, off, val); 90 ret = pcibios_cfgwrite(*handle, off, val);
99 91
100 if (ret) 92 if (ret)
101 return (-1); 93 return -1;
102 94
103 return (0); 95 return 0;
104} 96}

cvs diff -r1.4 -r1.5 src/sys/arch/i386/stand/lib/bootinfo_memmap.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/bootinfo_memmap.c 2005/12/11 12:17:48 1.4
+++ src/sys/arch/i386/stand/lib/bootinfo_memmap.c 2008/12/14 17:03:43 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bootinfo_memmap.c,v 1.4 2005/12/11 12:17:48 christos Exp $ */ 1/* $NetBSD: bootinfo_memmap.c,v 1.5 2008/12/14 17:03:43 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1999 4 * Copyright (c) 1999
5 * Matthias Drochner. All rights reserved. 5 * Matthias Drochner. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -20,30 +20,30 @@ @@ -20,30 +20,30 @@
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * 26 *
27 */ 27 */
28 28
29#include <lib/libsa/stand.h> 29#include <lib/libsa/stand.h>
30#include "libi386.h" 30#include "libi386.h"
31#include "bootinfo.h" 31#include "bootinfo.h"
32 32
33extern int getmementry __P((int *, int *)); 33extern int getmementry(int *, int *);
34 34
35void 35void
36bi_getmemmap() 36bi_getmemmap(void)
37{ 37{
38 int buf[5], i, nranges, n; 38 int buf[5], i, nranges, n;
39 struct btinfo_memmap *bimm; 39 struct btinfo_memmap *bimm;
40 40
41 nranges = 0; 41 nranges = 0;
42 i = 0; 42 i = 0;
43 do { 43 do {
44 if (getmementry(&i, buf)) 44 if (getmementry(&i, buf))
45 break; 45 break;
46 nranges++; 46 nranges++;
47 } while (i); 47 } while (i);
48 48
49 bimm = alloc(sizeof(struct btinfo_memmap) 49 bimm = alloc(sizeof(struct btinfo_memmap)

cvs diff -r1.4 -r1.5 src/sys/arch/i386/stand/lib/isapnp.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/isapnp.c 2005/12/11 12:17:48 1.4
+++ src/sys/arch/i386/stand/lib/isapnp.c 2008/12/14 17:03:43 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: isapnp.c,v 1.4 2005/12/11 12:17:48 christos Exp $ */ 1/* $NetBSD: isapnp.c,v 1.5 2008/12/14 17:03:43 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1997 4 * Copyright (c) 1997
5 * Matthias Drochner. All rights reserved. 5 * Matthias Drochner. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -53,150 +53,145 @@ enum { @@ -53,150 +53,145 @@ enum {
53 RESDATA, 53 RESDATA,
54 RESSTAT, 54 RESSTAT,
55 SETCSN, 55 SETCSN,
56 SETLDEV 56 SETLDEV
57}; 57};
58 58
59#define MEMBASE 0x40 59#define MEMBASE 0x40
60#define IOBASE 0x60 60#define IOBASE 0x60
61#define INTBASE 0x70 61#define INTBASE 0x70
62#define DMABASE 0x74 62#define DMABASE 0x74
63 63
64static int pnpdataport; 64static int pnpdataport;
65 65
66static int  66static int
67getiobase(nr) 67getiobase(int nr)
68 int nr; 
69{ 68{
70 unsigned short iobase; 69 unsigned short iobase;
71 70
72 outb(PNPADDR, SETLDEV); 71 outb(PNPADDR, SETLDEV);
73 outb(PNPWDATA, 0); /* subdev 0 */ 72 outb(PNPWDATA, 0); /* subdev 0 */
74 73
75 outb(PNPADDR, IOBASE + nr * 2); 74 outb(PNPADDR, IOBASE + nr * 2);
76 iobase = (inb(pnpdataport) << 8); 75 iobase = (inb(pnpdataport) << 8);
77 outb(PNPADDR, IOBASE + nr * 2 + 1); 76 outb(PNPADDR, IOBASE + nr * 2 + 1);
78 iobase |= inb(pnpdataport); 77 iobase |= inb(pnpdataport);
79 78
80 return (iobase); 79 return iobase;
81} 80}
82 81
83static int  82static int
84getdmachan(nr) 83getdmachan(int nr)
85 int nr; 
86{ 84{
87 unsigned char dmachannel; 85 unsigned char dmachannel;
88 86
89 outb(PNPADDR, SETLDEV); 87 outb(PNPADDR, SETLDEV);
90 outb(PNPWDATA, 0); /* subdev 0 */ 88 outb(PNPWDATA, 0); /* subdev 0 */
91 89
92 outb(PNPADDR, DMABASE + nr); 90 outb(PNPADDR, DMABASE + nr);
93 dmachannel = inb(pnpdataport) & 0x07; 91 dmachannel = inb(pnpdataport) & 0x07;
94 92
95 return (dmachannel); 93 return dmachannel;
96} 94}
97 95
98struct cardid { 96struct cardid {
99 unsigned char eisaid[4]; 97 unsigned char eisaid[4];
100 unsigned int serial; 98 unsigned int serial;
101 unsigned char crc; 99 unsigned char crc;
102}; 100};
103 101
104/* 102/*
105 do isolation, call pnpscanresc() in board config state 103 do isolation, call pnpscanresc() in board config state
106 */ 104 */
107static int  105static int
108pnpisol(csn) 106pnpisol(int csn)
109 int csn; 
110{ 107{
111 unsigned char buf[9]; 108 unsigned char buf[9];
112 int i, j; 109 int i, j;
113 struct cardid *id; 110 struct cardid *id;
114 unsigned char crc = 0x6a; 111 unsigned char crc = 0x6a;
115 112
116 /* 113 /*
117 * do 72 pairs of reads from ISOL register all but 1 go to sleep 114 * do 72 pairs of reads from ISOL register all but 1 go to sleep
118 * state (ch. 3.3) 115 * state (ch. 3.3)
119 */ 116 */
120 outb(PNPADDR, ISOL); 117 outb(PNPADDR, ISOL);
121 delay(1000); 118 delay(1000);
122 119
123 for (i = 0; i < 9; i++) { 120 for (i = 0; i < 9; i++) {
124 for (j = 0; j < 8; j++) { 121 for (j = 0; j < 8; j++) {
125 unsigned char a, b; 122 unsigned char a, b;
126 int bitset; 123 int bitset;
127 124
128 a = inb(pnpdataport); 125 a = inb(pnpdataport);
129 b = inb(pnpdataport); 126 b = inb(pnpdataport);
130 if ((a == 0x55) && (b == 0xaa)) 127 if ((a == 0x55) && (b == 0xaa))
131 bitset = 1; 128 bitset = 1;
132 else if ((a == 0xff) && (b == 0xff)) 129 else if ((a == 0xff) && (b == 0xff))
133 bitset = 0; 130 bitset = 0;
134 else 131 else
135 return (-1); /* data port conflict */ 132 return -1; /* data port conflict */
136 133
137 buf[i] = (buf[i] >> 1) | (bitset << 7); 134 buf[i] = (buf[i] >> 1) | (bitset << 7);
138 135
139 if (i < 8) /* calc crc for first 8 bytes (app. 136 if (i < 8) /* calc crc for first 8 bytes (app.
140 * B.2) */ 137 * B.2) */
141 crc = (crc >> 1) | 138 crc = (crc >> 1) |
142 ((bitset != ((crc & 1) == !(crc & 2))) << 7); 139 ((bitset != ((crc & 1) == !(crc & 2))) << 7);
143 140
144 delay(250); 141 delay(250);
145 } 142 }
146 } 143 }
147 id = (struct cardid *) buf; 144 id = (struct cardid *) buf;
148 145
149 if (id->crc != crc) 146 if (id->crc != crc)
150 return (0); /* normal end */ 147 return 0; /* normal end */
151 148
152 outb(PNPADDR, SETCSN); 149 outb(PNPADDR, SETCSN);
153 outb(PNPWDATA, csn); /* set csn for winning card and put it to 150 outb(PNPWDATA, csn); /* set csn for winning card and put it to
154 * config state */ 151 * config state */
155 152
156 return ((id->eisaid[0] << 24) | (id->eisaid[1] << 16) 153 return (id->eisaid[0] << 24) | (id->eisaid[1] << 16)
157 | (id->eisaid[2] << 8) | (id->eisaid[3])); 154 | (id->eisaid[2] << 8) | (id->eisaid[3]);
158} 155}
159 156
160static void  157static void
161pnpisolreset() 158pnpisolreset(void)
162{ 159{
163 outb(PNPADDR, WAKE); 160 outb(PNPADDR, WAKE);
164 outb(PNPWDATA, 0); /* put all remaining cards to isolation state */ 161 outb(PNPWDATA, 0); /* put all remaining cards to isolation state */
165} 162}
166 163
167/* 164/*
168 send initiation sequence (app. B.1) 165 send initiation sequence (app. B.1)
169 */ 166 */
170static void  167static void
171pnpinit() 168pnpinit(void)
172{ 169{
173 int i; 170 int i;
174 unsigned char key = 0x6a; 171 unsigned char key = 0x6a;
175 172
176 outb(PNPADDR, 0); 173 outb(PNPADDR, 0);
177 outb(PNPADDR, 0); 174 outb(PNPADDR, 0);
178 175
179 for (i = 0; i < 32; i++) { 176 for (i = 0; i < 32; i++) {
180 outb(PNPADDR, key); 177 outb(PNPADDR, key);
181 key = (key >> 1) | 178 key = (key >> 1) |
182 (((key & 1) == !(key & 2)) << 7); 179 (((key & 1) == !(key & 2)) << 7);
183 } 180 }
184} 181}
185 182
186int  183int
187isapnp_finddev(id, iobase, dmachan) 184isapnp_finddev(int id, int *iobase, int *dmachan)
188 int id; 
189 int *iobase, *dmachan; 
190{ 185{
191 int csn; 186 int csn;
192 187
193 outb(PNPADDR, CONTROL); 188 outb(PNPADDR, CONTROL);
194 outb(PNPWDATA, 2); /* XXX force wait for key */ 189 outb(PNPWDATA, 2); /* XXX force wait for key */
195 190
196 /* scan all allowed data ports (ch. 3.1) */ 191 /* scan all allowed data ports (ch. 3.1) */
197 for (pnpdataport = PNPRDATAMIN; pnpdataport <= PNPRDATAMAX; 192 for (pnpdataport = PNPRDATAMIN; pnpdataport <= PNPRDATAMAX;
198 pnpdataport += 4) { 193 pnpdataport += 4) {
199 int res, found = 0; 194 int res, found = 0;
200 195
201 pnpinit(); /* initiation sequence */ 196 pnpinit(); /* initiation sequence */
202 197
@@ -218,19 +213,19 @@ isapnp_finddev(id, iobase, dmachan) @@ -218,19 +213,19 @@ isapnp_finddev(id, iobase, dmachan)
218 if (iobase) 213 if (iobase)
219 *iobase = getiobase(0); 214 *iobase = getiobase(0);
220 if (dmachan) 215 if (dmachan)
221 *dmachan = getdmachan(0); 216 *dmachan = getdmachan(0);
222 found = 1; 217 found = 1;
223 } 218 }
224 pnpisolreset(); 219 pnpisolreset();
225 } while ((res != 0) && (res != -1)); 220 } while ((res != 0) && (res != -1));
226 221
227 outb(PNPADDR, CONTROL); 222 outb(PNPADDR, CONTROL);
228 outb(PNPWDATA, 2); /* return to wait for key */ 223 outb(PNPWDATA, 2); /* return to wait for key */
229 224
230 if (csn > 1) /* at least 1 board found */ 225 if (csn > 1) /* at least 1 board found */
231 return (!found); 226 return !found;
232 227
233 /* if no board found, try next dataport */ 228 /* if no board found, try next dataport */
234 } 229 }
235 return (-1); /* nothing found */ 230 return -1; /* nothing found */
236} 231}

cvs diff -r1.4 -r1.5 src/sys/arch/i386/stand/lib/parseutils.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/parseutils.c 2008/12/09 15:38:52 1.4
+++ src/sys/arch/i386/stand/lib/parseutils.c 2008/12/14 17:03:43 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: parseutils.c,v 1.4 2008/12/09 15:38:52 christos Exp $ */ 1/* $NetBSD: parseutils.c,v 1.5 2008/12/14 17:03:43 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, 1997 4 * Copyright (c) 1996, 1997
5 * Matthias Drochner. All rights reserved. 5 * Matthias Drochner. All rights reserved.
6 * Copyright (c) 1996, 1997 6 * Copyright (c) 1996, 1997
7 * Perry E. Metzger. All rights reserved. 7 * Perry E. Metzger. All rights reserved.
8 * Copyright (c) 1997 8 * Copyright (c) 1997
9 * Jason R. Thorpe. All rights reserved 9 * Jason R. Thorpe. All rights reserved
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -38,111 +38,105 @@ @@ -38,111 +38,105 @@
38 */ 38 */
39 39
40#include <lib/libkern/libkern.h> 40#include <lib/libkern/libkern.h>
41#include <lib/libsa/stand.h> 41#include <lib/libsa/stand.h>
42#include <sys/boot_flag.h> 42#include <sys/boot_flag.h>
43 43
44#include "libi386.h" 44#include "libi386.h"
45 45
46/* 46/*
47 * chops the head from the arguments and returns the arguments if any, 47 * chops the head from the arguments and returns the arguments if any,
48 * or possibly an empty string. 48 * or possibly an empty string.
49 */ 49 */
50char * 50char *
51gettrailer(arg) 51gettrailer(char *arg)
52 char *arg; 
53{ 52{
54 char *options; 53 char *options;
55 54
56 if ((options = strchr(arg, ' ')) == NULL) 55 if ((options = strchr(arg, ' ')) == NULL)
57 return (""); 56 return "";
58 else 57 else
59 *options++ = '\0'; 58 *options++ = '\0';
60 59
61 /* trim leading blanks */ 60 /* trim leading blanks */
62 while (*options && *options == ' ') 61 while (*options && *options == ' ')
63 options++; 62 options++;
64 63
65 return (options); 64 return options;
66} 65}
67 66
68int 67int
69parseopts(opts, howto) 68parseopts(const char *opts, int *howto)
70 const char *opts; 
71 int *howto; 
72{ 69{
73 int r, tmpopt = 0; 70 int r, tmpopt = 0;
74 71
75 opts++; /* skip - */ 72 opts++; /* skip - */
76 while (*opts) { 73 while (*opts) {
77 r = 0; 74 r = 0;
78 BOOT_FLAG(*opts, r); 75 BOOT_FLAG(*opts, r);
79 if (r == 0) { 76 if (r == 0) {
80 printf("-%c: unknown flag\n", *opts); 77 printf("-%c: unknown flag\n", *opts);
81 command_help(NULL); 78 command_help(NULL);
82 return(0); 79 return 0;
83 } 80 }
84 tmpopt |= r; 81 tmpopt |= r;
85 opts++; 82 opts++;
86 if (*opts == ' ' || *opts == '\t') { 83 if (*opts == ' ' || *opts == '\t') {
87 do 84 do
88 opts++; /* skip whitespace */ 85 opts++; /* skip whitespace */
89 while (*opts == ' ' || *opts == '\t'); 86 while (*opts == ' ' || *opts == '\t');
90 if (*opts == '-') 87 if (*opts == '-')
91 opts++; /* skip - */ 88 opts++; /* skip - */
92 else if (*opts != '\0') { 89 else if (*opts != '\0') {
93 printf("invalid arguments\n"); 90 printf("invalid arguments\n");
94 command_help(NULL); 91 command_help(NULL);
95 return(0); 92 return 0;
96 } 93 }
97 } 94 }
98 } 95 }
99 96
100 *howto = tmpopt; 97 *howto = tmpopt;
101 return(1); 98 return 1;
102} 99}
103 100
104int 101int
105parseboot(arg, filename, howto) 102parseboot(char *arg, char **filename, int *howto)
106 char *arg; 
107 char **filename; 
108 int *howto; 
109{ 103{
110 char *opts = NULL; 104 char *opts = NULL;
111 105
112 *filename = 0; 106 *filename = 0;
113 *howto = 0; 107 *howto = 0;
114 108
115 /* if there were no arguments */ 109 /* if there were no arguments */
116 if (!*arg) 110 if (!*arg)
117 return(1); 111 return 1;
118 112
119 /* format is... */ 113 /* format is... */
120 /* [[xxNx:]filename] [-adqsv] */ 114 /* [[xxNx:]filename] [-adqsv] */
121 115
122 /* check for just args */ 116 /* check for just args */
123 if (arg[0] == '-') 117 if (arg[0] == '-')
124 opts = arg; 118 opts = arg;
125 else { 119 else {
126 /* there's a file name */ 120 /* there's a file name */
127 *filename = arg; 121 *filename = arg;
128 122
129 opts = gettrailer(arg); 123 opts = gettrailer(arg);
130 if (!*opts) 124 if (!*opts)
131 opts = NULL; 125 opts = NULL;
132 else if (*opts != '-') { 126 else if (*opts != '-') {
133 printf("invalid arguments\n"); 127 printf("invalid arguments\n");
134 command_help(NULL); 128 command_help(NULL);
135 return(0); 129 return 0;
136 } 130 }
137 } 131 }
138 132
139 /* at this point, we have dealt with filenames. */ 133 /* at this point, we have dealt with filenames. */
140 134
141 /* now, deal with options */ 135 /* now, deal with options */
142 if (opts) { 136 if (opts) {
143 if (parseopts(opts, howto) == 0) 137 if (parseopts(opts, howto) == 0)
144 return(0); 138 return 0;
145 } 139 }
146 140
147 return(1); 141 return 1;
148} 142}

cvs diff -r1.3 -r1.4 src/sys/arch/i386/stand/lib/bootinfo.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/bootinfo.c 2005/12/11 12:17:48 1.3
+++ src/sys/arch/i386/stand/lib/bootinfo.c 2008/12/14 17:03:43 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bootinfo.c,v 1.3 2005/12/11 12:17:48 christos Exp $ */ 1/* $NetBSD: bootinfo.c,v 1.4 2008/12/14 17:03:43 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1997 4 * Copyright (c) 1997
5 * Matthias Drochner. All rights reserved. 5 * Matthias Drochner. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -24,23 +24,22 @@ @@ -24,23 +24,22 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * 26 *
27 */ 27 */
28 28
29#include <lib/libsa/stand.h> 29#include <lib/libsa/stand.h>
30#include <lib/libkern/libkern.h> 30#include <lib/libkern/libkern.h>
31 31
32#include "libi386.h" 32#include "libi386.h"
33#include "bootinfo.h" 33#include "bootinfo.h"
34 34
35struct bootinfo *bootinfo; 35struct bootinfo *bootinfo;
36 36
37void bi_add(what, type, size) 37void
38struct btinfo_common *what; 38bi_add(struct btinfo_common *what, int type, int size)
39int type, size; 
40{ 39{
41 what->len = size; 40 what->len = size;
42 what->type = type; 41 what->type = type;
43 42
44 if(bootinfo) 43 if(bootinfo)
45 bootinfo->entry[bootinfo->nentries++] = vtophys(what); 44 bootinfo->entry[bootinfo->nentries++] = vtophys(what);
46} 45}

cvs diff -r1.3 -r1.4 src/sys/arch/i386/stand/lib/isapnpvar.h (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/isapnpvar.h 2005/12/11 12:17:48 1.3
+++ src/sys/arch/i386/stand/lib/isapnpvar.h 2008/12/14 17:03:43 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: isapnpvar.h,v 1.3 2005/12/11 12:17:48 christos Exp $ */ 1/* $NetBSD: isapnpvar.h,v 1.4 2008/12/14 17:03:43 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1997 4 * Copyright (c) 1997
5 * Matthias Drochner. All rights reserved. 5 * Matthias Drochner. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -16,14 +16,14 @@ @@ -16,14 +16,14 @@
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * 26 *
27 */ 27 */
28 28
29int isapnp_finddev __P((int, int*, int*)); 29int isapnp_finddev(int, int*, int*);

cvs diff -r1.3 -r1.4 src/sys/arch/i386/stand/lib/pcivar.h (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/pcivar.h 2005/12/11 12:17:48 1.3
+++ src/sys/arch/i386/stand/lib/pcivar.h 2008/12/14 17:03:43 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pcivar.h,v 1.3 2005/12/11 12:17:48 christos Exp $ */ 1/* $NetBSD: pcivar.h,v 1.4 2008/12/14 17:03:43 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 4 * Copyright (c) 1996
5 * Matthias Drochner. All rights reserved. 5 * Matthias Drochner. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -19,17 +19,17 @@ @@ -19,17 +19,17 @@
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * 26 *
27 */ 27 */
28 28
29 29
30typedef unsigned int pcihdl_t; 30typedef unsigned int pcihdl_t;
31 31
32int pcicheck __P((void)); 32int pcicheck(void);
33int pcifinddev __P((int, int, pcihdl_t*)); 33int pcifinddev(int, int, pcihdl_t*);
34int pcicfgread __P((pcihdl_t*, int, int*)); 34int pcicfgread(pcihdl_t*, int, int*);
35int pcicfgwrite __P((pcihdl_t*, int, int)); 35int pcicfgwrite(pcihdl_t*, int, int);

cvs diff -r1.8 -r1.9 src/sys/arch/i386/stand/lib/comio_direct.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/comio_direct.c 2005/11/11 22:25:09 1.8
+++ src/sys/arch/i386/stand/lib/comio_direct.c 2008/12/14 17:03:43 1.9
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: comio_direct.c,v 1.8 2005/11/11 22:25:09 dsl Exp $ */ 1/* $NetBSD: comio_direct.c,v 1.9 2008/12/14 17:03:43 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1993, 1994, 1995, 1996, 1997 4 * Copyright (c) 1993, 1994, 1995, 1996, 1997
5 * Charles M. Hannum. All rights reserved. 5 * Charles M. Hannum. All rights reserved.
6 * 6 *
7 * Taken from sys/dev/isa/com.c and integrated into standalone boot 7 * Taken from sys/dev/isa/com.c and integrated into standalone boot
8 * programs by Martin Husemann. 8 * programs by Martin Husemann.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -93,27 +93,27 @@ comspeed(long speed) @@ -93,27 +93,27 @@ comspeed(long speed)
93{ 93{
94 int x, err; 94 int x, err;
95 95
96 if (speed <= 0) 96 if (speed <= 0)
97 speed = 9600; 97 speed = 9600;
98 x = divrnd((COM_FREQ / 16), speed); 98 x = divrnd((COM_FREQ / 16), speed);
99 if (x <= 0) 99 if (x <= 0)
100 return RATE_9600; 100 return RATE_9600;
101 err = divrnd((COM_FREQ / 16) * 1000, speed * x) - 1000; 101 err = divrnd((COM_FREQ / 16) * 1000, speed * x) - 1000;
102 if (err < 0) 102 if (err < 0)
103 err = -err; 103 err = -err;
104 if (err > COM_TOLERANCE) 104 if (err > COM_TOLERANCE)
105 return RATE_9600; 105 return RATE_9600;
106 return (x); 106 return x;
107} 107}
108 108
109/* 109/*
110 * get a character 110 * get a character
111 */ 111 */
112int 112int
113comgetc_d(int combase) 113comgetc_d(int combase)
114{ 114{
115 u_char stat, c; 115 u_char stat, c;
116 116
117 if (serbuf_read != serbuf_write) { 117 if (serbuf_read != serbuf_write) {
118 c = serbuf[serbuf_read++]; 118 c = serbuf[serbuf_read++];
119 if (serbuf_read >= SERBUFSIZE) 119 if (serbuf_read >= SERBUFSIZE)
@@ -122,27 +122,27 @@ comgetc_d(int combase) @@ -122,27 +122,27 @@ comgetc_d(int combase)
122 } 122 }
123 123
124 for (;;) { 124 for (;;) {
125 while (!ISSET(stat = inb(combase + com_lsr), LSR_RXRDY)) 125 while (!ISSET(stat = inb(combase + com_lsr), LSR_RXRDY))
126 ; 126 ;
127 c = inb(combase + com_data); 127 c = inb(combase + com_data);
128 inb(combase + com_iir); 128 inb(combase + com_iir);
129 if (c != XOFF) { 129 if (c != XOFF) {
130 stopped = 0; 130 stopped = 0;
131 break; /* got a real char, deliver it... */ 131 break; /* got a real char, deliver it... */
132 } 132 }
133 stopped = 1; 133 stopped = 1;
134 } 134 }
135 return (c); 135 return c;
136} 136}
137 137
138/* 138/*
139 * output a character, return nonzero on success 139 * output a character, return nonzero on success
140 */ 140 */
141int 141int
142computc_d(int c, int combase) 142computc_d(int c, int combase)
143{ 143{
144 u_char stat; 144 u_char stat;
145 int timo; 145 int timo;
146 146
147 /* check for old XOFF */ 147 /* check for old XOFF */
148 while (stopped) 148 while (stopped)

cvs diff -r1.8 -r1.9 src/sys/arch/i386/stand/lib/getextmemx.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/getextmemx.c 2007/12/25 18:33:34 1.8
+++ src/sys/arch/i386/stand/lib/getextmemx.c 2008/12/14 17:03:43 1.9
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: getextmemx.c,v 1.8 2007/12/25 18:33:34 perry Exp $ */ 1/* $NetBSD: getextmemx.c,v 1.9 2008/12/14 17:03:43 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1997, 1999 4 * Copyright (c) 1997, 1999
5 * Matthias Drochner. All rights reserved. 5 * Matthias Drochner. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -25,32 +25,32 @@ @@ -25,32 +25,32 @@
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 * 26 *
27 */ 27 */
28 28
29/* 29/*
30 * Try 2 more fancy BIOS calls to get the size of extended 30 * Try 2 more fancy BIOS calls to get the size of extended
31 * memory besides the classical int15/88, take maximum. 31 * memory besides the classical int15/88, take maximum.
32 * needs lowlevel parts from biosmemx.S and biosmem.S 32 * needs lowlevel parts from biosmemx.S and biosmem.S
33 */ 33 */
34 34
35#include <lib/libsa/stand.h> 35#include <lib/libsa/stand.h>
36#include "libi386.h" 36#include "libi386.h"
37 37
38extern int getextmem2 __P((int *)); 38extern int getextmem2(int *);
39extern int getmementry __P((int *, int *)); 39extern int getmementry(int *, int *);
40extern int getextmemps2 __P((void *)); 40extern int getextmemps2(void *);
41 41
42int 42int
43getextmemx() 43getextmemx(void)
44{ 44{
45 int buf[5], i; 45 int buf[5], i;
46 int extmem = getextmem1(); 46 int extmem = getextmem1();
47#ifdef SUPPORT_PS2 47#ifdef SUPPORT_PS2
48 struct { 48 struct {
49 uint16_t len; 49 uint16_t len;
50 uint32_t dta[8]; 50 uint32_t dta[8];
51 /* pad to 64 bytes - without this, machine would reset */ 51 /* pad to 64 bytes - without this, machine would reset */
52 uint8_t __pad[30]; 52 uint8_t __pad[30];
53 } __packed bufps2; 53 } __packed bufps2;
54#endif 54#endif
55 55
56#ifdef DEBUG_MEMSIZE 56#ifdef DEBUG_MEMSIZE
@@ -83,15 +83,15 @@ getextmemx() @@ -83,15 +83,15 @@ getextmemx()
83 } while (i); 83 } while (i);
84 84
85#ifdef SUPPORT_PS2 85#ifdef SUPPORT_PS2
86 /* use local memory information from RETURN MEMORY-MAP INFORMATION */ 86 /* use local memory information from RETURN MEMORY-MAP INFORMATION */
87 if (!getextmemps2((void *) &bufps2)) { 87 if (!getextmemps2((void *) &bufps2)) {
88 int help = bufps2.dta[0]; 88 int help = bufps2.dta[0];
89 if (help == 15 * 1024) 89 if (help == 15 * 1024)
90 help += bufps2.dta[1]; 90 help += bufps2.dta[1];
91 if (extmem < help) 91 if (extmem < help)
92 extmem = help; 92 extmem = help;
93 } 93 }
94#endif 94#endif
95 95
96 return (extmem); 96 return extmem;
97} 97}

cvs diff -r1.13 -r1.14 src/sys/arch/i386/stand/lib/dosfile.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/dosfile.c 2006/05/10 06:24:02 1.13
+++ src/sys/arch/i386/stand/lib/dosfile.c 2008/12/14 17:03:43 1.14
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: dosfile.c,v 1.13 2006/05/10 06:24:02 skrll Exp $ */ 1/* $NetBSD: dosfile.c,v 1.14 2008/12/14 17:03:43 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 4 * Copyright (c) 1996
5 * Matthias Drochner. All rights reserved. 5 * Matthias Drochner. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -27,91 +27,85 @@ @@ -27,91 +27,85 @@
27 */ 27 */
28 28
29/* 29/*
30 * DOS filesystem for libsa 30 * DOS filesystem for libsa
31 * standalone - uses no device, works only with DOS running 31 * standalone - uses no device, works only with DOS running
32 * needs lowlevel parts from dos_file.S 32 * needs lowlevel parts from dos_file.S
33 */ 33 */
34 34
35#include <lib/libsa/stand.h> 35#include <lib/libsa/stand.h>
36 36
37#include "diskbuf.h" 37#include "diskbuf.h"
38#include "dosfile.h" 38#include "dosfile.h"
39 39
40extern int dosopen __P((const char *)); 40extern int dosopen(const char *);
41extern void dosclose __P((int)); 41extern void dosclose(int);
42extern int dosread __P((int, char *, int)); 42extern int dosread(int, char *, int);
43extern int dosseek __P((int, int, int)); 43extern int dosseek(int, int, int);
44 44
45struct dosfile { 45struct dosfile {
46 int doshandle, off; 46 int doshandle, off;
47}; 47};
48 48
49extern int doserrno; /* in dos_file.S */ 49extern int doserrno; /* in dos_file.S */
50 50
51static int dos2errno __P((void)); 51static int dos2errno(void);
52 52
53static int 53static int
54dos2errno() 54dos2errno(void)
55{ 55{
56 int err; 56 int err;
57 57
58 switch (doserrno) { 58 switch (doserrno) {
59 case 1: 59 case 1:
60 case 4: 60 case 4:
61 case 12: 61 case 12:
62 default: 62 default:
63 err = EIO; 63 err = EIO;
64 case 2: 64 case 2:
65 case 3: 65 case 3:
66 err = ENOENT; 66 err = ENOENT;
67 case 5: 67 case 5:
68 err = EPERM; 68 err = EPERM;
69 case 6: 69 case 6:
70 err = EINVAL; 70 err = EINVAL;
71 } 71 }
72 return (err); 72 return err;
73} 73}
74 74
75int  75int
76dos_open(path, f) 76dos_open(const char *path, struct open_file *f)
77 const char *path; 
78 struct open_file *f; 
79{ 77{
80 struct dosfile *df; 78 struct dosfile *df;
81 79
82 df = (struct dosfile *) alloc(sizeof(*df)); 80 df = (struct dosfile *) alloc(sizeof(*df));
83 if (!df) 81 if (!df)
84 return (-1); 82 return -1;
85 83
86 df->off = 0; 84 df->off = 0;
87 df->doshandle = dosopen(path); 85 df->doshandle = dosopen(path);
88 if (df->doshandle < 0) { 86 if (df->doshandle < 0) {
89#ifdef DEBUG 87#ifdef DEBUG
90 printf("DOS error %d\n", doserrno); 88 printf("DOS error %d\n", doserrno);
91#endif 89#endif
92 dealloc(df, sizeof(*df)); 90 dealloc(df, sizeof(*df));
93 return (dos2errno()); 91 return dos2errno();
94 } 92 }
95 f->f_fsdata = (void *) df; 93 f->f_fsdata = (void *) df;
96 return (0); 94 return 0;
97} 95}
98 96
99int  97int
100dos_read(f, addr, size, resid) 98dos_read(struct open_file *f, void *addr, size_t size, size_t *resid)
101 struct open_file *f; 
102 void *addr; 
103 size_t size; 
104 size_t *resid; /* out */ 
105{ 99{
106 struct dosfile *df; 100 struct dosfile *df;
107 int got; 101 int got;
108 static int tc = 0; 102 static int tc = 0;
109 103
110 df = (struct dosfile *) f->f_fsdata; 104 df = (struct dosfile *) f->f_fsdata;
111 105
112 if (!(tc++ % 4)) 106 if (!(tc++ % 4))
113 twiddle(); 107 twiddle();
114 108
115 if ((unsigned long) addr >= 0x10000) { 109 if ((unsigned long) addr >= 0x10000) {
116 u_int lsize = size; 110 u_int lsize = size;
117 111
@@ -122,101 +116,91 @@ dos_read(f, addr, size, resid) @@ -122,101 +116,91 @@ dos_read(f, addr, size, resid)
122 116
123 tsize = lsize; 117 tsize = lsize;
124 118
125 if (tsize > DISKBUFSIZE) 119 if (tsize > DISKBUFSIZE)
126 tsize = DISKBUFSIZE; 120 tsize = DISKBUFSIZE;
127 121
128 alloc_diskbuf(dos_read); 122 alloc_diskbuf(dos_read);
129 123
130 tgot = dosread(df->doshandle, diskbufp, tsize); 124 tgot = dosread(df->doshandle, diskbufp, tsize);
131 if (tgot < 0) { 125 if (tgot < 0) {
132#ifdef DEBUG 126#ifdef DEBUG
133 printf("DOS error %d\n", doserrno); 127 printf("DOS error %d\n", doserrno);
134#endif 128#endif
135 return (dos2errno()); 129 return dos2errno();
136 } 130 }
137 memcpy(p, diskbufp, tgot); 131 memcpy(p, diskbufp, tgot);
138 132
139 p += tgot; 133 p += tgot;
140 lsize -= tgot; 134 lsize -= tgot;
141 135
142 if (tgot != tsize) 136 if (tgot != tsize)
143 break; /* EOF */ 137 break; /* EOF */
144 } 138 }
145 got = size - lsize; 139 got = size - lsize;
146 } else { 140 } else {
147 got = dosread(df->doshandle, addr, size); 141 got = dosread(df->doshandle, addr, size);
148 142
149 if (got < 0) { 143 if (got < 0) {
150#ifdef DEBUG 144#ifdef DEBUG
151 printf("DOS error %d\n", doserrno); 145 printf("DOS error %d\n", doserrno);
152#endif 146#endif
153 return (dos2errno()); 147 return dos2errno();
154 } 148 }
155 } 149 }
156 150
157 df->off += got; 151 df->off += got;
158 size -= got; 152 size -= got;
159 153
160 if (resid) 154 if (resid)
161 *resid = size; 155 *resid = size;
162 return (0); 156 return 0;
163} 157}
164 158
165int  159int
166dos_close(f) 160dos_close(struct open_file *f)
167 struct open_file *f; 
168{ 161{
169 struct dosfile *df; 162 struct dosfile *df;
170 df = (struct dosfile *) f->f_fsdata; 163 df = (struct dosfile *) f->f_fsdata;
171 164
172 dosclose(df->doshandle); 165 dosclose(df->doshandle);
173 166
174 if (df) 167 if (df)
175 dealloc(df, sizeof(*df)); 168 dealloc(df, sizeof(*df));
176 return (0); 169 return 0;
177} 170}
178 171
179int  172int
180dos_write(f, start, size, resid) 173dos_write(struct open_file *f, void *start, size_t size, size_t *resid)
181 struct open_file *f; 
182 void *start; 
183 size_t size; 
184 size_t *resid; /* out */ 
185{ 174{
186 return (EROFS); 175 return EROFS;
187} 176}
188 177
189int  178int
190dos_stat(f, sb) 179dos_stat(struct open_file *f, struct stat *sb)
191 struct open_file *f; 
192 struct stat *sb; 
193{ 180{
194 struct dosfile *df; 181 struct dosfile *df;
195 df = (struct dosfile *) f->f_fsdata; 182 df = (struct dosfile *) f->f_fsdata;
196 183
197 sb->st_mode = 0444; 184 sb->st_mode = 0444;
198 sb->st_nlink = 1; 185 sb->st_nlink = 1;
199 sb->st_uid = 0; 186 sb->st_uid = 0;
200 sb->st_gid = 0; 187 sb->st_gid = 0;
201 sb->st_size = -1; 188 sb->st_size = -1;
202 return (0); 189 return 0;
203} 190}
204 191
205off_t  192off_t
206dos_seek(f, offset, where) 193dos_seek(struct open_file *f, off_t offset, int where)
207 struct open_file *f; 
208 off_t offset; 
209 int where; 
210{ 194{
211 struct dosfile *df; 195 struct dosfile *df;
212 int doswhence, res; 196 int doswhence, res;
213#ifdef DOS_CHECK 197#ifdef DOS_CHECK
214 int checkoffs; 198 int checkoffs;
215#endif 199#endif
216 df = (struct dosfile *) f->f_fsdata; 200 df = (struct dosfile *) f->f_fsdata;
217 201
218 switch (where) { 202 switch (where) {
219 case SEEK_SET: 203 case SEEK_SET:
220 doswhence = 0; 204 doswhence = 0;
221#ifdef DOS_CHECK 205#ifdef DOS_CHECK
222 checkoffs = offset; /* don't trust DOS */ 206 checkoffs = offset; /* don't trust DOS */
@@ -226,31 +210,31 @@ dos_seek(f, offset, where) @@ -226,31 +210,31 @@ dos_seek(f, offset, where)
226 doswhence = 1; 210 doswhence = 1;
227#ifdef DOS_CHECK 211#ifdef DOS_CHECK
228 checkoffs = df->off + offset; 212 checkoffs = df->off + offset;
229#endif 213#endif
230 break; 214 break;
231 case SEEK_END: 215 case SEEK_END:
232 doswhence = 2; 216 doswhence = 2;
233#ifdef DOS_CHECK 217#ifdef DOS_CHECK
234 checkoffs = -1; /* we dont know len */ 218 checkoffs = -1; /* we dont know len */
235#endif 219#endif
236 break; 220 break;
237 default: 221 default:
238 errno = EOFFSET; 222 errno = EOFFSET;
239 return (-1); 223 return -1;
240 } 224 }
241 res = dosseek(df->doshandle, offset, doswhence); 225 res = dosseek(df->doshandle, offset, doswhence);
242 if (res == -1) { 226 if (res == -1) {
243 errno = dos2errno(); 227 errno = dos2errno();
244 return (-1); 228 return -1;
245 } 229 }
246#ifdef DOS_CHECK 230#ifdef DOS_CHECK
247 if ((checkoffs != -1) && (res != checkoffs)) { 231 if ((checkoffs != -1) && (res != checkoffs)) {
248 printf("dosfile: unexpected seek result (%d+%d(%d)=%d)\n", 232 printf("dosfile: unexpected seek result (%d+%d(%d)=%d)\n",
249 df->off, offset, where, res); 233 df->off, offset, where, res);
250 errno = EOFFSET; 234 errno = EOFFSET;
251 return (-1); 235 return -1;
252 } 236 }
253#endif 237#endif
254 df->off = res; 238 df->off = res;
255 return (res); 239 return res;
256} 240}

cvs diff -r1.35 -r1.36 src/sys/arch/i386/stand/lib/exec.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/exec.c 2008/11/25 13:23:54 1.35
+++ src/sys/arch/i386/stand/lib/exec.c 2008/12/14 17:03:43 1.36
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: exec.c,v 1.35 2008/11/25 13:23:54 ad Exp $ */ 1/* $NetBSD: exec.c,v 1.36 2008/12/14 17:03:43 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -326,32 +326,32 @@ module_path(boot_module_t *bm) @@ -326,32 +326,32 @@ module_path(boot_module_t *bm)
326 name = name_buf; 326 name = name_buf;
327 break; 327 break;
328 } 328 }
329 } 329 }
330 if (name[0] == '/') 330 if (name[0] == '/')
331 snprintf(buf, sizeof(buf), "%s", name); 331 snprintf(buf, sizeof(buf), "%s", name);
332 else 332 else
333 snprintf(buf, sizeof(buf), "%s/%s/%s.kmod", 333 snprintf(buf, sizeof(buf), "%s/%s/%s.kmod",
334 module_base, name, name); 334 module_base, name, name);
335 335
336 return buf; 336 return buf;
337} 337}
338 338
339static int  339static int
340module_open(boot_module_t *bm, int mode) 340module_open(boot_module_t *bm, int mode)
341{ 341{
342 int fd; 342 int fd;
343 const char *path; 343 const char *path;
344  344
345 /* check the expanded path first */ 345 /* check the expanded path first */
346 path = module_path(bm); 346 path = module_path(bm);
347 fd = open(path, mode); 347 fd = open(path, mode);
348 if (fd == -1) { 348 if (fd == -1) {
349 printf("WARNING: couldn't open %s\n", path); 349 printf("WARNING: couldn't open %s\n", path);
350 /* now attempt the raw path provided */ 350 /* now attempt the raw path provided */
351 fd = open(bm->bm_path, mode); 351 fd = open(bm->bm_path, mode);
352 if (fd == -1) 352 if (fd == -1)
353 printf("WARNING: couldn't open %s\n", bm->bm_path); 353 printf("WARNING: couldn't open %s\n", bm->bm_path);
354 } 354 }
355 return fd; 355 return fd;
356} 356}
357 357

cvs diff -r1.1.1.1 -r1.2 src/sys/arch/i386/stand/lib/isadma.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/isadma.c 1997/03/14 02:40:32 1.1.1.1
+++ src/sys/arch/i386/stand/lib/isadma.c 2008/12/14 17:03:43 1.2
@@ -1,44 +1,43 @@ @@ -1,44 +1,43 @@
1/* $NetBSD: isadma.c,v 1.1.1.1 1997/03/14 02:40:32 perry Exp $ */ 1/* $NetBSD: isadma.c,v 1.2 2008/12/14 17:03:43 christos Exp $ */
2 2
3/* from: NetBSD:dev/isa/isadma.c */ 3/* from: NetBSD:dev/isa/isadma.c */
4 4
5#include <sys/types.h> 5#include <sys/types.h>
6#include <machine/pio.h> 6#include <machine/pio.h>
7 7
8#include <lib/libsa/stand.h> 8#include <lib/libsa/stand.h>
9 9
10#include "isadmavar.h" 10#include "isadmavar.h"
11 11
12#define IO_DMA1 0x000 /* 8237A DMA Controller #1 */ 12#define IO_DMA1 0x000 /* 8237A DMA Controller #1 */
13#define IO_DMA2 0x0C0 /* 8237A DMA Controller #2 */ 13#define IO_DMA2 0x0C0 /* 8237A DMA Controller #2 */
14#define DMA37MD_CASCADE 0xc0 /* cascade mode */ 14#define DMA37MD_CASCADE 0xc0 /* cascade mode */
15#define DMA1_SMSK (IO_DMA1 + 1*10) /* single mask register */ 15#define DMA1_SMSK (IO_DMA1 + 1*10) /* single mask register */
16#define DMA1_MODE (IO_DMA1 + 1*11) /* mode register */ 16#define DMA1_MODE (IO_DMA1 + 1*11) /* mode register */
17#define DMA2_SMSK (IO_DMA2 + 2*10) /* single mask register */ 17#define DMA2_SMSK (IO_DMA2 + 2*10) /* single mask register */
18#define DMA2_MODE (IO_DMA2 + 2*11) /* mode register */ 18#define DMA2_MODE (IO_DMA2 + 2*11) /* mode register */
19 19
20/* 20/*
21 * isa_dmacascade(): program 8237 DMA controller channel to accept 21 * isa_dmacascade(): program 8237 DMA controller channel to accept
22 * external dma control by a board. 22 * external dma control by a board.
23 */ 23 */
24void 24void
25isa_dmacascade(chan) 25isa_dmacascade(int chan)
26 int chan; 
27{ 26{
28 27
29#ifdef ISADMA_DEBUG 28#ifdef ISADMA_DEBUG
30 if (chan < 0 || chan > 7) 29 if (chan < 0 || chan > 7)
31 panic("isa_dmacascade: impossible request");  30 panic("isa_dmacascade: impossible request");
32#endif 31#endif
33 32
34 /* set dma channel mode, and set dma channel mode */ 33 /* set dma channel mode, and set dma channel mode */
35 if ((chan & 4) == 0) { 34 if ((chan & 4) == 0) {
36 outb(DMA1_MODE, chan | DMA37MD_CASCADE); 35 outb(DMA1_MODE, chan | DMA37MD_CASCADE);
37 outb(DMA1_SMSK, chan); 36 outb(DMA1_SMSK, chan);
38 } else { 37 } else {
39 chan &= 3; 38 chan &= 3;
40 39
41 outb(DMA2_MODE, chan | DMA37MD_CASCADE); 40 outb(DMA2_MODE, chan | DMA37MD_CASCADE);
42 outb(DMA2_SMSK, chan); 41 outb(DMA2_SMSK, chan);
43 } 42 }
44} 43}

cvs diff -r1.1.1.1 -r1.2 src/sys/arch/i386/stand/lib/isadmavar.h (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/isadmavar.h 1997/03/14 02:40:33 1.1.1.1
+++ src/sys/arch/i386/stand/lib/isadmavar.h 2008/12/14 17:03:43 1.2
@@ -1,3 +1,3 @@ @@ -1,3 +1,3 @@
1/* $NetBSD: isadmavar.h,v 1.1.1.1 1997/03/14 02:40:33 perry Exp $ */ 1/* $NetBSD: isadmavar.h,v 1.2 2008/12/14 17:03:43 christos Exp $ */
2 2
3void isa_dmacascade __P((int)); 3void isa_dmacascade(int);

cvs diff -r1.1 -r1.2 src/sys/arch/i386/stand/lib/menuutils.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/menuutils.c 1997/09/17 17:13:02 1.1
+++ src/sys/arch/i386/stand/lib/menuutils.c 2008/12/14 17:03:43 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: menuutils.c,v 1.1 1997/09/17 17:13:02 drochner Exp $ */ 1/* $NetBSD: menuutils.c,v 1.2 2008/12/14 17:03:43 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, 1997 4 * Copyright (c) 1996, 1997
5 * Matthias Drochner. All rights reserved. 5 * Matthias Drochner. All rights reserved.
6 * Copyright (c) 1996, 1997 6 * Copyright (c) 1996, 1997
7 * Perry E. Metzger. All rights reserved. 7 * Perry E. Metzger. All rights reserved.
8 * Copyright (c) 1997 8 * Copyright (c) 1997
9 * Jason R. Thorpe. All rights reserved 9 * Jason R. Thorpe. All rights reserved
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -33,47 +33,46 @@ @@ -33,47 +33,46 @@
33 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
37 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 */ 38 */
39 39
40#include <lib/libkern/libkern.h> 40#include <lib/libkern/libkern.h>
41#include <lib/libsa/stand.h> 41#include <lib/libsa/stand.h>
42 42
43#include "libi386.h" 43#include "libi386.h"
44 44
45void 45void
46docommand(arg) 46docommand(char *arg)
47 char *arg; 
48{ 47{
49 char *options; 48 char *options;
50 int i; 49 int i;
51 50
52 options = gettrailer(arg); 51 options = gettrailer(arg);
53 52
54 for (i = 0; commands[i].c_name != NULL; i++) { 53 for (i = 0; commands[i].c_name != NULL; i++) {
55 if (strcmp(arg, commands[i].c_name) == 0) { 54 if (strcmp(arg, commands[i].c_name) == 0) {
56 (*commands[i].c_fn)(options); 55 (*commands[i].c_fn)(options);
57 return; 56 return;
58 } 57 }
59 } 58 }
60 59
61 printf("unknown command\n"); 60 printf("unknown command\n");
62 command_help(NULL); 61 command_help(NULL);
63} 62}
64 63
65void 64void
66bootmenu() 65bootmenu(void)
67{ 66{
68 char input[80]; 67 char input[80];
69 68
70 for (;;) { 69 for (;;) {
71 char *c = input; 70 char *c = input;
72 71
73 input[0] = '\0'; 72 input[0] = '\0';
74 printf("> "); 73 printf("> ");
75 gets(input); 74 gets(input);
76 75
77 /* 76 /*
78 * Skip leading whitespace. 77 * Skip leading whitespace.
79 */ 78 */

cvs diff -r1.1 -r1.2 src/sys/arch/i386/stand/lib/printmemlist.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/printmemlist.c 1999/12/21 14:22:55 1.1
+++ src/sys/arch/i386/stand/lib/printmemlist.c 2008/12/14 17:03:43 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: printmemlist.c,v 1.1 1999/12/21 14:22:55 drochner Exp $ */ 1/* $NetBSD: printmemlist.c,v 1.2 2008/12/14 17:03:43 christos Exp $ */
2/* 2/*
3 * Copyright (c) 1999 3 * Copyright (c) 1999
4 * Matthias Drochner. All rights reserved. 4 * Matthias Drochner. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -18,37 +18,37 @@ @@ -18,37 +18,37 @@
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 * 25 *
26 */ 26 */
27 27
28#include <lib/libsa/stand.h> 28#include <lib/libsa/stand.h>
29#include "libi386.h" 29#include "libi386.h"
30 30
31extern int getmementry __P((int *, int *)); 31extern int getmementry(int *, int *);
32 32
33static char *memtypes[] = { 33static char *memtypes[] = {
34 "available", 34 "available",
35 "reserved", 35 "reserved",
36 "ACPI reclaimable", 36 "ACPI reclaimable",
37 "ACPI NVS" 37 "ACPI NVS"
38}; 38};
39 39
40void 40void
41printmemlist() 41printmemlist(void)
42{ 42{
43 int buf[5], i; 43 int buf[5], i;
44 char *type; 44 char *type;
45 45
46 i = 0; 46 i = 0;
47 do { 47 do {
48 if (getmementry(&i, buf)) 48 if (getmementry(&i, buf))
49 break; 49 break;
50 if (buf[4] < 1 || buf[4] > 4) 50 if (buf[4] < 1 || buf[4] > 4)
51 type = "invalid entry"; 51 type = "invalid entry";
52 else 52 else
53 type = memtypes[buf[4] - 1]; 53 type = memtypes[buf[4] - 1];
54 printf("%x:%x/%x:%x: %s\n", buf[1], buf[0], buf[3], buf[2], 54 printf("%x:%x/%x:%x: %s\n", buf[1], buf[0], buf[3], buf[2],