/*
* 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.
*/
/*
* This file contains interface code to make the kernel look it has
* functionality that is useful for drivers lower than nsctl.
*/
#ifndef DS_DDICT
#endif
#ifndef DS_DDICT
#endif
#include "nsc_thread.h"
#ifdef DS_DDICT
#endif
#include "nskernd.h"
#include "nsc_list.h"
void _nsc_stop_proc(void);
void _nsc_start_proc(void);
/*
* Solaris specific driver module interface code.
*/
nulldev, /* open */
nulldev, /* close */
nodev, /* strategy */
nodev, /* print */
nodev, /* dump */
nodev, /* read */
nodev, /* write */
nodev, /* ioctl */
nodev, /* devmap routine */
nodev, /* mmap routine */
nodev, /* segmap */
nochpoll, /* chpoll */
0, /* not a STREAMS driver, no cb_str routine */
nodev, /* aread */
nodev, /* awrite */
};
DEVO_REV, /* Driver build version */
0, /* device reference count */
nulldev, /* identify */
nulldev, /* probe */
nodev, /* reset */
};
"nws:Kernel Interface:" ISS_VERSION_STR,
};
};
/*
* Solaris module load time code
*/
int
_init(void)
{
void nskern_init();
int err;
if (err) {
return (err);
}
nskern_init();
return (DDI_SUCCESS);
}
/*
* Solaris module unload time code
*/
int
_fini(void)
{
int err;
nskernd_stop();
}
return (err);
}
int
{
}
/*
* Attach an instance of the device. This happens before an open
* can succeed.
*/
static int
{
if (cmd == DDI_ATTACH) {
nskern_dip = dip;
return (DDI_SUCCESS);
} else {
return (DDI_FAILURE);
}
}
/* ARGSUSED */
static int
{
if (cmd == DDI_DETACH) {
nskern_dip = NULL;
return (DDI_SUCCESS);
} else {
return (DDI_FAILURE);
}
}
/* ARGSUSED */
static int
{
switch (cmd) {
case DDI_INFO_DEVT2DEVINFO:
*result = nskern_dip;
rc = DDI_SUCCESS;
break;
case DDI_INFO_DEVT2INSTANCE:
/* single instance */
*result = 0;
rc = DDI_SUCCESS;
break;
}
return (rc);
}
/* ARGSUSED */
int
{
return (0);
}
/*
* nskern_init - initialize the nskern layer at module load time.
*/
void
nskern_init(void)
{
nskernd_init();
(void) nst_startup();
}
#if (defined(DS_DDICT))
static clock_t
nskern_lbolt(void)
{
#ifdef _SunOS_5_6
return (lbolt);
return (0);
#else
return (ddi_get_lbolt());
#endif
}
#endif /* ddict */
/*
* nsc_usec()
* - return the value of the "microsecond timer emulation".
*
* Pre-SunOS 5.9:
* Actually this is a fake free running counter based on the lbolt value.
*
* SunOS 5.9+
* This is based on the gethrtime(9f) DDI facility.
*/
#if (defined(DS_DDICT))
/* these two #defines need to match! */
#endif /* ! _SunOS_5_9+ */
nsc_usec(void)
{
/* avoid divide by zero */
return (gethrtime() / 1000);
}
/*
* nsc_yield - yield the cpu.
*/
void
nsc_yield(void)
{
/* can't call yield() unless there is an lwp context */
/* do this for now */
delay(2);
}
/*
* void
* ls_ins_before(ls_elt_t *, ls_elt_t *)
* Link new into list before old.
*
* None.
*/
#ifdef lint
void
#else
void
#endif
{
}
/*
* void
* ls_ins_after(ls_elt_t *, ls_elt_t *)
* Link new into list after old.
*
* None.
*/
#ifdef lint
void
#else
void
#endif
{
}
/*
* ls_elt_t *
* ls_remque(ls_elt_t *)
* Unlink first element in the specified list.
*
* Returns the element's address or 0 if list is empty.
* Resets elements pointers to empty list state.
*/
ls_elt_t *
{
if (!LS_ISEMPTY(p)) {
}
return (result);
}
/*
* void
* ls_remove(ls_elt_t *)
* Unlink donated element for list.
*
* Resets elements pointers to empty list state.
*/
#ifdef lint
void
#else
void
#endif
{
LS_INIT(p);
}