Release 4.7 drivers/pnp/pnpbios/proc.c
/*
* /proc/bus/pnp interface for Plug and Play devices
*
* Written by David Hinds, dahinds@users.sourceforge.net
* Modified by Thomas Hood
*
* The .../devices and .../<node> and .../boot/<node> files are
* utilized by the lspnp and setpnp utilities, supplied with the
* pcmcia-cs package.
* http://pcmcia-cs.sourceforge.net
*
* The .../escd file is utilized by the lsescd utility written by
* Gunther Mayer.
*
* The .../legacy_device_resources file is not used yet.
*
* The other files are human-readable.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/pnp.h>
#include <linux/seq_file.h>
#include <linux/init.h>
#include <asm/uaccess.h>
#include "pnpbios.h"
static struct proc_dir_entry *proc_pnp = NULL;
static struct proc_dir_entry *proc_pnp_boot = NULL;
static int pnpconfig_proc_show(struct seq_file *m, void *v)
{
struct pnp_isa_config_struc pnps;
if (pnp_bios_isapnp_config(&pnps))
return -EIO;
seq_printf(m, "structure_revision %d\n"
"number_of_CSNs %d\n"
"ISA_read_data_port 0x%x\n",
pnps.revision, pnps.no_csns, pnps.isa_rd_data_port);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
dave jones | dave jones | 45 | 81.82% | 1 | 50.00% |
alexey dobriyan | alexey dobriyan | 10 | 18.18% | 1 | 50.00% |
| Total | 55 | 100.00% | 2 | 100.00% |
static int pnpconfig_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, pnpconfig_proc_show, NULL);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alexey dobriyan | alexey dobriyan | 20 | 76.92% | 1 | 50.00% |
dave jones | dave jones | 6 | 23.08% | 1 | 50.00% |
| Total | 26 | 100.00% | 2 | 100.00% |
static const struct file_operations pnpconfig_proc_fops = {
.owner = THIS_MODULE,
.open = pnpconfig_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int escd_info_proc_show(struct seq_file *m, void *v)
{
struct escd_info_struc escd;
if (pnp_bios_escd_info(&escd))
return -EIO;
seq_printf(m, "min_ESCD_write_size %d\n"
"ESCD_size %d\n"
"NVRAM_base 0x%x\n",
escd.min_escd_write_size,
escd.escd_size, escd.nv_storage_base);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
dave jones | dave jones | 41 | 74.55% | 1 | 50.00% |
alexey dobriyan | alexey dobriyan | 14 | 25.45% | 1 | 50.00% |
| Total | 55 | 100.00% | 2 | 100.00% |
static int escd_info_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, escd_info_proc_show, NULL);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alexey dobriyan | alexey dobriyan | 24 | 92.31% | 1 | 50.00% |
dave jones | dave jones | 2 | 7.69% | 1 | 50.00% |
| Total | 26 | 100.00% | 2 | 100.00% |
static const struct file_operations escd_info_proc_fops = {
.owner = THIS_MODULE,
.open = escd_info_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#define MAX_SANE_ESCD_SIZE (32*1024)
static int escd_proc_show(struct seq_file *m, void *v)
{
struct escd_info_struc escd;
char *tmpbuf;
int escd_size;
if (pnp_bios_escd_info(&escd))
return -EIO;
/* sanity check */
if (escd.escd_size > MAX_SANE_ESCD_SIZE) {
printk(KERN_ERR
"PnPBIOS: %s: ESCD size reported by BIOS escd_info call is too great\n", __func__);
return -EFBIG;
}
tmpbuf = kzalloc(escd.escd_size, GFP_KERNEL);
if (!tmpbuf)
return -ENOMEM;
if (pnp_bios_read_escd(tmpbuf, escd.nv_storage_base)) {
kfree(tmpbuf);
return -EIO;
}
escd_size =
(unsigned char)(tmpbuf[0]) + (unsigned char)(tmpbuf[1]) * 256;
/* sanity check */
if (escd_size > MAX_SANE_ESCD_SIZE) {
printk(KERN_ERR "PnPBIOS: %s: ESCD size reported by"
" BIOS read_escd call is too great\n", __func__);
kfree(tmpbuf);
return -EFBIG;
}
seq_write(m, tmpbuf, escd_size);
kfree(tmpbuf);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
dave jones | dave jones | 130 | 75.14% | 2 | 33.33% |
thomas hood | thomas hood | 21 | 12.14% | 1 | 16.67% |
alexey dobriyan | alexey dobriyan | 15 | 8.67% | 1 | 16.67% |
jesper juhl | jesper juhl | 6 | 3.47% | 1 | 16.67% |
robert p. j. day | robert p. j. day | 1 | 0.58% | 1 | 16.67% |
| Total | 173 | 100.00% | 6 | 100.00% |
static int escd_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, escd_proc_show, NULL);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alexey dobriyan | alexey dobriyan | 20 | 76.92% | 1 | 50.00% |
dave jones | dave jones | 6 | 23.08% | 1 | 50.00% |
| Total | 26 | 100.00% | 2 | 100.00% |
static const struct file_operations escd_proc_fops = {
.owner = THIS_MODULE,
.open = escd_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int pnp_legacyres_proc_show(struct seq_file *m, void *v)
{
void *buf;
buf = kmalloc(65536, GFP_KERNEL);
if (!buf)
return -ENOMEM;
if (pnp_bios_get_stat_res(buf)) {
kfree(buf);
return -EIO;
}
seq_write(m, buf, 65536);
kfree(buf);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alexey dobriyan | alexey dobriyan | 51 | 70.83% | 1 | 50.00% |
dave jones | dave jones | 21 | 29.17% | 1 | 50.00% |
| Total | 72 | 100.00% | 2 | 100.00% |
static int pnp_legacyres_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, pnp_legacyres_proc_show, NULL);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alexey dobriyan | alexey dobriyan | 20 | 76.92% | 1 | 50.00% |
linus torvalds | linus torvalds | 6 | 23.08% | 1 | 50.00% |
| Total | 26 | 100.00% | 2 | 100.00% |
static const struct file_operations pnp_legacyres_proc_fops = {
.owner = THIS_MODULE,
.open = pnp_legacyres_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int pnp_devices_proc_show(struct seq_file *m, void *v)
{
struct pnp_bios_node *node;
u8 nodenum;
node = kzalloc(node_info.max_node_size, GFP_KERNEL);
if (!node)
return -ENOMEM;
for (nodenum = 0; nodenum < 0xff;) {
u8 thisnodenum = nodenum;
if (pnp_bios_get_dev_node(&nodenum, PNPMODE_DYNAMIC, node))
break;
seq_printf(m, "%02x\t%08x\t%3phC\t%04x\n",
node->handle, node->eisa_id,
node->type_code, node->flags);
if (nodenum <= thisnodenum) {
printk(KERN_ERR
"%s Node number 0x%x is out of sequence following node 0x%x. Aborting.\n",
"PnPBIOS: proc_read_devices:",
(unsigned int)nodenum,
(unsigned int)thisnodenum);
break;
}
}
kfree(node);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 84 | 62.69% | 1 | 16.67% |
dave jones | dave jones | 36 | 26.87% | 1 | 16.67% |
alexey dobriyan | alexey dobriyan | 11 | 8.21% | 1 | 16.67% |
adam belay | adam belay | 1 | 0.75% | 1 | 16.67% |
robert p. j. day | robert p. j. day | 1 | 0.75% | 1 | 16.67% |
andy shevchenko | andy shevchenko | 1 | 0.75% | 1 | 16.67% |
| Total | 134 | 100.00% | 6 | 100.00% |
static int pnp_devices_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, pnp_devices_proc_show, NULL);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alexey dobriyan | alexey dobriyan | 20 | 76.92% | 1 | 50.00% |
linus torvalds | linus torvalds | 6 | 23.08% | 1 | 50.00% |
| Total | 26 | 100.00% | 2 | 100.00% |
static const struct file_operations pnp_devices_proc_fops = {
.owner = THIS_MODULE,
.open = pnp_devices_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int pnpbios_proc_show(struct seq_file *m, void *v)
{
void *data = m->private;
struct pnp_bios_node *node;
int boot = (long)data >> 8;
u8 nodenum = (long)data;
int len;
node = kzalloc(node_info.max_node_size, GFP_KERNEL);
if (!node)
return -ENOMEM;
if (pnp_bios_get_dev_node(&nodenum, boot, node)) {
kfree(node);
return -EIO;
}
len = node->size - sizeof(struct pnp_bios_node);
seq_write(m, node->data, len);
kfree(node);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 97 | 78.86% | 1 | 25.00% |
alexey dobriyan | alexey dobriyan | 18 | 14.63% | 1 | 25.00% |
dave jones | dave jones | 7 | 5.69% | 1 | 25.00% |
robert p. j. day | robert p. j. day | 1 | 0.81% | 1 | 25.00% |
| Total | 123 | 100.00% | 4 | 100.00% |
static int pnpbios_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, pnpbios_proc_show, PDE_DATA(inode));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alexey dobriyan | alexey dobriyan | 26 | 89.66% | 1 | 33.33% |
linus torvalds | linus torvalds | 2 | 6.90% | 1 | 33.33% |
al viro | al viro | 1 | 3.45% | 1 | 33.33% |
| Total | 29 | 100.00% | 3 | 100.00% |
static ssize_t pnpbios_proc_write(struct file *file, const char __user *buf,
size_t count, loff_t *pos)
{
void *data = PDE_DATA(file_inode(file));
struct pnp_bios_node *node;
int boot = (long)data >> 8;
u8 nodenum = (long)data;
int ret = count;
node = kzalloc(node_info.max_node_size, GFP_KERNEL);
if (!node)
return -ENOMEM;
if (pnp_bios_get_dev_node(&nodenum, boot, node)) {
ret = -EIO;
goto out;
}
if (count != node->size - sizeof(struct pnp_bios_node)) {
ret = -EINVAL;
goto out;
}
if (copy_from_user(node->data, buf, count)) {
ret = -EFAULT;
goto out;
}
if (pnp_bios_set_dev_node(node->handle, boot, node) != 0) {
ret = -EINVAL;
goto out;
}
ret = count;
out:
kfree(node);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 123 | 64.06% | 1 | 14.29% |
andrew morton | andrew morton | 49 | 25.52% | 1 | 14.29% |
alexey dobriyan | alexey dobriyan | 14 | 7.29% | 1 | 14.29% |
al viro | al viro | 5 | 2.60% | 3 | 42.86% |
robert p. j. day | robert p. j. day | 1 | 0.52% | 1 | 14.29% |
| Total | 192 | 100.00% | 7 | 100.00% |
static const struct file_operations pnpbios_proc_fops = {
.owner = THIS_MODULE,
.open = pnpbios_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.write = pnpbios_proc_write,
};
int pnpbios_interface_attach_device(struct pnp_bios_node *node)
{
char name[3];
sprintf(name, "%02x", node->handle);
if (!proc_pnp)
return -EIO;
if (!pnpbios_dont_use_current_config) {
proc_create_data(name, 0644, proc_pnp, &pnpbios_proc_fops,
(void *)(long)(node->handle));
}
if (!proc_pnp_boot)
return -EIO;
if (proc_create_data(name, 0644, proc_pnp_boot, &pnpbios_proc_fops,
(void *)(long)(node->handle + 0x100)))
return 0;
return -EIO;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 67 | 59.29% | 1 | 20.00% |
adam belay | adam belay | 28 | 24.78% | 2 | 40.00% |
alexey dobriyan | alexey dobriyan | 17 | 15.04% | 1 | 20.00% |
dave jones | dave jones | 1 | 0.88% | 1 | 20.00% |
| Total | 113 | 100.00% | 5 | 100.00% |
/*
* When this is called, pnpbios functions are assumed to
* work and the pnpbios_dont_use_current_config flag
* should already have been set to the appropriate value
*/
int __init pnpbios_proc_init(void)
{
proc_pnp = proc_mkdir("bus/pnp", NULL);
if (!proc_pnp)
return -EIO;
proc_pnp_boot = proc_mkdir("boot", proc_pnp);
if (!proc_pnp_boot)
return -EIO;
proc_create("devices", 0, proc_pnp, &pnp_devices_proc_fops);
proc_create("configuration_info", 0, proc_pnp, &pnpconfig_proc_fops);
proc_create("escd_info", 0, proc_pnp, &escd_info_proc_fops);
proc_create("escd", S_IRUSR, proc_pnp, &escd_proc_fops);
proc_create("legacy_device_resources", 0, proc_pnp, &pnp_legacyres_proc_fops);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
adam belay | adam belay | 74 | 69.16% | 1 | 20.00% |
alexey dobriyan | alexey dobriyan | 17 | 15.89% | 2 | 40.00% |
dave jones | dave jones | 12 | 11.21% | 1 | 20.00% |
linus torvalds | linus torvalds | 4 | 3.74% | 1 | 20.00% |
| Total | 107 | 100.00% | 5 | 100.00% |
void __exit pnpbios_proc_exit(void)
{
int i;
char name[3];
if (!proc_pnp)
return;
for (i = 0; i < 0xff; i++) {
sprintf(name, "%02x", i);
if (!pnpbios_dont_use_current_config)
remove_proc_entry(name, proc_pnp);
remove_proc_entry(name, proc_pnp_boot);
}
remove_proc_entry("legacy_device_resources", proc_pnp);
remove_proc_entry("escd", proc_pnp);
remove_proc_entry("escd_info", proc_pnp);
remove_proc_entry("configuration_info", proc_pnp);
remove_proc_entry("devices", proc_pnp);
remove_proc_entry("boot", proc_pnp);
remove_proc_entry("bus/pnp", NULL);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 82 | 71.30% | 1 | 33.33% |
dave jones | dave jones | 31 | 26.96% | 1 | 33.33% |
alexey dobriyan | alexey dobriyan | 2 | 1.74% | 1 | 33.33% |
| Total | 115 | 100.00% | 3 | 100.00% |
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alexey dobriyan | alexey dobriyan | 505 | 32.52% | 2 | 10.53% |
linus torvalds | linus torvalds | 504 | 32.45% | 1 | 5.26% |
dave jones | dave jones | 338 | 21.76% | 2 | 10.53% |
adam belay | adam belay | 107 | 6.89% | 3 | 15.79% |
andrew morton | andrew morton | 52 | 3.35% | 1 | 5.26% |
thomas hood | thomas hood | 25 | 1.61% | 1 | 5.26% |
jesper juhl | jesper juhl | 6 | 0.39% | 1 | 5.26% |
al viro | al viro | 6 | 0.39% | 3 | 15.79% |
robert p. j. day | robert p. j. day | 4 | 0.26% | 1 | 5.26% |
martin dalecki | martin dalecki | 3 | 0.19% | 1 | 5.26% |
bjorn helgaas | bjorn helgaas | 1 | 0.06% | 1 | 5.26% |
andy shevchenko | andy shevchenko | 1 | 0.06% | 1 | 5.26% |
justin mattock | justin mattock | 1 | 0.06% | 1 | 5.26% |
| Total | 1553 | 100.00% | 19 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.