Skip to contentSkip to conversation

powerpc: Add legacy PCI access via sysfs (v3)

PATCH In review Benjamin Herrenschmidt 2 participants 3 messages Oct 14, 2008 – Oct 15, 2008 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Add legacy PCI access via sysfs (v3)

This patch adds support for legacy_io and legacy_mem files in bus class directories in sysfs for powerpc

---

This is version 3, this time after doing a "quilt ref" and thus getting a patch that actually useful. Sorry about the mishap.

 arch/powerpc/include/asm/pci-bridge.h |    7 +
 arch/powerpc/include/asm/pci.h        |   11 ++
 arch/powerpc/kernel/pci-common.c      |  136 +++++++++++++++++++++++++++++++++-
 3 files changed, 153 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/pci.h +11 -0
@@ -123,6 +123,16 @@ int pci_mmap_page_range(struct pci_dev *
 /* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */
 #define HAVE_PCI_MMAP	1
 
+extern int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val,
+			   size_t count);
+extern int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val,
+			   size_t count);
+extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
+				      struct vm_area_struct *vma,
+				      enum pci_mmap_state mmap_state);
+
+#define HAVE_PCI_LEGACY	1
+
 #if defined(CONFIG_PPC64) || defined(CONFIG_NOT_COHERENT_CACHE)
 /*
  * For 64-bit kernels, pci_unmap_{single,page} is not a nop.
@@ -226,5 +236,6 @@ extern void pci_resource_to_user(const s
 extern void pcibios_do_bus_setup(struct pci_bus *bus);
 extern void pcibios_fixup_of_probed_bus(struct pci_bus *bus);
 
+
 #endif	/* __KERNEL__ */
 #endif /* __ASM_POWERPC_PCI_H */
arch/powerpc/kernel/pci-common.c +135 -1

160 lines not on this page · raw message

arch/powerpc/include/asm/pci-bridge.h +7 -0
Index: linux-work/arch/powerpc/include/asm/pci-bridge.h
===================================================================
@@ -74,6 +74,13 @@ struct pci_controller {
 	unsigned long pci_io_size;
 #endif
 
+	/* Some machines have a special region to forward the ISA
+	 * "memory" cycles such as VGA memory regions. Left to 0
+	 * if unsupported
+	 */
+	resource_size_t	isa_mem_phys;
+	resource_size_t	isa_mem_size;
+
 	struct pci_ops *ops;
 	unsigned int __iomem *cfg_addr;
 	void __iomem *cfg_data;