Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
arch
tile
kernel
proc.c
Go to the documentation of this file.
1
/*
2
* Copyright 2010 Tilera Corporation. All Rights Reserved.
3
*
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation, version 2.
7
*
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11
* NON INFRINGEMENT. See the GNU General Public License for
12
* more details.
13
*/
14
15
#include <
linux/smp.h
>
16
#include <
linux/seq_file.h
>
17
#include <
linux/threads.h
>
18
#include <
linux/cpumask.h
>
19
#include <linux/timex.h>
20
#include <
linux/delay.h
>
21
#include <linux/fs.h>
22
#include <
linux/proc_fs.h
>
23
#include <linux/sysctl.h>
24
#include <
linux/hardirq.h
>
25
#include <
linux/hugetlb.h
>
26
#include <linux/mman.h>
27
#include <asm/unaligned.h>
28
#include <asm/pgtable.h>
29
#include <asm/processor.h>
30
#include <asm/sections.h>
31
#include <
asm/homecache.h
>
32
#include <asm/hardwall.h>
33
#include <
arch/chip.h
>
34
35
36
/*
37
* Support /proc/cpuinfo
38
*/
39
40
#define cpu_to_ptr(n) ((void *)((long)(n)+1))
41
#define ptr_to_cpu(p) ((long)(p) - 1)
42
43
static
int
show_cpuinfo
(
struct
seq_file
*
m
,
void
*
v
)
44
{
45
int
n
=
ptr_to_cpu
(v);
46
47
if
(n == 0) {
48
char
buf
[
NR_CPUS
*5];
49
cpulist_scnprintf(buf,
sizeof
(buf),
cpu_online_mask
);
50
seq_printf
(m,
"cpu count\t: %d\n"
,
num_online_cpus
());
51
seq_printf
(m,
"cpu list\t: %s\n"
, buf);
52
seq_printf
(m,
"model name\t: %s\n"
,
chip_model
);
53
seq_printf
(m,
"flags\t\t:\n"
);
/* nothing for now */
54
seq_printf
(m,
"cpu MHz\t\t: %llu.%06llu\n"
,
55
get_clock_rate
() / 1000000,
56
(
get_clock_rate
() % 1000000));
57
seq_printf
(m,
"bogomips\t: %lu.%02lu\n\n"
,
58
loops_per_jiffy
/(500000/
HZ
),
59
(
loops_per_jiffy
/(5000/
HZ
)) % 100);
60
}
61
62
#ifdef CONFIG_SMP
63
if
(!
cpu_online
(n))
64
return
0;
65
#endif
66
67
seq_printf
(m,
"processor\t: %d\n"
, n);
68
69
/* Print only num_online_cpus() blank lines total. */
70
if
(cpumask_next(n,
cpu_online_mask
) <
nr_cpu_ids
)
71
seq_printf
(m,
"\n"
);
72
73
return
0;
74
}
75
76
static
void
*
c_start
(
struct
seq_file
*
m
, loff_t *
pos
)
77
{
78
return
*pos <
nr_cpu_ids
?
cpu_to_ptr
(*pos) :
NULL
;
79
}
80
static
void
*c_next(
struct
seq_file
*m,
void
*
v
, loff_t *pos)
81
{
82
++*
pos
;
83
return
c_start
(m, pos);
84
}
85
static
void
c_stop(
struct
seq_file
*m,
void
*
v
)
86
{
87
}
88
const
struct
seq_operations
cpuinfo_op
= {
89
.start =
c_start
,
90
.next = c_next,
91
.stop = c_stop,
92
.show =
show_cpuinfo
,
93
};
94
95
/*
96
* Support /proc/tile directory
97
*/
98
99
static
int
__init
proc_tile_init(
void
)
100
{
101
struct
proc_dir_entry
*
root
=
proc_mkdir
(
"tile"
,
NULL
);
102
if
(root ==
NULL
)
103
return
0;
104
105
proc_tile_hardwall_init
(root);
106
107
return
0;
108
}
109
110
arch_initcall
(proc_tile_init);
111
112
/*
113
* Support /proc/sys/tile directory
114
*/
115
116
#ifndef __tilegx__
/* FIXME: GX: no support for unaligned access yet */
117
static
ctl_table
unaligned_subtable[] = {
118
{
119
.
procname
=
"enabled"
,
120
.data = &
unaligned_fixup
,
121
.maxlen =
sizeof
(
int
),
122
.
mode
= 0644,
123
.
proc_handler
= &
proc_dointvec
124
},
125
{
126
.procname =
"printk"
,
127
.data = &
unaligned_printk
,
128
.maxlen =
sizeof
(
int
),
129
.
mode
= 0644,
130
.
proc_handler
= &
proc_dointvec
131
},
132
{
133
.procname =
"count"
,
134
.data = &
unaligned_fixup_count
,
135
.maxlen =
sizeof
(
int
),
136
.
mode
= 0644,
137
.
proc_handler
= &
proc_dointvec
138
},
139
{}
140
};
141
142
static
ctl_table
unaligned_table[] = {
143
{
144
.
procname
=
"unaligned_fixup"
,
145
.mode = 0555,
146
.child = unaligned_subtable
147
},
148
{}
149
};
150
151
static
struct
ctl_path
tile_path[] = {
152
{ .procname =
"tile"
},
153
{ }
154
};
155
156
static
int
__init
proc_sys_tile_init(
void
)
157
{
158
register_sysctl_paths
(tile_path, unaligned_table);
159
return
0;
160
}
161
162
arch_initcall
(proc_sys_tile_init);
163
#endif
Generated on Thu Jan 10 2013 13:11:15 for Linux Kernel by
1.8.2