Patchwork Do not hide resource for pci/pcie when configured as Agent/EP

login
register
mail settings
Submitter Hongtao Jia
Date Oct. 28, 2011, 8:08 a.m.
Message ID <1319789280-12091-1-git-send-email-B38951@freescale.com>
Download mbox | patch
Permalink /patch/122369/
State Accepted
Delegated to: Kumar Gala
Headers show

Comments

Hongtao Jia - Oct. 28, 2011, 8:08 a.m.
From: Jason Jin <Jason.jin@freescale.com>

Current pci/pcie init code will hide the pci/pcie host resource.
But did not judge it is host/RC or agent/EP. If configured as
agent/EP, we should avoid hiding its resource in the host side.

In PCI system, the Programing Interface can be used to judge the
host/agent status:
Programing Interface = 0: host
Programing Interface = 1: Agent

In PCIE system, both the Programing Interface and Header type can
be used to judge the RC/EP status.
Header Type = 0: EP
Header Type = 1: RC

Signed-off-by: Jason Jin <Jason.jin@freescale.com>
Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/kernel/pci-common.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Kumar Gala - Nov. 24, 2011, 5:04 a.m.
On Oct 28, 2011, at 3:08 AM, Jia Hongtao wrote:

> From: Jason Jin <Jason.jin@freescale.com>
> 
> Current pci/pcie init code will hide the pci/pcie host resource.
> But did not judge it is host/RC or agent/EP. If configured as
> agent/EP, we should avoid hiding its resource in the host side.
> 
> In PCI system, the Programing Interface can be used to judge the
> host/agent status:
> Programing Interface = 0: host
> Programing Interface = 1: Agent
> 
> In PCIE system, both the Programing Interface and Header type can
> be used to judge the RC/EP status.
> Header Type = 0: EP
> Header Type = 1: RC
> 
> Signed-off-by: Jason Jin <Jason.jin@freescale.com>
> Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
> Signed-off-by: Jia Hongtao <B38951@freescale.com>
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
> arch/powerpc/kernel/pci-common.c |    3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)

applied to next

- k

Patch

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 4f134132c..bc61a69 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1732,10 +1732,13 @@  void __devinit pcibios_scan_phb(struct pci_controller *hose)
 static void fixup_hide_host_resource_fsl(struct pci_dev *dev)
 {
 	int i, class = dev->class >> 8;
+	/* When configured as agent, programing interface = 1 */
+	int prog_if = dev->class & 0xf;
 
 	if ((class == PCI_CLASS_PROCESSOR_POWERPC ||
 	     class == PCI_CLASS_BRIDGE_OTHER) &&
 		(dev->hdr_type == PCI_HEADER_TYPE_NORMAL) &&
+		(prog_if == 0) &&
 		(dev->bus->parent == NULL)) {
 		for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
 			dev->resource[i].start = 0;