diff options
author | Jessica Clarke <jrtc27@jrtc27.com> | 2020-06-08 01:16:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-07 17:16:40 -0700 |
commit | 5d9ed238e1cabfbca3c47f50d32894ce94bfc304 (patch) | |
tree | 7d16ae69dc1800243a98c6f15f674e686505da9a /machine | |
parent | a38aa7f7073b57e8527efad8e01fafc580df420f (diff) | |
download | riscv-pk-5d9ed238e1cabfbca3c47f50d32894ce94bfc304.zip riscv-pk-5d9ed238e1cabfbca3c47f50d32894ce94bfc304.tar.gz riscv-pk-5d9ed238e1cabfbca3c47f50d32894ce94bfc304.tar.bz2 |
Consistently use fdt_string_list for FDT compatible property (#202)
QEMU's finisher is "sifive,test1\0sifive,test0\0syscon" so we fail to
detect it currently. Instead, search the entire list, and for
completeness do the same with the HTIF and SiFive UART drivers.
Diffstat (limited to 'machine')
-rw-r--r-- | machine/finisher.c | 2 | ||||
-rw-r--r-- | machine/htif.c | 2 | ||||
-rw-r--r-- | machine/uart.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/machine/finisher.c b/machine/finisher.c index 60dcb30..ed6604e 100644 --- a/machine/finisher.c +++ b/machine/finisher.c @@ -31,7 +31,7 @@ static void finisher_open(const struct fdt_scan_node *node, void *extra) static void finisher_prop(const struct fdt_scan_prop *prop, void *extra) { struct finisher_scan *scan = (struct finisher_scan *)extra; - if (!strcmp(prop->name, "compatible") && !strcmp((const char*)prop->value, "sifive,test0")) { + if (!strcmp(prop->name, "compatible") && fdt_string_list_index(prop, "sifive,test0") >= 0) { scan->compat = 1; } else if (!strcmp(prop->name, "reg")) { fdt_get_address(prop->node->parent, prop->value, &scan->reg); diff --git a/machine/htif.c b/machine/htif.c index aae8c56..5f8722f 100644 --- a/machine/htif.c +++ b/machine/htif.c @@ -128,7 +128,7 @@ static void htif_open(const struct fdt_scan_node *node, void *extra) static void htif_prop(const struct fdt_scan_prop *prop, void *extra) { struct htif_scan *scan = (struct htif_scan *)extra; - if (!strcmp(prop->name, "compatible") && !strcmp((const char*)prop->value, "ucb,htif0")) { + if (!strcmp(prop->name, "compatible") && fdt_string_list_index(prop, "ucb,htif0") >= 0) { scan->compat = 1; } } diff --git a/machine/uart.c b/machine/uart.c index 8cb47fb..697d7ba 100644 --- a/machine/uart.c +++ b/machine/uart.c @@ -45,7 +45,7 @@ static void uart_open(const struct fdt_scan_node *node, void *extra) static void uart_prop(const struct fdt_scan_prop *prop, void *extra) { struct uart_scan *scan = (struct uart_scan *)extra; - if (!strcmp(prop->name, "compatible") && !strcmp((const char*)prop->value, "sifive,uart0")) { + if (!strcmp(prop->name, "compatible") && fdt_string_list_index(prop, "sifive,uart0") >= 0) { scan->compat = 1; } else if (!strcmp(prop->name, "reg")) { fdt_get_address(prop->node->parent, prop->value, &scan->reg); |