]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/asm-x86/processor.h
x86: move tsc definitions to were they belong
[mirror_ubuntu-bionic-kernel.git] / include / asm-x86 / processor.h
CommitLineData
c758ecf6
GOC
1#ifndef __ASM_X86_PROCESSOR_H
2#define __ASM_X86_PROCESSOR_H
3
4static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
5 unsigned int *ecx, unsigned int *edx)
6{
7 /* ecx is often an input as well as an output. */
8 __asm__("cpuid"
9 : "=a" (*eax),
10 "=b" (*ebx),
11 "=c" (*ecx),
12 "=d" (*edx)
13 : "0" (*eax), "2" (*ecx));
14}
15
16
96a388de
TG
17#ifdef CONFIG_X86_32
18# include "processor_32.h"
19#else
20# include "processor_64.h"
21#endif
c758ecf6
GOC
22
23#ifndef CONFIG_PARAVIRT
24#define __cpuid native_cpuid
25#endif
26
27/*
28 * Generic CPUID function
29 * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx
30 * resulting in stale register contents being returned.
31 */
32static inline void cpuid(unsigned int op,
33 unsigned int *eax, unsigned int *ebx,
34 unsigned int *ecx, unsigned int *edx)
35{
36 *eax = op;
37 *ecx = 0;
38 __cpuid(eax, ebx, ecx, edx);
39}
40
41/* Some CPUID calls want 'count' to be placed in ecx */
42static inline void cpuid_count(unsigned int op, int count,
43 unsigned int *eax, unsigned int *ebx,
44 unsigned int *ecx, unsigned int *edx)
45{
46 *eax = op;
47 *ecx = count;
48 __cpuid(eax, ebx, ecx, edx);
49}
50
51/*
52 * CPUID functions returning a single datum
53 */
54static inline unsigned int cpuid_eax(unsigned int op)
55{
56 unsigned int eax, ebx, ecx, edx;
57
58 cpuid(op, &eax, &ebx, &ecx, &edx);
59 return eax;
60}
61static inline unsigned int cpuid_ebx(unsigned int op)
62{
63 unsigned int eax, ebx, ecx, edx;
64
65 cpuid(op, &eax, &ebx, &ecx, &edx);
66 return ebx;
67}
68static inline unsigned int cpuid_ecx(unsigned int op)
69{
70 unsigned int eax, ebx, ecx, edx;
71
72 cpuid(op, &eax, &ebx, &ecx, &edx);
73 return ecx;
74}
75static inline unsigned int cpuid_edx(unsigned int op)
76{
77 unsigned int eax, ebx, ecx, edx;
78
79 cpuid(op, &eax, &ebx, &ecx, &edx);
80 return edx;
81}
82
83#endif