oplpanel.c revision a1bf6e2eba3dc9acc46299eac9c6ef1bc1e15c2b
/*
* 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
*/
/*
* All Rights Reserved, Copyright (c) FUJITSU LIMITED 2006
*/
/*
*/
#include <sys/machsystm.h>
#ifdef DEBUG
int panel_debug = 0;
#else
#define DCMN_ERR(x)
#define panel_ddi_put8(x, y, z) ddi_put8(x, y, z)
#endif
static char *panel_name = "oplpanel";
struct panel_state {
};
struct cb_ops panel_cb_ops = {
nodev, /* open */
nodev, /* close */
nodev, /* strategy */
nodev, /* print */
nodev, /* dump */
nodev, /* read */
nodev, /* write */
nodev, /* ioctl */
nodev, /* devmap */
nodev, /* mmap */
nodev, /* segmap */
nochpoll, /* poll */
nodev, /* prop_op */
NULL, /* streamtab */
CB_REV, /* cb_rev */
nodev, /* async I/O read entry point */
nodev /* async I/O write entry point */
};
static struct dev_ops panel_dev_ops = {
DEVO_REV, /* driver build version */
0, /* device reference count */
panel_getinfo, /* getinfo */
nulldev, /* identify */
nulldev, /* probe */
panel_attach, /* attach */
panel_detach, /* detach */
nulldev, /* reset */
&panel_cb_ops, /* cb_ops */
NULL, /* bus_ops */
nulldev, /* power */
ddi_quiesce_not_supported, /* devo_quiesce */
};
/* module configuration stuff */
static void *panelstates;
extern struct mod_ops mod_driverops;
"OPL panel driver",
};
static struct modlinkage modlinkage = {
&modldrv,
0
};
int
_init(void)
{
int status;
sizeof (struct panel_state), 0);
if (status != 0) {
return (status);
}
if (status != 0) {
}
return (status);
}
int
_fini(void)
{
/*
* Can't unload to make sure the panel switch always works.
*/
return (EBUSY);
}
int
{
}
static int
{
int instance;
};
switch (cmd) {
case DDI_ATTACH:
panel_name, instance));
break;
case DDI_RESUME:
panel_name, instance));
if ((statep = (struct panel_state *)
return (DDI_FAILURE);
}
/* enable the interrupt just in case */
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
/*
* Attach routine
*/
/* alloc and get soft state */
goto attach_failed2;
}
if ((statep = (struct panel_state *)
goto attach_failed1;
}
/* set the dip in the soft state */
/* mapping register */
0, 0, /* the entire space is mapped */
goto attach_failed1;
}
/* setup the interrupt handler */
goto attach_failed0;
}
/* ATTACH SUCCESS */
/* announce the device */
/* turn on interrupt */
return (DDI_SUCCESS);
return (DDI_FAILURE);
}
static int
{
int instance;
struct panel_state *statep;
if ((statep = (struct panel_state *)
return (DDI_FAILURE);
}
switch (cmd) {
case DDI_DETACH:
panel_name, instance));
/* turn off interrupt */
/* free all resources for the dip */
/* need not free iblock_cookie */
return (DDI_SUCCESS);
case DDI_SUSPEND:
panel_name, instance));
return (DDI_SUCCESS);
default:
return (DDI_FAILURE);
}
/* Not reached */
}
/*ARGSUSED*/
static int
{
struct panel_state *statep;
int instance;
switch (cmd) {
case DDI_INFO_DEVT2DEVINFO:
if ((statep = (struct panel_state *)
return (DDI_FAILURE);
}
break;
case DDI_INFO_DEVT2INSTANCE:
break;
default:
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
static uint_t
{
/* to confirm the validity of the interrupt */
PNLINT_MASK)) {
return (DDI_INTR_UNCLAIMED);
}
/*
* Clear the PNLINT bit
* HW reported that there might be a delay in the PNLINT bit
* clearing. We force synchronization by attempting to read
* back the reg after clearing the bit.
*/
if (panel_enable) {
/* avoid double panic */
panel_enable = 0;
"System Panel Driver: Emergency panic request "
"detected!");
/* Not reached */
}
return (DDI_INTR_CLAIMED);
}
#ifdef DEBUG
static void
{
if (panel_debug) {
panel_name, value);
} else {
}
}
#endif