From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

The g5 iommu code would fill the "iommu_table" member of whatever device
node was pointed to by pcidev->sysdata during boot.  However, the ppc64
kernel fills that with a pointer to the PHB node which is later replaced
"lazily" with a pointer to the real node when calling
pci_device_to_OF_node().  In this case, we were thus "losing" the
iommu_table pointer.  Typical symptom: loss of the SATA when looking at
it's /proc entry.

This fixes it by forcing the update to the final sysdata pointer when
filling up the iommu_table pointers.  The "lazy" thing is useless on pmac
anyway.


---

 25-akpm/arch/ppc64/kernel/pmac_iommu.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff -puN arch/ppc64/kernel/pmac_iommu.c~ppc64-g5-iommu-fix arch/ppc64/kernel/pmac_iommu.c
--- 25/arch/ppc64/kernel/pmac_iommu.c~ppc64-g5-iommu-fix	2004-03-15 23:20:22.888217856 -0800
+++ 25-akpm/arch/ppc64/kernel/pmac_iommu.c	2004-03-15 23:20:22.891217400 -0800
@@ -289,8 +289,11 @@ void iommu_setup_pmac(void)
 	 * things simple. Setup all PCI devices to point to this table
 	 */
 	while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
-		dn = PCI_GET_DN(dev);
-
+		/* We must use pci_device_to_OF_node() to make sure that
+		 * we get the real "final" pointer to the device in the
+		 * pci_dev sysdata and not the temporary PHB one
+		 */
+		struct device_node *dn = pci_device_to_OF_node(dev);
 		if (dn)
 			dn->iommu_table = &iommu_table_pmac;
 	}

_