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