xref: /titanic_52/usr/src/uts/common/sys/cpr.h (revision c2580b931007758eab8cb5ae8726ebe1588e259b)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_CPR_H
28 #define	_SYS_CPR_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/obpdefs.h>
37 #include <sys/param.h>
38 #include <sys/mutex.h>
39 #include <sys/uadmin.h>
40 #include <sys/compress.h>
41 
42 /*
43  * definitions for kernel, cprboot, pmconfig
44  */
45 #define	CPR_VERSION		6
46 #define	CPR_CONFIG		"/etc/.cpr_config"
47 
48 
49 /*
50  * magic numbers for cpr files
51  */
52 #define	CPR_CONFIG_MAGIC	0x436E4667	/* 'CnFg' */
53 #define	CPR_DEFAULT_MAGIC	0x44664C74	/* 'DfLt' */
54 
55 /*
56  * max(strlen("true"), strlen("false")) + 1
57  */
58 #define	PROP_BOOL_LEN		6
59 #define	PROP_MOD		'Y'
60 #define	PROP_NOMOD		'N'
61 
62 /*
63  * max property name length used
64  * max property count
65  */
66 #define	CPR_MAXPLEN		15
67 #define	CPR_MAXPROP		5
68 
69 /*
70  * name/value of nvram properties
71  */
72 struct cpr_prop_info {
73 	char	mod;
74 	char	name[CPR_MAXPLEN];
75 	char	value[OBP_MAXPATHLEN];
76 };
77 typedef struct cpr_prop_info cprop_t;
78 
79 struct cpr_default_mini {
80 	int	magic;				/* magic word for booter */
81 	int	reusable;			/* true if resuable statefile */
82 };
83 typedef struct cpr_default_mini cmini_t;
84 
85 struct cpr_default_info {
86 	cmini_t	mini;
87 	cprop_t	props[CPR_MAXPROP];		/* nvram property info */
88 };
89 typedef struct cpr_default_info cdef_t;
90 
91 
92 /*
93  * Configuration info provided by user via pmconfig.
94  *
95  * The first part (cf_type, cf_path, cf_fs, cf_devfs, cf_dev_prom)
96  * is used by both the cpr kernel module and cpr booter program
97  * to locate the statefile.
98  *
99  * cf_type	CFT_UFS
100  * cf_path	(path within file system) ".CPR"
101  * cf_fs	(mount point for the statefile's filesystem) "/export/home"
102  * cf_devfs	(devfs path of disk parition mounted there) "/dev/dsk/c0t0d0s7"
103  * cf_dev_prom	(prom device path of the above disk partition)
104  *			"/sbus/espdma/dma/sd@0:h"
105  *
106  * If the statefile were on a character special device (/dev//rdsk/c0t1d0s7),
107  * the fields would have the typical values shown below:
108  *
109  * cf_type	CFT_SPEC
110  * cf_path	ignored
111  * cf_fs	ignored
112  * cf_devfs	/dev/rdsk/c1t0d0s7
113  * cf_dev_prom	(prom device path of the above special file)
114  *			"/sbus/espdma/dma/sd@1:h"
115  *
116  * The rest of the fields are autoshutdown and autopm configuration related.
117  * They are updated by pmconfig and consumed by both powerd and dtpower.
118  */
119 
120 struct cprconfig {
121 	int	cf_magic;			/* magic word for	*/
122 						/* booter to verify	*/
123 	int	cf_type;			/* CFT_UFS or CFT_SPEC	*/
124 	char	cf_path[MAXNAMELEN];		/* fs-relative path	*/
125 						/* for the state file	*/
126 	char	cf_fs[MAXNAMELEN];		/* mount point for fs	*/
127 						/* holding state file	*/
128 	char	cf_devfs[MAXNAMELEN];		/* path to device node	*/
129 						/* for above mount pt.	*/
130 	char	cf_dev_prom[OBP_MAXPATHLEN];	/* full device path of	*/
131 						/* above filesystem	*/
132 	/*
133 	 * autoshutdown configuration fields
134 	 */
135 	int	is_cpr_capable;			/* 0 - False, 1 - True */
136 	int	is_cpr_default;			/* 0 - False, 1 - True */
137 	int	is_autowakeup_capable;		/* 0 - False, 1 - True */
138 	int	as_idle;			/* idle time in min */
139 	int	as_sh;				/* Start_time hour */
140 	int	as_sm;				/* Start_time minutes */
141 	int	as_fh;				/* Finish_time hour */
142 	int	as_fm;				/* Finish_time minute */
143 	char	as_behavior[64];		/* "default","unconfigured", */
144 						/* "shutdown", "autowakeup" */
145 						/*  or "noshutdown" */
146 	int	ttychars_thold;			/* default = 0 */
147 	float	loadaverage_thold;		/* default = 0.04  */
148 	int	diskreads_thold;		/* default = 0 */
149 	int	nfsreqs_thold;			/* default = 0 */
150 	char	idlecheck_path[MAXPATHLEN];	/* default = "" */
151 
152 	/*
153 	 * autopm behavior field
154 	 */
155 	int	is_autopm_default;		/* 0 - False, 1 - True */
156 	char	apm_behavior[64];		/* "enable","disable" or */
157 						/* "default" */
158 };
159 
160 
161 /*
162  * values for cf_type
163  */
164 #define	CFT_UFS		1		/* statefile is ufs file	*/
165 #define	CFT_SPEC	2		/* statefile is special file	*/
166 
167 
168 /*
169  * definitions for kernel, cprboot
170  */
171 #ifdef _KERNEL
172 
173 #include <sys/promif.h>
174 #include <sys/sunddi.h>
175 #include <sys/sysmacros.h>
176 #include <sys/vnode.h>
177 #include <sys/cpr_impl.h>
178 
179 extern int	cpr_debug;
180 
181 #define	errp	prom_printf
182 #define	DPRINT
183 
184 /*
185  * DEBUG1 displays the main flow of CPR. Use it to identify which sub-module
186  *	of CPR causes problems.
187  * DEBUG2 displays minor stuff that normally won't matter.
188  * DEBUG3 displays some big loops (cpr_dump); requires much longer runtime.
189  * DEBUG4 displays lots of cprboot output, cpr_read and page handling.
190  * DEBUG5 various, mostly unique stuff
191  * DEBUG9 displays statistical data for CPR on console (by using printf),
192  *	such as num page invalidated, etc.
193  */
194 #define	LEVEL1		0x1
195 #define	LEVEL2		0x2
196 #define	LEVEL3		0x4
197 #define	LEVEL4		0x8
198 #define	LEVEL5		0x10
199 #define	LEVEL6		0x20
200 #define	LEVEL7		0x40
201 #define	LEVEL8		0x80
202 
203 #define	DEBUG1(p)	{if (cpr_debug & LEVEL1) p; }
204 #define	DEBUG2(p)	{if (cpr_debug & LEVEL2) p; }
205 #define	DEBUG3(p)	{if (cpr_debug & LEVEL3) p; }
206 #define	DEBUG4(p)	{if (cpr_debug & LEVEL4) p; }
207 #define	DEBUG5(p)	{if (cpr_debug & LEVEL5) p; }
208 #define	DEBUG7(p)	{if (cpr_debug & LEVEL7) p; }
209 #define	DEBUG8(p)	{if (cpr_debug & LEVEL8) p; }
210 #define	DEBUG9(p)	{if (cpr_debug & LEVEL6) p; }
211 
212 #define	CPR_DEBUG_BIT(dval)	(1 << (dval - AD_CPR_DEBUG0 - 1))
213 #define	DBG_DONTSHOWRANGE	0
214 #define	DBG_SHOWRANGE		1
215 
216 /*
217  * CPR FILE FORMAT:
218  *
219  * 	Dump Header: general dump data:
220  *		cpr_dump_desc
221  *
222  *	Machdep descriptor: cpr_machdep_desc
223  *	Machdep data: sun4m/sun4u machine dependent info:
224  *		cpr_sun4m_machdep
225  *		cpr_sun4u_machdep, var length prom words
226  *
227  * 	Page Map: bitmap record consisting of a descriptor and data:
228  *		cpr_bitmap_desc
229  *		(char) bitmap[cpr_bitmap_desc.cbd_size]
230  *
231  * 	Page data: Contains one or more physical page records,
232  *		each record consists of a descriptor and data:
233  *		cpr_page_desc
234  *		(char) page_data[cpr_page_desc.cpd_offset]
235  *
236  *	Terminator: end marker
237  *		cpr_terminator
238  *
239  *	NOTE: cprboot now supports both ILP32 and LP64 kernels;
240  *	the size of these structures written to a cpr statefile
241  *	must be the same for ILP32 and LP64.  For details, see
242  *	sun4u/sys/cpr_impl.h
243  */
244 
245 #define	CPR_DUMP_MAGIC		0x44754d70	/* 'DuMp' */
246 #define	CPR_BITMAP_MAGIC	0x42744d70	/* 'BtMp' */
247 #define	CPR_PAGE_MAGIC		0x50614765	/* 'PaGe' */
248 #define	CPR_MACHDEP_MAGIC	0x4d614470	/* 'MaDp' */
249 #define	CPR_TERM_MAGIC		0x5465526d	/* 'TeRm' */
250 
251 /*
252  * header at the begining of the dump data section
253  */
254 struct cpr_dump_desc {
255 	uint_t		cdd_magic;	/* paranoia check */
256 	ushort_t	cdd_version;	/* version number */
257 	ushort_t	cdd_machine;	/* sun4m, sun4u */
258 	int		cdd_bitmaprec;	/* number of bitmap records */
259 	int		cdd_dumppgsize;	/* total # of frames dumped, in pages */
260 	int		cdd_test_mode;	/* true if called by uadmin test mode */
261 	int		cdd_debug;	/* turn on debug in cprboot */
262 	cpr_ext		cdd_filesize;	/* statefile size in bytes */
263 };
264 typedef struct cpr_dump_desc cdd_t;
265 
266 /*
267  * physical memory bitmap descriptor, preceeds the actual bitmap.
268  */
269 struct cpr_bitmap_desc {
270 	uint_t		cbd_magic;	/* so we can spot it better */
271 	pfn_t		cbd_spfn;   	/* starting pfn */
272 	pfn_t		cbd_epfn;	/* ending pfn */
273 	size_t		cbd_size;	/* size of this bitmap, in bytes */
274 	cpr_ptr		cbd_reg_bitmap;	/* regular bitmap */
275 	cpr_ptr		cbd_vlt_bitmap; /* volatile bitmap */
276 	cpr_ptr		cbd_auxmap; 	/* aux bitmap used during thaw */
277 };
278 typedef struct cpr_bitmap_desc cbd_t;
279 
280 /*
281  * Maximum supported bitmap descriptors; 1-2 + null-terminator is common
282  */
283 #define	CPR_MAX_BMDESC	(16 + 1)
284 
285 /*
286  * Describes the contiguous pages saved in the storage area.
287  * To save space data will be compressed before saved.
288  * However some data end up bigger after compression.
289  * In that case, we save the raw data and make a note
290  * of it in the csd_clean_compress field.
291  */
292 struct cpr_storage_desc {
293 	pfn_t		csd_dirty_spfn;		/* starting dirty pfn */
294 	pgcnt_t		csd_dirty_npages;
295 	cpr_ptr		csd_clean_sva;		/* starting clean va */
296 	size_t		csd_clean_sz;
297 	int		csd_clean_compressed;
298 #ifdef DEBUG
299 	uint_t		csd_usum;
300 	uint_t		csd_csum;
301 #endif
302 };
303 typedef struct cpr_storage_desc csd_t;
304 
305 /*
306  * Describes saved pages, preceeds page data;
307  * cpd_lenth len is important when pages are compressed.
308  */
309 struct cpr_page_desc {
310 	uint_t	cpd_magic;	/* so we can spot it better */
311 	pfn_t	cpd_pfn;   	/* kern physical address page # */
312 	pgcnt_t	cpd_pages;	/* number of contiguous pages */
313 	size_t	cpd_length;	/* data segment size in bytes */
314 	uint_t	cpd_flag;	/* see below */
315 	uint_t	cpd_csum;	/* "after compression" checksum */
316 	uint_t	cpd_usum;	/* "before compression" checksum */
317 };
318 typedef struct cpr_page_desc cpd_t;
319 
320 /*
321  * cpd_flag values
322  */
323 #define	CPD_COMPRESS	0x0001	/* set if compressed */
324 #define	CPD_CSUM	0x0002	/* set if "after compression" checsum valid */
325 #define	CPD_USUM	0x0004	/* set if "before compression" checsum valid */
326 
327 /*
328  * machdep header stores the length of the platform specific information
329  * that are used by resume.
330  *
331  * Note: the md_size field is the total length of the machine dependent
332  * information.  This always includes a fixed length section and may
333  * include a variable length section following it on some platforms.
334  */
335 struct cpr_machdep_desc {
336 	uint_t md_magic;	/* paranoia check */
337 	uint_t md_size;		/* the size of the "opaque" data following */
338 };
339 typedef struct cpr_machdep_desc cmd_t;
340 
341 typedef struct timespec32 cpr_time_t;
342 
343 struct cpr_terminator {
344 	uint_t	magic;			/* paranoia check */
345 	size_t	real_statef_size;	/* ...in bytes */
346 	cpr_ptr	va;			/* virtual addr of this struct */
347 	cpr_ext	pfn;			/* phys addr of this struct */
348 	cpr_time_t tm_shutdown;		/* time in milisec when shutdown */
349 	cpr_time_t tm_cprboot_start;	/* time when cprboot starts to run */
350 	cpr_time_t tm_cprboot_end;	/* time before jumping to kernel */
351 };
352 typedef struct cpr_terminator ctrm_t;
353 
354 
355 #define	REGULAR_BITMAP		1
356 #define	VOLATILE_BITMAP		0
357 
358 /*
359  * reference the right bitmap based on the arg descriptor and flag
360  */
361 #define	DESC_TO_MAP(desc, flag)	(flag == REGULAR_BITMAP) ? \
362 	(char *)desc->cbd_reg_bitmap : (char *)desc->cbd_vlt_bitmap
363 /*
364  * checks if a phys page is within the range covered by a bitmap
365  */
366 #define	PPN_IN_RANGE(ppn, desc) \
367 	(ppn <= desc->cbd_epfn && ppn >= desc->cbd_spfn)
368 
369 #define	WRITE_TO_STATEFILE	0
370 #define	SAVE_TO_STORAGE		1
371 #define	STORAGE_DESC_ALLOC	2
372 
373 
374 /*
375  * prom_read() max is 32k
376  * for sun4m, page size is 4k, CPR_MAXCONTIG is 8
377  * for sun4u, page size is 8k, CPR_MAXCONTIG is 4
378  */
379 #define	PROM_MAX_READ	0x8000
380 #define	CPR_MAX_BLOCK	0x8000
381 #define	CPR_MAXCONTIG	(CPR_MAX_BLOCK / MMU_PAGESIZE)
382 
383 #define	PAGE_ROUNDUP(val)	(((val) + MMU_PAGEOFFSET) & MMU_PAGEMASK)
384 
385 /*
386  * converts byte size to bitmap size; 1 bit represents one phys page
387  */
388 #define	BITMAP_BYTES(size)	((size) >> (MMU_PAGESHIFT + 3))
389 
390 
391 /*
392  * redefinitions of uadmin subcommands for A_FREEZE
393  */
394 #define	AD_CPR_COMPRESS		AD_COMPRESS /* store state file compressed */
395 #define	AD_CPR_FORCE		AD_FORCE /* force to do AD_CPR_COMPRESS */
396 #define	AD_CPR_CHECK		AD_CHECK /* test if CPR module is there */
397 #define	AD_CPR_REUSEINIT	AD_REUSEINIT /* write cprinfo file */
398 #define	AD_CPR_REUSABLE		AD_REUSABLE /* create reusable statefile */
399 #define	AD_CPR_REUSEFINI	AD_REUSEFINI /* revert to non-reusable CPR */
400 #define	AD_CPR_TESTHALT		6	/* test mode, halt */
401 #define	AD_CPR_TESTNOZ		7	/* test mode, auto-restart uncompress */
402 #define	AD_CPR_TESTZ		8	/* test mode, auto-restart compress */
403 #define	AD_CPR_PRINT		9	/* print out stats */
404 #define	AD_CPR_NOCOMPRESS	10	/* store state file uncompressed */
405 #define	AD_CPR_DEBUG0		100	/* clear debug flag */
406 #define	AD_CPR_DEBUG1		101	/* display CPR main flow via prom */
407 #define	AD_CPR_DEBUG2		102	/* misc small/mid size loops */
408 #define	AD_CPR_DEBUG3		103	/* exhaustive big loops */
409 #define	AD_CPR_DEBUG4		104	/* debug cprboot */
410 #define	AD_CPR_DEBUG5		105	/* debug machdep part of resume */
411 #define	AD_CPR_DEBUG7		107	/* debug bitmap code */
412 #define	AD_CPR_DEBUG8		108
413 #define	AD_CPR_DEBUG9		109	/* display stat data on console */
414 
415 /*
416  * cprboot related information and definitions.
417  * The statefile names are hardcoded for now.
418  */
419 #define	CPR_DEFAULT		"/.cpr_default"
420 #define	CPR_STATE_FILE		"/.CPR"
421 
422 
423 /*
424  * definitions for CPR statistics
425  */
426 #define	CPR_E_NAMELEN		64
427 #define	CPR_E_MAX_EVENTNUM	64
428 
429 struct cpr_tdata {
430 	time_t	mtime;		/* mean time on this event */
431 	time_t	stime;		/* start time on this event */
432 	time_t	etime;		/* end time on this event */
433 	time_t	ltime;		/* time duration of the last event */
434 };
435 typedef struct cpr_tdata ctd_t;
436 
437 struct cpr_event {
438 	struct	cpr_event *ce_next;	/* next event in the list */
439 	long	ce_ntests;		/* num of the events since loaded */
440 	ctd_t	ce_sec;			/* cpr time in sec on this event */
441 	ctd_t	ce_msec;		/* cpr time in 100*millisec */
442 	char 	ce_name[CPR_E_NAMELEN];
443 };
444 
445 struct cpr_stat {
446 	int	cs_ntests;		/* num of cpr's since loaded */
447 	int	cs_mclustsz;		/* average cluster size: all in bytes */
448 	int	cs_upage2statef;	/* actual # of upages gone to statef */
449 	int	cs_min_comprate;	/* minimum compression ratio * 100 */
450 	pgcnt_t	cs_nosw_pages;		/* # of pages of no backing store */
451 	size_t	cs_nocomp_statefsz;	/* statefile size without compression */
452 	size_t	cs_est_statefsz;	/* estimated statefile size */
453 	size_t	cs_real_statefsz;	/* real statefile size */
454 	size_t	cs_dumped_statefsz;	/* how much has been dumped out */
455 	struct cpr_event *cs_event_head; /* The 1st one in stat event list */
456 	struct cpr_event *cs_event_tail; /* The last one in stat event list */
457 };
458 
459 /*
460  * macros for CPR statistics evaluation
461  */
462 #define	CPR_STAT_EVENT_START(s)		cpr_stat_event_start(s, 0)
463 #define	CPR_STAT_EVENT_END(s)		cpr_stat_event_end(s, 0)
464 /*
465  * use the following is other time zone is required
466  */
467 #define	CPR_STAT_EVENT_START_TMZ(s, t)	cpr_stat_event_start(s, t)
468 #define	CPR_STAT_EVENT_END_TMZ(s, t)	cpr_stat_event_end(s, t)
469 
470 #define	CPR_STAT_EVENT_PRINT		cpr_stat_event_print
471 
472 
473 /*
474  * State Structure for CPR
475  */
476 typedef struct cpr {
477 	uint_t		c_cprboot_magic;
478 	uint_t		c_flags;
479 	int		c_substate;	/* tracking suspend progress */
480 	int		c_fcn;		/* uadmin subcommand */
481 	vnode_t		*c_vp;		/* vnode for statefile */
482 	cbd_t  		*c_bmda;	/* bitmap descriptor array */
483 	caddr_t		c_mapping_area;	/* reserve for dumping kas phys pages */
484 	struct cpr_stat	c_stat;
485 	char		c_alloc_cnt;	/* # of statefile alloc retries */
486 } cpr_t;
487 
488 /*
489  * c_flags definitions
490  */
491 #define	C_SUSPENDING		0x01
492 #define	C_RESUMING		0x02
493 #define	C_COMPRESSING		0x04
494 #define	C_REUSABLE		0x08
495 #define	C_ERROR			0x10
496 
497 extern cpr_t cpr_state;
498 #define	CPR	(&cpr_state)
499 #define	STAT	(&cpr_state.c_stat)
500 
501 /*
502  * definitions for c_substate. It works together w/ c_flags to determine which
503  * stages the CPR is at.
504  */
505 #define	C_ST_SUSPEND_BEGIN		0
506 #define	C_ST_MP_OFFLINE			1
507 #define	C_ST_STOP_USER_THREADS		2
508 #define	C_ST_PM_REATTACH_NOINVOL	3
509 #define	C_ST_DISABLE_UFS_LOGGING	4
510 #define	C_ST_STATEF_ALLOC		5
511 #define	C_ST_SUSPEND_DEVICES		6
512 #define	C_ST_STOP_KERNEL_THREADS	7
513 #define	C_ST_SETPROPS_1			8
514 #define	C_ST_DUMP			9
515 #define	C_ST_SETPROPS_0			10
516 #define	C_ST_DUMP_NOSPC			11
517 #define	C_ST_REUSABLE			12
518 
519 #define	cpr_set_substate(a)	(CPR->c_substate = (a))
520 
521 #define	C_VP		(CPR->c_vp)
522 
523 #define	C_MAX_ALLOC_RETRY	4
524 
525 #define	CPR_PROM_SAVE		0
526 #define	CPR_PROM_RESTORE	1
527 #define	CPR_PROM_FREE		2
528 
529 /*
530  * default/historic size for cpr write buffer
531  */
532 #define	CPRBUFSZ		0x20000
533 
534 /*
535  * cpr statefile I/O on a block device begins after the disk label
536  * and bootblock (primarily for disk slices that start at cyl 0);
537  * the offset should be at least (label size + bootblock size = 8k)
538  */
539 #define	CPR_SPEC_OFFSET		16384
540 
541 typedef int (*bitfunc_t)(pfn_t, int);
542 
543 /*
544  * arena scan info
545  */
546 struct cpr_walkinfo {
547 	int mapflag;
548 	bitfunc_t bitfunc;
549 	pgcnt_t pages;
550 	size_t size;
551 	int ranges;
552 };
553 
554 /*
555  * Value used by cpr, found in devi_cpr_flags
556  */
557 #define	DCF_CPR_SUSPENDED	0x1	/* device went through cpr_suspend */
558 
559 #ifndef _ASM
560 
561 extern char *cpr_build_statefile_path(void);
562 extern char *cpr_enumerate_promprops(char **, size_t *);
563 extern char *cpr_get_statefile_prom_path(void);
564 extern int cpr_clrbit(pfn_t, int);
565 extern int cpr_contig_pages(vnode_t *, int);
566 extern int cpr_default_setup(int);
567 extern int cpr_dump(vnode_t *);
568 extern int cpr_get_reusable_mode(void);
569 extern int cpr_isset(pfn_t, int);
570 extern int cpr_main(void);
571 extern int cpr_mp_offline(void);
572 extern int cpr_mp_online(void);
573 extern int cpr_nobit(pfn_t, int);
574 extern int cpr_open_deffile(int, vnode_t **);
575 extern int cpr_read_cdump(int, cdd_t *, ushort_t);
576 extern int cpr_read_cprinfo(int, char *, char *);
577 extern int cpr_read_machdep(int, caddr_t, size_t);
578 extern int cpr_read_phys_page(int, uint_t, int *);
579 extern int cpr_read_terminator(int, ctrm_t *, caddr_t);
580 extern int cpr_resume_devices(dev_info_t *, int);
581 extern int cpr_set_properties(int);
582 extern int cpr_setbit(pfn_t, int);
583 extern int cpr_statefile_is_spec(void);
584 extern int cpr_statefile_offset(void);
585 extern int cpr_stop_kernel_threads(void);
586 extern int cpr_stop_user_threads(void);
587 extern int cpr_suspend_devices(dev_info_t *);
588 extern int cpr_validate_definfo(int);
589 extern int cpr_write(vnode_t *, caddr_t, size_t);
590 extern int cpr_update_nvram(cprop_t *);
591 extern int cpr_write_deffile(cdef_t *);
592 extern int i_cpr_alloc_bitmaps(void);
593 extern int i_cpr_dump_sensitive_kpages(vnode_t *);
594 extern int i_cpr_save_sensitive_kpages(void);
595 extern pgcnt_t cpr_count_kpages(int, bitfunc_t);
596 extern pgcnt_t cpr_count_pages(caddr_t, size_t, int, bitfunc_t, int);
597 extern pgcnt_t cpr_count_seg_pages(int, bitfunc_t);
598 extern pgcnt_t cpr_count_volatile_pages(int, bitfunc_t);
599 extern pgcnt_t cpr_scan_kvseg(int, bitfunc_t, struct seg *);
600 extern pgcnt_t i_cpr_count_sensitive_kpages(int, bitfunc_t);
601 extern pgcnt_t i_cpr_count_special_kpages(int, bitfunc_t);
602 extern pgcnt_t i_cpr_count_storage_pages(int, bitfunc_t);
603 extern ssize_t cpr_get_machdep_len(int);
604 extern void cpr_clear_definfo(void);
605 extern void cpr_restore_time(void);
606 extern void cpr_save_time(void);
607 extern void cpr_show_range(char *, size_t, int, bitfunc_t, pgcnt_t);
608 extern void cpr_signal_user(int sig);
609 extern void cpr_spinning_bar(void);
610 extern void cpr_start_user_threads(void);
611 extern void cpr_stat_cleanup(void);
612 extern void cpr_stat_event_end(char *, cpr_time_t *);
613 extern void cpr_stat_event_print(void);
614 extern void cpr_stat_event_start(char *, cpr_time_t *);
615 extern void cpr_stat_record_events(void);
616 extern void cpr_tod_get(cpr_time_t *ctp);
617 extern void cpr_tod_fault_reset(void);
618 extern void i_cpr_bitmap_cleanup(void);
619 
620 /*PRINTFLIKE2*/
621 extern void cpr_err(int, const char *, ...) __KPRINTFLIKE(2);
622 
623 extern cpr_time_t wholecycle_tv;
624 extern int cpr_reusable_mode;
625 
626 #endif	/* _ASM */
627 #endif	/* _KERNEL */
628 
629 
630 #ifdef	__cplusplus
631 }
632 #endif
633 
634 #endif	/* _SYS_CPR_H */
635