Print this page
4748 use an enum for tod_faulted global


 311 static int fsflushcnt;  /* counter for t_fsflushr */
 312 int     dosynctodr = 1; /* patchable; enable/disable sync to TOD chip */
 313 int     tod_needsync = 0;       /* need to sync tod chip with software time */
 314 static int tod_broken = 0;      /* clock chip doesn't work */
 315 time_t  boot_time = 0;          /* Boot time in seconds since 1970 */
 316 cyclic_id_t clock_cyclic;       /* clock()'s cyclic_id */
 317 cyclic_id_t deadman_cyclic;     /* deadman()'s cyclic_id */
 318 
 319 extern void     clock_tick_schedule(int);
 320 
 321 static int lgrp_ticks;          /* counter to schedule lgrp load calcs */
 322 
 323 /*
 324  * for tod fault detection
 325  */
 326 #define TOD_REF_FREQ            ((longlong_t)(NANOSEC))
 327 #define TOD_STALL_THRESHOLD     (TOD_REF_FREQ * 3 / 2)
 328 #define TOD_JUMP_THRESHOLD      (TOD_REF_FREQ / 2)
 329 #define TOD_FILTER_N            4
 330 #define TOD_FILTER_SETTLE       (4 * TOD_FILTER_N)
 331 static int tod_faulted = TOD_NOFAULT;
 332 
 333 static int tod_status_flag = 0;         /* used by tod_validate() */
 334 
 335 static hrtime_t prev_set_tick = 0;      /* gethrtime() prior to tod_set() */
 336 static time_t prev_set_tod = 0;         /* tv_sec value passed to tod_set() */
 337 
 338 /* patchable via /etc/system */
 339 int tod_validate_enable = 1;
 340 
 341 /* Diagnose/Limit messages about delay(9F) called from interrupt context */
 342 int                     delay_from_interrupt_diagnose = 0;
 343 volatile uint32_t       delay_from_interrupt_msg = 20;
 344 
 345 /*
 346  * On non-SPARC systems, TOD validation must be deferred until gethrtime
 347  * returns non-zero values (after mach_clkinit's execution).
 348  * On SPARC systems, it must be deferred until after hrtime_base
 349  * and hres_last_tick are set (in the first invocation of hres_tick).
 350  * Since in both cases the prerequisites occur before the invocation of
 351  * tod_get() in clock(), the deferment is lifted there.




 311 static int fsflushcnt;  /* counter for t_fsflushr */
 312 int     dosynctodr = 1; /* patchable; enable/disable sync to TOD chip */
 313 int     tod_needsync = 0;       /* need to sync tod chip with software time */
 314 static int tod_broken = 0;      /* clock chip doesn't work */
 315 time_t  boot_time = 0;          /* Boot time in seconds since 1970 */
 316 cyclic_id_t clock_cyclic;       /* clock()'s cyclic_id */
 317 cyclic_id_t deadman_cyclic;     /* deadman()'s cyclic_id */
 318 
 319 extern void     clock_tick_schedule(int);
 320 
 321 static int lgrp_ticks;          /* counter to schedule lgrp load calcs */
 322 
 323 /*
 324  * for tod fault detection
 325  */
 326 #define TOD_REF_FREQ            ((longlong_t)(NANOSEC))
 327 #define TOD_STALL_THRESHOLD     (TOD_REF_FREQ * 3 / 2)
 328 #define TOD_JUMP_THRESHOLD      (TOD_REF_FREQ / 2)
 329 #define TOD_FILTER_N            4
 330 #define TOD_FILTER_SETTLE       (4 * TOD_FILTER_N)
 331 static enum tod_fault_type tod_faulted = TOD_NOFAULT;
 332 
 333 static int tod_status_flag = 0;         /* used by tod_validate() */
 334 
 335 static hrtime_t prev_set_tick = 0;      /* gethrtime() prior to tod_set() */
 336 static time_t prev_set_tod = 0;         /* tv_sec value passed to tod_set() */
 337 
 338 /* patchable via /etc/system */
 339 int tod_validate_enable = 1;
 340 
 341 /* Diagnose/Limit messages about delay(9F) called from interrupt context */
 342 int                     delay_from_interrupt_diagnose = 0;
 343 volatile uint32_t       delay_from_interrupt_msg = 20;
 344 
 345 /*
 346  * On non-SPARC systems, TOD validation must be deferred until gethrtime
 347  * returns non-zero values (after mach_clkinit's execution).
 348  * On SPARC systems, it must be deferred until after hrtime_base
 349  * and hres_last_tick are set (in the first invocation of hres_tick).
 350  * Since in both cases the prerequisites occur before the invocation of
 351  * tod_get() in clock(), the deferment is lifted there.