From 6f3fcd769335399ad2ac76a42bb36dff680beef3 Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Fri, 15 Jun 2018 18:55:02 +0000 Subject: [PATCH] Check for a 'pci' prefix rather than a full match in get_addr_props Summary: Newer OPAL device trees, such as those on POWER9 systems, use 'pciex' for device_type, not 'pci'. Rather than enumerating all possible variants, just check for a 'pci' prefix. Reviewed by: nwhitehorn, breno.leitao_gmail.com Differential Revision: https://reviews.freebsd.org/D15817 --- sys/dev/ofw/ofw_subr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/dev/ofw/ofw_subr.c b/sys/dev/ofw/ofw_subr.c index c1ded7635c5..e7cfd972cbd 100644 --- a/sys/dev/ofw/ofw_subr.c +++ b/sys/dev/ofw/ofw_subr.c @@ -61,7 +61,9 @@ get_addr_props(phandle_t node, uint32_t *addrp, uint32_t *sizep, int *pcip) res = OF_getprop(node, "device_type", type, sizeof(type)); if (res != -1) { type[sizeof(type) - 1] = '\0'; - pci = (strcmp(type, "pci") == 0) ? 1 : 0; + if (strcmp(type, "pci") == 0 || + strcmp(type, "pciex")== 0) + pci = 1; } } if (addrp != NULL)