ia64/xen-unstable

view xen/include/xen/time.h @ 17550:becd9b77f951

x86: Add TSC stop support for Deep C state

TSC may stop at deep C state (C3/C4...) entry/exit. this patch add the
logic that save and restore TSC during deep C state entry/exit, by
using platform timer (PIT/HPET)

Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Tian Kevin <kevin.tian@intel.com>
Signed-off-by: Wei Gang<gang.wei@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu May 01 10:50:09 2008 +0100 (2008-05-01)
parents 2477e94450aa
children 6c4cab061af4
line source
1 /******************************************************************************
2 * time.h
3 *
4 * Copyright (c) 2002-2003 Rolf Neugebauer
5 * Copyright (c) 2002-2005 K A Fraser
6 */
8 #ifndef __XEN_TIME_H__
9 #define __XEN_TIME_H__
11 #include <xen/types.h>
12 #include <public/xen.h>
13 #include <asm/time.h>
15 extern int init_xen_time(void);
16 extern void cstate_save_tsc(void);
17 extern void cstate_restore_tsc(void);
19 extern unsigned long cpu_khz;
21 struct domain;
23 /*
24 * System Time
25 * 64 bit value containing the nanoseconds elapsed since boot time.
26 * This value is adjusted by frequency drift.
27 * NOW() returns the current time.
28 * The other macros are for convenience to approximate short intervals
29 * of real time into system time
30 */
32 typedef s64 s_time_t;
34 s_time_t get_s_time(void);
35 unsigned long get_localtime(struct domain *d);
37 struct tm {
38 int tm_sec; /* seconds */
39 int tm_min; /* minutes */
40 int tm_hour; /* hours */
41 int tm_mday; /* day of the month */
42 int tm_mon; /* month */
43 int tm_year; /* year */
44 int tm_wday; /* day of the week */
45 int tm_yday; /* day in the year */
46 int tm_isdst; /* daylight saving time */
47 };
48 struct tm gmtime(unsigned long t);
50 #define NOW() ((s_time_t)get_s_time())
51 #define SECONDS(_s) ((s_time_t)((_s) * 1000000000ULL))
52 #define MILLISECS(_ms) ((s_time_t)((_ms) * 1000000ULL))
53 #define MICROSECS(_us) ((s_time_t)((_us) * 1000ULL))
55 extern void update_vcpu_system_time(struct vcpu *v);
56 extern void update_domain_wallclock_time(struct domain *d);
58 extern void do_settime(
59 unsigned long secs, unsigned long nsecs, u64 system_time_base);
61 extern void send_timer_event(struct vcpu *v);
63 #endif /* __XEN_TIME_H__ */
65 /*
66 * Local variables:
67 * mode: C
68 * c-set-style: "BSD"
69 * c-basic-offset: 4
70 * tab-width: 4
71 * indent-tabs-mode: nil
72 * End:
73 */