blob: 931e5a17709d7a53d3aad7cbdfb1037a19a36648 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// SPDX-License-Identifier: GPL-2.0-only
#define pr_fmt(fmt) "deep-probe: " fmt
#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;
pr_info("supported due to %s\n", matches->compatible);
return true;
}
}
}
boardstate = DEEP_PROBE_NOT_SUPPORTED;
return false;
}
EXPORT_SYMBOL_GPL(deep_probe_is_supported);
|