0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * CDDL HEADER START
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * The contents of this file are subject to the terms of the
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * Common Development and Distribution License (the "License").
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * You may not use this file except in compliance with the License.
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * See the License for the specific language governing permissions
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * and limitations under the License.
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * When distributing Covered Code, include this CDDL HEADER in each
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * If applicable, add the following below this CDDL HEADER, with the
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * fields enclosed by brackets "[]" replaced with your own identifying
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * information: Portions Copyright [yyyy] [name of copyright owner]
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * CDDL HEADER END
dd64cd4431d441dd94f19b4b5006ea1b83ac426dRandall Ralphs * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * Use is subject to license terms.
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * Implementation of "scsi_vhci_f_tpgs_tape" T10 standard based failover_ops.
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * NOTE: for sequential devices only.
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs/* Supported device table entries. */
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphsstatic void tpgs_tape_init(void);
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphsstatic int tpgs_tape_device_probe(struct scsi_device *sd,
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs/* Failover module plumbing. */
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs#define scsi_vhci_failover_ops scsi_vhci_failover_ops_f_tpgs_tape
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs#endif /* lint */
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs "f_tpgs_tape",
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs /* The rest of the implementation comes from SFO_NAME_TPGS import */
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs * External function definitions
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphsextern struct scsi_failover_ops *vhci_failover_ops_by_name(char *);
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs/* ARGSUSED */
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphstpgs_tape_device_probe(struct scsi_device *sd, struct scsi_inquiry *inq,
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs VHCI_DEBUG(6, (CE_NOTE, NULL, "tpgs_tape_device_probe: vidpid %s\n",
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs "!tpgs_tape_device_probe: not a standard tpgs device"));
dd64cd4431d441dd94f19b4b5006ea1b83ac426dRandall Ralphs } else if (inq->inq_dtype != DTYPE_SEQUENTIAL) {
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs "!tpgs_tape_device_probe: Detected a "
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs "Standard Asymmetric device "
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs "not yet supported\n"));
dd64cd4431d441dd94f19b4b5006ea1b83ac426dRandall Ralphs } else if (vhci_tpgs_get_target_fo_mode(sd, &mode, &state, &xlf,
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs VHCI_DEBUG(4, (CE_WARN, NULL, "!unable to fetch fo "
dd64cd4431d441dd94f19b4b5006ea1b83ac426dRandall Ralphs } else if (inq->inq_tpgs == TPGS_FAILOVER_IMPLICIT) {
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs "!tpgs_tape_device_probe: Detected a "
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs "Standard Asymmetric device "
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs "with implicit failover\n"));
dd64cd4431d441dd94f19b4b5006ea1b83ac426dRandall Ralphs } else if (inq->inq_tpgs == TPGS_FAILOVER_EXPLICIT) {
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs "!tpgs_tape_device_probe: Detected a "
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs "Standard Asymmetric device "
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs "with explicit failover\n"));
dd64cd4431d441dd94f19b4b5006ea1b83ac426dRandall Ralphs } else if (inq->inq_tpgs == TPGS_FAILOVER_BOTH) {
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs "!tpgs_tape_device_probe: Detected a "
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs "Standard Asymmetric device "
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs "which supports both implicit and explicit failover\n"));
dd64cd4431d441dd94f19b4b5006ea1b83ac426dRandall Ralphs "!tpgs_tape_device_probe: "
dd64cd4431d441dd94f19b4b5006ea1b83ac426dRandall Ralphs * Policy only applies to 'client' probe, not
dd64cd4431d441dd94f19b4b5006ea1b83ac426dRandall Ralphs * vhci_is_dev_supported() pHCI probe. Detect difference
dd64cd4431d441dd94f19b4b5006ea1b83ac426dRandall Ralphs * based on ctpriv.
dd64cd4431d441dd94f19b4b5006ea1b83ac426dRandall Ralphs (mdi_set_lb_policy(sd->sd_dev, LOAD_BALANCE_NONE) !=
dd64cd4431d441dd94f19b4b5006ea1b83ac426dRandall Ralphs VHCI_DEBUG(6, (CE_NOTE, NULL, "!fail load balance none"
0205780bc43902d17f94f07ceacb0cd8d5eab20frralphs /* clone SFO_NAME_SYM implementation for most things */