git: 8f2e39b9d3ec - stable/12 - pci_dw: Trim ATU windows bigger than 4GB
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 14 Oct 2021 16:20:15 UTC
The branch stable/12 has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=8f2e39b9d3ecbd9653f859d9261745059f2b9071 commit 8f2e39b9d3ecbd9653f859d9261745059f2b9071 Author: Wojciech Macek <wma@FreeBSD.org> AuthorDate: 2021-04-09 07:28:44 +0000 Commit: Marcin Wojtas <mw@FreeBSD.org> CommitDate: 2021-10-14 16:09:44 +0000 pci_dw: Trim ATU windows bigger than 4GB The size of the ATU MEM/IO windows is implicitly casted to uint32_t. Because of that some window sizes were silently demoted to 0 and ignored. Check the size if its too large, trim it to 4GB and print a warning message. Submitted by: Kornel Duleba <mindal@semihalf.com> Reviewed by: mw Obtained from: Semihalf Sponsored by: Marvell Differential revision: https://reviews.freebsd.org/D29625 (cherry picked from commit 243000b19f8b4ab104b584b2d16bc6aa9131c9b5) --- sys/dev/pci/pci_dw.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/dev/pci/pci_dw.c b/sys/dev/pci/pci_dw.c index 904e36caff20..973a56239473 100644 --- a/sys/dev/pci/pci_dw.c +++ b/sys/dev/pci/pci_dw.c @@ -350,6 +350,18 @@ pci_dw_decode_ranges(struct pci_dw_softc *sc, struct ofw_pci_range *ranges, " Not all required ranges are found in DT\n"); return (ENXIO); } + if (sc->io_range.size > UINT32_MAX) { + device_printf(sc->dev, + "ATU IO window size is too large. Up to 4GB windows " + "are supported, trimming window size to 4GB\n"); + sc->io_range.size = UINT32_MAX; + } + if (sc->mem_range.size > UINT32_MAX) { + device_printf(sc->dev, + "ATU MEM window size is too large. Up to 4GB windows " + "are supported, trimming window size to 4GB\n"); + sc->mem_range.size = UINT32_MAX; + } return (0); }