diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-06-08 15:27:06 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-06-08 15:27:06 +0000 |
commit | ec781b303bcbf6dd62c55d5f3ea74f879b01b753 (patch) | |
tree | c748a2dfdb13a80884b4f8475254c3fb9bb6bf57 /sys/dev/ofw | |
parent | cacefc814f032ba3ab4bc7b8a36c3f305c0883ac (diff) |
Use fdt to find the console to initialise. Try to use /chosen/stdout-path
if present otherwise fallback to /aliases/serial0.
Don't require a platform match to run the various console init functions
so the init functions will run for unknown board ids.
With and ok kettenis@ on a earlier version.
Diffstat (limited to 'sys/dev/ofw')
-rw-r--r-- | sys/dev/ofw/fdt.c | 32 | ||||
-rw-r--r-- | sys/dev/ofw/fdt.h | 3 |
2 files changed, 21 insertions, 14 deletions
diff --git a/sys/dev/ofw/fdt.c b/sys/dev/ofw/fdt.c index 9844d80b408..73c997f36a8 100644 --- a/sys/dev/ofw/fdt.c +++ b/sys/dev/ofw/fdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdt.c,v 1.10 2016/05/21 21:24:36 kettenis Exp $ */ +/* $OpenBSD: fdt.c,v 1.11 2016/06/08 15:27:05 jsg Exp $ */ /* * Copyright (c) 2009 Dariusz Swiderski <sfires@sfires.net> @@ -570,6 +570,23 @@ fdt_get_memory_address(void *node, int idx, struct fdt_memory *mem) return fdt_translate_memory_address(parent, mem); } +int +fdt_is_compatible(void *node, const char *name) +{ + char *data; + int len; + + len = fdt_node_property(node, "compatible", &data); + while (len > 0) { + if (strcmp(data, name) == 0) + return 1; + len -= strlen(data) + 1; + data += strlen(data) + 1; + } + + return 0; +} + #ifdef DEBUG /* * Debug methods for printing whole tree, particular odes and properies @@ -798,17 +815,6 @@ int OF_is_compatible(int handle, const char *name) { void *node = (char *)tree.header + handle; - char *data; - int len; - - len = fdt_node_property(node, "compatible", &data); - while (len > 0) { - if (strcmp(data, name) == 0) - return 1; - len -= strlen(data) + 1; - data += strlen(data) + 1; - } - - return 0; + return (fdt_is_compatible(node, name)); } diff --git a/sys/dev/ofw/fdt.h b/sys/dev/ofw/fdt.h index ff5ef0d13c3..4949b426bdb 100644 --- a/sys/dev/ofw/fdt.h +++ b/sys/dev/ofw/fdt.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fdt.h,v 1.2 2016/04/03 12:32:13 patrick Exp $ */ +/* $OpenBSD: fdt.h,v 1.3 2016/06/08 15:27:05 jsg Exp $ */ /* * Copyright (c) 2009 Dariusz Swiderski <sfires@sfires.net> @@ -61,6 +61,7 @@ void *fdt_find_node(char *); int fdt_node_property(void *, char *, char **); void *fdt_parent_node(void *); int fdt_get_memory_address(void *, int, struct fdt_memory *); +int fdt_is_compatible(void *, const char *); #ifdef DEBUG void *fdt_print_property(void *, int); void fdt_print_node(void *, int); |