ql_xioctl.c revision fcf3ce441efd61da9bb2884968af01cb7c1452cc
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
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Copyright 2008 QLogic Corporation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#pragma ident "Copyright 2008 QLogic Corporation; ql_xioctl.c"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ISP2xxx Solaris Fibre Channel Adapter (FCA) driver source file.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ***********************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * * NOTICE **
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * * COPYRIGHT (C) 1996-2008 QLOGIC CORPORATION **
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * * ALL RIGHTS RESERVED **
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ***********************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Local data
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Local prototypes
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int ql_sdm_ioctl(ql_adapter_state_t *, int, void *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int ql_sdm_setup(ql_adapter_state_t *, EXT_IOCTL **, void *, int,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic boolean_t ql_validate_signature(EXT_IOCTL *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int ql_sdm_return(ql_adapter_state_t *, EXT_IOCTL *, void *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_query(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_qry_hba_node(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_qry_hba_port(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_qry_disc_port(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_qry_disc_tgt(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_qry_fw(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_qry_chip(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_qry_driver(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_fcct(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_aen_reg(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_aen_get(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_scsi_passthru(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_wwpn_to_scsiaddr(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_host_idx(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_host_drvname(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_read_nvram(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_write_nvram(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_read_flash(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_write_flash(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_write_vpd(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_read_vpd(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_diagnostic_loopback(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_send_els_rnid(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_set_host_data(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_get_host_data(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int ql_lun_count(ql_adapter_state_t *, ql_tgt_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int ql_report_lun(ql_adapter_state_t *, ql_tgt_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int ql_inq_scan(ql_adapter_state_t *, ql_tgt_t *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int ql_inq(ql_adapter_state_t *, ql_tgt_t *, int, ql_mbx_iocb_t *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uint32_t ql_get_buffer_data(caddr_t, caddr_t, uint32_t, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uint32_t ql_send_buffer_data(caddr_t, caddr_t, uint32_t, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ql_tgt_t *ql_find_port(ql_adapter_state_t *, uint8_t *, uint16_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int ql_flash_fcode_load(ql_adapter_state_t *, void *, uint32_t, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int ql_load_fcode(ql_adapter_state_t *, uint8_t *, uint32_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int ql_flash_fcode_dump(ql_adapter_state_t *, void *, uint32_t, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int ql_program_flash_address(ql_adapter_state_t *, uint32_t,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_set_rnid_parameters(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_get_rnid_parameters(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int ql_reset_statistics(ql_adapter_state_t *, EXT_IOCTL *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_get_statistics(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_get_statistics_fc(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_get_statistics_fc4(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_set_led_state(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_get_led_state(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_drive_led(ql_adapter_state_t *, uint32_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uint32_t ql_setup_led(ql_adapter_state_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uint32_t ql_wrapup_led(ql_adapter_state_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_get_port_summary(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_get_target_id(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_get_sfp(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int ql_dump_sfp(ql_adapter_state_t *, void *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic ql_fcache_t *ql_setup_fnode(ql_adapter_state_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_get_fcache(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_get_fcache_ex(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_update_fcache(ql_adapter_state_t *, uint8_t *, uint32_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int ql_check_pci(ql_adapter_state_t *, ql_fcache_t *, uint32_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_port_param(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int ql_check_pci(ql_adapter_state_t *, ql_fcache_t *, uint32_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_get_pci_data(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_get_fwfcetrace(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_get_fwexttrace(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_menlo_reset(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_menlo_get_fw_version(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_menlo_update_fw(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_menlo_manage_info(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int ql_suspend_hba(ql_adapter_state_t *, uint32_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_get_vp_cnt_id(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_vp_ioctl(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_qry_vport(ql_adapter_state_t *, EXT_IOCTL *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ******************************************************************** */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* External IOCTL support. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ******************************************************************** */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_alloc_xioctl_resource
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Allocates resources needed by module code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): already allocated exiting\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte xp = kmem_zalloc(sizeof (ql_xioctl_t), KM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate AEN tracking buffer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte xp->aen_tracking_queue = kmem_zalloc(EXT_DEF_MAX_AEN_QUEUE *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_free_xioctl_resource
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Frees resources used by module code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): already freed\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmem_free(xp->aen_tracking_queue, EXT_DEF_MAX_AEN_QUEUE *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * External IOCTL processing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: function to perform
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * arg: data type varies with request
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cred_p: credentials pointer
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * rval_p: pointer to result value
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0: success
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ENXIO: No such device or address
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ENOPROTOOPT: Protocol not available
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_xioctl(ql_adapter_state_t *ha, int cmd, intptr_t arg, int mode,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered, cmd=%d\n", ha->instance, cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): no context\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* function not supported. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_sdm_ioctl
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Provides ioctl functions for SAN/Device Management functions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * AKA External Ioctl functions.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ioctl_code: ioctl function to perform
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * arg: Pointer to EXT_IOCTL cmd data in application land.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0: success
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ENOMEM: Alloc of local EXT_IOCTL struct failed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * EFAULT: Copyin of caller's EXT_IOCTL struct failed or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * copyout of EXT_IOCTL status info failed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * EINVAL: Signature or version of caller's EXT_IOCTL invalid.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * EBUSY: Device busy
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_sdm_ioctl(ql_adapter_state_t *ha, int ioctl_code, void *arg, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy argument structure (EXT_IOCTL) from application land. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * a non-zero value at this time means a problem getting
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the requested information from application land, just
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * return the error code and hope for the best.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Map the physical ha ptr (which the ioctl is called with)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to the virtual ha that the caller is addressing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Special case: HbaSelect == 0 is physical ha
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If we can't find the specified vp index then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * we probably have an error (vp indexes shifting
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * under our feet?).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If driver is suspended or stalled, rtn BUSY so caller
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * can try again at some later time
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ha->flags & ADAPTER_SUSPENDED ? "suspended" : "stalled");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return results to caller */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* function not supported. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, function not supported=%d\n", ioctl_code);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return results to caller */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_sdm_setup
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Make a local copy of the EXT_IOCTL struct and validate it.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd_struct: Pointer to location to store local adrs of EXT_IOCTL.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * arg: Address of application EXT_IOCTL cmd data
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * val_sig: Pointer to a function to validate the ioctl signature.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0: success
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * EFAULT: Copy in error of application EXT_IOCTL struct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * EINVAL: Invalid version, signature.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ENOMEM: Local allocation of EXT_IOCTL failed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_sdm_setup(ql_adapter_state_t *ha, EXT_IOCTL **cmd_struct, void *arg,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate local memory for EXT_IOCTL. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmd = (EXT_IOCTL *)kmem_zalloc(sizeof (EXT_IOCTL), KM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get argument structure. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ddi_copyin(arg, (void *)cmd, sizeof (EXT_IOCTL), mode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Check signature and the version.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If either are not valid then neither is the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * structure so don't attempt to return any error status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * because we can't trust what caller's arg points to.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Just return the errno.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_validate_signature
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Validate the signature string for an external ioctl call.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sg: Pointer to EXT_IOCTL signature to validate.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * B_TRUE: Signature is valid.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * B_FALSE: Signature is NOT valid.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Check signature.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If signature is not valid then neither is the rest of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the structure (e.g., can't trust it), so don't attempt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to return any error status other than the errno.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bcmp(&cmd_struct->Signature, "QLOGIC", 6) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_sdm_return
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copies return data/status to application land for
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ioctl call using the SAN/Device Management EXT_IOCTL call interface.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Pointer to kernel copy of requestor's EXT_IOCTL struct.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ioctl_code: ioctl function to perform
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * arg: EXT_IOCTL cmd data in application land.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0: success
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * EFAULT: Copy out error.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_sdm_return(ql_adapter_state_t *ha, EXT_IOCTL *cmd, void *arg, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)&(((EXT_IOCTL*)arg)->ResponseLen), sizeof (uint32_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Some copyout operation failed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs all EXT_CC_QUERY functions.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Local EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_query(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered, cmd=%d\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* case off on command subcode */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* function not supported. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_qry_hba_node
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_SC_QUERY_HBA_NODE subfunction.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_qry_hba_node(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* fill in the values */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(ha->loginparams.node_ww_name.raw_wwn, tmp_node.WWNN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf((char *)(tmp_node.Manufacturer), "QLogic Corporation");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf((char *)(tmp_node.Model), "%x", ha->device_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf((char *)(tmp_node.DriverVersion), QL_VERSION);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte verlen = strlen((char *)(tmp_node.DriverVersion));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, No room for fpga version string\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte w = (uint16_t)ddi_get16(ha->sbus_fpga_dev_handle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmpptr = (char *)&(tmp_node.DriverVersion[verlen+1]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf((char *)(tmp_node.FWVersion), "%01d.%02d.%02d",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcat((char *)(tmp_node.FWVersion), " EF");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcat((char *)(tmp_node.FWVersion), " TP");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcat((char *)(tmp_node.FWVersion), " IP");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcat((char *)(tmp_node.FWVersion), " IPX");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcat((char *)(tmp_node.FWVersion), " FL");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcat((char *)(tmp_node.FWVersion), " FLX");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* FCode version. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*LINTED [Solaris DDI_DEV_T_ANY Lint error]*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_getlongprop(DDI_DEV_T_ANY, ha->dip, PROP_LEN_AND_VAL_ALLOC |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DDI_PROP_DONTPASS | DDI_PROP_CANSLEEP, "version", (caddr_t)&bufp,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_node.OptRomVersion[EXT_DEF_MAX_STR_SIZE - 1] =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf((char *)tmp_node.OptRomVersion, "0");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_qry_hba_port
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_SC_QUERY_HBA_PORT subfunction.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_qry_hba_port(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ResponseLen < EXT_HBA_NODE, Len=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* fill in the values */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(ha->loginparams.nport_ww_name.raw_wwn, tmp_port.WWPN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* For now we are initiator only driver */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fill in the portspeed values.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * default to not yet negotiated state
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_port.PortSpeed = EXT_PORTSPEED_NOT_NEGOTIATED;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Report all supported port speeds */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_port.PortSupportedSpeed = (EXT_DEF_PORTSPEED_8GBIT |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EXT_DEF_PORTSPEED_4GBIT | EXT_DEF_PORTSPEED_2GBIT |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Correct supported speeds based on type of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sfp that is present
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* no sfp detected */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 4GB sfp */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 8GB sfp */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_port.PortSupportedSpeed = (EXT_DEF_PORTSPEED_4GBIT |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EXT_DEF_PORTSPEED_2GBIT | EXT_DEF_PORTSPEED_1GBIT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_port.PortSupportedSpeed = (EXT_DEF_PORTSPEED_2GBIT |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_port.PortSupportedSpeed = EXT_DEF_PORTSPEED_2GBIT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_port.PortSupportedSpeed = EXT_DEF_PORTSPEED_1GBIT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_port.PortSupportedSpeed = EXT_DEF_PORTSPEED_UNKNOWN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "unknown HBA type: %xh\n", ha->device_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (index = 0; index < DEVICE_HEAD_LIST_SIZE; index++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_port.DiscPortNameType = EXT_DEF_USE_NODE_NAME;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting, ports=%d, targets=%d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_qry_disc_port
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_SC_QUERY_DISC_PORT subfunction.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd->Instance = Port instance in fcport chain.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_qry_disc_port(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ResponseLen < EXT_DISC_PORT, Len=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte index < DEVICE_HEAD_LIST_SIZE && link == NULL; index++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* fill in the values */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* no matching device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, port not found port=%d\n", cmd->Instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_port.Type = (uint16_t)(tmp_port.Type | EXT_DEF_TAPE_DEV);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_port.Type = (uint16_t)(tmp_port.Type | EXT_DEF_FABRIC_DEV);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_port.Type = (uint16_t)(tmp_port.Type | EXT_DEF_TARGET_DEV);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_qry_disc_tgt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_SC_QUERY_DISC_TGT subfunction.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd->Instance = Port instance in fcport chain.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_qry_disc_tgt(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered, target=%d\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd->ResponseLen < sizeof (EXT_DISC_TARGET)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ResponseLen < EXT_DISC_TARGET, Len=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Scan port list for requested target and fill in the values */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte index < DEVICE_HEAD_LIST_SIZE && link == NULL; index++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* fill in the values */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* no matching device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, not found target=%d\n", cmd->Instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_tgt.LunCount = (uint16_t)ql_lun_count(ha, tq);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_tgt.Type = (uint16_t)(tmp_tgt.Type | EXT_DEF_TAPE_DEV);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_tgt.Type = (uint16_t)(tmp_tgt.Type | EXT_DEF_FABRIC_DEV);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_tgt.Type = (uint16_t)(tmp_tgt.Type | EXT_DEF_TARGET_DEV);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_SC_QUERY_FW subfunction.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_qry_fw(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ResponseLen < EXT_FW, Len=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf((char *)(fw_info.Version), "%d.%d.%d", mr.mb[1],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyout((void *)&fw_info, (void *)(uintptr_t)(cmd->ResponseAdr),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_qry_chip
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_SC_QUERY_CHIP subfunction.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_qry_chip(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ResponseLen < EXT_CHIP, Len=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte chip.IoAddr = ql_pci_config_get32(ha, PCI_CONF_BASE0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte chip.MemAddr = ql_pci_config_get32(ha, PCI_CONF_BASE1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyout((void *)&chip, (void *)(uintptr_t)(cmd->ResponseAdr),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_qry_driver
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_SC_QUERY_DRIVER subfunction.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_qry_driver(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ResponseLen < EXT_DRIVER, Len=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy((void *)&qd.Version[0], QL_VERSION);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (CFG_IST(ha, (CFG_CTRL_2425|CFG_EXT_FW_INTERFACE)) ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyout((void *)&qd, (void *)(uintptr_t)cmd->ResponseAdr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * IOCTL management server FC-CT passthrough.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: User space CT arguments pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_fcct(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get CT argument structure. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Login management server device. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tq.loop_id = (uint16_t)(CFG_IST(ha, CFG_CTRL_2425) ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ql_login_fport(ha, &tq, tq.loop_id, LFF_NO_PRLI, &mr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): cmd\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate a DMA Memory Descriptor */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dma_mem = (dma_mem_t *)kmem_zalloc(sizeof (dma_mem_t), KM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Determine maximum buffer size. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate command block. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt_size = (uint32_t)(sizeof (ql_mbx_iocb_t) + pld_byte_cnt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get command payload data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_get_buffer_data((caddr_t)(uintptr_t)cmd->RequestAdr, pld,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get DMA memory for the IOCB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_get_dma_mem(ha, dma_mem, pkt_size, LITTLE_ENDIAN_DMA,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy out going payload data to IOCB DMA buffer. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_rep_put8(dma_mem->acc_handle, (uint8_t *)pld,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uint8_t *)dma_mem->bp, pld_byte_cnt, DDI_DEV_AUTOINCR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Sync IOCB DMA buffer. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) ddi_dma_sync(dma_mem->dma_handle, 0, pld_byte_cnt,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Setup IOCB
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set loop ID */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set ISP command timeout. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set cmd/response data segment counts. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load ct cmd byte count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->ms24.cmd_byte_count = LE_32(cmd->RequestLen);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load ct rsp byte count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->ms24.resp_byte_count = LE_32(cmd->ResponseLen);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte long_ptr = (uint32_t *)&pkt->ms24.dseg_0_address;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load MS command entry data segments. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *long_ptr++ = (uint32_t)(LE_32(cmd->RequestLen));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load MS response entry data segments. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte comp_status = (uint16_t)LE_16(pkt->sts24.comp_status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rval != QL_SUCCESS || (pkt->sts24.entry_status & 0x3c) !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "es=%xh, ss_l=%xh, rval=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set loop ID */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte loop_id = (uint16_t)(ct->gs_type == GS_TYPE_DIR_SERVER ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SIMPLE_NAME_SERVER_LOOP_ID : MANAGEMENT_SERVER_LOOP_ID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set ISP command timeout. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set data segment counts. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Response total byte count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->ms.resp_byte_count = LE_32(cmd->ResponseLen);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Command total byte count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load command/response data segments. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte comp_status = (uint16_t)LE_16(pkt->sts.comp_status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rval != QL_SUCCESS || (pkt->sts.entry_status & 0x7e) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "es=%xh, rval=%xh\n", pkt->sts.entry_status, rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Sync in coming DMA buffer. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy in coming DMA data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_rep_get8(dma_mem->acc_handle, (uint8_t *)pld,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy response payload from DMA buffer to application. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): ResponseLen=%d\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Send response payload. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_aen_reg
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * IOCTL management server Asynchronous Event Tracking Enable/Disable.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_aen_reg(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ddi_copyin((void*)(uintptr_t)(cmd->RequestAdr), ®_struct,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Empty the queue. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_aen_get
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * IOCTL management server Asynchronous Event Record Transfer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_aen_get(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Compute the number of events that can be returned */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte request_cnt = (uint8_t)(cmd->ResponseLen / sizeof (EXT_ASYNC_EVENT));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, request_cnt < EXT_DEF_MAX_AEN_QUEUE, "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 1st: Make a local copy of the entire queue content. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_q = (EXT_ASYNC_EVENT *)xp->aen_tracking_queue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_q[i].AsyncEventCode = 0; /* empty out the slot */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Empty the queue. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* 2nd: Now transfer the queue content to user buffer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy the entire queue to user's buffer. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte out_size = (uint32_t)(queue_cnt * sizeof (EXT_ASYNC_EVENT));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_enqueue_aen
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * event_code: async event code of the event to add to queue.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * payload: event payload for the queue.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * INTR_LOCK must be already obtained.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interrupt or Kernel context, no mailbox commands allowed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_enqueue_aen(ql_adapter_state_t *ha, uint16_t event_code, void *payload)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered, event_code=%d\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): no context\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte aen_queue = (EXT_ASYNC_EVENT *)xp->aen_tracking_queue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (aen_queue[xp->aen_q_tail].AsyncEventCode != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Need to change queue pointers to make room. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Increment tail for adding new entry. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We're overwriting the oldest entry, so need to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * update the head pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte aen_queue[new_entry].AsyncEventCode = event_code;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Update payload */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* domain */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* save in big endian */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Not supported */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_scsi_passthru
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * IOCTL SCSI passthrough.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: User space SCSI command pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_scsi_passthru(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* SCSI request struct for SCSI passthrough IOs. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Verify Sub Code and set cnt to needed request size. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (cmd->SubCode == EXT_SC_SEND_FC_SCSI_PASSTHRU) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, invalid SubCode=%xh\n", cmd->SubCode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dma_mem = (dma_mem_t *)kmem_zalloc(sizeof (dma_mem_t), KM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Verify the size of and copy in the passthru request structure. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, RequestLen != cnt, is=%xh, expected=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((const void *)(uintptr_t)(uintptr_t)cmd->RequestAdr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Find fc_port from SCSI PASSTHRU structure fill in the scsi_req
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * request data structure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte scsi_req.sense_length = sizeof (sp_req->SenseData);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte usp_req = (EXT_SCSI_PASSTHRU *)(uintptr_t)cmd->RequestAdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): SubCode=%xh, Target=%lld\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ha->instance, cmd->SubCode, sp_req->TargetAddr.Target);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Must be FC PASSTHRU, verified above.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fc_req->FCScsiAddr.DestType == EXT_DEF_DESTTYPE_WWPN) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "wwpn=%02x%02x%02x%02x%02x%02x%02x%02x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "wwnn=%02x%02x%02x%02x%02x%02x%02x%02x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, SubCode=%xh invalid DestType=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte scsi_req.sense_length = sizeof (fc_req->SenseData);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ufc_req = (EXT_FC_SCSI_PASSTHRU *)(uintptr_t)cmd->RequestAdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (tq == NULL || !VALID_TARGET_ID(ha, tq->loop_id)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "target not available; loopid=%xh\n", tq->loop_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate command block. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((scsi_req.direction == EXT_DEF_SCSI_PASSTHRU_DATA_IN ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte scsi_req.direction == EXT_DEF_SCSI_PASSTHRU_DATA_OUT) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt_size = (uint32_t)(sizeof (ql_mbx_iocb_t) + pld_size);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get DMA memory for the IOCB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_get_dma_mem(ha, dma_mem, pld_size, LITTLE_ENDIAN_DMA,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmn_err(CE_WARN, "%s(%d): request queue DMA memory "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (scsi_req.direction == EXT_DEF_SCSI_PASSTHRU_DATA_IN) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get command payload. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy out going data to DMA buffer. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_rep_put8(dma_mem->acc_handle, (uint8_t *)pld,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Sync DMA buffer. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* retries = ha->port_down_retry_count; */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): SCSI cdb\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set LUN number */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set N_port handle */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->cmd24.n_port_hdl = (uint16_t)LE_16(tq->loop_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set VP Index */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set target ID */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set ISP command timeout. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load SCSI CDB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_rep_put8(ha->hba_buf.acc_handle, scsi_req.cdbp,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set tag queue control flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set transfer direction. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set data segment count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load total byte count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load data descriptor. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (CFG_IST(ha, CFG_ENABLE_64BIT_ADDRESSING)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Go issue command and wait for completion. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): request pkt\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = ql_issue_mbx_iocb(ha, (caddr_t)pkt, pkt_size);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Sync in coming DMA buffer. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy in coming DMA data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_rep_get8(dma_mem->acc_handle, (uint8_t *)pld,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (status == QL_SUCCESS && pkt->sts.entry_status != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sts.comp_status = (uint16_t)(CFG_IST(ha, CFG_CTRL_2425) ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We have verified about all the request that can be so far.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Now we need to start verification of our ability to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * actually issue the CDB.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Cannot issue command now, maybe later */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Command error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Setup status. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Setup residuals. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sts.residual_length = LE_32(pkt->sts24.residual_length);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Setup state flags. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pld_size && sts.comp_status != CS_DATA_UNDERRUN) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sts.state_flags_h = (uint8_t)(sts.state_flags_h |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sts.state_flags_h = (uint8_t)(sts.state_flags_h |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sts.state_flags_l = (uint8_t)(sts.state_flags_l |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sts.state_flags_l = (uint8_t)(sts.state_flags_l |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sts.state_flags_l = (uint8_t)(sts.state_flags_l | SF_SIMPLE_Q);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Setup FCP response info. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sts.rsp_info_length = sts.scsi_status_h & FCP_RSP_LEN_VALID ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Setup sense data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sts.state_flags_h = (uint8_t)(sts.state_flags_h |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cnt2 = (uint16_t)(((uintptr_t)pkt + sizeof (sts_24xx_entry_t)) -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (cnt = 0; cnt < cnt2; cnt = (uint16_t)(cnt + 4)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Setup residuals. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sts.residual_length = LE_32(pkt->sts.residual_length);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Setup state flags. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Setup FCP response info. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sts.rsp_info_length = sts.scsi_status_h & FCP_RSP_LEN_VALID ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Setup sense data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sts.req_sense_length = sts.scsi_status_h & FCP_SNS_LEN_VALID ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sts.req_sense_data = &pkt->sts.req_sense_data[0];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): response pkt\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If non data transfer commands fix tranfer counts.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Non data transfer command, clear sts_entry residual
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Correct ISP completion status */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (sts.comp_status == CS_COMPLETE && sts.scsi_status_l == 0 &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): Correct completion\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (sts.comp_status == CS_DATA_UNDERRUN) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): error d_id=%xh, comp_status=%xh, "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "scsi_status_h=%xh, scsi_status_l=%xh\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tq->d_id.b24, sts.comp_status, sts.scsi_status_h,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Handle residual count on SCSI check
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * condition.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * - If Residual Under / Over is set, use the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Residual Transfer Length field in IOCB.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * - If Residual Under / Over is not set, and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Transferred Data bit is set in State Flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * field of IOCB, report residual value of 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * (you may want to do this for tape
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Write-type commands only). This takes care
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of logical end of tape problem and does
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * not break Unit Attention.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * - If Residual Under / Over is not set, and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Transferred Data bit is not set in State
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Flags, report residual value equal to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * original data transfer length.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Check condition with vaild sense data flag set and sense
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * length != 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (sts.req_sense_length > scsi_req.sense_length) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, Check Condition Status, d_id=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_DUMP_2(sts.req_sense_data, 8, sts.req_sense_length);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyout(sts.req_sense_data, scsi_req.u_sense,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy response payload from DMA buffer to application. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): Data Return resid=%lu, "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "byte_count=%u, ResponseLen=%xh\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Send response payload. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, cmd->Status=%xh, comp_status=%xh, "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "d_id=%xh\n", cmd->Status, sts.comp_status, tq->d_id.b24);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting, ResponseLen=%d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_wwpn_to_scsiaddr
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_wwpn_to_scsiaddr(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = ddi_copyin((void*)(uintptr_t)(cmd->RequestAdr), wwpn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (tq == NULL || tq->flags & TQF_INITIATOR_DEVICE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* no matching device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy out the IDs found. For now we can only return target ID. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_addr = (EXT_SCSI_ADDR *)(uintptr_t)cmd->ResponseAdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = ddi_copyout((void *)wwpn, (void *)&tmp_addr->Target, 8, mode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_host_idx
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets host order index.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_host_idx(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ResponseLen < Len=%xh\n", cmd->ResponseLen);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyout((void *)&idx, (void *)(uintptr_t)(cmd->ResponseAdr),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_host_drvname
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets host driver name
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_host_drvname(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ResponseLen: %xh, needed: %xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyout((void *)&drvname, (void *)(uintptr_t)(cmd->ResponseAdr),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_read_nvram
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get NVRAM contents.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_read_nvram(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_size = (uint32_t)(CFG_IST(ha, CFG_CTRL_2425) ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ResponseLen != NVRAM, Len=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get NVRAM data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)(uintptr_t)(cmd->ResponseAdr), mode) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_write_nvram
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Loads NVRAM contents.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_write_nvram(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nv_size = (uint32_t)(CFG_IST(ha, CFG_CTRL_2425) ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load NVRAM data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_nv_util_load(ha, (void *)(uintptr_t)(cmd->RequestAdr),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_write_vpd
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Loads VPD contents.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_write_vpd(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, RequestLen != VPD len, len passed=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load VPD data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((rval = ql_vpd_load(ha, (void *)(uintptr_t)(cmd->RequestAdr),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_read_vpd
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dumps VPD contents.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_read_vpd(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ResponseLen < VPD len, len passed=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Dump VPD data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ql_vpd_dump(ha, (void *)(uintptr_t)(cmd->ResponseAdr),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_fcache
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dumps flash cache contents.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_fcache(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ResponseLen < %d, len passed=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * For backwards compatibility, get one of each image type
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while ((fptr != NULL) && (fptr->buf != NULL) && (types != 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the next image */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fptr = ql_get_fbuf(ha->fcache, types)) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cpsize = (fptr->buflen < 100 ? fptr->buflen : 100);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get the firmware image -- it needs to be last in the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * buffer at offset 300 for backwards compatibility. Also for
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * backwards compatibility, the pci header is stripped off.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fptr = ql_get_fbuf(ha->fcache, FTYPE_FW)) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte hsize = sizeof (pci_header_t) + sizeof (pci_data_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "header size (%xh) exceeds buflen (%xh)\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_fcache_ex
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dumps flash cache contents.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_fcache_ex(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Make sure user passed enough buffer space */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (fptr = ha->fcache; fptr != NULL; fptr = fptr->next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ResponseLen < %d, len passed=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the next image */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (fptr->buflen < FBUFSIZE ? fptr->buflen : FBUFSIZE),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ddicopy at %xh, exiting\n", boff);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_read_flash
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get flash contents.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_read_flash(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ResponseLen=%xh, flash size=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* adjust read size to flash size */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get flash data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Resume I/O */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ql_awaken_task_daemon(ha, NULL, ISP_ABORT_NEEDED,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_write_flash
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Loads flash contents.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_write_flash(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load flash data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, RequestLen=%xh, flash size=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Resume I/O */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ql_awaken_task_daemon(ha, NULL, ISP_ABORT_NEEDED,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_diagnostic_loopback
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_CC_LOOPBACK Command
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Local EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_diagnostic_loopback(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get loop back request. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((const void *)(uintptr_t)cmd->RequestAdr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check transfer length fits in buffer. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (plbreq.BufferLength < plbreq.TransferCount &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate command memory. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bp = kmem_zalloc(plbreq.TransferCount, KM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get loopback data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_get_buffer_data((caddr_t)(uintptr_t)plbreq.BufferAddress,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bp, plbreq.TransferCount, mode) != plbreq.TransferCount) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (DRIVER_SUSPENDED(ha) || ql_stall_driver(ha, 0) != QL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Shutdown IP. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* determine topology so we can send the loopback or the echo */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Echo is supported on 2300's only and above */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ha->topology & QL_F_PORT) && ha->device_id >= 0x2300) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): F_PORT topology -- using echo\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ql_diag_echo(ha, bp, plbreq.TransferCount, 0, &mr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ql_diag_loopback(ha, bp, plbreq.TransferCount,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Restart IP if it was shutdown. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ha->flags & IP_ENABLED && !(ha->flags & IP_INITIALIZED)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, diagnostic_loopback_mbx=%xh\n", rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return loopback data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_send_buffer_data(bp, (caddr_t)(uintptr_t)plbreq.BufferAddress,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plbreq.TransferCount, mode) != plbreq.TransferCount) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return loopback results. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte plbrsp.IterationCountLastError = (mr.mb[19] >> 16) | mr.mb[18];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_send_els_rnid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * IOCTL for extended link service RNID command.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: User space CT arguments pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_send_els_rnid(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* parameter error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, RequestLen < EXT_RNID_REQ, Len=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((void*)(uintptr_t)(cmd->RequestAdr),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Find loop ID of the device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bcmp((void *)bptr, (void *)tmp_rnid.Addr.FcAddr.WWNN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uint8_t *)tmp_rnid.Addr.FcAddr.WWNN, QLNT_NODE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (tmp_rnid.Addr.Type == EXT_DEF_TYPE_WWPN) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bcmp((void *)bptr, (void *)tmp_rnid.Addr.FcAddr.WWPN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uint8_t *)tmp_rnid.Addr.FcAddr.WWPN, QLNT_PORT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (tmp_rnid.Addr.Type == EXT_DEF_TYPE_PORTID) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copy caller's d_id to tmp space.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(&tmp_rnid.Addr.FcAddr.Id[1], tmp_fcid.r.d_id,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bcmp((void *)&ha->d_id, (void *)tmp_fcid.r.d_id,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tq = ql_find_port(ha, (uint8_t *)tmp_fcid.r.d_id,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate memory for command. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_buf = kmem_zalloc(SEND_RNID_RSP_SIZE, KM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ql_get_rnid_params(ha, SEND_RNID_RSP_SIZE, tmp_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, get_rnid_params_mbx=%xh\n", rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Save gotten RNID data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(tmp_buf, &rnid_data, sizeof (EXT_RNID_DATA));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Now build the Send RNID response */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_buf[0] = (char)(EXT_DEF_RNID_DFORMAT_TOPO_DISC);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(ha->init_ctrl_blk.cb24.port_name, &tmp_buf[4],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(ha->init_ctrl_blk.cb.port_name, &tmp_buf[4],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* no matching device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Send command */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uint8_t)tmp_rnid.DataFormat, SEND_RNID_RSP_SIZE, tmp_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uint8_t)tmp_rnid.DataFormat, SEND_RNID_RSP_SIZE,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy the response */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte copy_len = (cmd->ResponseLen > SEND_RNID_RSP_SIZE) ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_send_buffer_data(tmp_buf, (caddr_t)(uintptr_t)cmd->ResponseAdr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (cmd->ResponseLen > SEND_RNID_RSP_SIZE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_set_host_data
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Process IOCTL subcommand to set host/adapter related data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: User space CT arguments pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_set_host_data(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered, SubCode=%d\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * case off on command subcode
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* function not supported. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, function not supported=%d\n", cmd->SubCode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_host_data
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_CC_GET_DATA subcommands.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Local EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_host_data(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered, SubCode=%d\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* case off on command subcode */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* function not supported. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, function not supported=%d\n", cmd->SubCode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ******************************************************************** */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Helper Functions */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ******************************************************************** */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_lun_count
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get numbers of LUNS on target.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * q: device queue pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Number of LUNs.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_lun_count(ql_adapter_state_t *ha, ql_tgt_t *tq)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Bypass LUNs that failed. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cnt = ql_inq_scan(ha, tq, ha->maximum_luns_per_target);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_report_lun
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get numbers of LUNS using report LUN command.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * q: target queue pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Number of LUNs.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_report_lun(ql_adapter_state_t *ha, ql_tgt_t *tq)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt_size = sizeof (ql_mbx_iocb_t) + sizeof (ql_rpt_lun_lst_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rpt = (ql_rpt_lun_lst_t *)((caddr_t)pkt + sizeof (ql_mbx_iocb_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get DMA memory for the IOCB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_get_dma_mem(ha, &dma_mem, sizeof (ql_rpt_lun_lst_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte LITTLE_ENDIAN_DMA, MEM_RING_ALIGN) != QL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set N_port handle */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->cmd24.n_port_hdl = (uint16_t)LE_16(tq->loop_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set target ID */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set ISP command timeout. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load SCSI CDB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set tag queue control flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set transfer direction. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set data segment count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load total byte count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load data descriptor. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (CFG_IST(ha, CFG_ENABLE_64BIT_ADDRESSING)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->cmd3.control_flags_l = CF_DATA_IN | CF_STAG;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Sync in coming DMA buffer. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) ddi_dma_sync(dma_mem.dma_handle, 0, dma_mem.size,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy in coming DMA data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uint8_t *)dma_mem.bp, dma_mem.size, DDI_DEV_AUTOINCR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte comp_status = (uint16_t)LE_16(pkt->sts24.comp_status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte comp_status = (uint16_t)LE_16(pkt->sts.comp_status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rval == QL_SUCCESS && pkt->sts.entry_status != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rval != QL_SUCCESS || comp_status != CS_COMPLETE ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Device underrun, treat as OK. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, issue_iocb=%xh, d_id=%xh, cs=%xh, "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%3xh%3xh%3xh%3xh%3xh%3xh%3xh%3xh%3xh"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): LUN list\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_inq_scan
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get numbers of LUNS using inquiry command.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * tq: target queue pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * count: scan for the number of existing LUNs.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Number of LUNs.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_inq_scan(ql_adapter_state_t *ha, ql_tgt_t *tq, int count)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt_size = sizeof (ql_mbx_iocb_t) + INQ_DATA_SIZE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inq = (uint8_t *)((caddr_t)pkt + sizeof (ql_mbx_iocb_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "unsupported device id=%xh, lun=%d, "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (rval == QL_ABORTED || rval == QL_FUNCTION_TIMEOUT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Issue inquiry command.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * tq: target queue pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lun: LUN number.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pkt: command and buffer pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * inq_len: amount of inquiry data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql local function return status code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_inq(ql_adapter_state_t *ha, ql_tgt_t *tq, int lun, ql_mbx_iocb_t *pkt,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt_size = (uint32_t)(sizeof (ql_mbx_iocb_t) + inq_len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inq_data = (caddr_t)pkt + sizeof (ql_mbx_iocb_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get DMA memory for the IOCB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte LITTLE_ENDIAN_DMA, MEM_RING_ALIGN) != QL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set LUN number */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set N_port handle */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->cmd24.n_port_hdl = (uint16_t)LE_16(tq->loop_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set target ID */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set ISP command timeout. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load SCSI CDB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set tag queue control flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set transfer direction. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set data segment count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load total byte count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load data descriptor. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (CFG_IST(ha, CFG_ENABLE_64BIT_ADDRESSING)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->cmd3.control_flags_l = CF_DATA_IN | CF_STAG;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* rval = ql_issue_mbx_iocb(ha, (caddr_t)pkt, pkt_size); */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Sync in coming IOCB DMA buffer. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) ddi_dma_sync(dma_mem.dma_handle, 0, dma_mem.size,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy in coming DMA data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_rep_get8(dma_mem.acc_handle, (uint8_t *)inq_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uint8_t *)dma_mem.bp, dma_mem.size, DDI_DEV_AUTOINCR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte comp_status = (uint16_t)LE_16(pkt->sts24.comp_status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte comp_status = (uint16_t)LE_16(pkt->sts.comp_status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rval == QL_SUCCESS && pkt->sts.entry_status != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rval != QL_SUCCESS || comp_status != CS_COMPLETE ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, issue_iocb=%xh, d_id=%xh, cs=%xh, "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%3xh%3xh%3xh%3xh%3xh%3xh%3xh%3xh%3xh"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_buffer_data
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copies data from user space to kernal buffer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * src: User source buffer address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dst: Kernal destination buffer address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * size: Amount of data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Returns number of bytes transferred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_buffer_data(caddr_t src, caddr_t dst, uint32_t size, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_send_buffer_data
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copies data from kernal buffer to user space.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * src: Kernal source buffer address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dst: User destination buffer address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * size: Amount of data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Returns number of bytes transferred.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_send_buffer_data(caddr_t src, caddr_t dst, uint32_t size, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_find_port
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Locates device queue.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * name: device port name.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Returns target queue pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_find_port(ql_adapter_state_t *ha, uint8_t *name, uint16_t type)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Scan port list for requested target */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (index = 0; index < DEVICE_HEAD_LIST_SIZE; index++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (uint16_t)) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_24xx_flash_desc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get flash descriptor table.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql local function return status code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (flash_desc_t), FLASH_2500_DESCRIPTOR_TABLE << 2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (cnt = 0; cnt < (sizeof (flash_desc_t)) / 2; cnt++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* flash size in desc table is in 1024 bytes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte xp->fdesc.flash_size = xp->fdesc.flash_size * 0x400;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.flash_valid=%xh\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.flash_version=%xh\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.flash_len=%xh\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.flash_model=%s\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.flash_checksum=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.flash_unused=%xh\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.flash_manuf=%xh\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.flash_id=%xh\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.flash_flag=%xh\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.erase_cmd=%xh\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.alt_erase_cmd=%xh\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.write_enable_cmd=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.write_enable_bits=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.write_statusreg_cmd=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.unprotect_sector_cmd=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.read_manuf_cmd=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.block_size=%xh\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.alt_block_size=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.flash_size=%xh\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.write_enable_data=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.readid_address_len=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.write_disable_bits=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.read_device_id_len=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.chip_erase_cmd=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.read_timeout=%xh\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): xp->fdesc.protect_sector_cmd=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (chksum != 0 || xp->fdesc.flash_valid != FLASH_DESC_VAILD ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_setup_flash
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the manufacturer and id number of the flash chip, and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sets up the size parameter.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * int: ql local function return status code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (CFG_IST(ha, CFG_CTRL_2200) && !ha->subven_id) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Temporarily set the ha->xioctl->fdesc.flash_size to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 25xx flash size to avoid failing of ql_dump_focde.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte xp->fdesc.flash_manuf = (uint8_t)ql_read_flash_byte(ha, 0x0000);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Default flash descriptor table. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * hack for non std 2312 and 6312 boards. hardware people need to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * use either the 128k flash chip (original), or something larger.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * For driver purposes, we'll treat it as a 128k flash chip.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ha->device_id == 0x2312 || ha->device_id == 0x6312 ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ha->device_id == 0x6322) && (xp->fdesc.flash_size > 0x20000) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "chip exceeds max size: %xh, using 128k\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "unsupported mfr / type: man_id = %xh, flash_id = "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%xh\n", xp->fdesc.flash_manuf, xp->fdesc.flash_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_flash_fcode_load
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Loads fcode data into flash from application.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * bp: user buffer address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * size: user buffer size.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_flash_fcode_load(ql_adapter_state_t *ha, void *bp, uint32_t bsize,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, bufsize: %xh, flash size: %xh\n", bsize,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((bfp = (uint8_t *)kmem_zalloc(bsize, KM_SLEEP)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (ql_load_fcode(ha, bfp, bsize) != QL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* update the fcache */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_load_fcode
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Loads fcode in to flash.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dp: data pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * size: data length.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql local function return status code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_load_fcode(ql_adapter_state_t *ha, uint8_t *dp, uint32_t size)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sbus has an additional check to make
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sure they don't brick the HBA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Enable Flash Read/Write. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Erase flash prior to write. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Write fcode data to flash. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allow other system activity. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_flash_util_dump
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dumps FLASH to application.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * bp: user buffer address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * bsize: user buffer size
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_flash_fcode_dump(ql_adapter_state_t *ha, void *bp, uint32_t bsize,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* adjust max read size to flash size */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((bfp = (uint8_t *)kmem_zalloc(bsize, KM_SLEEP)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Dump Flash fcode. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (ddi_copyout(bfp, bp, bsize, mode) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_dump_fcode
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dumps fcode from flash.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dp: data pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * size: data length.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * startpos: starting position in flash.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * (start position must be 4 byte aligned)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql local function return status code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_dump_fcode(ql_adapter_state_t *ha, uint8_t *dp, uint32_t size,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* make sure startpos+size doesn't exceed flash */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (size + startpos > ha->xioctl->fdesc.flash_size) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "exceeded flash range, sz=%xh, stp=%xh, flsz=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* check start addr is 32 bit aligned for 24xx */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* adjust 24xx start addr for 32 bit words */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Enable Flash Read/Write. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Read fcode data from flash. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allow other system activity. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_program_flash_address
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Program flash address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * addr: flash byte address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * data: data to be written to flash.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql local function return status code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_program_flash_address(ql_adapter_state_t *ha, uint32_t addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Write Program Command Sequence */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Wait for write to complete. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_set_rnid_parameters
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Set RNID parameters.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: User space CT arguments pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_set_rnid_parameters(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmd->ResponseLen = 0; /* NO response to caller. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd->RequestLen != sizeof (EXT_SET_RNID_REQ)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* parameter error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, RequestLen < EXT_SET_RNID_REQ, Len=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ddi_copyin((void*)(uintptr_t)(cmd->RequestAdr), &tmp_set,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate memory for command. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_buf = kmem_zalloc(sizeof (EXT_RNID_DATA), KM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ql_get_rnid_params(ha, sizeof (EXT_RNID_DATA),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, get_rnid_params_mbx=%xh\n", rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Now set the requested params. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(tmp_set.UDPPortNumber, tmp_buf->UDPPortNumber, 2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(tmp_set.IPAddress, tmp_buf->IPAddress, 16);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ql_set_rnid_params(ha, sizeof (EXT_RNID_DATA),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, set_rnid_params_mbx=%xh\n", rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_rnid_parameters
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get RNID parameters.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: User space CT arguments pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_rnid_parameters(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate memory for command. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmp_buf = kmem_zalloc(sizeof (EXT_RNID_DATA), KM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Send command */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ql_get_rnid_params(ha, sizeof (EXT_RNID_DATA),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, get_rnid_params_mbx=%xh\n", rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy the response */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (EXT_RNID_DATA), mode) != sizeof (EXT_RNID_DATA)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_reset_statistics
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_SC_RST_STATISTICS subcommand. of EXT_CC_SET_DATA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Local EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_reset_statistics(ql_adapter_state_t *ha, EXT_IOCTL *cmd)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, reset_link_status_mbx=%xh\n", rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_statistics
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_SC_GET_STATISTICS subcommand. of EXT_CC_GET_DATA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Local EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_statistics(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ABORT_ISP_ACTIVE | LOOP_RESYNC_ACTIVE | DRIVER_STALL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate memory for command. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ls = kmem_zalloc(sizeof (ql_link_stats_t), KM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * I think these are supposed to be port statistics
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the loop ID or port ID should be in cmd->Instance.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ha->task_daemon_flags & LOOP_DOWN ? 0xFF : ha->loop_id),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, get_link_status=%xh, id=%xh\n", rval,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ps.ControllerErrorCount = xp->ControllerErrorCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ps.MBytesCount = (uint32_t)(xp->IOInputMByteCnt +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ps.LossOfSignalsCount = LE_32(ls->signal_loss_cnt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ps.PrimitiveSeqProtocolErrorCount = LE_32(ls->prot_err_cnt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ps.InvalidTransmissionWordCount = LE_32(ls->inv_xmit_cnt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_statistics_fc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_SC_GET_FC_STATISTICS subcommand. of EXT_CC_GET_DATA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Local EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_statistics_fc(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((const void *)(uintptr_t)cmd->RequestAdr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): wwpn=%02x%02x%02x%02x%02x%02x%02x%02x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ha->instance, name[0], name[1], name[2], name[3], name[4],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (tq == NULL || !VALID_TARGET_ID(ha, tq->loop_id)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ABORT_ISP_ACTIVE | LOOP_RESYNC_ACTIVE | DRIVER_STALL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate memory for command. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ls = kmem_zalloc(sizeof (ql_link_stats_t), KM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ql_get_link_status(ha, tq->loop_id, sizeof (ql_link_stats_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, get_link_status=%xh, d_id=%xh\n", rval,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ps.LossOfSignalsCount = LE_32(ls->signal_loss_cnt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ps.PrimitiveSeqProtocolErrorCount = LE_32(ls->prot_err_cnt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ps.InvalidTransmissionWordCount = LE_32(ls->inv_xmit_cnt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_statistics_fc4
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_SC_GET_FC_STATISTICS subcommand. of EXT_CC_GET_DATA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Local EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_statistics_fc4(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc4stats.ControlRequests = xp->IOControlRequests;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmd->ResponseLen = sizeof (EXT_HBA_FC4STATISTICS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_set_led_state
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_SET_BEACON_STATE subcommand of EXT_CC_SET_DATA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Local EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_set_led_state(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd->RequestLen < sizeof (EXT_BEACON_CONTROL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "exiting - failed, RequestLen < EXT_BEACON_CONTROL,"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "exiting - failed, Invalid function for HBA model\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ddi_copyin((void*)(uintptr_t)(cmd->RequestAdr), &bstate,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case EXT_DEF_GRN_BLINK_OFF: /* turn beacon off */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* not quite an error -- LED state is already off */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "LED off request -- LED is already off\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* not quite an error -- LED state is already on */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte xp->ledstate.LEDflags = LED_YELLOW_24 | LED_AMBER_24;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, unknown state request %xh\n", bstate.State);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_led_state
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_GET_BEACON_STATE subcommand of EXT_CC_GET_DATA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Local EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_led_state(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd->ResponseLen < sizeof (EXT_BEACON_CONTROL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "exiting - failed, ResponseLen < EXT_BEACON_CONTROL,"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "exiting - failed, Invalid function for HBA model\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* inform the user of the current beacon state (off or on) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_blink_led
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Determine the next state of the LED and drive it
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interrupt context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entering\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* determine the next led state */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* turn the led on or off */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_drive_led
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * drive the led's as determined by LEDflags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * LEDflags: LED flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_drive_led(ql_adapter_state_t *ha, uint32_t LEDflags)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entering\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (CFG_IST(ha, (CFG_CTRL_2300 | CFG_CTRL_6322))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* setup to send new data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gpio_enable = (uint16_t)(gpio_enable | LED_MASK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* read current data and clear out old led data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* set in the new led data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* write out the new led data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* setup to send new data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* read current data and clear out old led data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* set in the new led data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* write out the new led data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_setup_led
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Setup LED for driver control
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entering\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* decouple the LED control from the fw */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, get_firmware_option=%xh\n", rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* set the appropriate options */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mr.mb[1] = (uint16_t)(mr.mb[1] | FO1_DISABLE_GPIO);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* send it back to the firmware */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, set_firmware_option=%xh\n", rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* initally, turn the LED's off */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_wrapup_led
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Return LED control to the firmware
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entering\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Turn all LED's off */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* disable the LED update mask */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* write out the data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* give LED control back to the f/w */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, get_firmware_option=%xh\n", rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mr.mb[1] = (uint16_t)(mr.mb[1] & ~FO1_DISABLE_GPIO);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, set_firmware_option=%xh\n", rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_port_summary
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_SC_GET_PORT_SUMMARY subcommand. of EXT_CC_GET_DATA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The EXT_IOCTL->RequestAdr points to a single
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * UINT32 which identifies the device type.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Local EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_port_summary(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get the type of device the requestor is looking for.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We ignore this for now.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ddi_copyin((void *)(uintptr_t)cmd->RequestAdr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Count the number of entries to be returned. Count devices
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * that are offlline, but have been persistently bound.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (index = 0; index < DEVICE_HEAD_LIST_SIZE; index++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue; /* Skip this one */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Compute the number of entries that can be returned
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * based upon the size of caller's response buffer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rlen = sizeof (EXT_DEVICEDATA) - sizeof (EXT_DEVICEDATAENTRY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (sizeof (EXT_DEVICEDATAENTRY) * (dd.TotalDevices - 1)));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, rlen > ResponseLen, rlen=%d, Len=%d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uddp = (EXT_DEVICEDATA *)(uintptr_t)cmd->ResponseAdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (index = 0; index < DEVICE_HEAD_LIST_SIZE; index++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue; /* Skip this one */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero((void *)ddep, sizeof (EXT_DEVICEDATAENTRY));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "wwnn=%02x%02x%02x%02x%02x%02x%02x%02x, "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "wwpn=%02x%02x%02x%02x%02x%02x%02x%02x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddep->LoopID, ddep->NodeWWN[0], ddep->NodeWWN[1],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (EXT_DEVICEDATA) - sizeof (EXT_DEVICEDATAENTRY), mode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmd->ResponseLen += (uint32_t)sizeof (EXT_DEVICEDATAENTRY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_target_id
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_SC_GET_TARGET_ID subcommand. of EXT_CC_GET_DATA.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Local EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_target_id(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((const void *)(uintptr_t)cmd->RequestAdr, wwpn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): wwpn=%02x%02x%02x%02x%02x%02x%02x%02x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ha->instance, name[0], name[1], name[2], name[3], name[4],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (tq == NULL || !VALID_TARGET_ID(ha, tq->loop_id)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(tq->port_name, (caddr_t)&extdestaddr.DestAddr.ScsiAddr.Target, 8);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_setup_fcache
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Populates selected flash sections into the cache
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha = adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Driver must be in stalled state prior to entering or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * add code to this function prior to calling ql_setup_flash()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* If we already have populated it, rtn */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "unable to setup flash; rval=%xh\n", rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate & populate this node */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* link in the new node */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Do the firmware node first for 24xx/25xx's */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((rval = ql_dump_fcode(ha, ftmp->buf, FBUFSIZE,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* checkout the pci data / format */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* release all resources we have */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_update_fcache
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * re-populates updated flash into the fcache. If
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fcache does not exist (e.g., flash was empty/invalid on
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * boot), this routine will create and the populate it.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha = adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * *bpf = Pointer to flash buffer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * bsize = Size of flash buffer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_update_fcache(ql_adapter_state_t *ha, uint8_t *bfp, uint32_t bsize)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate & populate this node */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* link in the new node */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Do the firmware node first for 24xx's */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* read in first FBUFSIZE bytes of this flash section */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "passed buffer too small; fr=%xh, bsize=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* checkout the pci data / format */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * release all resources we have
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Release previous fcache resources and update with new
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_setup_fnode
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Allocates fcache node
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha = adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * node = point to allocated fcache node (NULL = failed)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Driver must be in stalled state prior to entering or
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * add code to this function prior to calling ql_setup_flash()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fnode = (ql_fcache_t *)(kmem_zalloc(sizeof (ql_fcache_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((fnode->buf = (uint8_t *)(kmem_zalloc(FBUFSIZE,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_fcache_rel
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Releases the fcache resources
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha = adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * head = Pointer to fcache linked list
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* release all resources we have */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_fbuf
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Search the fcache list for the type specified
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fptr = Pointer to fcache linked list
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ftype = Type of image to be returned.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Pointer to ql_fcache_t.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * NULL means not found.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* does this image meet criteria? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_check_pci
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * checks the passed buffer for a valid pci signature and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * expected (and in range) pci length values.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * For firmware type, a pci header is added since the image in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the flash does not have one (!!!).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * On successful pci check, nextpos adjusted to next pci header.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * -1 --> last pci image
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 --> pci header valid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 1 --> pci header invalid.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_check_pci(ql_adapter_state_t *ha, ql_fcache_t *fcache, uint32_t *nextpos)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*LINTED [Solaris DDI_DEV_T_ANY Lint error]*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Build a pci header for the firmware module
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((buf = (uint8_t *)(kmem_zalloc(FBUFSIZE, KM_SLEEP))) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(fcache->buf, bufp, (FBUFSIZE - sizeof (pci_header_t) -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* TODO: check offsets are correct! */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(fcache->verstr, FCHBA_OPTION_ROM_VERSION_LEN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get to the pci header image length */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte doff = pcih->dataoffset[0] | (pcih->dataoffset[1] << 8);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* some header section sanity check */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pcih->signature[1] != PCI_HEADER1 || doff > 50) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "buffer format error: s0=%xh, s1=%xh, off=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* a slight sanity data section check */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pcid->signature[0] != 'P' || pcid->signature[1] != 'C' ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pcid->signature[2] != 'I' || pcid->signature[3] != 'R') {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* adjust the next flash read start position */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(fcache->verstr, FCHBA_OPTION_ROM_VERSION_LEN,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%d.%d", pcid->revisionlevel[1], pcid->revisionlevel[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_sfp
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Returns sfp data to sdmapi caller
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Local EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_sfp(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ResponseLen < SFP len, len passed=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Dump SFP data in user buffer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ql_dump_sfp(ha, (void *)(uintptr_t)(cmd->ResponseAdr),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_dump_sfp
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dumps SFP.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * bp: buffer address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_dump_sfp(ql_adapter_state_t *ha, void *bp, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get memory for SFP. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((rval2 = ql_get_dma_mem(ha, &mem, 64, LITTLE_ENDIAN_DMA,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (cnt = 0; cnt < QL_24XX_SFP_SIZE; cnt += mem.size) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* copy the data back */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((dxfer = ql_send_buffer_data(mem.bp, bp, mem.size,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ddi copy error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ddi copy; byte cnt = %xh", dxfer);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* adjust the buffer pointer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_port_param
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Retrieves or sets the firmware port speed settings
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Local EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_port_param(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((const void *)(uintptr_t)cmd->RequestAdr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (port_param.FCScsiAddr.DestType != EXT_DEF_DESTTYPE_WWPN) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): wwpn=%02x%02x%02x%02x%02x%02x%02x%02x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ha->instance, name[0], name[1], name[2], name[3], name[4],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tq = ql_find_port(ha, name, (uint16_t)QLNT_PORT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (tq == NULL || !VALID_TARGET_ID(ha, tq->loop_id)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Report the firmware's port rate for the wwpn
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ql_iidma_rate(ha, tq->loop_id, &idma_rate,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy back the data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Set the firmware's port rate for the wwpn
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ql_iidma_rate(ha, tq->loop_id, &idma_rate,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "invalid mode specified: %x\n", port_param.Mode);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_fwexttrace
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dumps f/w extended trace buffer
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * bp: buffer address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_fwexttrace(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_fwfcetrace
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dumps f/w fibre channel trace buffer
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * bp: buffer address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_fwfcetrace(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_pci_data
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Retrieves pci config space data
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Local EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_pci_data(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * First check the "Capabilities List" bit of the status register.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_pci_config_get16(ha, PCI_CONF_STAT) & PCI_STAT_CAP) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Now get the capability pointer
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cap_ptr = (uint8_t)ql_pci_config_get8(ha, PCI_CONF_CAP_PTR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Check for the pcie capability.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cap_id = (uint8_t)ql_pci_config_get8(ha, cap_ptr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed ResponseLen < buf_size, len passed=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Dump PCI config data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ql_pci_dump(ha, (void *)(uintptr_t)(cmd->ResponseAdr),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_pci_dump
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dumps PCI config data to application buffer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha = adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * bp = user buffer address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_pci_dump(ql_adapter_state_t *ha, uint32_t *bp, uint32_t pci_size, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* store the initial value of ptr32 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (pci_os = 0; pci_os < pci_size; pci_os += 4) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ptr32 = (uint32_t)ql_pci_config_get32(ha, pci_os);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyout((void *)org_ptr32, (void *)bp, pci_size, mode) !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_menlo_reset
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Reset Menlo
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * bp: buffer address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_menlo_reset(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * TODO: only vp_index 0 can do this (?)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Verify the size of request structure. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get reset request. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((const void *)(uintptr_t)cmd->RequestAdr, (void *)&rst,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Wait for I/O to stop and daemon to stall. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_menlo_get_fw_version
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get Menlo firmware version.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * bp: buffer address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_menlo_get_fw_version(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd->ResponseLen < sizeof (MENLO_GET_FW_VERSION)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmd->DetailStatus = sizeof (MENLO_GET_FW_VERSION);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "ResponseLen=%d < %d\n", cmd->ResponseLen,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate packet. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt = kmem_zalloc(sizeof (ql_mbx_iocb_t), KM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->mvfy.options_status = LE_16(VMF_DO_NOT_UPDATE_FW);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ql_issue_mbx_iocb(ha, (caddr_t)pkt, sizeof (ql_mbx_iocb_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rval != QL_SUCCESS || (pkt->mvfy.entry_status & 0x3c) != 0 ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Command error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, status=%xh, es=%xh, cs=%xh, fc=%xh\n", rval,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->mvfy.entry_status & 0x3c, pkt->mvfy.options_status,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmd->ResponseLen = sizeof (MENLO_GET_FW_VERSION);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_menlo_update_fw
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get Menlo update firmware.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * bp: buffer address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_menlo_update_fw(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * TODO: only vp_index 0 can do this (?)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Verify the size of request structure. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd->RequestLen < sizeof (MENLO_UPDATE_FW)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get update fw request. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((caddr_t)(uintptr_t)cmd->RequestAdr, (caddr_t)&fw,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Wait for I/O to stop and daemon to stall. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate packet. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dma_mem = (dma_mem_t *)kmem_zalloc(sizeof (dma_mem_t), KM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt = kmem_zalloc(sizeof (ql_mbx_iocb_t), KM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get DMA memory for the IOCB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_get_dma_mem(ha, dma_mem, fw.TotalByteCount, LITTLE_ENDIAN_DMA,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmn_err(CE_WARN, "%s(%d): request queue DMA memory "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get firmware data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_get_buffer_data((caddr_t)fw.pFwDataBytes, dma_mem->bp,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Sync DMA buffer. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) ddi_dma_sync(dma_mem->dma_handle, 0, dma_mem->size,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->mvfy.options_status = (uint16_t)LE_16(fw.Flags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->mvfy.fw_sequence_size = LE_32(fw.TotalByteCount);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->mvfy.dseg_0_length = LE_32(fw.TotalByteCount);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ql_issue_mbx_iocb(ha, (caddr_t)pkt, sizeof (ql_mbx_iocb_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rval != QL_SUCCESS || (pkt->mvfy.entry_status & 0x3c) != 0 ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Command error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, status=%xh, es=%xh, cs=%xh, fc=%xh\n", rval,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->mvfy.entry_status & 0x3c, pkt->mvfy.options_status,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_menlo_manage_info
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get Menlo manage info.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * bp: buffer address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_menlo_manage_info(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Verify the size of request structure. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd->RequestLen < sizeof (MENLO_MANAGE_INFO)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get manage info request. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ddi_copyin((caddr_t)(uintptr_t)cmd->RequestAdr, (caddr_t)&info,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Allocate packet. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt = kmem_zalloc(sizeof (ql_mbx_iocb_t), KM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->mdata.options_status = (uint16_t)LE_16(info.Operation);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get DMA memory for the IOCB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->mdata.total_byte_count = LE_32(info.TotalByteCount);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte LE_32(info.Parameters.ap.MenloMemory.StartingAddr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dma_mem = (dma_mem_t *)kmem_zalloc(sizeof (dma_mem_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_get_dma_mem(ha, dma_mem, info.TotalByteCount,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte LITTLE_ENDIAN_DMA, MEM_DATA_ALIGN) != QL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmn_err(CE_WARN, "%s(%d): request queue DMA memory "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->mdata.dseg_0_length = LE_32(info.TotalByteCount);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (info.Operation & MENLO_OP_CHANGE_CONFIG) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte LE_32(info.Parameters.ap.MenloConfig.ConfigParamID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte LE_32(info.Parameters.ap.MenloConfig.ConfigParamData0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte LE_32(info.Parameters.ap.MenloConfig.ConfigParamData1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte LE_32(info.Parameters.ap.MenloInfo.InfoDataType);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = ql_issue_mbx_iocb(ha, (caddr_t)pkt, sizeof (ql_mbx_iocb_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rval != QL_SUCCESS || (pkt->mdata.entry_status & 0x3c) != 0 ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Command error */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, status=%xh, es=%xh, cs=%xh, fc=%xh\n", rval,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pkt->mdata.entry_status & 0x3c, pkt->mdata.options_status,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (info.Operation == MENLO_OP_READ_MEM) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) ddi_dma_sync(dma_mem->dma_handle, 0, dma_mem->size,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ql_send_buffer_data((caddr_t)info.pDataBytes, dma_mem->bp,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte info.TotalByteCount, mode) != info.TotalByteCount) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_suspend_hba
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Suspends all adapter ports.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * options: BIT_0 --> leave driver stalled on exit if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * qla local function return status code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_suspend_hba(ql_adapter_state_t *ha, uint32_t opt)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Quiesce I/O on all adapter ports */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (link = ql_hba.first; link != NULL; link = link->next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((rval = ql_stall_driver(ha2, opt)) != QL_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_restart_hba
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Restarts adapter.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Resume I/O on all adapter ports */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (link = ql_hba.first; link != NULL; link = link->next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_get_vp_cnt_id
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Retrieves pci config space data
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Local EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_get_vp_cnt_id(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd->ResponseLen < sizeof (EXT_VPORT_ID_CNT)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, ResponseLen < EXT_VPORT_ID_CNT, Len=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting, vport_cnt=%d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_vp_ioctl
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs all EXT_CC_VPORT_CMD functions.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: Local EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_vp_ioctl(ql_adapter_state_t *ha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered, cmd=%d\n", ha->instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* case off on command subcode */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* function not supported. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_qry_vport
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Performs EXT_VF_SC_VPORT_GETINFO subfunction.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmd: EXT_IOCTL cmd struct pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mode: flags.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * None, request status indicated in cmd->Status.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Kernel context.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_qry_vport(ql_adapter_state_t *vha, EXT_IOCTL *cmd, int mode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): entered\n", vha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cmd->ResponseLen < sizeof (EXT_VPORT_INFO)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(vha, "failed, ResponseLen < EXT_VPORT_INFO, Len=%xh\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Fill in the vport information. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(vha->loginparams.node_ww_name.raw_wwn, tmp_vport.wwnn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(vha->loginparams.nport_ww_name.raw_wwn, tmp_vport.wwpn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte max_vport = (CFG_IST(vha, CFG_CTRL_2422) ? MAX_24_VIRTUAL_PORTS :
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_9(CE_CONT, "(%d): exiting\n", vha->instance);