git: 9873b1716970 - main - bcm_dma: attach at an earlier bus pass

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Fri, 24 Feb 2023 17:23:34 UTC
The branch main has been updated by mhorne:

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

commit 9873b171697033f9f19608d98bcd1c16cacb92af
Author:     Mark Millard <marklmi26-fbsd@yahoo.com>
AuthorDate: 2023-02-17 20:30:35 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2023-02-24 17:20:40 +0000

    bcm_dma: attach at an earlier bus pass
    
    The sdhci_bcm driver attach routine relies on bcm_dma already being
    attached, in order to allocate a DMA channel. However, both drivers
    attached at the default pass so this is not guaranteed. Newer RPI
    firmware exposes this assumption, and the result is a NULL-dereference
    in bcm_dma_allocate().
    
    To fix this, use BUS_PASS_SUPPORTDEV for bcm_dma.
    
    PR:             268835
    Reviewed by:    mhorne
    MFC after:      1 week
---
 sys/arm/broadcom/bcm2835/bcm2835_dma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/arm/broadcom/bcm2835/bcm2835_dma.c b/sys/arm/broadcom/bcm2835/bcm2835_dma.c
index 5f9ecb0b7981..49a3938282a2 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_dma.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_dma.c
@@ -764,5 +764,6 @@ static driver_t bcm_dma_driver = {
 	sizeof(struct bcm_dma_softc),
 };
 
-DRIVER_MODULE(bcm_dma, simplebus, bcm_dma_driver, 0, 0);
+EARLY_DRIVER_MODULE(bcm_dma, simplebus, bcm_dma_driver, 0, 0,
+    BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_MIDDLE);
 MODULE_VERSION(bcm_dma, 1);