diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Makefile | 1 | ||||
-rw-r--r-- | common/deep-probe.c | 39 |
2 files changed, 40 insertions, 0 deletions
diff --git a/common/Makefile b/common/Makefile index 382a4f661f..daa022ff54 100644 --- a/common/Makefile +++ b/common/Makefile @@ -3,6 +3,7 @@ obj-y += memory_display.o pbl-$(CONFIG_PBL_CONSOLE) += memory_display.o obj-y += clock.o obj-y += console_common.o +obj-y += deep-probe.o obj-y += startup.o obj-y += misc.o obj-pbl-y += memsize.o diff --git a/common/deep-probe.c b/common/deep-probe.c new file mode 100644 index 0000000000..1020ad93b7 --- /dev/null +++ b/common/deep-probe.c @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include <common.h> +#include <deep-probe.h> +#include <of.h> + +enum deep_probe_state { + DEEP_PROBE_UNKONWN = -1, + DEEP_PROBE_NOT_SUPPORTED, + DEEP_PROBE_SUPPORTED +}; + +static enum deep_probe_state boardstate = DEEP_PROBE_UNKONWN; + +bool deep_probe_is_supported(void) +{ + struct deep_probe_entry *board; + + if (boardstate > DEEP_PROBE_UNKONWN) + return boardstate; + + /* determine boardstate */ + for (board = &__barebox_deep_probe_start; + board != &__barebox_deep_probe_end; board++) { + const struct of_device_id *matches = board->device_id; + + for (; matches->compatible; matches++) { + if (of_machine_is_compatible(matches->compatible)) { + boardstate = DEEP_PROBE_SUPPORTED; + printk("Deep probe supported due to %s\n", matches->compatible); + return true; + } + } + } + + boardstate = DEEP_PROBE_NOT_SUPPORTED; + return false; +} +EXPORT_SYMBOL_GPL(deep_probe_is_supported); |