The branch main has been updated by andrew:

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

commit f91e9401c2098ba56f43093ef9747d0b1f60f8eb
Author:     Andrew Turner <and...@freebsd.org>
AuthorDate: 2024-04-23 11:27:09 +0000
Commit:     Andrew Turner <and...@freebsd.org>
CommitDate: 2024-05-10 09:29:24 +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
---
 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 e1e9c1880b54..3211c331ed6e 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);
 
        if (!ofw_bus_node_status_okay(node))
                return (PSCI_MISSING);

Reply via email to