Commit 9645e7b1 authored by Adam Belay's avatar Adam Belay

PnPBIOS Update

- Prevents calling the node_info call more than necessary in order to take
load off the pnpbios
- intregrates the proc registration code with the device scanning code
- adds human readable error messages instead of number codes
- other small cleanups
parent 1332f65e
This diff is collapsed.
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
static struct proc_dir_entry *proc_pnp = NULL; static struct proc_dir_entry *proc_pnp = NULL;
static struct proc_dir_entry *proc_pnp_boot = NULL; static struct proc_dir_entry *proc_pnp_boot = NULL;
static struct pnp_dev_node_info node_info;
static int proc_read_pnpconfig(char *buf, char **start, off_t pos, static int proc_read_pnpconfig(char *buf, char **start, off_t pos,
int count, int *eof, void *data) int count, int *eof, void *data)
...@@ -136,7 +135,7 @@ static int proc_read_devices(char *buf, char **start, off_t pos, ...@@ -136,7 +135,7 @@ static int proc_read_devices(char *buf, char **start, off_t pos,
/* 26 = the number of characters per line sprintf'ed */ /* 26 = the number of characters per line sprintf'ed */
if ((p - buf + 26) > count) if ((p - buf + 26) > count)
break; break;
if (pnp_bios_get_dev_node(&nodenum, 1, node)) if (pnp_bios_get_dev_node(&nodenum, PNPMODE_STATIC, node))
break; break;
p += sprintf(p, "%02x\t%08x\t%02x:%02x:%02x\t%04x\n", p += sprintf(p, "%02x\t%08x\t%02x:%02x:%02x\t%04x\n",
node->handle, node->eisa_id, node->handle, node->eisa_id,
...@@ -193,41 +192,11 @@ static int proc_write_node(struct file *file, const char *buf, ...@@ -193,41 +192,11 @@ static int proc_write_node(struct file *file, const char *buf,
return count; return count;
} }
/* int pnpbios_interface_attach_device(struct pnp_bios_node * node)
* 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 )
{ {
struct pnp_bios_node *node;
struct proc_dir_entry *ent;
char name[3]; char name[3];
u8 nodenum; struct proc_dir_entry *ent;
if (pnp_bios_dev_node_info(&node_info))
return -EIO;
proc_pnp = proc_mkdir("pnp", proc_bus);
if (!proc_pnp)
return -EIO;
proc_pnp_boot = proc_mkdir("boot", proc_pnp);
if (!proc_pnp_boot)
return -EIO;
create_proc_read_entry("devices", 0, proc_pnp, proc_read_devices, NULL);
create_proc_read_entry("configuration_info", 0, proc_pnp, proc_read_pnpconfig, NULL);
create_proc_read_entry("escd_info", 0, proc_pnp, proc_read_escdinfo, NULL);
create_proc_read_entry("escd", S_IRUSR, proc_pnp, proc_read_escd, NULL);
create_proc_read_entry("legacy_device_resources", 0, proc_pnp, proc_read_legacyres, NULL);
node = pnpbios_kmalloc(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, 1, node) != 0)
break;
sprintf(name, "%02x", node->handle); sprintf(name, "%02x", node->handle);
if ( !pnpbios_dont_use_current_config ) { if ( !pnpbios_dont_use_current_config ) {
ent = create_proc_entry(name, 0, proc_pnp); ent = create_proc_entry(name, 0, proc_pnp);
...@@ -242,13 +211,29 @@ int __init pnpbios_proc_init( void ) ...@@ -242,13 +211,29 @@ int __init pnpbios_proc_init( void )
ent->read_proc = proc_read_node; ent->read_proc = proc_read_node;
ent->write_proc = proc_write_node; ent->write_proc = proc_write_node;
ent->data = (void *)(long)(node->handle+0x100); ent->data = (void *)(long)(node->handle+0x100);
return 0;
} }
if (nodenum <= thisnodenum) { return -EIO;
printk(KERN_ERR "%s Node number 0x%x is out of sequence following node 0x%x. Aborting.\n", "PnPBIOS: proc_init:", (unsigned int)nodenum, (unsigned int)thisnodenum); }
break;
} /*
} * When this is called, pnpbios functions are assumed to
kfree(node); * 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("pnp", proc_bus);
if (!proc_pnp)
return -EIO;
proc_pnp_boot = proc_mkdir("boot", proc_pnp);
if (!proc_pnp_boot)
return -EIO;
create_proc_read_entry("devices", 0, proc_pnp, proc_read_devices, NULL);
create_proc_read_entry("configuration_info", 0, proc_pnp, proc_read_pnpconfig, NULL);
create_proc_read_entry("escd_info", 0, proc_pnp, proc_read_escdinfo, NULL);
create_proc_read_entry("escd", S_IRUSR, proc_pnp, proc_read_escd, NULL);
create_proc_read_entry("legacy_device_resources", 0, proc_pnp, proc_read_legacyres, NULL);
return 0; return 0;
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <linux/pci.h> #include <linux/pci.h>
/* /*
* Status codes (warnings and errors) * Return codes
*/ */
#define PNP_SUCCESS 0x00 #define PNP_SUCCESS 0x00
#define PNP_NOT_SET_STATICALLY 0x7f #define PNP_NOT_SET_STATICALLY 0x7f
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
#define PNPMSG_POWER_OFF 0x41 #define PNPMSG_POWER_OFF 0x41
#define PNPMSG_PNP_OS_ACTIVE 0x42 #define PNPMSG_PNP_OS_ACTIVE 0x42
#define PNPMSG_PNP_OS_INACTIVE 0x43 #define PNPMSG_PNP_OS_INACTIVE 0x43
/* /*
* Plug and Play BIOS flags * Plug and Play BIOS flags
*/ */
...@@ -88,6 +89,12 @@ ...@@ -88,6 +89,12 @@
#define pnpbios_is_static(x) (((x)->flags & 0x0100) == 0x0000) #define pnpbios_is_static(x) (((x)->flags & 0x0100) == 0x0000)
#define pnpbios_is_dynamic(x) ((x)->flags & 0x0080) #define pnpbios_is_dynamic(x) ((x)->flags & 0x0080)
/*
* Function Parameters
*/
#define PNPMODE_STATIC 1
#define PNPMODE_DYNAMIC 0
/* 0x8000 through 0xffff are OEM defined */ /* 0x8000 through 0xffff are OEM defined */
#pragma pack(1) #pragma pack(1)
...@@ -125,8 +132,10 @@ struct pnp_bios_node { ...@@ -125,8 +132,10 @@ struct pnp_bios_node {
/* non-exported */ /* non-exported */
extern int pnpbios_dont_use_current_config; extern int pnpbios_dont_use_current_config;
extern struct pnp_dev_node_info node_info;
extern void *pnpbios_kmalloc(size_t size, int f); extern void *pnpbios_kmalloc(size_t size, int f);
extern int pnpbios_init (void); extern int pnpbios_init (void);
extern int pnpbios_interface_attach_device(struct pnp_bios_node * node);
extern int pnpbios_proc_init (void); extern int pnpbios_proc_init (void);
extern void pnpbios_proc_exit (void); extern void pnpbios_proc_exit (void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment