Question: device_t related code vs. FDT's lack of define before use/reference requirements: is there a normal FreeBSD technique to deal with such?
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 15 Dec 2022 22:29:21 UTC
While the RPi4B's provide the example here, as far as I can tell, nothing here need be RPi* specific: the question is more general for FDT involvement in the device_t related activity. Modern RPi4B live FDT's have the sequencing: mmc@7e300000 { compatible = "brcm,bcm2835-mmc", "brcm,bcm2835-sdhci"; . . . dmas = <0x0000000c 0x0000000b>; . . . }; . . . . . . Note: the brcm,bcm2835-mmc related attach attempts to use the later dma@7e007000 . . . instance of brcm,bcm2835-dma. (Note the 0x0000000c phandle referenced is . . . defined below as well: reference before definition.) . . . The result is a kernel crash from a bad dereference of bcm_dma_sc->sc_mtx . . . (really sc=bcm_dma_sc then later sc->sc_mtx). . . . dma@7e007000 { compatible = "brcm,bcm2835-dma"; . . . interrupt-names = "dma0", "dma1", "dma2", "dma3", "dma4", "dma5", "dma6", "dma7", "dma8", "dma9", "dma10"; #dma-cells = <0x00000001>; brcm,dma-channel-mask = <0x000007f5>; phandle = <0x0000000c>; }; . . . mmcnr@7e300000 { compatible = "brcm,bcm2835-mmc", "brcm,bcm2835-sdhci"; . . . dmas = <0x0000000c 0x0000000b>; dma-names = "rx-tx"; . . . }; How is the device_t related probing and attachment of FreeBSD devices supposed to work for such a FDT ordering of the information? Are there one or more identified ways of handling such? Or does FreeBSD effectively require define before use/reference in FDT's in general? The code happened to not fail back when the RPi* firmware happened to have the FDT sequencing (phandle 0x0000000b for this example): dma@7e007000 { compatible = "brcm,bcm2835-dma"; . . . interrupt-names = "dma0", "dma1", "dma2", "dma3", "dma4", "dma5", "dma6", "dma7", "dma8", "dma9", "dma10"; #dma-cells = <0x00000001>; brcm,dma-channel-mask = <0x000007f5>; phandle = <0x0000000b>; }; . . . mmc@7e300000 { compatible = "brcm,bcm2835-mmc", "brcm,bcm2835-sdhci"; . . . dmas = <0x0000000b 0x0000000b>; dma-names = "rx-tx"; . . . }; mmcnr@7e300000 { compatible = "brcm,bcm2835-mmc", "brcm,bcm2835-sdhci"; . . . dmas = <0x0000000b 0x0000000b>; dma-names = "rx-tx"; . . . }; (which happens to be: define before use/reference). === Mark Millard marklmi at yahoo.com