1#ifndef _LINUX_SWSUSP_H 2#define _LINUX_SWSUSP_H 3 4#ifdef CONFIG_X86 5#include <asm/suspend.h> 6#endif 7#include <linux/swap.h> 8#include <linux/notifier.h> 9#include <linux/config.h> 10#include <linux/init.h> 11#include <linux/pm.h> 12 13#ifdef CONFIG_PM 14/* page backup entry */ 15typedef struct pbe { 16 unsigned long address; /* address of the copy */ 17 unsigned long orig_address; /* original address of page */ 18 swp_entry_t swap_address; 19 swp_entry_t dummy; /* we need scratch space at 20 * end of page (see link, diskpage) 21 */ 22} suspend_pagedir_t; 23 24#define SWAP_FILENAME_MAXLENGTH 32 25 26struct suspend_header { 27 u32 version_code; 28 unsigned long num_physpages; 29 char machine[8]; 30 char version[20]; 31 int num_cpus; 32 int page_size; 33 suspend_pagedir_t *suspend_pagedir; 34 unsigned int num_pbes; 35}; 36 37#define SUSPEND_PD_PAGES(x) (((x)*sizeof(struct pbe))/PAGE_SIZE+1) 38 39/* mm/vmscan.c */ 40extern int shrink_mem(void); 41 42/* mm/page_alloc.c */ 43extern void drain_local_pages(void); 44 45/* kernel/power/swsusp.c */ 46extern int software_suspend(void); 47 48extern unsigned int nr_copy_pages __nosavedata; 49extern suspend_pagedir_t *pagedir_nosave __nosavedata; 50 51#else /* CONFIG_SOFTWARE_SUSPEND */ 52static inline int software_suspend(void) 53{ 54 printk("Warning: fake suspend called\n"); 55 return -EPERM; 56} 57#define software_resume() do { } while(0) 58#endif /* CONFIG_SOFTWARE_SUSPEND */ 59 60 61#ifdef CONFIG_PM 62extern void refrigerator(unsigned long); 63extern int freeze_processes(void); 64extern void thaw_processes(void); 65 66extern int pm_prepare_console(void); 67extern void pm_restore_console(void); 68 69#else 70static inline void refrigerator(unsigned long flag) {} 71#endif /* CONFIG_PM */ 72 73#ifdef CONFIG_SMP 74extern void disable_nonboot_cpus(void); 75extern void enable_nonboot_cpus(void); 76#else 77static inline void disable_nonboot_cpus(void) {} 78static inline void enable_nonboot_cpus(void) {} 79#endif 80 81asmlinkage void do_magic(int is_resume); 82asmlinkage void do_magic_resume_1(void); 83asmlinkage void do_magic_resume_2(void); 84asmlinkage void do_magic_suspend_1(void); 85asmlinkage void do_magic_suspend_2(void); 86 87void save_processor_state(void); 88void restore_processor_state(void); 89struct saved_context; 90void __save_processor_state(struct saved_context *ctxt); 91void __restore_processor_state(struct saved_context *ctxt); 92 93#endif /* _LINUX_SWSUSP_H */ 94

