scfconf.c revision 25cf1a301a396c38e8adf52c15f537b80d2483f7
/*
* 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
*/
#pragma ident "%Z%%M% %I% %E% SMI"
static struct driver_minor_data {
char *name;
int type;
int minor_num;
} scf_minor[] = {
{ NULL, 0}
};
/*
* Function list
*/
/*
* External function
*/
extern void scf_dscp_init(void);
extern void scf_dscp_fini(void);
/*
* External value
*/
extern int scf_devbusy_wait_time;
extern int scf_cmdend_wait_time;
extern int scf_online_wait_time;
extern int scf_rxbuff_wait_time;
extern int scf_dscp_ack_wait_time;
extern int scf_dscp_end_wait_time;
extern int scf_dscp_txbusy_time;
extern int scf_dscp_callback_time;
extern int scf_shutdown_wait_time;
extern int scf_poff_wait_time;
extern int scf_halt_wait_time;
/*
* scf_attach()
*
* Description: Driver attach() entry processing.
*
*/
int
{
#define SCF_FUNC_NAME "scf_attach() "
int instance;
struct driver_minor_data *dmdp;
int ret = DDI_FAILURE;
char wk_pathname[MAXPATHLEN];
int tm_stop_cnt;
SCF_FUNC_NAME ": start instance = %d name = %s",
sizeof (ddi_attach_cmd_t));
/* pseudo device */
if (cmd == DDI_ATTACH) {
/* get instance number */
/* allocate softstate */
DDI_SUCCESS) {
"attach ", 8);
"%s: scf_attach: "
"ddi_soft_state_zalloc failed.\n",
goto END_attach;
}
/* get softstate */
NULL) {
"attach ", 8);
"%s: scf_attach: "
"ddi_get_soft_state failed.\n",
goto END_attach;
}
/* retain dip in soft state */
/* create minor node */
DDI_PSEUDO, 0) == DDI_FAILURE) {
"%s: scf_attach: "
"ddi_create_minor_node "
"failed.\n",
/* remove minor node */
if (scf_comtbl.resource_flag &
DID_MNODE) {
NULL);
(~DID_MNODE);
}
/* soft state free */
goto END_attach;
}
"ddi_create_minor_node() is success");
}
}
ret = DDI_SUCCESS;
goto END_attach;
}
/* get SCF Driver mutex */
DDI_SUCCESS) {
"attach ", 8);
"%s: scf_attach: "
"ddi_get_iblock_cookie failed.\n",
goto END_attach;
}
}
DDI_SUCCESS) {
"attach ", 8);
"%s: scf_attach: "
"ddi_get_soft_iblock_cookie failed.\n",
goto END_attach;
}
}
/* add software interrupt handler */
"attach ", 8);
"%s: scf_attach: ddi_add_softintr failed.",
goto ATTACH_failed;
}
}
/* kstat resource initialize */
}
/* Lock driver mutex */
/* get instance number */
switch (cmd) {
case DDI_ATTACH:
/* DDI_ATTACH */
/* allocate softstate */
"attach ", 8);
"%s: scf_attach: "
"ddi_soft_state_zalloc failed.\n",
/* Unlock driver mutex */
goto END_attach;
}
/* get softstate */
"attach ", 8);
"%s: scf_attach: ddi_get_soft_state failed.\n",
/* Unlock driver mutex */
goto END_attach;
}
/* pathname get (use cmn_err) */
} else {
}
/* retain dip in soft state */
/* create minor node */
DDI_PSEUDO, 0) == DDI_FAILURE) {
"attach ", 8);
"%s: scf_attach: "
"ddi_create_minor_node failed.\n",
goto ATTACH_failed;
}
/* get configuration file */
/* map SCF registers */
"attach ", 8);
goto ATTACH_failed;
}
/* add interrupt handler */
DDI_SUCCESS) {
"attach ", 8);
"%s: scf_attach: ddi_add_intr failed.\n",
goto ATTACH_failed;
}
/* DSCP inteface initialize */
}
/* permit SCF intr */
/* first attach */
/* no execute scf device */
if (scf_comtbl.watchdog_after_resume) {
}
} else {
/* exists execute scf device */
}
/* Collect the timers which need to be stopped */
/* Unlock driver mutex */
/* Timer stop */
if (tm_stop_cnt != 0) {
}
ret = DDI_SUCCESS;
goto END_attach;
case DDI_RESUME:
/* get softstate */
"attach ", 8);
"%s: scf_attach: ddi_get_soft_state failed.\n",
/* Unlock driver mutex */
goto END_attach;
}
/* Transmitting stop release by SUSPEND */
/* queue update */
scf_comtbl.suspend_flag = 0;
if (scf_comtbl.watchdog_after_resume) {
}
/* permit SCF intr */
} else {
/* exists execute SCF device */
/* permit SCF intr */
}
} else {
}
/* Collect the timers which need to be stopped */
/* Unlock driver mutex */
/* Timer stop */
if (tm_stop_cnt != 0) {
}
ret = DDI_SUCCESS;
goto END_attach;
default:
/* Unlock driver mutex */
goto END_attach;
}
/*
* ATTACH_failed
*/
/* last SCF device */
/* DSCP interface area release */
}
/* All timer stop */
/* Collect the timers which need to be stopped */
/* Unlock driver mutex */
/* Timer stop */
if (tm_stop_cnt != 0) {
}
/* destroy kstat resources */
}
} else {
/* Unlock driver mutex */
}
/*
* END_attach
*/
return (ret);
}
/*
* scf_detach()
*
* Description: Driver detach() entry processing.
*
*/
int
{
#define SCF_FUNC_NAME "scf_detach() "
int instance;
int ret = DDI_FAILURE;
scf_state_t *next_path = 0;
int cv_ret;
int tm_stop_cnt;
SCF_FUNC_NAME ": start instance = %d name = %s",
sizeof (ddi_detach_cmd_t));
if (cmd == DDI_DETACH) {
/* get instance number */
/* remove minor node */
"ddi_remove_minor_node() is success");
}
/* soft state free */
}
ret = DDI_SUCCESS;
goto END_detach;
}
/* Lock driver mutex */
switch (cmd) {
case DDI_DETACH:
/* get instance number */
/* get softstate */
"detach ", 8);
"%s: scf_detach: ddi_get_soft_state failed.\n",
/* Unlock driver mutex */
goto END_detach;
}
if (scf_last_detach_mode == 0) {
/* Last deveice detach is error */
/* Unlock driver mutex */
goto END_detach;
}
}
}
/* SCF command transmit sync stop */
/* forbid interrupt */
if (next_path) {
/* SCF path change */
}
/* SCF command sync start */
/* free resources allocated in driver */
/* last device */
/* DSCP interface area release */
}
/* All timer stop */
/* Collect the timers which need to be stopped */
/* Unlock driver mutex */
/* Timer stop */
if (tm_stop_cnt != 0) {
}
/* destroy kstat resources */
}
} else {
/* Collect the timers which need to be stopped */
/* Unlock driver mutex */
/* Timer stop */
if (tm_stop_cnt != 0) {
}
}
/* soft state free */
ret = DDI_SUCCESS;
goto END_detach;
case DDI_SUSPEND:
/* get instance number */
/* get softstate */
"detach ", 8);
"%s: scf_detach: ddi_get_soft_state failed.\n",
/* Unlock driver mutex */
goto END_detach;
}
/* report "Shutdown start" to SCF */
/*
* if watching cpu stop it, but set flag for
* restart after resume
*/
}
/* SUSPEND wait state */
(SCF_TIMERCD_CMDEND)) + ddi_get_lbolt());
while (scf_comtbl.suspend_wait != 0) {
if (cv_ret == 0) {
scf_comtbl.suspend_wait = 0;
sizeof (kcondvar_t));
break;
} else if (cv_ret == (-1)) {
scf_comtbl.suspend_wait = 0;
break;
}
}
}
/* forbid interrupt */
/* Collect the timers which need to be stopped */
/* Unlock driver mutex */
/* Timer stop */
if (tm_stop_cnt != 0) {
}
ret = DDI_SUCCESS;
goto END_detach;
default:
/* Unlock driver mutex */
break;
}
/*
* END_detach
*/
return (ret);
}
/*
* scf_resource_free_dev()
*
* Description: Release processing of device resources.
*
*/
void
{
#define SCF_FUNC_NAME "scf_resource_free_dev() "
/* remove intr */
}
/* remove minor node */
"ddi_remove_minor_node() is success");
}
/* unmap SCF registers */
}
/*
* scf_getinfo()
*
* Description: Driver getinfo() entry processing.
*
*/
/* ARGSUSED */
int
{
#define SCF_FUNC_NAME "scf_getinfo() "
int ret;
int instance;
if (SCF_CHECK_INSTANCE(instance)) {
}
switch (cmd) {
case DDI_INFO_DEVT2INSTANCE:
ret = DDI_SUCCESS;
goto END_getinfo;
case DDI_INFO_DEVT2DEVINFO:
ret = DDI_SUCCESS;
goto END_getinfo;
}
default:
ret = DDI_FAILURE;
}
/*
* END_getinfo
*/
return (ret);
}
/*
* scf_reload_conf()
*
* Description: Read in processing of driver configuration file.
*
*/
void
{
#define SCF_FUNC_NAME "scf_reload_conf() "
int get_prm;
/*
* get driver control mode value
*/
/* SCFHALT after processing mode */
"scf_halt_proc_mode", (-1));
if (get_prm != (-1)) {
}
/*
* get alive check function parameter value
*/
/* Operation of alive check function */
"scf-alive-check-function", &wkcharp) ==
}
}
/* Interrupt interval time */
"scf-alive-interval-time", (-1));
if (get_prm != (-1)) {
}
/* Monitoring timeout */
"scf-alive-monitor-time", (-1));
if (get_prm != (-1)) {
}
/* Panic timeout */
"scf-alive-panic-time", (-1));
if (get_prm != (-1)) {
}
if ((scf_alive_interval_time < INTERVAL_TIME_MIN) ||
((scf_alive_panic_time != PANIC_TIME_NONE) &&
(scf_alive_panic_time < PANIC_TIME_MIN)) ||
}
}
/*
* get system interface control value
*/
/* SCFIOCRDCTRL wait timer value */
"scf_rdctrl_sense_wait", (-1));
}
/* Buff full wait retry timer value */
"scf_buf_ful_rtime", (-1));
if (get_prm >= 0) {
}
/* RCI busy wait retry timer value */
"scf_rci_busy_rtime", (-1));
if (get_prm >= 0) {
}
/* Tx sum retry counter */
"scf_tesum_rcnt", (-1));
if (get_prm >= 0) {
}
/* Rx sum retry counter */
"scf_resum_rcnt", (-1));
if (get_prm >= 0) {
}
/* Command to retry counter */
"scf_cmd_to_rcnt", (-1));
if (get_prm >= 0) {
}
/* Command device busy retry counter */
"scf_devbusy_wait_rcnt", (-1));
if (get_prm >= 0) {
}
/* SCF online retry counter */
"scf_online_wait_rcnt", (-1));
if (get_prm >= 0) {
}
/* SCF path change retry counter */
"scf_path_change_max", (-1));
if (get_prm >= 0) {
}
/*
* get timer control value
*/
/* SCF command busy watch timer value */
"scf_devbusy_wait_time", (-1));
if (get_prm >= 0) {
}
/* SCF command completion watch value */
"scf_cmdend_wait_time", (-1));
if (get_prm >= 0) {
}
/* SCF online watch timer value */
"scf_online_wait_time", (-1));
if (get_prm >= 0) {
}
/* Next receive wait timer value */
"scf_rxbuff_wait_time", (-1));
if (get_prm >= 0) {
}
/* DSCP interface TxACK watch timer value */
"scf_dscp_ack_wait_time", (-1));
if (get_prm >= 0) {
}
/* DSCP interface TxEND watch timer value */
"scf_dscp_end_wait_time", (-1));
if (get_prm >= 0) {
}
/* DSCP interface busy watch timer value */
"scf_dscp_txbusy_time", (-1));
if (get_prm >= 0) {
}
/* DSCP interface callback timer value */
"scf_dscp_callback_time", (-1));
if (get_prm >= 0) {
}
/* Timer value set */
}
}