Skip to contentSkip to conversation

: sparc64: Get rid of pci_controller_info.

PATCH New David Miller 1 participant 1 message Sep 11, 2008 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 1/2 : sparc64: Get rid of pci_controller_info.

sparc64: Get rid of pci_controller_info.

It is just used as a parent to encapsulate two PBM objects.

But that layout is only really relevant and necessary for psycho PCI controllers, which unlike all the others share a single IOMMU instance between sibling PCI busses.

---
 arch/sparc/include/asm/iommu_64.h |    3 +
 arch/sparc64/kernel/pci.c         |    4 +-
 arch/sparc64/kernel/pci_fire.c    |   55 ++++---------
 arch/sparc64/kernel/pci_impl.h    |   16 +---
 arch/sparc64/kernel/pci_psycho.c  |  161 +++++++++++++++++--------------------
 arch/sparc64/kernel/pci_sabre.c   |   33 ++++----
 arch/sparc64/kernel/pci_schizo.c  |   84 +++++++++-----------
 arch/sparc64/kernel/pci_sun4v.c   |   66 ++++++---------
 8 files changed, 181 insertions(+), 241 deletions(-)
arch/sparc/include/asm/iommu_64.h +3 -0
index d7b9afc..caf798b 100644
@@ -48,6 +48,9 @@ struct strbuf {
 	unsigned long		strbuf_control;
 	unsigned long		strbuf_pflush;
 	unsigned long		strbuf_fsync;
+	unsigned long		strbuf_err_stat;
+	unsigned long		strbuf_tag_diag;
+	unsigned long		strbuf_line_diag;
 	unsigned long		strbuf_ctxflush;
 	unsigned long		strbuf_ctxmatch_base;
 	unsigned long		strbuf_flushflag_pa;
arch/sparc64/kernel/pci.c +2 -2
index 8e18fdf..3070f6f 100644
@@ -977,14 +977,14 @@ int pcibus_to_node(struct pci_bus *pbus)
 EXPORT_SYMBOL(pcibus_to_node);
 #endif
 
-/* Return the domain nuber for this pci bus */
+/* Return the domain number for this pci bus */
 
 int pci_domain_nr(struct pci_bus *pbus)
 {
 	struct pci_pbm_info *pbm = pbus->sysdata;
 	int ret;
 
-	if (pbm = NULL || pbm->parent = NULL) {
+	if (!pbm) {
 		ret = -ENXIO;
 	} else {
 		ret = pbm->index;
arch/sparc64/kernel/pci_fire.c +17 -38

107 lines not on this page · raw message

arch/sparc64/kernel/pci_impl.h +5 -11
index 4125f75..4937ce9 100644
@@ -56,15 +56,11 @@ struct sparc64_msiq_cookie {
 };
 #endif
 
-struct pci_controller_info;
-
 struct pci_pbm_info {
 	struct pci_pbm_info		*next;
+	struct pci_pbm_info		*sibling;
 	int				index;
 
-	/* PCI controller we sit under. */
-	struct pci_controller_info	*parent;
-
 	/* Physical address base of controller registers. */
 	unsigned long			controller_regs;
 
@@ -107,6 +103,10 @@ struct pci_pbm_info {
 	/* This will be 12 on PCI-E controllers, 8 elsewhere.  */
 	unsigned long			config_space_reg_bits;
 
+	unsigned long			pci_afsr;
+	unsigned long			pci_afar;
+	unsigned long			pci_csr;
+
 	/* State of 66MHz capabilities on this PBM. */
 	int				is_66mhz_capable;
 	int				all_devs_66mhz;
@@ -151,12 +151,6 @@ struct pci_pbm_info {
 	int				numa_node;
 };
 
-struct pci_controller_info {
-	/* The PCI bus modules controlled by us. */
-	struct pci_pbm_info		pbm_A;
-	struct pci_pbm_info		pbm_B;
-};
-
 extern struct pci_pbm_info *pci_pbm_root;
 
 extern int pci_num_pbms;
arch/sparc64/kernel/pci_psycho.c +74 -86

290 lines not on this page · raw message

arch/sparc64/kernel/pci_sabre.c +16 -16
index 707d6d6..8f779b5 100644
@@ -734,8 +734,8 @@ static int sabre_iommu_init(struct pci_pbm_info *pbm,
 	return 0;
 }
 
-static void __init sabre_pbm_init(struct pci_controller_info *p,
-				  struct pci_pbm_info *pbm, struct of_device *op)
+static void __init sabre_pbm_init(struct pci_pbm_info *pbm,
+				  struct of_device *op)
 {
 	struct device_node *dp = op->node;
 
@@ -750,7 +750,6 @@ static void __init sabre_pbm_init(struct pci_controller_info *p,
 	pbm->index = pci_num_pbms++;
 
 	pbm->chip_type = PBM_CHIP_TYPE_SABRE;
-	pbm->parent = p;
 	pbm->prom_node = dp;
 	pci_get_pbm_props(pbm);
 
@@ -764,7 +763,6 @@ static int __devinit sabre_probe(struct of_device *op,
 {
 	const struct linux_prom64_registers *pr_regs;
 	struct device_node *dp = op->node;
-	struct pci_controller_info *p;
 	struct pci_pbm_info *pbm;
 	u32 upa_portid, dma_mask;
 	struct iommu *iommu;
@@ -786,26 +784,22 @@ static int __devinit sabre_probe(struct of_device *op,
 	}
 
 	err = -ENOMEM;
-	p = kzalloc(sizeof(*p), GFP_ATOMIC);
-	if (!p) {
-		printk(KERN_ERR PFX "Cannot allocate controller info.\n");
+	pbm = kzalloc(sizeof(*pbm), GFP_KERNEL);
+	if (!pbm) {
+		printk(KERN_ERR PFX "Cannot allocate pci_pbm_info.\n");
 		goto out_err;
 	}
 
-	iommu = kzalloc(sizeof(*iommu), GFP_ATOMIC);
+	iommu = kzalloc(sizeof(*iommu), GFP_KERNEL);
 	if (!iommu) {
 		printk(KERN_ERR PFX "Cannot allocate PBM iommu.\n");
 		goto out_free_controller;
 	}
 
-	pbm = &p->pbm_A;
 	pbm->iommu = iommu;
 
 	upa_portid = of_getintprop_default(dp, "upa-portid", 0xff);
 
-	pbm->next = pci_pbm_root;
-	pci_pbm_root = pbm;
-
 	pbm->portid = upa_portid;
 
 	/*
@@ -840,8 +834,7 @@ static int __devinit sabre_probe(struct of_device *op,
 		     SABRE_PCICTRL_ARBPARK | SABRE_PCICTRL_AEN));
 
 	/* Now map in PCI config space for entire SABRE. */
-	pbm->config_space -		(pbm->controller_regs + SABRE_CONFIGSPACE);
+	pbm->config_space = pbm->controller_regs + SABRE_CONFIGSPACE;
 
 	vdma = of_get_property(dp, "virtual-dma", NULL);
 	if (!vdma) {
@@ -876,14 +869,20 @@ static int __devinit sabre_probe(struct of_device *op,
 	/*
 	 * Look for APB underneath.
 	 */
-	sabre_pbm_init(p, pbm, op);
+	sabre_pbm_init(pbm, op);
+
+	pbm->next = pci_pbm_root;
+	pci_pbm_root = pbm;
+
+	dev_set_drvdata(&op->dev, pbm);
+
 	return 0;
 
 out_free_iommu:
-	kfree(p->pbm_A.iommu);
+	kfree(pbm->iommu);
 
 out_free_controller:
-	kfree(p);
+	kfree(pbm);
 
 out_err:
 	return err;
arch/sparc64/kernel/pci_schizo.c +37 -47

180 lines not on this page · raw message

arch/sparc64/kernel/pci_sun4v.c +27 -39

125 lines not on this page · raw message

Signature · 1 line
1.5.6.5.GIT