Blame view

include/asm-powerpc/timex.h 793 Bytes
dd56fdf23   jdl@freescale.com   [PATCH] powerpc: ...
1
2
3
4
  #ifndef _ASM_POWERPC_TIMEX_H
  #define _ASM_POWERPC_TIMEX_H
  
  #ifdef __KERNEL__
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
5
  /*
dd56fdf23   jdl@freescale.com   [PATCH] powerpc: ...
6
   * PowerPC architecture timex specifications
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
7
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
8

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
9
  #include <asm/cputable.h>
859deea94   Benjamin Herrenschmidt   [POWERPC] Cell ti...
10
  #include <asm/reg.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
11

cbd27b8ce   Benjamin Herrenschmidt   [PATCH] ppc32: Fi...
12
  #define CLOCK_TICK_RATE	1024000 /* Underlying HZ */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13
14
  
  typedef unsigned long cycles_t;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
15
16
  static inline cycles_t get_cycles(void)
  {
dd56fdf23   jdl@freescale.com   [PATCH] powerpc: ...
17
  #ifdef __powerpc64__
859deea94   Benjamin Herrenschmidt   [POWERPC] Cell ti...
18
  	return mftb();
dd56fdf23   jdl@freescale.com   [PATCH] powerpc: ...
19
  #else
859deea94   Benjamin Herrenschmidt   [POWERPC] Cell ti...
20
  	cycles_t ret;
dd56fdf23   jdl@freescale.com   [PATCH] powerpc: ...
21
22
23
24
25
26
  	/*
  	 * For the "cycle" counter we use the timebase lower half.
  	 * Currently only used on SMP.
  	 */
  
  	ret = 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
27
28
  
  	__asm__ __volatile__(
0909c8c2d   Benjamin Herrenschmidt   [POWERPC] Support...
29
30
  		"97:	mftb %0
  "
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
31
32
33
34
  		"99:
  "
  		".section __ftr_fixup,\"a\"
  "
0909c8c2d   Benjamin Herrenschmidt   [POWERPC] Support...
35
36
37
38
  		".align 2
  "
  		"98:
  "
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
39
40
41
42
  		"	.long %1
  "
  		"	.long 0
  "
0909c8c2d   Benjamin Herrenschmidt   [POWERPC] Support...
43
44
45
46
  		"	.long 97b-98b
  "
  		"	.long 99b-98b
  "
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
47
48
49
  		".previous"
  		: "=r" (ret) : "i" (CPU_FTR_601));
  	return ret;
859deea94   Benjamin Herrenschmidt   [POWERPC] Cell ti...
50
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
51
  }
dd56fdf23   jdl@freescale.com   [PATCH] powerpc: ...
52
53
  #endif	/* __KERNEL__ */
  #endif	/* _ASM_POWERPC_TIMEX_H */