17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5ae115bc7Smrj * Common Development and Distribution License (the "License"). 6ae115bc7Smrj * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*8fc99e42STrevor Thompson * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_CPR_H 277c478bd9Sstevel@tonic-gate #define _SYS_CPR_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifdef __cplusplus 307c478bd9Sstevel@tonic-gate extern "C" { 317c478bd9Sstevel@tonic-gate #endif 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #include <sys/obpdefs.h> 347c478bd9Sstevel@tonic-gate #include <sys/param.h> 357c478bd9Sstevel@tonic-gate #include <sys/mutex.h> 367c478bd9Sstevel@tonic-gate #include <sys/uadmin.h> 377c478bd9Sstevel@tonic-gate #include <sys/compress.h> 38ae115bc7Smrj #include <sys/archsystm.h> 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate /* 417c478bd9Sstevel@tonic-gate * definitions for kernel, cprboot, pmconfig 427c478bd9Sstevel@tonic-gate */ 437c478bd9Sstevel@tonic-gate #define CPR_VERSION 6 447c478bd9Sstevel@tonic-gate #define CPR_CONFIG "/etc/.cpr_config" 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate /* 487c478bd9Sstevel@tonic-gate * magic numbers for cpr files 497c478bd9Sstevel@tonic-gate */ 507c478bd9Sstevel@tonic-gate #define CPR_CONFIG_MAGIC 0x436E4667 /* 'CnFg' */ 517c478bd9Sstevel@tonic-gate #define CPR_DEFAULT_MAGIC 0x44664C74 /* 'DfLt' */ 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate /* 547c478bd9Sstevel@tonic-gate * max(strlen("true"), strlen("false")) + 1 557c478bd9Sstevel@tonic-gate */ 567c478bd9Sstevel@tonic-gate #define PROP_BOOL_LEN 6 577c478bd9Sstevel@tonic-gate #define PROP_MOD 'Y' 587c478bd9Sstevel@tonic-gate #define PROP_NOMOD 'N' 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate /* 617c478bd9Sstevel@tonic-gate * max property name length used 627c478bd9Sstevel@tonic-gate * max property count 637c478bd9Sstevel@tonic-gate */ 647c478bd9Sstevel@tonic-gate #define CPR_MAXPLEN 15 657c478bd9Sstevel@tonic-gate #define CPR_MAXPROP 5 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate /* 687c478bd9Sstevel@tonic-gate * name/value of nvram properties 697c478bd9Sstevel@tonic-gate */ 707c478bd9Sstevel@tonic-gate struct cpr_prop_info { 717c478bd9Sstevel@tonic-gate char mod; 727c478bd9Sstevel@tonic-gate char name[CPR_MAXPLEN]; 737c478bd9Sstevel@tonic-gate char value[OBP_MAXPATHLEN]; 747c478bd9Sstevel@tonic-gate }; 757c478bd9Sstevel@tonic-gate typedef struct cpr_prop_info cprop_t; 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate struct cpr_default_mini { 787c478bd9Sstevel@tonic-gate int magic; /* magic word for booter */ 797c478bd9Sstevel@tonic-gate int reusable; /* true if resuable statefile */ 807c478bd9Sstevel@tonic-gate }; 817c478bd9Sstevel@tonic-gate typedef struct cpr_default_mini cmini_t; 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate struct cpr_default_info { 847c478bd9Sstevel@tonic-gate cmini_t mini; 857c478bd9Sstevel@tonic-gate cprop_t props[CPR_MAXPROP]; /* nvram property info */ 867c478bd9Sstevel@tonic-gate }; 877c478bd9Sstevel@tonic-gate typedef struct cpr_default_info cdef_t; 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate /* 917c478bd9Sstevel@tonic-gate * Configuration info provided by user via pmconfig. 927c478bd9Sstevel@tonic-gate * 937c478bd9Sstevel@tonic-gate * The first part (cf_type, cf_path, cf_fs, cf_devfs, cf_dev_prom) 947c478bd9Sstevel@tonic-gate * is used by both the cpr kernel module and cpr booter program 957c478bd9Sstevel@tonic-gate * to locate the statefile. 967c478bd9Sstevel@tonic-gate * 977c478bd9Sstevel@tonic-gate * cf_type CFT_UFS 987c478bd9Sstevel@tonic-gate * cf_path (path within file system) ".CPR" 997c478bd9Sstevel@tonic-gate * cf_fs (mount point for the statefile's filesystem) "/export/home" 1007c478bd9Sstevel@tonic-gate * cf_devfs (devfs path of disk parition mounted there) "/dev/dsk/c0t0d0s7" 1017c478bd9Sstevel@tonic-gate * cf_dev_prom (prom device path of the above disk partition) 1027c478bd9Sstevel@tonic-gate * "/sbus/espdma/dma/sd@0:h" 1037c478bd9Sstevel@tonic-gate * 1047c478bd9Sstevel@tonic-gate * If the statefile were on a character special device (/dev//rdsk/c0t1d0s7), 1057c478bd9Sstevel@tonic-gate * the fields would have the typical values shown below: 1067c478bd9Sstevel@tonic-gate * 1077c478bd9Sstevel@tonic-gate * cf_type CFT_SPEC 1087c478bd9Sstevel@tonic-gate * cf_path ignored 1097c478bd9Sstevel@tonic-gate * cf_fs ignored 1107c478bd9Sstevel@tonic-gate * cf_devfs /dev/rdsk/c1t0d0s7 1117c478bd9Sstevel@tonic-gate * cf_dev_prom (prom device path of the above special file) 1127c478bd9Sstevel@tonic-gate * "/sbus/espdma/dma/sd@1:h" 1137c478bd9Sstevel@tonic-gate * 114e7cbe64fSgw25295 * If the statefile is on a zvol, the fields would have these values: 115e7cbe64fSgw25295 * 116e7cbe64fSgw25295 * cf_type CFT_ZVOL 117e7cbe64fSgw25295 * cf_path ignored 118e7cbe64fSgw25295 * cf_fs (the zvol name e.g. "dump" portion of rootpool/dump) 119e7cbe64fSgw25295 * cf_devfs (devfs path) "/dev/zvol/dsk/<pool>/<zvol>" 120e7cbe64fSgw25295 * cf_dev_prom (prom device path of the above special file) 121e7cbe64fSgw25295 * e.g. "/sbus/espdma/dma/sd@1:h" 122e7cbe64fSgw25295 * 1237c478bd9Sstevel@tonic-gate * The rest of the fields are autoshutdown and autopm configuration related. 1247c478bd9Sstevel@tonic-gate * They are updated by pmconfig and consumed by both powerd and dtpower. 1257c478bd9Sstevel@tonic-gate */ 1267c478bd9Sstevel@tonic-gate 1277c478bd9Sstevel@tonic-gate struct cprconfig { 1287c478bd9Sstevel@tonic-gate int cf_magic; /* magic word for */ 1297c478bd9Sstevel@tonic-gate /* booter to verify */ 1307c478bd9Sstevel@tonic-gate int cf_type; /* CFT_UFS or CFT_SPEC */ 1317c478bd9Sstevel@tonic-gate char cf_path[MAXNAMELEN]; /* fs-relative path */ 1327c478bd9Sstevel@tonic-gate /* for the state file */ 1337c478bd9Sstevel@tonic-gate char cf_fs[MAXNAMELEN]; /* mount point for fs */ 1347c478bd9Sstevel@tonic-gate /* holding state file */ 1357c478bd9Sstevel@tonic-gate char cf_devfs[MAXNAMELEN]; /* path to device node */ 1367c478bd9Sstevel@tonic-gate /* for above mount pt. */ 1377c478bd9Sstevel@tonic-gate char cf_dev_prom[OBP_MAXPATHLEN]; /* full device path of */ 1387c478bd9Sstevel@tonic-gate /* above filesystem */ 1397c478bd9Sstevel@tonic-gate /* 1407c478bd9Sstevel@tonic-gate * autoshutdown configuration fields 1417c478bd9Sstevel@tonic-gate */ 1427c478bd9Sstevel@tonic-gate int is_cpr_capable; /* 0 - False, 1 - True */ 1437c478bd9Sstevel@tonic-gate int is_cpr_default; /* 0 - False, 1 - True */ 1447c478bd9Sstevel@tonic-gate int is_autowakeup_capable; /* 0 - False, 1 - True */ 1457c478bd9Sstevel@tonic-gate int as_idle; /* idle time in min */ 1467c478bd9Sstevel@tonic-gate int as_sh; /* Start_time hour */ 1477c478bd9Sstevel@tonic-gate int as_sm; /* Start_time minutes */ 1487c478bd9Sstevel@tonic-gate int as_fh; /* Finish_time hour */ 1497c478bd9Sstevel@tonic-gate int as_fm; /* Finish_time minute */ 1507c478bd9Sstevel@tonic-gate char as_behavior[64]; /* "default","unconfigured", */ 1517c478bd9Sstevel@tonic-gate /* "shutdown", "autowakeup" */ 1527c478bd9Sstevel@tonic-gate /* or "noshutdown" */ 1537c478bd9Sstevel@tonic-gate int ttychars_thold; /* default = 0 */ 1547c478bd9Sstevel@tonic-gate float loadaverage_thold; /* default = 0.04 */ 1557c478bd9Sstevel@tonic-gate int diskreads_thold; /* default = 0 */ 1567c478bd9Sstevel@tonic-gate int nfsreqs_thold; /* default = 0 */ 1577c478bd9Sstevel@tonic-gate char idlecheck_path[MAXPATHLEN]; /* default = "" */ 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate /* 1607c478bd9Sstevel@tonic-gate * autopm behavior field 1617c478bd9Sstevel@tonic-gate */ 1627c478bd9Sstevel@tonic-gate int is_autopm_default; /* 0 - False, 1 - True */ 1637c478bd9Sstevel@tonic-gate char apm_behavior[64]; /* "enable","disable" or */ 1647c478bd9Sstevel@tonic-gate /* "default" */ 1657c478bd9Sstevel@tonic-gate }; 1667c478bd9Sstevel@tonic-gate 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate /* 1697c478bd9Sstevel@tonic-gate * values for cf_type 1707c478bd9Sstevel@tonic-gate */ 1717c478bd9Sstevel@tonic-gate #define CFT_UFS 1 /* statefile is ufs file */ 1727c478bd9Sstevel@tonic-gate #define CFT_SPEC 2 /* statefile is special file */ 173e7cbe64fSgw25295 #define CFT_ZVOL 3 /* statefile is a zvol */ 1747c478bd9Sstevel@tonic-gate 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate /* 1777c478bd9Sstevel@tonic-gate * definitions for kernel, cprboot 1787c478bd9Sstevel@tonic-gate */ 1797c478bd9Sstevel@tonic-gate #ifdef _KERNEL 1807c478bd9Sstevel@tonic-gate 1817c478bd9Sstevel@tonic-gate #include <sys/promif.h> 1827c478bd9Sstevel@tonic-gate #include <sys/sunddi.h> 1837c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h> 1847c478bd9Sstevel@tonic-gate #include <sys/vnode.h> 1857c478bd9Sstevel@tonic-gate #include <sys/cpr_impl.h> 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate extern int cpr_debug; 1887c478bd9Sstevel@tonic-gate 1892df1fe9cSrandyf #define errp prom_printf 1902df1fe9cSrandyf #define DPRINT 1912df1fe9cSrandyf 1927c478bd9Sstevel@tonic-gate /* 193ae115bc7Smrj * CPR_DEBUG1 displays the main flow of CPR. Use it to identify which 194ae115bc7Smrj * sub-module of CPR causes problems. 195ae115bc7Smrj * CPR_DEBUG2 displays minor stuff that normally won't matter. 196ae115bc7Smrj * CPR_DEBUG3 displays some big loops (cpr_dump); requires much longer runtime. 197ae115bc7Smrj * CPR_DEBUG4 displays lots of cprboot output, cpr_read and page handling. 198ae115bc7Smrj * CPR_DEBUG5 various, mostly unique stuff 199ae115bc7Smrj * CPR_DEBUG9 displays statistical data for CPR on console (by using printf), 2007c478bd9Sstevel@tonic-gate * such as num page invalidated, etc. 2017c478bd9Sstevel@tonic-gate */ 202ae115bc7Smrj #define CPR_DEBUG1 0x1 203ae115bc7Smrj #define CPR_DEBUG2 0x2 204ae115bc7Smrj #define CPR_DEBUG3 0x4 205ae115bc7Smrj #define CPR_DEBUG4 0x8 206ae115bc7Smrj #define CPR_DEBUG5 0x10 207ae115bc7Smrj #define CPR_DEBUG6 0x20 208ae115bc7Smrj #define CPR_DEBUG7 0x40 209ae115bc7Smrj #define CPR_DEBUG8 0x80 210ae115bc7Smrj #define CPR_DEBUG9 CPR_DEBUG6 2117c478bd9Sstevel@tonic-gate 212ae115bc7Smrj #define CPR_DEBUG(level, ...) if (cpr_debug & level) cpr_dprintf(__VA_ARGS__) 2137c478bd9Sstevel@tonic-gate 2147c478bd9Sstevel@tonic-gate #define CPR_DEBUG_BIT(dval) (1 << (dval - AD_CPR_DEBUG0 - 1)) 2157c478bd9Sstevel@tonic-gate #define DBG_DONTSHOWRANGE 0 2167c478bd9Sstevel@tonic-gate #define DBG_SHOWRANGE 1 2177c478bd9Sstevel@tonic-gate 2187c478bd9Sstevel@tonic-gate /* 2197c478bd9Sstevel@tonic-gate * CPR FILE FORMAT: 2207c478bd9Sstevel@tonic-gate * 2217c478bd9Sstevel@tonic-gate * Dump Header: general dump data: 2227c478bd9Sstevel@tonic-gate * cpr_dump_desc 2237c478bd9Sstevel@tonic-gate * 2247c478bd9Sstevel@tonic-gate * Machdep descriptor: cpr_machdep_desc 2257c478bd9Sstevel@tonic-gate * Machdep data: sun4m/sun4u machine dependent info: 2267c478bd9Sstevel@tonic-gate * cpr_sun4m_machdep 2277c478bd9Sstevel@tonic-gate * cpr_sun4u_machdep, var length prom words 2287c478bd9Sstevel@tonic-gate * 2297c478bd9Sstevel@tonic-gate * Page Map: bitmap record consisting of a descriptor and data: 2307c478bd9Sstevel@tonic-gate * cpr_bitmap_desc 2317c478bd9Sstevel@tonic-gate * (char) bitmap[cpr_bitmap_desc.cbd_size] 2327c478bd9Sstevel@tonic-gate * 2337c478bd9Sstevel@tonic-gate * Page data: Contains one or more physical page records, 2347c478bd9Sstevel@tonic-gate * each record consists of a descriptor and data: 2357c478bd9Sstevel@tonic-gate * cpr_page_desc 2367c478bd9Sstevel@tonic-gate * (char) page_data[cpr_page_desc.cpd_offset] 2377c478bd9Sstevel@tonic-gate * 2387c478bd9Sstevel@tonic-gate * Terminator: end marker 2397c478bd9Sstevel@tonic-gate * cpr_terminator 2407c478bd9Sstevel@tonic-gate * 2417c478bd9Sstevel@tonic-gate * NOTE: cprboot now supports both ILP32 and LP64 kernels; 2427c478bd9Sstevel@tonic-gate * the size of these structures written to a cpr statefile 2437c478bd9Sstevel@tonic-gate * must be the same for ILP32 and LP64. For details, see 2447c478bd9Sstevel@tonic-gate * sun4u/sys/cpr_impl.h 2457c478bd9Sstevel@tonic-gate */ 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate #define CPR_DUMP_MAGIC 0x44754d70 /* 'DuMp' */ 2487c478bd9Sstevel@tonic-gate #define CPR_BITMAP_MAGIC 0x42744d70 /* 'BtMp' */ 2497c478bd9Sstevel@tonic-gate #define CPR_PAGE_MAGIC 0x50614765 /* 'PaGe' */ 2507c478bd9Sstevel@tonic-gate #define CPR_MACHDEP_MAGIC 0x4d614470 /* 'MaDp' */ 2517c478bd9Sstevel@tonic-gate #define CPR_TERM_MAGIC 0x5465526d /* 'TeRm' */ 2527c478bd9Sstevel@tonic-gate 2537c478bd9Sstevel@tonic-gate /* 2547c478bd9Sstevel@tonic-gate * header at the begining of the dump data section 2557c478bd9Sstevel@tonic-gate */ 2567c478bd9Sstevel@tonic-gate struct cpr_dump_desc { 2577c478bd9Sstevel@tonic-gate uint_t cdd_magic; /* paranoia check */ 2587c478bd9Sstevel@tonic-gate ushort_t cdd_version; /* version number */ 2597c478bd9Sstevel@tonic-gate ushort_t cdd_machine; /* sun4m, sun4u */ 2607c478bd9Sstevel@tonic-gate int cdd_bitmaprec; /* number of bitmap records */ 2617c478bd9Sstevel@tonic-gate int cdd_dumppgsize; /* total # of frames dumped, in pages */ 2627c478bd9Sstevel@tonic-gate int cdd_test_mode; /* true if called by uadmin test mode */ 2637c478bd9Sstevel@tonic-gate int cdd_debug; /* turn on debug in cprboot */ 2647c478bd9Sstevel@tonic-gate cpr_ext cdd_filesize; /* statefile size in bytes */ 2657c478bd9Sstevel@tonic-gate }; 2667c478bd9Sstevel@tonic-gate typedef struct cpr_dump_desc cdd_t; 2677c478bd9Sstevel@tonic-gate 2687c478bd9Sstevel@tonic-gate /* 2697c478bd9Sstevel@tonic-gate * physical memory bitmap descriptor, preceeds the actual bitmap. 2707c478bd9Sstevel@tonic-gate */ 2717c478bd9Sstevel@tonic-gate struct cpr_bitmap_desc { 2727c478bd9Sstevel@tonic-gate uint_t cbd_magic; /* so we can spot it better */ 2737c478bd9Sstevel@tonic-gate pfn_t cbd_spfn; /* starting pfn */ 2747c478bd9Sstevel@tonic-gate pfn_t cbd_epfn; /* ending pfn */ 2757c478bd9Sstevel@tonic-gate size_t cbd_size; /* size of this bitmap, in bytes */ 2767c478bd9Sstevel@tonic-gate cpr_ptr cbd_reg_bitmap; /* regular bitmap */ 2777c478bd9Sstevel@tonic-gate cpr_ptr cbd_vlt_bitmap; /* volatile bitmap */ 2787c478bd9Sstevel@tonic-gate cpr_ptr cbd_auxmap; /* aux bitmap used during thaw */ 2797c478bd9Sstevel@tonic-gate }; 2807c478bd9Sstevel@tonic-gate typedef struct cpr_bitmap_desc cbd_t; 2817c478bd9Sstevel@tonic-gate 2827c478bd9Sstevel@tonic-gate /* 2837c478bd9Sstevel@tonic-gate * Maximum supported bitmap descriptors; 1-2 + null-terminator is common 2847c478bd9Sstevel@tonic-gate */ 2857c478bd9Sstevel@tonic-gate #define CPR_MAX_BMDESC (16 + 1) 2867c478bd9Sstevel@tonic-gate 2877c478bd9Sstevel@tonic-gate /* 2887c478bd9Sstevel@tonic-gate * Describes the contiguous pages saved in the storage area. 2897c478bd9Sstevel@tonic-gate * To save space data will be compressed before saved. 2907c478bd9Sstevel@tonic-gate * However some data end up bigger after compression. 2917c478bd9Sstevel@tonic-gate * In that case, we save the raw data and make a note 2927c478bd9Sstevel@tonic-gate * of it in the csd_clean_compress field. 2937c478bd9Sstevel@tonic-gate */ 2947c478bd9Sstevel@tonic-gate struct cpr_storage_desc { 2957c478bd9Sstevel@tonic-gate pfn_t csd_dirty_spfn; /* starting dirty pfn */ 2967c478bd9Sstevel@tonic-gate pgcnt_t csd_dirty_npages; 2977c478bd9Sstevel@tonic-gate cpr_ptr csd_clean_sva; /* starting clean va */ 2987c478bd9Sstevel@tonic-gate size_t csd_clean_sz; 2997c478bd9Sstevel@tonic-gate int csd_clean_compressed; 3007c478bd9Sstevel@tonic-gate #ifdef DEBUG 3017c478bd9Sstevel@tonic-gate uint_t csd_usum; 3027c478bd9Sstevel@tonic-gate uint_t csd_csum; 3037c478bd9Sstevel@tonic-gate #endif 3047c478bd9Sstevel@tonic-gate }; 3057c478bd9Sstevel@tonic-gate typedef struct cpr_storage_desc csd_t; 3067c478bd9Sstevel@tonic-gate 3077c478bd9Sstevel@tonic-gate /* 3087c478bd9Sstevel@tonic-gate * Describes saved pages, preceeds page data; 3097c478bd9Sstevel@tonic-gate * cpd_lenth len is important when pages are compressed. 3107c478bd9Sstevel@tonic-gate */ 3117c478bd9Sstevel@tonic-gate struct cpr_page_desc { 3127c478bd9Sstevel@tonic-gate uint_t cpd_magic; /* so we can spot it better */ 3137c478bd9Sstevel@tonic-gate pfn_t cpd_pfn; /* kern physical address page # */ 3147c478bd9Sstevel@tonic-gate pgcnt_t cpd_pages; /* number of contiguous pages */ 3157c478bd9Sstevel@tonic-gate size_t cpd_length; /* data segment size in bytes */ 3167c478bd9Sstevel@tonic-gate uint_t cpd_flag; /* see below */ 3177c478bd9Sstevel@tonic-gate uint_t cpd_csum; /* "after compression" checksum */ 3187c478bd9Sstevel@tonic-gate uint_t cpd_usum; /* "before compression" checksum */ 3197c478bd9Sstevel@tonic-gate }; 3207c478bd9Sstevel@tonic-gate typedef struct cpr_page_desc cpd_t; 3217c478bd9Sstevel@tonic-gate 3227c478bd9Sstevel@tonic-gate /* 3237c478bd9Sstevel@tonic-gate * cpd_flag values 3247c478bd9Sstevel@tonic-gate */ 3257c478bd9Sstevel@tonic-gate #define CPD_COMPRESS 0x0001 /* set if compressed */ 3267c478bd9Sstevel@tonic-gate #define CPD_CSUM 0x0002 /* set if "after compression" checsum valid */ 3277c478bd9Sstevel@tonic-gate #define CPD_USUM 0x0004 /* set if "before compression" checsum valid */ 3287c478bd9Sstevel@tonic-gate 3297c478bd9Sstevel@tonic-gate /* 3307c478bd9Sstevel@tonic-gate * machdep header stores the length of the platform specific information 3317c478bd9Sstevel@tonic-gate * that are used by resume. 3327c478bd9Sstevel@tonic-gate * 3337c478bd9Sstevel@tonic-gate * Note: the md_size field is the total length of the machine dependent 3347c478bd9Sstevel@tonic-gate * information. This always includes a fixed length section and may 3357c478bd9Sstevel@tonic-gate * include a variable length section following it on some platforms. 3367c478bd9Sstevel@tonic-gate */ 3377c478bd9Sstevel@tonic-gate struct cpr_machdep_desc { 3387c478bd9Sstevel@tonic-gate uint_t md_magic; /* paranoia check */ 3397c478bd9Sstevel@tonic-gate uint_t md_size; /* the size of the "opaque" data following */ 3407c478bd9Sstevel@tonic-gate }; 3417c478bd9Sstevel@tonic-gate typedef struct cpr_machdep_desc cmd_t; 3427c478bd9Sstevel@tonic-gate 3437c478bd9Sstevel@tonic-gate typedef struct timespec32 cpr_time_t; 3447c478bd9Sstevel@tonic-gate 3457c478bd9Sstevel@tonic-gate struct cpr_terminator { 3467c478bd9Sstevel@tonic-gate uint_t magic; /* paranoia check */ 3477c478bd9Sstevel@tonic-gate size_t real_statef_size; /* ...in bytes */ 3487c478bd9Sstevel@tonic-gate cpr_ptr va; /* virtual addr of this struct */ 3497c478bd9Sstevel@tonic-gate cpr_ext pfn; /* phys addr of this struct */ 3507c478bd9Sstevel@tonic-gate cpr_time_t tm_shutdown; /* time in milisec when shutdown */ 3517c478bd9Sstevel@tonic-gate cpr_time_t tm_cprboot_start; /* time when cprboot starts to run */ 3527c478bd9Sstevel@tonic-gate cpr_time_t tm_cprboot_end; /* time before jumping to kernel */ 3537c478bd9Sstevel@tonic-gate }; 3547c478bd9Sstevel@tonic-gate typedef struct cpr_terminator ctrm_t; 3557c478bd9Sstevel@tonic-gate 3567c478bd9Sstevel@tonic-gate 3577c478bd9Sstevel@tonic-gate #define REGULAR_BITMAP 1 3587c478bd9Sstevel@tonic-gate #define VOLATILE_BITMAP 0 3597c478bd9Sstevel@tonic-gate 3607c478bd9Sstevel@tonic-gate /* 3617c478bd9Sstevel@tonic-gate * reference the right bitmap based on the arg descriptor and flag 3627c478bd9Sstevel@tonic-gate */ 3637c478bd9Sstevel@tonic-gate #define DESC_TO_MAP(desc, flag) (flag == REGULAR_BITMAP) ? \ 3647c478bd9Sstevel@tonic-gate (char *)desc->cbd_reg_bitmap : (char *)desc->cbd_vlt_bitmap 3657c478bd9Sstevel@tonic-gate /* 3667c478bd9Sstevel@tonic-gate * checks if a phys page is within the range covered by a bitmap 3677c478bd9Sstevel@tonic-gate */ 3687c478bd9Sstevel@tonic-gate #define PPN_IN_RANGE(ppn, desc) \ 3697c478bd9Sstevel@tonic-gate (ppn <= desc->cbd_epfn && ppn >= desc->cbd_spfn) 3707c478bd9Sstevel@tonic-gate 3717c478bd9Sstevel@tonic-gate #define WRITE_TO_STATEFILE 0 3727c478bd9Sstevel@tonic-gate #define SAVE_TO_STORAGE 1 3737c478bd9Sstevel@tonic-gate #define STORAGE_DESC_ALLOC 2 3747c478bd9Sstevel@tonic-gate 3757c478bd9Sstevel@tonic-gate 3767c478bd9Sstevel@tonic-gate /* 3777c478bd9Sstevel@tonic-gate * prom_read() max is 32k 3787c478bd9Sstevel@tonic-gate * for sun4m, page size is 4k, CPR_MAXCONTIG is 8 3797c478bd9Sstevel@tonic-gate * for sun4u, page size is 8k, CPR_MAXCONTIG is 4 3807c478bd9Sstevel@tonic-gate */ 3817c478bd9Sstevel@tonic-gate #define PROM_MAX_READ 0x8000 3827c478bd9Sstevel@tonic-gate #define CPR_MAX_BLOCK 0x8000 3837c478bd9Sstevel@tonic-gate #define CPR_MAXCONTIG (CPR_MAX_BLOCK / MMU_PAGESIZE) 3847c478bd9Sstevel@tonic-gate 3857c478bd9Sstevel@tonic-gate #define PAGE_ROUNDUP(val) (((val) + MMU_PAGEOFFSET) & MMU_PAGEMASK) 3867c478bd9Sstevel@tonic-gate 3877c478bd9Sstevel@tonic-gate /* 3887c478bd9Sstevel@tonic-gate * converts byte size to bitmap size; 1 bit represents one phys page 3897c478bd9Sstevel@tonic-gate */ 3907c478bd9Sstevel@tonic-gate #define BITMAP_BYTES(size) ((size) >> (MMU_PAGESHIFT + 3)) 3917c478bd9Sstevel@tonic-gate 3927c478bd9Sstevel@tonic-gate 3937c478bd9Sstevel@tonic-gate /* 3947c478bd9Sstevel@tonic-gate * redefinitions of uadmin subcommands for A_FREEZE 3957c478bd9Sstevel@tonic-gate */ 3967c478bd9Sstevel@tonic-gate #define AD_CPR_COMPRESS AD_COMPRESS /* store state file compressed */ 3977c478bd9Sstevel@tonic-gate #define AD_CPR_FORCE AD_FORCE /* force to do AD_CPR_COMPRESS */ 3987c478bd9Sstevel@tonic-gate #define AD_CPR_CHECK AD_CHECK /* test if CPR module is there */ 3997c478bd9Sstevel@tonic-gate #define AD_CPR_REUSEINIT AD_REUSEINIT /* write cprinfo file */ 4007c478bd9Sstevel@tonic-gate #define AD_CPR_REUSABLE AD_REUSABLE /* create reusable statefile */ 4017c478bd9Sstevel@tonic-gate #define AD_CPR_REUSEFINI AD_REUSEFINI /* revert to non-reusable CPR */ 4027c478bd9Sstevel@tonic-gate #define AD_CPR_TESTHALT 6 /* test mode, halt */ 4037c478bd9Sstevel@tonic-gate #define AD_CPR_TESTNOZ 7 /* test mode, auto-restart uncompress */ 4047c478bd9Sstevel@tonic-gate #define AD_CPR_TESTZ 8 /* test mode, auto-restart compress */ 4057c478bd9Sstevel@tonic-gate #define AD_CPR_PRINT 9 /* print out stats */ 4067c478bd9Sstevel@tonic-gate #define AD_CPR_NOCOMPRESS 10 /* store state file uncompressed */ 4072df1fe9cSrandyf #define AD_CPR_SUSP_DEVICES 11 /* Only suspend resume devices */ 4087c478bd9Sstevel@tonic-gate #define AD_CPR_DEBUG0 100 /* clear debug flag */ 4097c478bd9Sstevel@tonic-gate #define AD_CPR_DEBUG1 101 /* display CPR main flow via prom */ 4107c478bd9Sstevel@tonic-gate #define AD_CPR_DEBUG2 102 /* misc small/mid size loops */ 4117c478bd9Sstevel@tonic-gate #define AD_CPR_DEBUG3 103 /* exhaustive big loops */ 4127c478bd9Sstevel@tonic-gate #define AD_CPR_DEBUG4 104 /* debug cprboot */ 4137c478bd9Sstevel@tonic-gate #define AD_CPR_DEBUG5 105 /* debug machdep part of resume */ 4147c478bd9Sstevel@tonic-gate #define AD_CPR_DEBUG7 107 /* debug bitmap code */ 4157c478bd9Sstevel@tonic-gate #define AD_CPR_DEBUG8 108 4167c478bd9Sstevel@tonic-gate #define AD_CPR_DEBUG9 109 /* display stat data on console */ 4177c478bd9Sstevel@tonic-gate 4187c478bd9Sstevel@tonic-gate /* 4192df1fe9cSrandyf * Suspend to RAM test points. 4202df1fe9cSrandyf * Probably belong above, but are placed here for now. 4212df1fe9cSrandyf */ 4222df1fe9cSrandyf /* S3 leave hardware on and return success */ 4232df1fe9cSrandyf #define AD_LOOPBACK_SUSPEND_TO_RAM_PASS 22 4242df1fe9cSrandyf 4252df1fe9cSrandyf /* S3 leave hardware on and return failure */ 4262df1fe9cSrandyf #define AD_LOOPBACK_SUSPEND_TO_RAM_FAIL 23 4272df1fe9cSrandyf 4282df1fe9cSrandyf /* S3 ignored devices that fail to suspend */ 4292df1fe9cSrandyf #define AD_FORCE_SUSPEND_TO_RAM 24 4302df1fe9cSrandyf 4312df1fe9cSrandyf /* S3 on a specified device */ 4322df1fe9cSrandyf #define AD_DEVICE_SUSPEND_TO_RAM 25 4332df1fe9cSrandyf 4342df1fe9cSrandyf 4352df1fe9cSrandyf 4362df1fe9cSrandyf /* 4372df1fe9cSrandyf * Temporary definition of the Suspend to RAM development subcommands 4382df1fe9cSrandyf * so that non-ON apps will work after initial integration. 4392df1fe9cSrandyf */ 4402df1fe9cSrandyf #define DEV_SUSPEND_TO_RAM 200 4412df1fe9cSrandyf #define DEV_CHECK_SUSPEND_TO_RAM 201 4422df1fe9cSrandyf 4432df1fe9cSrandyf /* 4447c478bd9Sstevel@tonic-gate * cprboot related information and definitions. 4457c478bd9Sstevel@tonic-gate * The statefile names are hardcoded for now. 4467c478bd9Sstevel@tonic-gate */ 4477c478bd9Sstevel@tonic-gate #define CPR_DEFAULT "/.cpr_default" 4487c478bd9Sstevel@tonic-gate #define CPR_STATE_FILE "/.CPR" 4497c478bd9Sstevel@tonic-gate 4507c478bd9Sstevel@tonic-gate 4517c478bd9Sstevel@tonic-gate /* 4527c478bd9Sstevel@tonic-gate * definitions for CPR statistics 4537c478bd9Sstevel@tonic-gate */ 4547c478bd9Sstevel@tonic-gate #define CPR_E_NAMELEN 64 4557c478bd9Sstevel@tonic-gate #define CPR_E_MAX_EVENTNUM 64 4567c478bd9Sstevel@tonic-gate 4577c478bd9Sstevel@tonic-gate struct cpr_tdata { 4587c478bd9Sstevel@tonic-gate time_t mtime; /* mean time on this event */ 4597c478bd9Sstevel@tonic-gate time_t stime; /* start time on this event */ 4607c478bd9Sstevel@tonic-gate time_t etime; /* end time on this event */ 4617c478bd9Sstevel@tonic-gate time_t ltime; /* time duration of the last event */ 4627c478bd9Sstevel@tonic-gate }; 4637c478bd9Sstevel@tonic-gate typedef struct cpr_tdata ctd_t; 4647c478bd9Sstevel@tonic-gate 4657c478bd9Sstevel@tonic-gate struct cpr_event { 4667c478bd9Sstevel@tonic-gate struct cpr_event *ce_next; /* next event in the list */ 4677c478bd9Sstevel@tonic-gate long ce_ntests; /* num of the events since loaded */ 4687c478bd9Sstevel@tonic-gate ctd_t ce_sec; /* cpr time in sec on this event */ 4697c478bd9Sstevel@tonic-gate ctd_t ce_msec; /* cpr time in 100*millisec */ 4707c478bd9Sstevel@tonic-gate char ce_name[CPR_E_NAMELEN]; 4717c478bd9Sstevel@tonic-gate }; 4727c478bd9Sstevel@tonic-gate 4737c478bd9Sstevel@tonic-gate struct cpr_stat { 4747c478bd9Sstevel@tonic-gate int cs_ntests; /* num of cpr's since loaded */ 4757c478bd9Sstevel@tonic-gate int cs_mclustsz; /* average cluster size: all in bytes */ 4767c478bd9Sstevel@tonic-gate int cs_upage2statef; /* actual # of upages gone to statef */ 4777c478bd9Sstevel@tonic-gate int cs_min_comprate; /* minimum compression ratio * 100 */ 4787c478bd9Sstevel@tonic-gate pgcnt_t cs_nosw_pages; /* # of pages of no backing store */ 4797c478bd9Sstevel@tonic-gate size_t cs_nocomp_statefsz; /* statefile size without compression */ 4807c478bd9Sstevel@tonic-gate size_t cs_est_statefsz; /* estimated statefile size */ 4817c478bd9Sstevel@tonic-gate size_t cs_real_statefsz; /* real statefile size */ 4827c478bd9Sstevel@tonic-gate size_t cs_dumped_statefsz; /* how much has been dumped out */ 4837c478bd9Sstevel@tonic-gate struct cpr_event *cs_event_head; /* The 1st one in stat event list */ 4847c478bd9Sstevel@tonic-gate struct cpr_event *cs_event_tail; /* The last one in stat event list */ 4857c478bd9Sstevel@tonic-gate }; 4867c478bd9Sstevel@tonic-gate 4877c478bd9Sstevel@tonic-gate /* 4887c478bd9Sstevel@tonic-gate * macros for CPR statistics evaluation 4897c478bd9Sstevel@tonic-gate */ 4907c478bd9Sstevel@tonic-gate #define CPR_STAT_EVENT_START(s) cpr_stat_event_start(s, 0) 4917c478bd9Sstevel@tonic-gate #define CPR_STAT_EVENT_END(s) cpr_stat_event_end(s, 0) 4927c478bd9Sstevel@tonic-gate /* 4937c478bd9Sstevel@tonic-gate * use the following is other time zone is required 4947c478bd9Sstevel@tonic-gate */ 4957c478bd9Sstevel@tonic-gate #define CPR_STAT_EVENT_START_TMZ(s, t) cpr_stat_event_start(s, t) 4967c478bd9Sstevel@tonic-gate #define CPR_STAT_EVENT_END_TMZ(s, t) cpr_stat_event_end(s, t) 4977c478bd9Sstevel@tonic-gate 4987c478bd9Sstevel@tonic-gate #define CPR_STAT_EVENT_PRINT cpr_stat_event_print 4997c478bd9Sstevel@tonic-gate 5007c478bd9Sstevel@tonic-gate 5017c478bd9Sstevel@tonic-gate /* 5027c478bd9Sstevel@tonic-gate * State Structure for CPR 5037c478bd9Sstevel@tonic-gate */ 5047c478bd9Sstevel@tonic-gate typedef struct cpr { 5057c478bd9Sstevel@tonic-gate uint_t c_cprboot_magic; 5067c478bd9Sstevel@tonic-gate uint_t c_flags; 5077c478bd9Sstevel@tonic-gate int c_substate; /* tracking suspend progress */ 5087c478bd9Sstevel@tonic-gate int c_fcn; /* uadmin subcommand */ 5097c478bd9Sstevel@tonic-gate vnode_t *c_vp; /* vnode for statefile */ 5107c478bd9Sstevel@tonic-gate cbd_t *c_bmda; /* bitmap descriptor array */ 5117c478bd9Sstevel@tonic-gate caddr_t c_mapping_area; /* reserve for dumping kas phys pages */ 5127c478bd9Sstevel@tonic-gate struct cpr_stat c_stat; 5137c478bd9Sstevel@tonic-gate char c_alloc_cnt; /* # of statefile alloc retries */ 5147c478bd9Sstevel@tonic-gate } cpr_t; 5157c478bd9Sstevel@tonic-gate 5167c478bd9Sstevel@tonic-gate /* 5177c478bd9Sstevel@tonic-gate * c_flags definitions 5187c478bd9Sstevel@tonic-gate */ 5197c478bd9Sstevel@tonic-gate #define C_SUSPENDING 0x01 5207c478bd9Sstevel@tonic-gate #define C_RESUMING 0x02 5217c478bd9Sstevel@tonic-gate #define C_COMPRESSING 0x04 5227c478bd9Sstevel@tonic-gate #define C_REUSABLE 0x08 5237c478bd9Sstevel@tonic-gate #define C_ERROR 0x10 5247c478bd9Sstevel@tonic-gate 5257c478bd9Sstevel@tonic-gate extern cpr_t cpr_state; 5267c478bd9Sstevel@tonic-gate #define CPR (&cpr_state) 5277c478bd9Sstevel@tonic-gate #define STAT (&cpr_state.c_stat) 5287c478bd9Sstevel@tonic-gate 5297c478bd9Sstevel@tonic-gate /* 5307c478bd9Sstevel@tonic-gate * definitions for c_substate. It works together w/ c_flags to determine which 5317c478bd9Sstevel@tonic-gate * stages the CPR is at. 5327c478bd9Sstevel@tonic-gate */ 5337c478bd9Sstevel@tonic-gate #define C_ST_SUSPEND_BEGIN 0 5347c478bd9Sstevel@tonic-gate #define C_ST_MP_OFFLINE 1 5357c478bd9Sstevel@tonic-gate #define C_ST_STOP_USER_THREADS 2 5367c478bd9Sstevel@tonic-gate #define C_ST_PM_REATTACH_NOINVOL 3 5377c478bd9Sstevel@tonic-gate #define C_ST_DISABLE_UFS_LOGGING 4 5387c478bd9Sstevel@tonic-gate #define C_ST_STATEF_ALLOC 5 5397c478bd9Sstevel@tonic-gate #define C_ST_SUSPEND_DEVICES 6 5407c478bd9Sstevel@tonic-gate #define C_ST_STOP_KERNEL_THREADS 7 5417c478bd9Sstevel@tonic-gate #define C_ST_SETPROPS_1 8 5427c478bd9Sstevel@tonic-gate #define C_ST_DUMP 9 5437c478bd9Sstevel@tonic-gate #define C_ST_SETPROPS_0 10 5447c478bd9Sstevel@tonic-gate #define C_ST_DUMP_NOSPC 11 5457c478bd9Sstevel@tonic-gate #define C_ST_REUSABLE 12 5462df1fe9cSrandyf #define C_ST_NODUMP 13 5472df1fe9cSrandyf #define C_ST_MP_PAUSED 14 5487c478bd9Sstevel@tonic-gate 5497c478bd9Sstevel@tonic-gate #define cpr_set_substate(a) (CPR->c_substate = (a)) 5507c478bd9Sstevel@tonic-gate 5517c478bd9Sstevel@tonic-gate #define C_VP (CPR->c_vp) 5527c478bd9Sstevel@tonic-gate 5537c478bd9Sstevel@tonic-gate #define C_MAX_ALLOC_RETRY 4 5547c478bd9Sstevel@tonic-gate 5557c478bd9Sstevel@tonic-gate #define CPR_PROM_SAVE 0 5567c478bd9Sstevel@tonic-gate #define CPR_PROM_RESTORE 1 5577c478bd9Sstevel@tonic-gate #define CPR_PROM_FREE 2 5587c478bd9Sstevel@tonic-gate 5597c478bd9Sstevel@tonic-gate /* 5607c478bd9Sstevel@tonic-gate * default/historic size for cpr write buffer 5617c478bd9Sstevel@tonic-gate */ 5627c478bd9Sstevel@tonic-gate #define CPRBUFSZ 0x20000 5637c478bd9Sstevel@tonic-gate 5647c478bd9Sstevel@tonic-gate /* 5657c478bd9Sstevel@tonic-gate * cpr statefile I/O on a block device begins after the disk label 5667c478bd9Sstevel@tonic-gate * and bootblock (primarily for disk slices that start at cyl 0); 5677c478bd9Sstevel@tonic-gate * the offset should be at least (label size + bootblock size = 8k) 5687c478bd9Sstevel@tonic-gate */ 5697c478bd9Sstevel@tonic-gate #define CPR_SPEC_OFFSET 16384 5707c478bd9Sstevel@tonic-gate 5717c478bd9Sstevel@tonic-gate typedef int (*bitfunc_t)(pfn_t, int); 5727c478bd9Sstevel@tonic-gate 5737c478bd9Sstevel@tonic-gate /* 5747c478bd9Sstevel@tonic-gate * arena scan info 5757c478bd9Sstevel@tonic-gate */ 5767c478bd9Sstevel@tonic-gate struct cpr_walkinfo { 5777c478bd9Sstevel@tonic-gate int mapflag; 5787c478bd9Sstevel@tonic-gate bitfunc_t bitfunc; 5797c478bd9Sstevel@tonic-gate pgcnt_t pages; 5807c478bd9Sstevel@tonic-gate size_t size; 5817c478bd9Sstevel@tonic-gate int ranges; 5827c478bd9Sstevel@tonic-gate }; 5837c478bd9Sstevel@tonic-gate 5847c478bd9Sstevel@tonic-gate /* 5857c478bd9Sstevel@tonic-gate * Value used by cpr, found in devi_cpr_flags 5867c478bd9Sstevel@tonic-gate */ 5877c478bd9Sstevel@tonic-gate #define DCF_CPR_SUSPENDED 0x1 /* device went through cpr_suspend */ 5887c478bd9Sstevel@tonic-gate 5892df1fe9cSrandyf /* 5902df1fe9cSrandyf * Values used to differentiate between suspend to disk and suspend to ram 5912df1fe9cSrandyf * in cpr_suspend and cpr_resume 5922df1fe9cSrandyf */ 5932df1fe9cSrandyf 5942df1fe9cSrandyf #define CPR_TORAM 3 5952df1fe9cSrandyf #define CPR_TODISK 4 5962df1fe9cSrandyf 5977c478bd9Sstevel@tonic-gate #ifndef _ASM 5987c478bd9Sstevel@tonic-gate 5997c478bd9Sstevel@tonic-gate extern char *cpr_build_statefile_path(void); 6007c478bd9Sstevel@tonic-gate extern char *cpr_enumerate_promprops(char **, size_t *); 6017c478bd9Sstevel@tonic-gate extern char *cpr_get_statefile_prom_path(void); 6027c478bd9Sstevel@tonic-gate extern int cpr_contig_pages(vnode_t *, int); 6037c478bd9Sstevel@tonic-gate extern int cpr_default_setup(int); 6047c478bd9Sstevel@tonic-gate extern int cpr_dump(vnode_t *); 6057c478bd9Sstevel@tonic-gate extern int cpr_get_reusable_mode(void); 6067c478bd9Sstevel@tonic-gate extern int cpr_isset(pfn_t, int); 6072df1fe9cSrandyf extern int cpr_main(int); 6087c478bd9Sstevel@tonic-gate extern int cpr_mp_offline(void); 6097c478bd9Sstevel@tonic-gate extern int cpr_mp_online(void); 6107c478bd9Sstevel@tonic-gate extern int cpr_nobit(pfn_t, int); 6117c478bd9Sstevel@tonic-gate extern int cpr_open_deffile(int, vnode_t **); 6127c478bd9Sstevel@tonic-gate extern int cpr_read_cdump(int, cdd_t *, ushort_t); 6137c478bd9Sstevel@tonic-gate extern int cpr_read_cprinfo(int, char *, char *); 6147c478bd9Sstevel@tonic-gate extern int cpr_read_machdep(int, caddr_t, size_t); 6157c478bd9Sstevel@tonic-gate extern int cpr_read_phys_page(int, uint_t, int *); 6167c478bd9Sstevel@tonic-gate extern int cpr_read_terminator(int, ctrm_t *, caddr_t); 6177c478bd9Sstevel@tonic-gate extern int cpr_resume_devices(dev_info_t *, int); 6187c478bd9Sstevel@tonic-gate extern int cpr_set_properties(int); 6197c478bd9Sstevel@tonic-gate extern int cpr_statefile_is_spec(void); 6207c478bd9Sstevel@tonic-gate extern int cpr_statefile_offset(void); 6217c478bd9Sstevel@tonic-gate extern int cpr_stop_kernel_threads(void); 6222df1fe9cSrandyf extern int cpr_threads_are_stopped(void); 6237c478bd9Sstevel@tonic-gate extern int cpr_stop_user_threads(void); 6247c478bd9Sstevel@tonic-gate extern int cpr_suspend_devices(dev_info_t *); 6257c478bd9Sstevel@tonic-gate extern int cpr_validate_definfo(int); 6267c478bd9Sstevel@tonic-gate extern int cpr_write(vnode_t *, caddr_t, size_t); 6277c478bd9Sstevel@tonic-gate extern int cpr_update_nvram(cprop_t *); 6287c478bd9Sstevel@tonic-gate extern int cpr_write_deffile(cdef_t *); 6297c478bd9Sstevel@tonic-gate extern int i_cpr_alloc_bitmaps(void); 6307c478bd9Sstevel@tonic-gate extern int i_cpr_dump_sensitive_kpages(vnode_t *); 6317c478bd9Sstevel@tonic-gate extern int i_cpr_save_sensitive_kpages(void); 6327c478bd9Sstevel@tonic-gate extern pgcnt_t cpr_count_kpages(int, bitfunc_t); 6337c478bd9Sstevel@tonic-gate extern pgcnt_t cpr_count_pages(caddr_t, size_t, int, bitfunc_t, int); 6347c478bd9Sstevel@tonic-gate extern pgcnt_t cpr_count_volatile_pages(int, bitfunc_t); 6357c478bd9Sstevel@tonic-gate extern pgcnt_t i_cpr_count_sensitive_kpages(int, bitfunc_t); 6367c478bd9Sstevel@tonic-gate extern pgcnt_t i_cpr_count_special_kpages(int, bitfunc_t); 6377c478bd9Sstevel@tonic-gate extern pgcnt_t i_cpr_count_storage_pages(int, bitfunc_t); 6387c478bd9Sstevel@tonic-gate extern ssize_t cpr_get_machdep_len(int); 6397c478bd9Sstevel@tonic-gate extern void cpr_clear_definfo(void); 6407c478bd9Sstevel@tonic-gate extern void cpr_restore_time(void); 6417c478bd9Sstevel@tonic-gate extern void cpr_save_time(void); 6427c478bd9Sstevel@tonic-gate extern void cpr_show_range(char *, size_t, int, bitfunc_t, pgcnt_t); 6437c478bd9Sstevel@tonic-gate extern void cpr_signal_user(int sig); 6447c478bd9Sstevel@tonic-gate extern void cpr_spinning_bar(void); 6457c478bd9Sstevel@tonic-gate extern void cpr_start_user_threads(void); 6467c478bd9Sstevel@tonic-gate extern void cpr_stat_cleanup(void); 6477c478bd9Sstevel@tonic-gate extern void cpr_stat_event_end(char *, cpr_time_t *); 6487c478bd9Sstevel@tonic-gate extern void cpr_stat_event_print(void); 6497c478bd9Sstevel@tonic-gate extern void cpr_stat_event_start(char *, cpr_time_t *); 6507c478bd9Sstevel@tonic-gate extern void cpr_stat_record_events(void); 6517c478bd9Sstevel@tonic-gate extern void cpr_tod_get(cpr_time_t *ctp); 652*8fc99e42STrevor Thompson extern void cpr_tod_status_set(int); 6537c478bd9Sstevel@tonic-gate extern void i_cpr_bitmap_cleanup(void); 6542df1fe9cSrandyf extern void i_cpr_stop_other_cpus(void); 6552df1fe9cSrandyf extern void i_cpr_alloc_cpus(void); 6562df1fe9cSrandyf extern void i_cpr_free_cpus(void); 6577c478bd9Sstevel@tonic-gate 6587c478bd9Sstevel@tonic-gate /*PRINTFLIKE2*/ 6597c478bd9Sstevel@tonic-gate extern void cpr_err(int, const char *, ...) __KPRINTFLIKE(2); 6607c478bd9Sstevel@tonic-gate 6617c478bd9Sstevel@tonic-gate extern cpr_time_t wholecycle_tv; 6627c478bd9Sstevel@tonic-gate extern int cpr_reusable_mode; 6637c478bd9Sstevel@tonic-gate 6647c478bd9Sstevel@tonic-gate #endif /* _ASM */ 6657c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 6667c478bd9Sstevel@tonic-gate 6677c478bd9Sstevel@tonic-gate 6687c478bd9Sstevel@tonic-gate #ifdef __cplusplus 6697c478bd9Sstevel@tonic-gate } 6707c478bd9Sstevel@tonic-gate #endif 6717c478bd9Sstevel@tonic-gate 6727c478bd9Sstevel@tonic-gate #endif /* _SYS_CPR_H */ 673