| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ofw_subr.c,v 1.44 2021/01/24 16:23:05 thorpej Exp $ */ | | 1 | /* $NetBSD: ofw_subr.c,v 1.45 2021/01/24 16:45:41 thorpej Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright 1998 | | 4 | * Copyright 1998 |
5 | * Digital Equipment Corporation. All rights reserved. | | 5 | * Digital Equipment Corporation. All rights reserved. |
6 | * | | 6 | * |
7 | * This software is furnished under license and may be used and | | 7 | * This software is furnished under license and may be used and |
8 | * copied only in accordance with the following terms and conditions. | | 8 | * copied only in accordance with the following terms and conditions. |
9 | * Subject to these conditions, you may download, copy, install, | | 9 | * Subject to these conditions, you may download, copy, install, |
10 | * use, modify and distribute this software in source and/or binary | | 10 | * use, modify and distribute this software in source and/or binary |
11 | * form. No title or ownership is transferred hereby. | | 11 | * form. No title or ownership is transferred hereby. |
12 | * | | 12 | * |
13 | * 1) Any source code used, modified or distributed must reproduce | | 13 | * 1) Any source code used, modified or distributed must reproduce |
14 | * and retain this copyright notice and list of conditions as | | 14 | * and retain this copyright notice and list of conditions as |
| @@ -24,27 +24,27 @@ | | | @@ -24,27 +24,27 @@ |
24 | * 3) This software is provided "AS-IS" and any express or implied | | 24 | * 3) This software is provided "AS-IS" and any express or implied |
25 | * warranties, including but not limited to, any implied warranties | | 25 | * warranties, including but not limited to, any implied warranties |
26 | * of merchantability, fitness for a particular purpose, or | | 26 | * of merchantability, fitness for a particular purpose, or |
27 | * non-infringement are disclaimed. In no event shall DIGITAL be | | 27 | * non-infringement are disclaimed. In no event shall DIGITAL be |
28 | * liable for any damages whatsoever, and in particular, DIGITAL | | 28 | * liable for any damages whatsoever, and in particular, DIGITAL |
29 | * shall not be liable for special, indirect, consequential, or | | 29 | * shall not be liable for special, indirect, consequential, or |
30 | * incidental damages or damages for lost profits, loss of | | 30 | * incidental damages or damages for lost profits, loss of |
31 | * revenue or loss of use, whether such damages arise in contract, | | 31 | * revenue or loss of use, whether such damages arise in contract, |
32 | * negligence, tort, under statute, in equity, at law or otherwise, | | 32 | * negligence, tort, under statute, in equity, at law or otherwise, |
33 | * even if advised of the possibility of such damage. | | 33 | * even if advised of the possibility of such damage. |
34 | */ | | 34 | */ |
35 | | | 35 | |
36 | #include <sys/cdefs.h> | | 36 | #include <sys/cdefs.h> |
37 | __KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.44 2021/01/24 16:23:05 thorpej Exp $"); | | 37 | __KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.45 2021/01/24 16:45:41 thorpej Exp $"); |
38 | | | 38 | |
39 | #include <sys/param.h> | | 39 | #include <sys/param.h> |
40 | #include <sys/device.h> | | 40 | #include <sys/device.h> |
41 | #include <sys/systm.h> | | 41 | #include <sys/systm.h> |
42 | #include <sys/malloc.h> | | 42 | #include <sys/malloc.h> |
43 | #include <dev/ofw/openfirm.h> | | 43 | #include <dev/ofw/openfirm.h> |
44 | | | 44 | |
45 | #define OFW_MAX_STACK_BUF_SIZE 256 | | 45 | #define OFW_MAX_STACK_BUF_SIZE 256 |
46 | #define OFW_PATH_BUF_SIZE 512 | | 46 | #define OFW_PATH_BUF_SIZE 512 |
47 | | | 47 | |
48 | /* | | 48 | /* |
49 | * int of_decode_int(p) | | 49 | * int of_decode_int(p) |
50 | * | | 50 | * |
| @@ -231,27 +231,27 @@ of_match_compat_data(int phandle, | | | @@ -231,27 +231,27 @@ of_match_compat_data(int phandle, |
231 | * This routine searches an array of compat_data structures for a | | 231 | * This routine searches an array of compat_data structures for a |
232 | * matching "compatible" entry matching the supplied OFW node. | | 232 | * matching "compatible" entry matching the supplied OFW node. |
233 | * | | 233 | * |
234 | * Arguments: | | 234 | * Arguments: |
235 | * phandle OFW phandle of device to be checked for | | 235 | * phandle OFW phandle of device to be checked for |
236 | * compatibility. | | 236 | * compatibility. |
237 | * compat_data Array of possible compat entry strings and | | 237 | * compat_data Array of possible compat entry strings and |
238 | * associated metadata. The last entry in the | | 238 | * associated metadata. The last entry in the |
239 | * list should have a "compat" of NULL to terminate | | 239 | * list should have a "compat" of NULL to terminate |
240 | * the list. | | 240 | * the list. |
241 | * | | 241 | * |
242 | * Return Value: | | 242 | * Return Value: |
243 | * The first matching compat_data entry in the array. If no matches | | 243 | * The first matching compat_data entry in the array. If no matches |
244 | * are found, the terminating ("compat" of NULL) record is returned. | | 244 | * are found, the NULL is returned. |
245 | * | | 245 | * |
246 | * Side Effects: | | 246 | * Side Effects: |
247 | * None. | | 247 | * None. |
248 | */ | | 248 | */ |
249 | const struct device_compatible_entry * | | 249 | const struct device_compatible_entry * |
250 | of_search_compatible(int phandle, | | 250 | of_search_compatible(int phandle, |
251 | const struct device_compatible_entry *compat_data) | | 251 | const struct device_compatible_entry *compat_data) |
252 | { | | 252 | { |
253 | for (; compat_data->compat != NULL; compat_data++) { | | 253 | for (; compat_data->compat != NULL; compat_data++) { |
254 | const char *compat[] = { compat_data->compat, NULL }; | | 254 | const char *compat[] = { compat_data->compat, NULL }; |
255 | if (of_match_compatible(phandle, compat)) | | 255 | if (of_match_compatible(phandle, compat)) |
256 | return compat_data; | | 256 | return compat_data; |
257 | } | | 257 | } |