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