Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull VFS updates from Al Viro, Misc cleanups all over the place, mainly wrt /proc interfaces (switch create_proc_entry to proc_create(), get rid of the deprecated create_proc_read_entry() in favor of using proc_create_data() and seq_file etc). 7kloc removed. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (204 commits) don't bother with deferred freeing of fdtables proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h proc: Make the PROC_I() and PDE() macros internal to procfs proc: Supply a function to remove a proc entry by PDE take cgroup_open() and cpuset_open() to fs/proc/base.c ppc: Clean up scanlog ppc: Clean up rtas_flash driver somewhat hostap: proc: Use remove_proc_subtree() drm: proc: Use remove_proc_subtree() drm: proc: Use minor->index to label things, not PDE->name drm: Constify drm_proc_list[] zoran: Don't print proc_dir_entry data in debug reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show() proc: Supply an accessor for getting the data from a PDE's parent airo: Use remove_proc_subtree() rtl8192u: Don't need to save device proc dir PDE rtl8187se: Use a dir under /proc/net/r8180/ proc: Add proc_mkdir_data() proc: Move some bits from linux/proc_fs.h to linux/{of.h,signal.h,tty.h} proc: Move PDE_NET() to fs/proc/proc_net.c ...
This commit is contained in:
commit
20b4fb4852
385 changed files with 7446 additions and 14590 deletions
|
@ -51,13 +51,11 @@ MODULE_LICENSE("GPL");
|
||||||
typedef struct _srm_env {
|
typedef struct _srm_env {
|
||||||
char *name;
|
char *name;
|
||||||
unsigned long id;
|
unsigned long id;
|
||||||
struct proc_dir_entry *proc_entry;
|
|
||||||
} srm_env_t;
|
} srm_env_t;
|
||||||
|
|
||||||
static struct proc_dir_entry *base_dir;
|
static struct proc_dir_entry *base_dir;
|
||||||
static struct proc_dir_entry *named_dir;
|
static struct proc_dir_entry *named_dir;
|
||||||
static struct proc_dir_entry *numbered_dir;
|
static struct proc_dir_entry *numbered_dir;
|
||||||
static char number[256][4];
|
|
||||||
|
|
||||||
static srm_env_t srm_named_entries[] = {
|
static srm_env_t srm_named_entries[] = {
|
||||||
{ "auto_action", ENV_AUTO_ACTION },
|
{ "auto_action", ENV_AUTO_ACTION },
|
||||||
|
@ -77,21 +75,18 @@ static srm_env_t srm_named_entries[] = {
|
||||||
{ "tty_dev", ENV_TTY_DEV },
|
{ "tty_dev", ENV_TTY_DEV },
|
||||||
{ NULL, 0 },
|
{ NULL, 0 },
|
||||||
};
|
};
|
||||||
static srm_env_t srm_numbered_entries[256];
|
|
||||||
|
|
||||||
|
|
||||||
static int srm_env_proc_show(struct seq_file *m, void *v)
|
static int srm_env_proc_show(struct seq_file *m, void *v)
|
||||||
{
|
{
|
||||||
unsigned long ret;
|
unsigned long ret;
|
||||||
srm_env_t *entry;
|
unsigned long id = (unsigned long)m->private;
|
||||||
char *page;
|
char *page;
|
||||||
|
|
||||||
entry = m->private;
|
|
||||||
page = (char *)__get_free_page(GFP_USER);
|
page = (char *)__get_free_page(GFP_USER);
|
||||||
if (!page)
|
if (!page)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
ret = callback_getenv(entry->id, page, PAGE_SIZE);
|
ret = callback_getenv(id, page, PAGE_SIZE);
|
||||||
|
|
||||||
if ((ret >> 61) == 0) {
|
if ((ret >> 61) == 0) {
|
||||||
seq_write(m, page, ret);
|
seq_write(m, page, ret);
|
||||||
|
@ -104,14 +99,14 @@ static int srm_env_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int srm_env_proc_open(struct inode *inode, struct file *file)
|
static int srm_env_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, srm_env_proc_show, PDE(inode)->data);
|
return single_open(file, srm_env_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t srm_env_proc_write(struct file *file, const char __user *buffer,
|
static ssize_t srm_env_proc_write(struct file *file, const char __user *buffer,
|
||||||
size_t count, loff_t *pos)
|
size_t count, loff_t *pos)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
srm_env_t *entry = PDE(file_inode(file))->data;
|
unsigned long id = (unsigned long)PDE_DATA(file_inode(file));
|
||||||
char *buf = (char *) __get_free_page(GFP_USER);
|
char *buf = (char *) __get_free_page(GFP_USER);
|
||||||
unsigned long ret1, ret2;
|
unsigned long ret1, ret2;
|
||||||
|
|
||||||
|
@ -127,7 +122,7 @@ static ssize_t srm_env_proc_write(struct file *file, const char __user *buffer,
|
||||||
goto out;
|
goto out;
|
||||||
buf[count] = '\0';
|
buf[count] = '\0';
|
||||||
|
|
||||||
ret1 = callback_setenv(entry->id, buf, count);
|
ret1 = callback_setenv(id, buf, count);
|
||||||
if ((ret1 >> 61) == 0) {
|
if ((ret1 >> 61) == 0) {
|
||||||
do
|
do
|
||||||
ret2 = callback_save_env();
|
ret2 = callback_save_env();
|
||||||
|
@ -149,52 +144,6 @@ static const struct file_operations srm_env_proc_fops = {
|
||||||
.write = srm_env_proc_write,
|
.write = srm_env_proc_write,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
|
||||||
srm_env_cleanup(void)
|
|
||||||
{
|
|
||||||
srm_env_t *entry;
|
|
||||||
unsigned long var_num;
|
|
||||||
|
|
||||||
if (base_dir) {
|
|
||||||
/*
|
|
||||||
* Remove named entries
|
|
||||||
*/
|
|
||||||
if (named_dir) {
|
|
||||||
entry = srm_named_entries;
|
|
||||||
while (entry->name != NULL && entry->id != 0) {
|
|
||||||
if (entry->proc_entry) {
|
|
||||||
remove_proc_entry(entry->name,
|
|
||||||
named_dir);
|
|
||||||
entry->proc_entry = NULL;
|
|
||||||
}
|
|
||||||
entry++;
|
|
||||||
}
|
|
||||||
remove_proc_entry(NAMED_DIR, base_dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Remove numbered entries
|
|
||||||
*/
|
|
||||||
if (numbered_dir) {
|
|
||||||
for (var_num = 0; var_num <= 255; var_num++) {
|
|
||||||
entry = &srm_numbered_entries[var_num];
|
|
||||||
|
|
||||||
if (entry->proc_entry) {
|
|
||||||
remove_proc_entry(entry->name,
|
|
||||||
numbered_dir);
|
|
||||||
entry->proc_entry = NULL;
|
|
||||||
entry->name = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
remove_proc_entry(NUMBERED_DIR, base_dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
remove_proc_entry(BASE_DIR, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int __init
|
static int __init
|
||||||
srm_env_init(void)
|
srm_env_init(void)
|
||||||
{
|
{
|
||||||
|
@ -212,12 +161,6 @@ srm_env_init(void)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Init numbers
|
|
||||||
*/
|
|
||||||
for (var_num = 0; var_num <= 255; var_num++)
|
|
||||||
sprintf(number[var_num], "%ld", var_num);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create base directory
|
* Create base directory
|
||||||
*/
|
*/
|
||||||
|
@ -225,7 +168,7 @@ srm_env_init(void)
|
||||||
if (!base_dir) {
|
if (!base_dir) {
|
||||||
printk(KERN_ERR "Couldn't create base dir /proc/%s\n",
|
printk(KERN_ERR "Couldn't create base dir /proc/%s\n",
|
||||||
BASE_DIR);
|
BASE_DIR);
|
||||||
goto cleanup;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -254,9 +197,8 @@ srm_env_init(void)
|
||||||
*/
|
*/
|
||||||
entry = srm_named_entries;
|
entry = srm_named_entries;
|
||||||
while (entry->name && entry->id) {
|
while (entry->name && entry->id) {
|
||||||
entry->proc_entry = proc_create_data(entry->name, 0644, named_dir,
|
if (!proc_create_data(entry->name, 0644, named_dir,
|
||||||
&srm_env_proc_fops, entry);
|
&srm_env_proc_fops, (void *)entry->id))
|
||||||
if (!entry->proc_entry)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
entry++;
|
entry++;
|
||||||
}
|
}
|
||||||
|
@ -265,15 +207,11 @@ srm_env_init(void)
|
||||||
* Create all numbered nodes
|
* Create all numbered nodes
|
||||||
*/
|
*/
|
||||||
for (var_num = 0; var_num <= 255; var_num++) {
|
for (var_num = 0; var_num <= 255; var_num++) {
|
||||||
entry = &srm_numbered_entries[var_num];
|
char name[4];
|
||||||
entry->name = number[var_num];
|
sprintf(name, "%ld", var_num);
|
||||||
|
if (!proc_create_data(name, 0644, numbered_dir,
|
||||||
entry->proc_entry = proc_create_data(entry->name, 0644, numbered_dir,
|
&srm_env_proc_fops, (void *)var_num))
|
||||||
&srm_env_proc_fops, entry);
|
|
||||||
if (!entry->proc_entry)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
entry->id = var_num;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_INFO "%s: version %s loaded successfully\n", NAME,
|
printk(KERN_INFO "%s: version %s loaded successfully\n", NAME,
|
||||||
|
@ -282,18 +220,15 @@ srm_env_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
srm_env_cleanup();
|
remove_proc_subtree(BASE_DIR, NULL);
|
||||||
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit
|
static void __exit
|
||||||
srm_env_exit(void)
|
srm_env_exit(void)
|
||||||
{
|
{
|
||||||
srm_env_cleanup();
|
remove_proc_subtree(BASE_DIR, NULL);
|
||||||
printk(KERN_INFO "%s: unloaded successfully\n", NAME);
|
printk(KERN_INFO "%s: unloaded successfully\n", NAME);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(srm_env_init);
|
module_init(srm_env_init);
|
||||||
|
|
|
@ -9,24 +9,18 @@ struct buffer {
|
||||||
char data[];
|
char data[];
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static ssize_t atags_read(struct file *file, char __user *buf,
|
||||||
read_buffer(char* page, char** start, off_t off, int count,
|
size_t count, loff_t *ppos)
|
||||||
int* eof, void* data)
|
|
||||||
{
|
{
|
||||||
struct buffer *buffer = (struct buffer *)data;
|
struct buffer *b = PDE_DATA(file_inode(file));
|
||||||
|
return simple_read_from_buffer(buf, count, ppos, b->data, b->size);
|
||||||
if (off >= buffer->size) {
|
|
||||||
*eof = 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
count = min((int) (buffer->size - off), count);
|
|
||||||
|
|
||||||
memcpy(page, &buffer->data[off], count);
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct file_operations atags_fops = {
|
||||||
|
.read = atags_read,
|
||||||
|
.llseek = default_llseek,
|
||||||
|
};
|
||||||
|
|
||||||
#define BOOT_PARAMS_SIZE 1536
|
#define BOOT_PARAMS_SIZE 1536
|
||||||
static char __initdata atags_copy[BOOT_PARAMS_SIZE];
|
static char __initdata atags_copy[BOOT_PARAMS_SIZE];
|
||||||
|
|
||||||
|
@ -66,9 +60,7 @@ static int __init init_atags_procfs(void)
|
||||||
b->size = size;
|
b->size = size;
|
||||||
memcpy(b->data, atags_copy, size);
|
memcpy(b->data, atags_copy, size);
|
||||||
|
|
||||||
tags_entry = create_proc_read_entry("atags", 0400,
|
tags_entry = proc_create_data("atags", 0400, NULL, &atags_fops, b);
|
||||||
NULL, read_buffer, b);
|
|
||||||
|
|
||||||
if (!tags_entry)
|
if (!tags_entry)
|
||||||
goto nomem;
|
goto nomem;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/syscalls.h>
|
#include <linux/syscalls.h>
|
||||||
#include <linux/perf_event.h>
|
#include <linux/perf_event.h>
|
||||||
|
@ -79,27 +80,27 @@ static unsigned long abtcounter;
|
||||||
static pid_t previous_pid;
|
static pid_t previous_pid;
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
static int proc_read_status(char *page, char **start, off_t off, int count,
|
static int proc_status_show(struct seq_file *m, void *v)
|
||||||
int *eof, void *data)
|
|
||||||
{
|
{
|
||||||
char *p = page;
|
seq_printf(m, "Emulated SWP:\t\t%lu\n", swpcounter);
|
||||||
int len;
|
seq_printf(m, "Emulated SWPB:\t\t%lu\n", swpbcounter);
|
||||||
|
seq_printf(m, "Aborted SWP{B}:\t\t%lu\n", abtcounter);
|
||||||
p += sprintf(p, "Emulated SWP:\t\t%lu\n", swpcounter);
|
|
||||||
p += sprintf(p, "Emulated SWPB:\t\t%lu\n", swpbcounter);
|
|
||||||
p += sprintf(p, "Aborted SWP{B}:\t\t%lu\n", abtcounter);
|
|
||||||
if (previous_pid != 0)
|
if (previous_pid != 0)
|
||||||
p += sprintf(p, "Last process:\t\t%d\n", previous_pid);
|
seq_printf(m, "Last process:\t\t%d\n", previous_pid);
|
||||||
|
return 0;
|
||||||
len = (p - page) - off;
|
|
||||||
if (len < 0)
|
|
||||||
len = 0;
|
|
||||||
|
|
||||||
*eof = (len <= count) ? 1 : 0;
|
|
||||||
*start = page + off;
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int proc_status_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, proc_status_show, PDE_DATA(inode));
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations proc_status_fops = {
|
||||||
|
.open = proc_status_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -266,14 +267,8 @@ static struct undef_hook swp_hook = {
|
||||||
static int __init swp_emulation_init(void)
|
static int __init swp_emulation_init(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
struct proc_dir_entry *res;
|
if (!proc_create("cpu/swp_emulation", S_IRUGO, NULL, &proc_status_fops))
|
||||||
|
|
||||||
res = create_proc_entry("cpu/swp_emulation", S_IRUGO, NULL);
|
|
||||||
|
|
||||||
if (!res)
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
res->read_proc = proc_read_status;
|
|
||||||
#endif /* CONFIG_PROC_FS */
|
#endif /* CONFIG_PROC_FS */
|
||||||
|
|
||||||
printk(KERN_NOTICE "Registering SWP/SWPB emulation handler\n");
|
printk(KERN_NOTICE "Registering SWP/SWPB emulation handler\n");
|
||||||
|
|
|
@ -31,20 +31,8 @@ extern void *smem_item(unsigned id, unsigned *size);
|
||||||
static ssize_t last_radio_log_read(struct file *file, char __user *buf,
|
static ssize_t last_radio_log_read(struct file *file, char __user *buf,
|
||||||
size_t len, loff_t *offset)
|
size_t len, loff_t *offset)
|
||||||
{
|
{
|
||||||
loff_t pos = *offset;
|
return simple_read_from_buffer(buf, len, offset,
|
||||||
ssize_t count;
|
radio_log_base, radio_log_size);
|
||||||
|
|
||||||
if (pos >= radio_log_size)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
count = min(len, (size_t)(radio_log_size - pos));
|
|
||||||
if (copy_to_user(buf, radio_log_base + pos, count)) {
|
|
||||||
pr_err("%s: copy to user failed\n", __func__);
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
*offset += count;
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct file_operations last_radio_log_fops = {
|
static struct file_operations last_radio_log_fops = {
|
||||||
|
@ -67,7 +55,8 @@ void msm_init_last_radio_log(struct module *owner)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = create_proc_entry("last_radio_log", S_IFREG | S_IRUGO, NULL);
|
entry = proc_create("last_radio_log", S_IRUGO, NULL,
|
||||||
|
&last_radio_log_fops);
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
pr_err("%s: could not create proc entry for radio log\n",
|
pr_err("%s: could not create proc entry for radio log\n",
|
||||||
__func__);
|
__func__);
|
||||||
|
@ -77,7 +66,6 @@ void msm_init_last_radio_log(struct module *owner)
|
||||||
pr_err("%s: last radio log is %d bytes long\n", __func__,
|
pr_err("%s: last radio log is %d bytes long\n", __func__,
|
||||||
radio_log_size);
|
radio_log_size);
|
||||||
last_radio_log_fops.owner = owner;
|
last_radio_log_fops.owner = owner;
|
||||||
entry->proc_fops = &last_radio_log_fops;
|
|
||||||
entry->size = radio_log_size;
|
entry->size = radio_log_size;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(msm_init_last_radio_log);
|
EXPORT_SYMBOL(msm_init_last_radio_log);
|
||||||
|
|
|
@ -37,7 +37,8 @@
|
||||||
|
|
||||||
#include <linux/suspend.h>
|
#include <linux/suspend.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/debugfs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/sysfs.h>
|
#include <linux/sysfs.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
@ -423,23 +424,12 @@ void omap1_pm_suspend(void)
|
||||||
omap_rev());
|
omap_rev());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DEBUG) && defined(CONFIG_PROC_FS)
|
#ifdef CONFIG_DEBUG_FS
|
||||||
static int g_read_completed;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read system PM registers for debugging
|
* Read system PM registers for debugging
|
||||||
*/
|
*/
|
||||||
static int omap_pm_read_proc(
|
static int omap_pm_debug_show(struct seq_file *m, void *v)
|
||||||
char *page_buffer,
|
|
||||||
char **my_first_byte,
|
|
||||||
off_t virtual_start,
|
|
||||||
int length,
|
|
||||||
int *eof,
|
|
||||||
void *data)
|
|
||||||
{
|
{
|
||||||
int my_buffer_offset = 0;
|
|
||||||
char * const my_base = page_buffer;
|
|
||||||
|
|
||||||
ARM_SAVE(ARM_CKCTL);
|
ARM_SAVE(ARM_CKCTL);
|
||||||
ARM_SAVE(ARM_IDLECT1);
|
ARM_SAVE(ARM_IDLECT1);
|
||||||
ARM_SAVE(ARM_IDLECT2);
|
ARM_SAVE(ARM_IDLECT2);
|
||||||
|
@ -480,10 +470,7 @@ static int omap_pm_read_proc(
|
||||||
MPUI1610_SAVE(EMIFS_CONFIG);
|
MPUI1610_SAVE(EMIFS_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virtual_start == 0) {
|
seq_printf(m,
|
||||||
g_read_completed = 0;
|
|
||||||
|
|
||||||
my_buffer_offset += sprintf(my_base + my_buffer_offset,
|
|
||||||
"ARM_CKCTL_REG: 0x%-8x \n"
|
"ARM_CKCTL_REG: 0x%-8x \n"
|
||||||
"ARM_IDLECT1_REG: 0x%-8x \n"
|
"ARM_IDLECT1_REG: 0x%-8x \n"
|
||||||
"ARM_IDLECT2_REG: 0x%-8x \n"
|
"ARM_IDLECT2_REG: 0x%-8x \n"
|
||||||
|
@ -513,8 +500,8 @@ static int omap_pm_read_proc(
|
||||||
ULPD_SHOW(ULPD_STATUS_REQ),
|
ULPD_SHOW(ULPD_STATUS_REQ),
|
||||||
ULPD_SHOW(ULPD_POWER_CTRL));
|
ULPD_SHOW(ULPD_POWER_CTRL));
|
||||||
|
|
||||||
if (cpu_is_omap7xx()) {
|
if (cpu_is_omap7xx()) {
|
||||||
my_buffer_offset += sprintf(my_base + my_buffer_offset,
|
seq_printf(m,
|
||||||
"MPUI7XX_CTRL_REG 0x%-8x \n"
|
"MPUI7XX_CTRL_REG 0x%-8x \n"
|
||||||
"MPUI7XX_DSP_STATUS_REG: 0x%-8x \n"
|
"MPUI7XX_DSP_STATUS_REG: 0x%-8x \n"
|
||||||
"MPUI7XX_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
|
"MPUI7XX_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
|
||||||
|
@ -527,8 +514,8 @@ static int omap_pm_read_proc(
|
||||||
MPUI7XX_SHOW(MPUI_DSP_API_CONFIG),
|
MPUI7XX_SHOW(MPUI_DSP_API_CONFIG),
|
||||||
MPUI7XX_SHOW(EMIFF_SDRAM_CONFIG),
|
MPUI7XX_SHOW(EMIFF_SDRAM_CONFIG),
|
||||||
MPUI7XX_SHOW(EMIFS_CONFIG));
|
MPUI7XX_SHOW(EMIFS_CONFIG));
|
||||||
} else if (cpu_is_omap15xx()) {
|
} else if (cpu_is_omap15xx()) {
|
||||||
my_buffer_offset += sprintf(my_base + my_buffer_offset,
|
seq_printf(m,
|
||||||
"MPUI1510_CTRL_REG 0x%-8x \n"
|
"MPUI1510_CTRL_REG 0x%-8x \n"
|
||||||
"MPUI1510_DSP_STATUS_REG: 0x%-8x \n"
|
"MPUI1510_DSP_STATUS_REG: 0x%-8x \n"
|
||||||
"MPUI1510_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
|
"MPUI1510_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
|
||||||
|
@ -541,8 +528,8 @@ static int omap_pm_read_proc(
|
||||||
MPUI1510_SHOW(MPUI_DSP_API_CONFIG),
|
MPUI1510_SHOW(MPUI_DSP_API_CONFIG),
|
||||||
MPUI1510_SHOW(EMIFF_SDRAM_CONFIG),
|
MPUI1510_SHOW(EMIFF_SDRAM_CONFIG),
|
||||||
MPUI1510_SHOW(EMIFS_CONFIG));
|
MPUI1510_SHOW(EMIFS_CONFIG));
|
||||||
} else if (cpu_is_omap16xx()) {
|
} else if (cpu_is_omap16xx()) {
|
||||||
my_buffer_offset += sprintf(my_base + my_buffer_offset,
|
seq_printf(m,
|
||||||
"MPUI1610_CTRL_REG 0x%-8x \n"
|
"MPUI1610_CTRL_REG 0x%-8x \n"
|
||||||
"MPUI1610_DSP_STATUS_REG: 0x%-8x \n"
|
"MPUI1610_DSP_STATUS_REG: 0x%-8x \n"
|
||||||
"MPUI1610_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
|
"MPUI1610_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
|
||||||
|
@ -555,28 +542,37 @@ static int omap_pm_read_proc(
|
||||||
MPUI1610_SHOW(MPUI_DSP_API_CONFIG),
|
MPUI1610_SHOW(MPUI_DSP_API_CONFIG),
|
||||||
MPUI1610_SHOW(EMIFF_SDRAM_CONFIG),
|
MPUI1610_SHOW(EMIFF_SDRAM_CONFIG),
|
||||||
MPUI1610_SHOW(EMIFS_CONFIG));
|
MPUI1610_SHOW(EMIFS_CONFIG));
|
||||||
}
|
|
||||||
|
|
||||||
g_read_completed++;
|
|
||||||
} else if (g_read_completed >= 1) {
|
|
||||||
*eof = 1;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
g_read_completed++;
|
|
||||||
|
|
||||||
*my_first_byte = page_buffer;
|
return 0;
|
||||||
return my_buffer_offset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void omap_pm_init_proc(void)
|
static int omap_pm_debug_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
/* XXX Appears to leak memory */
|
return single_open(file, omap_pm_debug_show,
|
||||||
create_proc_read_entry("driver/omap_pm",
|
&inode->i_private);
|
||||||
S_IWUSR | S_IRUGO, NULL,
|
|
||||||
omap_pm_read_proc, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* DEBUG && CONFIG_PROC_FS */
|
static const struct file_operations omap_pm_debug_fops = {
|
||||||
|
.open = omap_pm_debug_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void omap_pm_init_debugfs(void)
|
||||||
|
{
|
||||||
|
struct dentry *d;
|
||||||
|
|
||||||
|
d = debugfs_create_dir("pm_debug", NULL);
|
||||||
|
if (!d)
|
||||||
|
return;
|
||||||
|
|
||||||
|
(void) debugfs_create_file("omap_pm", S_IWUSR | S_IRUGO,
|
||||||
|
d, NULL, &omap_pm_debug_fops);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_DEBUG_FS */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* omap_pm_prepare - Do preliminary suspend work.
|
* omap_pm_prepare - Do preliminary suspend work.
|
||||||
|
@ -701,8 +697,8 @@ static int __init omap_pm_init(void)
|
||||||
|
|
||||||
suspend_set_ops(&omap_pm_ops);
|
suspend_set_ops(&omap_pm_ops);
|
||||||
|
|
||||||
#if defined(DEBUG) && defined(CONFIG_PROC_FS)
|
#ifdef CONFIG_DEBUG_FS
|
||||||
omap_pm_init_proc();
|
omap_pm_init_debugfs();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_OMAP_32K_TIMER
|
#ifdef CONFIG_OMAP_32K_TIMER
|
||||||
|
|
|
@ -116,14 +116,12 @@ static const struct seq_operations cplbinfo_sops = {
|
||||||
|
|
||||||
static int cplbinfo_open(struct inode *inode, struct file *file)
|
static int cplbinfo_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *pde = PDE(file_inode(file));
|
|
||||||
char cplb_type;
|
char cplb_type;
|
||||||
unsigned int cpu;
|
unsigned int cpu = (unsigned long)PDE_DATA(file_inode(file));
|
||||||
int ret;
|
int ret;
|
||||||
struct seq_file *m;
|
struct seq_file *m;
|
||||||
struct cplbinfo_data *cdata;
|
struct cplbinfo_data *cdata;
|
||||||
|
|
||||||
cpu = (unsigned int)pde->data;
|
|
||||||
cplb_type = cpu & CPLBINFO_DCPLB_FLAG ? 'D' : 'I';
|
cplb_type = cpu & CPLBINFO_DCPLB_FLAG ? 'D' : 'I';
|
||||||
cpu &= ~CPLBINFO_DCPLB_FLAG;
|
cpu &= ~CPLBINFO_DCPLB_FLAG;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <arch/svinto.h>
|
#include <arch/svinto.h>
|
||||||
#include <asm/fasttimer.h>
|
#include <asm/fasttimer.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
|
|
||||||
|
|
||||||
#define DEBUG_LOG_INCLUDED
|
#define DEBUG_LOG_INCLUDED
|
||||||
|
@ -489,197 +490,162 @@ void schedule_usleep(unsigned long us)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
|
|
||||||
,int *eof, void *data_unused);
|
|
||||||
static struct proc_dir_entry *fasttimer_proc_entry;
|
|
||||||
#endif /* CONFIG_PROC_FS */
|
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
|
||||||
|
|
||||||
/* This value is very much based on testing */
|
/* This value is very much based on testing */
|
||||||
#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300)
|
#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300)
|
||||||
|
|
||||||
static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
|
static int proc_fasttimer_show(struct seq_file *m, void *v)
|
||||||
,int *eof, void *data_unused)
|
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int num_to_show;
|
int num_to_show;
|
||||||
struct fasttime_t tv;
|
struct fasttime_t tv;
|
||||||
struct fast_timer *t, *nextt;
|
struct fast_timer *t, *nextt;
|
||||||
static char *bigbuf = NULL;
|
|
||||||
static unsigned long used;
|
|
||||||
|
|
||||||
if (!bigbuf && !(bigbuf = vmalloc(BIG_BUF_SIZE)))
|
do_gettimeofday_fast(&tv);
|
||||||
{
|
|
||||||
used = 0;
|
|
||||||
if (buf)
|
|
||||||
buf[0] = '\0';
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!offset || !used)
|
seq_printf(m, "Fast timers added: %i\n", fast_timers_added);
|
||||||
{
|
seq_printf(m, "Fast timers started: %i\n", fast_timers_started);
|
||||||
do_gettimeofday_fast(&tv);
|
seq_printf(m, "Fast timer interrupts: %i\n", fast_timer_ints);
|
||||||
|
seq_printf(m, "Fast timers expired: %i\n", fast_timers_expired);
|
||||||
used = 0;
|
seq_printf(m, "Fast timers deleted: %i\n", fast_timers_deleted);
|
||||||
used += sprintf(bigbuf + used, "Fast timers added: %i\n",
|
seq_printf(m, "Fast timer running: %s\n",
|
||||||
fast_timers_added);
|
fast_timer_running ? "yes" : "no");
|
||||||
used += sprintf(bigbuf + used, "Fast timers started: %i\n",
|
seq_printf(m, "Current time: %lu.%06lu\n",
|
||||||
fast_timers_started);
|
(unsigned long)tv.tv_jiff,
|
||||||
used += sprintf(bigbuf + used, "Fast timer interrupts: %i\n",
|
(unsigned long)tv.tv_usec);
|
||||||
fast_timer_ints);
|
|
||||||
used += sprintf(bigbuf + used, "Fast timers expired: %i\n",
|
|
||||||
fast_timers_expired);
|
|
||||||
used += sprintf(bigbuf + used, "Fast timers deleted: %i\n",
|
|
||||||
fast_timers_deleted);
|
|
||||||
used += sprintf(bigbuf + used, "Fast timer running: %s\n",
|
|
||||||
fast_timer_running ? "yes" : "no");
|
|
||||||
used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n",
|
|
||||||
(unsigned long)tv.tv_jiff,
|
|
||||||
(unsigned long)tv.tv_usec);
|
|
||||||
#ifdef FAST_TIMER_SANITY_CHECKS
|
#ifdef FAST_TIMER_SANITY_CHECKS
|
||||||
used += sprintf(bigbuf + used, "Sanity failed: %i\n",
|
seq_printf(m, "Sanity failed: %i\n", sanity_failed);
|
||||||
sanity_failed);
|
|
||||||
#endif
|
#endif
|
||||||
used += sprintf(bigbuf + used, "\n");
|
seq_putc(m, '\n');
|
||||||
|
|
||||||
#ifdef DEBUG_LOG_INCLUDED
|
#ifdef DEBUG_LOG_INCLUDED
|
||||||
{
|
{
|
||||||
int end_i = debug_log_cnt;
|
int end_i = debug_log_cnt;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
if (debug_log_cnt_wrapped)
|
if (debug_log_cnt_wrapped)
|
||||||
{
|
i = debug_log_cnt;
|
||||||
i = debug_log_cnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((i != end_i || (debug_log_cnt_wrapped && !used)) &&
|
while (i != end_i || debug_log_cnt_wrapped) {
|
||||||
used+100 < BIG_BUF_SIZE)
|
if (seq_printf(m, debug_log_string[i], debug_log_value[i]) < 0)
|
||||||
{
|
return 0;
|
||||||
used += sprintf(bigbuf + used, debug_log_string[i],
|
i = (i+1) % DEBUG_LOG_MAX;
|
||||||
debug_log_value[i]);
|
}
|
||||||
i = (i+1) % DEBUG_LOG_MAX;
|
}
|
||||||
}
|
seq_putc(m, '\n');
|
||||||
}
|
|
||||||
used += sprintf(bigbuf + used, "\n");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started:
|
num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started:
|
||||||
NUM_TIMER_STATS);
|
NUM_TIMER_STATS);
|
||||||
used += sprintf(bigbuf + used, "Timers started: %i\n", fast_timers_started);
|
seq_printf(m, "Timers started: %i\n", fast_timers_started);
|
||||||
for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE) ; i++)
|
for (i = 0; i < num_to_show; i++) {
|
||||||
{
|
int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
|
||||||
int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
|
|
||||||
|
|
||||||
#if 1 //ndef FAST_TIMER_LOG
|
#if 1 //ndef FAST_TIMER_LOG
|
||||||
used += sprintf(bigbuf + used, "div: %i freq: %i delay: %i"
|
seq_printf(m, "div: %i freq: %i delay: %i"
|
||||||
"\n",
|
"\n",
|
||||||
timer_div_settings[cur],
|
timer_div_settings[cur],
|
||||||
timer_freq_settings[cur],
|
timer_freq_settings[cur],
|
||||||
timer_delay_settings[cur]
|
timer_delay_settings[cur]);
|
||||||
);
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef FAST_TIMER_LOG
|
#ifdef FAST_TIMER_LOG
|
||||||
t = &timer_started_log[cur];
|
t = &timer_started_log[cur];
|
||||||
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
|
if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
|
||||||
"d: %6li us data: 0x%08lX"
|
"d: %6li us data: 0x%08lX"
|
||||||
"\n",
|
"\n",
|
||||||
t->name,
|
t->name,
|
||||||
(unsigned long)t->tv_set.tv_jiff,
|
(unsigned long)t->tv_set.tv_jiff,
|
||||||
(unsigned long)t->tv_set.tv_usec,
|
(unsigned long)t->tv_set.tv_usec,
|
||||||
(unsigned long)t->tv_expires.tv_jiff,
|
(unsigned long)t->tv_expires.tv_jiff,
|
||||||
(unsigned long)t->tv_expires.tv_usec,
|
(unsigned long)t->tv_expires.tv_usec,
|
||||||
t->delay_us,
|
t->delay_us,
|
||||||
t->data
|
t->data) < 0)
|
||||||
);
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
used += sprintf(bigbuf + used, "\n");
|
seq_putc(m, '\n');
|
||||||
|
|
||||||
#ifdef FAST_TIMER_LOG
|
#ifdef FAST_TIMER_LOG
|
||||||
num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added:
|
num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added:
|
||||||
NUM_TIMER_STATS);
|
NUM_TIMER_STATS);
|
||||||
used += sprintf(bigbuf + used, "Timers added: %i\n", fast_timers_added);
|
seq_printf(m, "Timers added: %i\n", fast_timers_added);
|
||||||
for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++)
|
for (i = 0; i < num_to_show; i++) {
|
||||||
{
|
t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS];
|
||||||
t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS];
|
if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
|
||||||
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
|
"d: %6li us data: 0x%08lX"
|
||||||
"d: %6li us data: 0x%08lX"
|
"\n",
|
||||||
"\n",
|
t->name,
|
||||||
t->name,
|
(unsigned long)t->tv_set.tv_jiff,
|
||||||
(unsigned long)t->tv_set.tv_jiff,
|
(unsigned long)t->tv_set.tv_usec,
|
||||||
(unsigned long)t->tv_set.tv_usec,
|
(unsigned long)t->tv_expires.tv_jiff,
|
||||||
(unsigned long)t->tv_expires.tv_jiff,
|
(unsigned long)t->tv_expires.tv_usec,
|
||||||
(unsigned long)t->tv_expires.tv_usec,
|
t->delay_us,
|
||||||
t->delay_us,
|
t->data) < 0)
|
||||||
t->data
|
return 0;
|
||||||
);
|
}
|
||||||
}
|
seq_putc(m, '\n');
|
||||||
used += sprintf(bigbuf + used, "\n");
|
|
||||||
|
|
||||||
num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired:
|
num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired:
|
||||||
NUM_TIMER_STATS);
|
NUM_TIMER_STATS);
|
||||||
used += sprintf(bigbuf + used, "Timers expired: %i\n", fast_timers_expired);
|
seq_printf(m, "Timers expired: %i\n", fast_timers_expired);
|
||||||
for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++)
|
for (i = 0; i < num_to_show; i++) {
|
||||||
{
|
t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS];
|
||||||
t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS];
|
if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
|
||||||
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
|
"d: %6li us data: 0x%08lX"
|
||||||
"d: %6li us data: 0x%08lX"
|
"\n",
|
||||||
"\n",
|
t->name,
|
||||||
t->name,
|
(unsigned long)t->tv_set.tv_jiff,
|
||||||
(unsigned long)t->tv_set.tv_jiff,
|
(unsigned long)t->tv_set.tv_usec,
|
||||||
(unsigned long)t->tv_set.tv_usec,
|
(unsigned long)t->tv_expires.tv_jiff,
|
||||||
(unsigned long)t->tv_expires.tv_jiff,
|
(unsigned long)t->tv_expires.tv_usec,
|
||||||
(unsigned long)t->tv_expires.tv_usec,
|
t->delay_us,
|
||||||
t->delay_us,
|
t->data) < 0)
|
||||||
t->data
|
return 0;
|
||||||
);
|
}
|
||||||
}
|
seq_putc(m, '\n');
|
||||||
used += sprintf(bigbuf + used, "\n");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
used += sprintf(bigbuf + used, "Active timers:\n");
|
seq_puts(m, "Active timers:\n");
|
||||||
local_irq_save(flags);
|
|
||||||
t = fast_timer_list;
|
|
||||||
while (t != NULL && (used+100 < BIG_BUF_SIZE))
|
|
||||||
{
|
|
||||||
nextt = t->next;
|
|
||||||
local_irq_restore(flags);
|
|
||||||
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
|
|
||||||
"d: %6li us data: 0x%08lX"
|
|
||||||
/* " func: 0x%08lX" */
|
|
||||||
"\n",
|
|
||||||
t->name,
|
|
||||||
(unsigned long)t->tv_set.tv_jiff,
|
|
||||||
(unsigned long)t->tv_set.tv_usec,
|
|
||||||
(unsigned long)t->tv_expires.tv_jiff,
|
|
||||||
(unsigned long)t->tv_expires.tv_usec,
|
|
||||||
t->delay_us,
|
|
||||||
t->data
|
|
||||||
/* , t->function */
|
|
||||||
);
|
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
if (t->next != nextt)
|
t = fast_timer_list;
|
||||||
{
|
while (t) {
|
||||||
printk(KERN_WARNING "timer removed!\n");
|
nextt = t->next;
|
||||||
}
|
local_irq_restore(flags);
|
||||||
t = nextt;
|
if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
|
||||||
}
|
"d: %6li us data: 0x%08lX"
|
||||||
local_irq_restore(flags);
|
/* " func: 0x%08lX" */
|
||||||
}
|
"\n",
|
||||||
|
t->name,
|
||||||
|
(unsigned long)t->tv_set.tv_jiff,
|
||||||
|
(unsigned long)t->tv_set.tv_usec,
|
||||||
|
(unsigned long)t->tv_expires.tv_jiff,
|
||||||
|
(unsigned long)t->tv_expires.tv_usec,
|
||||||
|
t->delay_us,
|
||||||
|
t->data
|
||||||
|
/* , t->function */
|
||||||
|
) < 0)
|
||||||
|
return 0;
|
||||||
|
local_irq_save(flags);
|
||||||
|
if (t->next != nextt)
|
||||||
|
printk(KERN_WARNING "timer removed!\n");
|
||||||
|
t = nextt;
|
||||||
|
}
|
||||||
|
local_irq_restore(flags);
|
||||||
|
|
||||||
if (used - offset < len)
|
return 0;
|
||||||
{
|
|
||||||
len = used - offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(buf, bigbuf + offset, len);
|
|
||||||
*start = buf;
|
|
||||||
*eof = 1;
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int proc_fasttimer_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open_size(file, proc_fasttimer_show, PDE_DATA(inode), BIG_BUF_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations proc_fasttimer_fops = {
|
||||||
|
.open = proc_fasttimer_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
#endif /* PROC_FS */
|
#endif /* PROC_FS */
|
||||||
|
|
||||||
#ifdef FAST_TIMER_TEST
|
#ifdef FAST_TIMER_TEST
|
||||||
|
@ -857,8 +823,7 @@ int fast_timer_init(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
if ((fasttimer_proc_entry = create_proc_entry( "fasttimer", 0, 0 )))
|
proc_create("fasttimer", 0, NULL, &proc_fasttimer_fops);
|
||||||
fasttimer_proc_entry->read_proc = proc_fasttimer_read;
|
|
||||||
#endif /* PROC_FS */
|
#endif /* PROC_FS */
|
||||||
if(request_irq(TIMER1_IRQ_NBR, timer1_handler, 0,
|
if(request_irq(TIMER1_IRQ_NBR, timer1_handler, 0,
|
||||||
"fast timer int", NULL))
|
"fast timer int", NULL))
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <hwregs/timer_defs.h>
|
#include <hwregs/timer_defs.h>
|
||||||
#include <asm/fasttimer.h>
|
#include <asm/fasttimer.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* timer0 is running at 100MHz and generating jiffies timer ticks
|
* timer0 is running at 100MHz and generating jiffies timer ticks
|
||||||
|
@ -463,195 +464,161 @@ void schedule_usleep(unsigned long us)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
|
|
||||||
,int *eof, void *data_unused);
|
|
||||||
static struct proc_dir_entry *fasttimer_proc_entry;
|
|
||||||
#endif /* CONFIG_PROC_FS */
|
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
|
||||||
|
|
||||||
/* This value is very much based on testing */
|
/* This value is very much based on testing */
|
||||||
#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300)
|
#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300)
|
||||||
|
|
||||||
static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
|
static int proc_fasttimer_show(struct seq_file *m, void *v)
|
||||||
,int *eof, void *data_unused)
|
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int num_to_show;
|
int num_to_show;
|
||||||
struct fasttime_t tv;
|
struct fasttime_t tv;
|
||||||
struct fast_timer *t, *nextt;
|
struct fast_timer *t, *nextt;
|
||||||
static char *bigbuf = NULL;
|
|
||||||
static unsigned long used;
|
|
||||||
|
|
||||||
if (!bigbuf) {
|
do_gettimeofday_fast(&tv);
|
||||||
bigbuf = vmalloc(BIG_BUF_SIZE);
|
|
||||||
if (!bigbuf) {
|
|
||||||
used = 0;
|
|
||||||
if (buf)
|
|
||||||
buf[0] = '\0';
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!offset || !used) {
|
seq_printf(m, "Fast timers added: %i\n", fast_timers_added);
|
||||||
do_gettimeofday_fast(&tv);
|
seq_printf(m, "Fast timers started: %i\n", fast_timers_started);
|
||||||
|
seq_printf(m, "Fast timer interrupts: %i\n", fast_timer_ints);
|
||||||
used = 0;
|
seq_printf(m, "Fast timers expired: %i\n", fast_timers_expired);
|
||||||
used += sprintf(bigbuf + used, "Fast timers added: %i\n",
|
seq_printf(m, "Fast timers deleted: %i\n", fast_timers_deleted);
|
||||||
fast_timers_added);
|
seq_printf(m, "Fast timer running: %s\n",
|
||||||
used += sprintf(bigbuf + used, "Fast timers started: %i\n",
|
fast_timer_running ? "yes" : "no");
|
||||||
fast_timers_started);
|
seq_printf(m, "Current time: %lu.%06lu\n",
|
||||||
used += sprintf(bigbuf + used, "Fast timer interrupts: %i\n",
|
(unsigned long)tv.tv_jiff,
|
||||||
fast_timer_ints);
|
(unsigned long)tv.tv_usec);
|
||||||
used += sprintf(bigbuf + used, "Fast timers expired: %i\n",
|
|
||||||
fast_timers_expired);
|
|
||||||
used += sprintf(bigbuf + used, "Fast timers deleted: %i\n",
|
|
||||||
fast_timers_deleted);
|
|
||||||
used += sprintf(bigbuf + used, "Fast timer running: %s\n",
|
|
||||||
fast_timer_running ? "yes" : "no");
|
|
||||||
used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n",
|
|
||||||
(unsigned long)tv.tv_jiff,
|
|
||||||
(unsigned long)tv.tv_usec);
|
|
||||||
#ifdef FAST_TIMER_SANITY_CHECKS
|
#ifdef FAST_TIMER_SANITY_CHECKS
|
||||||
used += sprintf(bigbuf + used, "Sanity failed: %i\n",
|
seq_printf(m, "Sanity failed: %i\n", sanity_failed);
|
||||||
sanity_failed);
|
|
||||||
#endif
|
#endif
|
||||||
used += sprintf(bigbuf + used, "\n");
|
seq_putc(m, '\n');
|
||||||
|
|
||||||
#ifdef DEBUG_LOG_INCLUDED
|
#ifdef DEBUG_LOG_INCLUDED
|
||||||
{
|
{
|
||||||
int end_i = debug_log_cnt;
|
int end_i = debug_log_cnt;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
if (debug_log_cnt_wrapped)
|
if (debug_log_cnt_wrapped)
|
||||||
i = debug_log_cnt;
|
i = debug_log_cnt;
|
||||||
|
|
||||||
while ((i != end_i || (debug_log_cnt_wrapped && !used)) &&
|
while ((i != end_i || debug_log_cnt_wrapped)) {
|
||||||
used+100 < BIG_BUF_SIZE)
|
if (seq_printf(m, debug_log_string[i], debug_log_value[i]) < 0)
|
||||||
{
|
return 0;
|
||||||
used += sprintf(bigbuf + used, debug_log_string[i],
|
i = (i+1) % DEBUG_LOG_MAX;
|
||||||
debug_log_value[i]);
|
}
|
||||||
i = (i+1) % DEBUG_LOG_MAX;
|
}
|
||||||
}
|
seq_putc(m, '\n');
|
||||||
}
|
|
||||||
used += sprintf(bigbuf + used, "\n");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started:
|
num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started:
|
||||||
NUM_TIMER_STATS);
|
NUM_TIMER_STATS);
|
||||||
used += sprintf(bigbuf + used, "Timers started: %i\n", fast_timers_started);
|
seq_printf(m, "Timers started: %i\n", fast_timers_started);
|
||||||
for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE) ; i++)
|
for (i = 0; i < num_to_show; i++) {
|
||||||
{
|
int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
|
||||||
int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
|
|
||||||
|
|
||||||
#if 1 //ndef FAST_TIMER_LOG
|
#if 1 //ndef FAST_TIMER_LOG
|
||||||
used += sprintf(bigbuf + used, "div: %i delay: %i"
|
seq_printf(m, "div: %i delay: %i"
|
||||||
"\n",
|
"\n",
|
||||||
timer_div_settings[cur],
|
timer_div_settings[cur],
|
||||||
timer_delay_settings[cur]
|
timer_delay_settings[cur]);
|
||||||
);
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef FAST_TIMER_LOG
|
#ifdef FAST_TIMER_LOG
|
||||||
t = &timer_started_log[cur];
|
t = &timer_started_log[cur];
|
||||||
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
|
if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
|
||||||
"d: %6li us data: 0x%08lX"
|
"d: %6li us data: 0x%08lX"
|
||||||
"\n",
|
"\n",
|
||||||
t->name,
|
t->name,
|
||||||
(unsigned long)t->tv_set.tv_jiff,
|
(unsigned long)t->tv_set.tv_jiff,
|
||||||
(unsigned long)t->tv_set.tv_usec,
|
(unsigned long)t->tv_set.tv_usec,
|
||||||
(unsigned long)t->tv_expires.tv_jiff,
|
(unsigned long)t->tv_expires.tv_jiff,
|
||||||
(unsigned long)t->tv_expires.tv_usec,
|
(unsigned long)t->tv_expires.tv_usec,
|
||||||
t->delay_us,
|
t->delay_us,
|
||||||
t->data
|
t->data) < 0)
|
||||||
);
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
used += sprintf(bigbuf + used, "\n");
|
seq_putc(m, '\n');
|
||||||
|
|
||||||
#ifdef FAST_TIMER_LOG
|
#ifdef FAST_TIMER_LOG
|
||||||
num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added:
|
num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added:
|
||||||
NUM_TIMER_STATS);
|
NUM_TIMER_STATS);
|
||||||
used += sprintf(bigbuf + used, "Timers added: %i\n", fast_timers_added);
|
seq_printf(m, "Timers added: %i\n", fast_timers_added);
|
||||||
for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++)
|
for (i = 0; i < num_to_show; i++) {
|
||||||
{
|
t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS];
|
||||||
t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS];
|
if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
|
||||||
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
|
"d: %6li us data: 0x%08lX"
|
||||||
"d: %6li us data: 0x%08lX"
|
"\n",
|
||||||
"\n",
|
t->name,
|
||||||
t->name,
|
(unsigned long)t->tv_set.tv_jiff,
|
||||||
(unsigned long)t->tv_set.tv_jiff,
|
(unsigned long)t->tv_set.tv_usec,
|
||||||
(unsigned long)t->tv_set.tv_usec,
|
(unsigned long)t->tv_expires.tv_jiff,
|
||||||
(unsigned long)t->tv_expires.tv_jiff,
|
(unsigned long)t->tv_expires.tv_usec,
|
||||||
(unsigned long)t->tv_expires.tv_usec,
|
t->delay_us,
|
||||||
t->delay_us,
|
t->data) < 0)
|
||||||
t->data
|
return 0;
|
||||||
);
|
}
|
||||||
}
|
seq_putc(m, '\n');
|
||||||
used += sprintf(bigbuf + used, "\n");
|
|
||||||
|
|
||||||
num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired:
|
num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired:
|
||||||
NUM_TIMER_STATS);
|
NUM_TIMER_STATS);
|
||||||
used += sprintf(bigbuf + used, "Timers expired: %i\n", fast_timers_expired);
|
seq_printf(m, "Timers expired: %i\n", fast_timers_expired);
|
||||||
for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++)
|
for (i = 0; i < num_to_show; i++){
|
||||||
{
|
t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS];
|
||||||
t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS];
|
if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
|
||||||
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
|
"d: %6li us data: 0x%08lX"
|
||||||
"d: %6li us data: 0x%08lX"
|
"\n",
|
||||||
"\n",
|
t->name,
|
||||||
t->name,
|
(unsigned long)t->tv_set.tv_jiff,
|
||||||
(unsigned long)t->tv_set.tv_jiff,
|
(unsigned long)t->tv_set.tv_usec,
|
||||||
(unsigned long)t->tv_set.tv_usec,
|
(unsigned long)t->tv_expires.tv_jiff,
|
||||||
(unsigned long)t->tv_expires.tv_jiff,
|
(unsigned long)t->tv_expires.tv_usec,
|
||||||
(unsigned long)t->tv_expires.tv_usec,
|
t->delay_us,
|
||||||
t->delay_us,
|
t->data) < 0)
|
||||||
t->data
|
return 0;
|
||||||
);
|
}
|
||||||
}
|
seq_putc(m, '\n');
|
||||||
used += sprintf(bigbuf + used, "\n");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
used += sprintf(bigbuf + used, "Active timers:\n");
|
seq_puts(m, "Active timers:\n");
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
t = fast_timer_list;
|
t = fast_timer_list;
|
||||||
while (t != NULL && (used+100 < BIG_BUF_SIZE))
|
while (t != NULL){
|
||||||
{
|
nextt = t->next;
|
||||||
nextt = t->next;
|
local_irq_restore(flags);
|
||||||
local_irq_restore(flags);
|
if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
|
||||||
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
|
"d: %6li us data: 0x%08lX"
|
||||||
"d: %6li us data: 0x%08lX"
|
|
||||||
/* " func: 0x%08lX" */
|
/* " func: 0x%08lX" */
|
||||||
"\n",
|
"\n",
|
||||||
t->name,
|
t->name,
|
||||||
(unsigned long)t->tv_set.tv_jiff,
|
(unsigned long)t->tv_set.tv_jiff,
|
||||||
(unsigned long)t->tv_set.tv_usec,
|
(unsigned long)t->tv_set.tv_usec,
|
||||||
(unsigned long)t->tv_expires.tv_jiff,
|
(unsigned long)t->tv_expires.tv_jiff,
|
||||||
(unsigned long)t->tv_expires.tv_usec,
|
(unsigned long)t->tv_expires.tv_usec,
|
||||||
t->delay_us,
|
t->delay_us,
|
||||||
t->data
|
t->data
|
||||||
/* , t->function */
|
/* , t->function */
|
||||||
);
|
) < 0)
|
||||||
local_irq_save(flags);
|
return 0;
|
||||||
if (t->next != nextt)
|
local_irq_save(flags);
|
||||||
{
|
if (t->next != nextt)
|
||||||
printk("timer removed!\n");
|
printk("timer removed!\n");
|
||||||
}
|
t = nextt;
|
||||||
t = nextt;
|
}
|
||||||
}
|
local_irq_restore(flags);
|
||||||
local_irq_restore(flags);
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
if (used - offset < len)
|
|
||||||
{
|
|
||||||
len = used - offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(buf, bigbuf + offset, len);
|
|
||||||
*start = buf;
|
|
||||||
*eof = 1;
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int proc_fasttimer_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open_size(file, proc_fasttimer_show, PDE_DATA(inode), BIG_BUF_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations proc_fasttimer_fops = {
|
||||||
|
.open = proc_fasttimer_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* PROC_FS */
|
#endif /* PROC_FS */
|
||||||
|
|
||||||
#ifdef FAST_TIMER_TEST
|
#ifdef FAST_TIMER_TEST
|
||||||
|
@ -816,9 +783,7 @@ int fast_timer_init(void)
|
||||||
printk("fast_timer_init()\n");
|
printk("fast_timer_init()\n");
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
fasttimer_proc_entry = create_proc_entry("fasttimer", 0, 0);
|
proc_create("fasttimer", 0, NULL, &proc_fasttimer_fops);
|
||||||
if (fasttimer_proc_entry)
|
|
||||||
fasttimer_proc_entry->read_proc = proc_fasttimer_read;
|
|
||||||
#endif /* PROC_FS */
|
#endif /* PROC_FS */
|
||||||
if (request_irq(TIMER0_INTR_VECT, timer_trig_interrupt,
|
if (request_irq(TIMER0_INTR_VECT, timer_trig_interrupt,
|
||||||
IRQF_SHARED | IRQF_DISABLED,
|
IRQF_SHARED | IRQF_DISABLED,
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include <linux/stddef.h>
|
#include <linux/stddef.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/string.h>
|
#include <linux/string.h>
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
|
@ -138,30 +139,34 @@ static char *port_status(int portno)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gpio_proc_read(char *buf, char **start, off_t offset,
|
static int gpio_proc_show(struct seq_file *m, void *v)
|
||||||
int len, int *unused_i, void *unused_v)
|
|
||||||
{
|
{
|
||||||
int c,outlen;
|
|
||||||
static const char port_name[]="123456789ABCDEFGH";
|
static const char port_name[]="123456789ABCDEFGH";
|
||||||
outlen = 0;
|
int c;
|
||||||
|
|
||||||
for (c = 0; c < MAX_PORT; c++) {
|
for (c = 0; c < MAX_PORT; c++) {
|
||||||
if (ddrs[c] == NULL)
|
if (ddrs[c] == NULL)
|
||||||
continue ;
|
continue;
|
||||||
len = sprintf(buf,"P%c: %s\n",port_name[c],port_status(c));
|
seq_printf(m, "P%c: %s\n", port_name[c], port_status(c));
|
||||||
buf += len;
|
|
||||||
outlen += len;
|
|
||||||
}
|
}
|
||||||
return outlen;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int gpio_proc_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, gpio_proc_show, PDE_DATA(inode));
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations gpio_proc_fops = {
|
||||||
|
.open = gpio_proc_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
|
|
||||||
static __init int register_proc(void)
|
static __init int register_proc(void)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *proc_gpio;
|
return proc_create("gpio", S_IRUGO, NULL, &gpio_proc_fops) != NULL;
|
||||||
|
|
||||||
proc_gpio = create_proc_entry("gpio", S_IRUGO, NULL);
|
|
||||||
if (proc_gpio)
|
|
||||||
proc_gpio->read_proc = gpio_proc_read;
|
|
||||||
return proc_gpio != NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__initcall(register_proc);
|
__initcall(register_proc);
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/efi.h>
|
#include <linux/efi.h>
|
||||||
|
@ -41,7 +42,7 @@ MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
#define PALINFO_VERSION "0.5"
|
#define PALINFO_VERSION "0.5"
|
||||||
|
|
||||||
typedef int (*palinfo_func_t)(char*);
|
typedef int (*palinfo_func_t)(struct seq_file *);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *name; /* name of the proc entry */
|
const char *name; /* name of the proc entry */
|
||||||
|
@ -54,7 +55,7 @@ typedef struct {
|
||||||
* A bunch of string array to get pretty printing
|
* A bunch of string array to get pretty printing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *cache_types[] = {
|
static const char *cache_types[] = {
|
||||||
"", /* not used */
|
"", /* not used */
|
||||||
"Instruction",
|
"Instruction",
|
||||||
"Data",
|
"Data",
|
||||||
|
@ -122,19 +123,16 @@ static const char *mem_attrib[]={
|
||||||
* - a pointer to the end of the buffer
|
* - a pointer to the end of the buffer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static char *
|
static void bitvector_process(struct seq_file *m, u64 vector)
|
||||||
bitvector_process(char *p, u64 vector)
|
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
const char *units[]={ "", "K", "M", "G", "T" };
|
static const char *units[]={ "", "K", "M", "G", "T" };
|
||||||
|
|
||||||
for (i=0, j=0; i < 64; i++ , j=i/10) {
|
for (i=0, j=0; i < 64; i++ , j=i/10) {
|
||||||
if (vector & 0x1) {
|
if (vector & 0x1)
|
||||||
p += sprintf(p, "%d%s ", 1 << (i-j*10), units[j]);
|
seq_printf(m, "%d%s ", 1 << (i-j*10), units[j]);
|
||||||
}
|
|
||||||
vector >>= 1;
|
vector >>= 1;
|
||||||
}
|
}
|
||||||
return p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -149,8 +147,7 @@ bitvector_process(char *p, u64 vector)
|
||||||
* - a pointer to the end of the buffer
|
* - a pointer to the end of the buffer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static char *
|
static void bitregister_process(struct seq_file *m, u64 *reg_info, int max)
|
||||||
bitregister_process(char *p, u64 *reg_info, int max)
|
|
||||||
{
|
{
|
||||||
int i, begin, skip = 0;
|
int i, begin, skip = 0;
|
||||||
u64 value = reg_info[0];
|
u64 value = reg_info[0];
|
||||||
|
@ -163,9 +160,9 @@ bitregister_process(char *p, u64 *reg_info, int max)
|
||||||
|
|
||||||
if ((value & 0x1) == 0 && skip == 0) {
|
if ((value & 0x1) == 0 && skip == 0) {
|
||||||
if (begin <= i - 2)
|
if (begin <= i - 2)
|
||||||
p += sprintf(p, "%d-%d ", begin, i-1);
|
seq_printf(m, "%d-%d ", begin, i-1);
|
||||||
else
|
else
|
||||||
p += sprintf(p, "%d ", i-1);
|
seq_printf(m, "%d ", i-1);
|
||||||
skip = 1;
|
skip = 1;
|
||||||
begin = -1;
|
begin = -1;
|
||||||
} else if ((value & 0x1) && skip == 1) {
|
} else if ((value & 0x1) && skip == 1) {
|
||||||
|
@ -176,19 +173,15 @@ bitregister_process(char *p, u64 *reg_info, int max)
|
||||||
}
|
}
|
||||||
if (begin > -1) {
|
if (begin > -1) {
|
||||||
if (begin < 127)
|
if (begin < 127)
|
||||||
p += sprintf(p, "%d-127", begin);
|
seq_printf(m, "%d-127", begin);
|
||||||
else
|
else
|
||||||
p += sprintf(p, "127");
|
seq_puts(m, "127");
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int power_info(struct seq_file *m)
|
||||||
power_info(char *page)
|
|
||||||
{
|
{
|
||||||
s64 status;
|
s64 status;
|
||||||
char *p = page;
|
|
||||||
u64 halt_info_buffer[8];
|
u64 halt_info_buffer[8];
|
||||||
pal_power_mgmt_info_u_t *halt_info =(pal_power_mgmt_info_u_t *)halt_info_buffer;
|
pal_power_mgmt_info_u_t *halt_info =(pal_power_mgmt_info_u_t *)halt_info_buffer;
|
||||||
int i;
|
int i;
|
||||||
|
@ -198,26 +191,25 @@ power_info(char *page)
|
||||||
|
|
||||||
for (i=0; i < 8 ; i++ ) {
|
for (i=0; i < 8 ; i++ ) {
|
||||||
if (halt_info[i].pal_power_mgmt_info_s.im == 1) {
|
if (halt_info[i].pal_power_mgmt_info_s.im == 1) {
|
||||||
p += sprintf(p, "Power level %d:\n"
|
seq_printf(m,
|
||||||
"\tentry_latency : %d cycles\n"
|
"Power level %d:\n"
|
||||||
"\texit_latency : %d cycles\n"
|
"\tentry_latency : %d cycles\n"
|
||||||
"\tpower consumption : %d mW\n"
|
"\texit_latency : %d cycles\n"
|
||||||
"\tCache+TLB coherency : %s\n", i,
|
"\tpower consumption : %d mW\n"
|
||||||
halt_info[i].pal_power_mgmt_info_s.entry_latency,
|
"\tCache+TLB coherency : %s\n", i,
|
||||||
halt_info[i].pal_power_mgmt_info_s.exit_latency,
|
halt_info[i].pal_power_mgmt_info_s.entry_latency,
|
||||||
halt_info[i].pal_power_mgmt_info_s.power_consumption,
|
halt_info[i].pal_power_mgmt_info_s.exit_latency,
|
||||||
halt_info[i].pal_power_mgmt_info_s.co ? "Yes" : "No");
|
halt_info[i].pal_power_mgmt_info_s.power_consumption,
|
||||||
|
halt_info[i].pal_power_mgmt_info_s.co ? "Yes" : "No");
|
||||||
} else {
|
} else {
|
||||||
p += sprintf(p,"Power level %d: not implemented\n",i);
|
seq_printf(m,"Power level %d: not implemented\n", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return p - page;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int cache_info(struct seq_file *m)
|
||||||
cache_info(char *page)
|
|
||||||
{
|
{
|
||||||
char *p = page;
|
|
||||||
unsigned long i, levels, unique_caches;
|
unsigned long i, levels, unique_caches;
|
||||||
pal_cache_config_info_t cci;
|
pal_cache_config_info_t cci;
|
||||||
int j, k;
|
int j, k;
|
||||||
|
@ -228,73 +220,74 @@ cache_info(char *page)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
p += sprintf(p, "Cache levels : %ld\nUnique caches : %ld\n\n", levels, unique_caches);
|
seq_printf(m, "Cache levels : %ld\nUnique caches : %ld\n\n",
|
||||||
|
levels, unique_caches);
|
||||||
|
|
||||||
for (i=0; i < levels; i++) {
|
for (i=0; i < levels; i++) {
|
||||||
|
|
||||||
for (j=2; j >0 ; j--) {
|
for (j=2; j >0 ; j--) {
|
||||||
|
|
||||||
/* even without unification some level may not be present */
|
/* even without unification some level may not be present */
|
||||||
if ((status=ia64_pal_cache_config_info(i,j, &cci)) != 0) {
|
if ((status=ia64_pal_cache_config_info(i,j, &cci)) != 0)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
p += sprintf(p,
|
|
||||||
"%s Cache level %lu:\n"
|
|
||||||
"\tSize : %u bytes\n"
|
|
||||||
"\tAttributes : ",
|
|
||||||
cache_types[j+cci.pcci_unified], i+1,
|
|
||||||
cci.pcci_cache_size);
|
|
||||||
|
|
||||||
if (cci.pcci_unified) p += sprintf(p, "Unified ");
|
seq_printf(m,
|
||||||
|
"%s Cache level %lu:\n"
|
||||||
|
"\tSize : %u bytes\n"
|
||||||
|
"\tAttributes : ",
|
||||||
|
cache_types[j+cci.pcci_unified], i+1,
|
||||||
|
cci.pcci_cache_size);
|
||||||
|
|
||||||
p += sprintf(p, "%s\n", cache_mattrib[cci.pcci_cache_attr]);
|
if (cci.pcci_unified)
|
||||||
|
seq_puts(m, "Unified ");
|
||||||
|
|
||||||
p += sprintf(p,
|
seq_printf(m, "%s\n", cache_mattrib[cci.pcci_cache_attr]);
|
||||||
"\tAssociativity : %d\n"
|
|
||||||
"\tLine size : %d bytes\n"
|
seq_printf(m,
|
||||||
"\tStride : %d bytes\n",
|
"\tAssociativity : %d\n"
|
||||||
cci.pcci_assoc, 1<<cci.pcci_line_size, 1<<cci.pcci_stride);
|
"\tLine size : %d bytes\n"
|
||||||
|
"\tStride : %d bytes\n",
|
||||||
|
cci.pcci_assoc,
|
||||||
|
1<<cci.pcci_line_size,
|
||||||
|
1<<cci.pcci_stride);
|
||||||
if (j == 1)
|
if (j == 1)
|
||||||
p += sprintf(p, "\tStore latency : N/A\n");
|
seq_puts(m, "\tStore latency : N/A\n");
|
||||||
else
|
else
|
||||||
p += sprintf(p, "\tStore latency : %d cycle(s)\n",
|
seq_printf(m, "\tStore latency : %d cycle(s)\n",
|
||||||
cci.pcci_st_latency);
|
cci.pcci_st_latency);
|
||||||
|
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"\tLoad latency : %d cycle(s)\n"
|
"\tLoad latency : %d cycle(s)\n"
|
||||||
"\tStore hints : ", cci.pcci_ld_latency);
|
"\tStore hints : ", cci.pcci_ld_latency);
|
||||||
|
|
||||||
for(k=0; k < 8; k++ ) {
|
for(k=0; k < 8; k++ ) {
|
||||||
if ( cci.pcci_st_hints & 0x1)
|
if ( cci.pcci_st_hints & 0x1)
|
||||||
p += sprintf(p, "[%s]", cache_st_hints[k]);
|
seq_printf(m, "[%s]", cache_st_hints[k]);
|
||||||
cci.pcci_st_hints >>=1;
|
cci.pcci_st_hints >>=1;
|
||||||
}
|
}
|
||||||
p += sprintf(p, "\n\tLoad hints : ");
|
seq_puts(m, "\n\tLoad hints : ");
|
||||||
|
|
||||||
for(k=0; k < 8; k++ ) {
|
for(k=0; k < 8; k++ ) {
|
||||||
if (cci.pcci_ld_hints & 0x1)
|
if (cci.pcci_ld_hints & 0x1)
|
||||||
p += sprintf(p, "[%s]", cache_ld_hints[k]);
|
seq_printf(m, "[%s]", cache_ld_hints[k]);
|
||||||
cci.pcci_ld_hints >>=1;
|
cci.pcci_ld_hints >>=1;
|
||||||
}
|
}
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"\n\tAlias boundary : %d byte(s)\n"
|
"\n\tAlias boundary : %d byte(s)\n"
|
||||||
"\tTag LSB : %d\n"
|
"\tTag LSB : %d\n"
|
||||||
"\tTag MSB : %d\n",
|
"\tTag MSB : %d\n",
|
||||||
1<<cci.pcci_alias_boundary, cci.pcci_tag_lsb,
|
1<<cci.pcci_alias_boundary, cci.pcci_tag_lsb,
|
||||||
cci.pcci_tag_msb);
|
cci.pcci_tag_msb);
|
||||||
|
|
||||||
/* when unified, data(j=2) is enough */
|
/* when unified, data(j=2) is enough */
|
||||||
if (cci.pcci_unified) break;
|
if (cci.pcci_unified)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return p - page;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int vm_info(struct seq_file *m)
|
||||||
vm_info(char *page)
|
|
||||||
{
|
{
|
||||||
char *p = page;
|
|
||||||
u64 tr_pages =0, vw_pages=0, tc_pages;
|
u64 tr_pages =0, vw_pages=0, tc_pages;
|
||||||
u64 attrib;
|
u64 attrib;
|
||||||
pal_vm_info_1_u_t vm_info_1;
|
pal_vm_info_1_u_t vm_info_1;
|
||||||
|
@ -309,7 +302,7 @@ vm_info(char *page)
|
||||||
printk(KERN_ERR "ia64_pal_vm_summary=%ld\n", status);
|
printk(KERN_ERR "ia64_pal_vm_summary=%ld\n", status);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"Physical Address Space : %d bits\n"
|
"Physical Address Space : %d bits\n"
|
||||||
"Virtual Address Space : %d bits\n"
|
"Virtual Address Space : %d bits\n"
|
||||||
"Protection Key Registers(PKR) : %d\n"
|
"Protection Key Registers(PKR) : %d\n"
|
||||||
|
@ -324,49 +317,49 @@ vm_info(char *page)
|
||||||
vm_info_1.pal_vm_info_1_s.hash_tag_id,
|
vm_info_1.pal_vm_info_1_s.hash_tag_id,
|
||||||
vm_info_2.pal_vm_info_2_s.rid_size);
|
vm_info_2.pal_vm_info_2_s.rid_size);
|
||||||
if (vm_info_2.pal_vm_info_2_s.max_purges == PAL_MAX_PURGES)
|
if (vm_info_2.pal_vm_info_2_s.max_purges == PAL_MAX_PURGES)
|
||||||
p += sprintf(p, "unlimited\n");
|
seq_puts(m, "unlimited\n");
|
||||||
else
|
else
|
||||||
p += sprintf(p, "%d\n",
|
seq_printf(m, "%d\n",
|
||||||
vm_info_2.pal_vm_info_2_s.max_purges ?
|
vm_info_2.pal_vm_info_2_s.max_purges ?
|
||||||
vm_info_2.pal_vm_info_2_s.max_purges : 1);
|
vm_info_2.pal_vm_info_2_s.max_purges : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ia64_pal_mem_attrib(&attrib) == 0) {
|
if (ia64_pal_mem_attrib(&attrib) == 0) {
|
||||||
p += sprintf(p, "Supported memory attributes : ");
|
seq_puts(m, "Supported memory attributes : ");
|
||||||
sep = "";
|
sep = "";
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
if (attrib & (1 << i)) {
|
if (attrib & (1 << i)) {
|
||||||
p += sprintf(p, "%s%s", sep, mem_attrib[i]);
|
seq_printf(m, "%s%s", sep, mem_attrib[i]);
|
||||||
sep = ", ";
|
sep = ", ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p += sprintf(p, "\n");
|
seq_putc(m, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((status = ia64_pal_vm_page_size(&tr_pages, &vw_pages)) !=0) {
|
if ((status = ia64_pal_vm_page_size(&tr_pages, &vw_pages)) !=0) {
|
||||||
printk(KERN_ERR "ia64_pal_vm_page_size=%ld\n", status);
|
printk(KERN_ERR "ia64_pal_vm_page_size=%ld\n", status);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"\nTLB walker : %simplemented\n"
|
"\nTLB walker : %simplemented\n"
|
||||||
"Number of DTR : %d\n"
|
"Number of DTR : %d\n"
|
||||||
"Number of ITR : %d\n"
|
"Number of ITR : %d\n"
|
||||||
"TLB insertable page sizes : ",
|
"TLB insertable page sizes : ",
|
||||||
vm_info_1.pal_vm_info_1_s.vw ? "" : "not ",
|
vm_info_1.pal_vm_info_1_s.vw ? "" : "not ",
|
||||||
vm_info_1.pal_vm_info_1_s.max_dtr_entry+1,
|
vm_info_1.pal_vm_info_1_s.max_dtr_entry+1,
|
||||||
vm_info_1.pal_vm_info_1_s.max_itr_entry+1);
|
vm_info_1.pal_vm_info_1_s.max_itr_entry+1);
|
||||||
|
|
||||||
|
bitvector_process(m, tr_pages);
|
||||||
|
|
||||||
p = bitvector_process(p, tr_pages);
|
seq_puts(m, "\nTLB purgeable page sizes : ");
|
||||||
|
|
||||||
p += sprintf(p, "\nTLB purgeable page sizes : ");
|
bitvector_process(m, vw_pages);
|
||||||
|
|
||||||
p = bitvector_process(p, vw_pages);
|
|
||||||
}
|
}
|
||||||
if ((status=ia64_get_ptce(&ptce)) != 0) {
|
|
||||||
|
if ((status = ia64_get_ptce(&ptce)) != 0) {
|
||||||
printk(KERN_ERR "ia64_get_ptce=%ld\n", status);
|
printk(KERN_ERR "ia64_get_ptce=%ld\n", status);
|
||||||
} else {
|
} else {
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"\nPurge base address : 0x%016lx\n"
|
"\nPurge base address : 0x%016lx\n"
|
||||||
"Purge outer loop count : %d\n"
|
"Purge outer loop count : %d\n"
|
||||||
"Purge inner loop count : %d\n"
|
"Purge inner loop count : %d\n"
|
||||||
|
@ -375,7 +368,7 @@ vm_info(char *page)
|
||||||
ptce.base, ptce.count[0], ptce.count[1],
|
ptce.base, ptce.count[0], ptce.count[1],
|
||||||
ptce.stride[0], ptce.stride[1]);
|
ptce.stride[0], ptce.stride[1]);
|
||||||
|
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"TC Levels : %d\n"
|
"TC Levels : %d\n"
|
||||||
"Unique TC(s) : %d\n",
|
"Unique TC(s) : %d\n",
|
||||||
vm_info_1.pal_vm_info_1_s.num_tc_levels,
|
vm_info_1.pal_vm_info_1_s.num_tc_levels,
|
||||||
|
@ -385,13 +378,11 @@ vm_info(char *page)
|
||||||
for (j=2; j>0 ; j--) {
|
for (j=2; j>0 ; j--) {
|
||||||
tc_pages = 0; /* just in case */
|
tc_pages = 0; /* just in case */
|
||||||
|
|
||||||
|
|
||||||
/* even without unification, some levels may not be present */
|
/* even without unification, some levels may not be present */
|
||||||
if ((status=ia64_pal_vm_info(i,j, &tc_info, &tc_pages)) != 0) {
|
if ((status=ia64_pal_vm_info(i,j, &tc_info, &tc_pages)) != 0)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"\n%s Translation Cache Level %d:\n"
|
"\n%s Translation Cache Level %d:\n"
|
||||||
"\tHash sets : %d\n"
|
"\tHash sets : %d\n"
|
||||||
"\tAssociativity : %d\n"
|
"\tAssociativity : %d\n"
|
||||||
|
@ -403,15 +394,15 @@ vm_info(char *page)
|
||||||
tc_info.tc_num_entries);
|
tc_info.tc_num_entries);
|
||||||
|
|
||||||
if (tc_info.tc_pf)
|
if (tc_info.tc_pf)
|
||||||
p += sprintf(p, "PreferredPageSizeOptimized ");
|
seq_puts(m, "PreferredPageSizeOptimized ");
|
||||||
if (tc_info.tc_unified)
|
if (tc_info.tc_unified)
|
||||||
p += sprintf(p, "Unified ");
|
seq_puts(m, "Unified ");
|
||||||
if (tc_info.tc_reduce_tr)
|
if (tc_info.tc_reduce_tr)
|
||||||
p += sprintf(p, "TCReduction");
|
seq_puts(m, "TCReduction");
|
||||||
|
|
||||||
p += sprintf(p, "\n\tSupported page sizes: ");
|
seq_puts(m, "\n\tSupported page sizes: ");
|
||||||
|
|
||||||
p = bitvector_process(p, tc_pages);
|
bitvector_process(m, tc_pages);
|
||||||
|
|
||||||
/* when unified date (j=2) is enough */
|
/* when unified date (j=2) is enough */
|
||||||
if (tc_info.tc_unified)
|
if (tc_info.tc_unified)
|
||||||
|
@ -419,16 +410,14 @@ vm_info(char *page)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p += sprintf(p, "\n");
|
|
||||||
|
|
||||||
return p - page;
|
seq_putc(m, '\n');
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int register_info(struct seq_file *m)
|
||||||
register_info(char *page)
|
|
||||||
{
|
{
|
||||||
char *p = page;
|
|
||||||
u64 reg_info[2];
|
u64 reg_info[2];
|
||||||
u64 info;
|
u64 info;
|
||||||
unsigned long phys_stacked;
|
unsigned long phys_stacked;
|
||||||
|
@ -442,35 +431,31 @@ register_info(char *page)
|
||||||
};
|
};
|
||||||
|
|
||||||
for(info=0; info < 4; info++) {
|
for(info=0; info < 4; info++) {
|
||||||
|
if (ia64_pal_register_info(info, ®_info[0], ®_info[1]) != 0)
|
||||||
if (ia64_pal_register_info(info, ®_info[0], ®_info[1]) != 0) return 0;
|
return 0;
|
||||||
|
seq_printf(m, "%-32s : ", info_type[info]);
|
||||||
p += sprintf(p, "%-32s : ", info_type[info]);
|
bitregister_process(m, reg_info, 128);
|
||||||
|
seq_putc(m, '\n');
|
||||||
p = bitregister_process(p, reg_info, 128);
|
|
||||||
|
|
||||||
p += sprintf(p, "\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ia64_pal_rse_info(&phys_stacked, &hints) == 0) {
|
if (ia64_pal_rse_info(&phys_stacked, &hints) == 0)
|
||||||
|
seq_printf(m,
|
||||||
|
"RSE stacked physical registers : %ld\n"
|
||||||
|
"RSE load/store hints : %ld (%s)\n",
|
||||||
|
phys_stacked, hints.ph_data,
|
||||||
|
hints.ph_data < RSE_HINTS_COUNT ? rse_hints[hints.ph_data]: "(??)");
|
||||||
|
|
||||||
p += sprintf(p,
|
|
||||||
"RSE stacked physical registers : %ld\n"
|
|
||||||
"RSE load/store hints : %ld (%s)\n",
|
|
||||||
phys_stacked, hints.ph_data,
|
|
||||||
hints.ph_data < RSE_HINTS_COUNT ? rse_hints[hints.ph_data]: "(??)");
|
|
||||||
}
|
|
||||||
if (ia64_pal_debug_info(&iregs, &dregs))
|
if (ia64_pal_debug_info(&iregs, &dregs))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"Instruction debug register pairs : %ld\n"
|
"Instruction debug register pairs : %ld\n"
|
||||||
"Data debug register pairs : %ld\n", iregs, dregs);
|
"Data debug register pairs : %ld\n", iregs, dregs);
|
||||||
|
|
||||||
return p - page;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *proc_features_0[]={ /* Feature set 0 */
|
static const char *const proc_features_0[]={ /* Feature set 0 */
|
||||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,
|
NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,
|
||||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||||
|
@ -502,7 +487,7 @@ static char *proc_features_0[]={ /* Feature set 0 */
|
||||||
"Enable BERR promotion"
|
"Enable BERR promotion"
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *proc_features_16[]={ /* Feature set 16 */
|
static const char *const proc_features_16[]={ /* Feature set 16 */
|
||||||
"Disable ETM",
|
"Disable ETM",
|
||||||
"Enable ETM",
|
"Enable ETM",
|
||||||
"Enable MCA on half-way timer",
|
"Enable MCA on half-way timer",
|
||||||
|
@ -522,7 +507,7 @@ static char *proc_features_16[]={ /* Feature set 16 */
|
||||||
NULL, NULL, NULL, NULL, NULL
|
NULL, NULL, NULL, NULL, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static char **proc_features[]={
|
static const char *const *const proc_features[]={
|
||||||
proc_features_0,
|
proc_features_0,
|
||||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
NULL, NULL, NULL, NULL,
|
NULL, NULL, NULL, NULL,
|
||||||
|
@ -530,11 +515,10 @@ static char **proc_features[]={
|
||||||
NULL, NULL, NULL, NULL,
|
NULL, NULL, NULL, NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static char * feature_set_info(char *page, u64 avail, u64 status, u64 control,
|
static void feature_set_info(struct seq_file *m, u64 avail, u64 status, u64 control,
|
||||||
unsigned long set)
|
unsigned long set)
|
||||||
{
|
{
|
||||||
char *p = page;
|
const char *const *vf, *const *v;
|
||||||
char **vf, **v;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
vf = v = proc_features[set];
|
vf = v = proc_features[set];
|
||||||
|
@ -547,13 +531,13 @@ static char * feature_set_info(char *page, u64 avail, u64 status, u64 control,
|
||||||
if (vf)
|
if (vf)
|
||||||
v = vf + i;
|
v = vf + i;
|
||||||
if ( v && *v ) {
|
if ( v && *v ) {
|
||||||
p += sprintf(p, "%-40s : %s %s\n", *v,
|
seq_printf(m, "%-40s : %s %s\n", *v,
|
||||||
avail & 0x1 ? (status & 0x1 ?
|
avail & 0x1 ? (status & 0x1 ?
|
||||||
"On " : "Off"): "",
|
"On " : "Off"): "",
|
||||||
avail & 0x1 ? (control & 0x1 ?
|
avail & 0x1 ? (control & 0x1 ?
|
||||||
"Ctrl" : "NoCtrl"): "");
|
"Ctrl" : "NoCtrl"): "");
|
||||||
} else {
|
} else {
|
||||||
p += sprintf(p, "Feature set %2ld bit %2d\t\t\t"
|
seq_printf(m, "Feature set %2ld bit %2d\t\t\t"
|
||||||
" : %s %s\n",
|
" : %s %s\n",
|
||||||
set, i,
|
set, i,
|
||||||
avail & 0x1 ? (status & 0x1 ?
|
avail & 0x1 ? (status & 0x1 ?
|
||||||
|
@ -562,36 +546,32 @@ static char * feature_set_info(char *page, u64 avail, u64 status, u64 control,
|
||||||
"Ctrl" : "NoCtrl"): "");
|
"Ctrl" : "NoCtrl"): "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int processor_info(struct seq_file *m)
|
||||||
processor_info(char *page)
|
|
||||||
{
|
{
|
||||||
char *p = page;
|
|
||||||
u64 avail=1, status=1, control=1, feature_set=0;
|
u64 avail=1, status=1, control=1, feature_set=0;
|
||||||
s64 ret;
|
s64 ret;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
ret = ia64_pal_proc_get_features(&avail, &status, &control,
|
ret = ia64_pal_proc_get_features(&avail, &status, &control,
|
||||||
feature_set);
|
feature_set);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
return p - page;
|
return 0;
|
||||||
}
|
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
feature_set++;
|
feature_set++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = feature_set_info(p, avail, status, control, feature_set);
|
feature_set_info(m, avail, status, control, feature_set);
|
||||||
|
|
||||||
feature_set++;
|
feature_set++;
|
||||||
} while(1);
|
} while(1);
|
||||||
|
|
||||||
return p - page;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *bus_features[]={
|
static const char *const bus_features[]={
|
||||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,
|
NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,
|
||||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||||
|
@ -617,125 +597,118 @@ static const char *bus_features[]={
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int bus_info(struct seq_file *m)
|
||||||
bus_info(char *page)
|
|
||||||
{
|
{
|
||||||
char *p = page;
|
const char *const *v = bus_features;
|
||||||
const char **v = bus_features;
|
|
||||||
pal_bus_features_u_t av, st, ct;
|
pal_bus_features_u_t av, st, ct;
|
||||||
u64 avail, status, control;
|
u64 avail, status, control;
|
||||||
int i;
|
int i;
|
||||||
s64 ret;
|
s64 ret;
|
||||||
|
|
||||||
if ((ret=ia64_pal_bus_get_features(&av, &st, &ct)) != 0) return 0;
|
if ((ret=ia64_pal_bus_get_features(&av, &st, &ct)) != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
avail = av.pal_bus_features_val;
|
avail = av.pal_bus_features_val;
|
||||||
status = st.pal_bus_features_val;
|
status = st.pal_bus_features_val;
|
||||||
control = ct.pal_bus_features_val;
|
control = ct.pal_bus_features_val;
|
||||||
|
|
||||||
for(i=0; i < 64; i++, v++, avail >>=1, status >>=1, control >>=1) {
|
for(i=0; i < 64; i++, v++, avail >>=1, status >>=1, control >>=1) {
|
||||||
if ( ! *v ) continue;
|
if ( ! *v )
|
||||||
p += sprintf(p, "%-48s : %s%s %s\n", *v,
|
continue;
|
||||||
avail & 0x1 ? "" : "NotImpl",
|
seq_printf(m, "%-48s : %s%s %s\n", *v,
|
||||||
avail & 0x1 ? (status & 0x1 ? "On" : "Off"): "",
|
avail & 0x1 ? "" : "NotImpl",
|
||||||
avail & 0x1 ? (control & 0x1 ? "Ctrl" : "NoCtrl"): "");
|
avail & 0x1 ? (status & 0x1 ? "On" : "Off"): "",
|
||||||
|
avail & 0x1 ? (control & 0x1 ? "Ctrl" : "NoCtrl"): "");
|
||||||
}
|
}
|
||||||
return p - page;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int version_info(struct seq_file *m)
|
||||||
version_info(char *page)
|
|
||||||
{
|
{
|
||||||
pal_version_u_t min_ver, cur_ver;
|
pal_version_u_t min_ver, cur_ver;
|
||||||
char *p = page;
|
|
||||||
|
|
||||||
if (ia64_pal_version(&min_ver, &cur_ver) != 0)
|
if (ia64_pal_version(&min_ver, &cur_ver) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"PAL_vendor : 0x%02x (min=0x%02x)\n"
|
"PAL_vendor : 0x%02x (min=0x%02x)\n"
|
||||||
"PAL_A : %02x.%02x (min=%02x.%02x)\n"
|
"PAL_A : %02x.%02x (min=%02x.%02x)\n"
|
||||||
"PAL_B : %02x.%02x (min=%02x.%02x)\n",
|
"PAL_B : %02x.%02x (min=%02x.%02x)\n",
|
||||||
cur_ver.pal_version_s.pv_pal_vendor,
|
cur_ver.pal_version_s.pv_pal_vendor,
|
||||||
min_ver.pal_version_s.pv_pal_vendor,
|
min_ver.pal_version_s.pv_pal_vendor,
|
||||||
cur_ver.pal_version_s.pv_pal_a_model,
|
cur_ver.pal_version_s.pv_pal_a_model,
|
||||||
cur_ver.pal_version_s.pv_pal_a_rev,
|
cur_ver.pal_version_s.pv_pal_a_rev,
|
||||||
min_ver.pal_version_s.pv_pal_a_model,
|
min_ver.pal_version_s.pv_pal_a_model,
|
||||||
min_ver.pal_version_s.pv_pal_a_rev,
|
min_ver.pal_version_s.pv_pal_a_rev,
|
||||||
cur_ver.pal_version_s.pv_pal_b_model,
|
cur_ver.pal_version_s.pv_pal_b_model,
|
||||||
cur_ver.pal_version_s.pv_pal_b_rev,
|
cur_ver.pal_version_s.pv_pal_b_rev,
|
||||||
min_ver.pal_version_s.pv_pal_b_model,
|
min_ver.pal_version_s.pv_pal_b_model,
|
||||||
min_ver.pal_version_s.pv_pal_b_rev);
|
min_ver.pal_version_s.pv_pal_b_rev);
|
||||||
return p - page;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int perfmon_info(struct seq_file *m)
|
||||||
perfmon_info(char *page)
|
|
||||||
{
|
{
|
||||||
char *p = page;
|
|
||||||
u64 pm_buffer[16];
|
u64 pm_buffer[16];
|
||||||
pal_perf_mon_info_u_t pm_info;
|
pal_perf_mon_info_u_t pm_info;
|
||||||
|
|
||||||
if (ia64_pal_perf_mon_info(pm_buffer, &pm_info) != 0) return 0;
|
if (ia64_pal_perf_mon_info(pm_buffer, &pm_info) != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"PMC/PMD pairs : %d\n"
|
"PMC/PMD pairs : %d\n"
|
||||||
"Counter width : %d bits\n"
|
"Counter width : %d bits\n"
|
||||||
"Cycle event number : %d\n"
|
"Cycle event number : %d\n"
|
||||||
"Retired event number : %d\n"
|
"Retired event number : %d\n"
|
||||||
"Implemented PMC : ",
|
"Implemented PMC : ",
|
||||||
pm_info.pal_perf_mon_info_s.generic, pm_info.pal_perf_mon_info_s.width,
|
pm_info.pal_perf_mon_info_s.generic,
|
||||||
pm_info.pal_perf_mon_info_s.cycles, pm_info.pal_perf_mon_info_s.retired);
|
pm_info.pal_perf_mon_info_s.width,
|
||||||
|
pm_info.pal_perf_mon_info_s.cycles,
|
||||||
|
pm_info.pal_perf_mon_info_s.retired);
|
||||||
|
|
||||||
p = bitregister_process(p, pm_buffer, 256);
|
bitregister_process(m, pm_buffer, 256);
|
||||||
p += sprintf(p, "\nImplemented PMD : ");
|
seq_puts(m, "\nImplemented PMD : ");
|
||||||
p = bitregister_process(p, pm_buffer+4, 256);
|
bitregister_process(m, pm_buffer+4, 256);
|
||||||
p += sprintf(p, "\nCycles count capable : ");
|
seq_puts(m, "\nCycles count capable : ");
|
||||||
p = bitregister_process(p, pm_buffer+8, 256);
|
bitregister_process(m, pm_buffer+8, 256);
|
||||||
p += sprintf(p, "\nRetired bundles count capable : ");
|
seq_puts(m, "\nRetired bundles count capable : ");
|
||||||
|
|
||||||
#ifdef CONFIG_ITANIUM
|
#ifdef CONFIG_ITANIUM
|
||||||
/*
|
/*
|
||||||
* PAL_PERF_MON_INFO reports that only PMC4 can be used to count CPU_CYCLES
|
* PAL_PERF_MON_INFO reports that only PMC4 can be used to count CPU_CYCLES
|
||||||
* which is wrong, both PMC4 and PMD5 support it.
|
* which is wrong, both PMC4 and PMD5 support it.
|
||||||
*/
|
*/
|
||||||
if (pm_buffer[12] == 0x10) pm_buffer[12]=0x30;
|
if (pm_buffer[12] == 0x10)
|
||||||
|
pm_buffer[12]=0x30;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
p = bitregister_process(p, pm_buffer+12, 256);
|
bitregister_process(m, pm_buffer+12, 256);
|
||||||
|
seq_putc(m, '\n');
|
||||||
p += sprintf(p, "\n");
|
return 0;
|
||||||
|
|
||||||
return p - page;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int frequency_info(struct seq_file *m)
|
||||||
frequency_info(char *page)
|
|
||||||
{
|
{
|
||||||
char *p = page;
|
|
||||||
struct pal_freq_ratio proc, itc, bus;
|
struct pal_freq_ratio proc, itc, bus;
|
||||||
unsigned long base;
|
unsigned long base;
|
||||||
|
|
||||||
if (ia64_pal_freq_base(&base) == -1)
|
if (ia64_pal_freq_base(&base) == -1)
|
||||||
p += sprintf(p, "Output clock : not implemented\n");
|
seq_puts(m, "Output clock : not implemented\n");
|
||||||
else
|
else
|
||||||
p += sprintf(p, "Output clock : %ld ticks/s\n", base);
|
seq_printf(m, "Output clock : %ld ticks/s\n", base);
|
||||||
|
|
||||||
if (ia64_pal_freq_ratios(&proc, &bus, &itc) != 0) return 0;
|
if (ia64_pal_freq_ratios(&proc, &bus, &itc) != 0) return 0;
|
||||||
|
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"Processor/Clock ratio : %d/%d\n"
|
"Processor/Clock ratio : %d/%d\n"
|
||||||
"Bus/Clock ratio : %d/%d\n"
|
"Bus/Clock ratio : %d/%d\n"
|
||||||
"ITC/Clock ratio : %d/%d\n",
|
"ITC/Clock ratio : %d/%d\n",
|
||||||
proc.num, proc.den, bus.num, bus.den, itc.num, itc.den);
|
proc.num, proc.den, bus.num, bus.den, itc.num, itc.den);
|
||||||
|
return 0;
|
||||||
return p - page;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int tr_info(struct seq_file *m)
|
||||||
tr_info(char *page)
|
|
||||||
{
|
{
|
||||||
char *p = page;
|
|
||||||
long status;
|
long status;
|
||||||
pal_tr_valid_u_t tr_valid;
|
pal_tr_valid_u_t tr_valid;
|
||||||
u64 tr_buffer[4];
|
u64 tr_buffer[4];
|
||||||
|
@ -794,39 +767,40 @@ tr_info(char *page)
|
||||||
|
|
||||||
ifa_reg = (struct ifa_reg *)&tr_buffer[2];
|
ifa_reg = (struct ifa_reg *)&tr_buffer[2];
|
||||||
|
|
||||||
if (ifa_reg->valid == 0) continue;
|
if (ifa_reg->valid == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
gr_reg = (struct gr_reg *)tr_buffer;
|
gr_reg = (struct gr_reg *)tr_buffer;
|
||||||
itir_reg = (struct itir_reg *)&tr_buffer[1];
|
itir_reg = (struct itir_reg *)&tr_buffer[1];
|
||||||
rid_reg = (struct rid_reg *)&tr_buffer[3];
|
rid_reg = (struct rid_reg *)&tr_buffer[3];
|
||||||
|
|
||||||
pgm = -1 << (itir_reg->ps - 12);
|
pgm = -1 << (itir_reg->ps - 12);
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"%cTR%lu: av=%d pv=%d dv=%d mv=%d\n"
|
"%cTR%lu: av=%d pv=%d dv=%d mv=%d\n"
|
||||||
"\tppn : 0x%lx\n"
|
"\tppn : 0x%lx\n"
|
||||||
"\tvpn : 0x%lx\n"
|
"\tvpn : 0x%lx\n"
|
||||||
"\tps : ",
|
"\tps : ",
|
||||||
"ID"[i], j,
|
"ID"[i], j,
|
||||||
tr_valid.pal_tr_valid_s.access_rights_valid,
|
tr_valid.pal_tr_valid_s.access_rights_valid,
|
||||||
tr_valid.pal_tr_valid_s.priv_level_valid,
|
tr_valid.pal_tr_valid_s.priv_level_valid,
|
||||||
tr_valid.pal_tr_valid_s.dirty_bit_valid,
|
tr_valid.pal_tr_valid_s.dirty_bit_valid,
|
||||||
tr_valid.pal_tr_valid_s.mem_attr_valid,
|
tr_valid.pal_tr_valid_s.mem_attr_valid,
|
||||||
(gr_reg->ppn & pgm)<< 12, (ifa_reg->vpn & pgm)<< 12);
|
(gr_reg->ppn & pgm)<< 12, (ifa_reg->vpn & pgm)<< 12);
|
||||||
|
|
||||||
p = bitvector_process(p, 1<< itir_reg->ps);
|
bitvector_process(m, 1<< itir_reg->ps);
|
||||||
|
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"\n\tpl : %d\n"
|
"\n\tpl : %d\n"
|
||||||
"\tar : %d\n"
|
"\tar : %d\n"
|
||||||
"\trid : %x\n"
|
"\trid : %x\n"
|
||||||
"\tp : %d\n"
|
"\tp : %d\n"
|
||||||
"\tma : %d\n"
|
"\tma : %d\n"
|
||||||
"\td : %d\n",
|
"\td : %d\n",
|
||||||
gr_reg->pl, gr_reg->ar, rid_reg->rid, gr_reg->p, gr_reg->ma,
|
gr_reg->pl, gr_reg->ar, rid_reg->rid, gr_reg->p, gr_reg->ma,
|
||||||
gr_reg->d);
|
gr_reg->d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return p - page;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -834,7 +808,7 @@ tr_info(char *page)
|
||||||
/*
|
/*
|
||||||
* List {name,function} pairs for every entry in /proc/palinfo/cpu*
|
* List {name,function} pairs for every entry in /proc/palinfo/cpu*
|
||||||
*/
|
*/
|
||||||
static palinfo_entry_t palinfo_entries[]={
|
static const palinfo_entry_t palinfo_entries[]={
|
||||||
{ "version_info", version_info, },
|
{ "version_info", version_info, },
|
||||||
{ "vm_info", vm_info, },
|
{ "vm_info", vm_info, },
|
||||||
{ "cache_info", cache_info, },
|
{ "cache_info", cache_info, },
|
||||||
|
@ -876,7 +850,7 @@ typedef union {
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
palinfo_func_t func; /* pointer to function to call */
|
palinfo_func_t func; /* pointer to function to call */
|
||||||
char *page; /* buffer to store results */
|
struct seq_file *m; /* buffer to store results */
|
||||||
int ret; /* return value from call */
|
int ret; /* return value from call */
|
||||||
} palinfo_smp_data_t;
|
} palinfo_smp_data_t;
|
||||||
|
|
||||||
|
@ -889,7 +863,7 @@ static void
|
||||||
palinfo_smp_call(void *info)
|
palinfo_smp_call(void *info)
|
||||||
{
|
{
|
||||||
palinfo_smp_data_t *data = (palinfo_smp_data_t *)info;
|
palinfo_smp_data_t *data = (palinfo_smp_data_t *)info;
|
||||||
data->ret = (*data->func)(data->page);
|
data->ret = (*data->func)(data->m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -899,13 +873,13 @@ palinfo_smp_call(void *info)
|
||||||
* otherwise how many bytes in the "page" buffer were written
|
* otherwise how many bytes in the "page" buffer were written
|
||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
int palinfo_handle_smp(pal_func_cpu_u_t *f, char *page)
|
int palinfo_handle_smp(struct seq_file *m, pal_func_cpu_u_t *f)
|
||||||
{
|
{
|
||||||
palinfo_smp_data_t ptr;
|
palinfo_smp_data_t ptr;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ptr.func = palinfo_entries[f->func_id].proc_read;
|
ptr.func = palinfo_entries[f->func_id].proc_read;
|
||||||
ptr.page = page;
|
ptr.m = m;
|
||||||
ptr.ret = 0; /* just in case */
|
ptr.ret = 0; /* just in case */
|
||||||
|
|
||||||
|
|
||||||
|
@ -919,7 +893,7 @@ int palinfo_handle_smp(pal_func_cpu_u_t *f, char *page)
|
||||||
}
|
}
|
||||||
#else /* ! CONFIG_SMP */
|
#else /* ! CONFIG_SMP */
|
||||||
static
|
static
|
||||||
int palinfo_handle_smp(pal_func_cpu_u_t *f, char *page)
|
int palinfo_handle_smp(struct seq_file *m, pal_func_cpu_u_t *f)
|
||||||
{
|
{
|
||||||
printk(KERN_ERR "palinfo: should not be called with non SMP kernel\n");
|
printk(KERN_ERR "palinfo: should not be called with non SMP kernel\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -929,34 +903,35 @@ int palinfo_handle_smp(pal_func_cpu_u_t *f, char *page)
|
||||||
/*
|
/*
|
||||||
* Entry point routine: all calls go through this function
|
* Entry point routine: all calls go through this function
|
||||||
*/
|
*/
|
||||||
static int
|
static int proc_palinfo_show(struct seq_file *m, void *v)
|
||||||
palinfo_read_entry(char *page, char **start, off_t off, int count, int *eof, void *data)
|
|
||||||
{
|
{
|
||||||
int len=0;
|
pal_func_cpu_u_t *f = (pal_func_cpu_u_t *)&m->private;
|
||||||
pal_func_cpu_u_t *f = (pal_func_cpu_u_t *)&data;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* in SMP mode, we may need to call another CPU to get correct
|
* in SMP mode, we may need to call another CPU to get correct
|
||||||
* information. PAL, by definition, is processor specific
|
* information. PAL, by definition, is processor specific
|
||||||
*/
|
*/
|
||||||
if (f->req_cpu == get_cpu())
|
if (f->req_cpu == get_cpu())
|
||||||
len = (*palinfo_entries[f->func_id].proc_read)(page);
|
(*palinfo_entries[f->func_id].proc_read)(m);
|
||||||
else
|
else
|
||||||
len = palinfo_handle_smp(f, page);
|
palinfo_handle_smp(m, f);
|
||||||
|
|
||||||
put_cpu();
|
put_cpu();
|
||||||
|
return 0;
|
||||||
if (len <= off+count) *eof = 1;
|
|
||||||
|
|
||||||
*start = page + off;
|
|
||||||
len -= off;
|
|
||||||
|
|
||||||
if (len>count) len = count;
|
|
||||||
if (len<0) len = 0;
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int proc_palinfo_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, proc_palinfo_show, PDE_DATA(inode));
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations proc_palinfo_fops = {
|
||||||
|
.open = proc_palinfo_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
|
|
||||||
static void __cpuinit
|
static void __cpuinit
|
||||||
create_palinfo_proc_entries(unsigned int cpu)
|
create_palinfo_proc_entries(unsigned int cpu)
|
||||||
{
|
{
|
||||||
|
@ -974,9 +949,8 @@ create_palinfo_proc_entries(unsigned int cpu)
|
||||||
|
|
||||||
for (j=0; j < NR_PALINFO_ENTRIES; j++) {
|
for (j=0; j < NR_PALINFO_ENTRIES; j++) {
|
||||||
f.func_id = j;
|
f.func_id = j;
|
||||||
create_proc_read_entry(
|
proc_create_data(palinfo_entries[j].name, 0, cpu_dir,
|
||||||
palinfo_entries[j].name, 0, cpu_dir,
|
&proc_palinfo_fops, (void *)f.value);
|
||||||
palinfo_read_entry, (void *)f.value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include <linux/cpu.h>
|
#include <linux/cpu.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/smp.h>
|
#include <linux/smp.h>
|
||||||
#include <linux/timer.h>
|
#include <linux/timer.h>
|
||||||
|
@ -53,7 +54,7 @@ MODULE_AUTHOR("Jesse Barnes <jbarnes@sgi.com>");
|
||||||
MODULE_DESCRIPTION("/proc interface to IA-64 SAL features");
|
MODULE_DESCRIPTION("/proc interface to IA-64 SAL features");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
static int salinfo_read(char *page, char **start, off_t off, int count, int *eof, void *data);
|
static const struct file_operations proc_salinfo_fops;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *name; /* name of the proc entry */
|
const char *name; /* name of the proc entry */
|
||||||
|
@ -65,7 +66,7 @@ typedef struct {
|
||||||
* List {name,feature} pairs for every entry in /proc/sal/<feature>
|
* List {name,feature} pairs for every entry in /proc/sal/<feature>
|
||||||
* that this module exports
|
* that this module exports
|
||||||
*/
|
*/
|
||||||
static salinfo_entry_t salinfo_entries[]={
|
static const salinfo_entry_t salinfo_entries[]={
|
||||||
{ "bus_lock", IA64_SAL_PLATFORM_FEATURE_BUS_LOCK, },
|
{ "bus_lock", IA64_SAL_PLATFORM_FEATURE_BUS_LOCK, },
|
||||||
{ "irq_redirection", IA64_SAL_PLATFORM_FEATURE_IRQ_REDIR_HINT, },
|
{ "irq_redirection", IA64_SAL_PLATFORM_FEATURE_IRQ_REDIR_HINT, },
|
||||||
{ "ipi_redirection", IA64_SAL_PLATFORM_FEATURE_IPI_REDIR_HINT, },
|
{ "ipi_redirection", IA64_SAL_PLATFORM_FEATURE_IPI_REDIR_HINT, },
|
||||||
|
@ -301,9 +302,7 @@ salinfo_event_open(struct inode *inode, struct file *file)
|
||||||
static ssize_t
|
static ssize_t
|
||||||
salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
|
salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct inode *inode = file_inode(file);
|
struct salinfo_data *data = PDE_DATA(file_inode(file));
|
||||||
struct proc_dir_entry *entry = PDE(inode);
|
|
||||||
struct salinfo_data *data = entry->data;
|
|
||||||
char cmd[32];
|
char cmd[32];
|
||||||
size_t size;
|
size_t size;
|
||||||
int i, n, cpu = -1;
|
int i, n, cpu = -1;
|
||||||
|
@ -360,8 +359,7 @@ static const struct file_operations salinfo_event_fops = {
|
||||||
static int
|
static int
|
||||||
salinfo_log_open(struct inode *inode, struct file *file)
|
salinfo_log_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *entry = PDE(inode);
|
struct salinfo_data *data = PDE_DATA(inode);
|
||||||
struct salinfo_data *data = entry->data;
|
|
||||||
|
|
||||||
if (!capable(CAP_SYS_ADMIN))
|
if (!capable(CAP_SYS_ADMIN))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
@ -386,8 +384,7 @@ salinfo_log_open(struct inode *inode, struct file *file)
|
||||||
static int
|
static int
|
||||||
salinfo_log_release(struct inode *inode, struct file *file)
|
salinfo_log_release(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *entry = PDE(inode);
|
struct salinfo_data *data = PDE_DATA(inode);
|
||||||
struct salinfo_data *data = entry->data;
|
|
||||||
|
|
||||||
if (data->state == STATE_NO_DATA) {
|
if (data->state == STATE_NO_DATA) {
|
||||||
vfree(data->log_buffer);
|
vfree(data->log_buffer);
|
||||||
|
@ -463,9 +460,7 @@ salinfo_log_new_read(int cpu, struct salinfo_data *data)
|
||||||
static ssize_t
|
static ssize_t
|
||||||
salinfo_log_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
|
salinfo_log_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct inode *inode = file_inode(file);
|
struct salinfo_data *data = PDE_DATA(file_inode(file));
|
||||||
struct proc_dir_entry *entry = PDE(inode);
|
|
||||||
struct salinfo_data *data = entry->data;
|
|
||||||
u8 *buf;
|
u8 *buf;
|
||||||
u64 bufsize;
|
u64 bufsize;
|
||||||
|
|
||||||
|
@ -524,9 +519,7 @@ salinfo_log_clear(struct salinfo_data *data, int cpu)
|
||||||
static ssize_t
|
static ssize_t
|
||||||
salinfo_log_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
|
salinfo_log_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct inode *inode = file_inode(file);
|
struct salinfo_data *data = PDE_DATA(file_inode(file));
|
||||||
struct proc_dir_entry *entry = PDE(inode);
|
|
||||||
struct salinfo_data *data = entry->data;
|
|
||||||
char cmd[32];
|
char cmd[32];
|
||||||
size_t size;
|
size_t size;
|
||||||
u32 offset;
|
u32 offset;
|
||||||
|
@ -637,8 +630,9 @@ salinfo_init(void)
|
||||||
|
|
||||||
for (i=0; i < NR_SALINFO_ENTRIES; i++) {
|
for (i=0; i < NR_SALINFO_ENTRIES; i++) {
|
||||||
/* pass the feature bit in question as misc data */
|
/* pass the feature bit in question as misc data */
|
||||||
*sdir++ = create_proc_read_entry (salinfo_entries[i].name, 0, salinfo_dir,
|
*sdir++ = proc_create_data(salinfo_entries[i].name, 0, salinfo_dir,
|
||||||
salinfo_read, (void *)salinfo_entries[i].feature);
|
&proc_salinfo_fops,
|
||||||
|
(void *)salinfo_entries[i].feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) {
|
for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) {
|
||||||
|
@ -684,22 +678,23 @@ salinfo_init(void)
|
||||||
* 'data' contains an integer that corresponds to the feature we're
|
* 'data' contains an integer that corresponds to the feature we're
|
||||||
* testing
|
* testing
|
||||||
*/
|
*/
|
||||||
static int
|
static int proc_salinfo_show(struct seq_file *m, void *v)
|
||||||
salinfo_read(char *page, char **start, off_t off, int count, int *eof, void *data)
|
|
||||||
{
|
{
|
||||||
int len = 0;
|
unsigned long data = (unsigned long)v;
|
||||||
|
seq_puts(m, (sal_platform_features & data) ? "1\n" : "0\n");
|
||||||
len = sprintf(page, (sal_platform_features & (unsigned long)data) ? "1\n" : "0\n");
|
return 0;
|
||||||
|
|
||||||
if (len <= off+count) *eof = 1;
|
|
||||||
|
|
||||||
*start = page + off;
|
|
||||||
len -= off;
|
|
||||||
|
|
||||||
if (len>count) len = count;
|
|
||||||
if (len<0) len = 0;
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int proc_salinfo_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, proc_salinfo_show, PDE_DATA(inode));
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations proc_salinfo_fops = {
|
||||||
|
.open = proc_salinfo_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
|
|
||||||
module_init(salinfo_init);
|
module_init(salinfo_init);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
#include <linux/nodemask.h>
|
#include <linux/nodemask.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/sn/sn_sal.h>
|
#include <asm/sn/sn_sal.h>
|
||||||
|
@ -101,18 +102,18 @@ get_fit_entry(unsigned long nasid, int index, unsigned long *fentry,
|
||||||
/*
|
/*
|
||||||
* These two routines display the FIT table for each node.
|
* These two routines display the FIT table for each node.
|
||||||
*/
|
*/
|
||||||
static int dump_fit_entry(char *page, unsigned long *fentry)
|
static void dump_fit_entry(struct seq_file *m, unsigned long *fentry)
|
||||||
{
|
{
|
||||||
unsigned type;
|
unsigned type;
|
||||||
|
|
||||||
type = FIT_TYPE(fentry[1]);
|
type = FIT_TYPE(fentry[1]);
|
||||||
return sprintf(page, "%02x %-25s %x.%02x %016lx %u\n",
|
seq_printf(m, "%02x %-25s %x.%02x %016lx %u\n",
|
||||||
type,
|
type,
|
||||||
fit_type_name(type),
|
fit_type_name(type),
|
||||||
FIT_MAJOR(fentry[1]), FIT_MINOR(fentry[1]),
|
FIT_MAJOR(fentry[1]), FIT_MINOR(fentry[1]),
|
||||||
fentry[0],
|
fentry[0],
|
||||||
/* mult by sixteen to get size in bytes */
|
/* mult by sixteen to get size in bytes */
|
||||||
(unsigned)(fentry[1] & 0xffffff) * 16);
|
(unsigned)(fentry[1] & 0xffffff) * 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,31 +125,39 @@ static int dump_fit_entry(char *page, unsigned long *fentry)
|
||||||
* OK except for 4kB pages (and no one is going to do that on SN
|
* OK except for 4kB pages (and no one is going to do that on SN
|
||||||
* anyway).
|
* anyway).
|
||||||
*/
|
*/
|
||||||
static int
|
static int proc_fit_show(struct seq_file *m, void *v)
|
||||||
dump_fit(char *page, unsigned long nasid)
|
|
||||||
{
|
{
|
||||||
|
unsigned long nasid = (unsigned long)m->private;
|
||||||
unsigned long fentry[2];
|
unsigned long fentry[2];
|
||||||
int index;
|
int index;
|
||||||
char *p;
|
|
||||||
|
|
||||||
p = page;
|
|
||||||
for (index=0;;index++) {
|
for (index=0;;index++) {
|
||||||
BUG_ON(index * 60 > PAGE_SIZE);
|
BUG_ON(index * 60 > PAGE_SIZE);
|
||||||
if (get_fit_entry(nasid, index, fentry, NULL, 0))
|
if (get_fit_entry(nasid, index, fentry, NULL, 0))
|
||||||
break;
|
break;
|
||||||
p += dump_fit_entry(p, fentry);
|
dump_fit_entry(m, fentry);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
return p - page;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int proc_fit_open(struct inode *inode, struct file *file)
|
||||||
dump_version(char *page, unsigned long nasid)
|
|
||||||
{
|
{
|
||||||
|
return single_open(file, proc_fit_show, PDE_DATA(inode));
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations proc_fit_fops = {
|
||||||
|
.open = proc_fit_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int proc_version_show(struct seq_file *m, void *v)
|
||||||
|
{
|
||||||
|
unsigned long nasid = (unsigned long)m->private;
|
||||||
unsigned long fentry[2];
|
unsigned long fentry[2];
|
||||||
char banner[128];
|
char banner[128];
|
||||||
int index;
|
int index;
|
||||||
int len;
|
|
||||||
|
|
||||||
for (index = 0; ; index++) {
|
for (index = 0; ; index++) {
|
||||||
if (get_fit_entry(nasid, index, fentry, banner,
|
if (get_fit_entry(nasid, index, fentry, banner,
|
||||||
|
@ -158,56 +167,24 @@ dump_version(char *page, unsigned long nasid)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = sprintf(page, "%x.%02x\n", FIT_MAJOR(fentry[1]),
|
seq_printf(m, "%x.%02x\n", FIT_MAJOR(fentry[1]), FIT_MINOR(fentry[1]));
|
||||||
FIT_MINOR(fentry[1]));
|
|
||||||
page += len;
|
|
||||||
|
|
||||||
if (banner[0])
|
if (banner[0])
|
||||||
len += snprintf(page, PAGE_SIZE-len, "%s\n", banner);
|
seq_printf(m, "%s\n", banner);
|
||||||
|
return 0;
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* same as in proc_misc.c */
|
static int proc_version_open(struct inode *inode, struct file *file)
|
||||||
static int
|
|
||||||
proc_calc_metrics(char *page, char **start, off_t off, int count, int *eof,
|
|
||||||
int len)
|
|
||||||
{
|
{
|
||||||
if (len <= off + count)
|
return single_open(file, proc_version_show, PDE_DATA(inode));
|
||||||
*eof = 1;
|
|
||||||
*start = page + off;
|
|
||||||
len -= off;
|
|
||||||
if (len > count)
|
|
||||||
len = count;
|
|
||||||
if (len < 0)
|
|
||||||
len = 0;
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static const struct file_operations proc_version_fops = {
|
||||||
read_version_entry(char *page, char **start, off_t off, int count, int *eof,
|
.open = proc_version_open,
|
||||||
void *data)
|
.read = seq_read,
|
||||||
{
|
.llseek = seq_lseek,
|
||||||
int len;
|
.release = seq_release,
|
||||||
|
};
|
||||||
/* data holds the NASID of the node */
|
|
||||||
len = dump_version(page, (unsigned long)data);
|
|
||||||
len = proc_calc_metrics(page, start, off, count, eof, len);
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
read_fit_entry(char *page, char **start, off_t off, int count, int *eof,
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
|
|
||||||
/* data holds the NASID of the node */
|
|
||||||
len = dump_fit(page, (unsigned long)data);
|
|
||||||
len = proc_calc_metrics(page, start, off, count, eof, len);
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* module entry points */
|
/* module entry points */
|
||||||
int __init prominfo_init(void);
|
int __init prominfo_init(void);
|
||||||
|
@ -216,58 +193,39 @@ void __exit prominfo_exit(void);
|
||||||
module_init(prominfo_init);
|
module_init(prominfo_init);
|
||||||
module_exit(prominfo_exit);
|
module_exit(prominfo_exit);
|
||||||
|
|
||||||
static struct proc_dir_entry **proc_entries;
|
|
||||||
static struct proc_dir_entry *sgi_prominfo_entry;
|
|
||||||
|
|
||||||
#define NODE_NAME_LEN 11
|
#define NODE_NAME_LEN 11
|
||||||
|
|
||||||
int __init prominfo_init(void)
|
int __init prominfo_init(void)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry **entp;
|
struct proc_dir_entry *sgi_prominfo_entry;
|
||||||
cnodeid_t cnodeid;
|
cnodeid_t cnodeid;
|
||||||
unsigned long nasid;
|
|
||||||
int size;
|
|
||||||
char name[NODE_NAME_LEN];
|
|
||||||
|
|
||||||
if (!ia64_platform_is("sn2"))
|
if (!ia64_platform_is("sn2"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
size = num_online_nodes() * sizeof(struct proc_dir_entry *);
|
sgi_prominfo_entry = proc_mkdir("sgi_prominfo", NULL);
|
||||||
proc_entries = kzalloc(size, GFP_KERNEL);
|
if (!sgi_prominfo_entry)
|
||||||
if (!proc_entries)
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
sgi_prominfo_entry = proc_mkdir("sgi_prominfo", NULL);
|
|
||||||
|
|
||||||
entp = proc_entries;
|
|
||||||
for_each_online_node(cnodeid) {
|
for_each_online_node(cnodeid) {
|
||||||
sprintf(name, "node%d", cnodeid);
|
struct proc_dir_entry *dir;
|
||||||
*entp = proc_mkdir(name, sgi_prominfo_entry);
|
unsigned long nasid;
|
||||||
nasid = cnodeid_to_nasid(cnodeid);
|
char name[NODE_NAME_LEN];
|
||||||
create_proc_read_entry("fit", 0, *entp, read_fit_entry,
|
|
||||||
(void *)nasid);
|
|
||||||
create_proc_read_entry("version", 0, *entp,
|
|
||||||
read_version_entry, (void *)nasid);
|
|
||||||
entp++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
sprintf(name, "node%d", cnodeid);
|
||||||
|
dir = proc_mkdir(name, sgi_prominfo_entry);
|
||||||
|
if (!dir)
|
||||||
|
continue;
|
||||||
|
nasid = cnodeid_to_nasid(cnodeid);
|
||||||
|
proc_create_data("fit", 0, dir,
|
||||||
|
&proc_fit_fops, (void *)nasid);
|
||||||
|
proc_create_data("version", 0, dir,
|
||||||
|
&proc_version_fops, (void *)nasid);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __exit prominfo_exit(void)
|
void __exit prominfo_exit(void)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry **entp;
|
remove_proc_subtree("sgi_prominfo", NULL);
|
||||||
unsigned int cnodeid;
|
|
||||||
char name[NODE_NAME_LEN];
|
|
||||||
|
|
||||||
entp = proc_entries;
|
|
||||||
for_each_online_node(cnodeid) {
|
|
||||||
remove_proc_entry("fit", *entp);
|
|
||||||
remove_proc_entry("version", *entp);
|
|
||||||
sprintf(name, "node%d", cnodeid);
|
|
||||||
remove_proc_entry(name, sgi_prominfo_entry);
|
|
||||||
entp++;
|
|
||||||
}
|
|
||||||
remove_proc_entry("sgi_prominfo", NULL);
|
|
||||||
kfree(proc_entries);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <asm/mipsregs.h>
|
#include <asm/mipsregs.h>
|
||||||
#include <asm/cacheflush.h>
|
#include <asm/cacheflush.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
|
|
||||||
#include <asm/smtc_proc.h>
|
#include <asm/smtc_proc.h>
|
||||||
|
|
||||||
|
@ -30,51 +31,39 @@ unsigned long selfipis[NR_CPUS];
|
||||||
|
|
||||||
struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS];
|
struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS];
|
||||||
|
|
||||||
static struct proc_dir_entry *smtc_stats;
|
|
||||||
|
|
||||||
atomic_t smtc_fpu_recoveries;
|
atomic_t smtc_fpu_recoveries;
|
||||||
|
|
||||||
static int proc_read_smtc(char *page, char **start, off_t off,
|
static int smtc_proc_show(struct seq_file *m, void *v)
|
||||||
int count, int *eof, void *data)
|
|
||||||
{
|
{
|
||||||
int totalen = 0;
|
|
||||||
int len;
|
|
||||||
int i;
|
int i;
|
||||||
extern unsigned long ebase;
|
extern unsigned long ebase;
|
||||||
|
|
||||||
len = sprintf(page, "SMTC Status Word: 0x%08x\n", smtc_status);
|
seq_printf(m, "SMTC Status Word: 0x%08x\n", smtc_status);
|
||||||
totalen += len;
|
seq_printf(m, "Config7: 0x%08x\n", read_c0_config7());
|
||||||
page += len;
|
seq_printf(m, "EBASE: 0x%08lx\n", ebase);
|
||||||
len = sprintf(page, "Config7: 0x%08x\n", read_c0_config7());
|
seq_printf(m, "Counter Interrupts taken per CPU (TC)\n");
|
||||||
totalen += len;
|
for (i=0; i < NR_CPUS; i++)
|
||||||
page += len;
|
seq_printf(m, "%d: %ld\n", i, smtc_cpu_stats[i].timerints);
|
||||||
len = sprintf(page, "EBASE: 0x%08lx\n", ebase);
|
seq_printf(m, "Self-IPIs by CPU:\n");
|
||||||
totalen += len;
|
for(i = 0; i < NR_CPUS; i++)
|
||||||
page += len;
|
seq_printf(m, "%d: %ld\n", i, smtc_cpu_stats[i].selfipis);
|
||||||
len = sprintf(page, "Counter Interrupts taken per CPU (TC)\n");
|
seq_printf(m, "%d Recoveries of \"stolen\" FPU\n",
|
||||||
totalen += len;
|
atomic_read(&smtc_fpu_recoveries));
|
||||||
page += len;
|
return 0;
|
||||||
for (i=0; i < NR_CPUS; i++) {
|
|
||||||
len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].timerints);
|
|
||||||
totalen += len;
|
|
||||||
page += len;
|
|
||||||
}
|
|
||||||
len = sprintf(page, "Self-IPIs by CPU:\n");
|
|
||||||
totalen += len;
|
|
||||||
page += len;
|
|
||||||
for(i = 0; i < NR_CPUS; i++) {
|
|
||||||
len = sprintf(page, "%d: %ld\n", i, smtc_cpu_stats[i].selfipis);
|
|
||||||
totalen += len;
|
|
||||||
page += len;
|
|
||||||
}
|
|
||||||
len = sprintf(page, "%d Recoveries of \"stolen\" FPU\n",
|
|
||||||
atomic_read(&smtc_fpu_recoveries));
|
|
||||||
totalen += len;
|
|
||||||
page += len;
|
|
||||||
|
|
||||||
return totalen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int smtc_proc_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, smtc_proc_show, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations smtc_proc_fops = {
|
||||||
|
.open = smtc_proc_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
|
|
||||||
void init_smtc_stats(void)
|
void init_smtc_stats(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -86,6 +75,5 @@ void init_smtc_stats(void)
|
||||||
|
|
||||||
atomic_set(&smtc_fpu_recoveries, 0);
|
atomic_set(&smtc_fpu_recoveries, 0);
|
||||||
|
|
||||||
smtc_stats = create_proc_read_entry("smtc", 0444, NULL,
|
proc_create("smtc", 0444, NULL, &smtc_proc_fops);
|
||||||
proc_read_smtc, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,13 +58,13 @@ static int pvc_line_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int pvc_line_proc_open(struct inode *inode, struct file *file)
|
static int pvc_line_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, pvc_line_proc_show, PDE(inode)->data);
|
return single_open(file, pvc_line_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf,
|
static ssize_t pvc_line_proc_write(struct file *file, const char __user *buf,
|
||||||
size_t count, loff_t *pos)
|
size_t count, loff_t *pos)
|
||||||
{
|
{
|
||||||
int lineno = *(int *)PDE(file_inode(file))->data;
|
int lineno = *(int *)PDE_DATA(file_inode(file));
|
||||||
char kbuf[PVC_LINELEN];
|
char kbuf[PVC_LINELEN];
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <linux/pfn.h>
|
#include <linux/pfn.h>
|
||||||
#include <linux/hardirq.h>
|
#include <linux/hardirq.h>
|
||||||
#include <linux/gfp.h>
|
#include <linux/gfp.h>
|
||||||
|
#include <linux/kcore.h>
|
||||||
|
|
||||||
#include <asm/asm-offsets.h>
|
#include <asm/asm-offsets.h>
|
||||||
#include <asm/bootinfo.h>
|
#include <asm/bootinfo.h>
|
||||||
|
|
|
@ -53,56 +53,51 @@ static void pci_proc_init(void);
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: read_msp_pci_counts
|
* FUNCTION: show_msp_pci_counts
|
||||||
* _________________________________________________________________________
|
* _________________________________________________________________________
|
||||||
*
|
*
|
||||||
* DESCRIPTION: Prints the count of how many times each PCI
|
* DESCRIPTION: Prints the count of how many times each PCI
|
||||||
* interrupt has asserted. Can be invoked by the
|
* interrupt has asserted. Can be invoked by the
|
||||||
* /proc filesystem.
|
* /proc filesystem.
|
||||||
*
|
*
|
||||||
* INPUTS: page - part of STDOUT calculation
|
* INPUTS: m - synthetic file construction data
|
||||||
* off - part of STDOUT calculation
|
* v - iterator
|
||||||
* count - part of STDOUT calculation
|
|
||||||
* data - unused
|
|
||||||
*
|
*
|
||||||
* OUTPUTS: start - new start location
|
* RETURNS: 0 or error
|
||||||
* eof - end of file pointer
|
|
||||||
*
|
|
||||||
* RETURNS: len - STDOUT length
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static int read_msp_pci_counts(char *page, char **start, off_t off,
|
static int show_msp_pci_counts(struct seq_file *m, void *v)
|
||||||
int count, int *eof, void *data)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int len = 0;
|
|
||||||
unsigned int intcount, total = 0;
|
unsigned int intcount, total = 0;
|
||||||
|
|
||||||
for (i = 0; i < 32; ++i) {
|
for (i = 0; i < 32; ++i) {
|
||||||
intcount = pci_int_count[i];
|
intcount = pci_int_count[i];
|
||||||
if (intcount != 0) {
|
if (intcount != 0) {
|
||||||
len += sprintf(page + len, "[%d] = %u\n", i, intcount);
|
seq_printf(m, "[%d] = %u\n", i, intcount);
|
||||||
total += intcount;
|
total += intcount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
len += sprintf(page + len, "total = %u\n", total);
|
seq_printf(m, "total = %u\n", total);
|
||||||
if (len <= off+count)
|
return 0;
|
||||||
*eof = 1;
|
|
||||||
|
|
||||||
*start = page + off;
|
|
||||||
len -= off;
|
|
||||||
if (len > count)
|
|
||||||
len = count;
|
|
||||||
if (len < 0)
|
|
||||||
len = 0;
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int msp_pci_rd_cnt_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, show_msp_pci_counts, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations msp_pci_rd_cnt_fops = {
|
||||||
|
.open = msp_pci_rd_cnt_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: gen_pci_cfg_wr
|
* FUNCTION: gen_pci_cfg_wr_show
|
||||||
* _________________________________________________________________________
|
* _________________________________________________________________________
|
||||||
*
|
*
|
||||||
* DESCRIPTION: Generates a configuration write cycle for debug purposes.
|
* DESCRIPTION: Generates a configuration write cycle for debug purposes.
|
||||||
|
@ -112,37 +107,30 @@ static int read_msp_pci_counts(char *page, char **start, off_t off,
|
||||||
* PCI bus. Intent is that this function by invocable from
|
* PCI bus. Intent is that this function by invocable from
|
||||||
* the /proc filesystem.
|
* the /proc filesystem.
|
||||||
*
|
*
|
||||||
* INPUTS: page - part of STDOUT calculation
|
* INPUTS: m - synthetic file construction data
|
||||||
* off - part of STDOUT calculation
|
* v - iterator
|
||||||
* count - part of STDOUT calculation
|
|
||||||
* data - unused
|
|
||||||
*
|
*
|
||||||
* OUTPUTS: start - new start location
|
* RETURNS: 0 or error
|
||||||
* eof - end of file pointer
|
|
||||||
*
|
|
||||||
* RETURNS: len - STDOUT length
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static int gen_pci_cfg_wr(char *page, char **start, off_t off,
|
static int gen_pci_cfg_wr_show(struct seq_file *m, void *v)
|
||||||
int count, int *eof, void *data)
|
|
||||||
{
|
{
|
||||||
unsigned char where = 0; /* Write to static Device/Vendor ID */
|
unsigned char where = 0; /* Write to static Device/Vendor ID */
|
||||||
unsigned char bus_num = 0; /* Bus 0 */
|
unsigned char bus_num = 0; /* Bus 0 */
|
||||||
unsigned char dev_fn = 0xF; /* Arbitrary device number */
|
unsigned char dev_fn = 0xF; /* Arbitrary device number */
|
||||||
u32 wr_data = 0xFF00AA00; /* Arbitrary data */
|
u32 wr_data = 0xFF00AA00; /* Arbitrary data */
|
||||||
struct msp_pci_regs *preg = (void *)PCI_BASE_REG;
|
struct msp_pci_regs *preg = (void *)PCI_BASE_REG;
|
||||||
int len = 0;
|
|
||||||
unsigned long value;
|
unsigned long value;
|
||||||
int intr;
|
int intr;
|
||||||
|
|
||||||
len += sprintf(page + len, "PMC MSP PCI: Beginning\n");
|
seq_puts(m, "PMC MSP PCI: Beginning\n");
|
||||||
|
|
||||||
if (proc_init == 0) {
|
if (proc_init == 0) {
|
||||||
pci_proc_init();
|
pci_proc_init();
|
||||||
proc_init = ~0;
|
proc_init = ~0;
|
||||||
}
|
}
|
||||||
|
|
||||||
len += sprintf(page + len, "PMC MSP PCI: Before Cfg Wr\n");
|
seq_puts(m, "PMC MSP PCI: Before Cfg Wr\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate PCI Configuration Write Cycle
|
* Generate PCI Configuration Write Cycle
|
||||||
|
@ -168,21 +156,22 @@ static int gen_pci_cfg_wr(char *page, char **start, off_t off,
|
||||||
*/
|
*/
|
||||||
intr = preg->if_status;
|
intr = preg->if_status;
|
||||||
|
|
||||||
len += sprintf(page + len, "PMC MSP PCI: After Cfg Wr\n");
|
seq_puts(m, "PMC MSP PCI: After Cfg Wr\n");
|
||||||
|
return 0;
|
||||||
/* Handle STDOUT calculations */
|
|
||||||
if (len <= off+count)
|
|
||||||
*eof = 1;
|
|
||||||
*start = page + off;
|
|
||||||
len -= off;
|
|
||||||
if (len > count)
|
|
||||||
len = count;
|
|
||||||
if (len < 0)
|
|
||||||
len = 0;
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int gen_pci_cfg_wr_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, gen_pci_cfg_wr_show, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations gen_pci_cfg_wr_fops = {
|
||||||
|
.open = gen_pci_cfg_wr_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: pci_proc_init
|
* FUNCTION: pci_proc_init
|
||||||
|
@ -199,10 +188,8 @@ static int gen_pci_cfg_wr(char *page, char **start, off_t off,
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static void pci_proc_init(void)
|
static void pci_proc_init(void)
|
||||||
{
|
{
|
||||||
create_proc_read_entry("pmc_msp_pci_rd_cnt", 0, NULL,
|
proc_create("pmc_msp_pci_rd_cnt", 0, NULL, &msp_pci_rd_cnt_fops);
|
||||||
read_msp_pci_counts, NULL);
|
proc_create("pmc_msp_pci_cfg_wr", 0, NULL, &gen_pci_cfg_wr_fops);
|
||||||
create_proc_read_entry("pmc_msp_pci_cfg_wr", 0, NULL,
|
|
||||||
gen_pci_cfg_wr, NULL);
|
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_PROC_FS && PCI_COUNTERS */
|
#endif /* CONFIG_PROC_FS && PCI_COUNTERS */
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
|
||||||
#include <asm/sibyte/sb1250.h>
|
#include <asm/sibyte/sb1250.h>
|
||||||
|
@ -99,63 +100,60 @@ void check_bus_watcher(void)
|
||||||
printk("Bus watcher indicates no error\n");
|
printk("Bus watcher indicates no error\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bw_print_buffer(char *page, struct bw_stats_struct *stats)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
|
|
||||||
len = sprintf(page, "SiByte Bus Watcher statistics\n");
|
|
||||||
len += sprintf(page+len, "-----------------------------\n");
|
|
||||||
len += sprintf(page+len, "L2-d-cor %8ld\nL2-d-bad %8ld\n",
|
|
||||||
stats->l2_cor_d, stats->l2_bad_d);
|
|
||||||
len += sprintf(page+len, "L2-t-cor %8ld\nL2-t-bad %8ld\n",
|
|
||||||
stats->l2_cor_t, stats->l2_bad_t);
|
|
||||||
len += sprintf(page+len, "MC-d-cor %8ld\nMC-d-bad %8ld\n",
|
|
||||||
stats->mem_cor_d, stats->mem_bad_d);
|
|
||||||
len += sprintf(page+len, "IO-err %8ld\n", stats->bus_error);
|
|
||||||
len += sprintf(page+len, "\nLast recorded signature:\n");
|
|
||||||
len += sprintf(page+len, "Request %02x from %d, answered by %d with Dcode %d\n",
|
|
||||||
(unsigned int)(G_SCD_BERR_TID(stats->status) & 0x3f),
|
|
||||||
(int)(G_SCD_BERR_TID(stats->status) >> 6),
|
|
||||||
(int)G_SCD_BERR_RID(stats->status),
|
|
||||||
(int)G_SCD_BERR_DCODE(stats->status));
|
|
||||||
/* XXXKW indicate multiple errors between printings, or stats
|
|
||||||
collection (or both)? */
|
|
||||||
if (stats->status & M_SCD_BERR_MULTERRS)
|
|
||||||
len += sprintf(page+len, "Multiple errors observed since last check.\n");
|
|
||||||
if (stats->status_printed) {
|
|
||||||
len += sprintf(page+len, "(no change since last printing)\n");
|
|
||||||
} else {
|
|
||||||
stats->status_printed = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
|
|
||||||
/* For simplicity, I want to assume a single read is required each
|
/* For simplicity, I want to assume a single read is required each
|
||||||
time */
|
time */
|
||||||
static int bw_read_proc(char *page, char **start, off_t off,
|
static int bw_proc_show(struct seq_file *m, void *v)
|
||||||
int count, int *eof, void *data)
|
|
||||||
{
|
{
|
||||||
int len;
|
struct bw_stats_struct *stats = m->private;
|
||||||
|
|
||||||
if (off == 0) {
|
seq_puts(m, "SiByte Bus Watcher statistics\n");
|
||||||
len = bw_print_buffer(page, data);
|
seq_puts(m, "-----------------------------\n");
|
||||||
*start = page;
|
seq_printf(m, "L2-d-cor %8ld\nL2-d-bad %8ld\n",
|
||||||
|
stats->l2_cor_d, stats->l2_bad_d);
|
||||||
|
seq_printf(m, "L2-t-cor %8ld\nL2-t-bad %8ld\n",
|
||||||
|
stats->l2_cor_t, stats->l2_bad_t);
|
||||||
|
seq_printf(m, "MC-d-cor %8ld\nMC-d-bad %8ld\n",
|
||||||
|
stats->mem_cor_d, stats->mem_bad_d);
|
||||||
|
seq_printf(m, "IO-err %8ld\n", stats->bus_error);
|
||||||
|
seq_puts(m, "\nLast recorded signature:\n");
|
||||||
|
seq_printf(m, "Request %02x from %d, answered by %d with Dcode %d\n",
|
||||||
|
(unsigned int)(G_SCD_BERR_TID(stats->status) & 0x3f),
|
||||||
|
(int)(G_SCD_BERR_TID(stats->status) >> 6),
|
||||||
|
(int)G_SCD_BERR_RID(stats->status),
|
||||||
|
(int)G_SCD_BERR_DCODE(stats->status));
|
||||||
|
/* XXXKW indicate multiple errors between printings, or stats
|
||||||
|
collection (or both)? */
|
||||||
|
if (stats->status & M_SCD_BERR_MULTERRS)
|
||||||
|
seq_puts(m, "Multiple errors observed since last check.\n");
|
||||||
|
if (stats->status_printed) {
|
||||||
|
seq_puts(m, "(no change since last printing)\n");
|
||||||
} else {
|
} else {
|
||||||
len = 0;
|
stats->status_printed = 1;
|
||||||
*eof = 1;
|
|
||||||
}
|
}
|
||||||
return len;
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int bw_proc_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, bw_proc_show, PDE_DATA(inode));
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations bw_proc_fops = {
|
||||||
|
.open = bw_proc_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
|
|
||||||
static void create_proc_decoder(struct bw_stats_struct *stats)
|
static void create_proc_decoder(struct bw_stats_struct *stats)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *ent;
|
struct proc_dir_entry *ent;
|
||||||
|
|
||||||
ent = create_proc_read_entry("bus_watcher", S_IWUSR | S_IRUGO, NULL,
|
ent = proc_create_data("bus_watcher", S_IWUSR | S_IRUGO, NULL,
|
||||||
bw_read_proc, stats);
|
&bw_proc_fops, stats);
|
||||||
if (!ent) {
|
if (!ent) {
|
||||||
printk(KERN_INFO "Unable to initialize bus_watcher /proc entry\n");
|
printk(KERN_INFO "Unable to initialize bus_watcher /proc entry\n");
|
||||||
return;
|
return;
|
||||||
|
@ -210,11 +208,6 @@ static irqreturn_t sibyte_bw_int(int irq, void *data)
|
||||||
stats->bus_error += G_SCD_MEM_BUSERR(cntr);
|
stats->bus_error += G_SCD_MEM_BUSERR(cntr);
|
||||||
csr_out32(0, IOADDR(A_BUS_MEM_IO_ERRORS));
|
csr_out32(0, IOADDR(A_BUS_MEM_IO_ERRORS));
|
||||||
|
|
||||||
#ifndef CONFIG_PROC_FS
|
|
||||||
bw_print_buffer(bw_buf, stats);
|
|
||||||
printk(bw_buf);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
#include <linux/module.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/reboot.h>
|
#include <linux/reboot.h>
|
||||||
#include <linux/notifier.h>
|
#include <linux/notifier.h>
|
||||||
#include <linux/cache.h>
|
#include <linux/cache.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
|
|
||||||
#include <asm/pdc_chassis.h>
|
#include <asm/pdc_chassis.h>
|
||||||
#include <asm/processor.h>
|
#include <asm/processor.h>
|
||||||
|
@ -244,38 +246,38 @@ int pdc_chassis_send_status(int message)
|
||||||
|
|
||||||
#ifdef CONFIG_PDC_CHASSIS_WARN
|
#ifdef CONFIG_PDC_CHASSIS_WARN
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
static int pdc_chassis_warn_pread(char *page, char **start, off_t off,
|
static int pdc_chassis_warn_show(struct seq_file *m, void *v)
|
||||||
int count, int *eof, void *data)
|
|
||||||
{
|
{
|
||||||
char *out = page;
|
|
||||||
int len, ret;
|
|
||||||
unsigned long warn;
|
unsigned long warn;
|
||||||
u32 warnreg;
|
u32 warnreg;
|
||||||
|
|
||||||
ret = pdc_chassis_warn(&warn);
|
if (pdc_chassis_warn(&warn) != PDC_OK)
|
||||||
if (ret != PDC_OK)
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
warnreg = (warn & 0xFFFFFFFF);
|
warnreg = (warn & 0xFFFFFFFF);
|
||||||
|
|
||||||
if ((warnreg >> 24) & 0xFF)
|
if ((warnreg >> 24) & 0xFF)
|
||||||
out += sprintf(out, "Chassis component failure! (eg fan or PSU): 0x%.2x\n", ((warnreg >> 24) & 0xFF));
|
seq_printf(m, "Chassis component failure! (eg fan or PSU): 0x%.2x\n",
|
||||||
|
(warnreg >> 24) & 0xFF);
|
||||||
|
|
||||||
out += sprintf(out, "Battery: %s\n", (warnreg & 0x04) ? "Low!" : "OK");
|
seq_printf(m, "Battery: %s\n", (warnreg & 0x04) ? "Low!" : "OK");
|
||||||
out += sprintf(out, "Temp low: %s\n", (warnreg & 0x02) ? "Exceeded!" : "OK");
|
seq_printf(m, "Temp low: %s\n", (warnreg & 0x02) ? "Exceeded!" : "OK");
|
||||||
out += sprintf(out, "Temp mid: %s\n", (warnreg & 0x01) ? "Exceeded!" : "OK");
|
seq_printf(m, "Temp mid: %s\n", (warnreg & 0x01) ? "Exceeded!" : "OK");
|
||||||
|
return 0;
|
||||||
len = out - page - off;
|
|
||||||
if (len < count) {
|
|
||||||
*eof = 1;
|
|
||||||
if (len <= 0) return 0;
|
|
||||||
} else {
|
|
||||||
len = count;
|
|
||||||
}
|
|
||||||
*start = page + off;
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int pdc_chassis_warn_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, pdc_chassis_warn_show, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations pdc_chassis_warn_fops = {
|
||||||
|
.open = pdc_chassis_warn_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
|
|
||||||
static int __init pdc_chassis_create_procfs(void)
|
static int __init pdc_chassis_create_procfs(void)
|
||||||
{
|
{
|
||||||
unsigned long test;
|
unsigned long test;
|
||||||
|
@ -290,8 +292,7 @@ static int __init pdc_chassis_create_procfs(void)
|
||||||
|
|
||||||
printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n",
|
printk(KERN_INFO "Enabling PDC chassis warnings support v%s\n",
|
||||||
PDC_CHASSIS_VER);
|
PDC_CHASSIS_VER);
|
||||||
create_proc_read_entry("chassis", 0400, NULL, pdc_chassis_warn_pread,
|
proc_create("chassis", 0400, NULL, &pdc_chassis_warn_fops);
|
||||||
NULL);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,6 @@
|
||||||
|
|
||||||
/* #define LPARCFG_DEBUG */
|
/* #define LPARCFG_DEBUG */
|
||||||
|
|
||||||
static struct proc_dir_entry *proc_ppc64_lparcfg;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Track sum of all purrs across all processors. This is used to further
|
* Track sum of all purrs across all processors. This is used to further
|
||||||
* calculate usage values by different applications
|
* calculate usage values by different applications
|
||||||
|
@ -688,27 +686,22 @@ static const struct file_operations lparcfg_fops = {
|
||||||
|
|
||||||
static int __init lparcfg_init(void)
|
static int __init lparcfg_init(void)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *ent;
|
|
||||||
umode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
|
umode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
|
||||||
|
|
||||||
/* Allow writing if we have FW_FEATURE_SPLPAR */
|
/* Allow writing if we have FW_FEATURE_SPLPAR */
|
||||||
if (firmware_has_feature(FW_FEATURE_SPLPAR))
|
if (firmware_has_feature(FW_FEATURE_SPLPAR))
|
||||||
mode |= S_IWUSR;
|
mode |= S_IWUSR;
|
||||||
|
|
||||||
ent = proc_create("powerpc/lparcfg", mode, NULL, &lparcfg_fops);
|
if (!proc_create("powerpc/lparcfg", mode, NULL, &lparcfg_fops)) {
|
||||||
if (!ent) {
|
|
||||||
printk(KERN_ERR "Failed to create powerpc/lparcfg\n");
|
printk(KERN_ERR "Failed to create powerpc/lparcfg\n");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
proc_ppc64_lparcfg = ent;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit lparcfg_cleanup(void)
|
static void __exit lparcfg_cleanup(void)
|
||||||
{
|
{
|
||||||
if (proc_ppc64_lparcfg)
|
remove_proc_subtree("powerpc/lparcfg", NULL);
|
||||||
remove_proc_entry("lparcfg", proc_ppc64_lparcfg->parent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(lparcfg_init);
|
module_init(lparcfg_init);
|
||||||
|
|
|
@ -32,8 +32,6 @@
|
||||||
static loff_t page_map_seek( struct file *file, loff_t off, int whence)
|
static loff_t page_map_seek( struct file *file, loff_t off, int whence)
|
||||||
{
|
{
|
||||||
loff_t new;
|
loff_t new;
|
||||||
struct proc_dir_entry *dp = PDE(file_inode(file));
|
|
||||||
|
|
||||||
switch(whence) {
|
switch(whence) {
|
||||||
case 0:
|
case 0:
|
||||||
new = off;
|
new = off;
|
||||||
|
@ -42,12 +40,12 @@ static loff_t page_map_seek( struct file *file, loff_t off, int whence)
|
||||||
new = file->f_pos + off;
|
new = file->f_pos + off;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
new = dp->size + off;
|
new = PAGE_SIZE + off;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if ( new < 0 || new > dp->size )
|
if ( new < 0 || new > PAGE_SIZE )
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
return (file->f_pos = new);
|
return (file->f_pos = new);
|
||||||
}
|
}
|
||||||
|
@ -55,19 +53,18 @@ static loff_t page_map_seek( struct file *file, loff_t off, int whence)
|
||||||
static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes,
|
static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes,
|
||||||
loff_t *ppos)
|
loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *dp = PDE(file_inode(file));
|
return simple_read_from_buffer(buf, nbytes, ppos,
|
||||||
return simple_read_from_buffer(buf, nbytes, ppos, dp->data, dp->size);
|
PDE_DATA(file_inode(file)), PAGE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int page_map_mmap( struct file *file, struct vm_area_struct *vma )
|
static int page_map_mmap( struct file *file, struct vm_area_struct *vma )
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *dp = PDE(file_inode(file));
|
if ((vma->vm_end - vma->vm_start) > PAGE_SIZE)
|
||||||
|
|
||||||
if ((vma->vm_end - vma->vm_start) > dp->size)
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
remap_pfn_range(vma, vma->vm_start, __pa(dp->data) >> PAGE_SHIFT,
|
remap_pfn_range(vma, vma->vm_start,
|
||||||
dp->size, vma->vm_page_prot);
|
__pa(PDE_DATA(file_inode(file))) >> PAGE_SHIFT,
|
||||||
|
PAGE_SIZE, vma->vm_page_prot);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +83,7 @@ static int __init proc_ppc64_init(void)
|
||||||
&page_map_fops, vdso_data);
|
&page_map_fops, vdso_data);
|
||||||
if (!pde)
|
if (!pde)
|
||||||
return 1;
|
return 1;
|
||||||
pde->size = PAGE_SIZE;
|
proc_set_size(pde, PAGE_SIZE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,9 +102,10 @@ static struct kmem_cache *flash_block_cache = NULL;
|
||||||
|
|
||||||
#define FLASH_BLOCK_LIST_VERSION (1UL)
|
#define FLASH_BLOCK_LIST_VERSION (1UL)
|
||||||
|
|
||||||
/* Local copy of the flash block list.
|
/*
|
||||||
* We only allow one open of the flash proc file and create this
|
* Local copy of the flash block list.
|
||||||
* list as we go. The rtas_firmware_flash_list varable will be
|
*
|
||||||
|
* The rtas_firmware_flash_list varable will be
|
||||||
* set once the data is fully read.
|
* set once the data is fully read.
|
||||||
*
|
*
|
||||||
* For convenience as we build the list we use virtual addrs,
|
* For convenience as we build the list we use virtual addrs,
|
||||||
|
@ -125,23 +126,23 @@ struct rtas_update_flash_t
|
||||||
struct rtas_manage_flash_t
|
struct rtas_manage_flash_t
|
||||||
{
|
{
|
||||||
int status; /* Returned status */
|
int status; /* Returned status */
|
||||||
unsigned int op; /* Reject or commit image */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Status int must be first member of struct */
|
/* Status int must be first member of struct */
|
||||||
struct rtas_validate_flash_t
|
struct rtas_validate_flash_t
|
||||||
{
|
{
|
||||||
int status; /* Returned status */
|
int status; /* Returned status */
|
||||||
char buf[VALIDATE_BUF_SIZE]; /* Candidate image buffer */
|
char *buf; /* Candidate image buffer */
|
||||||
unsigned int buf_size; /* Size of image buf */
|
unsigned int buf_size; /* Size of image buf */
|
||||||
unsigned int update_results; /* Update results token */
|
unsigned int update_results; /* Update results token */
|
||||||
};
|
};
|
||||||
|
|
||||||
static DEFINE_SPINLOCK(flash_file_open_lock);
|
static struct rtas_update_flash_t rtas_update_flash_data;
|
||||||
static struct proc_dir_entry *firmware_flash_pde;
|
static struct rtas_manage_flash_t rtas_manage_flash_data;
|
||||||
static struct proc_dir_entry *firmware_update_pde;
|
static struct rtas_validate_flash_t rtas_validate_flash_data;
|
||||||
static struct proc_dir_entry *validate_pde;
|
static DEFINE_MUTEX(rtas_update_flash_mutex);
|
||||||
static struct proc_dir_entry *manage_pde;
|
static DEFINE_MUTEX(rtas_manage_flash_mutex);
|
||||||
|
static DEFINE_MUTEX(rtas_validate_flash_mutex);
|
||||||
|
|
||||||
/* Do simple sanity checks on the flash image. */
|
/* Do simple sanity checks on the flash image. */
|
||||||
static int flash_list_valid(struct flash_block_list *flist)
|
static int flash_list_valid(struct flash_block_list *flist)
|
||||||
|
@ -191,10 +192,10 @@ static void free_flash_list(struct flash_block_list *f)
|
||||||
|
|
||||||
static int rtas_flash_release(struct inode *inode, struct file *file)
|
static int rtas_flash_release(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *dp = PDE(file_inode(file));
|
struct rtas_update_flash_t *const uf = &rtas_update_flash_data;
|
||||||
struct rtas_update_flash_t *uf;
|
|
||||||
|
mutex_lock(&rtas_update_flash_mutex);
|
||||||
uf = (struct rtas_update_flash_t *) dp->data;
|
|
||||||
if (uf->flist) {
|
if (uf->flist) {
|
||||||
/* File was opened in write mode for a new flash attempt */
|
/* File was opened in write mode for a new flash attempt */
|
||||||
/* Clear saved list */
|
/* Clear saved list */
|
||||||
|
@ -214,13 +215,14 @@ static int rtas_flash_release(struct inode *inode, struct file *file)
|
||||||
uf->flist = NULL;
|
uf->flist = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
atomic_dec(&dp->count);
|
mutex_unlock(&rtas_update_flash_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_flash_status_msg(int status, char *buf)
|
static size_t get_flash_status_msg(int status, char *buf)
|
||||||
{
|
{
|
||||||
char *msg;
|
const char *msg;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case FLASH_AUTH:
|
case FLASH_AUTH:
|
||||||
|
@ -242,34 +244,51 @@ static void get_flash_status_msg(int status, char *buf)
|
||||||
msg = "ready: firmware image ready for flash on reboot\n";
|
msg = "ready: firmware image ready for flash on reboot\n";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(buf, "error: unexpected status value %d\n", status);
|
return sprintf(buf, "error: unexpected status value %d\n",
|
||||||
return;
|
status);
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(buf, msg);
|
len = strlen(msg);
|
||||||
|
memcpy(buf, msg, len + 1);
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reading the proc file will show status (not the firmware contents) */
|
/* Reading the proc file will show status (not the firmware contents) */
|
||||||
static ssize_t rtas_flash_read(struct file *file, char __user *buf,
|
static ssize_t rtas_flash_read_msg(struct file *file, char __user *buf,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *dp = PDE(file_inode(file));
|
struct rtas_update_flash_t *const uf = &rtas_update_flash_data;
|
||||||
struct rtas_update_flash_t *uf;
|
|
||||||
char msg[RTAS_MSG_MAXLEN];
|
char msg[RTAS_MSG_MAXLEN];
|
||||||
|
size_t len;
|
||||||
|
int status;
|
||||||
|
|
||||||
uf = dp->data;
|
mutex_lock(&rtas_update_flash_mutex);
|
||||||
|
status = uf->status;
|
||||||
|
mutex_unlock(&rtas_update_flash_mutex);
|
||||||
|
|
||||||
if (!strcmp(dp->name, FIRMWARE_FLASH_NAME)) {
|
/* Read as text message */
|
||||||
get_flash_status_msg(uf->status, msg);
|
len = get_flash_status_msg(status, msg);
|
||||||
} else { /* FIRMWARE_UPDATE_NAME */
|
return simple_read_from_buffer(buf, count, ppos, msg, len);
|
||||||
sprintf(msg, "%d\n", uf->status);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
static ssize_t rtas_flash_read_num(struct file *file, char __user *buf,
|
||||||
|
size_t count, loff_t *ppos)
|
||||||
|
{
|
||||||
|
struct rtas_update_flash_t *const uf = &rtas_update_flash_data;
|
||||||
|
char msg[RTAS_MSG_MAXLEN];
|
||||||
|
int status;
|
||||||
|
|
||||||
|
mutex_lock(&rtas_update_flash_mutex);
|
||||||
|
status = uf->status;
|
||||||
|
mutex_unlock(&rtas_update_flash_mutex);
|
||||||
|
|
||||||
|
/* Read as number */
|
||||||
|
sprintf(msg, "%d\n", status);
|
||||||
return simple_read_from_buffer(buf, count, ppos, msg, strlen(msg));
|
return simple_read_from_buffer(buf, count, ppos, msg, strlen(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* constructor for flash_block_cache */
|
/* constructor for flash_block_cache */
|
||||||
void rtas_block_ctor(void *ptr)
|
static void rtas_block_ctor(void *ptr)
|
||||||
{
|
{
|
||||||
memset(ptr, 0, RTAS_BLK_SIZE);
|
memset(ptr, 0, RTAS_BLK_SIZE);
|
||||||
}
|
}
|
||||||
|
@ -282,16 +301,15 @@ void rtas_block_ctor(void *ptr)
|
||||||
static ssize_t rtas_flash_write(struct file *file, const char __user *buffer,
|
static ssize_t rtas_flash_write(struct file *file, const char __user *buffer,
|
||||||
size_t count, loff_t *off)
|
size_t count, loff_t *off)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *dp = PDE(file_inode(file));
|
struct rtas_update_flash_t *const uf = &rtas_update_flash_data;
|
||||||
struct rtas_update_flash_t *uf;
|
|
||||||
char *p;
|
char *p;
|
||||||
int next_free;
|
int next_free, rc;
|
||||||
struct flash_block_list *fl;
|
struct flash_block_list *fl;
|
||||||
|
|
||||||
uf = (struct rtas_update_flash_t *) dp->data;
|
mutex_lock(&rtas_update_flash_mutex);
|
||||||
|
|
||||||
if (uf->status == FLASH_AUTH || count == 0)
|
if (uf->status == FLASH_AUTH || count == 0)
|
||||||
return count; /* discard data */
|
goto out; /* discard data */
|
||||||
|
|
||||||
/* In the case that the image is not ready for flashing, the memory
|
/* In the case that the image is not ready for flashing, the memory
|
||||||
* allocated for the block list will be freed upon the release of the
|
* allocated for the block list will be freed upon the release of the
|
||||||
|
@ -300,7 +318,7 @@ static ssize_t rtas_flash_write(struct file *file, const char __user *buffer,
|
||||||
if (uf->flist == NULL) {
|
if (uf->flist == NULL) {
|
||||||
uf->flist = kmem_cache_alloc(flash_block_cache, GFP_KERNEL);
|
uf->flist = kmem_cache_alloc(flash_block_cache, GFP_KERNEL);
|
||||||
if (!uf->flist)
|
if (!uf->flist)
|
||||||
return -ENOMEM;
|
goto nomem;
|
||||||
}
|
}
|
||||||
|
|
||||||
fl = uf->flist;
|
fl = uf->flist;
|
||||||
|
@ -311,7 +329,7 @@ static ssize_t rtas_flash_write(struct file *file, const char __user *buffer,
|
||||||
/* Need to allocate another block_list */
|
/* Need to allocate another block_list */
|
||||||
fl->next = kmem_cache_alloc(flash_block_cache, GFP_KERNEL);
|
fl->next = kmem_cache_alloc(flash_block_cache, GFP_KERNEL);
|
||||||
if (!fl->next)
|
if (!fl->next)
|
||||||
return -ENOMEM;
|
goto nomem;
|
||||||
fl = fl->next;
|
fl = fl->next;
|
||||||
next_free = 0;
|
next_free = 0;
|
||||||
}
|
}
|
||||||
|
@ -320,52 +338,37 @@ static ssize_t rtas_flash_write(struct file *file, const char __user *buffer,
|
||||||
count = RTAS_BLK_SIZE;
|
count = RTAS_BLK_SIZE;
|
||||||
p = kmem_cache_alloc(flash_block_cache, GFP_KERNEL);
|
p = kmem_cache_alloc(flash_block_cache, GFP_KERNEL);
|
||||||
if (!p)
|
if (!p)
|
||||||
return -ENOMEM;
|
goto nomem;
|
||||||
|
|
||||||
if(copy_from_user(p, buffer, count)) {
|
if(copy_from_user(p, buffer, count)) {
|
||||||
kmem_cache_free(flash_block_cache, p);
|
kmem_cache_free(flash_block_cache, p);
|
||||||
return -EFAULT;
|
rc = -EFAULT;
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
fl->blocks[next_free].data = p;
|
fl->blocks[next_free].data = p;
|
||||||
fl->blocks[next_free].length = count;
|
fl->blocks[next_free].length = count;
|
||||||
fl->num_blocks++;
|
fl->num_blocks++;
|
||||||
|
out:
|
||||||
|
mutex_unlock(&rtas_update_flash_mutex);
|
||||||
return count;
|
return count;
|
||||||
|
|
||||||
|
nomem:
|
||||||
|
rc = -ENOMEM;
|
||||||
|
error:
|
||||||
|
mutex_unlock(&rtas_update_flash_mutex);
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rtas_excl_open(struct inode *inode, struct file *file)
|
/*
|
||||||
{
|
* Flash management routines.
|
||||||
struct proc_dir_entry *dp = PDE(inode);
|
*/
|
||||||
|
static void manage_flash(struct rtas_manage_flash_t *args_buf, unsigned int op)
|
||||||
/* Enforce exclusive open with use count of PDE */
|
|
||||||
spin_lock(&flash_file_open_lock);
|
|
||||||
if (atomic_read(&dp->count) > 2) {
|
|
||||||
spin_unlock(&flash_file_open_lock);
|
|
||||||
return -EBUSY;
|
|
||||||
}
|
|
||||||
|
|
||||||
atomic_inc(&dp->count);
|
|
||||||
spin_unlock(&flash_file_open_lock);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int rtas_excl_release(struct inode *inode, struct file *file)
|
|
||||||
{
|
|
||||||
struct proc_dir_entry *dp = PDE(inode);
|
|
||||||
|
|
||||||
atomic_dec(&dp->count);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void manage_flash(struct rtas_manage_flash_t *args_buf)
|
|
||||||
{
|
{
|
||||||
s32 rc;
|
s32 rc;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rc = rtas_call(rtas_token("ibm,manage-flash-image"), 1,
|
rc = rtas_call(rtas_token("ibm,manage-flash-image"), 1, 1,
|
||||||
1, NULL, args_buf->op);
|
NULL, op);
|
||||||
} while (rtas_busy_delay(rc));
|
} while (rtas_busy_delay(rc));
|
||||||
|
|
||||||
args_buf->status = rc;
|
args_buf->status = rc;
|
||||||
|
@ -374,55 +377,62 @@ static void manage_flash(struct rtas_manage_flash_t *args_buf)
|
||||||
static ssize_t manage_flash_read(struct file *file, char __user *buf,
|
static ssize_t manage_flash_read(struct file *file, char __user *buf,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *dp = PDE(file_inode(file));
|
struct rtas_manage_flash_t *const args_buf = &rtas_manage_flash_data;
|
||||||
struct rtas_manage_flash_t *args_buf;
|
|
||||||
char msg[RTAS_MSG_MAXLEN];
|
char msg[RTAS_MSG_MAXLEN];
|
||||||
int msglen;
|
int msglen, status;
|
||||||
|
|
||||||
args_buf = dp->data;
|
mutex_lock(&rtas_manage_flash_mutex);
|
||||||
if (args_buf == NULL)
|
status = args_buf->status;
|
||||||
return 0;
|
mutex_unlock(&rtas_manage_flash_mutex);
|
||||||
|
|
||||||
msglen = sprintf(msg, "%d\n", args_buf->status);
|
|
||||||
|
|
||||||
|
msglen = sprintf(msg, "%d\n", status);
|
||||||
return simple_read_from_buffer(buf, count, ppos, msg, msglen);
|
return simple_read_from_buffer(buf, count, ppos, msg, msglen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t manage_flash_write(struct file *file, const char __user *buf,
|
static ssize_t manage_flash_write(struct file *file, const char __user *buf,
|
||||||
size_t count, loff_t *off)
|
size_t count, loff_t *off)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *dp = PDE(file_inode(file));
|
struct rtas_manage_flash_t *const args_buf = &rtas_manage_flash_data;
|
||||||
struct rtas_manage_flash_t *args_buf;
|
static const char reject_str[] = "0";
|
||||||
const char reject_str[] = "0";
|
static const char commit_str[] = "1";
|
||||||
const char commit_str[] = "1";
|
|
||||||
char stkbuf[10];
|
char stkbuf[10];
|
||||||
int op;
|
int op, rc;
|
||||||
|
|
||||||
|
mutex_lock(&rtas_manage_flash_mutex);
|
||||||
|
|
||||||
args_buf = (struct rtas_manage_flash_t *) dp->data;
|
|
||||||
if ((args_buf->status == MANAGE_AUTH) || (count == 0))
|
if ((args_buf->status == MANAGE_AUTH) || (count == 0))
|
||||||
return count;
|
goto out;
|
||||||
|
|
||||||
op = -1;
|
op = -1;
|
||||||
if (buf) {
|
if (buf) {
|
||||||
if (count > 9) count = 9;
|
if (count > 9) count = 9;
|
||||||
if (copy_from_user (stkbuf, buf, count)) {
|
rc = -EFAULT;
|
||||||
return -EFAULT;
|
if (copy_from_user (stkbuf, buf, count))
|
||||||
}
|
goto error;
|
||||||
if (strncmp(stkbuf, reject_str, strlen(reject_str)) == 0)
|
if (strncmp(stkbuf, reject_str, strlen(reject_str)) == 0)
|
||||||
op = RTAS_REJECT_TMP_IMG;
|
op = RTAS_REJECT_TMP_IMG;
|
||||||
else if (strncmp(stkbuf, commit_str, strlen(commit_str)) == 0)
|
else if (strncmp(stkbuf, commit_str, strlen(commit_str)) == 0)
|
||||||
op = RTAS_COMMIT_TMP_IMG;
|
op = RTAS_COMMIT_TMP_IMG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op == -1) /* buf is empty, or contains invalid string */
|
if (op == -1) { /* buf is empty, or contains invalid string */
|
||||||
return -EINVAL;
|
rc = -EINVAL;
|
||||||
|
goto error;
|
||||||
args_buf->op = op;
|
}
|
||||||
manage_flash(args_buf);
|
|
||||||
|
|
||||||
|
manage_flash(args_buf, op);
|
||||||
|
out:
|
||||||
|
mutex_unlock(&rtas_manage_flash_mutex);
|
||||||
return count;
|
return count;
|
||||||
|
|
||||||
|
error:
|
||||||
|
mutex_unlock(&rtas_manage_flash_mutex);
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Validation routines.
|
||||||
|
*/
|
||||||
static void validate_flash(struct rtas_validate_flash_t *args_buf)
|
static void validate_flash(struct rtas_validate_flash_t *args_buf)
|
||||||
{
|
{
|
||||||
int token = rtas_token("ibm,validate-flash-image");
|
int token = rtas_token("ibm,validate-flash-image");
|
||||||
|
@ -462,14 +472,14 @@ static int get_validate_flash_msg(struct rtas_validate_flash_t *args_buf,
|
||||||
static ssize_t validate_flash_read(struct file *file, char __user *buf,
|
static ssize_t validate_flash_read(struct file *file, char __user *buf,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *dp = PDE(file_inode(file));
|
struct rtas_validate_flash_t *const args_buf =
|
||||||
struct rtas_validate_flash_t *args_buf;
|
&rtas_validate_flash_data;
|
||||||
char msg[RTAS_MSG_MAXLEN];
|
char msg[RTAS_MSG_MAXLEN];
|
||||||
int msglen;
|
int msglen;
|
||||||
|
|
||||||
args_buf = dp->data;
|
mutex_lock(&rtas_validate_flash_mutex);
|
||||||
|
|
||||||
msglen = get_validate_flash_msg(args_buf, msg);
|
msglen = get_validate_flash_msg(args_buf, msg);
|
||||||
|
mutex_unlock(&rtas_validate_flash_mutex);
|
||||||
|
|
||||||
return simple_read_from_buffer(buf, count, ppos, msg, msglen);
|
return simple_read_from_buffer(buf, count, ppos, msg, msglen);
|
||||||
}
|
}
|
||||||
|
@ -477,24 +487,18 @@ static ssize_t validate_flash_read(struct file *file, char __user *buf,
|
||||||
static ssize_t validate_flash_write(struct file *file, const char __user *buf,
|
static ssize_t validate_flash_write(struct file *file, const char __user *buf,
|
||||||
size_t count, loff_t *off)
|
size_t count, loff_t *off)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *dp = PDE(file_inode(file));
|
struct rtas_validate_flash_t *const args_buf =
|
||||||
struct rtas_validate_flash_t *args_buf;
|
&rtas_validate_flash_data;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
args_buf = (struct rtas_validate_flash_t *) dp->data;
|
mutex_lock(&rtas_validate_flash_mutex);
|
||||||
|
|
||||||
if (dp->data == NULL) {
|
|
||||||
dp->data = kmalloc(sizeof(struct rtas_validate_flash_t),
|
|
||||||
GFP_KERNEL);
|
|
||||||
if (dp->data == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We are only interested in the first 4K of the
|
/* We are only interested in the first 4K of the
|
||||||
* candidate image */
|
* candidate image */
|
||||||
if ((*off >= VALIDATE_BUF_SIZE) ||
|
if ((*off >= VALIDATE_BUF_SIZE) ||
|
||||||
(args_buf->status == VALIDATE_AUTH)) {
|
(args_buf->status == VALIDATE_AUTH)) {
|
||||||
*off += count;
|
*off += count;
|
||||||
|
mutex_unlock(&rtas_validate_flash_mutex);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,31 +521,29 @@ static ssize_t validate_flash_write(struct file *file, const char __user *buf,
|
||||||
*off += count;
|
*off += count;
|
||||||
rc = count;
|
rc = count;
|
||||||
done:
|
done:
|
||||||
if (rc < 0) {
|
mutex_unlock(&rtas_validate_flash_mutex);
|
||||||
kfree(dp->data);
|
|
||||||
dp->data = NULL;
|
|
||||||
}
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int validate_flash_release(struct inode *inode, struct file *file)
|
static int validate_flash_release(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *dp = PDE(file_inode(file));
|
struct rtas_validate_flash_t *const args_buf =
|
||||||
struct rtas_validate_flash_t *args_buf;
|
&rtas_validate_flash_data;
|
||||||
|
|
||||||
args_buf = (struct rtas_validate_flash_t *) dp->data;
|
mutex_lock(&rtas_validate_flash_mutex);
|
||||||
|
|
||||||
if (args_buf->status == VALIDATE_READY) {
|
if (args_buf->status == VALIDATE_READY) {
|
||||||
args_buf->buf_size = VALIDATE_BUF_SIZE;
|
args_buf->buf_size = VALIDATE_BUF_SIZE;
|
||||||
validate_flash(args_buf);
|
validate_flash(args_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The matching atomic_inc was in rtas_excl_open() */
|
mutex_unlock(&rtas_validate_flash_mutex);
|
||||||
atomic_dec(&dp->count);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* On-reboot flash update applicator.
|
||||||
|
*/
|
||||||
static void rtas_flash_firmware(int reboot_type)
|
static void rtas_flash_firmware(int reboot_type)
|
||||||
{
|
{
|
||||||
unsigned long image_size;
|
unsigned long image_size;
|
||||||
|
@ -634,75 +636,57 @@ static void rtas_flash_firmware(int reboot_type)
|
||||||
spin_unlock(&rtas_data_buf_lock);
|
spin_unlock(&rtas_data_buf_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void remove_flash_pde(struct proc_dir_entry *dp)
|
/*
|
||||||
{
|
* Manifest of proc files to create
|
||||||
if (dp) {
|
*/
|
||||||
kfree(dp->data);
|
struct rtas_flash_file {
|
||||||
remove_proc_entry(dp->name, dp->parent);
|
const char *filename;
|
||||||
}
|
const char *rtas_call_name;
|
||||||
}
|
|
||||||
|
|
||||||
static int initialize_flash_pde_data(const char *rtas_call_name,
|
|
||||||
size_t buf_size,
|
|
||||||
struct proc_dir_entry *dp)
|
|
||||||
{
|
|
||||||
int *status;
|
int *status;
|
||||||
int token;
|
const struct file_operations fops;
|
||||||
|
|
||||||
dp->data = kzalloc(buf_size, GFP_KERNEL);
|
|
||||||
if (dp->data == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This code assumes that the status int is the first member of the
|
|
||||||
* struct
|
|
||||||
*/
|
|
||||||
status = (int *) dp->data;
|
|
||||||
token = rtas_token(rtas_call_name);
|
|
||||||
if (token == RTAS_UNKNOWN_SERVICE)
|
|
||||||
*status = FLASH_AUTH;
|
|
||||||
else
|
|
||||||
*status = FLASH_NO_OP;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct proc_dir_entry *create_flash_pde(const char *filename,
|
|
||||||
const struct file_operations *fops)
|
|
||||||
{
|
|
||||||
return proc_create(filename, S_IRUSR | S_IWUSR, NULL, fops);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct file_operations rtas_flash_operations = {
|
|
||||||
.owner = THIS_MODULE,
|
|
||||||
.read = rtas_flash_read,
|
|
||||||
.write = rtas_flash_write,
|
|
||||||
.open = rtas_excl_open,
|
|
||||||
.release = rtas_flash_release,
|
|
||||||
.llseek = default_llseek,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct file_operations manage_flash_operations = {
|
static const struct rtas_flash_file rtas_flash_files[] = {
|
||||||
.owner = THIS_MODULE,
|
{
|
||||||
.read = manage_flash_read,
|
.filename = "powerpc/rtas/" FIRMWARE_FLASH_NAME,
|
||||||
.write = manage_flash_write,
|
.rtas_call_name = "ibm,update-flash-64-and-reboot",
|
||||||
.open = rtas_excl_open,
|
.status = &rtas_update_flash_data.status,
|
||||||
.release = rtas_excl_release,
|
.fops.read = rtas_flash_read_msg,
|
||||||
.llseek = default_llseek,
|
.fops.write = rtas_flash_write,
|
||||||
};
|
.fops.release = rtas_flash_release,
|
||||||
|
.fops.llseek = default_llseek,
|
||||||
static const struct file_operations validate_flash_operations = {
|
},
|
||||||
.owner = THIS_MODULE,
|
{
|
||||||
.read = validate_flash_read,
|
.filename = "powerpc/rtas/" FIRMWARE_UPDATE_NAME,
|
||||||
.write = validate_flash_write,
|
.rtas_call_name = "ibm,update-flash-64-and-reboot",
|
||||||
.open = rtas_excl_open,
|
.status = &rtas_update_flash_data.status,
|
||||||
.release = validate_flash_release,
|
.fops.read = rtas_flash_read_num,
|
||||||
.llseek = default_llseek,
|
.fops.write = rtas_flash_write,
|
||||||
|
.fops.release = rtas_flash_release,
|
||||||
|
.fops.llseek = default_llseek,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.filename = "powerpc/rtas/" VALIDATE_FLASH_NAME,
|
||||||
|
.rtas_call_name = "ibm,validate-flash-image",
|
||||||
|
.status = &rtas_validate_flash_data.status,
|
||||||
|
.fops.read = validate_flash_read,
|
||||||
|
.fops.write = validate_flash_write,
|
||||||
|
.fops.release = validate_flash_release,
|
||||||
|
.fops.llseek = default_llseek,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.filename = "powerpc/rtas/" MANAGE_FLASH_NAME,
|
||||||
|
.rtas_call_name = "ibm,manage-flash-image",
|
||||||
|
.status = &rtas_manage_flash_data.status,
|
||||||
|
.fops.read = manage_flash_read,
|
||||||
|
.fops.write = manage_flash_write,
|
||||||
|
.fops.llseek = default_llseek,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init rtas_flash_init(void)
|
static int __init rtas_flash_init(void)
|
||||||
{
|
{
|
||||||
int rc;
|
int i;
|
||||||
|
|
||||||
if (rtas_token("ibm,update-flash-64-and-reboot") ==
|
if (rtas_token("ibm,update-flash-64-and-reboot") ==
|
||||||
RTAS_UNKNOWN_SERVICE) {
|
RTAS_UNKNOWN_SERVICE) {
|
||||||
|
@ -710,93 +694,65 @@ static int __init rtas_flash_init(void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
firmware_flash_pde = create_flash_pde("powerpc/rtas/"
|
rtas_validate_flash_data.buf = kzalloc(VALIDATE_BUF_SIZE, GFP_KERNEL);
|
||||||
FIRMWARE_FLASH_NAME,
|
if (!rtas_validate_flash_data.buf)
|
||||||
&rtas_flash_operations);
|
return -ENOMEM;
|
||||||
if (firmware_flash_pde == NULL) {
|
|
||||||
rc = -ENOMEM;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = initialize_flash_pde_data("ibm,update-flash-64-and-reboot",
|
|
||||||
sizeof(struct rtas_update_flash_t),
|
|
||||||
firmware_flash_pde);
|
|
||||||
if (rc != 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
firmware_update_pde = create_flash_pde("powerpc/rtas/"
|
|
||||||
FIRMWARE_UPDATE_NAME,
|
|
||||||
&rtas_flash_operations);
|
|
||||||
if (firmware_update_pde == NULL) {
|
|
||||||
rc = -ENOMEM;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = initialize_flash_pde_data("ibm,update-flash-64-and-reboot",
|
|
||||||
sizeof(struct rtas_update_flash_t),
|
|
||||||
firmware_update_pde);
|
|
||||||
if (rc != 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
validate_pde = create_flash_pde("powerpc/rtas/" VALIDATE_FLASH_NAME,
|
|
||||||
&validate_flash_operations);
|
|
||||||
if (validate_pde == NULL) {
|
|
||||||
rc = -ENOMEM;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = initialize_flash_pde_data("ibm,validate-flash-image",
|
|
||||||
sizeof(struct rtas_validate_flash_t),
|
|
||||||
validate_pde);
|
|
||||||
if (rc != 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
manage_pde = create_flash_pde("powerpc/rtas/" MANAGE_FLASH_NAME,
|
|
||||||
&manage_flash_operations);
|
|
||||||
if (manage_pde == NULL) {
|
|
||||||
rc = -ENOMEM;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = initialize_flash_pde_data("ibm,manage-flash-image",
|
|
||||||
sizeof(struct rtas_manage_flash_t),
|
|
||||||
manage_pde);
|
|
||||||
if (rc != 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
rtas_flash_term_hook = rtas_flash_firmware;
|
|
||||||
|
|
||||||
flash_block_cache = kmem_cache_create("rtas_flash_cache",
|
flash_block_cache = kmem_cache_create("rtas_flash_cache",
|
||||||
RTAS_BLK_SIZE, RTAS_BLK_SIZE, 0,
|
RTAS_BLK_SIZE, RTAS_BLK_SIZE, 0,
|
||||||
rtas_block_ctor);
|
rtas_block_ctor);
|
||||||
if (!flash_block_cache) {
|
if (!flash_block_cache) {
|
||||||
printk(KERN_ERR "%s: failed to create block cache\n",
|
printk(KERN_ERR "%s: failed to create block cache\n",
|
||||||
__func__);
|
__func__);
|
||||||
rc = -ENOMEM;
|
goto enomem_buf;
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(rtas_flash_files); i++) {
|
||||||
|
const struct rtas_flash_file *f = &rtas_flash_files[i];
|
||||||
|
int token;
|
||||||
|
|
||||||
|
if (!proc_create(f->filename, S_IRUSR | S_IWUSR, NULL, &f->fops))
|
||||||
|
goto enomem;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This code assumes that the status int is the first member of the
|
||||||
|
* struct
|
||||||
|
*/
|
||||||
|
token = rtas_token(f->rtas_call_name);
|
||||||
|
if (token == RTAS_UNKNOWN_SERVICE)
|
||||||
|
*f->status = FLASH_AUTH;
|
||||||
|
else
|
||||||
|
*f->status = FLASH_NO_OP;
|
||||||
|
}
|
||||||
|
|
||||||
|
rtas_flash_term_hook = rtas_flash_firmware;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
enomem:
|
||||||
remove_flash_pde(firmware_flash_pde);
|
while (--i >= 0) {
|
||||||
remove_flash_pde(firmware_update_pde);
|
const struct rtas_flash_file *f = &rtas_flash_files[i];
|
||||||
remove_flash_pde(validate_pde);
|
remove_proc_entry(f->filename, NULL);
|
||||||
remove_flash_pde(manage_pde);
|
}
|
||||||
|
|
||||||
return rc;
|
kmem_cache_destroy(flash_block_cache);
|
||||||
|
enomem_buf:
|
||||||
|
kfree(rtas_validate_flash_data.buf);
|
||||||
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit rtas_flash_cleanup(void)
|
static void __exit rtas_flash_cleanup(void)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
rtas_flash_term_hook = NULL;
|
rtas_flash_term_hook = NULL;
|
||||||
|
|
||||||
if (flash_block_cache)
|
for (i = 0; i < ARRAY_SIZE(rtas_flash_files); i++) {
|
||||||
kmem_cache_destroy(flash_block_cache);
|
const struct rtas_flash_file *f = &rtas_flash_files[i];
|
||||||
|
remove_proc_entry(f->filename, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
remove_flash_pde(firmware_flash_pde);
|
kmem_cache_destroy(flash_block_cache);
|
||||||
remove_flash_pde(firmware_update_pde);
|
kfree(rtas_validate_flash_data.buf);
|
||||||
remove_flash_pde(validate_pde);
|
|
||||||
remove_flash_pde(manage_pde);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(rtas_flash_init);
|
module_init(rtas_flash_init);
|
||||||
|
|
|
@ -1467,7 +1467,7 @@ static int kvm_htab_release(struct inode *inode, struct file *filp)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct file_operations kvm_htab_fops = {
|
static const struct file_operations kvm_htab_fops = {
|
||||||
.read = kvm_htab_read,
|
.read = kvm_htab_read,
|
||||||
.write = kvm_htab_write,
|
.write = kvm_htab_write,
|
||||||
.llseek = default_llseek,
|
.llseek = default_llseek,
|
||||||
|
|
|
@ -92,7 +92,7 @@ static int kvm_spapr_tce_release(struct inode *inode, struct file *filp)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct file_operations kvm_spapr_tce_fops = {
|
static const struct file_operations kvm_spapr_tce_fops = {
|
||||||
.mmap = kvm_spapr_tce_mmap,
|
.mmap = kvm_spapr_tce_mmap,
|
||||||
.release = kvm_spapr_tce_release,
|
.release = kvm_spapr_tce_release,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1483,7 +1483,7 @@ static int kvm_rma_release(struct inode *inode, struct file *filp)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct file_operations kvm_rma_fops = {
|
static const struct file_operations kvm_rma_fops = {
|
||||||
.mmap = kvm_rma_mmap,
|
.mmap = kvm_rma_mmap,
|
||||||
.release = kvm_rma_release,
|
.release = kvm_rma_release,
|
||||||
};
|
};
|
||||||
|
|
|
@ -149,7 +149,6 @@ static int __fops ## _open(struct inode *inode, struct file *file) \
|
||||||
return spufs_attr_open(inode, file, __get, __set, __fmt); \
|
return spufs_attr_open(inode, file, __get, __set, __fmt); \
|
||||||
} \
|
} \
|
||||||
static const struct file_operations __fops = { \
|
static const struct file_operations __fops = { \
|
||||||
.owner = THIS_MODULE, \
|
|
||||||
.open = __fops ## _open, \
|
.open = __fops ## _open, \
|
||||||
.release = spufs_attr_release, \
|
.release = spufs_attr_release, \
|
||||||
.read = spufs_attr_read, \
|
.read = spufs_attr_read, \
|
||||||
|
@ -2591,7 +2590,6 @@ static unsigned int spufs_switch_log_poll(struct file *file, poll_table *wait)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations spufs_switch_log_fops = {
|
static const struct file_operations spufs_switch_log_fops = {
|
||||||
.owner = THIS_MODULE,
|
|
||||||
.open = spufs_switch_log_open,
|
.open = spufs_switch_log_open,
|
||||||
.read = spufs_switch_log_read,
|
.read = spufs_switch_log_read,
|
||||||
.poll = spufs_switch_log_poll,
|
.poll = spufs_switch_log_poll,
|
||||||
|
|
|
@ -452,7 +452,7 @@ static int proc_ppc64_create_ofdt(void)
|
||||||
|
|
||||||
ent = proc_create("powerpc/ofdt", S_IWUSR, NULL, &ofdt_fops);
|
ent = proc_create("powerpc/ofdt", S_IWUSR, NULL, &ofdt_fops);
|
||||||
if (ent)
|
if (ent)
|
||||||
ent->size = 0;
|
proc_set_size(ent, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,13 +41,12 @@
|
||||||
|
|
||||||
|
|
||||||
static unsigned int ibm_scan_log_dump; /* RTAS token */
|
static unsigned int ibm_scan_log_dump; /* RTAS token */
|
||||||
static struct proc_dir_entry *proc_ppc64_scan_log_dump; /* The proc file */
|
static unsigned int *scanlog_buffer; /* The data buffer */
|
||||||
|
|
||||||
static ssize_t scanlog_read(struct file *file, char __user *buf,
|
static ssize_t scanlog_read(struct file *file, char __user *buf,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *dp = PDE(file_inode(file));
|
unsigned int *data = scanlog_buffer;
|
||||||
unsigned int *data = (unsigned int *)dp->data;
|
|
||||||
int status;
|
int status;
|
||||||
unsigned long len, off;
|
unsigned long len, off;
|
||||||
unsigned int wait_time;
|
unsigned int wait_time;
|
||||||
|
@ -135,8 +134,7 @@ static ssize_t scanlog_write(struct file * file, const char __user * buf,
|
||||||
|
|
||||||
static int scanlog_open(struct inode * inode, struct file * file)
|
static int scanlog_open(struct inode * inode, struct file * file)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *dp = PDE(inode);
|
unsigned int *data = scanlog_buffer;
|
||||||
unsigned int *data = (unsigned int *)dp->data;
|
|
||||||
|
|
||||||
if (data[0] != 0) {
|
if (data[0] != 0) {
|
||||||
/* This imperfect test stops a second copy of the
|
/* This imperfect test stops a second copy of the
|
||||||
|
@ -152,11 +150,9 @@ static int scanlog_open(struct inode * inode, struct file * file)
|
||||||
|
|
||||||
static int scanlog_release(struct inode * inode, struct file * file)
|
static int scanlog_release(struct inode * inode, struct file * file)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *dp = PDE(inode);
|
unsigned int *data = scanlog_buffer;
|
||||||
unsigned int *data = (unsigned int *)dp->data;
|
|
||||||
|
|
||||||
data[0] = 0;
|
data[0] = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +168,6 @@ const struct file_operations scanlog_fops = {
|
||||||
static int __init scanlog_init(void)
|
static int __init scanlog_init(void)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *ent;
|
struct proc_dir_entry *ent;
|
||||||
void *data;
|
|
||||||
int err = -ENOMEM;
|
int err = -ENOMEM;
|
||||||
|
|
||||||
ibm_scan_log_dump = rtas_token("ibm,scan-log-dump");
|
ibm_scan_log_dump = rtas_token("ibm,scan-log-dump");
|
||||||
|
@ -180,29 +175,24 @@ static int __init scanlog_init(void)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
/* Ideally we could allocate a buffer < 4G */
|
/* Ideally we could allocate a buffer < 4G */
|
||||||
data = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL);
|
scanlog_buffer = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL);
|
||||||
if (!data)
|
if (!scanlog_buffer)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
ent = proc_create_data("powerpc/rtas/scan-log-dump", S_IRUSR, NULL,
|
ent = proc_create("powerpc/rtas/scan-log-dump", S_IRUSR, NULL,
|
||||||
&scanlog_fops, data);
|
&scanlog_fops);
|
||||||
if (!ent)
|
if (!ent)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
proc_ppc64_scan_log_dump = ent;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err:
|
err:
|
||||||
kfree(data);
|
kfree(scanlog_buffer);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit scanlog_cleanup(void)
|
static void __exit scanlog_cleanup(void)
|
||||||
{
|
{
|
||||||
if (proc_ppc64_scan_log_dump) {
|
remove_proc_entry("powerpc/rtas/scan-log-dump", NULL);
|
||||||
kfree(proc_ppc64_scan_log_dump->data);
|
kfree(scanlog_buffer);
|
||||||
remove_proc_entry("scan-log-dump", proc_ppc64_scan_log_dump->parent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(scanlog_init);
|
module_init(scanlog_init);
|
||||||
|
|
|
@ -1323,22 +1323,6 @@ ENTRY(compat_sys_keyctl_wrapper)
|
||||||
llgfr %r6,%r6 # u32
|
llgfr %r6,%r6 # u32
|
||||||
jg compat_sys_keyctl # branch to system call
|
jg compat_sys_keyctl # branch to system call
|
||||||
|
|
||||||
ENTRY(compat_sys_preadv_wrapper)
|
|
||||||
llgfr %r2,%r2 # unsigned long
|
|
||||||
llgtr %r3,%r3 # compat_iovec *
|
|
||||||
llgfr %r4,%r4 # unsigned long
|
|
||||||
llgfr %r5,%r5 # u32
|
|
||||||
llgfr %r6,%r6 # u32
|
|
||||||
jg compat_sys_preadv # branch to system call
|
|
||||||
|
|
||||||
ENTRY(compat_sys_pwritev_wrapper)
|
|
||||||
llgfr %r2,%r2 # unsigned long
|
|
||||||
llgtr %r3,%r3 # compat_iovec *
|
|
||||||
llgfr %r4,%r4 # unsigned long
|
|
||||||
llgfr %r5,%r5 # u32
|
|
||||||
llgfr %r6,%r6 # u32
|
|
||||||
jg compat_sys_pwritev # branch to system call
|
|
||||||
|
|
||||||
ENTRY(sys_perf_event_open_wrapper)
|
ENTRY(sys_perf_event_open_wrapper)
|
||||||
llgtr %r2,%r2 # const struct perf_event_attr *
|
llgtr %r2,%r2 # const struct perf_event_attr *
|
||||||
lgfr %r3,%r3 # pid_t
|
lgfr %r3,%r3 # pid_t
|
||||||
|
|
|
@ -162,10 +162,8 @@ asmlinkage void do_softirq(void)
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
void init_irq_proc(void)
|
void init_irq_proc(void)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *root_irq_dir;
|
if (proc_mkdir("irq", NULL))
|
||||||
|
create_prof_cpu_mask();
|
||||||
root_irq_dir = proc_mkdir("irq", NULL);
|
|
||||||
create_prof_cpu_mask(root_irq_dir);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include <linux/crash_dump.h>
|
#include <linux/crash_dump.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
#include <asm/checksum.h>
|
#include <asm/checksum.h>
|
||||||
#include <asm/lowcore.h>
|
#include <asm/lowcore.h>
|
||||||
#include <asm/os_info.h>
|
#include <asm/os_info.h>
|
||||||
|
|
|
@ -336,8 +336,8 @@ SYSCALL(sys_inotify_init1,sys_inotify_init1,sys_inotify_init1_wrapper)
|
||||||
SYSCALL(sys_pipe2,sys_pipe2,sys_pipe2_wrapper) /* 325 */
|
SYSCALL(sys_pipe2,sys_pipe2,sys_pipe2_wrapper) /* 325 */
|
||||||
SYSCALL(sys_dup3,sys_dup3,sys_dup3_wrapper)
|
SYSCALL(sys_dup3,sys_dup3,sys_dup3_wrapper)
|
||||||
SYSCALL(sys_epoll_create1,sys_epoll_create1,sys_epoll_create1_wrapper)
|
SYSCALL(sys_epoll_create1,sys_epoll_create1,sys_epoll_create1_wrapper)
|
||||||
SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv_wrapper)
|
SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv)
|
||||||
SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper)
|
SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev)
|
||||||
SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo) /* 330 */
|
SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo) /* 330 */
|
||||||
SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper)
|
SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper)
|
||||||
SYSCALL(sys_fanotify_init,sys_fanotify_init,sys_fanotify_init_wrapper)
|
SYSCALL(sys_fanotify_init,sys_fanotify_init,sys_fanotify_init_wrapper)
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/mman.h>
|
#include <linux/mman.h>
|
||||||
#include <linux/pagemap.h>
|
#include <linux/pagemap.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/kcore.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/initrd.h>
|
#include <linux/initrd.h>
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
|
@ -308,11 +309,9 @@ int dma_extend(unsigned int chan, unsigned long op, void *param)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(dma_extend);
|
EXPORT_SYMBOL(dma_extend);
|
||||||
|
|
||||||
static int dma_read_proc(char *buf, char **start, off_t off,
|
static int dma_proc_show(struct seq_file *m, void *v)
|
||||||
int len, int *eof, void *data)
|
|
||||||
{
|
{
|
||||||
struct dma_info *info;
|
struct dma_info *info = v;
|
||||||
char *p = buf;
|
|
||||||
|
|
||||||
if (list_empty(®istered_dmac_list))
|
if (list_empty(®istered_dmac_list))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -332,14 +331,26 @@ static int dma_read_proc(char *buf, char **start, off_t off,
|
||||||
if (!(channel->flags & DMA_CONFIGURED))
|
if (!(channel->flags & DMA_CONFIGURED))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
p += sprintf(p, "%2d: %14s %s\n", i,
|
seq_printf(m, "%2d: %14s %s\n", i,
|
||||||
info->name, channel->dev_id);
|
info->name, channel->dev_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return p - buf;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int dma_proc_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, dma_proc_show, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations dma_proc_fops = {
|
||||||
|
.open = dma_proc_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
|
|
||||||
int register_dmac(struct dma_info *info)
|
int register_dmac(struct dma_info *info)
|
||||||
{
|
{
|
||||||
unsigned int total_channels, i;
|
unsigned int total_channels, i;
|
||||||
|
@ -412,8 +423,7 @@ EXPORT_SYMBOL(unregister_dmac);
|
||||||
static int __init dma_api_init(void)
|
static int __init dma_api_init(void)
|
||||||
{
|
{
|
||||||
printk(KERN_NOTICE "DMA: Registering DMA API.\n");
|
printk(KERN_NOTICE "DMA: Registering DMA API.\n");
|
||||||
return create_proc_read_entry("dma", 0, 0, dma_read_proc, 0)
|
return proc_create("dma", 0, NULL, &dma_proc_fops) ? 0 : -ENOMEM;
|
||||||
? 0 : -ENOMEM;
|
|
||||||
}
|
}
|
||||||
subsys_initcall(dma_api_init);
|
subsys_initcall(dma_api_init);
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ static int alignment_proc_open(struct inode *inode, struct file *file)
|
||||||
static ssize_t alignment_proc_write(struct file *file,
|
static ssize_t alignment_proc_write(struct file *file,
|
||||||
const char __user *buffer, size_t count, loff_t *pos)
|
const char __user *buffer, size_t count, loff_t *pos)
|
||||||
{
|
{
|
||||||
int *data = PDE(file_inode(file))->data;
|
int *data = PDE_DATA(file_inode(file));
|
||||||
char mode;
|
char mode;
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
|
|
|
@ -693,7 +693,7 @@ static int sparc_io_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int sparc_io_proc_open(struct inode *inode, struct file *file)
|
static int sparc_io_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, sparc_io_proc_show, PDE(inode)->data);
|
return single_open(file, sparc_io_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations sparc_io_proc_fops = {
|
static const struct file_operations sparc_io_proc_fops = {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/kernel_stat.h>
|
#include <linux/kernel_stat.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
#include <linux/seq_file.h>
|
#include <linux/seq_file.h>
|
||||||
|
|
||||||
#include <asm/timer.h>
|
#include <asm/timer.h>
|
||||||
|
|
|
@ -914,7 +914,7 @@ static int hardwall_proc_show(struct seq_file *sf, void *v)
|
||||||
static int hardwall_proc_open(struct inode *inode,
|
static int hardwall_proc_open(struct inode *inode,
|
||||||
struct file *file)
|
struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, hardwall_proc_show, PDE(inode)->data);
|
return single_open(file, hardwall_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations hardwall_proc_fops = {
|
static const struct file_operations hardwall_proc_fops = {
|
||||||
|
|
|
@ -782,8 +782,7 @@ static int create_proc_mconsole(void)
|
||||||
|
|
||||||
ent = proc_create("mconsole", 0200, NULL, &mconsole_proc_fops);
|
ent = proc_create("mconsole", 0200, NULL, &mconsole_proc_fops);
|
||||||
if (ent == NULL) {
|
if (ent == NULL) {
|
||||||
printk(KERN_INFO "create_proc_mconsole : create_proc_entry "
|
printk(KERN_INFO "create_proc_mconsole : proc_create failed\n");
|
||||||
"failed\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -322,11 +322,8 @@ static int load_aout_binary(struct linux_binprm *bprm)
|
||||||
|
|
||||||
if (N_MAGIC(ex) == OMAGIC) {
|
if (N_MAGIC(ex) == OMAGIC) {
|
||||||
unsigned long text_addr, map_size;
|
unsigned long text_addr, map_size;
|
||||||
loff_t pos;
|
|
||||||
|
|
||||||
text_addr = N_TXTADDR(ex);
|
text_addr = N_TXTADDR(ex);
|
||||||
|
|
||||||
pos = 32;
|
|
||||||
map_size = ex.a_text+ex.a_data;
|
map_size = ex.a_text+ex.a_data;
|
||||||
|
|
||||||
error = vm_brk(text_addr & PAGE_MASK, map_size);
|
error = vm_brk(text_addr & PAGE_MASK, map_size);
|
||||||
|
@ -336,15 +333,12 @@ static int load_aout_binary(struct linux_binprm *bprm)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = bprm->file->f_op->read(bprm->file,
|
error = read_code(bprm->file, text_addr, 32,
|
||||||
(char __user *)text_addr,
|
ex.a_text + ex.a_data);
|
||||||
ex.a_text+ex.a_data, &pos);
|
|
||||||
if ((signed long)error < 0) {
|
if ((signed long)error < 0) {
|
||||||
send_sig(SIGKILL, current, 0);
|
send_sig(SIGKILL, current, 0);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
flush_icache_range(text_addr, text_addr+ex.a_text+ex.a_data);
|
|
||||||
} else {
|
} else {
|
||||||
#ifdef WARN_OLD
|
#ifdef WARN_OLD
|
||||||
static unsigned long error_time, error_time2;
|
static unsigned long error_time, error_time2;
|
||||||
|
@ -366,15 +360,9 @@ static int load_aout_binary(struct linux_binprm *bprm)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) {
|
if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) {
|
||||||
loff_t pos = fd_offset;
|
|
||||||
|
|
||||||
vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
|
vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
|
||||||
bprm->file->f_op->read(bprm->file,
|
read_code(bprm->file, N_TXTADDR(ex), fd_offset,
|
||||||
(char __user *)N_TXTADDR(ex),
|
ex.a_text+ex.a_data);
|
||||||
ex.a_text+ex.a_data, &pos);
|
|
||||||
flush_icache_range((unsigned long) N_TXTADDR(ex),
|
|
||||||
(unsigned long) N_TXTADDR(ex) +
|
|
||||||
ex.a_text+ex.a_data);
|
|
||||||
goto beyond_if;
|
goto beyond_if;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,8 +439,6 @@ static int load_aout_library(struct file *file)
|
||||||
start_addr = ex.a_entry & 0xfffff000;
|
start_addr = ex.a_entry & 0xfffff000;
|
||||||
|
|
||||||
if ((N_TXTOFF(ex) & ~PAGE_MASK) != 0) {
|
if ((N_TXTOFF(ex) & ~PAGE_MASK) != 0) {
|
||||||
loff_t pos = N_TXTOFF(ex);
|
|
||||||
|
|
||||||
#ifdef WARN_OLD
|
#ifdef WARN_OLD
|
||||||
static unsigned long error_time;
|
static unsigned long error_time;
|
||||||
if (time_after(jiffies, error_time + 5*HZ)) {
|
if (time_after(jiffies, error_time + 5*HZ)) {
|
||||||
|
@ -465,12 +451,8 @@ static int load_aout_library(struct file *file)
|
||||||
#endif
|
#endif
|
||||||
vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
|
vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
|
||||||
|
|
||||||
file->f_op->read(file, (char __user *)start_addr,
|
read_code(file, start_addr, N_TXTOFF(ex),
|
||||||
ex.a_text + ex.a_data, &pos);
|
ex.a_text + ex.a_data);
|
||||||
flush_icache_range((unsigned long) start_addr,
|
|
||||||
(unsigned long) start_addr + ex.a_text +
|
|
||||||
ex.a_data);
|
|
||||||
|
|
||||||
retval = 0;
|
retval = 0;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <linux/memory_hotplug.h>
|
#include <linux/memory_hotplug.h>
|
||||||
#include <linux/nmi.h>
|
#include <linux/nmi.h>
|
||||||
#include <linux/gfp.h>
|
#include <linux/gfp.h>
|
||||||
|
#include <linux/kcore.h>
|
||||||
|
|
||||||
#include <asm/processor.h>
|
#include <asm/processor.h>
|
||||||
#include <asm/bios_ebda.h>
|
#include <asm/bios_ebda.h>
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <linux/efi-bgrt.h>
|
#include <linux/efi-bgrt.h>
|
||||||
#include <linux/export.h>
|
#include <linux/export.h>
|
||||||
#include <linux/bootmem.h>
|
#include <linux/bootmem.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
#include <linux/memblock.h>
|
#include <linux/memblock.h>
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/reboot.h>
|
#include <linux/reboot.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
|
|
||||||
#include <asm/setup.h>
|
#include <asm/setup.h>
|
||||||
#include <asm/page.h>
|
#include <asm/page.h>
|
||||||
|
|
|
@ -214,20 +214,27 @@ static int simdisk_detach(struct simdisk *dev)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int proc_read_simdisk(char *page, char **start, off_t off,
|
static ssize_t proc_read_simdisk(struct file *file, char __user *buf,
|
||||||
int count, int *eof, void *data)
|
size_t size, loff_t *ppos)
|
||||||
{
|
{
|
||||||
int len;
|
struct simdisk *dev = PDE_DATA(file_inode(file));
|
||||||
struct simdisk *dev = (struct simdisk *) data;
|
char *s = dev->filename;
|
||||||
len = sprintf(page, "%s\n", dev->filename ? dev->filename : "");
|
if (s) {
|
||||||
return len;
|
ssize_t n = simple_read_from_buffer(buf, size, ppos,
|
||||||
|
s, strlen(s));
|
||||||
|
if (n < 0)
|
||||||
|
return n;
|
||||||
|
buf += n;
|
||||||
|
size -= n;
|
||||||
|
}
|
||||||
|
return simple_read_from_buffer(buf, size, ppos, "\n", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int proc_write_simdisk(struct file *file, const char *buffer,
|
static ssize_t proc_write_simdisk(struct file *file, const char __user *buf,
|
||||||
unsigned long count, void *data)
|
size_t size, loff_t *ppos)
|
||||||
{
|
{
|
||||||
char *tmp = kmalloc(count + 1, GFP_KERNEL);
|
char *tmp = kmalloc(count + 1, GFP_KERNEL);
|
||||||
struct simdisk *dev = (struct simdisk *) data;
|
struct simdisk *dev = PDE_DATA(file_inode(file));
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
|
@ -256,6 +263,12 @@ static int proc_write_simdisk(struct file *file, const char *buffer,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct file_operations fops = {
|
||||||
|
.read = proc_read_simdisk,
|
||||||
|
.write = proc_write_simdisk,
|
||||||
|
.llseek = default_llseek,
|
||||||
|
};
|
||||||
|
|
||||||
static int __init simdisk_setup(struct simdisk *dev, int which,
|
static int __init simdisk_setup(struct simdisk *dev, int which,
|
||||||
struct proc_dir_entry *procdir)
|
struct proc_dir_entry *procdir)
|
||||||
{
|
{
|
||||||
|
@ -289,10 +302,7 @@ static int __init simdisk_setup(struct simdisk *dev, int which,
|
||||||
set_capacity(dev->gd, 0);
|
set_capacity(dev->gd, 0);
|
||||||
add_disk(dev->gd);
|
add_disk(dev->gd);
|
||||||
|
|
||||||
dev->procfile = create_proc_entry(tmp, 0644, procdir);
|
dev->procfile = proc_create_data(tmp, 0644, procdir, &fops, dev);
|
||||||
dev->procfile->data = dev;
|
|
||||||
dev->procfile->read_proc = proc_read_simdisk;
|
|
||||||
dev->procfile->write_proc = proc_write_simdisk;
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_alloc_disk:
|
out_alloc_disk:
|
||||||
|
|
|
@ -194,7 +194,7 @@ static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
|
||||||
|
|
||||||
static int acpi_ac_open_fs(struct inode *inode, struct file *file)
|
static int acpi_ac_open_fs(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, acpi_ac_seq_show, PDE(inode)->data);
|
return single_open(file, acpi_ac_seq_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_ac_add_fs(struct acpi_device *device)
|
static int acpi_ac_add_fs(struct acpi_device *device)
|
||||||
|
|
|
@ -929,7 +929,7 @@ static int acpi_battery_read_##_name(struct seq_file *seq, void *offset) \
|
||||||
} \
|
} \
|
||||||
static int acpi_battery_##_name##_open_fs(struct inode *inode, struct file *file) \
|
static int acpi_battery_##_name##_open_fs(struct inode *inode, struct file *file) \
|
||||||
{ \
|
{ \
|
||||||
return single_open(file, acpi_battery_read_##_name, PDE(inode)->data); \
|
return single_open(file, acpi_battery_read_##_name, PDE_DATA(inode)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
DECLARE_FILE_FUNCTIONS(info);
|
DECLARE_FILE_FUNCTIONS(info);
|
||||||
|
|
|
@ -129,7 +129,7 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
|
||||||
|
|
||||||
static int acpi_button_state_open_fs(struct inode *inode, struct file *file)
|
static int acpi_button_state_open_fs(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, acpi_button_state_seq_show, PDE(inode)->data);
|
return single_open(file, acpi_button_state_seq_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations acpi_button_state_fops = {
|
static const struct file_operations acpi_button_state_fops = {
|
||||||
|
|
|
@ -120,7 +120,7 @@ static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset)
|
||||||
|
|
||||||
static int acpi_system_alarm_open_fs(struct inode *inode, struct file *file)
|
static int acpi_system_alarm_open_fs(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, acpi_system_alarm_seq_show, PDE(inode)->data);
|
return single_open(file, acpi_system_alarm_seq_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_date_field(char **p, u32 * value)
|
static int get_date_field(char **p, u32 * value)
|
||||||
|
@ -397,7 +397,7 @@ static int
|
||||||
acpi_system_wakeup_device_open_fs(struct inode *inode, struct file *file)
|
acpi_system_wakeup_device_open_fs(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, acpi_system_wakeup_device_seq_show,
|
return single_open(file, acpi_system_wakeup_device_seq_show,
|
||||||
PDE(inode)->data);
|
PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations acpi_system_wakeup_device_fops = {
|
static const struct file_operations acpi_system_wakeup_device_fops = {
|
||||||
|
|
|
@ -521,19 +521,6 @@ acpi_sbs_add_fs(struct proc_dir_entry **dir,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
acpi_sbs_remove_fs(struct proc_dir_entry **dir,
|
|
||||||
struct proc_dir_entry *parent_dir)
|
|
||||||
{
|
|
||||||
if (*dir) {
|
|
||||||
remove_proc_entry(ACPI_SBS_FILE_INFO, *dir);
|
|
||||||
remove_proc_entry(ACPI_SBS_FILE_STATE, *dir);
|
|
||||||
remove_proc_entry(ACPI_SBS_FILE_ALARM, *dir);
|
|
||||||
remove_proc_entry((*dir)->name, parent_dir);
|
|
||||||
*dir = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Smart Battery Interface */
|
/* Smart Battery Interface */
|
||||||
static struct proc_dir_entry *acpi_battery_dir = NULL;
|
static struct proc_dir_entry *acpi_battery_dir = NULL;
|
||||||
|
|
||||||
|
@ -584,7 +571,7 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
|
||||||
|
|
||||||
static int acpi_battery_info_open_fs(struct inode *inode, struct file *file)
|
static int acpi_battery_info_open_fs(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, acpi_battery_read_info, PDE(inode)->data);
|
return single_open(file, acpi_battery_read_info, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_battery_read_state(struct seq_file *seq, void *offset)
|
static int acpi_battery_read_state(struct seq_file *seq, void *offset)
|
||||||
|
@ -623,7 +610,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
|
||||||
|
|
||||||
static int acpi_battery_state_open_fs(struct inode *inode, struct file *file)
|
static int acpi_battery_state_open_fs(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, acpi_battery_read_state, PDE(inode)->data);
|
return single_open(file, acpi_battery_read_state, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
|
static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
|
||||||
|
@ -688,7 +675,7 @@ acpi_battery_write_alarm(struct file *file, const char __user * buffer,
|
||||||
|
|
||||||
static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file)
|
static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, acpi_battery_read_alarm, PDE(inode)->data);
|
return single_open(file, acpi_battery_read_alarm, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations acpi_battery_info_fops = {
|
static const struct file_operations acpi_battery_info_fops = {
|
||||||
|
@ -736,7 +723,7 @@ static int acpi_ac_read_state(struct seq_file *seq, void *offset)
|
||||||
|
|
||||||
static int acpi_ac_state_open_fs(struct inode *inode, struct file *file)
|
static int acpi_ac_state_open_fs(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, acpi_ac_read_state, PDE(inode)->data);
|
return single_open(file, acpi_ac_read_state, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations acpi_ac_state_fops = {
|
static const struct file_operations acpi_ac_state_fops = {
|
||||||
|
@ -836,8 +823,8 @@ static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
|
||||||
power_supply_unregister(&battery->bat);
|
power_supply_unregister(&battery->bat);
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||||
if (battery->proc_entry)
|
proc_remove(battery->proc_entry);
|
||||||
acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir);
|
battery->proc_entry = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -873,8 +860,8 @@ static void acpi_charger_remove(struct acpi_sbs *sbs)
|
||||||
if (sbs->charger.dev)
|
if (sbs->charger.dev)
|
||||||
power_supply_unregister(&sbs->charger);
|
power_supply_unregister(&sbs->charger);
|
||||||
#ifdef CONFIG_ACPI_PROCFS_POWER
|
#ifdef CONFIG_ACPI_PROCFS_POWER
|
||||||
if (sbs->charger_entry)
|
proc_remove(sbs->charger_entry);
|
||||||
acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir);
|
sbs->charger_entry = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -322,23 +322,11 @@ static u8 k2_stat_check_status(struct ata_port *ap)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PPC_OF
|
#ifdef CONFIG_PPC_OF
|
||||||
/*
|
static int k2_sata_show_info(struct seq_file *m, struct Scsi_Host *shost)
|
||||||
* k2_sata_proc_info
|
|
||||||
* inout : decides on the direction of the dataflow and the meaning of the
|
|
||||||
* variables
|
|
||||||
* buffer: If inout==FALSE data is being written to it else read from it
|
|
||||||
* *start: If inout==FALSE start of the valid data in the buffer
|
|
||||||
* offset: If inout==FALSE offset from the beginning of the imaginary file
|
|
||||||
* from which we start writing into the buffer
|
|
||||||
* length: If inout==FALSE max number of bytes to be written into the buffer
|
|
||||||
* else number of bytes in the buffer
|
|
||||||
*/
|
|
||||||
static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
|
|
||||||
off_t offset, int count, int inout)
|
|
||||||
{
|
{
|
||||||
struct ata_port *ap;
|
struct ata_port *ap;
|
||||||
struct device_node *np;
|
struct device_node *np;
|
||||||
int len, index;
|
int index;
|
||||||
|
|
||||||
/* Find the ata_port */
|
/* Find the ata_port */
|
||||||
ap = ata_shost_to_port(shost);
|
ap = ata_shost_to_port(shost);
|
||||||
|
@ -356,15 +344,12 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
|
||||||
const u32 *reg = of_get_property(np, "reg", NULL);
|
const u32 *reg = of_get_property(np, "reg", NULL);
|
||||||
if (!reg)
|
if (!reg)
|
||||||
continue;
|
continue;
|
||||||
if (index == *reg)
|
if (index == *reg) {
|
||||||
|
seq_printf(m, "devspec: %s\n", np->full_name);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (np == NULL)
|
return 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
len = sprintf(page, "devspec: %s\n", np->full_name);
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_PPC_OF */
|
#endif /* CONFIG_PPC_OF */
|
||||||
|
|
||||||
|
@ -372,7 +357,7 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
|
||||||
static struct scsi_host_template k2_sata_sht = {
|
static struct scsi_host_template k2_sata_sht = {
|
||||||
ATA_BMDMA_SHT(DRV_NAME),
|
ATA_BMDMA_SHT(DRV_NAME),
|
||||||
#ifdef CONFIG_PPC_OF
|
#ifdef CONFIG_PPC_OF
|
||||||
.proc_info = k2_sata_proc_info,
|
.show_info = k2_sata_show_info,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6473,7 +6473,7 @@ static int dac960_initial_status_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int dac960_initial_status_proc_open(struct inode *inode, struct file *file)
|
static int dac960_initial_status_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, dac960_initial_status_proc_show, PDE(inode)->data);
|
return single_open(file, dac960_initial_status_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations dac960_initial_status_proc_fops = {
|
static const struct file_operations dac960_initial_status_proc_fops = {
|
||||||
|
@ -6519,7 +6519,7 @@ static int dac960_current_status_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int dac960_current_status_proc_open(struct inode *inode, struct file *file)
|
static int dac960_current_status_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, dac960_current_status_proc_show, PDE(inode)->data);
|
return single_open(file, dac960_current_status_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations dac960_current_status_proc_fops = {
|
static const struct file_operations dac960_current_status_proc_fops = {
|
||||||
|
@ -6540,14 +6540,14 @@ static int dac960_user_command_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int dac960_user_command_proc_open(struct inode *inode, struct file *file)
|
static int dac960_user_command_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, dac960_user_command_proc_show, PDE(inode)->data);
|
return single_open(file, dac960_user_command_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t dac960_user_command_proc_write(struct file *file,
|
static ssize_t dac960_user_command_proc_write(struct file *file,
|
||||||
const char __user *Buffer,
|
const char __user *Buffer,
|
||||||
size_t Count, loff_t *pos)
|
size_t Count, loff_t *pos)
|
||||||
{
|
{
|
||||||
DAC960_Controller_T *Controller = (DAC960_Controller_T *) PDE(file_inode(file))->data;
|
DAC960_Controller_T *Controller = PDE_DATA(file_inode(file));
|
||||||
unsigned char CommandBuffer[80];
|
unsigned char CommandBuffer[80];
|
||||||
int Length;
|
int Length;
|
||||||
if (Count > sizeof(CommandBuffer)-1) return -EINVAL;
|
if (Count > sizeof(CommandBuffer)-1) return -EINVAL;
|
||||||
|
|
|
@ -493,7 +493,7 @@ static int cciss_seq_open(struct inode *inode, struct file *file)
|
||||||
struct seq_file *seq = file->private_data;
|
struct seq_file *seq = file->private_data;
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
seq->private = PDE(inode)->data;
|
seq->private = PDE_DATA(inode);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,13 +54,11 @@ static CommandList_struct *cmd_special_alloc(ctlr_info_t *h);
|
||||||
static void cmd_free(ctlr_info_t *h, CommandList_struct *c);
|
static void cmd_free(ctlr_info_t *h, CommandList_struct *c);
|
||||||
static void cmd_special_free(ctlr_info_t *h, CommandList_struct *c);
|
static void cmd_special_free(ctlr_info_t *h, CommandList_struct *c);
|
||||||
|
|
||||||
static int cciss_scsi_proc_info(
|
static int cciss_scsi_write_info(struct Scsi_Host *sh,
|
||||||
struct Scsi_Host *sh,
|
|
||||||
char *buffer, /* data buffer */
|
char *buffer, /* data buffer */
|
||||||
char **start, /* where data in buffer starts */
|
int length); /* length of data in buffer */
|
||||||
off_t offset, /* offset from start of imaginary file */
|
static int cciss_scsi_show_info(struct seq_file *m,
|
||||||
int length, /* length of data in buffer */
|
struct Scsi_Host *sh);
|
||||||
int func); /* 0 == read, 1 == write */
|
|
||||||
|
|
||||||
static int cciss_scsi_queue_command (struct Scsi_Host *h,
|
static int cciss_scsi_queue_command (struct Scsi_Host *h,
|
||||||
struct scsi_cmnd *cmd);
|
struct scsi_cmnd *cmd);
|
||||||
|
@ -82,7 +80,8 @@ static struct scsi_host_template cciss_driver_template = {
|
||||||
.module = THIS_MODULE,
|
.module = THIS_MODULE,
|
||||||
.name = "cciss",
|
.name = "cciss",
|
||||||
.proc_name = "cciss",
|
.proc_name = "cciss",
|
||||||
.proc_info = cciss_scsi_proc_info,
|
.write_info = cciss_scsi_write_info,
|
||||||
|
.show_info = cciss_scsi_show_info,
|
||||||
.queuecommand = cciss_scsi_queue_command,
|
.queuecommand = cciss_scsi_queue_command,
|
||||||
.this_id = 7,
|
.this_id = 7,
|
||||||
.cmd_per_lun = 1,
|
.cmd_per_lun = 1,
|
||||||
|
@ -1302,60 +1301,55 @@ cciss_scsi_user_command(ctlr_info_t *h, int hostno, char *buffer, int length)
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cciss_scsi_proc_info(struct Scsi_Host *sh,
|
cciss_scsi_write_info(struct Scsi_Host *sh,
|
||||||
char *buffer, /* data buffer */
|
char *buffer, /* data buffer */
|
||||||
char **start, /* where data in buffer starts */
|
int length) /* length of data in buffer */
|
||||||
off_t offset, /* offset from start of imaginary file */
|
|
||||||
int length, /* length of data in buffer */
|
|
||||||
int func) /* 0 == read, 1 == write */
|
|
||||||
{
|
{
|
||||||
|
ctlr_info_t *h = (ctlr_info_t *) sh->hostdata[0];
|
||||||
int buflen, datalen;
|
|
||||||
ctlr_info_t *h;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
h = (ctlr_info_t *) sh->hostdata[0];
|
|
||||||
if (h == NULL) /* This really shouldn't ever happen. */
|
if (h == NULL) /* This really shouldn't ever happen. */
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (func == 0) { /* User is reading from /proc/scsi/ciss*?/?* */
|
return cciss_scsi_user_command(h, sh->host_no,
|
||||||
buflen = sprintf(buffer, "cciss%d: SCSI host: %d\n",
|
|
||||||
h->ctlr, sh->host_no);
|
|
||||||
|
|
||||||
/* this information is needed by apps to know which cciss
|
|
||||||
device corresponds to which scsi host number without
|
|
||||||
having to open a scsi target device node. The device
|
|
||||||
information is not a duplicate of /proc/scsi/scsi because
|
|
||||||
the two may be out of sync due to scsi hotplug, rather
|
|
||||||
this info is for an app to be able to use to know how to
|
|
||||||
get them back in sync. */
|
|
||||||
|
|
||||||
for (i = 0; i < ccissscsi[h->ctlr].ndevices; i++) {
|
|
||||||
struct cciss_scsi_dev_t *sd =
|
|
||||||
&ccissscsi[h->ctlr].dev[i];
|
|
||||||
buflen += sprintf(&buffer[buflen], "c%db%dt%dl%d %02d "
|
|
||||||
"0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
|
|
||||||
sh->host_no, sd->bus, sd->target, sd->lun,
|
|
||||||
sd->devtype,
|
|
||||||
sd->scsi3addr[0], sd->scsi3addr[1],
|
|
||||||
sd->scsi3addr[2], sd->scsi3addr[3],
|
|
||||||
sd->scsi3addr[4], sd->scsi3addr[5],
|
|
||||||
sd->scsi3addr[6], sd->scsi3addr[7]);
|
|
||||||
}
|
|
||||||
datalen = buflen - offset;
|
|
||||||
if (datalen < 0) { /* they're reading past EOF. */
|
|
||||||
datalen = 0;
|
|
||||||
*start = buffer+buflen;
|
|
||||||
} else
|
|
||||||
*start = buffer + offset;
|
|
||||||
return(datalen);
|
|
||||||
} else /* User is writing to /proc/scsi/cciss*?/?* ... */
|
|
||||||
return cciss_scsi_user_command(h, sh->host_no,
|
|
||||||
buffer, length);
|
buffer, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
cciss_scsi_show_info(struct seq_file *m, struct Scsi_Host *sh)
|
||||||
|
{
|
||||||
|
|
||||||
|
ctlr_info_t *h = (ctlr_info_t *) sh->hostdata[0];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (h == NULL) /* This really shouldn't ever happen. */
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
seq_printf(m, "cciss%d: SCSI host: %d\n",
|
||||||
|
h->ctlr, sh->host_no);
|
||||||
|
|
||||||
|
/* this information is needed by apps to know which cciss
|
||||||
|
device corresponds to which scsi host number without
|
||||||
|
having to open a scsi target device node. The device
|
||||||
|
information is not a duplicate of /proc/scsi/scsi because
|
||||||
|
the two may be out of sync due to scsi hotplug, rather
|
||||||
|
this info is for an app to be able to use to know how to
|
||||||
|
get them back in sync. */
|
||||||
|
|
||||||
|
for (i = 0; i < ccissscsi[h->ctlr].ndevices; i++) {
|
||||||
|
struct cciss_scsi_dev_t *sd =
|
||||||
|
&ccissscsi[h->ctlr].dev[i];
|
||||||
|
seq_printf(m, "c%db%dt%dl%d %02d "
|
||||||
|
"0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
|
||||||
|
sh->host_no, sd->bus, sd->target, sd->lun,
|
||||||
|
sd->devtype,
|
||||||
|
sd->scsi3addr[0], sd->scsi3addr[1],
|
||||||
|
sd->scsi3addr[2], sd->scsi3addr[3],
|
||||||
|
sd->scsi3addr[4], sd->scsi3addr[5],
|
||||||
|
sd->scsi3addr[6], sd->scsi3addr[7]);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* cciss_scatter_gather takes a struct scsi_cmnd, (cmd), and does the pci
|
/* cciss_scatter_gather takes a struct scsi_cmnd, (cmd), and does the pci
|
||||||
dma mapping and fills in the scatter gather entries of the
|
dma mapping and fills in the scatter gather entries of the
|
||||||
cciss command, c. */
|
cciss command, c. */
|
||||||
|
|
|
@ -296,7 +296,7 @@ static int ida_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int ida_proc_open(struct inode *inode, struct file *file)
|
static int ida_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, ida_proc_show, PDE(inode)->data);
|
return single_open(file, ida_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations ida_proc_fops = {
|
static const struct file_operations ida_proc_fops = {
|
||||||
|
|
|
@ -314,7 +314,7 @@ static int drbd_seq_show(struct seq_file *seq, void *v)
|
||||||
static int drbd_proc_open(struct inode *inode, struct file *file)
|
static int drbd_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
if (try_module_get(THIS_MODULE))
|
if (try_module_get(THIS_MODULE))
|
||||||
return single_open(file, drbd_seq_show, PDE(inode)->data);
|
return single_open(file, drbd_seq_show, PDE_DATA(inode));
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,9 +230,11 @@ static int __do_lo_send_write(struct file *file,
|
||||||
ssize_t bw;
|
ssize_t bw;
|
||||||
mm_segment_t old_fs = get_fs();
|
mm_segment_t old_fs = get_fs();
|
||||||
|
|
||||||
|
file_start_write(file);
|
||||||
set_fs(get_ds());
|
set_fs(get_ds());
|
||||||
bw = file->f_op->write(file, buf, len, &pos);
|
bw = file->f_op->write(file, buf, len, &pos);
|
||||||
set_fs(old_fs);
|
set_fs(old_fs);
|
||||||
|
file_end_write(file);
|
||||||
if (likely(bw == len))
|
if (likely(bw == len))
|
||||||
return 0;
|
return 0;
|
||||||
printk(KERN_ERR "loop: Write error at byte offset %llu, length %i.\n",
|
printk(KERN_ERR "loop: Write error at byte offset %llu, length %i.\n",
|
||||||
|
|
|
@ -2648,7 +2648,7 @@ static int pkt_seq_show(struct seq_file *m, void *p)
|
||||||
|
|
||||||
static int pkt_seq_open(struct inode *inode, struct file *file)
|
static int pkt_seq_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, pkt_seq_show, PDE(inode)->data);
|
return single_open(file, pkt_seq_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations pkt_proc_fops = {
|
static const struct file_operations pkt_proc_fops = {
|
||||||
|
|
|
@ -525,7 +525,7 @@ static int ps3vram_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int ps3vram_proc_open(struct inode *inode, struct file *file)
|
static int ps3vram_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, ps3vram_proc_show, PDE(inode)->data);
|
return single_open(file, ps3vram_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations ps3vram_proc_fops = {
|
static const struct file_operations ps3vram_proc_fops = {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <linux/miscdevice.h>
|
#include <linux/miscdevice.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
#include <linux/capability.h>
|
#include <linux/capability.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
|
@ -329,9 +330,7 @@ ds1620_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef THERM_USE_PROC
|
#ifdef THERM_USE_PROC
|
||||||
static int
|
static int ds1620_proc_therm_show(struct seq_file *m, void *v)
|
||||||
proc_therm_ds1620_read(char *buf, char **start, off_t offset,
|
|
||||||
int len, int *eof, void *unused)
|
|
||||||
{
|
{
|
||||||
struct therm th;
|
struct therm th;
|
||||||
int temp;
|
int temp;
|
||||||
|
@ -339,17 +338,25 @@ proc_therm_ds1620_read(char *buf, char **start, off_t offset,
|
||||||
ds1620_read_state(&th);
|
ds1620_read_state(&th);
|
||||||
temp = cvt_9_to_int(ds1620_in(THERM_READ_TEMP, 9));
|
temp = cvt_9_to_int(ds1620_in(THERM_READ_TEMP, 9));
|
||||||
|
|
||||||
len = sprintf(buf, "Thermostat: HI %i.%i, LOW %i.%i; "
|
seq_printf(m, "Thermostat: HI %i.%i, LOW %i.%i; temperature: %i.%i C, fan %s\n",
|
||||||
"temperature: %i.%i C, fan %s\n",
|
th.hi >> 1, th.hi & 1 ? 5 : 0,
|
||||||
th.hi >> 1, th.hi & 1 ? 5 : 0,
|
th.lo >> 1, th.lo & 1 ? 5 : 0,
|
||||||
th.lo >> 1, th.lo & 1 ? 5 : 0,
|
temp >> 1, temp & 1 ? 5 : 0,
|
||||||
temp >> 1, temp & 1 ? 5 : 0,
|
fan_state[netwinder_get_fan()]);
|
||||||
fan_state[netwinder_get_fan()]);
|
return 0;
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct proc_dir_entry *proc_therm_ds1620;
|
static int ds1620_proc_therm_open(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return single_open(file, ds1620_proc_therm_show, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct file_operations ds1620_proc_therm_fops = {
|
||||||
|
.open = ds1620_proc_therm_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const struct file_operations ds1620_fops = {
|
static const struct file_operations ds1620_fops = {
|
||||||
|
@ -397,10 +404,7 @@ static int __init ds1620_init(void)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#ifdef THERM_USE_PROC
|
#ifdef THERM_USE_PROC
|
||||||
proc_therm_ds1620 = create_proc_entry("therm", 0, NULL);
|
if (!proc_create("therm", 0, NULL, &ds1620_proc_therm_fops))
|
||||||
if (proc_therm_ds1620)
|
|
||||||
proc_therm_ds1620->read_proc = proc_therm_ds1620_read;
|
|
||||||
else
|
|
||||||
printk(KERN_ERR "therm: unable to register /proc/therm\n");
|
printk(KERN_ERR "therm: unable to register /proc/therm\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/rtc.h>
|
#include <linux/rtc.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
#include <linux/efi.h>
|
#include <linux/efi.h>
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
|
|
||||||
|
@ -296,12 +297,10 @@ static struct miscdevice efi_rtc_dev= {
|
||||||
/*
|
/*
|
||||||
* We export RAW EFI information to /proc/driver/efirtc
|
* We export RAW EFI information to /proc/driver/efirtc
|
||||||
*/
|
*/
|
||||||
static int
|
static int efi_rtc_proc_show(struct seq_file *m, void *v)
|
||||||
efi_rtc_get_status(char *buf)
|
|
||||||
{
|
{
|
||||||
efi_time_t eft, alm;
|
efi_time_t eft, alm;
|
||||||
efi_time_cap_t cap;
|
efi_time_cap_t cap;
|
||||||
char *p = buf;
|
|
||||||
efi_bool_t enabled, pending;
|
efi_bool_t enabled, pending;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
@ -316,64 +315,63 @@ efi_rtc_get_status(char *buf)
|
||||||
|
|
||||||
spin_unlock_irqrestore(&efi_rtc_lock,flags);
|
spin_unlock_irqrestore(&efi_rtc_lock,flags);
|
||||||
|
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"Time : %u:%u:%u.%09u\n"
|
"Time : %u:%u:%u.%09u\n"
|
||||||
"Date : %u-%u-%u\n"
|
"Date : %u-%u-%u\n"
|
||||||
"Daylight : %u\n",
|
"Daylight : %u\n",
|
||||||
eft.hour, eft.minute, eft.second, eft.nanosecond,
|
eft.hour, eft.minute, eft.second, eft.nanosecond,
|
||||||
eft.year, eft.month, eft.day,
|
eft.year, eft.month, eft.day,
|
||||||
eft.daylight);
|
eft.daylight);
|
||||||
|
|
||||||
if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE)
|
if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE)
|
||||||
p += sprintf(p, "Timezone : unspecified\n");
|
seq_puts(m, "Timezone : unspecified\n");
|
||||||
else
|
else
|
||||||
/* XXX fixme: convert to string? */
|
/* XXX fixme: convert to string? */
|
||||||
p += sprintf(p, "Timezone : %u\n", eft.timezone);
|
seq_printf(m, "Timezone : %u\n", eft.timezone);
|
||||||
|
|
||||||
|
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"Alarm Time : %u:%u:%u.%09u\n"
|
"Alarm Time : %u:%u:%u.%09u\n"
|
||||||
"Alarm Date : %u-%u-%u\n"
|
"Alarm Date : %u-%u-%u\n"
|
||||||
"Alarm Daylight : %u\n"
|
"Alarm Daylight : %u\n"
|
||||||
"Enabled : %s\n"
|
"Enabled : %s\n"
|
||||||
"Pending : %s\n",
|
"Pending : %s\n",
|
||||||
alm.hour, alm.minute, alm.second, alm.nanosecond,
|
alm.hour, alm.minute, alm.second, alm.nanosecond,
|
||||||
alm.year, alm.month, alm.day,
|
alm.year, alm.month, alm.day,
|
||||||
alm.daylight,
|
alm.daylight,
|
||||||
enabled == 1 ? "yes" : "no",
|
enabled == 1 ? "yes" : "no",
|
||||||
pending == 1 ? "yes" : "no");
|
pending == 1 ? "yes" : "no");
|
||||||
|
|
||||||
if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE)
|
if (eft.timezone == EFI_UNSPECIFIED_TIMEZONE)
|
||||||
p += sprintf(p, "Timezone : unspecified\n");
|
seq_puts(m, "Timezone : unspecified\n");
|
||||||
else
|
else
|
||||||
/* XXX fixme: convert to string? */
|
/* XXX fixme: convert to string? */
|
||||||
p += sprintf(p, "Timezone : %u\n", alm.timezone);
|
seq_printf(m, "Timezone : %u\n", alm.timezone);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* now prints the capabilities
|
* now prints the capabilities
|
||||||
*/
|
*/
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"Resolution : %u\n"
|
"Resolution : %u\n"
|
||||||
"Accuracy : %u\n"
|
"Accuracy : %u\n"
|
||||||
"SetstoZero : %u\n",
|
"SetstoZero : %u\n",
|
||||||
cap.resolution, cap.accuracy, cap.sets_to_zero);
|
cap.resolution, cap.accuracy, cap.sets_to_zero);
|
||||||
|
|
||||||
return p - buf;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int efi_rtc_proc_open(struct inode *inode, struct file *file)
|
||||||
efi_rtc_read_proc(char *page, char **start, off_t off,
|
|
||||||
int count, int *eof, void *data)
|
|
||||||
{
|
{
|
||||||
int len = efi_rtc_get_status(page);
|
return single_open(file, efi_rtc_proc_show, NULL);
|
||||||
if (len <= off+count) *eof = 1;
|
|
||||||
*start = page + off;
|
|
||||||
len -= off;
|
|
||||||
if (len>count) len = count;
|
|
||||||
if (len<0) len = 0;
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct file_operations efi_rtc_proc_fops = {
|
||||||
|
.open = efi_rtc_proc_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
|
|
||||||
static int __init
|
static int __init
|
||||||
efi_rtc_init(void)
|
efi_rtc_init(void)
|
||||||
{
|
{
|
||||||
|
@ -389,8 +387,7 @@ efi_rtc_init(void)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
dir = create_proc_read_entry ("driver/efirtc", 0, NULL,
|
dir = proc_create("driver/efirtc", 0, NULL, &efi_rtc_proc_fops);
|
||||||
efi_rtc_read_proc, NULL);
|
|
||||||
if (dir == NULL) {
|
if (dir == NULL) {
|
||||||
printk(KERN_ERR "efirtc: can't create /proc/driver/efirtc.\n");
|
printk(KERN_ERR "efirtc: can't create /proc/driver/efirtc.\n");
|
||||||
misc_deregister(&efi_rtc_dev);
|
misc_deregister(&efi_rtc_dev);
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/poll.h>
|
#include <linux/poll.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
|
|
||||||
|
@ -386,18 +387,15 @@ static int gen_rtc_release(struct inode *inode, struct file *file)
|
||||||
* Info exported via "/proc/driver/rtc".
|
* Info exported via "/proc/driver/rtc".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int gen_rtc_proc_output(char *buf)
|
static int gen_rtc_proc_show(struct seq_file *m, void *v)
|
||||||
{
|
{
|
||||||
char *p;
|
|
||||||
struct rtc_time tm;
|
struct rtc_time tm;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
struct rtc_pll_info pll;
|
struct rtc_pll_info pll;
|
||||||
|
|
||||||
p = buf;
|
|
||||||
|
|
||||||
flags = get_rtc_time(&tm);
|
flags = get_rtc_time(&tm);
|
||||||
|
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"rtc_time\t: %02d:%02d:%02d\n"
|
"rtc_time\t: %02d:%02d:%02d\n"
|
||||||
"rtc_date\t: %04d-%02d-%02d\n"
|
"rtc_date\t: %04d-%02d-%02d\n"
|
||||||
"rtc_epoch\t: %04u\n",
|
"rtc_epoch\t: %04u\n",
|
||||||
|
@ -406,23 +404,23 @@ static int gen_rtc_proc_output(char *buf)
|
||||||
|
|
||||||
tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
|
tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
|
||||||
|
|
||||||
p += sprintf(p, "alarm\t\t: ");
|
seq_puts(m, "alarm\t\t: ");
|
||||||
if (tm.tm_hour <= 24)
|
if (tm.tm_hour <= 24)
|
||||||
p += sprintf(p, "%02d:", tm.tm_hour);
|
seq_printf(m, "%02d:", tm.tm_hour);
|
||||||
else
|
else
|
||||||
p += sprintf(p, "**:");
|
seq_puts(m, "**:");
|
||||||
|
|
||||||
if (tm.tm_min <= 59)
|
if (tm.tm_min <= 59)
|
||||||
p += sprintf(p, "%02d:", tm.tm_min);
|
seq_printf(m, "%02d:", tm.tm_min);
|
||||||
else
|
else
|
||||||
p += sprintf(p, "**:");
|
seq_puts(m, "**:");
|
||||||
|
|
||||||
if (tm.tm_sec <= 59)
|
if (tm.tm_sec <= 59)
|
||||||
p += sprintf(p, "%02d\n", tm.tm_sec);
|
seq_printf(m, "%02d\n", tm.tm_sec);
|
||||||
else
|
else
|
||||||
p += sprintf(p, "**\n");
|
seq_puts(m, "**\n");
|
||||||
|
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"DST_enable\t: %s\n"
|
"DST_enable\t: %s\n"
|
||||||
"BCD\t\t: %s\n"
|
"BCD\t\t: %s\n"
|
||||||
"24hr\t\t: %s\n"
|
"24hr\t\t: %s\n"
|
||||||
|
@ -442,7 +440,7 @@ static int gen_rtc_proc_output(char *buf)
|
||||||
0L /* freq */,
|
0L /* freq */,
|
||||||
(flags & RTC_BATT_BAD) ? "bad" : "okay");
|
(flags & RTC_BATT_BAD) ? "bad" : "okay");
|
||||||
if (!get_rtc_pll(&pll))
|
if (!get_rtc_pll(&pll))
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"PLL adjustment\t: %d\n"
|
"PLL adjustment\t: %d\n"
|
||||||
"PLL max +ve adjustment\t: %d\n"
|
"PLL max +ve adjustment\t: %d\n"
|
||||||
"PLL max -ve adjustment\t: %d\n"
|
"PLL max -ve adjustment\t: %d\n"
|
||||||
|
@ -455,26 +453,26 @@ static int gen_rtc_proc_output(char *buf)
|
||||||
pll.pll_posmult,
|
pll.pll_posmult,
|
||||||
pll.pll_negmult,
|
pll.pll_negmult,
|
||||||
pll.pll_clock);
|
pll.pll_clock);
|
||||||
return p - buf;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gen_rtc_read_proc(char *page, char **start, off_t off,
|
static int gen_rtc_proc_open(struct inode *inode, struct file *file)
|
||||||
int count, int *eof, void *data)
|
|
||||||
{
|
{
|
||||||
int len = gen_rtc_proc_output (page);
|
return single_open(file, gen_rtc_proc_show, NULL);
|
||||||
if (len <= off+count) *eof = 1;
|
|
||||||
*start = page + off;
|
|
||||||
len -= off;
|
|
||||||
if (len>count) len = count;
|
|
||||||
if (len<0) len = 0;
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct file_operations gen_rtc_proc_fops = {
|
||||||
|
.open = gen_rtc_proc_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
|
|
||||||
static int __init gen_rtc_proc_init(void)
|
static int __init gen_rtc_proc_init(void)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *r;
|
struct proc_dir_entry *r;
|
||||||
|
|
||||||
r = create_proc_read_entry("driver/rtc", 0, NULL, gen_rtc_read_proc, NULL);
|
r = proc_create("driver/rtc", 0, NULL, &gen_rtc_proc_fops);
|
||||||
if (!r)
|
if (!r)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1917,7 +1917,7 @@ static int smi_ipmb_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int smi_ipmb_proc_open(struct inode *inode, struct file *file)
|
static int smi_ipmb_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, smi_ipmb_proc_show, PDE(inode)->data);
|
return single_open(file, smi_ipmb_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations smi_ipmb_proc_ops = {
|
static const struct file_operations smi_ipmb_proc_ops = {
|
||||||
|
@ -1938,7 +1938,7 @@ static int smi_version_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int smi_version_proc_open(struct inode *inode, struct file *file)
|
static int smi_version_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, smi_version_proc_show, PDE(inode)->data);
|
return single_open(file, smi_version_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations smi_version_proc_ops = {
|
static const struct file_operations smi_version_proc_ops = {
|
||||||
|
@ -2013,7 +2013,7 @@ static int smi_stats_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int smi_stats_proc_open(struct inode *inode, struct file *file)
|
static int smi_stats_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, smi_stats_proc_show, PDE(inode)->data);
|
return single_open(file, smi_stats_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations smi_stats_proc_ops = {
|
static const struct file_operations smi_stats_proc_ops = {
|
||||||
|
@ -4541,7 +4541,7 @@ static void __exit cleanup_ipmi(void)
|
||||||
del_timer_sync(&ipmi_timer);
|
del_timer_sync(&ipmi_timer);
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
remove_proc_entry(proc_ipmi_root->name, NULL);
|
proc_remove(proc_ipmi_root);
|
||||||
#endif /* CONFIG_PROC_FS */
|
#endif /* CONFIG_PROC_FS */
|
||||||
|
|
||||||
driver_unregister(&ipmidriver.driver);
|
driver_unregister(&ipmidriver.driver);
|
||||||
|
|
|
@ -2839,7 +2839,7 @@ static int smi_type_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int smi_type_proc_open(struct inode *inode, struct file *file)
|
static int smi_type_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, smi_type_proc_show, PDE(inode)->data);
|
return single_open(file, smi_type_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations smi_type_proc_ops = {
|
static const struct file_operations smi_type_proc_ops = {
|
||||||
|
@ -2882,7 +2882,7 @@ static int smi_si_stats_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int smi_si_stats_proc_open(struct inode *inode, struct file *file)
|
static int smi_si_stats_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, smi_si_stats_proc_show, PDE(inode)->data);
|
return single_open(file, smi_si_stats_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations smi_si_stats_proc_ops = {
|
static const struct file_operations smi_si_stats_proc_ops = {
|
||||||
|
@ -2910,7 +2910,7 @@ static int smi_params_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int smi_params_proc_open(struct inode *inode, struct file *file)
|
static int smi_params_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, smi_params_proc_show, PDE(inode)->data);
|
return single_open(file, smi_params_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations smi_params_proc_ops = {
|
static const struct file_operations smi_params_proc_ops = {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <linux/efi.h>
|
#include <linux/efi.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/pstore.h>
|
#include <linux/pstore.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
#include <linux/ucs2_string.h>
|
#include <linux/ucs2_string.h>
|
||||||
|
|
||||||
#define DUMP_NAME_LEN 52
|
#define DUMP_NAME_LEN 52
|
||||||
|
|
|
@ -67,6 +67,7 @@
|
||||||
|
|
||||||
#include <linux/efi.h>
|
#include <linux/efi.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
#include <linux/ucs2_string.h>
|
#include <linux/ucs2_string.h>
|
||||||
|
|
||||||
#define EFIVARS_VERSION "0.08"
|
#define EFIVARS_VERSION "0.08"
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
/**
|
/**
|
||||||
* Proc file list.
|
* Proc file list.
|
||||||
*/
|
*/
|
||||||
static struct drm_info_list drm_proc_list[] = {
|
static const struct drm_info_list drm_proc_list[] = {
|
||||||
{"name", drm_name_info, 0},
|
{"name", drm_name_info, 0},
|
||||||
{"vm", drm_vm_info, 0},
|
{"vm", drm_vm_info, 0},
|
||||||
{"clients", drm_clients_info, 0},
|
{"clients", drm_clients_info, 0},
|
||||||
|
@ -63,7 +63,7 @@ static struct drm_info_list drm_proc_list[] = {
|
||||||
|
|
||||||
static int drm_proc_open(struct inode *inode, struct file *file)
|
static int drm_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
struct drm_info_node* node = PDE(inode)->data;
|
struct drm_info_node* node = PDE_DATA(inode);
|
||||||
|
|
||||||
return single_open(file, node->info_ent->show, node);
|
return single_open(file, node->info_ent->show, node);
|
||||||
}
|
}
|
||||||
|
@ -89,13 +89,13 @@ static const struct file_operations drm_proc_fops = {
|
||||||
* Create a given set of proc files represented by an array of
|
* Create a given set of proc files represented by an array of
|
||||||
* gdm_proc_lists in the given root directory.
|
* gdm_proc_lists in the given root directory.
|
||||||
*/
|
*/
|
||||||
static int drm_proc_create_files(struct drm_info_list *files, int count,
|
static int drm_proc_create_files(const struct drm_info_list *files, int count,
|
||||||
struct proc_dir_entry *root, struct drm_minor *minor)
|
struct proc_dir_entry *root, struct drm_minor *minor)
|
||||||
{
|
{
|
||||||
struct drm_device *dev = minor->dev;
|
struct drm_device *dev = minor->dev;
|
||||||
struct proc_dir_entry *ent;
|
struct proc_dir_entry *ent;
|
||||||
struct drm_info_node *tmp;
|
struct drm_info_node *tmp;
|
||||||
int i, ret;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
u32 features = files[i].driver_features;
|
u32 features = files[i].driver_features;
|
||||||
|
@ -105,10 +105,9 @@ static int drm_proc_create_files(struct drm_info_list *files, int count,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL);
|
tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL);
|
||||||
if (tmp == NULL) {
|
if (!tmp)
|
||||||
ret = -1;
|
return -1;
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
tmp->minor = minor;
|
tmp->minor = minor;
|
||||||
tmp->info_ent = &files[i];
|
tmp->info_ent = &files[i];
|
||||||
list_add(&tmp->list, &minor->proc_nodes.list);
|
list_add(&tmp->list, &minor->proc_nodes.list);
|
||||||
|
@ -116,28 +115,20 @@ static int drm_proc_create_files(struct drm_info_list *files, int count,
|
||||||
ent = proc_create_data(files[i].name, S_IRUGO, root,
|
ent = proc_create_data(files[i].name, S_IRUGO, root,
|
||||||
&drm_proc_fops, tmp);
|
&drm_proc_fops, tmp);
|
||||||
if (!ent) {
|
if (!ent) {
|
||||||
DRM_ERROR("Cannot create /proc/dri/%s/%s\n",
|
DRM_ERROR("Cannot create /proc/dri/%u/%s\n",
|
||||||
root->name, files[i].name);
|
minor->index, files[i].name);
|
||||||
list_del(&tmp->list);
|
list_del(&tmp->list);
|
||||||
kfree(tmp);
|
kfree(tmp);
|
||||||
ret = -1;
|
return -1;
|
||||||
goto fail;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
remove_proc_entry(drm_proc_list[i].name, minor->proc_root);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the DRI proc filesystem for a device
|
* Initialize the DRI proc filesystem for a device
|
||||||
*
|
*
|
||||||
* \param dev DRM device
|
* \param dev DRM device
|
||||||
* \param minor device minor number
|
|
||||||
* \param root DRI proc dir entry.
|
* \param root DRI proc dir entry.
|
||||||
* \param dev_root resulting DRI device proc dir entry.
|
* \param dev_root resulting DRI device proc dir entry.
|
||||||
* \return root entry pointer on success, or NULL on failure.
|
* \return root entry pointer on success, or NULL on failure.
|
||||||
|
@ -146,14 +137,13 @@ static int drm_proc_create_files(struct drm_info_list *files, int count,
|
||||||
* "/proc/dri/%minor%/", and each entry in proc_list as
|
* "/proc/dri/%minor%/", and each entry in proc_list as
|
||||||
* "/proc/dri/%minor%/%name%".
|
* "/proc/dri/%minor%/%name%".
|
||||||
*/
|
*/
|
||||||
int drm_proc_init(struct drm_minor *minor, int minor_id,
|
int drm_proc_init(struct drm_minor *minor, struct proc_dir_entry *root)
|
||||||
struct proc_dir_entry *root)
|
|
||||||
{
|
{
|
||||||
char name[64];
|
char name[12];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
INIT_LIST_HEAD(&minor->proc_nodes.list);
|
INIT_LIST_HEAD(&minor->proc_nodes.list);
|
||||||
sprintf(name, "%d", minor_id);
|
sprintf(name, "%u", minor->index);
|
||||||
minor->proc_root = proc_mkdir(name, root);
|
minor->proc_root = proc_mkdir(name, root);
|
||||||
if (!minor->proc_root) {
|
if (!minor->proc_root) {
|
||||||
DRM_ERROR("Cannot create /proc/dri/%s\n", name);
|
DRM_ERROR("Cannot create /proc/dri/%s\n", name);
|
||||||
|
@ -163,7 +153,7 @@ int drm_proc_init(struct drm_minor *minor, int minor_id,
|
||||||
ret = drm_proc_create_files(drm_proc_list, DRM_PROC_ENTRIES,
|
ret = drm_proc_create_files(drm_proc_list, DRM_PROC_ENTRIES,
|
||||||
minor->proc_root, minor);
|
minor->proc_root, minor);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
remove_proc_entry(name, root);
|
remove_proc_subtree(name, root);
|
||||||
minor->proc_root = NULL;
|
minor->proc_root = NULL;
|
||||||
DRM_ERROR("Failed to create core drm proc files\n");
|
DRM_ERROR("Failed to create core drm proc files\n");
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -172,7 +162,7 @@ int drm_proc_init(struct drm_minor *minor, int minor_id,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int drm_proc_remove_files(struct drm_info_list *files, int count,
|
static int drm_proc_remove_files(const struct drm_info_list *files, int count,
|
||||||
struct drm_minor *minor)
|
struct drm_minor *minor)
|
||||||
{
|
{
|
||||||
struct list_head *pos, *q;
|
struct list_head *pos, *q;
|
||||||
|
@ -213,8 +203,7 @@ int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root)
|
||||||
drm_proc_remove_files(drm_proc_list, DRM_PROC_ENTRIES, minor);
|
drm_proc_remove_files(drm_proc_list, DRM_PROC_ENTRIES, minor);
|
||||||
|
|
||||||
sprintf(name, "%d", minor->index);
|
sprintf(name, "%d", minor->index);
|
||||||
remove_proc_entry(name, root);
|
remove_proc_subtree(name, root);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -352,7 +352,7 @@ int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type)
|
||||||
idr_replace(&drm_minors_idr, new_minor, minor_id);
|
idr_replace(&drm_minors_idr, new_minor, minor_id);
|
||||||
|
|
||||||
if (type == DRM_MINOR_LEGACY) {
|
if (type == DRM_MINOR_LEGACY) {
|
||||||
ret = drm_proc_init(new_minor, minor_id, drm_proc_root);
|
ret = drm_proc_init(new_minor, drm_proc_root);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
DRM_ERROR("DRM: Failed to initialize /proc/dri.\n");
|
DRM_ERROR("DRM: Failed to initialize /proc/dri.\n");
|
||||||
goto err_mem;
|
goto err_mem;
|
||||||
|
|
|
@ -1408,7 +1408,7 @@ static int idecd_capacity_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int idecd_capacity_proc_open(struct inode *inode, struct file *file)
|
static int idecd_capacity_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, idecd_capacity_proc_show, PDE(inode)->data);
|
return single_open(file, idecd_capacity_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations idecd_capacity_proc_fops = {
|
static const struct file_operations idecd_capacity_proc_fops = {
|
||||||
|
|
|
@ -53,7 +53,7 @@ static int idedisk_cache_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int idedisk_cache_proc_open(struct inode *inode, struct file *file)
|
static int idedisk_cache_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, idedisk_cache_proc_show, PDE(inode)->data);
|
return single_open(file, idedisk_cache_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations idedisk_cache_proc_fops = {
|
static const struct file_operations idedisk_cache_proc_fops = {
|
||||||
|
@ -74,7 +74,7 @@ static int idedisk_capacity_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int idedisk_capacity_proc_open(struct inode *inode, struct file *file)
|
static int idedisk_capacity_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, idedisk_capacity_proc_show, PDE(inode)->data);
|
return single_open(file, idedisk_capacity_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations idedisk_capacity_proc_fops = {
|
static const struct file_operations idedisk_capacity_proc_fops = {
|
||||||
|
@ -115,7 +115,7 @@ static int idedisk_sv_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int idedisk_sv_proc_open(struct inode *inode, struct file *file)
|
static int idedisk_sv_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, idedisk_sv_proc_show, PDE(inode)->data);
|
return single_open(file, idedisk_sv_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations idedisk_sv_proc_fops = {
|
static const struct file_operations idedisk_sv_proc_fops = {
|
||||||
|
@ -133,7 +133,7 @@ static int idedisk_st_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int idedisk_st_proc_open(struct inode *inode, struct file *file)
|
static int idedisk_st_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, idedisk_st_proc_show, PDE(inode)->data);
|
return single_open(file, idedisk_st_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations idedisk_st_proc_fops = {
|
static const struct file_operations idedisk_st_proc_fops = {
|
||||||
|
|
|
@ -15,7 +15,7 @@ static int idefloppy_capacity_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int idefloppy_capacity_proc_open(struct inode *inode, struct file *file)
|
static int idefloppy_capacity_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, idefloppy_capacity_proc_show, PDE(inode)->data);
|
return single_open(file, idefloppy_capacity_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations idefloppy_capacity_proc_fops = {
|
static const struct file_operations idefloppy_capacity_proc_fops = {
|
||||||
|
|
|
@ -58,7 +58,7 @@ static int ide_imodel_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int ide_imodel_proc_open(struct inode *inode, struct file *file)
|
static int ide_imodel_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, ide_imodel_proc_show, PDE(inode)->data);
|
return single_open(file, ide_imodel_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations ide_imodel_proc_fops = {
|
static const struct file_operations ide_imodel_proc_fops = {
|
||||||
|
@ -82,7 +82,7 @@ static int ide_mate_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int ide_mate_proc_open(struct inode *inode, struct file *file)
|
static int ide_mate_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, ide_mate_proc_show, PDE(inode)->data);
|
return single_open(file, ide_mate_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations ide_mate_proc_fops = {
|
static const struct file_operations ide_mate_proc_fops = {
|
||||||
|
@ -103,7 +103,7 @@ static int ide_channel_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int ide_channel_proc_open(struct inode *inode, struct file *file)
|
static int ide_channel_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, ide_channel_proc_show, PDE(inode)->data);
|
return single_open(file, ide_channel_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations ide_channel_proc_fops = {
|
static const struct file_operations ide_channel_proc_fops = {
|
||||||
|
@ -143,7 +143,7 @@ static int ide_identify_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int ide_identify_proc_open(struct inode *inode, struct file *file)
|
static int ide_identify_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, ide_identify_proc_show, PDE(inode)->data);
|
return single_open(file, ide_identify_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations ide_identify_proc_fops = {
|
static const struct file_operations ide_identify_proc_fops = {
|
||||||
|
@ -325,7 +325,7 @@ static int ide_settings_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int ide_settings_proc_open(struct inode *inode, struct file *file)
|
static int ide_settings_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, ide_settings_proc_show, PDE(inode)->data);
|
return single_open(file, ide_settings_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_LEN 30
|
#define MAX_LEN 30
|
||||||
|
@ -333,7 +333,7 @@ static int ide_settings_proc_open(struct inode *inode, struct file *file)
|
||||||
static ssize_t ide_settings_proc_write(struct file *file, const char __user *buffer,
|
static ssize_t ide_settings_proc_write(struct file *file, const char __user *buffer,
|
||||||
size_t count, loff_t *pos)
|
size_t count, loff_t *pos)
|
||||||
{
|
{
|
||||||
ide_drive_t *drive = (ide_drive_t *) PDE(file_inode(file))->data;
|
ide_drive_t *drive = PDE_DATA(file_inode(file));
|
||||||
char name[MAX_LEN + 1];
|
char name[MAX_LEN + 1];
|
||||||
int for_real = 0, mul_factor, div_factor;
|
int for_real = 0, mul_factor, div_factor;
|
||||||
unsigned long n;
|
unsigned long n;
|
||||||
|
@ -474,7 +474,7 @@ static int ide_geometry_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int ide_geometry_proc_open(struct inode *inode, struct file *file)
|
static int ide_geometry_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, ide_geometry_proc_show, PDE(inode)->data);
|
return single_open(file, ide_geometry_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct file_operations ide_geometry_proc_fops = {
|
const struct file_operations ide_geometry_proc_fops = {
|
||||||
|
@ -497,7 +497,7 @@ static int ide_dmodel_proc_show(struct seq_file *seq, void *v)
|
||||||
|
|
||||||
static int ide_dmodel_proc_open(struct inode *inode, struct file *file)
|
static int ide_dmodel_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, ide_dmodel_proc_show, PDE(inode)->data);
|
return single_open(file, ide_dmodel_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations ide_dmodel_proc_fops = {
|
static const struct file_operations ide_dmodel_proc_fops = {
|
||||||
|
@ -525,7 +525,7 @@ static int ide_driver_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int ide_driver_proc_open(struct inode *inode, struct file *file)
|
static int ide_driver_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, ide_driver_proc_show, PDE(inode)->data);
|
return single_open(file, ide_driver_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ide_replace_subdriver(ide_drive_t *drive, const char *driver)
|
static int ide_replace_subdriver(ide_drive_t *drive, const char *driver)
|
||||||
|
@ -558,7 +558,7 @@ static int ide_replace_subdriver(ide_drive_t *drive, const char *driver)
|
||||||
static ssize_t ide_driver_proc_write(struct file *file, const char __user *buffer,
|
static ssize_t ide_driver_proc_write(struct file *file, const char __user *buffer,
|
||||||
size_t count, loff_t *pos)
|
size_t count, loff_t *pos)
|
||||||
{
|
{
|
||||||
ide_drive_t *drive = (ide_drive_t *) PDE(file_inode(file))->data;
|
ide_drive_t *drive = PDE_DATA(file_inode(file));
|
||||||
char name[32];
|
char name[32];
|
||||||
|
|
||||||
if (!capable(CAP_SYS_ADMIN))
|
if (!capable(CAP_SYS_ADMIN))
|
||||||
|
@ -601,7 +601,7 @@ static int ide_media_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int ide_media_proc_open(struct inode *inode, struct file *file)
|
static int ide_media_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, ide_media_proc_show, PDE(inode)->data);
|
return single_open(file, ide_media_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations ide_media_proc_fops = {
|
static const struct file_operations ide_media_proc_fops = {
|
||||||
|
|
|
@ -1847,7 +1847,7 @@ static int idetape_name_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int idetape_name_proc_open(struct inode *inode, struct file *file)
|
static int idetape_name_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, idetape_name_proc_show, PDE(inode)->data);
|
return single_open(file, idetape_name_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations idetape_name_proc_fops = {
|
static const struct file_operations idetape_name_proc_fops = {
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include <linux/time.h>
|
#include <linux/time.h>
|
||||||
#include <linux/miscdevice.h>
|
#include <linux/miscdevice.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/seq_file.h>
|
||||||
#include <linux/poll.h>
|
#include <linux/poll.h>
|
||||||
#include <linux/rtc.h>
|
#include <linux/rtc.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
|
@ -74,9 +75,6 @@ static unsigned int hp_sdc_rtc_poll(struct file *file, poll_table *wait);
|
||||||
static int hp_sdc_rtc_open(struct inode *inode, struct file *file);
|
static int hp_sdc_rtc_open(struct inode *inode, struct file *file);
|
||||||
static int hp_sdc_rtc_fasync (int fd, struct file *filp, int on);
|
static int hp_sdc_rtc_fasync (int fd, struct file *filp, int on);
|
||||||
|
|
||||||
static int hp_sdc_rtc_read_proc(char *page, char **start, off_t off,
|
|
||||||
int count, int *eof, void *data);
|
|
||||||
|
|
||||||
static void hp_sdc_rtc_isr (int irq, void *dev_id,
|
static void hp_sdc_rtc_isr (int irq, void *dev_id,
|
||||||
uint8_t status, uint8_t data)
|
uint8_t status, uint8_t data)
|
||||||
{
|
{
|
||||||
|
@ -427,22 +425,19 @@ static int hp_sdc_rtc_fasync (int fd, struct file *filp, int on)
|
||||||
return fasync_helper (fd, filp, on, &hp_sdc_rtc_async_queue);
|
return fasync_helper (fd, filp, on, &hp_sdc_rtc_async_queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hp_sdc_rtc_proc_output (char *buf)
|
static int hp_sdc_rtc_proc_show(struct seq_file *m, void *v)
|
||||||
{
|
{
|
||||||
#define YN(bit) ("no")
|
#define YN(bit) ("no")
|
||||||
#define NY(bit) ("yes")
|
#define NY(bit) ("yes")
|
||||||
char *p;
|
|
||||||
struct rtc_time tm;
|
struct rtc_time tm;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
memset(&tm, 0, sizeof(struct rtc_time));
|
memset(&tm, 0, sizeof(struct rtc_time));
|
||||||
|
|
||||||
p = buf;
|
|
||||||
|
|
||||||
if (hp_sdc_rtc_read_bbrtc(&tm)) {
|
if (hp_sdc_rtc_read_bbrtc(&tm)) {
|
||||||
p += sprintf(p, "BBRTC\t\t: READ FAILED!\n");
|
seq_puts(m, "BBRTC\t\t: READ FAILED!\n");
|
||||||
} else {
|
} else {
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"rtc_time\t: %02d:%02d:%02d\n"
|
"rtc_time\t: %02d:%02d:%02d\n"
|
||||||
"rtc_date\t: %04d-%02d-%02d\n"
|
"rtc_date\t: %04d-%02d-%02d\n"
|
||||||
"rtc_epoch\t: %04lu\n",
|
"rtc_epoch\t: %04lu\n",
|
||||||
|
@ -452,41 +447,41 @@ static int hp_sdc_rtc_proc_output (char *buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hp_sdc_rtc_read_rt(&tv)) {
|
if (hp_sdc_rtc_read_rt(&tv)) {
|
||||||
p += sprintf(p, "i8042 rtc\t: READ FAILED!\n");
|
seq_puts(m, "i8042 rtc\t: READ FAILED!\n");
|
||||||
} else {
|
} else {
|
||||||
p += sprintf(p, "i8042 rtc\t: %ld.%02d seconds\n",
|
seq_printf(m, "i8042 rtc\t: %ld.%02d seconds\n",
|
||||||
tv.tv_sec, (int)tv.tv_usec/1000);
|
tv.tv_sec, (int)tv.tv_usec/1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hp_sdc_rtc_read_fhs(&tv)) {
|
if (hp_sdc_rtc_read_fhs(&tv)) {
|
||||||
p += sprintf(p, "handshake\t: READ FAILED!\n");
|
seq_puts(m, "handshake\t: READ FAILED!\n");
|
||||||
} else {
|
} else {
|
||||||
p += sprintf(p, "handshake\t: %ld.%02d seconds\n",
|
seq_printf(m, "handshake\t: %ld.%02d seconds\n",
|
||||||
tv.tv_sec, (int)tv.tv_usec/1000);
|
tv.tv_sec, (int)tv.tv_usec/1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hp_sdc_rtc_read_mt(&tv)) {
|
if (hp_sdc_rtc_read_mt(&tv)) {
|
||||||
p += sprintf(p, "alarm\t\t: READ FAILED!\n");
|
seq_puts(m, "alarm\t\t: READ FAILED!\n");
|
||||||
} else {
|
} else {
|
||||||
p += sprintf(p, "alarm\t\t: %ld.%02d seconds\n",
|
seq_printf(m, "alarm\t\t: %ld.%02d seconds\n",
|
||||||
tv.tv_sec, (int)tv.tv_usec/1000);
|
tv.tv_sec, (int)tv.tv_usec/1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hp_sdc_rtc_read_dt(&tv)) {
|
if (hp_sdc_rtc_read_dt(&tv)) {
|
||||||
p += sprintf(p, "delay\t\t: READ FAILED!\n");
|
seq_puts(m, "delay\t\t: READ FAILED!\n");
|
||||||
} else {
|
} else {
|
||||||
p += sprintf(p, "delay\t\t: %ld.%02d seconds\n",
|
seq_printf(m, "delay\t\t: %ld.%02d seconds\n",
|
||||||
tv.tv_sec, (int)tv.tv_usec/1000);
|
tv.tv_sec, (int)tv.tv_usec/1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hp_sdc_rtc_read_ct(&tv)) {
|
if (hp_sdc_rtc_read_ct(&tv)) {
|
||||||
p += sprintf(p, "periodic\t: READ FAILED!\n");
|
seq_puts(m, "periodic\t: READ FAILED!\n");
|
||||||
} else {
|
} else {
|
||||||
p += sprintf(p, "periodic\t: %ld.%02d seconds\n",
|
seq_printf(m, "periodic\t: %ld.%02d seconds\n",
|
||||||
tv.tv_sec, (int)tv.tv_usec/1000);
|
tv.tv_sec, (int)tv.tv_usec/1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
p += sprintf(p,
|
seq_printf(m,
|
||||||
"DST_enable\t: %s\n"
|
"DST_enable\t: %s\n"
|
||||||
"BCD\t\t: %s\n"
|
"BCD\t\t: %s\n"
|
||||||
"24hr\t\t: %s\n"
|
"24hr\t\t: %s\n"
|
||||||
|
@ -506,23 +501,23 @@ static int hp_sdc_rtc_proc_output (char *buf)
|
||||||
1UL,
|
1UL,
|
||||||
1 ? "okay" : "dead");
|
1 ? "okay" : "dead");
|
||||||
|
|
||||||
return p - buf;
|
return 0;
|
||||||
#undef YN
|
#undef YN
|
||||||
#undef NY
|
#undef NY
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hp_sdc_rtc_read_proc(char *page, char **start, off_t off,
|
static int hp_sdc_rtc_proc_open(struct inode *inode, struct file *file)
|
||||||
int count, int *eof, void *data)
|
|
||||||
{
|
{
|
||||||
int len = hp_sdc_rtc_proc_output (page);
|
return single_open(file, hp_sdc_rtc_proc_show, NULL);
|
||||||
if (len <= off+count) *eof = 1;
|
|
||||||
*start = page + off;
|
|
||||||
len -= off;
|
|
||||||
if (len>count) len = count;
|
|
||||||
if (len<0) len = 0;
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct file_operations hp_sdc_rtc_proc_fops = {
|
||||||
|
.open = hp_sdc_rtc_proc_open,
|
||||||
|
.read = seq_read,
|
||||||
|
.llseek = seq_lseek,
|
||||||
|
.release = seq_release,
|
||||||
|
};
|
||||||
|
|
||||||
static int hp_sdc_rtc_ioctl(struct file *file,
|
static int hp_sdc_rtc_ioctl(struct file *file,
|
||||||
unsigned int cmd, unsigned long arg)
|
unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
|
@ -715,8 +710,7 @@ static int __init hp_sdc_rtc_init(void)
|
||||||
if (misc_register(&hp_sdc_rtc_dev) != 0)
|
if (misc_register(&hp_sdc_rtc_dev) != 0)
|
||||||
printk(KERN_INFO "Could not register misc. dev for i8042 rtc\n");
|
printk(KERN_INFO "Could not register misc. dev for i8042 rtc\n");
|
||||||
|
|
||||||
create_proc_read_entry ("driver/rtc", 0, NULL,
|
proc_create("driver/rtc", 0, NULL, &hp_sdc_rtc_proc_fops);
|
||||||
hp_sdc_rtc_read_proc, NULL);
|
|
||||||
|
|
||||||
printk(KERN_INFO "HP i8042 SDC + MSM-58321 RTC support loaded "
|
printk(KERN_INFO "HP i8042 SDC + MSM-58321 RTC support loaded "
|
||||||
"(RTC v " RTC_VERSION ")\n");
|
"(RTC v " RTC_VERSION ")\n");
|
||||||
|
|
|
@ -2334,7 +2334,7 @@ static int gigaset_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int gigaset_proc_open(struct inode *inode, struct file *file)
|
static int gigaset_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, gigaset_proc_show, PDE(inode)->data);
|
return single_open(file, gigaset_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations gigaset_proc_fops = {
|
static const struct file_operations gigaset_proc_fops = {
|
||||||
|
|
|
@ -702,7 +702,7 @@ static int b1ctl_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int b1ctl_proc_open(struct inode *inode, struct file *file)
|
static int b1ctl_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, b1ctl_proc_show, PDE(inode)->data);
|
return single_open(file, b1ctl_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct file_operations b1ctl_proc_fops = {
|
const struct file_operations b1ctl_proc_fops = {
|
||||||
|
|
|
@ -944,7 +944,7 @@ static int b1dmactl_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int b1dmactl_proc_open(struct inode *inode, struct file *file)
|
static int b1dmactl_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, b1dmactl_proc_show, PDE(inode)->data);
|
return single_open(file, b1dmactl_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct file_operations b1dmactl_proc_fops = {
|
const struct file_operations b1dmactl_proc_fops = {
|
||||||
|
|
|
@ -1129,7 +1129,7 @@ static int c4_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int c4_proc_open(struct inode *inode, struct file *file)
|
static int c4_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, c4_proc_show, PDE(inode)->data);
|
return single_open(file, c4_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations c4_proc_fops = {
|
static const struct file_operations c4_proc_fops = {
|
||||||
|
|
|
@ -145,7 +145,7 @@ void remove_divas_proc(void)
|
||||||
static ssize_t grp_opt_proc_write(struct file *file, const char __user *buffer,
|
static ssize_t grp_opt_proc_write(struct file *file, const char __user *buffer,
|
||||||
size_t count, loff_t *pos)
|
size_t count, loff_t *pos)
|
||||||
{
|
{
|
||||||
diva_os_xdi_adapter_t *a = PDE(file_inode(file))->data;
|
diva_os_xdi_adapter_t *a = PDE_DATA(file_inode(file));
|
||||||
PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
|
PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
|
||||||
|
|
||||||
if ((count == 1) || (count == 2)) {
|
if ((count == 1) || (count == 2)) {
|
||||||
|
@ -172,7 +172,7 @@ static ssize_t grp_opt_proc_write(struct file *file, const char __user *buffer,
|
||||||
static ssize_t d_l1_down_proc_write(struct file *file, const char __user *buffer,
|
static ssize_t d_l1_down_proc_write(struct file *file, const char __user *buffer,
|
||||||
size_t count, loff_t *pos)
|
size_t count, loff_t *pos)
|
||||||
{
|
{
|
||||||
diva_os_xdi_adapter_t *a = PDE(file_inode(file))->data;
|
diva_os_xdi_adapter_t *a = PDE_DATA(file_inode(file));
|
||||||
PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
|
PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
|
||||||
|
|
||||||
if ((count == 1) || (count == 2)) {
|
if ((count == 1) || (count == 2)) {
|
||||||
|
@ -210,7 +210,7 @@ static int d_l1_down_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int d_l1_down_proc_open(struct inode *inode, struct file *file)
|
static int d_l1_down_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, d_l1_down_proc_show, PDE(inode)->data);
|
return single_open(file, d_l1_down_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations d_l1_down_proc_fops = {
|
static const struct file_operations d_l1_down_proc_fops = {
|
||||||
|
@ -236,7 +236,7 @@ static int grp_opt_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int grp_opt_proc_open(struct inode *inode, struct file *file)
|
static int grp_opt_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, grp_opt_proc_show, PDE(inode)->data);
|
return single_open(file, grp_opt_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations grp_opt_proc_fops = {
|
static const struct file_operations grp_opt_proc_fops = {
|
||||||
|
@ -251,7 +251,7 @@ static const struct file_operations grp_opt_proc_fops = {
|
||||||
static ssize_t info_proc_write(struct file *file, const char __user *buffer,
|
static ssize_t info_proc_write(struct file *file, const char __user *buffer,
|
||||||
size_t count, loff_t *pos)
|
size_t count, loff_t *pos)
|
||||||
{
|
{
|
||||||
diva_os_xdi_adapter_t *a = PDE(file_inode(file))->data;
|
diva_os_xdi_adapter_t *a = PDE_DATA(file_inode(file));
|
||||||
PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
|
PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
|
||||||
char c[4];
|
char c[4];
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ static int info_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int info_proc_open(struct inode *inode, struct file *file)
|
static int info_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, info_proc_show, PDE(inode)->data);
|
return single_open(file, info_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations info_proc_fops = {
|
static const struct file_operations info_proc_fops = {
|
||||||
|
|
|
@ -469,7 +469,7 @@ static int hycapi_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int hycapi_proc_open(struct inode *inode, struct file *file)
|
static int hycapi_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, hycapi_proc_show, PDE(inode)->data);
|
return single_open(file, hycapi_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations hycapi_proc_fops = {
|
static const struct file_operations hycapi_proc_fops = {
|
||||||
|
|
|
@ -229,23 +229,12 @@ static int
|
||||||
hysdn_conf_open(struct inode *ino, struct file *filep)
|
hysdn_conf_open(struct inode *ino, struct file *filep)
|
||||||
{
|
{
|
||||||
hysdn_card *card;
|
hysdn_card *card;
|
||||||
struct proc_dir_entry *pd;
|
|
||||||
struct conf_writedata *cnf;
|
struct conf_writedata *cnf;
|
||||||
char *cp, *tmp;
|
char *cp, *tmp;
|
||||||
|
|
||||||
/* now search the addressed card */
|
/* now search the addressed card */
|
||||||
mutex_lock(&hysdn_conf_mutex);
|
mutex_lock(&hysdn_conf_mutex);
|
||||||
card = card_root;
|
card = PDE_DATA(ino);
|
||||||
while (card) {
|
|
||||||
pd = card->procconf;
|
|
||||||
if (pd == PDE(ino))
|
|
||||||
break;
|
|
||||||
card = card->next; /* search next entry */
|
|
||||||
}
|
|
||||||
if (!card) {
|
|
||||||
mutex_unlock(&hysdn_conf_mutex);
|
|
||||||
return (-ENODEV); /* device is unknown/invalid */
|
|
||||||
}
|
|
||||||
if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL))
|
if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL))
|
||||||
hysdn_addlog(card, "config open for uid=%d gid=%d mode=0x%x",
|
hysdn_addlog(card, "config open for uid=%d gid=%d mode=0x%x",
|
||||||
filep->f_cred->fsuid, filep->f_cred->fsgid,
|
filep->f_cred->fsuid, filep->f_cred->fsgid,
|
||||||
|
@ -317,21 +306,9 @@ hysdn_conf_close(struct inode *ino, struct file *filep)
|
||||||
hysdn_card *card;
|
hysdn_card *card;
|
||||||
struct conf_writedata *cnf;
|
struct conf_writedata *cnf;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
struct proc_dir_entry *pd;
|
|
||||||
|
|
||||||
mutex_lock(&hysdn_conf_mutex);
|
mutex_lock(&hysdn_conf_mutex);
|
||||||
/* search the addressed card */
|
card = PDE_DATA(ino);
|
||||||
card = card_root;
|
|
||||||
while (card) {
|
|
||||||
pd = card->procconf;
|
|
||||||
if (pd == PDE(ino))
|
|
||||||
break;
|
|
||||||
card = card->next; /* search next entry */
|
|
||||||
}
|
|
||||||
if (!card) {
|
|
||||||
mutex_unlock(&hysdn_conf_mutex);
|
|
||||||
return (-ENODEV); /* device is unknown/invalid */
|
|
||||||
}
|
|
||||||
if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL))
|
if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL))
|
||||||
hysdn_addlog(card, "config close for uid=%d gid=%d mode=0x%x",
|
hysdn_addlog(card, "config close for uid=%d gid=%d mode=0x%x",
|
||||||
filep->f_cred->fsuid, filep->f_cred->fsgid,
|
filep->f_cred->fsuid, filep->f_cred->fsgid,
|
||||||
|
@ -394,10 +371,11 @@ hysdn_procconf_init(void)
|
||||||
while (card) {
|
while (card) {
|
||||||
|
|
||||||
sprintf(conf_name, "%s%d", PROC_CONF_BASENAME, card->myid);
|
sprintf(conf_name, "%s%d", PROC_CONF_BASENAME, card->myid);
|
||||||
if ((card->procconf = (void *) proc_create(conf_name,
|
if ((card->procconf = (void *) proc_create_data(conf_name,
|
||||||
S_IFREG | S_IRUGO | S_IWUSR,
|
S_IFREG | S_IRUGO | S_IWUSR,
|
||||||
hysdn_proc_entry,
|
hysdn_proc_entry,
|
||||||
&conf_fops)) != NULL) {
|
&conf_fops,
|
||||||
|
card)) != NULL) {
|
||||||
hysdn_proclog_init(card); /* init the log file entry */
|
hysdn_proclog_init(card); /* init the log file entry */
|
||||||
}
|
}
|
||||||
card = card->next; /* next entry */
|
card = card->next; /* next entry */
|
||||||
|
|
|
@ -173,27 +173,14 @@ hysdn_log_read(struct file *file, char __user *buf, size_t count, loff_t *off)
|
||||||
{
|
{
|
||||||
struct log_data *inf;
|
struct log_data *inf;
|
||||||
int len;
|
int len;
|
||||||
struct proc_dir_entry *pde = PDE(file_inode(file));
|
hysdn_card *card = PDE_DATA(file_inode(file));
|
||||||
struct procdata *pd = NULL;
|
|
||||||
hysdn_card *card;
|
|
||||||
|
|
||||||
if (!*((struct log_data **) file->private_data)) {
|
if (!*((struct log_data **) file->private_data)) {
|
||||||
|
struct procdata *pd = card->proclog;
|
||||||
if (file->f_flags & O_NONBLOCK)
|
if (file->f_flags & O_NONBLOCK)
|
||||||
return (-EAGAIN);
|
return (-EAGAIN);
|
||||||
|
|
||||||
/* sorry, but we need to search the card */
|
interruptible_sleep_on(&(pd->rd_queue));
|
||||||
card = card_root;
|
|
||||||
while (card) {
|
|
||||||
pd = card->proclog;
|
|
||||||
if (pd->log == pde)
|
|
||||||
break;
|
|
||||||
card = card->next; /* search next entry */
|
|
||||||
}
|
|
||||||
if (card)
|
|
||||||
interruptible_sleep_on(&(pd->rd_queue));
|
|
||||||
else
|
|
||||||
return (-EAGAIN);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!(inf = *((struct log_data **) file->private_data)))
|
if (!(inf = *((struct log_data **) file->private_data)))
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -215,27 +202,15 @@ hysdn_log_read(struct file *file, char __user *buf, size_t count, loff_t *off)
|
||||||
static int
|
static int
|
||||||
hysdn_log_open(struct inode *ino, struct file *filep)
|
hysdn_log_open(struct inode *ino, struct file *filep)
|
||||||
{
|
{
|
||||||
hysdn_card *card;
|
hysdn_card *card = PDE_DATA(ino);
|
||||||
struct procdata *pd = NULL;
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
mutex_lock(&hysdn_log_mutex);
|
mutex_lock(&hysdn_log_mutex);
|
||||||
card = card_root;
|
|
||||||
while (card) {
|
|
||||||
pd = card->proclog;
|
|
||||||
if (pd->log == PDE(ino))
|
|
||||||
break;
|
|
||||||
card = card->next; /* search next entry */
|
|
||||||
}
|
|
||||||
if (!card) {
|
|
||||||
mutex_unlock(&hysdn_log_mutex);
|
|
||||||
return (-ENODEV); /* device is unknown/invalid */
|
|
||||||
}
|
|
||||||
filep->private_data = card; /* remember our own card */
|
|
||||||
|
|
||||||
if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) {
|
if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) {
|
||||||
/* write only access -> write log level only */
|
/* write only access -> write log level only */
|
||||||
|
filep->private_data = card; /* remember our own card */
|
||||||
} else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) {
|
} else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) {
|
||||||
|
struct procdata *pd = card->proclog;
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
/* read access -> log/debug read */
|
/* read access -> log/debug read */
|
||||||
spin_lock_irqsave(&card->hysdn_lock, flags);
|
spin_lock_irqsave(&card->hysdn_lock, flags);
|
||||||
|
@ -275,21 +250,13 @@ hysdn_log_close(struct inode *ino, struct file *filep)
|
||||||
} else {
|
} else {
|
||||||
/* read access -> log/debug read, mark one further file as closed */
|
/* read access -> log/debug read, mark one further file as closed */
|
||||||
|
|
||||||
pd = NULL;
|
|
||||||
inf = *((struct log_data **) filep->private_data); /* get first log entry */
|
inf = *((struct log_data **) filep->private_data); /* get first log entry */
|
||||||
if (inf)
|
if (inf)
|
||||||
pd = (struct procdata *) inf->proc_ctrl; /* still entries there */
|
pd = (struct procdata *) inf->proc_ctrl; /* still entries there */
|
||||||
else {
|
else {
|
||||||
/* no info available -> search card */
|
/* no info available -> search card */
|
||||||
card = card_root;
|
card = PDE_DATA(file_inode(filep));
|
||||||
while (card) {
|
pd = card->proclog; /* pointer to procfs log */
|
||||||
pd = card->proclog;
|
|
||||||
if (pd->log == PDE(ino))
|
|
||||||
break;
|
|
||||||
card = card->next; /* search next entry */
|
|
||||||
}
|
|
||||||
if (card)
|
|
||||||
pd = card->proclog; /* pointer to procfs log */
|
|
||||||
}
|
}
|
||||||
if (pd)
|
if (pd)
|
||||||
pd->if_used--; /* decrement interface usage count by one */
|
pd->if_used--; /* decrement interface usage count by one */
|
||||||
|
@ -319,24 +286,12 @@ static unsigned int
|
||||||
hysdn_log_poll(struct file *file, poll_table *wait)
|
hysdn_log_poll(struct file *file, poll_table *wait)
|
||||||
{
|
{
|
||||||
unsigned int mask = 0;
|
unsigned int mask = 0;
|
||||||
struct proc_dir_entry *pde = PDE(file_inode(file));
|
hysdn_card *card = PDE_DATA(file_inode(file));
|
||||||
hysdn_card *card;
|
struct procdata *pd = card->proclog;
|
||||||
struct procdata *pd = NULL;
|
|
||||||
|
|
||||||
if ((file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE)
|
if ((file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE)
|
||||||
return (mask); /* no polling for write supported */
|
return (mask); /* no polling for write supported */
|
||||||
|
|
||||||
/* we need to search the card */
|
|
||||||
card = card_root;
|
|
||||||
while (card) {
|
|
||||||
pd = card->proclog;
|
|
||||||
if (pd->log == pde)
|
|
||||||
break;
|
|
||||||
card = card->next; /* search next entry */
|
|
||||||
}
|
|
||||||
if (!card)
|
|
||||||
return (mask); /* card not found */
|
|
||||||
|
|
||||||
poll_wait(file, &(pd->rd_queue), wait);
|
poll_wait(file, &(pd->rd_queue), wait);
|
||||||
|
|
||||||
if (*((struct log_data **) file->private_data))
|
if (*((struct log_data **) file->private_data))
|
||||||
|
@ -373,9 +328,9 @@ hysdn_proclog_init(hysdn_card *card)
|
||||||
|
|
||||||
if ((pd = kzalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) {
|
if ((pd = kzalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) {
|
||||||
sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid);
|
sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid);
|
||||||
pd->log = proc_create(pd->log_name,
|
pd->log = proc_create_data(pd->log_name,
|
||||||
S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry,
|
S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry,
|
||||||
&log_fops);
|
&log_fops, card);
|
||||||
|
|
||||||
init_waitqueue_head(&(pd->rd_queue));
|
init_waitqueue_head(&(pd->rd_queue));
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,6 @@ mISDN_open(struct inode *ino, struct file *filep)
|
||||||
dev->work = 0;
|
dev->work = 0;
|
||||||
init_waitqueue_head(&dev->wait);
|
init_waitqueue_head(&dev->wait);
|
||||||
filep->private_data = dev;
|
filep->private_data = dev;
|
||||||
__module_get(THIS_MODULE);
|
|
||||||
return nonseekable_open(ino, filep);
|
return nonseekable_open(ino, filep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,19 +71,28 @@ static int
|
||||||
mISDN_close(struct inode *ino, struct file *filep)
|
mISDN_close(struct inode *ino, struct file *filep)
|
||||||
{
|
{
|
||||||
struct mISDNtimerdev *dev = filep->private_data;
|
struct mISDNtimerdev *dev = filep->private_data;
|
||||||
|
struct list_head *list = &dev->pending;
|
||||||
struct mISDNtimer *timer, *next;
|
struct mISDNtimer *timer, *next;
|
||||||
|
|
||||||
if (*debug & DEBUG_TIMER)
|
if (*debug & DEBUG_TIMER)
|
||||||
printk(KERN_DEBUG "%s(%p,%p)\n", __func__, ino, filep);
|
printk(KERN_DEBUG "%s(%p,%p)\n", __func__, ino, filep);
|
||||||
list_for_each_entry_safe(timer, next, &dev->pending, list) {
|
|
||||||
del_timer(&timer->tl);
|
spin_lock_irq(&dev->lock);
|
||||||
|
while (!list_empty(list)) {
|
||||||
|
timer = list_first_entry(list, struct mISDNtimer, list);
|
||||||
|
spin_unlock_irq(&dev->lock);
|
||||||
|
del_timer_sync(&timer->tl);
|
||||||
|
spin_lock_irq(&dev->lock);
|
||||||
|
/* it might have been moved to ->expired */
|
||||||
|
list_del(&timer->list);
|
||||||
kfree(timer);
|
kfree(timer);
|
||||||
}
|
}
|
||||||
|
spin_unlock_irq(&dev->lock);
|
||||||
|
|
||||||
list_for_each_entry_safe(timer, next, &dev->expired, list) {
|
list_for_each_entry_safe(timer, next, &dev->expired, list) {
|
||||||
kfree(timer);
|
kfree(timer);
|
||||||
}
|
}
|
||||||
kfree(dev);
|
kfree(dev);
|
||||||
module_put(THIS_MODULE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,36 +100,41 @@ static ssize_t
|
||||||
mISDN_read(struct file *filep, char __user *buf, size_t count, loff_t *off)
|
mISDN_read(struct file *filep, char __user *buf, size_t count, loff_t *off)
|
||||||
{
|
{
|
||||||
struct mISDNtimerdev *dev = filep->private_data;
|
struct mISDNtimerdev *dev = filep->private_data;
|
||||||
|
struct list_head *list = &dev->expired;
|
||||||
struct mISDNtimer *timer;
|
struct mISDNtimer *timer;
|
||||||
u_long flags;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (*debug & DEBUG_TIMER)
|
if (*debug & DEBUG_TIMER)
|
||||||
printk(KERN_DEBUG "%s(%p, %p, %d, %p)\n", __func__,
|
printk(KERN_DEBUG "%s(%p, %p, %d, %p)\n", __func__,
|
||||||
filep, buf, (int)count, off);
|
filep, buf, (int)count, off);
|
||||||
|
|
||||||
if (list_empty(&dev->expired) && (dev->work == 0)) {
|
if (count < sizeof(int))
|
||||||
|
return -ENOSPC;
|
||||||
|
|
||||||
|
spin_lock_irq(&dev->lock);
|
||||||
|
while (list_empty(list) && (dev->work == 0)) {
|
||||||
|
spin_unlock_irq(&dev->lock);
|
||||||
if (filep->f_flags & O_NONBLOCK)
|
if (filep->f_flags & O_NONBLOCK)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
wait_event_interruptible(dev->wait, (dev->work ||
|
wait_event_interruptible(dev->wait, (dev->work ||
|
||||||
!list_empty(&dev->expired)));
|
!list_empty(list)));
|
||||||
if (signal_pending(current))
|
if (signal_pending(current))
|
||||||
return -ERESTARTSYS;
|
return -ERESTARTSYS;
|
||||||
|
spin_lock_irq(&dev->lock);
|
||||||
}
|
}
|
||||||
if (count < sizeof(int))
|
|
||||||
return -ENOSPC;
|
|
||||||
if (dev->work)
|
if (dev->work)
|
||||||
dev->work = 0;
|
dev->work = 0;
|
||||||
if (!list_empty(&dev->expired)) {
|
if (!list_empty(list)) {
|
||||||
spin_lock_irqsave(&dev->lock, flags);
|
timer = list_first_entry(list, struct mISDNtimer, list);
|
||||||
timer = (struct mISDNtimer *)dev->expired.next;
|
|
||||||
list_del(&timer->list);
|
list_del(&timer->list);
|
||||||
spin_unlock_irqrestore(&dev->lock, flags);
|
spin_unlock_irq(&dev->lock);
|
||||||
if (put_user(timer->id, (int __user *)buf))
|
if (put_user(timer->id, (int __user *)buf))
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
else
|
else
|
||||||
ret = sizeof(int);
|
ret = sizeof(int);
|
||||||
kfree(timer);
|
kfree(timer);
|
||||||
|
} else {
|
||||||
|
spin_unlock_irq(&dev->lock);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +166,8 @@ dev_expire_timer(unsigned long data)
|
||||||
u_long flags;
|
u_long flags;
|
||||||
|
|
||||||
spin_lock_irqsave(&timer->dev->lock, flags);
|
spin_lock_irqsave(&timer->dev->lock, flags);
|
||||||
list_move_tail(&timer->list, &timer->dev->expired);
|
if (timer->id >= 0)
|
||||||
|
list_move_tail(&timer->list, &timer->dev->expired);
|
||||||
spin_unlock_irqrestore(&timer->dev->lock, flags);
|
spin_unlock_irqrestore(&timer->dev->lock, flags);
|
||||||
wake_up_interruptible(&timer->dev->wait);
|
wake_up_interruptible(&timer->dev->wait);
|
||||||
}
|
}
|
||||||
|
@ -162,7 +176,6 @@ static int
|
||||||
misdn_add_timer(struct mISDNtimerdev *dev, int timeout)
|
misdn_add_timer(struct mISDNtimerdev *dev, int timeout)
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
u_long flags;
|
|
||||||
struct mISDNtimer *timer;
|
struct mISDNtimer *timer;
|
||||||
|
|
||||||
if (!timeout) {
|
if (!timeout) {
|
||||||
|
@ -173,19 +186,16 @@ misdn_add_timer(struct mISDNtimerdev *dev, int timeout)
|
||||||
timer = kzalloc(sizeof(struct mISDNtimer), GFP_KERNEL);
|
timer = kzalloc(sizeof(struct mISDNtimer), GFP_KERNEL);
|
||||||
if (!timer)
|
if (!timer)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
spin_lock_irqsave(&dev->lock, flags);
|
timer->dev = dev;
|
||||||
timer->id = dev->next_id++;
|
setup_timer(&timer->tl, dev_expire_timer, (long)timer);
|
||||||
|
spin_lock_irq(&dev->lock);
|
||||||
|
id = timer->id = dev->next_id++;
|
||||||
if (dev->next_id < 0)
|
if (dev->next_id < 0)
|
||||||
dev->next_id = 1;
|
dev->next_id = 1;
|
||||||
list_add_tail(&timer->list, &dev->pending);
|
list_add_tail(&timer->list, &dev->pending);
|
||||||
spin_unlock_irqrestore(&dev->lock, flags);
|
|
||||||
timer->dev = dev;
|
|
||||||
timer->tl.data = (long)timer;
|
|
||||||
timer->tl.function = dev_expire_timer;
|
|
||||||
init_timer(&timer->tl);
|
|
||||||
timer->tl.expires = jiffies + ((HZ * (u_long)timeout) / 1000);
|
timer->tl.expires = jiffies + ((HZ * (u_long)timeout) / 1000);
|
||||||
add_timer(&timer->tl);
|
add_timer(&timer->tl);
|
||||||
id = timer->id;
|
spin_unlock_irq(&dev->lock);
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -193,26 +203,21 @@ misdn_add_timer(struct mISDNtimerdev *dev, int timeout)
|
||||||
static int
|
static int
|
||||||
misdn_del_timer(struct mISDNtimerdev *dev, int id)
|
misdn_del_timer(struct mISDNtimerdev *dev, int id)
|
||||||
{
|
{
|
||||||
u_long flags;
|
|
||||||
struct mISDNtimer *timer;
|
struct mISDNtimer *timer;
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
spin_lock_irqsave(&dev->lock, flags);
|
spin_lock_irq(&dev->lock);
|
||||||
list_for_each_entry(timer, &dev->pending, list) {
|
list_for_each_entry(timer, &dev->pending, list) {
|
||||||
if (timer->id == id) {
|
if (timer->id == id) {
|
||||||
list_del_init(&timer->list);
|
list_del_init(&timer->list);
|
||||||
/* RED-PEN AK: race -- timer can be still running on
|
timer->id = -1;
|
||||||
* other CPU. Needs reference count I think
|
spin_unlock_irq(&dev->lock);
|
||||||
*/
|
del_timer_sync(&timer->tl);
|
||||||
del_timer(&timer->tl);
|
|
||||||
ret = timer->id;
|
|
||||||
kfree(timer);
|
kfree(timer);
|
||||||
goto unlock;
|
return id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unlock:
|
spin_unlock_irq(&dev->lock);
|
||||||
spin_unlock_irqrestore(&dev->lock, flags);
|
return 0;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static long
|
static long
|
||||||
|
@ -262,6 +267,7 @@ mISDN_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations mISDN_fops = {
|
static const struct file_operations mISDN_fops = {
|
||||||
|
.owner = THIS_MODULE,
|
||||||
.read = mISDN_read,
|
.read = mISDN_read,
|
||||||
.poll = mISDN_poll,
|
.poll = mISDN_poll,
|
||||||
.unlocked_ioctl = mISDN_ioctl,
|
.unlocked_ioctl = mISDN_ioctl,
|
||||||
|
|
|
@ -869,7 +869,7 @@ static int pmu_battery_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int pmu_battery_proc_open(struct inode *inode, struct file *file)
|
static int pmu_battery_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, pmu_battery_proc_show, PDE(inode)->data);
|
return single_open(file, pmu_battery_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations pmu_battery_proc_fops = {
|
static const struct file_operations pmu_battery_proc_fops = {
|
||||||
|
|
|
@ -2527,11 +2527,8 @@ static int dvb_frontend_release(struct inode *inode, struct file *file)
|
||||||
|
|
||||||
if (dvbdev->users == -1) {
|
if (dvbdev->users == -1) {
|
||||||
wake_up(&fepriv->wait_queue);
|
wake_up(&fepriv->wait_queue);
|
||||||
if (fepriv->exit != DVB_FE_NO_EXIT) {
|
if (fepriv->exit != DVB_FE_NO_EXIT)
|
||||||
fops_put(file->f_op);
|
|
||||||
file->f_op = NULL;
|
|
||||||
wake_up(&dvbdev->wait_queue);
|
wake_up(&dvbdev->wait_queue);
|
||||||
}
|
|
||||||
if (fe->ops.ts_bus_ctrl)
|
if (fe->ops.ts_bus_ctrl)
|
||||||
fe->ops.ts_bus_ctrl(fe, 0);
|
fe->ops.ts_bus_ctrl(fe, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1479,11 +1479,8 @@ static int dvb_net_close(struct inode *inode, struct file *file)
|
||||||
|
|
||||||
dvb_generic_release(inode, file);
|
dvb_generic_release(inode, file);
|
||||||
|
|
||||||
if(dvbdev->users == 1 && dvbnet->exit == 1) {
|
if(dvbdev->users == 1 && dvbnet->exit == 1)
|
||||||
fops_put(file->f_op);
|
|
||||||
file->f_op = NULL;
|
|
||||||
wake_up(&dvbdev->wait_queue);
|
wake_up(&dvbdev->wait_queue);
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -259,80 +259,47 @@ void cx25821_free_mem_upstream_audio(struct cx25821_dev *dev)
|
||||||
static int cx25821_get_audio_data(struct cx25821_dev *dev,
|
static int cx25821_get_audio_data(struct cx25821_dev *dev,
|
||||||
const struct sram_channel *sram_ch)
|
const struct sram_channel *sram_ch)
|
||||||
{
|
{
|
||||||
struct file *myfile;
|
struct file *file;
|
||||||
int frame_index_temp = dev->_audioframe_index;
|
int frame_index_temp = dev->_audioframe_index;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int line_size = AUDIO_LINE_SIZE;
|
|
||||||
int frame_size = AUDIO_DATA_BUF_SZ;
|
int frame_size = AUDIO_DATA_BUF_SZ;
|
||||||
int frame_offset = frame_size * frame_index_temp;
|
int frame_offset = frame_size * frame_index_temp;
|
||||||
ssize_t vfs_read_retval = 0;
|
char mybuf[AUDIO_LINE_SIZE];
|
||||||
char mybuf[line_size];
|
|
||||||
loff_t file_offset = dev->_audioframe_count * frame_size;
|
loff_t file_offset = dev->_audioframe_count * frame_size;
|
||||||
loff_t pos;
|
char *p = NULL;
|
||||||
mm_segment_t old_fs;
|
|
||||||
|
|
||||||
if (dev->_audiofile_status == END_OF_FILE)
|
if (dev->_audiofile_status == END_OF_FILE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
myfile = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0);
|
file = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0);
|
||||||
|
if (IS_ERR(file)) {
|
||||||
if (IS_ERR(myfile)) {
|
pr_err("%s(): ERROR opening file(%s) with errno = %ld!\n",
|
||||||
const int open_errno = -PTR_ERR(myfile);
|
__func__, dev->_audiofilename, -PTR_ERR(file));
|
||||||
pr_err("%s(): ERROR opening file(%s) with errno = %d!\n",
|
return PTR_ERR(file);
|
||||||
__func__, dev->_audiofilename, open_errno);
|
|
||||||
return PTR_ERR(myfile);
|
|
||||||
} else {
|
|
||||||
if (!(myfile->f_op)) {
|
|
||||||
pr_err("%s(): File has no file operations registered!\n",
|
|
||||||
__func__);
|
|
||||||
filp_close(myfile, NULL);
|
|
||||||
return -EIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!myfile->f_op->read) {
|
|
||||||
pr_err("%s(): File has no READ operations registered!\n",
|
|
||||||
__func__);
|
|
||||||
filp_close(myfile, NULL);
|
|
||||||
return -EIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
pos = myfile->f_pos;
|
|
||||||
old_fs = get_fs();
|
|
||||||
set_fs(KERNEL_DS);
|
|
||||||
|
|
||||||
for (i = 0; i < dev->_audio_lines_count; i++) {
|
|
||||||
pos = file_offset;
|
|
||||||
|
|
||||||
vfs_read_retval = vfs_read(myfile, mybuf, line_size,
|
|
||||||
&pos);
|
|
||||||
|
|
||||||
if (vfs_read_retval > 0 && vfs_read_retval == line_size
|
|
||||||
&& dev->_audiodata_buf_virt_addr != NULL) {
|
|
||||||
memcpy((void *)(dev->_audiodata_buf_virt_addr +
|
|
||||||
frame_offset / 4), mybuf,
|
|
||||||
vfs_read_retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
file_offset += vfs_read_retval;
|
|
||||||
frame_offset += vfs_read_retval;
|
|
||||||
|
|
||||||
if (vfs_read_retval < line_size) {
|
|
||||||
pr_info("Done: exit %s() since no more bytes to read from Audio file\n",
|
|
||||||
__func__);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i > 0)
|
|
||||||
dev->_audioframe_count++;
|
|
||||||
|
|
||||||
dev->_audiofile_status = (vfs_read_retval == line_size) ?
|
|
||||||
IN_PROGRESS : END_OF_FILE;
|
|
||||||
|
|
||||||
set_fs(old_fs);
|
|
||||||
filp_close(myfile, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dev->_audiodata_buf_virt_addr)
|
||||||
|
p = (char *)dev->_audiodata_buf_virt_addr + frame_offset;
|
||||||
|
|
||||||
|
for (i = 0; i < dev->_audio_lines_count; i++) {
|
||||||
|
int n = kernel_read(file, file_offset, mybuf, AUDIO_LINE_SIZE);
|
||||||
|
if (n < AUDIO_LINE_SIZE) {
|
||||||
|
pr_info("Done: exit %s() since no more bytes to read from Audio file\n",
|
||||||
|
__func__);
|
||||||
|
dev->_audiofile_status = END_OF_FILE;
|
||||||
|
fput(file);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
dev->_audiofile_status = IN_PROGRESS;
|
||||||
|
if (p) {
|
||||||
|
memcpy(p, mybuf, n);
|
||||||
|
p += n;
|
||||||
|
}
|
||||||
|
file_offset += n;
|
||||||
|
}
|
||||||
|
dev->_audioframe_count++;
|
||||||
|
fput(file);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,81 +321,41 @@ static void cx25821_audioups_handler(struct work_struct *work)
|
||||||
static int cx25821_openfile_audio(struct cx25821_dev *dev,
|
static int cx25821_openfile_audio(struct cx25821_dev *dev,
|
||||||
const struct sram_channel *sram_ch)
|
const struct sram_channel *sram_ch)
|
||||||
{
|
{
|
||||||
struct file *myfile;
|
char *p = (void *)dev->_audiodata_buf_virt_addr;
|
||||||
int i = 0, j = 0;
|
struct file *file;
|
||||||
int line_size = AUDIO_LINE_SIZE;
|
loff_t offset;
|
||||||
ssize_t vfs_read_retval = 0;
|
int i, j;
|
||||||
char mybuf[line_size];
|
|
||||||
loff_t pos;
|
|
||||||
loff_t offset = (unsigned long)0;
|
|
||||||
mm_segment_t old_fs;
|
|
||||||
|
|
||||||
myfile = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0);
|
file = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0);
|
||||||
|
if (IS_ERR(file)) {
|
||||||
if (IS_ERR(myfile)) {
|
pr_err("%s(): ERROR opening file(%s) with errno = %ld!\n",
|
||||||
const int open_errno = -PTR_ERR(myfile);
|
__func__, dev->_audiofilename, PTR_ERR(file));
|
||||||
pr_err("%s(): ERROR opening file(%s) with errno = %d!\n",
|
return PTR_ERR(file);
|
||||||
__func__, dev->_audiofilename, open_errno);
|
|
||||||
return PTR_ERR(myfile);
|
|
||||||
} else {
|
|
||||||
if (!(myfile->f_op)) {
|
|
||||||
pr_err("%s(): File has no file operations registered!\n",
|
|
||||||
__func__);
|
|
||||||
filp_close(myfile, NULL);
|
|
||||||
return -EIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!myfile->f_op->read) {
|
|
||||||
pr_err("%s(): File has no READ operations registered!\n",
|
|
||||||
__func__);
|
|
||||||
filp_close(myfile, NULL);
|
|
||||||
return -EIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
pos = myfile->f_pos;
|
|
||||||
old_fs = get_fs();
|
|
||||||
set_fs(KERNEL_DS);
|
|
||||||
|
|
||||||
for (j = 0; j < NUM_AUDIO_FRAMES; j++) {
|
|
||||||
for (i = 0; i < dev->_audio_lines_count; i++) {
|
|
||||||
pos = offset;
|
|
||||||
|
|
||||||
vfs_read_retval = vfs_read(myfile, mybuf,
|
|
||||||
line_size, &pos);
|
|
||||||
|
|
||||||
if (vfs_read_retval > 0 &&
|
|
||||||
vfs_read_retval == line_size &&
|
|
||||||
dev->_audiodata_buf_virt_addr != NULL) {
|
|
||||||
memcpy((void *)(dev->
|
|
||||||
_audiodata_buf_virt_addr
|
|
||||||
+ offset / 4), mybuf,
|
|
||||||
vfs_read_retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
offset += vfs_read_retval;
|
|
||||||
|
|
||||||
if (vfs_read_retval < line_size) {
|
|
||||||
pr_info("Done: exit %s() since no more bytes to read from Audio file\n",
|
|
||||||
__func__);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i > 0)
|
|
||||||
dev->_audioframe_count++;
|
|
||||||
|
|
||||||
if (vfs_read_retval < line_size)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
dev->_audiofile_status = (vfs_read_retval == line_size) ?
|
|
||||||
IN_PROGRESS : END_OF_FILE;
|
|
||||||
|
|
||||||
set_fs(old_fs);
|
|
||||||
myfile->f_pos = 0;
|
|
||||||
filp_close(myfile, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (j = 0, offset = 0; j < NUM_AUDIO_FRAMES; j++) {
|
||||||
|
for (i = 0; i < dev->_audio_lines_count; i++) {
|
||||||
|
char buf[AUDIO_LINE_SIZE];
|
||||||
|
int n = kernel_read(file, offset, buf,
|
||||||
|
AUDIO_LINE_SIZE);
|
||||||
|
|
||||||
|
if (n < AUDIO_LINE_SIZE) {
|
||||||
|
pr_info("Done: exit %s() since no more bytes to read from Audio file\n",
|
||||||
|
__func__);
|
||||||
|
dev->_audiofile_status = END_OF_FILE;
|
||||||
|
fput(file);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p)
|
||||||
|
memcpy(p + offset, buf, n);
|
||||||
|
|
||||||
|
offset += n;
|
||||||
|
}
|
||||||
|
dev->_audioframe_count++;
|
||||||
|
}
|
||||||
|
dev->_audiofile_status = IN_PROGRESS;
|
||||||
|
fput(file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -375,7 +375,7 @@ int av7110_ir_init(struct av7110 *av7110)
|
||||||
if (av_cnt == 1) {
|
if (av_cnt == 1) {
|
||||||
e = proc_create("av7110_ir", S_IWUSR, NULL, &av7110_ir_proc_fops);
|
e = proc_create("av7110_ir", S_IWUSR, NULL, &av7110_ir_proc_fops);
|
||||||
if (e)
|
if (e)
|
||||||
e->size = 4 + 256 * sizeof(u16);
|
proc_set_size(e, 4 + 256 * sizeof(u16));
|
||||||
}
|
}
|
||||||
|
|
||||||
tasklet_init(&av7110->ir.ir_tasklet, av7110_emit_key, (unsigned long) &av7110->ir);
|
tasklet_init(&av7110->ir.ir_tasklet, av7110_emit_key, (unsigned long) &av7110->ir);
|
||||||
|
|
|
@ -130,14 +130,14 @@ static int zoran_show(struct seq_file *p, void *v)
|
||||||
|
|
||||||
static int zoran_open(struct inode *inode, struct file *file)
|
static int zoran_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
struct zoran *data = PDE(inode)->data;
|
struct zoran *data = PDE_DATA(inode);
|
||||||
return single_open(file, zoran_show, data);
|
return single_open(file, zoran_show, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t zoran_write(struct file *file, const char __user *buffer,
|
static ssize_t zoran_write(struct file *file, const char __user *buffer,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct zoran *zr = PDE(file_inode(file))->data;
|
struct zoran *zr = PDE_DATA(file_inode(file));
|
||||||
char *string, *sp;
|
char *string, *sp;
|
||||||
char *line, *ldelim, *varname, *svar, *tdelim;
|
char *line, *ldelim, *varname, *svar, *tdelim;
|
||||||
|
|
||||||
|
|
|
@ -307,7 +307,7 @@ static void ir_lirc_close(void *data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct file_operations lirc_fops = {
|
static const struct file_operations lirc_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.write = ir_lirc_transmit_ir,
|
.write = ir_lirc_transmit_ir,
|
||||||
.unlocked_ioctl = ir_lirc_ioctl,
|
.unlocked_ioctl = ir_lirc_ioctl,
|
||||||
|
|
|
@ -152,7 +152,7 @@ static int lirc_thread(void *irctl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct file_operations lirc_dev_fops = {
|
static const struct file_operations lirc_dev_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.read = lirc_dev_fop_read,
|
.read = lirc_dev_fop_read,
|
||||||
.write = lirc_dev_fop_write,
|
.write = lirc_dev_fop_write,
|
||||||
|
|
|
@ -6656,7 +6656,7 @@ static int mpt_summary_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int mpt_summary_proc_open(struct inode *inode, struct file *file)
|
static int mpt_summary_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, mpt_summary_proc_show, PDE(inode)->data);
|
return single_open(file, mpt_summary_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations mpt_summary_proc_fops = {
|
static const struct file_operations mpt_summary_proc_fops = {
|
||||||
|
@ -6805,7 +6805,7 @@ static int mpt_iocinfo_proc_show(struct seq_file *m, void *v)
|
||||||
|
|
||||||
static int mpt_iocinfo_proc_open(struct inode *inode, struct file *file)
|
static int mpt_iocinfo_proc_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, mpt_iocinfo_proc_show, PDE(inode)->data);
|
return single_open(file, mpt_iocinfo_proc_show, PDE_DATA(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct file_operations mpt_iocinfo_proc_fops = {
|
static const struct file_operations mpt_iocinfo_proc_fops = {
|
||||||
|
|
|
@ -596,13 +596,6 @@ mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
mptctl_release(struct inode *inode, struct file *filep)
|
|
||||||
{
|
|
||||||
fasync_helper(-1, filep, 0, &async_queue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mptctl_fasync(int fd, struct file *filep, int mode)
|
mptctl_fasync(int fd, struct file *filep, int mode)
|
||||||
{
|
{
|
||||||
|
@ -2822,7 +2815,6 @@ static const struct file_operations mptctl_fops = {
|
||||||
.llseek = no_llseek,
|
.llseek = no_llseek,
|
||||||
.fasync = mptctl_fasync,
|
.fasync = mptctl_fasync,
|
||||||
.unlocked_ioctl = mptctl_ioctl,
|
.unlocked_ioctl = mptctl_ioctl,
|
||||||
.release = mptctl_release,
|
|
||||||
#ifdef CONFIG_COMPAT
|
#ifdef CONFIG_COMPAT
|
||||||
.compat_ioctl = compat_mpctl_ioctl,
|
.compat_ioctl = compat_mpctl_ioctl,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -109,7 +109,7 @@ static int mptfc_host_reset(struct scsi_cmnd *SCpnt);
|
||||||
static struct scsi_host_template mptfc_driver_template = {
|
static struct scsi_host_template mptfc_driver_template = {
|
||||||
.module = THIS_MODULE,
|
.module = THIS_MODULE,
|
||||||
.proc_name = "mptfc",
|
.proc_name = "mptfc",
|
||||||
.proc_info = mptscsih_proc_info,
|
.show_info = mptscsih_show_info,
|
||||||
.name = "MPT FC Host",
|
.name = "MPT FC Host",
|
||||||
.info = mptscsih_info,
|
.info = mptscsih_info,
|
||||||
.queuecommand = mptfc_qcmd,
|
.queuecommand = mptfc_qcmd,
|
||||||
|
|
|
@ -1977,7 +1977,7 @@ static enum blk_eh_timer_return mptsas_eh_timed_out(struct scsi_cmnd *sc)
|
||||||
static struct scsi_host_template mptsas_driver_template = {
|
static struct scsi_host_template mptsas_driver_template = {
|
||||||
.module = THIS_MODULE,
|
.module = THIS_MODULE,
|
||||||
.proc_name = "mptsas",
|
.proc_name = "mptsas",
|
||||||
.proc_info = mptscsih_proc_info,
|
.show_info = mptscsih_show_info,
|
||||||
.name = "MPT SAS Host",
|
.name = "MPT SAS Host",
|
||||||
.info = mptscsih_info,
|
.info = mptscsih_info,
|
||||||
.queuecommand = mptsas_qcmd,
|
.queuecommand = mptsas_qcmd,
|
||||||
|
|
|
@ -1284,101 +1284,17 @@ mptscsih_info(struct Scsi_Host *SChost)
|
||||||
return h->info_kbuf;
|
return h->info_kbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct info_str {
|
int mptscsih_show_info(struct seq_file *m, struct Scsi_Host *host)
|
||||||
char *buffer;
|
|
||||||
int length;
|
|
||||||
int offset;
|
|
||||||
int pos;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
mptscsih_copy_mem_info(struct info_str *info, char *data, int len)
|
|
||||||
{
|
|
||||||
if (info->pos + len > info->length)
|
|
||||||
len = info->length - info->pos;
|
|
||||||
|
|
||||||
if (info->pos + len < info->offset) {
|
|
||||||
info->pos += len;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info->pos < info->offset) {
|
|
||||||
data += (info->offset - info->pos);
|
|
||||||
len -= (info->offset - info->pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (len > 0) {
|
|
||||||
memcpy(info->buffer + info->pos, data, len);
|
|
||||||
info->pos += len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
mptscsih_copy_info(struct info_str *info, char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
char buf[81];
|
|
||||||
int len;
|
|
||||||
|
|
||||||
va_start(args, fmt);
|
|
||||||
len = vsprintf(buf, fmt, args);
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
mptscsih_copy_mem_info(info, buf, len);
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
mptscsih_host_info(MPT_ADAPTER *ioc, char *pbuf, off_t offset, int len)
|
|
||||||
{
|
|
||||||
struct info_str info;
|
|
||||||
|
|
||||||
info.buffer = pbuf;
|
|
||||||
info.length = len;
|
|
||||||
info.offset = offset;
|
|
||||||
info.pos = 0;
|
|
||||||
|
|
||||||
mptscsih_copy_info(&info, "%s: %s, ", ioc->name, ioc->prod_name);
|
|
||||||
mptscsih_copy_info(&info, "%s%08xh, ", MPT_FW_REV_MAGIC_ID_STRING, ioc->facts.FWVersion.Word);
|
|
||||||
mptscsih_copy_info(&info, "Ports=%d, ", ioc->facts.NumberOfPorts);
|
|
||||||
mptscsih_copy_info(&info, "MaxQ=%d\n", ioc->req_depth);
|
|
||||||
|
|
||||||
return ((info.pos > info.offset) ? info.pos - info.offset : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
|
|
||||||
/**
|
|
||||||
* mptscsih_proc_info - Return information about MPT adapter
|
|
||||||
* @host: scsi host struct
|
|
||||||
* @buffer: if write, user data; if read, buffer for user
|
|
||||||
* @start: returns the buffer address
|
|
||||||
* @offset: if write, 0; if read, the current offset into the buffer from
|
|
||||||
* the previous read.
|
|
||||||
* @length: if write, return length;
|
|
||||||
* @func: write = 1; read = 0
|
|
||||||
*
|
|
||||||
* (linux scsi_host_template.info routine)
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset,
|
|
||||||
int length, int func)
|
|
||||||
{
|
{
|
||||||
MPT_SCSI_HOST *hd = shost_priv(host);
|
MPT_SCSI_HOST *hd = shost_priv(host);
|
||||||
MPT_ADAPTER *ioc = hd->ioc;
|
MPT_ADAPTER *ioc = hd->ioc;
|
||||||
int size = 0;
|
|
||||||
|
|
||||||
if (func) {
|
seq_printf(m, "%s: %s, ", ioc->name, ioc->prod_name);
|
||||||
/*
|
seq_printf(m, "%s%08xh, ", MPT_FW_REV_MAGIC_ID_STRING, ioc->facts.FWVersion.Word);
|
||||||
* write is not supported
|
seq_printf(m, "Ports=%d, ", ioc->facts.NumberOfPorts);
|
||||||
*/
|
seq_printf(m, "MaxQ=%d\n", ioc->req_depth);
|
||||||
} else {
|
|
||||||
if (start)
|
|
||||||
*start = buffer;
|
|
||||||
|
|
||||||
size = mptscsih_host_info(ioc, buffer, offset, length);
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
return size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
|
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
|
||||||
|
@ -3348,7 +3264,7 @@ EXPORT_SYMBOL(mptscsih_shutdown);
|
||||||
EXPORT_SYMBOL(mptscsih_suspend);
|
EXPORT_SYMBOL(mptscsih_suspend);
|
||||||
EXPORT_SYMBOL(mptscsih_resume);
|
EXPORT_SYMBOL(mptscsih_resume);
|
||||||
#endif
|
#endif
|
||||||
EXPORT_SYMBOL(mptscsih_proc_info);
|
EXPORT_SYMBOL(mptscsih_show_info);
|
||||||
EXPORT_SYMBOL(mptscsih_info);
|
EXPORT_SYMBOL(mptscsih_info);
|
||||||
EXPORT_SYMBOL(mptscsih_qcmd);
|
EXPORT_SYMBOL(mptscsih_qcmd);
|
||||||
EXPORT_SYMBOL(mptscsih_slave_destroy);
|
EXPORT_SYMBOL(mptscsih_slave_destroy);
|
||||||
|
|
|
@ -111,7 +111,7 @@ extern void mptscsih_shutdown(struct pci_dev *);
|
||||||
extern int mptscsih_suspend(struct pci_dev *pdev, pm_message_t state);
|
extern int mptscsih_suspend(struct pci_dev *pdev, pm_message_t state);
|
||||||
extern int mptscsih_resume(struct pci_dev *pdev);
|
extern int mptscsih_resume(struct pci_dev *pdev);
|
||||||
#endif
|
#endif
|
||||||
extern int mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int func);
|
extern int mptscsih_show_info(struct seq_file *, struct Scsi_Host *);
|
||||||
extern const char * mptscsih_info(struct Scsi_Host *SChost);
|
extern const char * mptscsih_info(struct Scsi_Host *SChost);
|
||||||
extern int mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *));
|
extern int mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *));
|
||||||
extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel,
|
extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel,
|
||||||
|
|
|
@ -831,7 +831,7 @@ static void mptspi_slave_destroy(struct scsi_device *sdev)
|
||||||
static struct scsi_host_template mptspi_driver_template = {
|
static struct scsi_host_template mptspi_driver_template = {
|
||||||
.module = THIS_MODULE,
|
.module = THIS_MODULE,
|
||||||
.proc_name = "mptspi",
|
.proc_name = "mptspi",
|
||||||
.proc_info = mptscsih_proc_info,
|
.show_info = mptscsih_show_info,
|
||||||
.name = "MPT SPI Host",
|
.name = "MPT SPI Host",
|
||||||
.info = mptscsih_info,
|
.info = mptscsih_info,
|
||||||
.queuecommand = mptspi_qcmd,
|
.queuecommand = mptspi_qcmd,
|
||||||
|
|
|
@ -1599,98 +1599,98 @@ static int i2o_seq_show_sensors(struct seq_file *seq, void *v)
|
||||||
|
|
||||||
static int i2o_seq_open_hrt(struct inode *inode, struct file *file)
|
static int i2o_seq_open_hrt(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_hrt, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_hrt, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_lct(struct inode *inode, struct file *file)
|
static int i2o_seq_open_lct(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_lct, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_lct, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_status(struct inode *inode, struct file *file)
|
static int i2o_seq_open_status(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_status, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_status, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_hw(struct inode *inode, struct file *file)
|
static int i2o_seq_open_hw(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_hw, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_hw, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_ddm_table(struct inode *inode, struct file *file)
|
static int i2o_seq_open_ddm_table(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_ddm_table, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_ddm_table, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_driver_store(struct inode *inode, struct file *file)
|
static int i2o_seq_open_driver_store(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_driver_store, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_driver_store, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_drivers_stored(struct inode *inode, struct file *file)
|
static int i2o_seq_open_drivers_stored(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_drivers_stored, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_drivers_stored, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_groups(struct inode *inode, struct file *file)
|
static int i2o_seq_open_groups(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_groups, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_groups, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_phys_device(struct inode *inode, struct file *file)
|
static int i2o_seq_open_phys_device(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_phys_device, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_phys_device, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_claimed(struct inode *inode, struct file *file)
|
static int i2o_seq_open_claimed(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_claimed, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_claimed, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_users(struct inode *inode, struct file *file)
|
static int i2o_seq_open_users(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_users, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_users, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_priv_msgs(struct inode *inode, struct file *file)
|
static int i2o_seq_open_priv_msgs(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_priv_msgs, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_priv_msgs, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_authorized_users(struct inode *inode, struct file *file)
|
static int i2o_seq_open_authorized_users(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_authorized_users,
|
return single_open(file, i2o_seq_show_authorized_users,
|
||||||
PDE(inode)->data);
|
PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_dev_identity(struct inode *inode, struct file *file)
|
static int i2o_seq_open_dev_identity(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_dev_identity, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_dev_identity, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_ddm_identity(struct inode *inode, struct file *file)
|
static int i2o_seq_open_ddm_identity(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_ddm_identity, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_ddm_identity, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_uinfo(struct inode *inode, struct file *file)
|
static int i2o_seq_open_uinfo(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_uinfo, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_uinfo, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_sgl_limits(struct inode *inode, struct file *file)
|
static int i2o_seq_open_sgl_limits(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_sgl_limits, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_sgl_limits, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_sensors(struct inode *inode, struct file *file)
|
static int i2o_seq_open_sensors(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_sensors, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_sensors, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2o_seq_open_dev_name(struct inode *inode, struct file *file)
|
static int i2o_seq_open_dev_name(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return single_open(file, i2o_seq_show_dev_name, PDE(inode)->data);
|
return single_open(file, i2o_seq_show_dev_name, PDE_DATA(inode));
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct file_operations i2o_seq_fops_lct = {
|
static const struct file_operations i2o_seq_fops_lct = {
|
||||||
|
@ -1894,25 +1894,6 @@ static int i2o_proc_create_entries(struct proc_dir_entry *dir,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* i2o_proc_subdir_remove - Remove child entries from a proc entry
|
|
||||||
* @dir: proc dir entry from which the childs should be removed
|
|
||||||
*
|
|
||||||
* Iterate over each i2o proc entry under dir and remove it. If the child
|
|
||||||
* also has entries, remove them too.
|
|
||||||
*/
|
|
||||||
static void i2o_proc_subdir_remove(struct proc_dir_entry *dir)
|
|
||||||
{
|
|
||||||
struct proc_dir_entry *pe, *tmp;
|
|
||||||
pe = dir->subdir;
|
|
||||||
while (pe) {
|
|
||||||
tmp = pe->next;
|
|
||||||
i2o_proc_subdir_remove(pe);
|
|
||||||
remove_proc_entry(pe->name, dir);
|
|
||||||
pe = tmp;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* i2o_proc_device_add - Add an I2O device to the proc dir
|
* i2o_proc_device_add - Add an I2O device to the proc dir
|
||||||
* @dir: proc dir entry to which the device should be added
|
* @dir: proc dir entry to which the device should be added
|
||||||
|
@ -1932,14 +1913,12 @@ static void i2o_proc_device_add(struct proc_dir_entry *dir,
|
||||||
|
|
||||||
osm_debug("adding device /proc/i2o/%s/%s\n", dev->iop->name, buff);
|
osm_debug("adding device /proc/i2o/%s/%s\n", dev->iop->name, buff);
|
||||||
|
|
||||||
devdir = proc_mkdir(buff, dir);
|
devdir = proc_mkdir_data(buff, 0, dir, dev);
|
||||||
if (!devdir) {
|
if (!devdir) {
|
||||||
osm_warn("Could not allocate procdir!\n");
|
osm_warn("Could not allocate procdir!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
devdir->data = dev;
|
|
||||||
|
|
||||||
i2o_proc_create_entries(devdir, generic_dev_entries, dev);
|
i2o_proc_create_entries(devdir, generic_dev_entries, dev);
|
||||||
|
|
||||||
/* Inform core that we want updates about this device's status */
|
/* Inform core that we want updates about this device's status */
|
||||||
|
@ -1973,12 +1952,10 @@ static int i2o_proc_iop_add(struct proc_dir_entry *dir,
|
||||||
|
|
||||||
osm_debug("adding IOP /proc/i2o/%s\n", c->name);
|
osm_debug("adding IOP /proc/i2o/%s\n", c->name);
|
||||||
|
|
||||||
iopdir = proc_mkdir(c->name, dir);
|
iopdir = proc_mkdir_data(c->name, 0, dir, c);
|
||||||
if (!iopdir)
|
if (!iopdir)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
iopdir->data = c;
|
|
||||||
|
|
||||||
i2o_proc_create_entries(iopdir, i2o_proc_generic_iop_entries, c);
|
i2o_proc_create_entries(iopdir, i2o_proc_generic_iop_entries, c);
|
||||||
|
|
||||||
list_for_each_entry(dev, &c->devices, list)
|
list_for_each_entry(dev, &c->devices, list)
|
||||||
|
@ -1987,31 +1964,6 @@ static int i2o_proc_iop_add(struct proc_dir_entry *dir,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* i2o_proc_iop_remove - Removes an I2O controller from the i2o proc tree
|
|
||||||
* @dir: parent proc dir entry
|
|
||||||
* @c: I2O controller which should be removed
|
|
||||||
*
|
|
||||||
* Iterate over each i2o proc entry and search controller c. If it is found
|
|
||||||
* remove it from the tree.
|
|
||||||
*/
|
|
||||||
static void i2o_proc_iop_remove(struct proc_dir_entry *dir,
|
|
||||||
struct i2o_controller *c)
|
|
||||||
{
|
|
||||||
struct proc_dir_entry *pe, *tmp;
|
|
||||||
|
|
||||||
pe = dir->subdir;
|
|
||||||
while (pe) {
|
|
||||||
tmp = pe->next;
|
|
||||||
if (pe->data == c) {
|
|
||||||
i2o_proc_subdir_remove(pe);
|
|
||||||
remove_proc_entry(pe->name, dir);
|
|
||||||
}
|
|
||||||
osm_debug("removing IOP /proc/i2o/%s\n", c->name);
|
|
||||||
pe = tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* i2o_proc_fs_create - Create the i2o proc fs.
|
* i2o_proc_fs_create - Create the i2o proc fs.
|
||||||
*
|
*
|
||||||
|
@ -2042,12 +1994,7 @@ static int __init i2o_proc_fs_create(void)
|
||||||
*/
|
*/
|
||||||
static int __exit i2o_proc_fs_destroy(void)
|
static int __exit i2o_proc_fs_destroy(void)
|
||||||
{
|
{
|
||||||
struct i2o_controller *c;
|
remove_proc_subtree("i2o", NULL);
|
||||||
|
|
||||||
list_for_each_entry(c, &i2o_controllers, list)
|
|
||||||
i2o_proc_iop_remove(i2o_proc_dir_root, c);
|
|
||||||
|
|
||||||
remove_proc_entry("i2o", NULL);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -593,7 +593,6 @@ static int lis3lv02d_misc_release(struct inode *inode, struct file *file)
|
||||||
struct lis3lv02d *lis3 = container_of(file->private_data,
|
struct lis3lv02d *lis3 = container_of(file->private_data,
|
||||||
struct lis3lv02d, miscdev);
|
struct lis3lv02d, miscdev);
|
||||||
|
|
||||||
fasync_helper(-1, file, 0, &lis3->async_queue);
|
|
||||||
clear_bit(0, &lis3->misc_opened); /* release the device */
|
clear_bit(0, &lis3->misc_opened); /* release the device */
|
||||||
if (lis3->pm_dev)
|
if (lis3->pm_dev)
|
||||||
pm_runtime_put(lis3->pm_dev);
|
pm_runtime_put(lis3->pm_dev);
|
||||||
|
|
|
@ -355,7 +355,7 @@ static void delete_proc_files(void)
|
||||||
for (p = proc_files; p->name; p++)
|
for (p = proc_files; p->name; p++)
|
||||||
if (p->entry)
|
if (p->entry)
|
||||||
remove_proc_entry(p->name, proc_gru);
|
remove_proc_entry(p->name, proc_gru);
|
||||||
remove_proc_entry("gru", proc_gru->parent);
|
proc_remove(proc_gru);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <linux/idr.h>
|
#include <linux/idr.h>
|
||||||
#include <linux/backing-dev.h>
|
#include <linux/backing-dev.h>
|
||||||
#include <linux/gfp.h>
|
#include <linux/gfp.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
|
|
||||||
#include <linux/mtd/mtd.h>
|
#include <linux/mtd/mtd.h>
|
||||||
#include <linux/mtd/partitions.h>
|
#include <linux/mtd/partitions.h>
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue