tod.c revision b0b35ace1e62aef432dcf5587270182d6c65cade
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* dev_ops and cb_ops entry point function declarations */
struct cb_ops tod_cb_ops = {
nodev, /* dump */
nodev, /* devmap */
ddi_segmap, /* segmap */
NULL, /* for STREAMS drivers */
};
static struct dev_ops tod_dev_ops = {
DEVO_REV, /* driver build version */
0, /* device reference count */
nulldev, /* probe */
nulldev, /* reset */
nulldev /* power */
};
/* module configuration stuff */
static void *statep;
extern struct mod_ops mod_driverops;
"tod driver (v1.0) %I%",
};
static struct modlinkage modlinkage = {
&modldrv,
0
};
int
_init(void)
{
int e;
return (e);
}
if ((e = mod_install(&modlinkage)) != 0) {
}
return (e);
}
int
_fini(void)
{
int e;
if ((e = mod_remove(&modlinkage)) != 0) {
return (e);
}
return (DDI_SUCCESS);
}
int
{
}
/* ARGSUSED */
static int
{
int retval = DDI_SUCCESS;
switch (cmd) {
case DDI_INFO_DEVT2DEVINFO:
} else {
}
break;
case DDI_INFO_DEVT2INSTANCE:
break;
default:
}
return (retval);
}
static int
{
int inst;
char name[80];
switch (cmd) {
case DDI_ATTACH:
/*
* Create minor node. The minor device number, inst, has no
* meaning. The model number above, which will be added to
* the device's softc, is used to direct peculiar behavior.
*/
goto attach_failed;
/*
* Allocate a soft state structure for this instance.
*/
goto attach_failed;
return (DDI_SUCCESS);
case DDI_RESUME:
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
/* Free soft state, if allocated. remove minor node if added earlier */
if (softc)
return (DDI_FAILURE);
}
static int
{
int inst;
switch (cmd) {
case DDI_DETACH:
return (ENXIO);
/*
* Free the soft state and remove minor node added earlier.
*/
return (DDI_SUCCESS);
case DDI_SUSPEND:
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
}
/* ARGSUSED */
static int
{
}
/* ARGSUSED */
static int
{
}
/* ARGSUSED */
static int
{
return (ENXIO);
}
switch (cmd) {
case TOD_CLEAR_ALARM:
break;
case TOD_SET_ALARM:
return (EFAULT);
}
} else {
return (EFAULT);
}
}
break;
case TOD_GET_DATE:
return (EFAULT);
}
} else {
if (TIMEVAL_OVERFLOW(&ts)) {
return (EOVERFLOW);
}
if (ddi_copyout(&time32,
return (EFAULT);
}
}
break;
default:
return (EINVAL);
}
return (0);
}