git: 7339a7bd9739 - main - plic: add thead,c900-plic compatible

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Wed, 10 Jul 2024 17:09:48 UTC
The branch main has been updated by mhorne:

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

commit 7339a7bd9739f0386344c9bb560894cca84348a4
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2024-07-10 16:57:15 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-07-10 17:09:14 +0000

    plic: add thead,c900-plic compatible
    
    This allows attachment on Allwinner D1, and others.
    
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation
---
 sys/riscv/riscv/plic.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sys/riscv/riscv/plic.c b/sys/riscv/riscv/plic.c
index 406aff5bbff0..5280ec0bb333 100644
--- a/sys/riscv/riscv/plic.c
+++ b/sys/riscv/riscv/plic.c
@@ -99,6 +99,13 @@ struct plic_softc {
 	int			ndev;
 };
 
+static struct ofw_compat_data compat_data[] = {
+	{ "riscv,plic0",	1 },
+	{ "sifive,plic-1.0.0",	1 },
+	{ "thead,c900-plic",	1 },
+	{ NULL,			0 }
+};
+
 #define	RD4(sc, reg)				\
     bus_read_4(sc->mem_res, (reg))
 #define	WR4(sc, reg, val)			\
@@ -230,8 +237,7 @@ plic_probe(device_t dev)
 	if (!ofw_bus_status_okay(dev))
 		return (ENXIO);
 
-	if (!ofw_bus_is_compatible(dev, "riscv,plic0") &&
-	    !ofw_bus_is_compatible(dev, "sifive,plic-1.0.0"))
+	if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
 		return (ENXIO);
 
 	device_set_desc(dev, "RISC-V PLIC");