git: 122ac7ca1424 - stable/13 - x86: Adjust base addr for PCI MCFG regions
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 18 Jan 2024 23:39:25 UTC
The branch stable/13 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=122ac7ca14244a865a2252c853f3601816398a95
commit 122ac7ca14244a865a2252c853f3601816398a95
Author: Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2023-12-27 08:09:08 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-01-18 23:27:25 +0000
x86: Adjust base addr for PCI MCFG regions
Each bus gets 1 MB of address space; the actual base address for an
MCFG bus range is the address from the table plus the starting bus
number times 1 MB.
The PCI spec is unclear on this point, but this change matches what
Linux does, which is likely enough of a de facto standard regardless
of what any de jure standard might attempt to say.
Fixes: f54a3890b1f4 ("x86: Support multiple PCI MCFG regions")
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D43206
(cherry picked from commit 61e2161367bb4e68e603f53b1107f9427f988861)
---
sys/amd64/pci/pci_cfgreg.c | 2 +-
sys/i386/pci/pci_cfgreg.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys/amd64/pci/pci_cfgreg.c b/sys/amd64/pci/pci_cfgreg.c
index 0f591cb0112a..e026eb57c413 100644
--- a/sys/amd64/pci/pci_cfgreg.c
+++ b/sys/amd64/pci/pci_cfgreg.c
@@ -298,7 +298,7 @@ pcie_cfgregopen(uint64_t base, uint16_t domain, uint8_t minbus, uint8_t maxbus)
region = &mcfg_regions[mcfg_numregions];
/* XXX: We should make sure this really fits into the direct map. */
- region->base = pmap_mapdev_pciecfg(base, (maxbus + 1 - minbus) << 20);
+ region->base = pmap_mapdev_pciecfg(base + (minbus << 20), (maxbus + 1 - minbus) << 20);
region->domain = domain;
region->minbus = minbus;
region->maxbus = maxbus;
diff --git a/sys/i386/pci/pci_cfgreg.c b/sys/i386/pci/pci_cfgreg.c
index 231205dde28c..d5896c0d4583 100644
--- a/sys/i386/pci/pci_cfgreg.c
+++ b/sys/i386/pci/pci_cfgreg.c
@@ -575,7 +575,7 @@ pcie_cfgregopen(uint64_t base, uint16_t domain, uint8_t minbus, uint8_t maxbus)
sizeof(*mcfg_regions) * (mcfg_numregions + 1), M_DEVBUF, M_WAITOK);
region = &mcfg_regions[mcfg_numregions];
- region->base = base;
+ region->base = base + (minbus << 20);
region->domain = domain;
region->minbus = minbus;
region->maxbus = maxbus;