diff options
author | Wojciech Macek <wma@FreeBSD.org> | 2021-04-09 07:28:44 +0000 |
---|---|---|
committer | Jessica Clarke <jrtc27@FreeBSD.org> | 2021-09-07 12:06:47 +0000 |
commit | 215db69fbcb0b5acc04fbd9cb858e91d36252a46 (patch) | |
tree | ac14aa63f34c6119066bbb718efa2fe02b70cf63 /sys/dev/pci | |
parent | 0e948ed6d668d6dba240c4605301f47150be00bb (diff) |
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)
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/pci_dw.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/dev/pci/pci_dw.c b/sys/dev/pci/pci_dw.c index 161a68d2929d..f0aae5bf8418 100644 --- a/sys/dev/pci/pci_dw.c +++ b/sys/dev/pci/pci_dw.c @@ -342,6 +342,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); } |