linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] [POWERPC] the pci_dn class_code is only used by EEH
@ 2007-12-21  4:48 Stephen Rothwell
  2007-12-21  4:49 ` [PATCH 2/3] [POWERPC] the pci_dn pcidev " Stephen Rothwell
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Rothwell @ 2007-12-21  4:48 UTC (permalink / raw)
  To: paulus; +Cc: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 include/asm-powerpc/pci-bridge.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index 9b16d3b..07cdb5b 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -167,7 +167,6 @@ struct pci_dn {
 	int	busno;			/* pci bus number */
 	int	bussubno;		/* pci subordinate bus number */
 	int	devfn;			/* pci device and function number */
-	int	class_code;		/* pci device class */
 
 	struct  pci_controller *phb;	/* for pci devices */
 	struct	iommu_table *iommu_table;	/* for phb's or bridges */
@@ -177,6 +176,7 @@ struct pci_dn {
 	int	pci_ext_config_space;	/* for pci devices */
 
 #ifdef CONFIG_EEH
+	int	class_code;		/* pci device class */
 	int	eeh_mode;		/* See eeh.h for possible EEH_MODEs */
 	int	eeh_config_addr;
 	int	eeh_pe_config_addr; /* new-style partition endpoint address */
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] [POWERPC] the pci_dn pcidev is only used by EEH
  2007-12-21  4:48 [PATCH 1/3] [POWERPC] the pci_dn class_code is only used by EEH Stephen Rothwell
@ 2007-12-21  4:49 ` Stephen Rothwell
  2007-12-21  4:50   ` [PATCH 3/3] [POWERPC] iSeries: eliminate pci_dn bussubno Stephen Rothwell
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Rothwell @ 2007-12-21  4:49 UTC (permalink / raw)
  To: paulus; +Cc: ppc-dev


Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/platforms/iseries/pci.c |    1 -
 include/asm-powerpc/pci-bridge.h     |    2 +-
 2 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index 30e3d99..9319410 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -438,7 +438,6 @@ void __init iSeries_pcibios_fixup_resources(struct pci_dev *pdev)
 	}
 
 	pdev->sysdata = node;
-	PCI_DN(node)->pcidev = pdev;
 	allocate_device_bars(pdev);
 	iseries_device_information(pdev, bus, *sub_bus);
 	iommu_devnode_init_iSeries(pdev, node);
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index 07cdb5b..2932404 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -170,12 +170,12 @@ struct pci_dn {
 
 	struct  pci_controller *phb;	/* for pci devices */
 	struct	iommu_table *iommu_table;	/* for phb's or bridges */
-	struct	pci_dev *pcidev;	/* back-pointer to the pci device */
 	struct	device_node *node;	/* back-pointer to the device_node */
 
 	int	pci_ext_config_space;	/* for pci devices */
 
 #ifdef CONFIG_EEH
+	struct	pci_dev *pcidev;	/* back-pointer to the pci device */
 	int	class_code;		/* pci device class */
 	int	eeh_mode;		/* See eeh.h for possible EEH_MODEs */
 	int	eeh_config_addr;
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] [POWERPC] iSeries: eliminate pci_dn bussubno
  2007-12-21  4:49 ` [PATCH 2/3] [POWERPC] the pci_dn pcidev " Stephen Rothwell
@ 2007-12-21  4:50   ` Stephen Rothwell
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Rothwell @ 2007-12-21  4:50 UTC (permalink / raw)
  To: paulus; +Cc: ppc-dev

xlate_iomm_address() really wants the ds_addr to pass to the HV, so store
that value (instead of the BAR number) when we allocate the device bars.
This is not a fast path, so we can look up the device_node property
there instead of using the bussubno field of the pci_dn.

The other user of iseries_ds_addr() was already scanning the device tree,
so looking up a property will not slow it down any more.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/kernel/pci_dn.c         |    5 -----
 arch/powerpc/platforms/iseries/pci.c |   12 +++++++-----
 include/asm-powerpc/pci-bridge.h     |    1 -
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index 85d4d89..1c67de5 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -56,11 +56,6 @@ static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
 		pdn->busno = (regs[0] >> 16) & 0xff;
 		pdn->devfn = (regs[0] >> 8) & 0xff;
 	}
-	if (firmware_has_feature(FW_FEATURE_ISERIES)) {
-		const u32 *busp = of_get_property(dn, "linux,subbus", NULL);
-		if (busp)
-			pdn->bussubno = *busp;
-	}
 
 	pdn->pci_ext_config_space = (type && *type == 1);
 	return NULL;
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index 9319410..cc562e4 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -29,6 +29,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/pci.h>
+#include <linux/of.h>
 
 #include <asm/types.h>
 #include <asm/io.h>
@@ -70,7 +71,7 @@ static long current_iomm_table_entry;
  * Lookup Tables.
  */
 static struct device_node *iomm_table[IOMM_TABLE_MAX_ENTRIES];
-static u8 iobar_table[IOMM_TABLE_MAX_ENTRIES];
+static u64 ds_addr_table[IOMM_TABLE_MAX_ENTRIES];
 
 static DEFINE_SPINLOCK(iomm_table_lock);
 
@@ -80,8 +81,9 @@ static DEFINE_SPINLOCK(iomm_table_lock);
 static inline u64 iseries_ds_addr(struct device_node *node)
 {
 	struct pci_dn *pdn = PCI_DN(node);
+	const u32 *sbp = of_get_property(node, "linux,subbus", NULL);
 
-	return ((u64)pdn->busno << 48) + ((u64)pdn->bussubno << 40)
+	return ((u64)pdn->busno << 48) + ((u64)(sbp ? *sbp : 0) << 40)
 			+ ((u64)0x10 << 32);
 }
 
@@ -333,7 +335,8 @@ static void __init iomm_table_allocate_entry(struct pci_dev *dev, int bar_num)
 	 */
 	while (bar_size > 0 ) {
 		iomm_table[current_iomm_table_entry] = dev->sysdata;
-		iobar_table[current_iomm_table_entry] = bar_num;
+		ds_addr_table[current_iomm_table_entry] =
+			iseries_ds_addr(dev->sysdata) | (bar_num << 24);
 		bar_size -= IOMM_TABLE_ENTRY_SIZE;
 		++current_iomm_table_entry;
 	}
@@ -598,8 +601,7 @@ static inline struct device_node *xlate_iomm_address(
 	dn = iomm_table[ind];
 
 	if (dn != NULL) {
-		int barnum = iobar_table[ind];
-		*dsaptr = iseries_ds_addr(dn) | (barnum << 24);
+		*dsaptr = ds_addr_table[ind];
 		*bar_offset = base_addr % IOMM_TABLE_ENTRY_SIZE;
 	} else
 		panic("PCI: Invalid PCI IO address detected!\n");
diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index 2932404..a6ea49e 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -165,7 +165,6 @@ struct iommu_table;
 
 struct pci_dn {
 	int	busno;			/* pci bus number */
-	int	bussubno;		/* pci subordinate bus number */
 	int	devfn;			/* pci device and function number */
 
 	struct  pci_controller *phb;	/* for pci devices */
-- 
1.5.3.7

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-12-21  4:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-21  4:48 [PATCH 1/3] [POWERPC] the pci_dn class_code is only used by EEH Stephen Rothwell
2007-12-21  4:49 ` [PATCH 2/3] [POWERPC] the pci_dn pcidev " Stephen Rothwell
2007-12-21  4:50   ` [PATCH 3/3] [POWERPC] iSeries: eliminate pci_dn bussubno Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).