80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski/*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * This file and its contents are supplied under the terms of the
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Common Development and Distribution License ("CDDL"), version 1.0.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * You may only use this file in accordance with the terms of version
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * 1.0 of the CDDL.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski *
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * A full copy of the text of the CDDL should have accompanied this
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * source. A copy of the CDDL is also available via the Internet at
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * http://www.illumos.org/license/CDDL.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski/*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Copyright (C) 2013 Hewlett-Packard Development Company, L.P.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski/*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * This File has Modules that handle the NOE functionality for
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * this driver.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * It builds and submits the NOE command to the adapter. It also
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * processes a completed NOE command.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * A study of the FirmWare specifications would be neccessary to relate
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * coding in this module to the hardware functionality.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski#include "cpqary3.h"
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski/*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Local Functions Definitions
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowskiuint8_t cpqary3_disable_NOE_command(cpqary3_t *);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski/*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Last reason a drive at this position was failed by the
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * controller firmware (saved in the RIS).
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski#define MAX_KNOWN_FAILURE_REASON 31
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowskichar *ascii_failure_reason[] = {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "NONE",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "TOO_SMALL_IN_LOAD_CONFIG",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "ERROR_ERASING_RIS",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "ERROR_SAVING_RIS",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "FAIL_DRIVE_COMMAND",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "MARK_BAD_FAILED",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "MARK_BAD_FAILED_IN_FINISH_REMAP",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "TIMEOUT",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "AUTOSENSE_FAILED",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "MEDIUM_ERROR_1",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "MEDIUM_ERROR_2",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "NOT_READY_BAD_SENSE",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "NOT_READY",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "HARDWARE_ERROR",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "ABORTED_COMMAND",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "WRITE_PROTECTED",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "SPIN_UP_FAILURE_IN_RECOVER",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "REBUILD_WRITE_ERROR",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "TOO_SMALL_IN_HOT_PLUG",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "RESET_RECOVERY_ABORT",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "REMOVED_IN_HOT_PLUG",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "INIT_REQUEST_SENSE_FAILED",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "INIT_START_UNIT_FAILED",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "GDP_INQUIRY_FAILED",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "GDP_NON_DISK_DEVICE",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "GDP_READ_CAPACITY_FAILED",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "GDP_INVALID_BLOCK_SIZE",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "HOTP_REQUEST_SENSE_FAILED",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "HOTP_START_UNIT_FAILED",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "WRITE_ERROR_AFTER_REMAP",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "INIT_RESET_RECOVERY_ABORTED"
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski};
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski/*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * All Possible Logical Volume Status
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowskichar *log_vol_status[] = {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "OK",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Failed",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Not Configured",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Regenerating",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Needs Rebuild Permission",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Rebuilding",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Wrong Drive Replaced",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Bad Drive Connection",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Box Overheating",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Box Overheated",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Volume Expanding",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Not Yet Available",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Volume Needs to Expand",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Unknown"
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski};
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski/*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Function : cpqary3_send_NOE_command
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Description : This routine builds and submits the NOE Command
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * to the Controller.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Called By : cpqary3_attach(), cpqary3_NOE_handler()
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Parameters : per-controller, per-command,
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Flag to signify first time or otherwise
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Calls : cpqary3_alloc_phyctgs_mem(), cpqary3_cmdlist_occupy(),
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * cpqary3_submit(), cpqary3_add2submitted_cmdq(),
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * cpqary3_free_phyctgs_mem()
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Return Values: SUCCESS / FAILURE
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * [Shall fail only if memory allocation issues exist]
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowskiuint8_t
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowskicpqary3_send_NOE_command(cpqary3_t *ctlr, cpqary3_cmdpvt_t *memp, uint8_t flag)
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski{
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski uint32_t phys_addr = 0;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski NoeBuffer *databuf;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski CommandList_t *cmdlist;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cpqary3_phyctg_t *phys_handle;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski int rv;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * NOTE : DO NOT perform this operation for memp. Shall result in a
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * failure of submission of the NOE command as it shall be NULL for
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * the very first time
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski RETURN_FAILURE_IF_NULL(ctlr);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Allocate Memory for Return data
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * if failure, RETURN.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Allocate Memory for CommandList
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * If error, RETURN.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * get the Request Block from the CommandList
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Fill in the Request Packet with the corresponding values
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Special Information can be filled in the "bno" field of
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * the request structure.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Here, the "bno" field is filled for Asynchronous Mode.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Submit the Command.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * If Failure, WARN and RETURN.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (CPQARY3_NOE_RESUBMIT == flag) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if ((NULL == memp) || (NULL == memp->cmdlist_memaddr)) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_WARN, " CPQary3 : _send_NOE_command : "
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Re-Use Not possible; CommandList NULL");
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski return (CPQARY3_FAILURE);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski bzero(MEM2DRVPVT(memp)->sg, sizeof (NoeBuffer));
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski memp->cmdlist_memaddr->Header.Tag.drvinfo_n_err =
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski CPQARY3_NOECMD_SUCCESS;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski } else if (CPQARY3_NOE_INIT == flag) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski phys_handle =
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (cpqary3_phyctg_t *)MEM_ZALLOC(sizeof (cpqary3_phyctg_t));
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (!phys_handle)
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski return (CPQARY3_FAILURE);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski databuf = (NoeBuffer *)cpqary3_alloc_phyctgs_mem(ctlr,
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski sizeof (NoeBuffer), &phys_addr, phys_handle);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (!databuf) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski return (CPQARY3_FAILURE);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski bzero(databuf, sizeof (NoeBuffer));
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (NULL == (memp = cpqary3_cmdlist_occupy(ctlr))) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cpqary3_free_phyctgs_mem(phys_handle,
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski CPQARY3_FREE_PHYCTG_MEM);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski return (CPQARY3_FAILURE);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski memp->driverdata = (cpqary3_private_t *)
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski MEM_ZALLOC(sizeof (cpqary3_private_t));
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (NULL == memp->driverdata) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cpqary3_free_phyctgs_mem(phys_handle,
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski CPQARY3_FREE_PHYCTG_MEM);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cpqary3_cmdlist_release(memp, CPQARY3_HOLD_SW_MUTEX);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski return (CPQARY3_FAILURE);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski memp->driverdata->sg = databuf;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski memp->driverdata->phyctgp = phys_handle;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist = memp->cmdlist_memaddr;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Header.SGTotal = 1;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Header.SGList = 1;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Header.Tag.drvinfo_n_err = CPQARY3_NOECMD_SUCCESS;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Header.LUN.PhysDev.Mode = PERIPHERIAL_DEV_ADDR;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Request.CDBLen = CISS_NOE_CDB_LEN;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Request.Timeout = 0;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Request.Type.Type = CISS_TYPE_CMD;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Request.Type.Attribute = CISS_ATTR_HEADOFQUEUE;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Request.Type.Direction = CISS_XFER_READ;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Request.CDB[0] = CISS_NEW_READ;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Request.CDB[1] = BMIC_NOTIFY_ON_EVENT;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Request.CDB[10] = (NOE_BUFFER_LENGTH >> 8) & 0xff;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Request.CDB[11] = NOE_BUFFER_LENGTH & 0xff;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->SG[0].Addr = phys_addr;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->SG[0].Len = NOE_BUFFER_LENGTH;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /* PERF */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski memp->complete = cpqary3_noe_complete;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski mutex_enter(&ctlr->hw_mutex);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski rv = cpqary3_submit(ctlr, memp->cmdlist_phyaddr);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski mutex_exit(&ctlr->hw_mutex);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (rv != 0)
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski return (CPQARY3_FAILURE);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /* PERF */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski return (CPQARY3_SUCCESS);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski}
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski/*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Function : cpqary3_disable_NOE_command
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Description : This routine disables the Event Notifier
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * for the specified Controller.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Called By : cpqary3_cleanup()
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Parameters : Per Controller Structure
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Calls : cpqary3_cmdlist_occupy(), cpqary3_submit(),
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * cpqary3_add2submitted_cmdq()
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Return Values: SUCCESS / FAILURE
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * [Shall fail only if Memory Constraints exist]
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowskiuint8_t
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowskicpqary3_disable_NOE_command(cpqary3_t *ctlr)
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski{
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski CommandList_t *cmdlist;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cpqary3_cmdpvt_t *memp;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski int rv;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski RETURN_FAILURE_IF_NULL(ctlr);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Allocate Memory for CommandList
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * If error, RETURN.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * get the Request Block from the CommandList
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Fill in the Request Packet with the corresponding values
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Submit the Command.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * If Failure, WARN and RETURN.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (NULL == (memp = cpqary3_cmdlist_occupy(ctlr))) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_WARN, "CPQary3 : _disable_NOE_command : Failed");
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski return (CPQARY3_FAILURE);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist = memp->cmdlist_memaddr;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Header.Tag.drvinfo_n_err = CPQARY3_NOECMD_SUCCESS;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Header.LUN.PhysDev.Mode = PERIPHERIAL_DEV_ADDR;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Request.CDBLen = CISS_CANCEL_NOE_CDB_LEN;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Request.Timeout = 0;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Request.Type.Type = CISS_TYPE_CMD;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Request.Type.Attribute = CISS_ATTR_HEADOFQUEUE;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Request.Type.Direction = CISS_XFER_NONE;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Request.CDB[0] = ARRAY_WRITE; /* 0x27 */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmdlist->Request.CDB[6] = BMIC_CANCEL_NOTIFY_ON_EVENT;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /* PERF */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski memp->complete = cpqary3_noe_complete;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski mutex_enter(&ctlr->hw_mutex);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski rv = cpqary3_submit(ctlr, memp->cmdlist_phyaddr);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski mutex_exit(&ctlr->hw_mutex);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (rv != 0)
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski return (CPQARY3_FAILURE);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /* PERF */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski return (CPQARY3_SUCCESS);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski}
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski/*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Function : cpqary3_NOE_handler
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Description : This routine handles all those NOEs tabulated at the
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * begining of this code.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Called By : cpqary3_process_pkt()
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Parameters : Pointer to the Command List
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Calls : cpqary3_send_NOE_command(),
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * cpqary3_display_spare_status()
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * cpqary3_free_phyctgs_mem(), cpqary3_cmdlist_release()
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Return Values: None
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowskivoid
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowskicpqary3_NOE_handler(cpqary3_cmdpvt_t *memp)
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski{
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski uint16_t drive = 0;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski NoeBuffer *evt;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cpqary3_t *ctlr;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cpqary3_phyctg_t *phys_handle;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski uint8_t driveId = 0;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * This should never happen....
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * If the pointer passed as argument is NULL, Panic the System.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski VERIFY(memp != NULL);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski evt = (NoeBuffer *)MEM2DRVPVT(memp)->sg;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski ctlr = (cpqary3_t *)memp->ctlr;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski phys_handle = (cpqary3_phyctg_t *)MEM2DRVPVT(memp)->phyctgp;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /* Don't display more than 79 characters */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski evt->ascii_message[79] = 0;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski switch (evt->event_class_code) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski case CLASS_PROTOCOL:
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * the following cases are not handled:
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * 000 : This is for Synchronous NOE.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * CPQary3 follows asynchronous NOE.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * 002 : Asynchronous NOE time out.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * CPQary3 does not implement time
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * outs for NOE. It shall always reside in the HBA.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_NOTE, " %s", ctlr->hba_name);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if ((evt->event_subclass_code == SUB_CLASS_NON_EVENT) &&
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (evt->event_detail_code == DETAIL_DISABLED)) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " %s", ctlr->hba_name);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT,
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "CPQary3 : Event Notifier Disabled \n");
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski MEM_SFREE(memp->driverdata, sizeof (cpqary3_private_t));
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cpqary3_free_phyctgs_mem(phys_handle,
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski CPQARY3_FREE_PHYCTG_MEM);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cpqary3_cmdlist_release(memp, CPQARY3_NO_MUTEX);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski return;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski } else if ((evt->event_subclass_code ==
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski SUB_CLASS_PROTOCOL_ERR) &&
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (evt->event_detail_code == DETAIL_EVENT_Q_OVERFLOW)) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " %s\n", evt->ascii_message);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, "\n");
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski break;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski case CLASS_HOT_PLUG:
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (evt->event_subclass_code == SUB_CLASS_HP_CHANGE) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_NOTE, " %s", ctlr->hba_name);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " %s\n", evt->ascii_message);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Fix for QUIX 1000440284: Display the Physical
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Drive Num info only for CISS Controllers
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (!(ctlr->bddef->bd_flags & SA_BD_SAS)) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski driveId =
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /* LINTED: alignment */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski *(uint16_t *)(&evt->event_specific_data[0]);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (driveId & 0x80) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski driveId -= 0x80;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " Physical Drive Num "
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "....... SCSI Port %u, "
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Drive Id %u\n",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (driveId / 16) + 1,
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (driveId % 16));
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski } else {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " Physical Drive Num "
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "....... SCSI Port %u, "
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Drive Id %u\n",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (driveId / 16) + 1, (driveId % 16));
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " Configured Drive ? ....... %s\n",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski evt->event_specific_data[2] ? "YES" : "NO");
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (evt->event_specific_data[3]) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " Spare Drive? "
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "............. %s\n",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski evt->event_specific_data[3] ? "YES" : "NO");
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski } else if (evt->event_subclass_code == SUB_CLASS_SB_HP_CHANGE) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (evt->event_detail_code == DETAIL_PATH_REMOVED) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_WARN, " %s", ctlr->hba_name);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT,
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski " Storage Enclosure cable or %s\n",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski evt->ascii_message);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski } else if (evt->event_detail_code ==
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski DETAIL_PATH_REPAIRED) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_NOTE, " %s", ctlr->hba_name);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT,
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski " Storage Enclosure Cable or %s\n",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski evt->ascii_message);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski } else {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_NOTE, " %s", ctlr->hba_name);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " %s\n", evt->ascii_message);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski } else {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_NOTE, " %s", ctlr->hba_name);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " %s\n", evt->ascii_message);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, "\n");
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski break;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski case CLASS_HARDWARE:
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski case CLASS_ENVIRONMENT:
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_NOTE, " %s", ctlr->hba_name);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " %s\n", evt->ascii_message);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, "\n");
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski break;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski case CLASS_PHYSICAL_DRIVE:
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_WARN, " %s", ctlr->hba_name);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " %s\n", evt->ascii_message);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Fix for QUIX 1000440284: Display the Physical Drive
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Num info only for CISS Controllers
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (!(ctlr->bddef->bd_flags & SA_BD_SAS)) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /* LINTED: alignment */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski driveId = *(uint16_t *)(&evt->event_specific_data[0]);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (driveId & 0x80) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski driveId -= 0x80;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " Physical Drive Num ....... "
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "SCSI Port %u, Drive Id %u\n",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (driveId / 16) + 1, (driveId % 16));
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski } else {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " Physical Drive Num ....... "
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "SCSI Port %u, Drive Id %u\n",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (driveId / 16) + 1, (driveId % 16));
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (evt->event_specific_data[2] < MAX_KNOWN_FAILURE_REASON) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " Failure Reason............ %s\n",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski ascii_failure_reason[evt->event_specific_data[2]]);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski } else {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT,
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski " Failure Reason............ UNKNOWN \n");
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, "\n");
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski break;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski case CLASS_LOGICAL_DRIVE:
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_NOTE, " %s", ctlr->hba_name);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Fix for QXCR1000717274 - We are appending the logical
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * voulme number by one to be in sync with logical volume
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * details given by HPQacucli
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if ((evt->event_subclass_code == SUB_CLASS_STATUS) &&
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (evt->event_detail_code == DETAIL_CHANGE)) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " State change, logical drive %u\n",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /* LINTED: alignment */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (*(uint16_t *)(&evt->event_specific_data[0]) + 1));
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " New Logical Drive State... %s\n",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski log_vol_status[evt->event_specific_data[3]]);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * If the Logical drive has FAILED or it was
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * NOT CONFIGURED, in the corresponding target
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * structure, set flag as NONE to suggest that no
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * target exists at this id.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if ((evt->event_specific_data[3] == 1) ||
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (evt->event_specific_data[3] == 2)) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /* LINTED: alignment */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski drive = *(uint16_t *)
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (&evt->event_specific_data[0]);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski drive = ((drive < CTLR_SCSI_ID)
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski ? drive : drive + CPQARY3_TGT_ALIGNMENT);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (ctlr && ctlr->cpqary3_tgtp[drive]) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski ctlr->cpqary3_tgtp[drive]->type =
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski CPQARY3_TARGET_NONE;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (evt->event_specific_data[4] & SPARE_REBUILDING) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " Logical Drive %d: "
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Data is rebuilding on spare drive\n",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /* LINTED: alignment */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (*(uint16_t *)
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (&evt->event_specific_data[0]) + 1));
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (evt->event_specific_data[4] & SPARE_REBUILT) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT,
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski " Logical Drive %d: Rebuild complete. "
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "Spare is now active\n",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /* LINTED: alignment */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (*(uint16_t *)
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (&evt->event_specific_data[0]) + 1));
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski } else if ((evt->event_subclass_code == SUB_CLASS_STATUS) &&
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (evt->event_detail_code == MEDIA_EXCHANGE)) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " Media exchange detected, "
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "logical drive %u\n",
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /* LINTED: alignment */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (*(uint16_t *)
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski (&evt->event_specific_data[0]) + 1));
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski } else {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " %s\n", evt->ascii_message);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, "\n");
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski break;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski default:
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_NOTE, "%s", ctlr->hba_name);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, " %s\n", evt->ascii_message);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_CONT, "\n");
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski break;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski /*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Here, we reuse this command block to resubmit the NOE
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * command.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Ideally speaking, the resubmit should never fail
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (CPQARY3_FAILURE ==
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cpqary3_send_NOE_command(ctlr, memp, CPQARY3_NOE_RESUBMIT)) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cmn_err(CE_WARN, "CPQary3: Failed to ReInitialize "
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski "NOTIFY OF EVENT");
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cpqary3_free_phyctgs_mem(MEM2DRVPVT(memp)->phyctgp,
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski CPQARY3_FREE_PHYCTG_MEM);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cpqary3_cmdlist_release(memp, CPQARY3_NO_MUTEX);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski}
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski/* PERF */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski/*
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Function : cpqary3_noe_complete
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Description : This routine processes the completed
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * NOE commands and
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * initiates any callback that is needed.
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Called By : cpqary3_send_NOE_command,
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * cpqary3_disable_NOE_command
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Parameters : per-command
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Calls : cpqary3_NOE_handler, cpqary3_cmdlist_release
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski * Return Values: None
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski */
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowskivoid
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowskicpqary3_noe_complete(cpqary3_cmdpvt_t *cpqary3_cmdpvtp)
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski{
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski ASSERT(cpqary3_cmdpvtp != NULL);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (CPQARY3_TIMEOUT == cpqary3_cmdpvtp->cmdpvt_flag) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cpqary3_cmdlist_release(cpqary3_cmdpvtp, CPQARY3_NO_MUTEX);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski return;
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski if (cpqary3_cmdpvtp->cmdlist_memaddr->Request.CDB[6] ==
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski BMIC_CANCEL_NOTIFY_ON_EVENT) {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cv_signal(&cpqary3_cmdpvtp->ctlr->cv_noe_wait);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cpqary3_cmdlist_release(cpqary3_cmdpvtp, CPQARY3_NO_MUTEX);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski } else {
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski cpqary3_NOE_handler(cpqary3_cmdpvtp);
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski }
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski}
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski
80c94ecd7a524eb933a4bb221a9618b9dc490e76Keith M Wesolowski/* PERF */