diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2021-10-16 17:14:42 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2021-10-16 17:14:42 +0000 |
commit | fe2cbf7029e050107038daf3e5f4332bbaca1530 (patch) | |
tree | d229fdf86ab5db58a8838c3eca956b6dcf951b1f /sys | |
parent | d8a9537c426b0e927169692c4c02e9d698eeb35d (diff) |
Bail out early if the PCIe controller hasn't been initialized by the
firmware.
ok jsg@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/fdt/bcm2711_pcie.c | 12 |
1 files changed, 11 insertions, 1 deletions
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 <kettenis@openbsd.org> * @@ -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", |