aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/iseries
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2005-09-27 12:24:05 -0400
committerStephen Rothwell <sfr@canb.auug.org.au>2005-09-27 12:24:05 -0400
commitcb5c7980ab16c461a883ec7899675be57798d285 (patch)
treeb84622d3d61b8e947062c03393822e24ad7f3f1b /arch/powerpc/platforms/iseries
parent544cbbaed4de962fb0e831e8799ab01c448ff37d (diff)
powerpc: move iSeries_proc.c to powerpc/platforms/iseries
And renamed it to proc.c Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Diffstat (limited to 'arch/powerpc/platforms/iseries')
-rw-r--r--arch/powerpc/platforms/iseries/Makefile3
-rw-r--r--arch/powerpc/platforms/iseries/proc.c115
2 files changed, 117 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/iseries/Makefile b/arch/powerpc/platforms/iseries/Makefile
index 3a9981a35e2a..0bd671573c87 100644
--- a/arch/powerpc/platforms/iseries/Makefile
+++ b/arch/powerpc/platforms/iseries/Makefile
@@ -1 +1,2 @@
1obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o mf.o lpevents.o hvcall.o 1obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o mf.o lpevents.o \
2 hvcall.o proc.o
diff --git a/arch/powerpc/platforms/iseries/proc.c b/arch/powerpc/platforms/iseries/proc.c
new file mode 100644
index 000000000000..d46b473ce4dd
--- /dev/null
+++ b/arch/powerpc/platforms/iseries/proc.c
@@ -0,0 +1,115 @@
1/*
2 * Copyright (C) 2001 Kyle A. Lucke IBM Corporation
3 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen IBM Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#include <linux/init.h>
20#include <linux/proc_fs.h>
21#include <linux/seq_file.h>
22#include <linux/param.h> /* for HZ */
23#include <asm/paca.h>
24#include <asm/processor.h>
25#include <asm/time.h>
26#include <asm/lppaca.h>
27#include <asm/iSeries/ItLpQueue.h>
28#include <asm/iSeries/HvCallXm.h>
29#include <asm/iSeries/IoHriMainStore.h>
30#include <asm/iSeries/IoHriProcessorVpd.h>
31
32static int __init iseries_proc_create(void)
33{
34 struct proc_dir_entry *e = proc_mkdir("iSeries", 0);
35 if (!e)
36 return 1;
37
38 return 0;
39}
40core_initcall(iseries_proc_create);
41
42static unsigned long startTitan = 0;
43static unsigned long startTb = 0;
44
45static int proc_titantod_show(struct seq_file *m, void *v)
46{
47 unsigned long tb0, titan_tod;
48
49 tb0 = get_tb();
50 titan_tod = HvCallXm_loadTod();
51
52 seq_printf(m, "Titan\n" );
53 seq_printf(m, " time base = %016lx\n", tb0);
54 seq_printf(m, " titan tod = %016lx\n", titan_tod);
55 seq_printf(m, " xProcFreq = %016x\n",
56 xIoHriProcessorVpd[0].xProcFreq);
57 seq_printf(m, " xTimeBaseFreq = %016x\n",
58 xIoHriProcessorVpd[0].xTimeBaseFreq);
59 seq_printf(m, " tb_ticks_per_jiffy = %lu\n", tb_ticks_per_jiffy);
60 seq_printf(m, " tb_ticks_per_usec = %lu\n", tb_ticks_per_usec);
61
62 if (!startTitan) {
63 startTitan = titan_tod;
64 startTb = tb0;
65 } else {
66 unsigned long titan_usec = (titan_tod - startTitan) >> 12;
67 unsigned long tb_ticks = (tb0 - startTb);
68 unsigned long titan_jiffies = titan_usec / (1000000/HZ);
69 unsigned long titan_jiff_usec = titan_jiffies * (1000000/HZ);
70 unsigned long titan_jiff_rem_usec =
71 titan_usec - titan_jiff_usec;
72 unsigned long tb_jiffies = tb_ticks / tb_ticks_per_jiffy;
73 unsigned long tb_jiff_ticks = tb_jiffies * tb_ticks_per_jiffy;
74 unsigned long tb_jiff_rem_ticks = tb_ticks - tb_jiff_ticks;
75 unsigned long tb_jiff_rem_usec =
76 tb_jiff_rem_ticks / tb_ticks_per_usec;
77 unsigned long new_tb_ticks_per_jiffy =
78 (tb_ticks * (1000000/HZ))/titan_usec;
79
80 seq_printf(m, " titan elapsed = %lu uSec\n", titan_usec);
81 seq_printf(m, " tb elapsed = %lu ticks\n", tb_ticks);
82 seq_printf(m, " titan jiffies = %lu.%04lu \n", titan_jiffies,
83 titan_jiff_rem_usec);
84 seq_printf(m, " tb jiffies = %lu.%04lu\n", tb_jiffies,
85 tb_jiff_rem_usec);
86 seq_printf(m, " new tb_ticks_per_jiffy = %lu\n",
87 new_tb_ticks_per_jiffy);
88 }
89
90 return 0;
91}
92
93static int proc_titantod_open(struct inode *inode, struct file *file)
94{
95 return single_open(file, proc_titantod_show, NULL);
96}
97
98static struct file_operations proc_titantod_operations = {
99 .open = proc_titantod_open,
100 .read = seq_read,
101 .llseek = seq_lseek,
102 .release = single_release,
103};
104
105static int __init iseries_proc_init(void)
106{
107 struct proc_dir_entry *e;
108
109 e = create_proc_entry("iSeries/titanTod", S_IFREG|S_IRUGO, NULL);
110 if (e)
111 e->proc_fops = &proc_titantod_operations;
112
113 return 0;
114}
115__initcall(iseries_proc_init);