git: 1320b22f49b2 - stable/13 - dev/psci: Check all compat strings
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 15 Jul 2024 12:38:15 UTC
The branch stable/13 has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=1320b22f49b2385dc12505a93c3e2e34071d4eae
commit 1320b22f49b2385dc12505a93c3e2e34071d4eae
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:34:29 +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 a656a1365067..da0a5f2edb16 100644
--- a/sys/dev/psci/psci.c
+++ b/sys/dev/psci/psci.c
@@ -382,12 +382,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);