fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int iiopen(dev_t *devp, int flag, int otyp, cred_t *crp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int iiclose(dev_t dev, int flag, int otyp, cred_t *crp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int iiioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *crp,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int iiattach(dev_info_t *dip, ddi_attach_cmd_t cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int iidetach(dev_info_t *dip, ddi_detach_cmd_t cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int iiread();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* used for logging sysevent, gets set in _ii_attach */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst int dsw_major_rev = ISS_VERSION_MAJ; /* Major release number */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst int dsw_minor_rev = ISS_VERSION_MIN; /* Minor release number */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst int dsw_micro_rev = ISS_VERSION_MIC; /* Micro release number */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst int dsw_baseline_rev = ISS_VERSION_NUM; /* Baseline revision */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_config(intptr_t arg, int ilp32, int *rvp, int iflags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_disable(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_suspend(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_bitmap(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_segment(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_abort(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_acopy(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_copy(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_stat(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_version(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_wait(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_reset(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_offline(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_list(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_listlen(int cmd, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_export(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_join(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_copyparm(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_ocreate(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_oattach(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_odetach(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_olist(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_ostat(intptr_t arg, int ilp32, int *rvp, int is_iost_2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_bitsset(intptr_t arg, int ilp32, int cmd, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_gc_list(intptr_t, int, int *, kmutex_t *, _ii_lsthead_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_clist(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_move_grp(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int _ii_change_tag(intptr_t arg, int ilp32, int *rvp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte error = ddi_soft_state_init(&ii_statep, sizeof (struct ii_state), 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We do nothing here for now -- the kstat structure is
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * updated in-place
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* create global info structure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ii_gkstat = kstat_create("ii", 0, "global", "StorEdge",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* fill in immutable values */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iigkstat.ii_throttle_unit.value.ul = ii_throttle_unit;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iigkstat.ii_copy_direct.value.ul = ii_copy_direct;
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_WARN, "!Unable to create II global stats");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* save the dev_info_t to be used in logging using ddi_log_sysevent */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_soft_state_zalloc(ii_statep, instance) != 0) {
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_WARN, "!ii: no memory for instance %d state.",
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana "!ii: attach: could not get state for instance %d.",
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana DDI_PROP_DONTPASS | DDI_PROP_NOTPROM, "ii_debug", 0);
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_NOTE, "!ii: initializing ii version %d.%d.%d.%d",
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_NOTE, "!ii: initializing ii vers %d.%d.%d",
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_NOTE, "!ii: initializing ii version %d.%d",
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana "!ii: Value of ii_debug=%d is not 0,1 or 2.",
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana DDI_PROP_DONTPASS | DDI_PROP_NOTPROM, "ii_bitmap", II_WTHRU);
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_NOTE, "!ii: ii_bitmap is in memory");
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_NOTE, "!ii: ii_bitmap is on disk,"
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_NOTE, "!ii: ii_bitmap is on disk");
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana "!ii: ii_bitmap=%d out of range; "
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana "defaulting WTHRU(%d)", ii_bitmap, II_WTHRU);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* pick up these values if in ii.conf, otherwise leave alone */
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana DDI_PROP_DONTPASS | DDI_PROP_NOTPROM, "ii_throttle_unit", 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i > 0) {
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana "!ii: ii_throttle_unit=%d", ii_throttle_unit);
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana DDI_PROP_DONTPASS | DDI_PROP_NOTPROM, "ii_throttle_delay", 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i > 0) {
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana "!ii: ii_throttle_delay=%d", ii_throttle_delay);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ii_copy_direct = ddi_prop_get_int(DDI_DEV_T_ANY, dip,
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana DDI_PROP_DONTPASS | DDI_PROP_NOTPROM, "ii_copy_direct", 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ii_copy_direct < 0) || (ii_copy_direct > 1))
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_WARN, "!ii: _ii_init_dev failed");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_create_minor_node(dip, "ii", S_IFCHR, instance, DDI_PSEUDO, 0)
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_WARN, "!ii: could not create node.");
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana "!ii: detach: could not get state for instance %d.",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiiopen(dev_t *devp, int flag, int otyp, cred_t *crp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiiclose(dev_t dev, int flag, int otyp, cred_t *crp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_WARN, "!ii%d: %s", instance, str);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiiioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *crp, int *rvp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ilp32 = (ddi_model_convert_from(mode & FMODELS) == DDI_MODEL_ILP32);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = _ii_gc_list(arg, ilp32, rvp, &_ii_cluster_mutex,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = _ii_gc_list(arg, ilp32, rvp, &_ii_group_mutex,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dummy function