ANSI and KNF from Anon Ymousdiff -r1.6 -r1.7 src/sys/arch/i386/stand/lib/biosdisk.h
(christos)
--- 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 | |||
28 | int biosdisk_strategy(void *, int, daddr_t, size_t, void *, size_t *); | 28 | int biosdisk_strategy(void *, int, daddr_t, size_t, void *, size_t *); | |
29 | int biosdisk_open(struct open_file *, ...); | 29 | int biosdisk_open(struct open_file *, ...); | |
30 | int biosdisk_close(struct open_file *); | 30 | int biosdisk_close(struct open_file *); | |
31 | int biosdisk_ioctl(struct open_file *, u_long, void *); | 31 | int biosdisk_ioctl(struct open_file *, u_long, void *); | |
32 | int biosdisk_findpartition(int, u_int); | 32 | int biosdisk_findpartition(int, u_int); | |
33 |
--- 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 | |||
41 | static char *buf; | 41 | static char *buf; | |
42 | 42 | |||
43 | ssize_t | 43 | ssize_t | |
44 | pread(fd, dest, size) | 44 | pread(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 | } |
--- 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 | |||
29 | void biosmca __P((void)); | 29 | void biosmca(void); | |
30 | 30 | |||
31 | extern int biosmca_ps2model; | 31 | extern int biosmca_ps2model; |
--- 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
--- 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 | |||
11 | extern int biosgetrtc __P((u_long*)); | 11 | extern int biosgetrtc(u_long*); | |
12 | 12 | |||
13 | static inline u_long bcd2dec __P((u_long)); | 13 | static inline u_long bcd2dec(u_long); | |
14 | 14 | |||
15 | static inline u_long | 15 | static inline u_long | |
16 | bcd2dec(arg) | 16 | bcd2dec(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 | |||
22 | time_t | 21 | time_t | |
23 | getsecs() { | 22 | getsecs(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 | } |
--- 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 | |||
37 | extern int pcibios_present __P((int *)); | 37 | extern int pcibios_present(int *); | |
38 | extern int pcibios_finddev __P((int, int, int, unsigned int *)); | 38 | extern int pcibios_finddev(int, int, int, unsigned int *); | |
39 | extern int pcibios_cfgread __P((unsigned int, int, int *)); | 39 | extern int pcibios_cfgread(unsigned int, int, int *); | |
40 | extern int pcibios_cfgwrite __P((unsigned int, int, int)); | 40 | extern 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 | |||
44 | int | 44 | int | |
45 | pcicheck() | 45 | pcicheck(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 | |||
57 | int | 57 | int | |
58 | pcifinddev(vid, did, handle) | 58 | pcifinddev(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 | |||
74 | int | 72 | int | |
75 | pcicfgread(handle, off, val) | 73 | pcicfgread(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 | |||
90 | int | 85 | int | |
91 | pcicfgwrite(handle, off, val) | 86 | pcicfgwrite(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 | } |
--- 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 | |||
33 | extern int getmementry __P((int *, int *)); | 33 | extern int getmementry(int *, int *); | |
34 | 34 | |||
35 | void | 35 | void | |
36 | bi_getmemmap() | 36 | bi_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) |
--- 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 | |||
64 | static int pnpdataport; | 64 | static int pnpdataport; | |
65 | 65 | |||
66 | static int | 66 | static int | |
67 | getiobase(nr) | 67 | getiobase(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 | |||
83 | static int | 82 | static int | |
84 | getdmachan(nr) | 83 | getdmachan(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 | |||
98 | struct cardid { | 96 | struct 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 | */ | |
107 | static int | 105 | static int | |
108 | pnpisol(csn) | 106 | pnpisol(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 | |||
160 | static void | 157 | static void | |
161 | pnpisolreset() | 158 | pnpisolreset(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 | */ | |
170 | static void | 167 | static void | |
171 | pnpinit() | 168 | pnpinit(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 | |||
186 | int | 183 | int | |
187 | isapnp_finddev(id, iobase, dmachan) | 184 | isapnp_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 | } |
--- 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 | */ | |
50 | char * | 50 | char * | |
51 | gettrailer(arg) | 51 | gettrailer(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 | |||
68 | int | 67 | int | |
69 | parseopts(opts, howto) | 68 | parseopts(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 | |||
104 | int | 101 | int | |
105 | parseboot(arg, filename, howto) | 102 | parseboot(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 | } |
--- 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 | |||
35 | struct bootinfo *bootinfo; | 35 | struct bootinfo *bootinfo; | |
36 | 36 | |||
37 | void bi_add(what, type, size) | 37 | void | |
38 | struct btinfo_common *what; | 38 | bi_add(struct btinfo_common *what, int type, int size) | |
39 | int 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 | } |
--- 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 | |||
29 | int isapnp_finddev __P((int, int*, int*)); | 29 | int isapnp_finddev(int, int*, int*); |
--- 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 | |||
30 | typedef unsigned int pcihdl_t; | 30 | typedef unsigned int pcihdl_t; | |
31 | 31 | |||
32 | int pcicheck __P((void)); | 32 | int pcicheck(void); | |
33 | int pcifinddev __P((int, int, pcihdl_t*)); | 33 | int pcifinddev(int, int, pcihdl_t*); | |
34 | int pcicfgread __P((pcihdl_t*, int, int*)); | 34 | int pcicfgread(pcihdl_t*, int, int*); | |
35 | int pcicfgwrite __P((pcihdl_t*, int, int)); | 35 | int pcicfgwrite(pcihdl_t*, int, int); |
--- 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 | */ | |
112 | int | 112 | int | |
113 | comgetc_d(int combase) | 113 | comgetc_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 | */ | |
141 | int | 141 | int | |
142 | computc_d(int c, int combase) | 142 | computc_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) |
--- 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 | |||
38 | extern int getextmem2 __P((int *)); | 38 | extern int getextmem2(int *); | |
39 | extern int getmementry __P((int *, int *)); | 39 | extern int getmementry(int *, int *); | |
40 | extern int getextmemps2 __P((void *)); | 40 | extern int getextmemps2(void *); | |
41 | 41 | |||
42 | int | 42 | int | |
43 | getextmemx() | 43 | getextmemx(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 | } |
--- 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 | |||
40 | extern int dosopen __P((const char *)); | 40 | extern int dosopen(const char *); | |
41 | extern void dosclose __P((int)); | 41 | extern void dosclose(int); | |
42 | extern int dosread __P((int, char *, int)); | 42 | extern int dosread(int, char *, int); | |
43 | extern int dosseek __P((int, int, int)); | 43 | extern int dosseek(int, int, int); | |
44 | 44 | |||
45 | struct dosfile { | 45 | struct dosfile { | |
46 | int doshandle, off; | 46 | int doshandle, off; | |
47 | }; | 47 | }; | |
48 | 48 | |||
49 | extern int doserrno; /* in dos_file.S */ | 49 | extern int doserrno; /* in dos_file.S */ | |
50 | 50 | |||
51 | static int dos2errno __P((void)); | 51 | static int dos2errno(void); | |
52 | 52 | |||
53 | static int | 53 | static int | |
54 | dos2errno() | 54 | dos2errno(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 | |||
75 | int | 75 | int | |
76 | dos_open(path, f) | 76 | dos_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 | |||
99 | int | 97 | int | |
100 | dos_read(f, addr, size, resid) | 98 | dos_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 | |||
165 | int | 159 | int | |
166 | dos_close(f) | 160 | dos_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 | |||
179 | int | 172 | int | |
180 | dos_write(f, start, size, resid) | 173 | dos_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 | |||
189 | int | 178 | int | |
190 | dos_stat(f, sb) | 179 | dos_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 | |||
205 | off_t | 192 | off_t | |
206 | dos_seek(f, offset, where) | 193 | dos_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 | } |
--- 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 | |||
339 | static int | 339 | static int | |
340 | module_open(boot_module_t *bm, int mode) | 340 | module_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 |
--- 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 | */ | |
24 | void | 24 | void | |
25 | isa_dmacascade(chan) | 25 | isa_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 | } |
--- 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 | |||
3 | void isa_dmacascade __P((int)); | 3 | void isa_dmacascade(int); |
--- 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
--- 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 | |||
31 | extern int getmementry __P((int *, int *)); | 31 | extern int getmementry(int *, int *); | |
32 | 32 | |||
33 | static char *memtypes[] = { | 33 | static 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 | |||
40 | void | 40 | void | |
41 | printmemlist() | 41 | printmemlist(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], |