|
@@ -54,7 +54,9 @@ static int ipmi_init_msghandler(void);
|
|
|
|
|
|
static int initialized = 0;
|
|
static int initialized = 0;
|
|
|
|
|
|
-static struct proc_dir_entry *proc_ipmi_root = NULL;
|
|
|
|
|
|
+#ifdef CONFIG_PROC_FS
|
|
|
|
+struct proc_dir_entry *proc_ipmi_root = NULL;
|
|
|
|
+#endif /* CONFIG_PROC_FS */
|
|
|
|
|
|
#define MAX_EVENTS_IN_QUEUE 25
|
|
#define MAX_EVENTS_IN_QUEUE 25
|
|
|
|
|
|
@@ -124,11 +126,13 @@ struct ipmi_channel
|
|
unsigned char protocol;
|
|
unsigned char protocol;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+#ifdef CONFIG_PROC_FS
|
|
struct ipmi_proc_entry
|
|
struct ipmi_proc_entry
|
|
{
|
|
{
|
|
char *name;
|
|
char *name;
|
|
struct ipmi_proc_entry *next;
|
|
struct ipmi_proc_entry *next;
|
|
};
|
|
};
|
|
|
|
+#endif
|
|
|
|
|
|
#define IPMI_IPMB_NUM_SEQ 64
|
|
#define IPMI_IPMB_NUM_SEQ 64
|
|
#define IPMI_MAX_CHANNELS 8
|
|
#define IPMI_MAX_CHANNELS 8
|
|
@@ -156,10 +160,13 @@ struct ipmi_smi
|
|
struct ipmi_smi_handlers *handlers;
|
|
struct ipmi_smi_handlers *handlers;
|
|
void *send_info;
|
|
void *send_info;
|
|
|
|
|
|
|
|
+#ifdef CONFIG_PROC_FS
|
|
/* A list of proc entries for this interface. This does not
|
|
/* A list of proc entries for this interface. This does not
|
|
need a lock, only one thread creates it and only one thread
|
|
need a lock, only one thread creates it and only one thread
|
|
destroys it. */
|
|
destroys it. */
|
|
|
|
+ spinlock_t proc_entry_lock;
|
|
struct ipmi_proc_entry *proc_entries;
|
|
struct ipmi_proc_entry *proc_entries;
|
|
|
|
+#endif
|
|
|
|
|
|
/* A table of sequence numbers for this interface. We use the
|
|
/* A table of sequence numbers for this interface. We use the
|
|
sequence numbers for IPMB messages that go out of the
|
|
sequence numbers for IPMB messages that go out of the
|
|
@@ -1470,8 +1477,9 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
|
|
read_proc_t *read_proc, write_proc_t *write_proc,
|
|
read_proc_t *read_proc, write_proc_t *write_proc,
|
|
void *data, struct module *owner)
|
|
void *data, struct module *owner)
|
|
{
|
|
{
|
|
- struct proc_dir_entry *file;
|
|
|
|
int rv = 0;
|
|
int rv = 0;
|
|
|
|
+#ifdef CONFIG_PROC_FS
|
|
|
|
+ struct proc_dir_entry *file;
|
|
struct ipmi_proc_entry *entry;
|
|
struct ipmi_proc_entry *entry;
|
|
|
|
|
|
/* Create a list element. */
|
|
/* Create a list element. */
|
|
@@ -1497,10 +1505,13 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
|
|
file->write_proc = write_proc;
|
|
file->write_proc = write_proc;
|
|
file->owner = owner;
|
|
file->owner = owner;
|
|
|
|
|
|
|
|
+ spin_lock(&smi->proc_entry_lock);
|
|
/* Stick it on the list. */
|
|
/* Stick it on the list. */
|
|
entry->next = smi->proc_entries;
|
|
entry->next = smi->proc_entries;
|
|
smi->proc_entries = entry;
|
|
smi->proc_entries = entry;
|
|
|
|
+ spin_unlock(&smi->proc_entry_lock);
|
|
}
|
|
}
|
|
|
|
+#endif /* CONFIG_PROC_FS */
|
|
|
|
|
|
return rv;
|
|
return rv;
|
|
}
|
|
}
|
|
@@ -1509,6 +1520,7 @@ static int add_proc_entries(ipmi_smi_t smi, int num)
|
|
{
|
|
{
|
|
int rv = 0;
|
|
int rv = 0;
|
|
|
|
|
|
|
|
+#ifdef CONFIG_PROC_FS
|
|
sprintf(smi->proc_dir_name, "%d", num);
|
|
sprintf(smi->proc_dir_name, "%d", num);
|
|
smi->proc_dir = proc_mkdir(smi->proc_dir_name, proc_ipmi_root);
|
|
smi->proc_dir = proc_mkdir(smi->proc_dir_name, proc_ipmi_root);
|
|
if (!smi->proc_dir)
|
|
if (!smi->proc_dir)
|
|
@@ -1531,14 +1543,17 @@ static int add_proc_entries(ipmi_smi_t smi, int num)
|
|
rv = ipmi_smi_add_proc_entry(smi, "version",
|
|
rv = ipmi_smi_add_proc_entry(smi, "version",
|
|
version_file_read_proc, NULL,
|
|
version_file_read_proc, NULL,
|
|
smi, THIS_MODULE);
|
|
smi, THIS_MODULE);
|
|
|
|
+#endif /* CONFIG_PROC_FS */
|
|
|
|
|
|
return rv;
|
|
return rv;
|
|
}
|
|
}
|
|
|
|
|
|
static void remove_proc_entries(ipmi_smi_t smi)
|
|
static void remove_proc_entries(ipmi_smi_t smi)
|
|
{
|
|
{
|
|
|
|
+#ifdef CONFIG_PROC_FS
|
|
struct ipmi_proc_entry *entry;
|
|
struct ipmi_proc_entry *entry;
|
|
|
|
|
|
|
|
+ spin_lock(&smi->proc_entry_lock);
|
|
while (smi->proc_entries) {
|
|
while (smi->proc_entries) {
|
|
entry = smi->proc_entries;
|
|
entry = smi->proc_entries;
|
|
smi->proc_entries = entry->next;
|
|
smi->proc_entries = entry->next;
|
|
@@ -1547,7 +1562,9 @@ static void remove_proc_entries(ipmi_smi_t smi)
|
|
kfree(entry->name);
|
|
kfree(entry->name);
|
|
kfree(entry);
|
|
kfree(entry);
|
|
}
|
|
}
|
|
|
|
+ spin_unlock(&smi->proc_entry_lock);
|
|
remove_proc_entry(smi->proc_dir_name, proc_ipmi_root);
|
|
remove_proc_entry(smi->proc_dir_name, proc_ipmi_root);
|
|
|
|
+#endif /* CONFIG_PROC_FS */
|
|
}
|
|
}
|
|
|
|
|
|
static int
|
|
static int
|
|
@@ -1694,6 +1711,9 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
|
|
new_intf->seq_table[j].seqid = 0;
|
|
new_intf->seq_table[j].seqid = 0;
|
|
}
|
|
}
|
|
new_intf->curr_seq = 0;
|
|
new_intf->curr_seq = 0;
|
|
|
|
+#ifdef CONFIG_PROC_FS
|
|
|
|
+ spin_lock_init(&(new_intf->proc_entry_lock));
|
|
|
|
+#endif
|
|
spin_lock_init(&(new_intf->waiting_msgs_lock));
|
|
spin_lock_init(&(new_intf->waiting_msgs_lock));
|
|
INIT_LIST_HEAD(&(new_intf->waiting_msgs));
|
|
INIT_LIST_HEAD(&(new_intf->waiting_msgs));
|
|
spin_lock_init(&(new_intf->events_lock));
|
|
spin_lock_init(&(new_intf->events_lock));
|
|
@@ -3085,6 +3105,7 @@ static int ipmi_init_msghandler(void)
|
|
ipmi_interfaces[i] = NULL;
|
|
ipmi_interfaces[i] = NULL;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#ifdef CONFIG_PROC_FS
|
|
proc_ipmi_root = proc_mkdir("ipmi", NULL);
|
|
proc_ipmi_root = proc_mkdir("ipmi", NULL);
|
|
if (!proc_ipmi_root) {
|
|
if (!proc_ipmi_root) {
|
|
printk(KERN_ERR PFX "Unable to create IPMI proc dir");
|
|
printk(KERN_ERR PFX "Unable to create IPMI proc dir");
|
|
@@ -3092,6 +3113,7 @@ static int ipmi_init_msghandler(void)
|
|
}
|
|
}
|
|
|
|
|
|
proc_ipmi_root->owner = THIS_MODULE;
|
|
proc_ipmi_root->owner = THIS_MODULE;
|
|
|
|
+#endif /* CONFIG_PROC_FS */
|
|
|
|
|
|
init_timer(&ipmi_timer);
|
|
init_timer(&ipmi_timer);
|
|
ipmi_timer.data = 0;
|
|
ipmi_timer.data = 0;
|
|
@@ -3129,7 +3151,9 @@ static __exit void cleanup_ipmi(void)
|
|
atomic_inc(&stop_operation);
|
|
atomic_inc(&stop_operation);
|
|
del_timer_sync(&ipmi_timer);
|
|
del_timer_sync(&ipmi_timer);
|
|
|
|
|
|
|
|
+#ifdef CONFIG_PROC_FS
|
|
remove_proc_entry(proc_ipmi_root->name, &proc_root);
|
|
remove_proc_entry(proc_ipmi_root->name, &proc_root);
|
|
|
|
+#endif /* CONFIG_PROC_FS */
|
|
|
|
|
|
initialized = 0;
|
|
initialized = 0;
|
|
|
|
|
|
@@ -3170,4 +3194,5 @@ EXPORT_SYMBOL(ipmi_get_my_address);
|
|
EXPORT_SYMBOL(ipmi_set_my_LUN);
|
|
EXPORT_SYMBOL(ipmi_set_my_LUN);
|
|
EXPORT_SYMBOL(ipmi_get_my_LUN);
|
|
EXPORT_SYMBOL(ipmi_get_my_LUN);
|
|
EXPORT_SYMBOL(ipmi_smi_add_proc_entry);
|
|
EXPORT_SYMBOL(ipmi_smi_add_proc_entry);
|
|
|
|
+EXPORT_SYMBOL(proc_ipmi_root);
|
|
EXPORT_SYMBOL(ipmi_user_set_run_to_completion);
|
|
EXPORT_SYMBOL(ipmi_user_set_run_to_completion);
|