]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
powerpc/PCI: Override pcibios_window_alignment()
authorGavin Shan <shangw@linux.vnet.ibm.com>
Tue, 11 Sep 2012 22:59:46 +0000 (16:59 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 11 Sep 2012 22:59:46 +0000 (16:59 -0600)
This patch implements pcibios_window_alignment() so powerpc platforms can
force P2P bridge windows to be at larger alignments than the PCI spec
requires.

[bhelgaas: changelog]
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
arch/powerpc/include/asm/machdep.h
arch/powerpc/kernel/pci-common.c

index 42ce570812c1629afb75ed7a5a472d059570305c..f7706d722b39539c3559e0d858924c7703f529d9 100644 (file)
@@ -214,6 +214,9 @@ struct machdep_calls {
        /* Called after scan and before resource survey */
        void (*pcibios_fixup_phb)(struct pci_controller *hose);
 
+       /* Called during PCI resource reassignment */
+       resource_size_t (*pcibios_window_alignment)(struct pci_bus *, unsigned long type);
+
        /* Called to shutdown machine specific hardware not already controlled
         * by other drivers.
         */
index 2aa04f29e1de95d89f295c190bb56754ba84efd7..43fea543d68649d93e9eb734c89b13b3eb7c5a1b 100644 (file)
@@ -99,6 +99,26 @@ void pcibios_free_controller(struct pci_controller *phb)
                kfree(phb);
 }
 
+/*
+ * The function is used to return the minimal alignment
+ * for memory or I/O windows of the associated P2P bridge.
+ * By default, 4KiB alignment for I/O windows and 1MiB for
+ * memory windows.
+ */
+resource_size_t pcibios_window_alignment(struct pci_bus *bus,
+                                        unsigned long type)
+{
+       if (ppc_md.pcibios_window_alignment)
+               return ppc_md.pcibios_window_alignment(bus, type);
+
+       /*
+        * PCI core will figure out the default
+        * alignment: 4KiB for I/O and 1MiB for
+        * memory window.
+        */
+       return 1;
+}
+
 static resource_size_t pcibios_io_size(const struct pci_controller *hose)
 {
 #ifdef CONFIG_PPC64