From 5d9ed238e1cabfbca3c47f50d32894ce94bfc304 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Mon, 8 Jun 2020 01:16:40 +0100 Subject: 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. --- machine/finisher.c | 2 +- machine/htif.c | 2 +- machine/uart.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'machine') 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); -- cgit v1.1