Message ID | 1489105546-28092-1-git-send-email-gwshan@linux.vnet.ibm.com |
---|---|
State | Accepted |
Headers | show |
On Fri, Mar 10, 2017 at 11:25:45AM +1100, Gavin Shan wrote: >We are creating PCI slot on root port, where the PCI slot isn't >supported from hardware. For this case, we shouldn't read the PCI >slot capability from hardware. When bogus data returned from the >hardware, we will attempt to the PCI slot's power state or enable >surprise hotplug functionality. All of them can't be accomplished >without hardware support. > >This leaves the PCI slot's capability list 0 if PCICAP_EXP_CAP_SLOT >isn't set in hardware (pcie_cap + 0x2). Otherwise, the PCI slot's >capability list is retrieved from hardware (pcie_cap + 0x14). > >Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> ping, Stewart? >--- > core/pcie-slot.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > >diff --git a/core/pcie-slot.c b/core/pcie-slot.c >index 64f0da6..aca59dd 100644 >--- a/core/pcie-slot.c >+++ b/core/pcie-slot.c >@@ -461,8 +461,13 @@ struct pci_slot *pcie_slot_create(struct phb *phb, struct pci_device *pd) > &slot->pcie_cap); > pci_cfg_read32(phb, pd->bdfn, ecap + PCICAP_EXP_LCAP, > &slot->link_cap); >- pci_cfg_read32(phb, pd->bdfn, ecap + PCICAP_EXP_SLOTCAP, >- &slot->slot_cap); >+ >+ /* Leave PCI slot capability blank if PCI slot isn't supported */ >+ if (slot->pcie_cap & PCICAP_EXP_CAP_SLOT) >+ pci_cfg_read32(phb, pd->bdfn, ecap + PCICAP_EXP_SLOTCAP, >+ &slot->slot_cap); >+ else >+ slot->slot_cap = 0; > > if (slot->slot_cap & PCICAP_EXP_SLOTCAP_HPLUG_CAP) > slot->pluggable = 1; >-- >2.7.4 >
Gavin Shan <gwshan@linux.vnet.ibm.com> writes: > We are creating PCI slot on root port, where the PCI slot isn't > supported from hardware. For this case, we shouldn't read the PCI > slot capability from hardware. When bogus data returned from the > hardware, we will attempt to the PCI slot's power state or enable > surprise hotplug functionality. All of them can't be accomplished > without hardware support. > > This leaves the PCI slot's capability list 0 if PCICAP_EXP_CAP_SLOT > isn't set in hardware (pcie_cap + 0x2). Otherwise, the PCI slot's > capability list is retrieved from hardware (pcie_cap + 0x14). > > Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> > --- > core/pcie-slot.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) Sorry for the delay. Series Merged to master as of 7c4a326bea502fc1f3b8b767f6ff9c02b7d1b254
diff --git a/core/pcie-slot.c b/core/pcie-slot.c index 64f0da6..aca59dd 100644 --- a/core/pcie-slot.c +++ b/core/pcie-slot.c @@ -461,8 +461,13 @@ struct pci_slot *pcie_slot_create(struct phb *phb, struct pci_device *pd) &slot->pcie_cap); pci_cfg_read32(phb, pd->bdfn, ecap + PCICAP_EXP_LCAP, &slot->link_cap); - pci_cfg_read32(phb, pd->bdfn, ecap + PCICAP_EXP_SLOTCAP, - &slot->slot_cap); + + /* Leave PCI slot capability blank if PCI slot isn't supported */ + if (slot->pcie_cap & PCICAP_EXP_CAP_SLOT) + pci_cfg_read32(phb, pd->bdfn, ecap + PCICAP_EXP_SLOTCAP, + &slot->slot_cap); + else + slot->slot_cap = 0; if (slot->slot_cap & PCICAP_EXP_SLOTCAP_HPLUG_CAP) slot->pluggable = 1;
We are creating PCI slot on root port, where the PCI slot isn't supported from hardware. For this case, we shouldn't read the PCI slot capability from hardware. When bogus data returned from the hardware, we will attempt to the PCI slot's power state or enable surprise hotplug functionality. All of them can't be accomplished without hardware support. This leaves the PCI slot's capability list 0 if PCICAP_EXP_CAP_SLOT isn't set in hardware (pcie_cap + 0x2). Otherwise, the PCI slot's capability list is retrieved from hardware (pcie_cap + 0x14). Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> --- core/pcie-slot.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)