/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2012 Joyent, Inc. All rights reserved.
*/
/*
*
* The purpose of this module is to monitor the connection between the system
* supports the Sun OEM uptime IPMI command. If the BMC connection does not
* exist, or the uptime function is not implemented, then the module unloads
* without doing anything.
*
* When the module is first loaded, or a reset is detected, the module will
* generate the ESC_PLATFORM_SP_RESET sysevent as a system-wide notification to
* indicate that this event has occurred.
*
* Note that this event generation is not guaranteed to have a one-to-one
* correspondence with an SP reset. There is no persistence, so if fmd is
* restarted we will generate this event again. Thus the event only indicates
* the possibility that the SP has been reset. This could be enhanced using fmd
* checkpoints to have some persistent state to avoid this scenario. However,
* it currently serves the useful dual purpose of notifying consumers of system
* startup as well as SP reset through a single channel.
*/
#include <errno.h>
#include <libipmi.h>
#include <libsysevent.h>
#include <string.h>
typedef struct sp_monitor {
} sp_monitor_t;
static void
{
/*
* We reset the seconds and generation so that the next time
* through we will try to post the sysevent again.
*/
}
}
/*ARGSUSED*/
static void
{
/*
* Ignore uptime failures. We will generate the appropriate
* event when it comes back online.
*/
} else {
/*
* We want to catch cases where the generation number is
* explicitly reset, or when the SP configuration is reset after
* a reboot (and the generation number is 0). We also post a
* sysevent when the module initially loads, since we can't be
* sure if we missed a SP reset or not.
*/
smp->sm_seconds == 0)
}
}
NULL, /* fmdo_recv */
sp_timeout, /* fmdo_timeout */
NULL, /* fmdo_close */
NULL, /* fmdo_stats */
NULL, /* fmdo_gc */
};
};
};
void
{
int error;
char *msg;
return;
== NULL) {
/*
* module without doing anything.
*/
if (error != EIPMI_BMC_OPEN_FAILED)
"connection: %s\n", msg);
"present");
return;
}
/*
* Attempt an initial uptime() call. If the IPMI command is
* unrecognized, then this is an unsupported platform and the module
* should be unloaded. Any other error is treated is transient failure.
*/
&smp->sm_generation)) != 0 &&
"not supported");
return;
}
if (error == 0)
else
/*
* Setup the recurring timer.
*/
}
void
{
if (smp) {
}
}