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>
This commit is contained in:
committed by
Jesse Barnes
parent
f393d9b130
commit
f19aeb1f36
@@ -95,16 +95,8 @@ extern int pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma,
|
||||
enum pci_mmap_state mmap_state, int write_combine);
|
||||
#define HAVE_PCI_LEGACY
|
||||
extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
|
||||
struct vm_area_struct *vma);
|
||||
extern ssize_t pci_read_legacy_io(struct kobject *kobj,
|
||||
struct bin_attribute *bin_attr,
|
||||
char *buf, loff_t off, size_t count);
|
||||
extern ssize_t pci_write_legacy_io(struct kobject *kobj,
|
||||
struct bin_attribute *bin_attr,
|
||||
char *buf, loff_t off, size_t count);
|
||||
extern int pci_mmap_legacy_mem(struct kobject *kobj,
|
||||
struct bin_attribute *attr,
|
||||
struct vm_area_struct *vma);
|
||||
struct vm_area_struct *vma,
|
||||
enum pci_mmap_state mmap_state);
|
||||
|
||||
#define pci_get_legacy_mem platform_pci_get_legacy_mem
|
||||
#define pci_legacy_read platform_pci_legacy_read
|
||||
|
@@ -614,12 +614,17 @@ char *ia64_pci_get_legacy_mem(struct pci_bus *bus)
|
||||
* vector to get the base address.
|
||||
*/
|
||||
int
|
||||
pci_mmap_legacy_page_range(struct pci_bus *bus, struct vm_area_struct *vma)
|
||||
pci_mmap_legacy_page_range(struct pci_bus *bus, struct vm_area_struct *vma,
|
||||
enum pci_mmap_state mmap_state)
|
||||
{
|
||||
unsigned long size = vma->vm_end - vma->vm_start;
|
||||
pgprot_t prot;
|
||||
char *addr;
|
||||
|
||||
/* We only support mmap'ing of legacy memory space */
|
||||
if (mmap_state != pci_mmap_mem)
|
||||
return -ENOSYS;
|
||||
|
||||
/*
|
||||
* Avoid attribute aliasing. See Documentation/ia64/aliasing.txt
|
||||
* for more details.
|
||||
|
Reference in New Issue
Block a user