/*
* 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.
*/
/*
* to the kmdb misc module (kmdbmod).
*/
#include <sys/kobj_impl.h>
#include <sys/sysmacros.h>
/*ARGSUSED*/
static int
{
return (EINVAL);
if (secpolicy_kmdb(credp) != 0)
return (EPERM);
return (0);
}
/*ARGSUSED*/
static int
{
return (0);
}
typedef struct kdrv_flags_map {
const char *fm_name;
int fm_defval;
{ "kmdb-trap-noswitch", 0, KMDB_F_TRAP_NOSWITCH },
{ "kmdb-driver-debug", 0, KMDB_F_DRV_DEBUG },
{ NULL }
};
static int
{
char *cfg;
int i, rc;
#if defined(__x86)
if (cons_polledio == NULL) {
return (ENOTSUP);
}
#endif
DDI_PROP_DONTPASS, "kmdb-memseg-size", 0);
}
}
return (rc);
}
static int
kdrv_deactivate(void)
{
return (kctl_deactivate());
}
/*ARGSUSED*/
static int
int *rvalp)
{
switch (cmd) {
case KMDB_IOC_START:
return (kdrv_activate(arg));
case KMDB_IOC_STOP:
return (kdrv_deactivate());
default:
return (EINVAL);
}
}
/*ARGSUSED*/
static int
{
switch (infocmd) {
case DDI_INFO_DEVT2DEVINFO:
break;
case DDI_INFO_DEVT2INSTANCE:
break;
default:
error = DDI_FAILURE;
}
return (error);
}
static int
{
if (cmd != DDI_ATTACH)
return (DDI_FAILURE);
return (DDI_FAILURE);
if (kctl_attach(dip) != 0)
return (DDI_FAILURE);
return (DDI_SUCCESS);
}
static int
{
if (cmd != DDI_DETACH)
return (DDI_FAILURE);
if (kctl_detach() == EBUSY)
return (DDI_FAILURE);
return (DDI_SUCCESS);
}
nodev, /* not a block driver */
nodev, /* no print routine */
nodev, /* no dump routine */
nodev, /* no read routine */
nodev, /* no write routine */
nodev, /* no devmap routine */
nodev, /* no mmap routine */
nodev, /* no segmap routine */
nochpoll, /* no chpoll routine */
0, /* not a STREAMS driver */
};
DEVO_REV, /* devo_rev */
0, /* devo_refcnt */
kdrv_getinfo, /* devo_getinfo */
nulldev, /* devo_identify */
nulldev, /* devo_probe */
kdrv_attach, /* devo_attach */
kdrv_detach, /* devo_detach */
nodev, /* devo_reset */
&kdrv_cb_ops, /* devo_cb_ops */
(struct bus_ops *)0, /* devo_bus_ops */
NULL, /* devo_power */
ddi_quiesce_not_needed, /* devo_quiesce */
};
"kmdb driver",
};
(void *)&modldrv,
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
{
}
int
_fini(void)
{
return (mod_remove(&modlinkage));
}