Commit 8090fa24 authored by David S. Miller's avatar David S. Miller

Merge davem@nuts.ninka.net:/disk1/davem/BK/net-2.5

into kernel.bkbits.net:/home/davem/net-2.5
parents 767ac366 aad00662
......@@ -62,8 +62,14 @@ static int card_probe(struct pnp_card * card, struct pnp_card_driver * drv)
if (drv->probe) {
if (drv->probe(clink, id)>=0)
return 1;
else
else {
struct pnp_dev * dev;
card_for_each_dev(card, dev) {
if (dev->card_link == clink)
pnp_release_card_device(dev);
}
kfree(clink);
}
} else
return 1;
}
......
......@@ -9,7 +9,6 @@
/* TODO: see if more isapnp functions are needed here */
#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/isapnp.h>
#include <linux/string.h>
......
......@@ -35,7 +35,6 @@
*/
#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
......@@ -65,7 +64,6 @@ MODULE_PARM(isapnp_rdp, "i");
MODULE_PARM_DESC(isapnp_rdp, "ISA Plug & Play read data port");
MODULE_PARM(isapnp_reset, "i");
MODULE_PARM_DESC(isapnp_reset, "ISA Plug & Play reset all cards");
MODULE_PARM(isapnp_allow_dma0, "i");
MODULE_PARM(isapnp_verbose, "i");
MODULE_PARM_DESC(isapnp_verbose, "ISA Plug & Play verbose mode");
MODULE_LICENSE("GPL");
......
......@@ -20,7 +20,6 @@
*/
#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/isapnp.h>
#include <linux/proc_fs.h>
......
......@@ -23,41 +23,7 @@
#include <asm/system.h>
#include <asm/byteorder.h>
/* PnP BIOS signature: "$PnP" */
#define PNP_SIGNATURE (('$' << 0) + ('P' << 8) + ('n' << 16) + ('P' << 24))
#pragma pack(1)
union pnp_bios_expansion_header {
struct {
u32 signature; /* "$PnP" */
u8 version; /* in BCD */
u8 length; /* length in bytes, currently 21h */
u16 control; /* system capabilities */
u8 checksum; /* all bytes must add up to 0 */
u32 eventflag; /* phys. address of the event flag */
u16 rmoffset; /* real mode entry point */
u16 rmcseg;
u16 pm16offset; /* 16 bit protected mode entry */
u32 pm16cseg;
u32 deviceID; /* EISA encoded system ID or 0 */
u16 rmdseg; /* real mode data segment */
u32 pm16dseg; /* 16 bit pm data segment base */
} fields;
char chars[0x21]; /* To calculate the checksum */
};
#pragma pack()
static union pnp_bios_expansion_header * pnp_bios_hdr = NULL;
/*
* Call this only after init time
*/
static int pnp_bios_present(void)
{
return (pnp_bios_hdr != NULL);
}
#include "pnpbios.h"
static struct {
u16 offset;
......@@ -557,10 +523,10 @@ static int pnp_bios_write_escd(char *data, u32 nvram_base)
/*
* Probing and Initialization
* Initialization
*/
static void pnpbios_prepare_bios_calls(union pnp_bios_expansion_header *header)
void pnpbios_calls_init(union pnp_bios_install_struct *header)
{
int i;
spin_lock_init(&pnp_bios_lock);
......@@ -576,52 +542,3 @@ static void pnpbios_prepare_bios_calls(union pnp_bios_expansion_header *header)
Q_SET_SEL(i, PNP_DS, header->fields.pm16dseg, 64 * 1024);
}
}
int pnpbios_probe_installation(void)
{
union pnp_bios_expansion_header *check;
u8 sum;
int length, i;
printk(KERN_INFO "PnPBIOS: Scanning system for PnP BIOS support...\n");
/*
* Search the defined area (0xf0000-0xffff0) for a valid PnP BIOS
* structure and, if one is found, sets up the selectors and
* entry points
*/
for (check = (union pnp_bios_expansion_header *) __va(0xf0000);
check < (union pnp_bios_expansion_header *) __va(0xffff0);
((void *) (check)) += 16) {
if (check->fields.signature != PNP_SIGNATURE)
continue;
printk(KERN_INFO "PnPBIOS: Found PnP BIOS installation structure at 0x%p\n", check);
length = check->fields.length;
if (!length) {
printk(KERN_ERR "PnPBIOS: installation structure is invalid, skipping\n");
continue;
}
for (sum = 0, i = 0; i < length; i++)
sum += check->chars[i];
if (sum) {
printk(KERN_ERR "PnPBIOS: installation structure is corrupted, skipping\n");
continue;
}
if (check->fields.version < 0x10) {
printk(KERN_WARNING "PnPBIOS: PnP BIOS version %d.%d is not supported\n",
check->fields.version >> 4,
check->fields.version & 15);
continue;
}
printk(KERN_INFO "PnPBIOS: PnP BIOS version %d.%d, entry 0x%x:0x%x, dseg 0x%x\n",
check->fields.version >> 4, check->fields.version & 15,
check->fields.pm16cseg, check->fields.pm16offset,
check->fields.pm16dseg);
pnp_bios_hdr = check;
pnpbios_prepare_bios_calls(check);
return 1;
}
printk(KERN_INFO "PnPBIOS: PnP BIOS support was not detected.\n");
return 0;
}
......@@ -74,6 +74,13 @@
*
*/
static union pnp_bios_install_struct * pnp_bios_install = NULL;
int pnp_bios_present(void)
{
return (pnp_bios_install != NULL);
}
struct pnp_dev_node_info node_info;
void *pnpbios_kmalloc(size_t size, int f)
......@@ -410,7 +417,56 @@ static int __init pnpbios_setup(char *str)
__setup("pnpbios=", pnpbios_setup);
#endif
subsys_initcall(pnpbios_init);
/* PnP BIOS signature: "$PnP" */
#define PNP_SIGNATURE (('$' << 0) + ('P' << 8) + ('n' << 16) + ('P' << 24))
int __init pnpbios_probe_system(void)
{
union pnp_bios_install_struct *check;
u8 sum;
int length, i;
printk(KERN_INFO "PnPBIOS: Scanning system for PnP BIOS support...\n");
/*
* Search the defined area (0xf0000-0xffff0) for a valid PnP BIOS
* structure and, if one is found, sets up the selectors and
* entry points
*/
for (check = (union pnp_bios_install_struct *) __va(0xf0000);
check < (union pnp_bios_install_struct *) __va(0xffff0);
((void *) (check)) += 16) {
if (check->fields.signature != PNP_SIGNATURE)
continue;
printk(KERN_INFO "PnPBIOS: Found PnP BIOS installation structure at 0x%p\n", check);
length = check->fields.length;
if (!length) {
printk(KERN_ERR "PnPBIOS: installation structure is invalid, skipping\n");
continue;
}
for (sum = 0, i = 0; i < length; i++)
sum += check->chars[i];
if (sum) {
printk(KERN_ERR "PnPBIOS: installation structure is corrupted, skipping\n");
continue;
}
if (check->fields.version < 0x10) {
printk(KERN_WARNING "PnPBIOS: PnP BIOS version %d.%d is not supported\n",
check->fields.version >> 4,
check->fields.version & 15);
continue;
}
printk(KERN_INFO "PnPBIOS: PnP BIOS version %d.%d, entry 0x%x:0x%x, dseg 0x%x\n",
check->fields.version >> 4, check->fields.version & 15,
check->fields.pm16cseg, check->fields.pm16offset,
check->fields.pm16dseg);
pnp_bios_install = check;
return 1;
}
printk(KERN_INFO "PnPBIOS: PnP BIOS support was not detected.\n");
return 0;
}
int __init pnpbios_init(void)
{
......@@ -421,24 +477,30 @@ int __init pnpbios_init(void)
}
/* scan the system for pnpbios support */
if (!pnpbios_probe_installation())
if (!pnpbios_probe_system())
return -ENODEV;
/* make preparations for bios calls */
pnpbios_calls_init(pnp_bios_install);
/* read the node info */
if (pnp_bios_dev_node_info(&node_info)) {
ret = pnp_bios_dev_node_info(&node_info);
if (ret) {
printk(KERN_ERR "PnPBIOS: Unable to get node info. Aborting.\n");
return -EIO;
return ret;
}
/* register with the pnp layer */
pnp_register_protocol(&pnpbios_protocol);
ret = pnp_register_protocol(&pnpbios_protocol);
if (ret) {
printk(KERN_ERR "PnPBIOS: Unable to register driver. Aborting.\n");
return ret;
}
#ifdef CONFIG_PROC_FS
/* start the proc interface */
ret = pnpbios_proc_init();
if (ret)
return ret;
#endif
printk(KERN_ERR "PnPBIOS: Failed to create proc interface.\n");
/* scan for pnpbios devices */
build_devlist();
......@@ -446,6 +508,8 @@ int __init pnpbios_init(void)
return 0;
}
subsys_initcall(pnpbios_init);
static int __init pnpbios_thread_init(void)
{
#ifdef CONFIG_HOTPLUG
......
/*
* pnpbios.h - contains definitions for functions used only locally.
* pnpbios.h - contains local definitions
*/
#pragma pack(1)
union pnp_bios_install_struct {
struct {
u32 signature; /* "$PnP" */
u8 version; /* in BCD */
u8 length; /* length in bytes, currently 21h */
u16 control; /* system capabilities */
u8 checksum; /* all bytes must add up to 0 */
u32 eventflag; /* phys. address of the event flag */
u16 rmoffset; /* real mode entry point */
u16 rmcseg;
u16 pm16offset; /* 16 bit protected mode entry */
u32 pm16cseg;
u32 deviceID; /* EISA encoded system ID or 0 */
u16 rmdseg; /* real mode data segment */
u32 pm16dseg; /* 16 bit pm data segment base */
} fields;
char chars[0x21]; /* To calculate the checksum */
};
#pragma pack()
extern int pnp_bios_present(void);
extern int pnpbios_dont_use_current_config;
extern void *pnpbios_kmalloc(size_t size, int f);
extern int pnpbios_parse_data_stream(struct pnp_dev *dev, struct pnp_bios_node * node);
extern int pnpbios_read_resources_from_node(struct pnp_resource_table *res, struct pnp_bios_node * node);
extern int pnpbios_write_resources_to_node(struct pnp_resource_table *res, struct pnp_bios_node * node);
extern void pnpid32_to_pnpid(u32 id, char *str);
extern void pnpbios_print_status(const char * module, u16 status);
extern int pnpbios_probe_installation(void);
extern void pnpbios_calls_init(union pnp_bios_install_struct * header);
#ifdef CONFIG_PROC_FS
extern int pnpbios_interface_attach_device(struct pnp_bios_node * node);
extern int pnpbios_proc_init (void);
extern void pnpbios_proc_exit (void);
#else
static inline int pnpbios_interface_attach_device(struct pnp_bios_node * node) { return 0; }
static inline int pnpbios_proc_init (void) { return 0; }
static inline void pnpbios_proc_exit (void) { ; }
#endif /* CONFIG_PROC */
......@@ -31,6 +31,8 @@
#include <asm/uaccess.h>
#include "pnpbios.h"
static struct proc_dir_entry *proc_pnp = NULL;
static struct proc_dir_entry *proc_pnp_boot = NULL;
......@@ -213,6 +215,9 @@ int pnpbios_interface_attach_device(struct pnp_bios_node * node)
struct proc_dir_entry *ent;
sprintf(name, "%02x", node->handle);
if (!proc_pnp)
return -EIO;
if ( !pnpbios_dont_use_current_config ) {
ent = create_proc_entry(name, 0, proc_pnp);
if (ent) {
......@@ -221,6 +226,9 @@ int pnpbios_interface_attach_device(struct pnp_bios_node * node)
ent->data = (void *)(long)(node->handle);
}
}
if (!proc_pnp_boot)
return -EIO;
ent = create_proc_entry(name, 0, proc_pnp_boot);
if (ent) {
ent->read_proc = proc_read_node;
......@@ -228,6 +236,7 @@ int pnpbios_interface_attach_device(struct pnp_bios_node * node)
ent->data = (void *)(long)(node->handle+0x100);
return 0;
}
return -EIO;
}
......@@ -257,8 +266,9 @@ void __exit pnpbios_proc_exit(void)
{
int i;
char name[3];
if (!proc_pnp) return;
if (!proc_pnp)
return;
for (i=0; i<0xff; i++) {
sprintf(name, "%02x", i);
......
......@@ -111,28 +111,6 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev)
return;
}
extern int pnp_allow_dma0;
static void quirk_opl3sax_resources(struct pnp_dev *dev)
{
/* This really isn't a device quirk but isapnp core code
* doesn't allow a DMA channel of 0, afflicted card is an
* OPL3Sax where x=4.
*/
struct pnp_option *res;
int max;
res = dev->dependent;
max = 0;
for (; res; res = res->next) {
if (res->dma->map > max)
max = res->dma->map;
}
if (max == 1 && pnp_allow_dma0 == -1) {
printk(KERN_INFO "pnp: opl3sa4 quirk: Allowing dma 0.\n");
pnp_allow_dma0 = 1;
}
return;
}
/*
* PnP Quirks
* Cards or devices that need some tweaking due to incomplete resource info
......@@ -153,7 +131,6 @@ static struct pnp_fixup pnp_fixups[] = {
{ "CTL0043", quirk_sb16audio_resources },
{ "CTL0044", quirk_sb16audio_resources },
{ "CTL0045", quirk_sb16audio_resources },
{ "YMH0021", quirk_opl3sax_resources },
{ "" }
};
......@@ -170,4 +147,3 @@ void pnp_fixup_device(struct pnp_dev *dev)
i++;
}
}
......@@ -21,8 +21,6 @@
#include <linux/pnp.h>
#include "base.h"
int pnp_allow_dma0 = -1; /* allow dma 0 during auto activation:
* -1=off (:default), 0=off (set by user), 1=on */
int pnp_skip_pci_scan; /* skip PCI resource scanning */
int pnp_reserve_irq[16] = { [0 ... 15] = -1 }; /* reserve (don't use) some IRQ */
int pnp_reserve_dma[8] = { [0 ... 7] = -1 }; /* reserve (don't use) some DMA */
......@@ -426,7 +424,7 @@ int pnp_check_irq(struct pnp_dev * dev, int idx)
int pnp_check_dma(struct pnp_dev * dev, int idx)
{
int tmp, mindma = 1;
int tmp;
struct pnp_dev *tdev;
unsigned long * dma = &dev->res.dma_resource[idx].start;
......@@ -435,9 +433,7 @@ int pnp_check_dma(struct pnp_dev * dev, int idx)
return 1;
/* check if the resource is valid */
if (pnp_allow_dma0 == 1)
mindma = 0;
if (*dma < mindma || *dma == 4 || *dma > 7)
if (*dma < 0 || *dma == 4 || *dma > 7)
return 0;
/* check if the resource is reserved */
......@@ -488,16 +484,6 @@ EXPORT_SYMBOL(pnp_register_port_resource);
EXPORT_SYMBOL(pnp_register_mem_resource);
/* format is: allowdma0 */
static int __init pnp_allowdma0(char *str)
{
pnp_allow_dma0 = 1;
return 1;
}
__setup("allowdma0", pnp_allowdma0);
/* format is: pnp_reserve_irq=irq1[,irq2] .... */
static int __init pnp_setup_reserve_irq(char *str)
......
......@@ -1196,8 +1196,10 @@ static struct file_operations proc_pid_attr_operations = {
.write = proc_pid_attr_write,
};
static struct file_operations proc_attr_operations;
static struct inode_operations proc_attr_inode_operations;
static struct file_operations proc_tid_attr_operations;
static struct inode_operations proc_tid_attr_inode_operations;
static struct file_operations proc_tgid_attr_operations;
static struct inode_operations proc_tgid_attr_inode_operations;
#endif
/* SMP-safe */
......@@ -1304,10 +1306,14 @@ static struct dentry *proc_pident_lookup(struct inode *dir,
break;
#ifdef CONFIG_SECURITY
case PROC_TID_ATTR:
inode->i_nlink = 2;
inode->i_op = &proc_tid_attr_inode_operations;
inode->i_fop = &proc_tid_attr_operations;
break;
case PROC_TGID_ATTR:
inode->i_nlink = 2;
inode->i_op = &proc_attr_inode_operations;
inode->i_fop = &proc_attr_operations;
inode->i_op = &proc_tgid_attr_inode_operations;
inode->i_fop = &proc_tgid_attr_operations;
break;
case PROC_TID_ATTR_CURRENT:
case PROC_TGID_ATTR_CURRENT:
......
......@@ -26,7 +26,7 @@
#ifdef __KERNEL__
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/pnp.h>
/*
* Return codes
......@@ -131,13 +131,7 @@ struct pnp_bios_node {
#ifdef CONFIG_PNPBIOS
/* non-exported */
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 int pnpbios_init (void);
extern int pnpbios_interface_attach_device(struct pnp_bios_node * node);
extern int pnpbios_proc_init (void);
extern void pnpbios_proc_exit (void);
extern int pnp_bios_dev_node_info (struct pnp_dev_node_info *data);
extern int pnp_bios_get_dev_node (u8 *nodenum, char config, struct pnp_bios_node *data);
......
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