platsvc.c revision f500b19684bd0346ac05bec02a50af07f369da1a
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* sun4v Platform Services Module
*/
#include <sys/machsystm.h>
/*
* Debugging routines
*/
#ifdef DEBUG
#else /* DEBUG */
#endif /* DEBUG */
/*
* Time resolution conversions.
*/
/*
* Domains Services interaction
*/
static ds_svc_hdl_t ds_md_handle;
static ds_svc_hdl_t ds_shutdown_handle;
static ds_svc_hdl_t ds_panic_handle;
static ds_capability_t ps_md_cap = {
"md-update", /* svc_id */
ps_vers, /* vers */
PS_NVERS /* nvers */
};
static ds_capability_t ps_shutdown_cap = {
"domain-shutdown", /* svc_id */
ps_vers, /* vers */
PS_NVERS /* nvers */
};
static ds_capability_t ps_panic_cap = {
"domain-panic", /* svc_id */
ps_vers, /* vers */
PS_NVERS /* nvers */
};
static ds_clnt_ops_t ps_md_ops = {
ps_reg_handler, /* ds_reg_cb */
ps_unreg_handler, /* ds_unreg_cb */
ps_md_data_handler, /* ds_data_cb */
&ds_md_handle /* cb_arg */
};
static ds_clnt_ops_t ps_shutdown_ops = {
ps_reg_handler, /* ds_reg_cb */
ps_unreg_handler, /* ds_unreg_cb */
ps_shutdown_data_handler, /* ds_data_cb */
&ds_shutdown_handle /* cb_arg */
};
static ds_clnt_ops_t ps_panic_ops = {
ps_reg_handler, /* ds_reg_cb */
ps_unreg_handler, /* ds_unreg_cb */
ps_panic_data_handler, /* ds_data_cb */
&ds_panic_handle /* cb_arg */
};
static int ps_init(void);
static void ps_fini(void);
/*
* Power down timeout value of 5 minutes.
*/
#define PLATSVC_POWERDOWN_DELAY 1200
"sun4v Platform Services"
};
static struct modlinkage modlinkage = {
(void *)&modlmisc,
};
int
_init(void)
{
int rv;
return (rv);
ps_fini();
return (rv);
}
int
{
}
int platsvc_allow_unload;
int
_fini(void)
{
int status;
if (platsvc_allow_unload == 0)
return (EBUSY);
ps_fini();
return (status);
}
static int
ps_init(void)
{
int rv;
extern int mdeg_init(void);
/* register with domain services framework */
if (rv != 0) {
return (rv);
}
if (rv != 0) {
(void) ds_cap_fini(&ps_md_cap);
return (rv);
}
if (rv != 0) {
(void) ds_cap_fini(&ps_md_cap);
(void) ds_cap_fini(&ps_shutdown_cap);
return (rv);
}
return (rv);
}
static void
ps_fini(void)
{
extern void mdeg_fini(void);
/*
* Stop incoming requests from Zeus
*/
(void) ds_cap_fini(&ps_md_cap);
(void) ds_cap_fini(&ps_shutdown_cap);
(void) ds_cap_fini(&ps_panic_cap);
mdeg_fini();
}
static void
{
extern int mach_descrip_update(void);
extern void mdeg_notify_clients(void);
extern void recalc_xc_timeouts(void);
return;
if (ds_handle == DS_INVALID_HDL) {
DBG("ps_md_data_handler: DS handle no longer valid\n");
return;
}
sizeof (resp_msg))) != 0) {
}
return;
}
DBG("MD Reload...\n");
if (mach_descrip_update()) {
return;
}
/*
* notify registered clients that MD has
* been updated
*/
}
}
static void
{
return;
if (ds_handle == DS_INVALID_HDL) {
DBG("ps_shutdown_data_handler: DS handle no longer valid\n");
return;
}
sizeof (resp_msg))) != 0) {
rv);
}
return;
}
}
/*
* Honor the ldoms manager's shutdown delay requirement.
*/
;
}
static void
{
return;
if (ds_handle == DS_INVALID_HDL) {
DBG("ps_panic_data_handler: DS handle no longer valid\n");
return;
}
sizeof (resp_msg))) != 0) {
rv);
}
return;
}
}
}
static void
{
DBG("ps_reg_handler: arg=0x%p, ver=%d.%d, hdl=0x%lx\n",
ds_md_handle = hdl;
}
static void
{
}