aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-06-24 17:27:42 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-24 17:44:01 -0400
commiteb71c87a492b7090ff9e8ac46912c480a1687e38 (patch)
tree1136213dee0f942866b6c2c65de7e7c63ca94fda /include
parentd384ea691fe4ea8c2dd5b9b8d9042eb181776f18 (diff)
Add some basic resume trace facilities
Considering that there isn't a lot of hw we can depend on during resume, this is about as good as it gets. This is x86-only for now, although the basic concept (and most of the code) will certainly work on almost any platform. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/rtc.h7
-rw-r--r--include/linux/resume-trace.h30
2 files changed, 34 insertions, 3 deletions
diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h
index cef08db34ada..4087037a4225 100644
--- a/include/asm-generic/rtc.h
+++ b/include/asm-generic/rtc.h
@@ -114,6 +114,7 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
114/* Set the current date and time in the real time clock. */ 114/* Set the current date and time in the real time clock. */
115static inline int set_rtc_time(struct rtc_time *time) 115static inline int set_rtc_time(struct rtc_time *time)
116{ 116{
117 unsigned long flags;
117 unsigned char mon, day, hrs, min, sec; 118 unsigned char mon, day, hrs, min, sec;
118 unsigned char save_control, save_freq_select; 119 unsigned char save_control, save_freq_select;
119 unsigned int yrs; 120 unsigned int yrs;
@@ -131,7 +132,7 @@ static inline int set_rtc_time(struct rtc_time *time)
131 if (yrs > 255) /* They are unsigned */ 132 if (yrs > 255) /* They are unsigned */
132 return -EINVAL; 133 return -EINVAL;
133 134
134 spin_lock_irq(&rtc_lock); 135 spin_lock_irqsave(&rtc_lock, flags);
135#ifdef CONFIG_MACH_DECSTATION 136#ifdef CONFIG_MACH_DECSTATION
136 real_yrs = yrs; 137 real_yrs = yrs;
137 leap_yr = ((!((yrs + 1900) % 4) && ((yrs + 1900) % 100)) || 138 leap_yr = ((!((yrs + 1900) % 4) && ((yrs + 1900) % 100)) ||
@@ -152,7 +153,7 @@ static inline int set_rtc_time(struct rtc_time *time)
152 * whether the chip is in binary mode or not. 153 * whether the chip is in binary mode or not.
153 */ 154 */
154 if (yrs > 169) { 155 if (yrs > 169) {
155 spin_unlock_irq(&rtc_lock); 156 spin_unlock_irqrestore(&rtc_lock, flags);
156 return -EINVAL; 157 return -EINVAL;
157 } 158 }
158 159
@@ -187,7 +188,7 @@ static inline int set_rtc_time(struct rtc_time *time)
187 CMOS_WRITE(save_control, RTC_CONTROL); 188 CMOS_WRITE(save_control, RTC_CONTROL);
188 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); 189 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
189 190
190 spin_unlock_irq(&rtc_lock); 191 spin_unlock_irqrestore(&rtc_lock, flags);
191 192
192 return 0; 193 return 0;
193} 194}
diff --git a/include/linux/resume-trace.h b/include/linux/resume-trace.h
new file mode 100644
index 000000000000..a376bd4ade39
--- /dev/null
+++ b/include/linux/resume-trace.h
@@ -0,0 +1,30 @@
1#ifndef RESUME_TRACE_H
2#define RESUME_TRACE_H
3
4#ifdef CONFIG_PM_TRACE
5
6struct device;
7extern void set_trace_device(struct device *);
8extern void generate_resume_trace(void *tracedata, unsigned int user);
9
10#define TRACE_DEVICE(dev) set_trace_device(dev)
11#define TRACE_RESUME(user) do { \
12 void *tracedata; \
13 asm volatile("movl $1f,%0\n" \
14 ".section .tracedata,\"a\"\n" \
15 "1:\t.word %c1\n" \
16 "\t.long %c2\n" \
17 ".previous" \
18 :"=r" (tracedata) \
19 : "i" (__LINE__), "i" (__FILE__)); \
20 generate_resume_trace(tracedata, user); \
21} while (0)
22
23#else
24
25#define TRACE_DEVICE(dev) do { } while (0)
26#define TRACE_RESUME(dev) do { } while (0)
27
28#endif
29
30#endif