From: kettenis Date: Sat, 16 Oct 2021 17:14:41 +0000 (+0000) Subject: Bail out early if the PCIe controller hasn't been initialized by the X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=054189b23f0af10d62dce7b66c95eb55c96805aa;p=openbsd Bail out early if the PCIe controller hasn't been initialized by the firmware. ok jsg@ --- diff --git a/sys/dev/fdt/bcm2711_pcie.c b/sys/dev/fdt/bcm2711_pcie.c index 70b1d2efa2b..b3468f7ad78 100644 --- a/sys/dev/fdt/bcm2711_pcie.c +++ b/sys/dev/fdt/bcm2711_pcie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcm2711_pcie.c,v 1.6 2021/05/17 17:25:13 kettenis Exp $ */ +/* $OpenBSD: bcm2711_pcie.c,v 1.7 2021/10/16 17:14:41 kettenis Exp $ */ /* * Copyright (c) 2020 Mark Kettenis * @@ -40,6 +40,9 @@ #define PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI 0x4084 #define PCIE_EXT_CFG_DATA 0x8000 #define PCIE_EXT_CFG_INDEX 0x9000 +#define PCIE_RGR1_SW_INIT_1 0x9210 +#define PCIE_RGR1_SW_INIT_1_PERST_MASK (1 << 0) +#define PCIE_RGR1_SW_INIT_1_INIT_MASK (1 << 1) #define HREAD4(sc, reg) \ (bus_space_read_4((sc)->sc_iot, (sc)->sc_ioh, (reg))) @@ -121,6 +124,7 @@ bcmpcie_attach(struct device *parent, struct device *self, void *aux) struct pcibus_attach_args pba; uint32_t *ranges; int i, j, nranges, rangeslen; + uint32_t reg; if (faa->fa_nreg < 1) { printf(": no registers\n"); @@ -134,6 +138,12 @@ bcmpcie_attach(struct device *parent, struct device *self, void *aux) return; } + reg = HREAD4(sc, PCIE_RGR1_SW_INIT_1); + if (reg & PCIE_RGR1_SW_INIT_1_INIT_MASK) { + printf(": disabled\n"); + return; + } + sc->sc_node = faa->fa_node; sc->sc_acells = OF_getpropint(sc->sc_node, "#address-cells",