| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: fwcrom.c,v 1.16 2014/09/21 18:03:47 christos Exp $ */ | | 1 | /* $NetBSD: fwcrom.c,v 1.17 2014/11/21 23:37:25 joerg Exp $ */ |
2 | /*- | | 2 | /*- |
3 | * Copyright (c) 2002-2003 | | 3 | * Copyright (c) 2002-2003 |
4 | * Hidetoshi Shimokawa. All rights reserved. | | 4 | * Hidetoshi Shimokawa. 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 | * 3. All advertising materials mentioning features or use of this software | | 14 | * 3. All advertising materials mentioning features or use of this software |
| @@ -24,27 +24,27 @@ | | | @@ -24,27 +24,27 @@ |
24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
33 | * SUCH DAMAGE. | | 33 | * SUCH DAMAGE. |
34 | */ | | 34 | */ |
35 | | | 35 | |
36 | #include <sys/cdefs.h> | | 36 | #include <sys/cdefs.h> |
37 | __KERNEL_RCSID(0, "$NetBSD: fwcrom.c,v 1.16 2014/09/21 18:03:47 christos Exp $"); | | 37 | __KERNEL_RCSID(0, "$NetBSD: fwcrom.c,v 1.17 2014/11/21 23:37:25 joerg Exp $"); |
38 | | | 38 | |
39 | #include <sys/param.h> | | 39 | #include <sys/param.h> |
40 | #ifdef _KERNEL | | 40 | #ifdef _KERNEL |
41 | #include <sys/device.h> | | 41 | #include <sys/device.h> |
42 | #include <sys/errno.h> | | 42 | #include <sys/errno.h> |
43 | #include <sys/systm.h> | | 43 | #include <sys/systm.h> |
44 | #else | | 44 | #else |
45 | #include <stdio.h> | | 45 | #include <stdio.h> |
46 | #include <string.h> | | 46 | #include <string.h> |
47 | #endif | | 47 | #endif |
48 | #include <dev/ieee1394/firewire.h> | | 48 | #include <dev/ieee1394/firewire.h> |
49 | #include <dev/ieee1394/iec13213.h> | | 49 | #include <dev/ieee1394/iec13213.h> |
50 | | | 50 | |
| @@ -162,27 +162,27 @@ crom_has_specver(uint32_t *p, uint32_t s | | | @@ -162,27 +162,27 @@ crom_has_specver(uint32_t *p, uint32_t s |
162 | } | | 162 | } |
163 | crom_next(cc); | | 163 | crom_next(cc); |
164 | } | | 164 | } |
165 | return 0; | | 165 | return 0; |
166 | } | | 166 | } |
167 | | | 167 | |
168 | void | | 168 | void |
169 | crom_parse_text(struct crom_context *cc, char *buf, int len) | | 169 | crom_parse_text(struct crom_context *cc, char *buf, int len) |
170 | { | | 170 | { |
171 | struct csrreg *reg; | | 171 | struct csrreg *reg; |
172 | struct csrtext *textleaf; | | 172 | struct csrtext *textleaf; |
173 | uint32_t *bp; | | 173 | uint32_t *bp; |
174 | int i, qlen; | | 174 | int i, qlen; |
175 | static char *nullstr = (char *)&"(null)"; | | 175 | static const char nullstr[] = "(null)"; |
176 | | | 176 | |
177 | if (cc->depth < 0) | | 177 | if (cc->depth < 0) |
178 | return; | | 178 | return; |
179 | | | 179 | |
180 | reg = crom_get(cc); | | 180 | reg = crom_get(cc); |
181 | switch (reg->key) { | | 181 | switch (reg->key) { |
182 | case CROM_TEXTLEAF: | | 182 | case CROM_TEXTLEAF: |
183 | case CROM_TEXTLEAF2: | | 183 | case CROM_TEXTLEAF2: |
184 | break; | | 184 | break; |
185 | default: | | 185 | default: |
186 | if ((char *)(reg + reg->val) > CROM_END(cc)) { | | 186 | if ((char *)(reg + reg->val) > CROM_END(cc)) { |
187 | strncpy(buf, nullstr, len); | | 187 | strncpy(buf, nullstr, len); |
188 | return; | | 188 | return; |