/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/sysmacros.h>
#include <sys/hypervisor_api.h>
#include <sys/mach_descrip.h>
#define WDT_OFF 0
/*
* MILLISEC defines the number of milliseconds in a second.
*/
static void config_watchdog(uint64_t, int);
static void watchdog_cyclic_init(hrtime_t);
/*
*/
/*
* Tuneable to control watchdog functionality. Watchdog can be
*/
static int watchdog_initialized = 0;
/*
* watchdog pat frequency, which is set to approximately 44% of
* the timeout value.
*/
void
watchdog_init(void)
{
int num_nodes;
int nplat;
int listsz;
if (!watchdog_enabled) {
return;
}
major != WDT_MIN_COREAPI_MAJOR ||
"not available\n");
watchdog_enabled = 0;
return;
}
/*
* Get the watchdog-max-timeout and watchdog-resolution MD properties.
*/
"watchdog is disabled.");
watchdog_enabled = 0;
return;
}
"is disabled.");
watchdog_enabled = 0;
(void) md_fini_handle(mdp);
return;
}
/*
* Make sure that watchdog timeout value is within limits.
*/
if (watchdog_timeout < WDT_MIN_TIMEOUT)
else if (watchdog_timeout > WDT_LONG_TIMEOUT)
&watchdog_resolution)) {
"is disabled.");
watchdog_enabled = 0;
(void) md_fini_handle(mdp);
return;
}
if (watchdog_resolution == 0 ||
(void) md_fini_handle(mdp);
/*
* round the timeout to the nearest smaller value.
*/
/*
* Cyclic need to be fired twice the frequency of regular
* watchdog timeout. Pedantic here and setting cyclic
* frequency to approximately 44% of watchdog_timeout.
*/
/*
* Note that regular timeout interval is in millisecond,
* therefore to get cyclic interval in nanosecond need to
* multiply by MICROSEC.
*/
watchdog_initialized = 1;
}
/*
* Pat the watchdog timer periodically using the hypervisor API.
* Regular pat occurs when the system runs normally.
* Long pat is when system panics.
*/
void
{
if (watchdog_enabled && watchdog_activated) {
if (panicstr)
else
}
}
/*
*/
void
{
if (watchdog_enabled && watchdog_activated) {
config_watchdog(0, WDT_OFF);
}
}
/*
*/
void
{
if (watchdog_enabled && !watchdog_activated) {
if (panicstr) {
} else {
}
}
}
void
{
if (watchdog_enabled && watchdog_activated) {
config_watchdog(0, WDT_OFF);
}
}
static void
{
if (watchdog_initialized) {
"Error = 0x%lx", ret);
watchdog_enabled = 0;
}
}
}
/*
* Once the watchdog cyclic is initialized, it won't be removed.
* The only way to not add the watchdog cyclic is to disable the watchdog
*/
static void
{
}