forked from luck/tmp_suning_uos_patched
mips: Don't use create_proc_read_entry()
Don't use create_proc_read_entry() as that is deprecated, but rather use proc_create_data() and seq_file instead. Signed-off-by: David Howells <dhowells@redhat.com> cc: Ralf Baechle <ralf@linux-mips.org> cc: linux-mips@linux-mips.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
28ff11882a
commit
24270156ac
|
@ -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);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user