Skip to contentSkip to conversation

powerpc: Add legacy PCI access via sysfs

PATCH Applied Benjamin Herrenschmidt 3 participants 8 messages Oct 10, 2008 – Oct 14, 2008 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Add legacy PCI access via sysfs

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

---

This is version 2, slightly different approach for getting at VGA memory which works a lot better with bridges providing a separate ISA Memory hole (which is the case of most of them).

Also tested on a variety of hardware with a little tool using x86emu to run VGA BIOSes, do VBE calls and whack text mode.

This patch relies on its generic counterpart, posted previously being applied first.

Jesse, due to the dependency, it's better if we have both in the powerpc tree -or- both in the PCI tree, what do you think is best ? Either that or I have to delay applying it to powerpc until you get the generic part in.

 arch/powerpc/include/asm/pci.h   |   11 +++
 arch/powerpc/kernel/pci-common.c |  140 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 149 insertions(+), 2 deletions(-)
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 +138 -2

158 lines not on this page · raw message

#1 lore raw
Quoted 13 lines · Benjamin Herrenschmidt

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

---

This is version 2, slightly different approach for getting at VGA memory which works a lot better with bridges providing a separate ISA Memory hole (which is the case of most of them).

Also tested on a variety of hardware with a little tool using x86emu to run VGA BIOSes, do VBE calls and whack text mode.

Quoted 7 lines

This patch relies on its generic counterpart, posted previously being applied first.

Jesse, due to the dependency, it's better if we have both in the powerpc tree -or- both in the PCI tree, what do you think is best ? Either that or I have to delay applying it to powerpc until you get the generic part in.

Ah I was worried the first one might need a respin, but it applied fine, so I'll go ahead and apply this one too.

Thanks,
Jesse

#2 lore raw
Quoted 3 lines · Jesse Barnes

Ah I was worried the first one might need a respin, but it applied fine, so
I'll go ahead and apply this one too.

Let's hope it doesn't collide with the pending powerpc.git merge...

Ben.

#4 lore raw
Quoted 8 lines · Jesse Barnes
Quoted 5 lines · Benjamin Herrenschmidt

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

---

Applied to linux-next, thanks.

Is that targeted towards .28 or .29? Ben has a 4xx specific patch that depends on this one, and I just need to know which version to bring that in for.

thx,
josh

#5 lore raw
Quoted 5 lines · Josh Boyer
Quoted 4 lines · Jesse Barnes
Quoted 3 lines · Benjamin Herrenschmidt

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

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

---

Applied to linux-next, thanks.

Is that targeted towards .28 or .29? Ben has a 4xx specific patch that depends on this one, and I just need to know which version to bring that in for.

I was planning on sending it for .28.

Jesse

#6 lore raw
Quoted 6 lines
Quoted 4 lines

Is that targeted towards .28 or .29? Ben has a 4xx specific patch that depends on this one, and I just need to know which version to bring that in for.

I was planning on sending it for .28.

There's a minor bogon in the powerpc side patch, ie, I left an unused variable from an old version of the patch. No big deal, but if you haven't merged yet, let me know and I'll do a new spin. If you have already, I'll do a fixup later on via the powerpc.git tree.

BTW. When do you intend to send that to Linus ?

Cheers,
Ben.

#7 lore raw
In reply to Benjamin Herrenschmidt
Quoted 9 lines · Benjamin Herrenschmidt

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

---

This is version 2, slightly different approach for getting at VGA memory which works a lot better with bridges providing a separate ISA Memory hole (which is the case of most of them).

Drop it Jesse. It's missing-quilt-ref busticated. One of these days I'll figure a scripted way to avoid that problem.

New one on the way.

Cheers,
Ben.