]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/power/power.h
hpt366: MWDMA filter for SATA cards (take 2)
[linux-2.6-omap-h63xx.git] / kernel / power / power.h
index 33bd94ceba32f16534f33b031a20521863f95bd5..95fbf2dd3fe33901be99ef8ce60a3bf2ca9fb833 100644 (file)
@@ -13,14 +13,22 @@ struct swsusp_info {
 
 
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
-extern int pm_suspend_disk(void);
+#ifdef CONFIG_HIBERNATION
+/*
+ * Keep some memory free so that I/O operations can succeed without paging
+ * [Might this be more than 4 MB?]
+ */
+#define PAGES_FOR_IO   ((4096 * 1024) >> PAGE_SHIFT)
+/*
+ * Keep 1 MB of memory free so that device drivers can allocate some pages in
+ * their .suspend() routines without breaking the suspend to disk.
+ */
+#define SPARE_PAGES    ((1024 * 1024) >> PAGE_SHIFT)
 
-#else
-static inline int pm_suspend_disk(void)
-{
-       return -EPERM;
-}
+/* kernel/power/disk.c */
+extern int hibernation_snapshot(int platform_mode);
+extern int hibernation_restore(int platform_mode);
+extern int hibernation_platform_enter(void);
 #endif
 
 extern int pfn_is_nosave(unsigned long);
@@ -48,6 +56,8 @@ extern sector_t swsusp_resume_block;
 extern asmlinkage int swsusp_arch_suspend(void);
 extern asmlinkage int swsusp_arch_resume(void);
 
+extern int create_basic_memory_bitmaps(void);
+extern void free_basic_memory_bitmaps(void);
 extern unsigned int count_data_pages(void);
 
 /**
@@ -138,41 +148,49 @@ struct resume_swap_area {
 #define PMOPS_ENTER    2
 #define PMOPS_FINISH   3
 
-/**
- *     The bitmap is used for tracing allocated swap pages
- *
- *     The entire bitmap consists of a number of bitmap_page
- *     structures linked with the help of the .next member.
- *     Thus each page can be allocated individually, so we only
- *     need to make 0-order memory allocations to create
- *     the bitmap.
- */
-
-#define BITMAP_PAGE_SIZE       (PAGE_SIZE - sizeof(void *))
-#define BITMAP_PAGE_CHUNKS     (BITMAP_PAGE_SIZE / sizeof(long))
-#define BITS_PER_CHUNK         (sizeof(long) * 8)
-#define BITMAP_PAGE_BITS       (BITMAP_PAGE_CHUNKS * BITS_PER_CHUNK)
+/* If unset, the snapshot device cannot be open. */
+extern atomic_t snapshot_device_available;
 
-struct bitmap_page {
-       unsigned long           chunks[BITMAP_PAGE_CHUNKS];
-       struct bitmap_page      *next;
-};
+extern sector_t alloc_swapdev_block(int swap);
+extern void free_all_swap_pages(int swap);
+extern int swsusp_swap_in_use(void);
 
-extern void free_bitmap(struct bitmap_page *bitmap);
-extern struct bitmap_page *alloc_bitmap(unsigned int nr_bits);
-extern sector_t alloc_swapdev_block(int swap, struct bitmap_page *bitmap);
-extern void free_all_swap_pages(int swap, struct bitmap_page *bitmap);
+/*
+ * Flags that can be passed from the hibernatig hernel to the "boot" kernel in
+ * the image header.
+ */
+#define SF_PLATFORM_MODE       1
 
+/* kernel/power/disk.c */
 extern int swsusp_check(void);
 extern int swsusp_shrink_memory(void);
 extern void swsusp_free(void);
 extern int swsusp_suspend(void);
 extern int swsusp_resume(void);
-extern int swsusp_read(void);
-extern int swsusp_write(void);
+extern int swsusp_read(unsigned int *flags_p);
+extern int swsusp_write(unsigned int flags);
 extern void swsusp_close(void);
-extern int suspend_enter(suspend_state_t state);
 
 struct timeval;
+/* kernel/power/swsusp.c */
 extern void swsusp_show_speed(struct timeval *, struct timeval *,
                                unsigned int, char *);
+
+#ifdef CONFIG_SUSPEND
+/* kernel/power/main.c */
+extern int suspend_devices_and_enter(suspend_state_t state);
+#else /* !CONFIG_SUSPEND */
+static inline int suspend_devices_and_enter(suspend_state_t state)
+{
+       return -ENOSYS;
+}
+#endif /* !CONFIG_SUSPEND */
+
+/* kernel/power/common.c */
+extern struct blocking_notifier_head pm_chain_head;
+
+static inline int pm_notifier_call_chain(unsigned long val)
+{
+       return (blocking_notifier_call_chain(&pm_chain_head, val, NULL)
+                       == NOTIFY_BAD) ? -EINVAL : 0;
+}