[PATCH] ibmphp: remove TRUE and FALSE
[linux/fpc-iii.git] / kernel / power / power.h
blobf06f12f2176733c6f87528c3a16f8c0a881e543c
1 #include <linux/suspend.h>
2 #include <linux/utsname.h>
4 struct swsusp_info {
5 struct new_utsname uts;
6 u32 version_code;
7 unsigned long num_physpages;
8 int cpus;
9 unsigned long image_pages;
10 unsigned long pages;
11 unsigned long size;
12 } __attribute__((aligned(PAGE_SIZE)));
16 #ifdef CONFIG_SOFTWARE_SUSPEND
17 extern int pm_suspend_disk(void);
19 #else
20 static inline int pm_suspend_disk(void)
22 return -EPERM;
24 #endif
25 extern struct semaphore pm_sem;
26 #define power_attr(_name) \
27 static struct subsys_attribute _name##_attr = { \
28 .attr = { \
29 .name = __stringify(_name), \
30 .mode = 0644, \
31 }, \
32 .show = _name##_show, \
33 .store = _name##_store, \
36 extern struct subsystem power_subsys;
38 /* References to section boundaries */
39 extern const void __nosave_begin, __nosave_end;
41 extern struct pbe *pagedir_nosave;
43 /* Preferred image size in bytes (default 500 MB) */
44 extern unsigned long image_size;
45 extern int in_suspend;
46 extern dev_t swsusp_resume_device;
48 extern asmlinkage int swsusp_arch_suspend(void);
49 extern asmlinkage int swsusp_arch_resume(void);
51 extern unsigned int count_data_pages(void);
53 struct snapshot_handle {
54 loff_t offset;
55 unsigned int page;
56 unsigned int page_offset;
57 unsigned int prev;
58 struct pbe *pbe;
59 void *buffer;
60 unsigned int buf_offset;
63 #define data_of(handle) ((handle).buffer + (handle).buf_offset)
65 extern int snapshot_read_next(struct snapshot_handle *handle, size_t count);
66 extern int snapshot_write_next(struct snapshot_handle *handle, size_t count);
67 int snapshot_image_loaded(struct snapshot_handle *handle);
69 #define SNAPSHOT_IOC_MAGIC '3'
70 #define SNAPSHOT_FREEZE _IO(SNAPSHOT_IOC_MAGIC, 1)
71 #define SNAPSHOT_UNFREEZE _IO(SNAPSHOT_IOC_MAGIC, 2)
72 #define SNAPSHOT_ATOMIC_SNAPSHOT _IOW(SNAPSHOT_IOC_MAGIC, 3, void *)
73 #define SNAPSHOT_ATOMIC_RESTORE _IO(SNAPSHOT_IOC_MAGIC, 4)
74 #define SNAPSHOT_FREE _IO(SNAPSHOT_IOC_MAGIC, 5)
75 #define SNAPSHOT_SET_IMAGE_SIZE _IOW(SNAPSHOT_IOC_MAGIC, 6, unsigned long)
76 #define SNAPSHOT_AVAIL_SWAP _IOR(SNAPSHOT_IOC_MAGIC, 7, void *)
77 #define SNAPSHOT_GET_SWAP_PAGE _IOR(SNAPSHOT_IOC_MAGIC, 8, void *)
78 #define SNAPSHOT_FREE_SWAP_PAGES _IO(SNAPSHOT_IOC_MAGIC, 9)
79 #define SNAPSHOT_SET_SWAP_FILE _IOW(SNAPSHOT_IOC_MAGIC, 10, unsigned int)
80 #define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11)
81 #define SNAPSHOT_IOC_MAXNR 11
83 /**
84 * The bitmap is used for tracing allocated swap pages
86 * The entire bitmap consists of a number of bitmap_page
87 * structures linked with the help of the .next member.
88 * Thus each page can be allocated individually, so we only
89 * need to make 0-order memory allocations to create
90 * the bitmap.
93 #define BITMAP_PAGE_SIZE (PAGE_SIZE - sizeof(void *))
94 #define BITMAP_PAGE_CHUNKS (BITMAP_PAGE_SIZE / sizeof(long))
95 #define BITS_PER_CHUNK (sizeof(long) * 8)
96 #define BITMAP_PAGE_BITS (BITMAP_PAGE_CHUNKS * BITS_PER_CHUNK)
98 struct bitmap_page {
99 unsigned long chunks[BITMAP_PAGE_CHUNKS];
100 struct bitmap_page *next;
103 extern void free_bitmap(struct bitmap_page *bitmap);
104 extern struct bitmap_page *alloc_bitmap(unsigned int nr_bits);
105 extern unsigned long alloc_swap_page(int swap, struct bitmap_page *bitmap);
106 extern void free_all_swap_pages(int swap, struct bitmap_page *bitmap);
108 extern int swsusp_check(void);
109 extern int swsusp_shrink_memory(void);
110 extern void swsusp_free(void);
111 extern int swsusp_suspend(void);
112 extern int swsusp_resume(void);
113 extern int swsusp_read(void);
114 extern int swsusp_write(void);
115 extern void swsusp_close(void);
116 extern int suspend_enter(suspend_state_t state);