Date: Wed, 18 Feb 2026 16:05:10 +0000 From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 349808d8bd19 - main - pcib: Assume a window where both the base and limit are 0 is uninitialized Message-ID: <6995e336.31e5c.551f1ab6@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=349808d8bd197165390a286bccdaa29a1d77c7ab commit 349808d8bd197165390a286bccdaa29a1d77c7ab Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2026-02-18 16:04:54 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2026-02-18 16:04:54 +0000 pcib: Assume a window where both the base and limit are 0 is uninitialized Since the low bits of a window's limit are hardwired to 1, this configuration looks like a minimally sized window at address 0. However, PCI resources are not generally at address 0 (see the __PCI_BAR_ZERO_VALID macro that was only defined on sparc64), and some PCI-PCI bridges report these register values after a reset. The result today is a lot of spam in dmesg as the minimally-sized windows fail to allocate. By ignoring these windows and treating them as closed the end result is the same, but there is less spam during boot. Reported by: jrtc27 Differential Revision: https://reviews.freebsd.org/D43922 --- sys/dev/pci/pci_pci.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c index 788af7339418..5cdb1de71c3f 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -437,6 +437,24 @@ pcib_alloc_window(struct pcib_softc *sc, struct pcib_window *w, int type, if (!pcib_is_window_open(w)) return; + /* + * Assume that a window where both the base and limit read as + * zero is not really open, or at least not assigned a valid + * range by the firmware. This can happen if a bridge device + * is never initialized by firmware, or if a platform driver + * resets the bridge. + * + * If devices behind this bridge have firmware-assigned + * resources in this range then the window will be reallocated + * on-demand. + */ + if (w->base == 0 && w->limit == ((pci_addr_t)1 << w->step) - 1) { + w->base = max_address; + w->limit = 0; + pcib_write_windows(sc, w->mask); + return; + } + if (w->base > max_address || w->limit > max_address) { device_printf(sc->dev, "initial %s window has too many bits, ignoring\n", w->name);home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6995e336.31e5c.551f1ab6>
