On Sat, Jul 04, 2020 at 12:19:59AM +0200, Mark Kettenis wrote:
> 
> Anyway, I think the problem is that OF_finddevice() returns -1 if the
> node can't be found.  Does the following diff help?

mp kernel boots on rpi3 with this
ok jsg@ if you also fix mainbus_attach_framebuffer()

arm64 efi_attach() also has a bad KASSERT()

        node = OF_finddevice("/chosen");
        KASSERT(node);

> 
> 
> Index: arch/arm64/dev/mainbus.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/arm64/dev/mainbus.c,v
> retrieving revision 1.17
> diff -u -p -r1.17 mainbus.c
> --- arch/arm64/dev/mainbus.c  17 Jun 2020 08:00:22 -0000      1.17
> +++ arch/arm64/dev/mainbus.c  3 Jul 2020 22:16:43 -0000
> @@ -316,7 +316,7 @@ mainbus_attach_cpus(struct device *self,
>       int acells, scells;
>       char buf[32];
>  
> -     if (node == 0)
> +     if (node == -1)
>               return;
>  
>       acells = sc->sc_acells;
> @@ -369,7 +369,7 @@ mainbus_attach_psci(struct device *self)
>       struct mainbus_softc *sc = (struct mainbus_softc *)self;
>       int node = OF_finddevice("/psci");
>  
> -     if (node == 0)
> +     if (node == -1)
>               return;
>  
>       sc->sc_early = 1;
> @@ -384,7 +384,8 @@ mainbus_attach_efi(struct device *self)
>       struct fdt_attach_args fa;
>       int node = OF_finddevice("/chosen");
>  
> -     if (node == 0 || OF_getproplen(node, "openbsd,uefi-system-table") <= 0)
> +     if (node == -1 ||
> +         OF_getproplen(node, "openbsd,uefi-system-table") <= 0)
>               return;
>  
>       memset(&fa, 0, sizeof(fa));
> 
> 

Reply via email to