Commit 085f1746 authored by Jeff Garzik's avatar Jeff Garzik

Merge mandrakesoft.com:/spare/vanilla/linus-2.5

into mandrakesoft.com:/spare/repo/misc-2.5
parents d7814fa5 08f129d2
...@@ -29,3 +29,14 @@ CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM ...@@ -29,3 +29,14 @@ CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM
When in doubt, say N. When in doubt, say N.
CONFIG_HOTPLUG_PCI_IBM
Say Y here if you have a motherboard with a IBM PCI Hotplug
controller.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called cpqphp.o. If you want to compile it
as a module, say M here and read <file:Documentation/modules.txt>.
When in doubt, say N.
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
mainmenu_option next_comment mainmenu_option next_comment
comment 'PCI Hotplug Support' comment 'PCI Hotplug Support'
dep_tristate 'Support for PCI Hotplug (EXPERIMENTAL)' CONFIG_HOTPLUG_PCI $CONFIG_DDFS $CONFIG_EXPERIMENTAL dep_tristate 'Support for PCI Hotplug (EXPERIMENTAL)' CONFIG_HOTPLUG_PCI $CONFIG_PCI $CONFIG_EXPERIMENTAL
dep_tristate ' Compaq PCI Hotplug driver' CONFIG_HOTPLUG_PCI_COMPAQ $CONFIG_HOTPLUG_PCI dep_tristate ' Compaq PCI Hotplug driver' CONFIG_HOTPLUG_PCI_COMPAQ $CONFIG_HOTPLUG_PCI $CONFIG_X86
dep_mbool ' Save configuration into NVRAM on Compaq servers' CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM $CONFIG_HOTPLUG_PCI_COMPAQ dep_mbool ' Save configuration into NVRAM on Compaq servers' CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM $CONFIG_HOTPLUG_PCI_COMPAQ
dep_tristate ' IBM PCI Hotplug driver' CONFIG_HOTPLUG_PCI_IBM $CONFIG_HOTPLUG_PCI $CONFIG_X86_IO_APIC $CONFIG_X86
endmenu endmenu
...@@ -4,12 +4,13 @@ ...@@ -4,12 +4,13 @@
O_TARGET := vmlinux-obj.o O_TARGET := vmlinux-obj.o
list-multi := cpqphp.o pci_hotplug.o list-multi := cpqphp.o pci_hotplug.o ibmphp.o
export-objs := pci_hotplug_core.o pci_hotplug_util.o export-objs := pci_hotplug_core.o pci_hotplug_util.o
obj-$(CONFIG_HOTPLUG_PCI) += pci_hotplug.o obj-$(CONFIG_HOTPLUG_PCI) += pci_hotplug.o
obj-$(CONFIG_HOTPLUG_PCI_COMPAQ) += cpqphp.o obj-$(CONFIG_HOTPLUG_PCI_COMPAQ) += cpqphp.o
obj-$(CONFIG_HOTPLUG_PCI_IBM) += ibmphp.o
pci_hotplug-objs := pci_hotplug_core.o \ pci_hotplug-objs := pci_hotplug_core.o \
pci_hotplug_util.o pci_hotplug_util.o
...@@ -19,6 +20,12 @@ cpqphp-objs := cpqphp_core.o \ ...@@ -19,6 +20,12 @@ cpqphp-objs := cpqphp_core.o \
cpqphp_proc.o \ cpqphp_proc.o \
cpqphp_pci.o cpqphp_pci.o
ibmphp-objs := ibmphp_core.o \
ibmphp_ebda.o \
ibmphp_pci.o \
ibmphp_res.o \
ibmphp_hpc.o
ifeq ($(CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM),y) ifeq ($(CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM),y)
cpqphp-objs += cpqphp_nvram.o cpqphp-objs += cpqphp_nvram.o
endif endif
...@@ -32,3 +39,6 @@ pci_hotplug.o: $(pci_hotplug-objs) ...@@ -32,3 +39,6 @@ pci_hotplug.o: $(pci_hotplug-objs)
cpqphp.o: $(cpqphp-objs) cpqphp.o: $(cpqphp-objs)
$(LD) -r -o $@ $(cpqphp-objs) $(LD) -r -o $@ $(cpqphp-objs)
ibmphp.o: $(ibmphp-objs)
$(LD) -r -o $@ $(ibmphp-objs)
...@@ -177,7 +177,7 @@ int cpqhp_proc_remove_ctrl (struct controller *ctrl) ...@@ -177,7 +177,7 @@ int cpqhp_proc_remove_ctrl (struct controller *ctrl)
int cpqhp_proc_init_ctrl (void) int cpqhp_proc_init_ctrl (void)
{ {
ctrl_proc_root = proc_mkdir("driver/hpc", NULL); ctrl_proc_root = proc_mkdir("hpc", proc_root_driver);
if (!ctrl_proc_root) if (!ctrl_proc_root)
return -ENOMEM; return -ENOMEM;
ctrl_proc_root->owner = THIS_MODULE; ctrl_proc_root->owner = THIS_MODULE;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* /*
* PCI HotPlug Controller Core * PCI HotPlug Controller Core
* *
* Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com) * Copyright (c) 2001-2002 Greg Kroah-Hartman (greg@kroah.com)
* Copyright (c) 2001 IBM Corp. * Copyright (c) 2001-2002 IBM Corp.
* *
* All rights reserved. * All rights reserved.
* *
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
* *
* Send feedback to <greg@kroah.com> * Send feedback to <greg@kroah.com>
* *
* Filesystem portion based on work done by Pat Mochel on ddfs/driverfs
*
*/ */
#include <linux/config.h> #include <linux/config.h>
...@@ -54,7 +56,7 @@ ...@@ -54,7 +56,7 @@
/* local variables */ /* local variables */
static int debug; static int debug;
#define DRIVER_VERSION "0.3" #define DRIVER_VERSION "0.4"
#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>" #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>"
#define DRIVER_DESC "PCI Hot Plug PCI Core" #define DRIVER_DESC "PCI Hot Plug PCI Core"
...@@ -74,7 +76,6 @@ struct hotplug_slot_core { ...@@ -74,7 +76,6 @@ struct hotplug_slot_core {
}; };
static struct super_operations pcihpfs_ops; static struct super_operations pcihpfs_ops;
static struct address_space_operations pcihpfs_aops;
static struct file_operations pcihpfs_dir_operations; static struct file_operations pcihpfs_dir_operations;
static struct file_operations default_file_operations; static struct file_operations default_file_operations;
static struct inode_operations pcihpfs_dir_inode_operations; static struct inode_operations pcihpfs_dir_inode_operations;
...@@ -112,7 +113,6 @@ static struct inode *pcihpfs_get_inode (struct super_block *sb, int mode, int de ...@@ -112,7 +113,6 @@ static struct inode *pcihpfs_get_inode (struct super_block *sb, int mode, int de
inode->i_blksize = PAGE_CACHE_SIZE; inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_blocks = 0; inode->i_blocks = 0;
inode->i_rdev = NODEV; inode->i_rdev = NODEV;
inode->i_mapping->a_ops = &pcihpfs_aops;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
switch (mode & S_IFMT) { switch (mode & S_IFMT) {
default: default:
...@@ -154,18 +154,6 @@ static int pcihpfs_create (struct inode *dir, struct dentry *dentry, int mode) ...@@ -154,18 +154,6 @@ static int pcihpfs_create (struct inode *dir, struct dentry *dentry, int mode)
return pcihpfs_mknod (dir, dentry, mode | S_IFREG, 0); return pcihpfs_mknod (dir, dentry, mode | S_IFREG, 0);
} }
static int pcihpfs_link (struct dentry *old_dentry, struct inode *dir,
struct dentry *dentry)
{
struct inode *inode = old_dentry->d_inode;
inode->i_nlink++;
atomic_inc(&inode->i_count);
dget(dentry);
d_instantiate(dentry, inode);
return 0;
}
static inline int pcihpfs_positive (struct dentry *dentry) static inline int pcihpfs_positive (struct dentry *dentry)
{ {
return dentry->d_inode && !d_unhashed(dentry); return dentry->d_inode && !d_unhashed(dentry);
...@@ -196,29 +184,15 @@ static int pcihpfs_unlink (struct inode *dir, struct dentry *dentry) ...@@ -196,29 +184,15 @@ static int pcihpfs_unlink (struct inode *dir, struct dentry *dentry)
if (pcihpfs_empty(dentry)) { if (pcihpfs_empty(dentry)) {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
lock_kernel();
inode->i_nlink--; inode->i_nlink--;
unlock_kernel();
dput(dentry); dput(dentry);
error = 0; error = 0;
} }
return error; return error;
} }
static int pcihpfs_rename (struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry)
{
int error = -ENOTEMPTY;
if (pcihpfs_empty(new_dentry)) {
struct inode *inode = new_dentry->d_inode;
if (inode) {
inode->i_nlink--;
dput(new_dentry);
}
error = 0;
}
return error;
}
#define pcihpfs_rmdir pcihpfs_unlink #define pcihpfs_rmdir pcihpfs_unlink
/* default file operations */ /* default file operations */
...@@ -238,6 +212,7 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig) ...@@ -238,6 +212,7 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig)
{ {
loff_t retval = -EINVAL; loff_t retval = -EINVAL;
lock_kernel();
switch(orig) { switch(orig) {
case 0: case 0:
if (offset > 0) { if (offset > 0) {
...@@ -254,6 +229,7 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig) ...@@ -254,6 +229,7 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig)
default: default:
break; break;
} }
unlock_kernel();
return retval; return retval;
} }
...@@ -265,18 +241,9 @@ static int default_open (struct inode *inode, struct file *filp) ...@@ -265,18 +241,9 @@ static int default_open (struct inode *inode, struct file *filp)
return 0; return 0;
} }
static int default_sync_file (struct file *file, struct dentry *dentry, int datasync)
{
return 0;
}
static struct address_space_operations pcihpfs_aops = {
};
static struct file_operations pcihpfs_dir_operations = { static struct file_operations pcihpfs_dir_operations = {
read: generic_read_dir, read: generic_read_dir,
readdir: dcache_readdir, readdir: dcache_readdir,
fsync: default_sync_file,
}; };
static struct file_operations default_file_operations = { static struct file_operations default_file_operations = {
...@@ -284,8 +251,6 @@ static struct file_operations default_file_operations = { ...@@ -284,8 +251,6 @@ static struct file_operations default_file_operations = {
write: default_write_file, write: default_write_file,
open: default_open, open: default_open,
llseek: default_file_lseek, llseek: default_file_lseek,
fsync: default_sync_file,
mmap: generic_file_mmap,
}; };
/* file ops for the "power" files */ /* file ops for the "power" files */
...@@ -296,8 +261,6 @@ static struct file_operations power_file_operations = { ...@@ -296,8 +261,6 @@ static struct file_operations power_file_operations = {
write: power_write_file, write: power_write_file,
open: default_open, open: default_open,
llseek: default_file_lseek, llseek: default_file_lseek,
fsync: default_sync_file,
mmap: generic_file_mmap,
}; };
/* file ops for the "attention" files */ /* file ops for the "attention" files */
...@@ -308,8 +271,6 @@ static struct file_operations attention_file_operations = { ...@@ -308,8 +271,6 @@ static struct file_operations attention_file_operations = {
write: attention_write_file, write: attention_write_file,
open: default_open, open: default_open,
llseek: default_file_lseek, llseek: default_file_lseek,
fsync: default_sync_file,
mmap: generic_file_mmap,
}; };
/* file ops for the "latch" files */ /* file ops for the "latch" files */
...@@ -319,8 +280,6 @@ static struct file_operations latch_file_operations = { ...@@ -319,8 +280,6 @@ static struct file_operations latch_file_operations = {
write: default_write_file, write: default_write_file,
open: default_open, open: default_open,
llseek: default_file_lseek, llseek: default_file_lseek,
fsync: default_sync_file,
mmap: generic_file_mmap,
}; };
/* file ops for the "presence" files */ /* file ops for the "presence" files */
...@@ -330,8 +289,6 @@ static struct file_operations presence_file_operations = { ...@@ -330,8 +289,6 @@ static struct file_operations presence_file_operations = {
write: default_write_file, write: default_write_file,
open: default_open, open: default_open,
llseek: default_file_lseek, llseek: default_file_lseek,
fsync: default_sync_file,
mmap: generic_file_mmap,
}; };
/* file ops for the "test" files */ /* file ops for the "test" files */
...@@ -341,19 +298,15 @@ static struct file_operations test_file_operations = { ...@@ -341,19 +298,15 @@ static struct file_operations test_file_operations = {
write: test_write_file, write: test_write_file,
open: default_open, open: default_open,
llseek: default_file_lseek, llseek: default_file_lseek,
fsync: default_sync_file,
mmap: generic_file_mmap,
}; };
static struct inode_operations pcihpfs_dir_inode_operations = { static struct inode_operations pcihpfs_dir_inode_operations = {
create: pcihpfs_create, create: pcihpfs_create,
lookup: pcihpfs_lookup, lookup: pcihpfs_lookup,
link: pcihpfs_link,
unlink: pcihpfs_unlink, unlink: pcihpfs_unlink,
mkdir: pcihpfs_mkdir, mkdir: pcihpfs_mkdir,
rmdir: pcihpfs_rmdir, rmdir: pcihpfs_rmdir,
mknod: pcihpfs_mknod, mknod: pcihpfs_mknod,
rename: pcihpfs_rename,
}; };
static struct super_operations pcihpfs_ops = { static struct super_operations pcihpfs_ops = {
...@@ -485,7 +438,7 @@ static int pcihpfs_create_by_name (const char *name, mode_t mode, ...@@ -485,7 +438,7 @@ static int pcihpfs_create_by_name (const char *name, mode_t mode,
if (!parent) { if (!parent) {
dbg("Ah! can not find a parent!\n"); dbg("Ah! can not find a parent!\n");
return -EFAULT; return -EINVAL;
} }
*dentry = NULL; *dentry = NULL;
...@@ -686,7 +639,7 @@ static ssize_t power_write_file (struct file *file, const char *ubuff, size_t co ...@@ -686,7 +639,7 @@ static ssize_t power_write_file (struct file *file, const char *ubuff, size_t co
default: default:
err ("Illegal value specified for power\n"); err ("Illegal value specified for power\n");
retval = -EFAULT; retval = -EINVAL;
} }
exit: exit:
...@@ -1019,7 +972,7 @@ int pci_hp_register (struct hotplug_slot *slot) ...@@ -1019,7 +972,7 @@ int pci_hp_register (struct hotplug_slot *slot)
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
if ((slot->info == NULL) || (slot->ops == NULL)) if ((slot->info == NULL) || (slot->ops == NULL))
return -EFAULT; return -EINVAL;
core = kmalloc (sizeof (struct hotplug_slot_core), GFP_KERNEL); core = kmalloc (sizeof (struct hotplug_slot_core), GFP_KERNEL);
if (!core) if (!core)
...@@ -1030,7 +983,7 @@ int pci_hp_register (struct hotplug_slot *slot) ...@@ -1030,7 +983,7 @@ int pci_hp_register (struct hotplug_slot *slot)
if (get_slot_from_name (slot->name) != NULL) { if (get_slot_from_name (slot->name) != NULL) {
spin_unlock (&list_lock); spin_unlock (&list_lock);
kfree (core); kfree (core);
return -EFAULT; return -EINVAL;
} }
slot->core_priv = core; slot->core_priv = core;
...@@ -1076,6 +1029,12 @@ int pci_hp_deregister (struct hotplug_slot *slot) ...@@ -1076,6 +1029,12 @@ int pci_hp_deregister (struct hotplug_slot *slot)
return 0; return 0;
} }
static inline void update_inode_time (struct inode *inode)
{
if (inode)
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
}
/** /**
* pci_hp_change_slot_info - changes the slot's information structure in the core * pci_hp_change_slot_info - changes the slot's information structure in the core
* @name: the name of the slot whose info has changed * @name: the name of the slot whose info has changed
...@@ -1089,6 +1048,7 @@ int pci_hp_deregister (struct hotplug_slot *slot) ...@@ -1089,6 +1048,7 @@ int pci_hp_deregister (struct hotplug_slot *slot)
int pci_hp_change_slot_info (const char *name, struct hotplug_slot_info *info) int pci_hp_change_slot_info (const char *name, struct hotplug_slot_info *info)
{ {
struct hotplug_slot *temp; struct hotplug_slot *temp;
struct hotplug_slot_core *core;
if (info == NULL) if (info == NULL)
return -ENODEV; return -ENODEV;
...@@ -1100,6 +1060,24 @@ int pci_hp_change_slot_info (const char *name, struct hotplug_slot_info *info) ...@@ -1100,6 +1060,24 @@ int pci_hp_change_slot_info (const char *name, struct hotplug_slot_info *info)
return -ENODEV; return -ENODEV;
} }
/*
* check all fields in the info structure, and update timestamps
* for the files referring to the fields that have now changed.
*/
core = temp->core_priv;
if ((core->power_dentry) &&
(temp->info->power_status != info->power_status))
update_inode_time (core->power_dentry->d_inode);
if ((core->attention_dentry) &&
(temp->info->attention_status != info->attention_status))
update_inode_time (core->attention_dentry->d_inode);
if ((core->latch_dentry) &&
(temp->info->latch_status != info->latch_status))
update_inode_time (core->latch_dentry->d_inode);
if ((core->adapter_dentry) &&
(temp->info->adapter_status != info->adapter_status))
update_inode_time (core->adapter_dentry->d_inode);
memcpy (temp->info, info, sizeof (struct hotplug_slot_info)); memcpy (temp->info, info, sizeof (struct hotplug_slot_info));
spin_unlock (&list_lock); spin_unlock (&list_lock);
return 0; return 0;
......
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