Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jul 2024 12:38:08 GMT
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: ab44e45862e0 - stable/14 - dev/psci: Check all compat strings
Message-ID:  <202407151238.46FCc8II059874@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=ab44e45862e099dac5f3bd5390c3233ad1073a56

commit ab44e45862e099dac5f3bd5390c3233ad1073a56
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-04-23 11:27:09 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-07-15 12:24:30 +0000

    dev/psci: Check all compat strings
    
    When searching for the PSCI FDT node we only check a few compat strings.
    Use the existing compat_data array to check all strings the driver may
    attach to.
    
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D44913
    
    (cherry picked from commit f91e9401c2098ba56f43093ef9747d0b1f60f8eb)
---
 sys/dev/psci/psci.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/sys/dev/psci/psci.c b/sys/dev/psci/psci.c
index 4fd1cd62ed8c..bc35f818d844 100644
--- a/sys/dev/psci/psci.c
+++ b/sys/dev/psci/psci.c
@@ -378,12 +378,18 @@ psci_fdt_callfn(psci_callfn_t *callfn)
 {
 	phandle_t node;
 
-	node = ofw_bus_find_compatible(OF_peer(0), "arm,psci-0.2");
-	if (node == 0) {
-		node = ofw_bus_find_compatible(OF_peer(0), "arm,psci-1.0");
-		if (node == 0)
-			return (PSCI_MISSING);
+	/* XXX: This is suboptimal, we should walk the tree & check each
+	 * node against compat_data, but we only have a few entries so
+	 * it's ok for now.
+	 */
+	for (int i = 0; compat_data[i].ocd_str != NULL; i++) {
+		node = ofw_bus_find_compatible(OF_peer(0),
+		    compat_data[i].ocd_str);
+		if (node != 0)
+			break;
 	}
+	if (node == 0)
+		return (PSCI_MISSING);
 
 	*callfn = psci_fdt_get_callfn(node);
 	return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407151238.46FCc8II059874>