diff options
author | Jesse Barnes <jbarnes@engr.sgi.com> | 2004-12-20 20:12:05 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <greg@kroah.com> | 2004-12-20 20:12:05 -0800 |
commit | 42298be0eeb5ae98453b3374c36161b05a46c5dc (patch) | |
tree | 4a8202912d5e0401373fa76939471446ff96e953 /Documentation | |
parent | 7c33c92a335ba6cf3378ccafc7f24bea62897a7e (diff) | |
download | history-42298be0eeb5ae98453b3374c36161b05a46c5dc.tar.gz |
[PATCH] PCI: export PCI resources in sysfs
This patch exports PCI resources to userspace in the corresponding sysfs
device directory. It depends on the platform HAVE_PCI_MMAP code, and is
#ifdef'd accordingly. I've also added documentation describing the sysfs PCI
device file layout.
Signed-off-by: Jesse Barnes <jbarnes@sgi.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/filesystems/sysfs-pci.txt | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/Documentation/filesystems/sysfs-pci.txt b/Documentation/filesystems/sysfs-pci.txt new file mode 100644 index 00000000000000..4cabfed6a77d33 --- /dev/null +++ b/Documentation/filesystems/sysfs-pci.txt @@ -0,0 +1,64 @@ +Accessing PCI device resources through sysfs + +sysfs, usually mounted at /sys, provides access to PCI resources on platforms +that support it. For example, a given bus might look like this: + + pci0000:17 + |-- 0000:17:00.0 + | |-- class + | |-- config + | |-- detach_state + | |-- device + | |-- irq + | |-- local_cpus + | |-- resource + | |-- resource0 + | |-- resource1 + | |-- resource2 + | |-- rom + | |-- subsystem_device + | |-- subsystem_vendor + | `-- vendor + `-- detach_state + +The topmost element describes the PCI domain and bus number. In this case, +the domain number is 0000 and the bus number is 17 (both values are in hex). +This bus contains a single function device in slot 0. The domain and bus +numbers are reproduced for convenience. Under the device directory are several +files, each with their own function. + + file function + ---- -------- + class PCI class (ascii, ro) + config PCI config space (binary, rw) + detach_state connection status (bool, rw) + device PCI device (ascii, ro) + irq IRQ number (ascii, ro) + local_cpus nearby CPU mask (cpumask, ro) + resource PCI resource host addresses (ascii, ro) + resource0..N PCI resource N, if present (binary, mmap) + rom PCI ROM resource, if present (binary, ro) + subsystem_device PCI subsystem device (ascii, ro) + subsystem_vendor PCI subsystem vendor (ascii, ro) + vendor PCI vendor (ascii, ro) + + ro - read only file + rw - file is readable and writable + mmap - file is mmapable + ascii - file contains ascii text + binary - file contains binary data + cpumask - file contains a cpumask type + +The read only files are informational, writes to them will be ignored. +Writable files can be used to perform actions on the device (e.g. changing +config space, detaching a device). mmapable files are available via an +mmap of the file at offset 0 and can be used to do actual device programming +from userspace. Note that some platforms don't support mmapping of certain +resources, so be sure to check the return value from any attempted mmap. + +Supporting PCI access on new platforms + +In order to support PCI resource mapping as described above, Linux platform +code must define HAVE_PCI_MMAP and provide a pci_mmap_page_range function. +Platforms are free to only support subsets of the mmap functionality, but +useful return codes should be provided. |