aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-10-25 23:20:03 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-25 23:20:03 -0400
commit8483ca3c99559027a3741af7f56f6b36887f7fd5 (patch)
tree4c09e045467c4dd174508ffd9b55a857ee139869 /include
parentede847c406054ba2a1ef2d165d3fd9f8e2b8d1bc (diff)
parent190a24f5605d95b786c92280bf7a51ebef43f29f (diff)
Merge branch 'merge' of master.kernel.org:/pub/scm/linux/kernel/git/paulus/powerpc
* 'merge' of master.kernel.org:/pub/scm/linux/kernel/git/paulus/powerpc: [POWERPC] Make sure __cpu_preinit_ppc970 gets called on 970GX processors [POWERPC] Fix CHRP platforms with only 8259 [POWERPC] IPIC: Fix spinlock recursion in set_irq_handler [POWERPC] Fix the UCC rx/tx clock of QE [POWERPC] cell: update defconfig [POWERPC] spufs: fix another off-by-one bug in spufs_mbox_read [POWERPC] spufs: fix signal2 file to report signal2 [POWERPC] Fix device_is_compatible() const warning [POWERPC] Cell timebase bug workaround [POWERPC] Support feature fixups in modules [POWERPC] Support feature fixups in vdso's [POWERPC] Support nested cpu feature sections [POWERPC] Consolidate feature fixup code [POWERPC] Fix hang in start_ldr if _end or _edata is unaligned [POWERPC] Fix spelling errors in ucc_fast.c and ucc_slow.c [POWERPC] Don't require execute perms on wrapper when building zImage.initrd [POWERPC] Add 970GX cputable entry [POWERPC] Fix build breakage with CONFIG_PPC32 [POWERPC] Fix compiler warning message on get_property call [POWERPC] Simplify stolen time calculation
Diffstat (limited to 'include')
-rw-r--r--include/asm-powerpc/asm-compat.h52
-rw-r--r--include/asm-powerpc/cputable.h37
-rw-r--r--include/asm-powerpc/firmware.h17
-rw-r--r--include/asm-powerpc/i8259.h1
-rw-r--r--include/asm-powerpc/ppc_asm.h18
-rw-r--r--include/asm-powerpc/prom.h10
-rw-r--r--include/asm-powerpc/reg.h26
-rw-r--r--include/asm-powerpc/time.h27
-rw-r--r--include/asm-powerpc/timex.h20
9 files changed, 144 insertions, 64 deletions
diff --git a/include/asm-powerpc/asm-compat.h b/include/asm-powerpc/asm-compat.h
index 8e64be0cc47d..c89bd58ee283 100644
--- a/include/asm-powerpc/asm-compat.h
+++ b/include/asm-powerpc/asm-compat.h
@@ -14,6 +14,58 @@
14# define ASM_CONST(x) __ASM_CONST(x) 14# define ASM_CONST(x) __ASM_CONST(x)
15#endif 15#endif
16 16
17
18/*
19 * Feature section common macros
20 *
21 * Note that the entries now contain offsets between the table entry
22 * and the code rather than absolute code pointers in order to be
23 * useable with the vdso shared library. There is also an assumption
24 * that values will be negative, that is, the fixup table has to be
25 * located after the code it fixes up.
26 */
27#ifdef CONFIG_PPC64
28#ifdef __powerpc64__
29/* 64 bits kernel, 64 bits code */
30#define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \
3199: \
32 .section sect,"a"; \
33 .align 3; \
3498: \
35 .llong msk; \
36 .llong val; \
37 .llong label##b-98b; \
38 .llong 99b-98b; \
39 .previous
40#else /* __powerpc64__ */
41/* 64 bits kernel, 32 bits code (ie. vdso32) */
42#define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \
4399: \
44 .section sect,"a"; \
45 .align 3; \
4698: \
47 .llong msk; \
48 .llong val; \
49 .long 0xffffffff; \
50 .long label##b-98b; \
51 .long 0xffffffff; \
52 .long 99b-98b; \
53 .previous
54#endif /* !__powerpc64__ */
55#else /* CONFIG_PPC64 */
56/* 32 bits kernel, 32 bits code */
57#define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \
5899: \
59 .section sect,"a"; \
60 .align 2; \
6198: \
62 .long msk; \
63 .long val; \
64 .long label##b-98b; \
65 .long 99b-98b; \
66 .previous
67#endif /* !CONFIG_PPC64 */
68
17#ifdef __powerpc64__ 69#ifdef __powerpc64__
18 70
19/* operations for longs and pointers */ 71/* operations for longs and pointers */
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index 12707ab9dc98..a9a40149a7c0 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -89,8 +89,11 @@ struct cpu_spec {
89 89
90extern struct cpu_spec *cur_cpu_spec; 90extern struct cpu_spec *cur_cpu_spec;
91 91
92extern void identify_cpu(unsigned long offset, unsigned long cpu); 92extern unsigned int __start___ftr_fixup, __stop___ftr_fixup;
93extern void do_cpu_ftr_fixups(unsigned long offset); 93
94extern struct cpu_spec *identify_cpu(unsigned long offset);
95extern void do_feature_fixups(unsigned long value, void *fixup_start,
96 void *fixup_end);
94 97
95#endif /* __ASSEMBLY__ */ 98#endif /* __ASSEMBLY__ */
96 99
@@ -144,6 +147,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
144#define CPU_FTR_CI_LARGE_PAGE LONG_ASM_CONST(0x0000100000000000) 147#define CPU_FTR_CI_LARGE_PAGE LONG_ASM_CONST(0x0000100000000000)
145#define CPU_FTR_PAUSE_ZERO LONG_ASM_CONST(0x0000200000000000) 148#define CPU_FTR_PAUSE_ZERO LONG_ASM_CONST(0x0000200000000000)
146#define CPU_FTR_PURR LONG_ASM_CONST(0x0000400000000000) 149#define CPU_FTR_PURR LONG_ASM_CONST(0x0000400000000000)
150#define CPU_FTR_CELL_TB_BUG LONG_ASM_CONST(0x0000800000000000)
147 151
148#ifndef __ASSEMBLY__ 152#ifndef __ASSEMBLY__
149 153
@@ -332,7 +336,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
332#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 336#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
333 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 337 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
334 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 338 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
335 CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE) 339 CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_CELL_TB_BUG)
336#define CPU_FTRS_PA6T (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 340#define CPU_FTRS_PA6T (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
337 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 341 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
338 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \ 342 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \
@@ -431,29 +435,12 @@ static inline int cpu_has_feature(unsigned long feature)
431 435
432#ifdef __ASSEMBLY__ 436#ifdef __ASSEMBLY__
433 437
434#define BEGIN_FTR_SECTION 98: 438#define BEGIN_FTR_SECTION_NESTED(label) label:
435 439#define BEGIN_FTR_SECTION BEGIN_FTR_SECTION_NESTED(97)
436#ifndef __powerpc64__ 440#define END_FTR_SECTION_NESTED(msk, val, label) \
441 MAKE_FTR_SECTION_ENTRY(msk, val, label, __ftr_fixup)
437#define END_FTR_SECTION(msk, val) \ 442#define END_FTR_SECTION(msk, val) \
43899: \ 443 END_FTR_SECTION_NESTED(msk, val, 97)
439 .section __ftr_fixup,"a"; \
440 .align 2; \
441 .long msk; \
442 .long val; \
443 .long 98b; \
444 .long 99b; \
445 .previous
446#else /* __powerpc64__ */
447#define END_FTR_SECTION(msk, val) \
44899: \
449 .section __ftr_fixup,"a"; \
450 .align 3; \
451 .llong msk; \
452 .llong val; \
453 .llong 98b; \
454 .llong 99b; \
455 .previous
456#endif /* __powerpc64__ */
457 444
458#define END_FTR_SECTION_IFSET(msk) END_FTR_SECTION((msk), (msk)) 445#define END_FTR_SECTION_IFSET(msk) END_FTR_SECTION((msk), (msk))
459#define END_FTR_SECTION_IFCLR(msk) END_FTR_SECTION((msk), 0) 446#define END_FTR_SECTION_IFCLR(msk) END_FTR_SECTION((msk), 0)
diff --git a/include/asm-powerpc/firmware.h b/include/asm-powerpc/firmware.h
index 1022737f4f34..fdf9aff71150 100644
--- a/include/asm-powerpc/firmware.h
+++ b/include/asm-powerpc/firmware.h
@@ -96,19 +96,16 @@ extern void machine_check_fwnmi(void);
96/* This is true if we are using the firmware NMI handler (typically LPAR) */ 96/* This is true if we are using the firmware NMI handler (typically LPAR) */
97extern int fwnmi_active; 97extern int fwnmi_active;
98 98
99#else /* __ASSEMBLY__ */ 99extern unsigned int __start___fw_ftr_fixup, __stop___fw_ftr_fixup;
100 100
101#define BEGIN_FW_FTR_SECTION 96: 101#else /* __ASSEMBLY__ */
102 102
103#define BEGIN_FW_FTR_SECTION_NESTED(label) label:
104#define BEGIN_FW_FTR_SECTION BEGIN_FW_FTR_SECTION_NESTED(97)
105#define END_FW_FTR_SECTION_NESTED(msk, val, label) \
106 MAKE_FTR_SECTION_ENTRY(msk, val, label, __fw_ftr_fixup)
103#define END_FW_FTR_SECTION(msk, val) \ 107#define END_FW_FTR_SECTION(msk, val) \
10497: \ 108 END_FW_FTR_SECTION_NESTED(msk, val, 97)
105 .section __fw_ftr_fixup,"a"; \
106 .align 3; \
107 .llong msk; \
108 .llong val; \
109 .llong 96b; \
110 .llong 97b; \
111 .previous
112 109
113#define END_FW_FTR_SECTION_IFSET(msk) END_FW_FTR_SECTION((msk), (msk)) 110#define END_FW_FTR_SECTION_IFSET(msk) END_FW_FTR_SECTION((msk), (msk))
114#define END_FW_FTR_SECTION_IFCLR(msk) END_FW_FTR_SECTION((msk), 0) 111#define END_FW_FTR_SECTION_IFCLR(msk) END_FW_FTR_SECTION((msk), 0)
diff --git a/include/asm-powerpc/i8259.h b/include/asm-powerpc/i8259.h
index 78489fb8d140..db1362f8c603 100644
--- a/include/asm-powerpc/i8259.h
+++ b/include/asm-powerpc/i8259.h
@@ -7,6 +7,7 @@
7#ifdef CONFIG_PPC_MERGE 7#ifdef CONFIG_PPC_MERGE
8extern void i8259_init(struct device_node *node, unsigned long intack_addr); 8extern void i8259_init(struct device_node *node, unsigned long intack_addr);
9extern unsigned int i8259_irq(void); 9extern unsigned int i8259_irq(void);
10extern struct irq_host *i8259_get_host(void);
10#else 11#else
11extern void i8259_init(unsigned long intack_addr, int offset); 12extern void i8259_init(unsigned long intack_addr, int offset);
12extern int i8259_irq(void); 13extern int i8259_irq(void);
diff --git a/include/asm-powerpc/ppc_asm.h b/include/asm-powerpc/ppc_asm.h
index a940cfe040da..fa083d8e4663 100644
--- a/include/asm-powerpc/ppc_asm.h
+++ b/include/asm-powerpc/ppc_asm.h
@@ -30,9 +30,9 @@ BEGIN_FTR_SECTION; \
30 mfspr ra,SPRN_PURR; /* get processor util. reg */ \ 30 mfspr ra,SPRN_PURR; /* get processor util. reg */ \
31END_FTR_SECTION_IFSET(CPU_FTR_PURR); \ 31END_FTR_SECTION_IFSET(CPU_FTR_PURR); \
32BEGIN_FTR_SECTION; \ 32BEGIN_FTR_SECTION; \
33 mftb ra; /* or get TB if no PURR */ \ 33 MFTB(ra); /* or get TB if no PURR */ \
34END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ 34END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \
35 ld rb,PACA_STARTPURR(r13); \ 35 ld rb,PACA_STARTPURR(r13); \
36 std ra,PACA_STARTPURR(r13); \ 36 std ra,PACA_STARTPURR(r13); \
37 subf rb,rb,ra; /* subtract start value */ \ 37 subf rb,rb,ra; /* subtract start value */ \
38 ld ra,PACA_USER_TIME(r13); \ 38 ld ra,PACA_USER_TIME(r13); \
@@ -45,9 +45,9 @@ BEGIN_FTR_SECTION; \
45 mfspr ra,SPRN_PURR; /* get processor util. reg */ \ 45 mfspr ra,SPRN_PURR; /* get processor util. reg */ \
46END_FTR_SECTION_IFSET(CPU_FTR_PURR); \ 46END_FTR_SECTION_IFSET(CPU_FTR_PURR); \
47BEGIN_FTR_SECTION; \ 47BEGIN_FTR_SECTION; \
48 mftb ra; /* or get TB if no PURR */ \ 48 MFTB(ra); /* or get TB if no PURR */ \
49END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ 49END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \
50 ld rb,PACA_STARTPURR(r13); \ 50 ld rb,PACA_STARTPURR(r13); \
51 std ra,PACA_STARTPURR(r13); \ 51 std ra,PACA_STARTPURR(r13); \
52 subf rb,rb,ra; /* subtract start value */ \ 52 subf rb,rb,ra; /* subtract start value */ \
53 ld ra,PACA_SYSTEM_TIME(r13); \ 53 ld ra,PACA_SYSTEM_TIME(r13); \
@@ -274,6 +274,16 @@ END_FTR_SECTION_IFSET(CPU_FTR_601)
274#define ISYNC_601 274#define ISYNC_601
275#endif 275#endif
276 276
277#ifdef CONFIG_PPC_CELL
278#define MFTB(dest) \
27990: mftb dest; \
280BEGIN_FTR_SECTION_NESTED(96); \
281 cmpwi dest,0; \
282 beq- 90b; \
283END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, CPU_FTR_CELL_TB_BUG, 96)
284#else
285#define MFTB(dest) mftb dest
286#endif
277 287
278#ifndef CONFIG_SMP 288#ifndef CONFIG_SMP
279#define TLBSYNC 289#define TLBSYNC
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 524629769336..ec11d44eaeb5 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -134,7 +134,7 @@ extern struct device_node *of_find_all_nodes(struct device_node *prev);
134extern struct device_node *of_get_parent(const struct device_node *node); 134extern struct device_node *of_get_parent(const struct device_node *node);
135extern struct device_node *of_get_next_child(const struct device_node *node, 135extern struct device_node *of_get_next_child(const struct device_node *node,
136 struct device_node *prev); 136 struct device_node *prev);
137extern struct property *of_find_property(struct device_node *np, 137extern struct property *of_find_property(const struct device_node *np,
138 const char *name, 138 const char *name,
139 int *lenp); 139 int *lenp);
140extern struct device_node *of_node_get(struct device_node *node); 140extern struct device_node *of_node_get(struct device_node *node);
@@ -158,10 +158,12 @@ extern void of_detach_node(const struct device_node *);
158extern void finish_device_tree(void); 158extern void finish_device_tree(void);
159extern void unflatten_device_tree(void); 159extern void unflatten_device_tree(void);
160extern void early_init_devtree(void *); 160extern void early_init_devtree(void *);
161extern int device_is_compatible(struct device_node *device, const char *); 161extern int device_is_compatible(const struct device_node *device,
162 const char *);
162extern int machine_is_compatible(const char *compat); 163extern int machine_is_compatible(const char *compat);
163extern const void *get_property(struct device_node *node, const char *name, 164extern const void *get_property(const struct device_node *node,
164 int *lenp); 165 const char *name,
166 int *lenp);
165extern void print_properties(struct device_node *node); 167extern void print_properties(struct device_node *node);
166extern int prom_n_addr_cells(struct device_node* np); 168extern int prom_n_addr_cells(struct device_node* np);
167extern int prom_n_size_cells(struct device_node* np); 169extern int prom_n_size_cells(struct device_node* np);
diff --git a/include/asm-powerpc/reg.h b/include/asm-powerpc/reg.h
index 8fb96811b55d..6faae7b14d55 100644
--- a/include/asm-powerpc/reg.h
+++ b/include/asm-powerpc/reg.h
@@ -591,6 +591,7 @@
591#define PV_630 0x0040 591#define PV_630 0x0040
592#define PV_630p 0x0041 592#define PV_630p 0x0041
593#define PV_970MP 0x0044 593#define PV_970MP 0x0044
594#define PV_970GX 0x0045
594#define PV_BE 0x0070 595#define PV_BE 0x0070
595#define PV_PA6T 0x0090 596#define PV_PA6T 0x0090
596 597
@@ -618,10 +619,35 @@
618 : "=r" (rval)); rval;}) 619 : "=r" (rval)); rval;})
619#define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v)) 620#define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v))
620 621
622#ifdef __powerpc64__
623#ifdef CONFIG_PPC_CELL
624#define mftb() ({unsigned long rval; \
625 asm volatile( \
626 "90: mftb %0;\n" \
627 "97: cmpwi %0,0;\n" \
628 " beq- 90b;\n" \
629 "99:\n" \
630 ".section __ftr_fixup,\"a\"\n" \
631 ".align 3\n" \
632 "98:\n" \
633 " .llong %1\n" \
634 " .llong %1\n" \
635 " .llong 97b-98b\n" \
636 " .llong 99b-98b\n" \
637 ".previous" \
638 : "=r" (rval) : "i" (CPU_FTR_CELL_TB_BUG)); rval;})
639#else
621#define mftb() ({unsigned long rval; \ 640#define mftb() ({unsigned long rval; \
622 asm volatile("mftb %0" : "=r" (rval)); rval;}) 641 asm volatile("mftb %0" : "=r" (rval)); rval;})
642#endif /* !CONFIG_PPC_CELL */
643
644#else /* __powerpc64__ */
645
623#define mftbl() ({unsigned long rval; \ 646#define mftbl() ({unsigned long rval; \
624 asm volatile("mftbl %0" : "=r" (rval)); rval;}) 647 asm volatile("mftbl %0" : "=r" (rval)); rval;})
648#define mftbu() ({unsigned long rval; \
649 asm volatile("mftbu %0" : "=r" (rval)); rval;})
650#endif /* !__powerpc64__ */
625 651
626#define mttbl(v) asm volatile("mttbl %0":: "r"(v)) 652#define mttbl(v) asm volatile("mttbl %0":: "r"(v))
627#define mttbu(v) asm volatile("mttbu %0":: "r"(v)) 653#define mttbu(v) asm volatile("mttbu %0":: "r"(v))
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index b051d4c88c3b..a78285010d62 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -82,30 +82,35 @@ struct div_result {
82#define __USE_RTC() 0 82#define __USE_RTC() 0
83#endif 83#endif
84 84
85/* On ppc64 this gets us the whole timebase; on ppc32 just the lower half */ 85#ifdef CONFIG_PPC64
86
87/* For compatibility, get_tbl() is defined as get_tb() on ppc64 */
88#define get_tbl get_tb
89
90#else
91
86static inline unsigned long get_tbl(void) 92static inline unsigned long get_tbl(void)
87{ 93{
88 unsigned long tbl;
89
90#if defined(CONFIG_403GCX) 94#if defined(CONFIG_403GCX)
95 unsigned long tbl;
91 asm volatile("mfspr %0, 0x3dd" : "=r" (tbl)); 96 asm volatile("mfspr %0, 0x3dd" : "=r" (tbl));
97 return tbl;
92#else 98#else
93 asm volatile("mftb %0" : "=r" (tbl)); 99 return mftbl();
94#endif 100#endif
95 return tbl;
96} 101}
97 102
98static inline unsigned int get_tbu(void) 103static inline unsigned int get_tbu(void)
99{ 104{
105#ifdef CONFIG_403GCX
100 unsigned int tbu; 106 unsigned int tbu;
101
102#if defined(CONFIG_403GCX)
103 asm volatile("mfspr %0, 0x3dc" : "=r" (tbu)); 107 asm volatile("mfspr %0, 0x3dc" : "=r" (tbu));
108 return tbu;
104#else 109#else
105 asm volatile("mftbu %0" : "=r" (tbu)); 110 return mftbu();
106#endif 111#endif
107 return tbu;
108} 112}
113#endif /* !CONFIG_PPC64 */
109 114
110static inline unsigned int get_rtcl(void) 115static inline unsigned int get_rtcl(void)
111{ 116{
@@ -131,7 +136,7 @@ static inline u64 get_tb(void)
131{ 136{
132 return mftb(); 137 return mftb();
133} 138}
134#else 139#else /* CONFIG_PPC64 */
135static inline u64 get_tb(void) 140static inline u64 get_tb(void)
136{ 141{
137 unsigned int tbhi, tblo, tbhi2; 142 unsigned int tbhi, tblo, tbhi2;
@@ -144,7 +149,7 @@ static inline u64 get_tb(void)
144 149
145 return ((u64)tbhi << 32) | tblo; 150 return ((u64)tbhi << 32) | tblo;
146} 151}
147#endif 152#endif /* !CONFIG_PPC64 */
148 153
149static inline void set_tb(unsigned int upper, unsigned int lower) 154static inline void set_tb(unsigned int upper, unsigned int lower)
150{ 155{
diff --git a/include/asm-powerpc/timex.h b/include/asm-powerpc/timex.h
index 3b9a8e786806..92dedde761d1 100644
--- a/include/asm-powerpc/timex.h
+++ b/include/asm-powerpc/timex.h
@@ -8,6 +8,7 @@
8 */ 8 */
9 9
10#include <asm/cputable.h> 10#include <asm/cputable.h>
11#include <asm/reg.h>
11 12
12#define CLOCK_TICK_RATE 1024000 /* Underlying HZ */ 13#define CLOCK_TICK_RATE 1024000 /* Underlying HZ */
13 14
@@ -15,13 +16,11 @@ typedef unsigned long cycles_t;
15 16
16static inline cycles_t get_cycles(void) 17static inline cycles_t get_cycles(void)
17{ 18{
18 cycles_t ret;
19
20#ifdef __powerpc64__ 19#ifdef __powerpc64__
21 20 return mftb();
22 __asm__ __volatile__("mftb %0" : "=r" (ret) : );
23
24#else 21#else
22 cycles_t ret;
23
25 /* 24 /*
26 * For the "cycle" counter we use the timebase lower half. 25 * For the "cycle" counter we use the timebase lower half.
27 * Currently only used on SMP. 26 * Currently only used on SMP.
@@ -30,18 +29,19 @@ static inline cycles_t get_cycles(void)
30 ret = 0; 29 ret = 0;
31 30
32 __asm__ __volatile__( 31 __asm__ __volatile__(
33 "98: mftb %0\n" 32 "97: mftb %0\n"
34 "99:\n" 33 "99:\n"
35 ".section __ftr_fixup,\"a\"\n" 34 ".section __ftr_fixup,\"a\"\n"
35 ".align 2\n"
36 "98:\n"
36 " .long %1\n" 37 " .long %1\n"
37 " .long 0\n" 38 " .long 0\n"
38 " .long 98b\n" 39 " .long 97b-98b\n"
39 " .long 99b\n" 40 " .long 99b-98b\n"
40 ".previous" 41 ".previous"
41 : "=r" (ret) : "i" (CPU_FTR_601)); 42 : "=r" (ret) : "i" (CPU_FTR_601));
42#endif
43
44 return ret; 43 return ret;
44#endif
45} 45}
46 46
47#endif /* __KERNEL__ */ 47#endif /* __KERNEL__ */