aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/probe.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-10-03 05:49:32 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-10-20 14:01:46 -0400
commitf19aeb1f3638b7bb4ca21eb361f004fac2bfe259 (patch)
tree2990881affb22ba426149e8d4c317fe9df9992c7 /drivers/pci/probe.c
parentf393d9b130423a7a47c751b26df07ceaa5dc76a9 (diff)
PCI: Add ability to mmap legacy_io on some platforms
This adds the ability to mmap legacy IO space to the legacy_io files in sysfs on platforms that support it. This will allow to clean up X to use this instead of /dev/mem for legacy IO accesses such as those performed by Int10. While at it I moved pci_create/remove_legacy_files() to pci-sysfs.c where I think they belong, thus making more things statis in there and cleaned up some spurrious prototypes in the ia64 pci.h file Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r--drivers/pci/probe.c66
1 files changed, 0 insertions, 66 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index afb9f1c0bc28..aaaf0a1fed22 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -42,72 +42,6 @@ int no_pci_devices(void)
42} 42}
43EXPORT_SYMBOL(no_pci_devices); 43EXPORT_SYMBOL(no_pci_devices);
44 44
45#ifdef HAVE_PCI_LEGACY
46/**
47 * pci_create_legacy_files - create legacy I/O port and memory files
48 * @b: bus to create files under
49 *
50 * Some platforms allow access to legacy I/O port and ISA memory space on
51 * a per-bus basis. This routine creates the files and ties them into
52 * their associated read, write and mmap files from pci-sysfs.c
53 *
54 * On error unwind, but don't propogate the error to the caller
55 * as it is ok to set up the PCI bus without these files.
56 */
57static void pci_create_legacy_files(struct pci_bus *b)
58{
59 int error;
60
61 b->legacy_io = kzalloc(sizeof(struct bin_attribute) * 2,
62 GFP_ATOMIC);
63 if (!b->legacy_io)
64 goto kzalloc_err;
65
66 b->legacy_io->attr.name = "legacy_io";
67 b->legacy_io->size = 0xffff;
68 b->legacy_io->attr.mode = S_IRUSR | S_IWUSR;
69 b->legacy_io->read = pci_read_legacy_io;
70 b->legacy_io->write = pci_write_legacy_io;
71 error = device_create_bin_file(&b->dev, b->legacy_io);
72 if (error)
73 goto legacy_io_err;
74
75 /* Allocated above after the legacy_io struct */
76 b->legacy_mem = b->legacy_io + 1;
77 b->legacy_mem->attr.name = "legacy_mem";
78 b->legacy_mem->size = 1024*1024;
79 b->legacy_mem->attr.mode = S_IRUSR | S_IWUSR;
80 b->legacy_mem->mmap = pci_mmap_legacy_mem;
81 error = device_create_bin_file(&b->dev, b->legacy_mem);
82 if (error)
83 goto legacy_mem_err;
84
85 return;
86
87legacy_mem_err:
88 device_remove_bin_file(&b->dev, b->legacy_io);
89legacy_io_err:
90 kfree(b->legacy_io);
91 b->legacy_io = NULL;
92kzalloc_err:
93 printk(KERN_WARNING "pci: warning: could not create legacy I/O port "
94 "and ISA memory resources to sysfs\n");
95 return;
96}
97
98void pci_remove_legacy_files(struct pci_bus *b)
99{
100 if (b->legacy_io) {
101 device_remove_bin_file(&b->dev, b->legacy_io);
102 device_remove_bin_file(&b->dev, b->legacy_mem);
103 kfree(b->legacy_io); /* both are allocated here */
104 }
105}
106#else /* !HAVE_PCI_LEGACY */
107static inline void pci_create_legacy_files(struct pci_bus *bus) { return; }
108void pci_remove_legacy_files(struct pci_bus *bus) { return; }
109#endif /* HAVE_PCI_LEGACY */
110
111/* 45/*
112 * PCI Bus Class Devices 46 * PCI Bus Class Devices
113 */ 47 */