/*
* 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.
*/
#define __NSC_GEN__
#include "nsc_dev.h"
#include "nsc_ioctl.h"
#include "nsc_power.h"
#include "../nsctl.h"
extern nsc_mem_t *_nsc_local_mem;
static int null_power(void);
typedef struct _nsc_power_s {
void (*pw_power_down)(void);
/* callback power down (shutdown imminent) */
} _nsc_power_t;
0, 0, 0,
};
static int null_power(void)
/*
* init null_power - dummy power routine for clients that choose not
* to implement all the power hooks.
*
*/
{
return (0);
}
/*
* int
* _nsc_power
* Call registered clients of the generic power ioctls.
*
* Calls all the registered clients with a message describing the
* current state of the power for the system.
*/
int
{
*rvp = 0;
return (EFAULT);
pp = _power_clients;
while (pp) {
case Power_OK:
(*pp->pw_power_ok)();
break;
case Power_Down:
(*pp->pw_power_down)();
break;
case Power_Lost:
break;
default:
return (EINVAL);
}
}
return (0);
}
/*
* int
* _nsc_init_power (void)
* Initialise power ioctl subsystem.
*
* Called at driver initialisation time to allocate necessary
* data structures.
*/
int
_nsc_init_power(void)
{
return (0);
}
/*
* int
* _nsc_deinit_power (void)
* Initialise power ioctl subsystem.
*
* Called at driver initialisation time to allocate necessary
* data structures.
*/
int
_nsc_deinit_power(void)
{
pp = _power_clients;
while (pp) {
}
return (0);
}
/*
* blind_t
* nsc_register_power (char *name, nsc_def_t *def)
* Register an power ioctl client.
*
* Returns a token for use in future calls to nsc_unregister_power.
* If a client with the same name is already registered then NULL
* is return to indicate failure.
* If registration fails NULL is returned.
*
* Description:
* Registers an power ioctl client for notifications during subsequent
*/
{
return (NULL);
return (NULL);
}
}
}
/*
* int
* nsc_unregister_power (blind_t powerp)
* Un-register a power ioctl client.
*
* Returns 0 on success, otherwise returns an error code.
*
* Description:
* The specified power ioctl client is un-registered if possible.
* Zero is returned on success otherwise an error code.
*/
int
{
return (EINVAL);
break;
return (EALREADY);
}
return (0);
}