Correct a couple of defines in pcie_host.h
v2 cover Correct a couple of defines in pcie_host.h
Hi,
This series attempts to correct a couple of defines inside pcie_host.h.
Best regards,
Francisco Iglesias
Changelog:v1->v2:
* Went from RFC to patch proposal
* Added more meat on the commit message of patch 1
Francisco Iglesias (2):
include/hw/pci/pcie_host: Correct PCIE_MMCFG_BUS_MASK include/hw/pci/pcie_host: Correct PCIE_MMCFG_SIZE_MAX
include/hw/pci/pcie_host.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.20.1
PATCH v2 1/2 include/hw/pci/pcie_host: Correct PCIE_MMCFG_BUS_MASK
According to [1] address bits 27 - 20 are mapped to the bus number (the TLPs bus number field is 8 bits). Below is the formula taken from Table 7-1 in [1].
"
Memory Address | PCI Express Configuration Space
A[(20+n-1):20] | Bus Number, 1 ≤ n ≤ 8
"
[1] PCI Express® Base Specification Revision 5.0 Version 1.0
--- include/hw/pci/pcie_host.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/hw/pci/pcie_host.h +2 -2
@@ -60,7 +60,7 @@ void pcie_host_mmcfg_update(PCIExpressHost *e,/* * PCI express ECAM (Enhanced Configuration Address Mapping) format. * AKA mmcfg address -* bit 20 - 28: bus number +* bit 20 - 27: bus number * bit 15 - 19: device number * bit 12 - 14: function number * bit 0 - 11: offset in configuration space of a given device
@@ -68,7 +68,7 @@ void pcie_host_mmcfg_update(PCIExpressHost *e,#define PCIE_MMCFG_SIZE_MAX (1ULL << 29)#define PCIE_MMCFG_SIZE_MIN (1ULL << 20)#define PCIE_MMCFG_BUS_BIT 20 -#define PCIE_MMCFG_BUS_MASK 0x1ff +#define PCIE_MMCFG_BUS_MASK 0xff#define PCIE_MMCFG_DEVFN_BIT 12#define PCIE_MMCFG_DEVFN_MASK 0xff#define PCIE_MMCFG_CONFOFFSET_MASK 0xfff
Signature · 1 line
2.20.1
PATCH v2 2/2 include/hw/pci/pcie_host: Correct PCIE_MMCFG_SIZE_MAX
In reply to Francisco IglesiasAccording to 7.2.2 in [1] bit 27 is the last bit that can be part of the bus number, this makes the ECAM max size equal to '1 << 28'. This patch restores back this value into the PCIE_MMCFG_SIZE_MAX define (which was changed in commit 58d5b22bbd5 ("ppc4xx: Add device models found in PPC440 core SoCs")).
[1] PCI Express® Base Specification Revision 5.0 Version 1.0
--- include/hw/pci/pcie_host.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/pci/pcie_host.h +1 -1
@@ -65,7 +65,7 @@ void pcie_host_mmcfg_update(PCIExpressHost *e,* bit 12 - 14: function number * bit 0 - 11: offset in configuration space of a given device */ -#define PCIE_MMCFG_SIZE_MAX (1ULL << 29) +#define PCIE_MMCFG_SIZE_MAX (1ULL << 28)#define PCIE_MMCFG_SIZE_MIN (1ULL << 20)#define PCIE_MMCFG_BUS_BIT 20#define PCIE_MMCFG_BUS_MASK 0xff
Signature · 1 line
2.20.1