aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-sysfs.c
diff options
context:
space:
mode:
authorIvan Kokshaysky <ink@jurassic.park.msu.ru>2009-02-17 05:46:53 -0500
committerJesse Barnes <jbarnes@hobbes.lan>2009-03-19 22:29:36 -0400
commit10a0ef39fbd1d484c2bbc1ffd83d57ecef209140 (patch)
tree2659f907c2039e0730d69fb8dac6e6f8e5b3cd34 /drivers/pci/pci-sysfs.c
parentea7415512a07add2b09c070c9a5d1950833cf9b3 (diff)
PCI/alpha: pci sysfs resources
This closes http://bugzilla.kernel.org/show_bug.cgi?id=10893 which is a showstopper for X development on alpha. The generic HAVE_PCI_MMAP code (drivers/pci-sysfs.c) is not very useful since we have to deal with three different types of MMIO address spaces: sparse and dense mappings for old ev4/ev5 machines and "normal" 1:1 MMIO space (bwx) for ev56 and later. Also "write combine" mappings are meaningless on alpha - roughly speaking, alpha does write combining, IO reordering and other optimizations by default, unless user splits IO accesses with memory barriers. I think the cleanest way to deal with resource files on alpha is to convert the default no-op pci_create_resource_files() and pci_remove_resource_files() for !HAVE_PCI_MMAP case into __weak functions and override them with alpha specific ones. Another alpha hook is needed for "legacy_" resource files to handle sparse addressing (pci_adjust_legacy_attr). With the "standard" resourceN files on ev56/ev6 libpciaccess works "out of the box". Handling of resourceN_sparse/resourceN_dense files on older machines obviously requires some userland work. Sparse/dense stuff has been tested on sx164 (pca56/pyxis, normally uses bwx IO) with the kernel hacked into "cia compatible" mode. Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pci-sysfs.c')
-rw-r--r--drivers/pci/pci-sysfs.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index dfc4e0ddf241..1c8929801400 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -493,6 +493,19 @@ pci_mmap_legacy_io(struct kobject *kobj, struct bin_attribute *attr,
493} 493}
494 494
495/** 495/**
496 * pci_adjust_legacy_attr - adjustment of legacy file attributes
497 * @b: bus to create files under
498 * @mmap_type: I/O port or memory
499 *
500 * Stub implementation. Can be overridden by arch if necessary.
501 */
502void __weak
503pci_adjust_legacy_attr(struct pci_bus *b, enum pci_mmap_state mmap_type)
504{
505 return;
506}
507
508/**
496 * pci_create_legacy_files - create legacy I/O port and memory files 509 * pci_create_legacy_files - create legacy I/O port and memory files
497 * @b: bus to create files under 510 * @b: bus to create files under
498 * 511 *
@@ -518,6 +531,7 @@ void pci_create_legacy_files(struct pci_bus *b)
518 b->legacy_io->read = pci_read_legacy_io; 531 b->legacy_io->read = pci_read_legacy_io;
519 b->legacy_io->write = pci_write_legacy_io; 532 b->legacy_io->write = pci_write_legacy_io;
520 b->legacy_io->mmap = pci_mmap_legacy_io; 533 b->legacy_io->mmap = pci_mmap_legacy_io;
534 pci_adjust_legacy_attr(b, pci_mmap_io);
521 error = device_create_bin_file(&b->dev, b->legacy_io); 535 error = device_create_bin_file(&b->dev, b->legacy_io);
522 if (error) 536 if (error)
523 goto legacy_io_err; 537 goto legacy_io_err;
@@ -528,6 +542,7 @@ void pci_create_legacy_files(struct pci_bus *b)
528 b->legacy_mem->size = 1024*1024; 542 b->legacy_mem->size = 1024*1024;
529 b->legacy_mem->attr.mode = S_IRUSR | S_IWUSR; 543 b->legacy_mem->attr.mode = S_IRUSR | S_IWUSR;
530 b->legacy_mem->mmap = pci_mmap_legacy_mem; 544 b->legacy_mem->mmap = pci_mmap_legacy_mem;
545 pci_adjust_legacy_attr(b, pci_mmap_mem);
531 error = device_create_bin_file(&b->dev, b->legacy_mem); 546 error = device_create_bin_file(&b->dev, b->legacy_mem);
532 if (error) 547 if (error)
533 goto legacy_mem_err; 548 goto legacy_mem_err;
@@ -719,8 +734,8 @@ static int pci_create_resource_files(struct pci_dev *pdev)
719 return 0; 734 return 0;
720} 735}
721#else /* !HAVE_PCI_MMAP */ 736#else /* !HAVE_PCI_MMAP */
722static inline int pci_create_resource_files(struct pci_dev *dev) { return 0; } 737int __weak pci_create_resource_files(struct pci_dev *dev) { return 0; }
723static inline void pci_remove_resource_files(struct pci_dev *dev) { return; } 738void __weak pci_remove_resource_files(struct pci_dev *dev) { return; }
724#endif /* HAVE_PCI_MMAP */ 739#endif /* HAVE_PCI_MMAP */
725 740
726/** 741/**