xref: /titanic_51/usr/src/uts/common/sys/cpr.h (revision c97ad5cdc75eb73e3cc38542ca3ba783574b0a7a)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_CPR_H
27 #define	_SYS_CPR_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #include <sys/obpdefs.h>
36 #include <sys/param.h>
37 #include <sys/mutex.h>
38 #include <sys/uadmin.h>
39 #include <sys/compress.h>
40 #include <sys/archsystm.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 /*
182  * CPR_DEBUG1 displays the main flow of CPR. Use it to identify which
183  * sub-module of CPR causes problems.
184  * CPR_DEBUG2 displays minor stuff that normally won't matter.
185  * CPR_DEBUG3 displays some big loops (cpr_dump); requires much longer runtime.
186  * CPR_DEBUG4 displays lots of cprboot output, cpr_read and page handling.
187  * CPR_DEBUG5 various, mostly unique stuff
188  * CPR_DEBUG9 displays statistical data for CPR on console (by using printf),
189  *	such as num page invalidated, etc.
190  */
191 #define	CPR_DEBUG1	0x1
192 #define	CPR_DEBUG2	0x2
193 #define	CPR_DEBUG3	0x4
194 #define	CPR_DEBUG4	0x8
195 #define	CPR_DEBUG5	0x10
196 #define	CPR_DEBUG6	0x20
197 #define	CPR_DEBUG7	0x40
198 #define	CPR_DEBUG8	0x80
199 #define	CPR_DEBUG9	CPR_DEBUG6
200 
201 #define	CPR_DEBUG(level, ...) if (cpr_debug & level) cpr_dprintf(__VA_ARGS__)
202 
203 #define	CPR_DEBUG_BIT(dval)	(1 << (dval - AD_CPR_DEBUG0 - 1))
204 #define	DBG_DONTSHOWRANGE	0
205 #define	DBG_SHOWRANGE		1
206 
207 /*
208  * CPR FILE FORMAT:
209  *
210  * 	Dump Header: general dump data:
211  *		cpr_dump_desc
212  *
213  *	Machdep descriptor: cpr_machdep_desc
214  *	Machdep data: sun4m/sun4u machine dependent info:
215  *		cpr_sun4m_machdep
216  *		cpr_sun4u_machdep, var length prom words
217  *
218  * 	Page Map: bitmap record consisting of a descriptor and data:
219  *		cpr_bitmap_desc
220  *		(char) bitmap[cpr_bitmap_desc.cbd_size]
221  *
222  * 	Page data: Contains one or more physical page records,
223  *		each record consists of a descriptor and data:
224  *		cpr_page_desc
225  *		(char) page_data[cpr_page_desc.cpd_offset]
226  *
227  *	Terminator: end marker
228  *		cpr_terminator
229  *
230  *	NOTE: cprboot now supports both ILP32 and LP64 kernels;
231  *	the size of these structures written to a cpr statefile
232  *	must be the same for ILP32 and LP64.  For details, see
233  *	sun4u/sys/cpr_impl.h
234  */
235 
236 #define	CPR_DUMP_MAGIC		0x44754d70	/* 'DuMp' */
237 #define	CPR_BITMAP_MAGIC	0x42744d70	/* 'BtMp' */
238 #define	CPR_PAGE_MAGIC		0x50614765	/* 'PaGe' */
239 #define	CPR_MACHDEP_MAGIC	0x4d614470	/* 'MaDp' */
240 #define	CPR_TERM_MAGIC		0x5465526d	/* 'TeRm' */
241 
242 /*
243  * header at the begining of the dump data section
244  */
245 struct cpr_dump_desc {
246 	uint_t		cdd_magic;	/* paranoia check */
247 	ushort_t	cdd_version;	/* version number */
248 	ushort_t	cdd_machine;	/* sun4m, sun4u */
249 	int		cdd_bitmaprec;	/* number of bitmap records */
250 	int		cdd_dumppgsize;	/* total # of frames dumped, in pages */
251 	int		cdd_test_mode;	/* true if called by uadmin test mode */
252 	int		cdd_debug;	/* turn on debug in cprboot */
253 	cpr_ext		cdd_filesize;	/* statefile size in bytes */
254 };
255 typedef struct cpr_dump_desc cdd_t;
256 
257 /*
258  * physical memory bitmap descriptor, preceeds the actual bitmap.
259  */
260 struct cpr_bitmap_desc {
261 	uint_t		cbd_magic;	/* so we can spot it better */
262 	pfn_t		cbd_spfn;   	/* starting pfn */
263 	pfn_t		cbd_epfn;	/* ending pfn */
264 	size_t		cbd_size;	/* size of this bitmap, in bytes */
265 	cpr_ptr		cbd_reg_bitmap;	/* regular bitmap */
266 	cpr_ptr		cbd_vlt_bitmap; /* volatile bitmap */
267 	cpr_ptr		cbd_auxmap; 	/* aux bitmap used during thaw */
268 };
269 typedef struct cpr_bitmap_desc cbd_t;
270 
271 /*
272  * Maximum supported bitmap descriptors; 1-2 + null-terminator is common
273  */
274 #define	CPR_MAX_BMDESC	(16 + 1)
275 
276 /*
277  * Describes the contiguous pages saved in the storage area.
278  * To save space data will be compressed before saved.
279  * However some data end up bigger after compression.
280  * In that case, we save the raw data and make a note
281  * of it in the csd_clean_compress field.
282  */
283 struct cpr_storage_desc {
284 	pfn_t		csd_dirty_spfn;		/* starting dirty pfn */
285 	pgcnt_t		csd_dirty_npages;
286 	cpr_ptr		csd_clean_sva;		/* starting clean va */
287 	size_t		csd_clean_sz;
288 	int		csd_clean_compressed;
289 #ifdef DEBUG
290 	uint_t		csd_usum;
291 	uint_t		csd_csum;
292 #endif
293 };
294 typedef struct cpr_storage_desc csd_t;
295 
296 /*
297  * Describes saved pages, preceeds page data;
298  * cpd_lenth len is important when pages are compressed.
299  */
300 struct cpr_page_desc {
301 	uint_t	cpd_magic;	/* so we can spot it better */
302 	pfn_t	cpd_pfn;   	/* kern physical address page # */
303 	pgcnt_t	cpd_pages;	/* number of contiguous pages */
304 	size_t	cpd_length;	/* data segment size in bytes */
305 	uint_t	cpd_flag;	/* see below */
306 	uint_t	cpd_csum;	/* "after compression" checksum */
307 	uint_t	cpd_usum;	/* "before compression" checksum */
308 };
309 typedef struct cpr_page_desc cpd_t;
310 
311 /*
312  * cpd_flag values
313  */
314 #define	CPD_COMPRESS	0x0001	/* set if compressed */
315 #define	CPD_CSUM	0x0002	/* set if "after compression" checsum valid */
316 #define	CPD_USUM	0x0004	/* set if "before compression" checsum valid */
317 
318 /*
319  * machdep header stores the length of the platform specific information
320  * that are used by resume.
321  *
322  * Note: the md_size field is the total length of the machine dependent
323  * information.  This always includes a fixed length section and may
324  * include a variable length section following it on some platforms.
325  */
326 struct cpr_machdep_desc {
327 	uint_t md_magic;	/* paranoia check */
328 	uint_t md_size;		/* the size of the "opaque" data following */
329 };
330 typedef struct cpr_machdep_desc cmd_t;
331 
332 typedef struct timespec32 cpr_time_t;
333 
334 struct cpr_terminator {
335 	uint_t	magic;			/* paranoia check */
336 	size_t	real_statef_size;	/* ...in bytes */
337 	cpr_ptr	va;			/* virtual addr of this struct */
338 	cpr_ext	pfn;			/* phys addr of this struct */
339 	cpr_time_t tm_shutdown;		/* time in milisec when shutdown */
340 	cpr_time_t tm_cprboot_start;	/* time when cprboot starts to run */
341 	cpr_time_t tm_cprboot_end;	/* time before jumping to kernel */
342 };
343 typedef struct cpr_terminator ctrm_t;
344 
345 
346 #define	REGULAR_BITMAP		1
347 #define	VOLATILE_BITMAP		0
348 
349 /*
350  * reference the right bitmap based on the arg descriptor and flag
351  */
352 #define	DESC_TO_MAP(desc, flag)	(flag == REGULAR_BITMAP) ? \
353 	(char *)desc->cbd_reg_bitmap : (char *)desc->cbd_vlt_bitmap
354 /*
355  * checks if a phys page is within the range covered by a bitmap
356  */
357 #define	PPN_IN_RANGE(ppn, desc) \
358 	(ppn <= desc->cbd_epfn && ppn >= desc->cbd_spfn)
359 
360 #define	WRITE_TO_STATEFILE	0
361 #define	SAVE_TO_STORAGE		1
362 #define	STORAGE_DESC_ALLOC	2
363 
364 
365 /*
366  * prom_read() max is 32k
367  * for sun4m, page size is 4k, CPR_MAXCONTIG is 8
368  * for sun4u, page size is 8k, CPR_MAXCONTIG is 4
369  */
370 #define	PROM_MAX_READ	0x8000
371 #define	CPR_MAX_BLOCK	0x8000
372 #define	CPR_MAXCONTIG	(CPR_MAX_BLOCK / MMU_PAGESIZE)
373 
374 #define	PAGE_ROUNDUP(val)	(((val) + MMU_PAGEOFFSET) & MMU_PAGEMASK)
375 
376 /*
377  * converts byte size to bitmap size; 1 bit represents one phys page
378  */
379 #define	BITMAP_BYTES(size)	((size) >> (MMU_PAGESHIFT + 3))
380 
381 
382 /*
383  * redefinitions of uadmin subcommands for A_FREEZE
384  */
385 #define	AD_CPR_COMPRESS		AD_COMPRESS /* store state file compressed */
386 #define	AD_CPR_FORCE		AD_FORCE /* force to do AD_CPR_COMPRESS */
387 #define	AD_CPR_CHECK		AD_CHECK /* test if CPR module is there */
388 #define	AD_CPR_REUSEINIT	AD_REUSEINIT /* write cprinfo file */
389 #define	AD_CPR_REUSABLE		AD_REUSABLE /* create reusable statefile */
390 #define	AD_CPR_REUSEFINI	AD_REUSEFINI /* revert to non-reusable CPR */
391 #define	AD_CPR_TESTHALT		6	/* test mode, halt */
392 #define	AD_CPR_TESTNOZ		7	/* test mode, auto-restart uncompress */
393 #define	AD_CPR_TESTZ		8	/* test mode, auto-restart compress */
394 #define	AD_CPR_PRINT		9	/* print out stats */
395 #define	AD_CPR_NOCOMPRESS	10	/* store state file uncompressed */
396 #define	AD_CPR_DEBUG0		100	/* clear debug flag */
397 #define	AD_CPR_DEBUG1		101	/* display CPR main flow via prom */
398 #define	AD_CPR_DEBUG2		102	/* misc small/mid size loops */
399 #define	AD_CPR_DEBUG3		103	/* exhaustive big loops */
400 #define	AD_CPR_DEBUG4		104	/* debug cprboot */
401 #define	AD_CPR_DEBUG5		105	/* debug machdep part of resume */
402 #define	AD_CPR_DEBUG7		107	/* debug bitmap code */
403 #define	AD_CPR_DEBUG8		108
404 #define	AD_CPR_DEBUG9		109	/* display stat data on console */
405 
406 /*
407  * cprboot related information and definitions.
408  * The statefile names are hardcoded for now.
409  */
410 #define	CPR_DEFAULT		"/.cpr_default"
411 #define	CPR_STATE_FILE		"/.CPR"
412 
413 
414 /*
415  * definitions for CPR statistics
416  */
417 #define	CPR_E_NAMELEN		64
418 #define	CPR_E_MAX_EVENTNUM	64
419 
420 struct cpr_tdata {
421 	time_t	mtime;		/* mean time on this event */
422 	time_t	stime;		/* start time on this event */
423 	time_t	etime;		/* end time on this event */
424 	time_t	ltime;		/* time duration of the last event */
425 };
426 typedef struct cpr_tdata ctd_t;
427 
428 struct cpr_event {
429 	struct	cpr_event *ce_next;	/* next event in the list */
430 	long	ce_ntests;		/* num of the events since loaded */
431 	ctd_t	ce_sec;			/* cpr time in sec on this event */
432 	ctd_t	ce_msec;		/* cpr time in 100*millisec */
433 	char 	ce_name[CPR_E_NAMELEN];
434 };
435 
436 struct cpr_stat {
437 	int	cs_ntests;		/* num of cpr's since loaded */
438 	int	cs_mclustsz;		/* average cluster size: all in bytes */
439 	int	cs_upage2statef;	/* actual # of upages gone to statef */
440 	int	cs_min_comprate;	/* minimum compression ratio * 100 */
441 	pgcnt_t	cs_nosw_pages;		/* # of pages of no backing store */
442 	size_t	cs_nocomp_statefsz;	/* statefile size without compression */
443 	size_t	cs_est_statefsz;	/* estimated statefile size */
444 	size_t	cs_real_statefsz;	/* real statefile size */
445 	size_t	cs_dumped_statefsz;	/* how much has been dumped out */
446 	struct cpr_event *cs_event_head; /* The 1st one in stat event list */
447 	struct cpr_event *cs_event_tail; /* The last one in stat event list */
448 };
449 
450 /*
451  * macros for CPR statistics evaluation
452  */
453 #define	CPR_STAT_EVENT_START(s)		cpr_stat_event_start(s, 0)
454 #define	CPR_STAT_EVENT_END(s)		cpr_stat_event_end(s, 0)
455 /*
456  * use the following is other time zone is required
457  */
458 #define	CPR_STAT_EVENT_START_TMZ(s, t)	cpr_stat_event_start(s, t)
459 #define	CPR_STAT_EVENT_END_TMZ(s, t)	cpr_stat_event_end(s, t)
460 
461 #define	CPR_STAT_EVENT_PRINT		cpr_stat_event_print
462 
463 
464 /*
465  * State Structure for CPR
466  */
467 typedef struct cpr {
468 	uint_t		c_cprboot_magic;
469 	uint_t		c_flags;
470 	int		c_substate;	/* tracking suspend progress */
471 	int		c_fcn;		/* uadmin subcommand */
472 	vnode_t		*c_vp;		/* vnode for statefile */
473 	cbd_t  		*c_bmda;	/* bitmap descriptor array */
474 	caddr_t		c_mapping_area;	/* reserve for dumping kas phys pages */
475 	struct cpr_stat	c_stat;
476 	char		c_alloc_cnt;	/* # of statefile alloc retries */
477 } cpr_t;
478 
479 /*
480  * c_flags definitions
481  */
482 #define	C_SUSPENDING		0x01
483 #define	C_RESUMING		0x02
484 #define	C_COMPRESSING		0x04
485 #define	C_REUSABLE		0x08
486 #define	C_ERROR			0x10
487 
488 extern cpr_t cpr_state;
489 #define	CPR	(&cpr_state)
490 #define	STAT	(&cpr_state.c_stat)
491 
492 /*
493  * definitions for c_substate. It works together w/ c_flags to determine which
494  * stages the CPR is at.
495  */
496 #define	C_ST_SUSPEND_BEGIN		0
497 #define	C_ST_MP_OFFLINE			1
498 #define	C_ST_STOP_USER_THREADS		2
499 #define	C_ST_PM_REATTACH_NOINVOL	3
500 #define	C_ST_DISABLE_UFS_LOGGING	4
501 #define	C_ST_STATEF_ALLOC		5
502 #define	C_ST_SUSPEND_DEVICES		6
503 #define	C_ST_STOP_KERNEL_THREADS	7
504 #define	C_ST_SETPROPS_1			8
505 #define	C_ST_DUMP			9
506 #define	C_ST_SETPROPS_0			10
507 #define	C_ST_DUMP_NOSPC			11
508 #define	C_ST_REUSABLE			12
509 
510 #define	cpr_set_substate(a)	(CPR->c_substate = (a))
511 
512 #define	C_VP		(CPR->c_vp)
513 
514 #define	C_MAX_ALLOC_RETRY	4
515 
516 #define	CPR_PROM_SAVE		0
517 #define	CPR_PROM_RESTORE	1
518 #define	CPR_PROM_FREE		2
519 
520 /*
521  * default/historic size for cpr write buffer
522  */
523 #define	CPRBUFSZ		0x20000
524 
525 /*
526  * cpr statefile I/O on a block device begins after the disk label
527  * and bootblock (primarily for disk slices that start at cyl 0);
528  * the offset should be at least (label size + bootblock size = 8k)
529  */
530 #define	CPR_SPEC_OFFSET		16384
531 
532 typedef int (*bitfunc_t)(pfn_t, int);
533 
534 /*
535  * arena scan info
536  */
537 struct cpr_walkinfo {
538 	int mapflag;
539 	bitfunc_t bitfunc;
540 	pgcnt_t pages;
541 	size_t size;
542 	int ranges;
543 };
544 
545 /*
546  * Value used by cpr, found in devi_cpr_flags
547  */
548 #define	DCF_CPR_SUSPENDED	0x1	/* device went through cpr_suspend */
549 
550 #ifndef _ASM
551 
552 extern char *cpr_build_statefile_path(void);
553 extern char *cpr_enumerate_promprops(char **, size_t *);
554 extern char *cpr_get_statefile_prom_path(void);
555 extern int cpr_clrbit(pfn_t, int);
556 extern int cpr_contig_pages(vnode_t *, int);
557 extern int cpr_default_setup(int);
558 extern int cpr_dump(vnode_t *);
559 extern int cpr_get_reusable_mode(void);
560 extern int cpr_isset(pfn_t, int);
561 extern int cpr_main(void);
562 extern int cpr_mp_offline(void);
563 extern int cpr_mp_online(void);
564 extern int cpr_nobit(pfn_t, int);
565 extern int cpr_open_deffile(int, vnode_t **);
566 extern int cpr_read_cdump(int, cdd_t *, ushort_t);
567 extern int cpr_read_cprinfo(int, char *, char *);
568 extern int cpr_read_machdep(int, caddr_t, size_t);
569 extern int cpr_read_phys_page(int, uint_t, int *);
570 extern int cpr_read_terminator(int, ctrm_t *, caddr_t);
571 extern int cpr_resume_devices(dev_info_t *, int);
572 extern int cpr_set_properties(int);
573 extern int cpr_setbit(pfn_t, int);
574 extern int cpr_statefile_is_spec(void);
575 extern int cpr_statefile_offset(void);
576 extern int cpr_stop_kernel_threads(void);
577 extern int cpr_stop_user_threads(void);
578 extern int cpr_suspend_devices(dev_info_t *);
579 extern int cpr_validate_definfo(int);
580 extern int cpr_write(vnode_t *, caddr_t, size_t);
581 extern int cpr_update_nvram(cprop_t *);
582 extern int cpr_write_deffile(cdef_t *);
583 extern int i_cpr_alloc_bitmaps(void);
584 extern int i_cpr_dump_sensitive_kpages(vnode_t *);
585 extern int i_cpr_save_sensitive_kpages(void);
586 extern pgcnt_t cpr_count_kpages(int, bitfunc_t);
587 extern pgcnt_t cpr_count_pages(caddr_t, size_t, int, bitfunc_t, int);
588 extern pgcnt_t cpr_count_seg_pages(int, bitfunc_t);
589 extern pgcnt_t cpr_count_volatile_pages(int, bitfunc_t);
590 extern pgcnt_t cpr_scan_kvseg(int, bitfunc_t, struct seg *);
591 extern pgcnt_t i_cpr_count_sensitive_kpages(int, bitfunc_t);
592 extern pgcnt_t i_cpr_count_special_kpages(int, bitfunc_t);
593 extern pgcnt_t i_cpr_count_storage_pages(int, bitfunc_t);
594 extern ssize_t cpr_get_machdep_len(int);
595 extern void cpr_clear_definfo(void);
596 extern void cpr_restore_time(void);
597 extern void cpr_save_time(void);
598 extern void cpr_show_range(char *, size_t, int, bitfunc_t, pgcnt_t);
599 extern void cpr_signal_user(int sig);
600 extern void cpr_spinning_bar(void);
601 extern void cpr_start_user_threads(void);
602 extern void cpr_stat_cleanup(void);
603 extern void cpr_stat_event_end(char *, cpr_time_t *);
604 extern void cpr_stat_event_print(void);
605 extern void cpr_stat_event_start(char *, cpr_time_t *);
606 extern void cpr_stat_record_events(void);
607 extern void cpr_tod_get(cpr_time_t *ctp);
608 extern void cpr_tod_fault_reset(void);
609 extern void i_cpr_bitmap_cleanup(void);
610 
611 /*PRINTFLIKE2*/
612 extern void cpr_err(int, const char *, ...) __KPRINTFLIKE(2);
613 
614 extern cpr_time_t wholecycle_tv;
615 extern int cpr_reusable_mode;
616 
617 #endif	/* _ASM */
618 #endif	/* _KERNEL */
619 
620 
621 #ifdef	__cplusplus
622 }
623 #endif
624 
625 #endif	/* _SYS_CPR_H */
626