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
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard/* Copyright 2010 QLogic Corporation */
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard#pragma ident "Copyright 2010 QLogic Corporation; ql_iocb.c"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ISP2xxx Solaris Fibre Channel Adapter (FCA) driver source file.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ***********************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * * NOTICE **
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard * * COPYRIGHT (C) 1996-2010 QLOGIC CORPORATION **
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * * ALL RIGHTS RESERVED **
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ***********************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Local Function Prototypes.
5dfd244acc8f144280c5bc8f69ed941185fc3cccDaniel Beauregardstatic int ql_req_pkt(ql_adapter_state_t *, request_t **);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_continuation_iocb(ql_adapter_state_t *, ddi_dma_cookie_t *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void ql_isp24xx_rcvbuf(ql_adapter_state_t *);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregardstatic void ql_cmd_24xx_type_6_iocb(ql_adapter_state_t *, ql_srb_t *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_start_iocb
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The start IOCB is responsible for building request packets
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * on request ring and modifying ISP input pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sp: srb structure pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interrupt or Kernel context, no mailbox commands allowed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_start_iocb(ql_adapter_state_t *vha, ql_srb_t *sp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Acquire ring lock. */
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard * If the pending queue is not empty maintain order
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard * by puting this srb at the tail and geting the head.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Remove command from pending command queue */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get command from pending command queue if not empty. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Release ring specific lock */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Remove command from pending command queue */
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard /* start this request and as many others as possible */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Calculate number of free request entries. */
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard * If no room in request ring put this srb at
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard * the head of the pending queue and exit.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " req_q_cnt=%d, req_ring_index=%d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for room in outstanding command list. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ha->outstanding_cmds[ha->osc_index] == NULL) {
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard * If no room in outstanding array put this srb at
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard * the head of the pending queue and exit.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_8(CE_CONT, "(%d): no room in outstanding "
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard /* nothing to stop us now. */
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard /* create and save a unique response identifier in the srb */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sp->handle = ha->adapter_stats->ncmds << OSC_INDEX_SHIFT |
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard /* build the iocb in the request ring */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Zero out packet. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Setup IOCB common data. */
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard /* mark the iocb with the response identifier */
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard /* Setup IOCB unique data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_5(CE_CONT, "(%d,%d): req packet, sp=%p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_DUMP_5((uint8_t *)pkt, 8, REQUEST_ENTRY_SIZE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Sync DMA buffer. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (off_t)(ha->req_ring_index * REQUEST_ENTRY_SIZE +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte REQUEST_Q_BUFFER_OFFSET), (size_t)REQUEST_ENTRY_SIZE,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Adjust ring index. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Reset watchdog timer */
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard * Send it by setting the new ring index in the ISP Request
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard * Ring In Pointer register. This is the mechanism
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard * used to notify the isp that a new iocb has been
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard * placed on the request ring.
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard ddi_put32(ha->db_dev_handle, ha->nx_req_in,
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard } while (RD_REG_DWORD(ha, ha->db_read) != w32);
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard WRT16_IO_REG(ha, req_in, ha->req_ring_index);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Update outstanding command count statistic. */
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard /* if there is a pending command, try to start it. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Remove command from pending command queue */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Release ring specific lock */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_req_pkt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Function is responsible for locking ring and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * getting a zeroed out request packet.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pkt: address for packet pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql local function return status code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interrupt or Kernel context, no mailbox commands allowed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_req_pkt(ql_adapter_state_t *vha, request_t **pktp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Wait for 30 seconds for slot. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Acquire ring lock. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Calculate number of free request entries. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Found empty request ring slot? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Zero out packet. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (cnt = 0; cnt < REQUEST_ENTRY_SIZE/4; cnt++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Setup IOCB common data. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Release request queue lock. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for pending interrupts. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * XXX protect interrupt routine from calling itself.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Need to revisit this routine. So far we never
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * hit this case as req slot was available
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ql_awaken_task_daemon(ha, NULL, ISP_ABORT_NEEDED, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EL(ha, "failed, rval = %xh, isp_abort_needed\n", rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_isp_cmd
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Function is responsible for modifying ISP input pointer.
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard * This action notifies the isp that a new request has been
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard * added to the request ring.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Releases ring lock.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interrupt or Kernel context, no mailbox commands allowed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_5(CE_CONT, "(%d): req packet:\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_DUMP_5((uint8_t *)ha->request_ring_ptr, 8, REQUEST_ENTRY_SIZE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Sync DMA buffer. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (off_t)(ha->req_ring_index * REQUEST_ENTRY_SIZE +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte REQUEST_Q_BUFFER_OFFSET), (size_t)REQUEST_ENTRY_SIZE,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Adjust ring index. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set chip new ring index. */
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard ddi_put32(ha->db_dev_handle, ha->nx_req_in, w32);
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard } while (RD_REG_DWORD(ha, ha->db_read) != w32);
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard WRT16_IO_REG(ha, req_in, ha->req_ring_index);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Release ring lock. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_command_iocb
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Setup of command IOCB.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sp: srb structure pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * arg: request queue packet.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interrupt or Kernel context, no mailbox commands allowed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_command_iocb(ql_adapter_state_t *ha, ql_srb_t *sp, void *arg)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set LUN number */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set target ID */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set tag queue control flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fcp->fcp_cntl.cntl_qtype == FCP_QTYPE_HEAD_OF_Q) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (fcp->fcp_cntl.cntl_qtype == FCP_QTYPE_ORDERED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* else if (fcp->fcp_cntl.cntl_qtype == FCP_QTYPE_SIMPLE) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set ISP command timeout. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(ha->hba_buf.acc_handle, &pkt->timeout, sp->isp_timeout);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load SCSI CDB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_rep_put8(ha->hba_buf.acc_handle, fcp->fcp_cdb,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Set transfer direction. Load Data segments.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ha->xioctl->IOOutputByteCnt += fcp->fcp_data_len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set data segment count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte seg_cnt = (uint16_t)sp->pkt->pkt_data_cookie_cnt;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(ha->hba_buf.acc_handle, &pkt->dseg_count, seg_cnt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load total byte count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, &pkt->byte_count, fcp->fcp_data_len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load command data segment. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, ptr32++, cp->dmac_address);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Build continuation packets.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (boolean_t)(CFG_IST(ha, CFG_ENABLE_64BIT_ADDRESSING)));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_continuation_iocb
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Setup of continuation IOCB.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cp: cookie list pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * seg_cnt: number of segments.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * addr64: 64 bit addresses.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interrupt or Kernel context, no mailbox commands allowed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_continuation_iocb(ql_adapter_state_t *ha, ddi_dma_cookie_t *cp,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Build continuation packets.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Sync DMA buffer. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (off_t)(ha->req_ring_index * REQUEST_ENTRY_SIZE +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Adjust ring pointer, and deal with wrap. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Zero out packet. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Build continuation packet.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_5(CE_CONT, "(%d): packet:\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_DUMP_5((uint8_t *)pkt, 8, REQUEST_ENTRY_SIZE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_command_24xx_iocb
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Setup of ISP24xx command IOCB.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sp: srb structure pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * arg: request queue packet.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interrupt or Kernel context, no mailbox commands allowed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_command_24xx_iocb(ql_adapter_state_t *ha, ql_srb_t *sp, void *arg)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard if (fcp->fcp_data_len != 0 && sp->sg_dma.dma_handle != NULL &&
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard QL_PRINT_3(CE_CONT, "(%d): cmd6 exit\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set LUN number */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set N_port handle */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(pha->hba_buf.acc_handle, &pkt->n_port_hdl, tq->loop_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set target ID */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set ISP command timeout. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(pha->hba_buf.acc_handle, &pkt->timeout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load SCSI CDB */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_rep_put8(pha->hba_buf.acc_handle, fcp->fcp_cdb, pkt->scsi_cdb,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ql_chg_endian((uint8_t *)&pkt->scsi_cdb + cnt, 4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Set tag queue control flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Cannot copy fcp->fcp_cntl.cntl_qtype directly,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * problem with x86 in 32bit kernel mode
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set transfer direction. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pha->xioctl->IOOutputByteCnt += fcp->fcp_data_len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pha->xioctl->IOInputByteCnt += fcp->fcp_data_len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set data segment count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte seg_cnt = (uint16_t)sp->pkt->pkt_data_cookie_cnt;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(pha->hba_buf.acc_handle, &pkt->dseg_count, seg_cnt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load total byte count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(pha->hba_buf.acc_handle, &pkt->total_byte_count,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load command data segment. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(pha->hba_buf.acc_handle, ptr32++, cp->dmac_address);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(pha->hba_buf.acc_handle, ptr32++, cp->dmac_notused);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(pha->hba_buf.acc_handle, ptr32, (uint32_t)cp->dmac_size);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Build continuation packets.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard * ql_cmd_24xx_type_6_iocb
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard * Setup of ISP24xx command type 6 IOCB.
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard * ha: adapter state pointer.
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard * sp: srb structure pointer.
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard * arg: request queue packet.
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard * Interrupt or Kernel context, no mailbox commands allowed.
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregardql_cmd_24xx_type_6_iocb(ql_adapter_state_t *ha, ql_srb_t *sp, void *arg)
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ql_tgt_t *tq = sp->lun_queue->target_queue;
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard /* Set LUN number */
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard pkt->fcp_lun[2] = cdma->cmd.fcp_lun[1] = LSB(sp->lun_queue->lun_no);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard pkt->fcp_lun[3] = cdma->cmd.fcp_lun[0] = MSB(sp->lun_queue->lun_no);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard /* Set N_port handle */
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ddi_put16(pha->hba_buf.acc_handle, &pkt->n_port_hdl, tq->loop_id);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard /* Set target ID */
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard /* Set ISP command timeout. */
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ddi_put16(pha->hba_buf.acc_handle, &pkt->timeout,
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard /* Load SCSI CDB */
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ddi_rep_put8(cmem->acc_handle, fcp->fcp_cdb, cdma->cmd.scsi_cdb,
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard * Set tag queue control flags
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard * Cannot copy fcp->fcp_cntl.cntl_qtype directly,
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard * problem with x86 in 32bit kernel mode
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard * FCP_CMND Payload Data Segment
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ddi_put16(pha->hba_buf.acc_handle, &pkt->cmnd_length,
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ddi_put32(pha->hba_buf.acc_handle, &pkt->cmnd_address[0],
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ddi_put32(pha->hba_buf.acc_handle, &pkt->cmnd_address[1],
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard /* Set transfer direction. */
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard pkt->control_flags = (uint8_t)(CF_DSD_PTR | CF_WR);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard pha->xioctl->IOOutputByteCnt += fcp->fcp_data_len;
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard } else if (fcp->fcp_cntl.cntl_read_data) {
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard pkt->control_flags = (uint8_t)(CF_DSD_PTR | CF_RD);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard pha->xioctl->IOInputByteCnt += fcp->fcp_data_len;
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard * FCP_DATA Data Segment Descriptor.
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard addr = cp->dmac_laddress + sizeof (fcp_cmnd_t);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ddi_put32(pha->hba_buf.acc_handle, &pkt->dseg_0_address[0], LSD(addr));
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ddi_put32(pha->hba_buf.acc_handle, &pkt->dseg_0_address[1], MSD(addr));
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard /* Set data segment count. */
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard seg_cnt = (uint16_t)sp->pkt->pkt_data_cookie_cnt;
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ddi_put16(pha->hba_buf.acc_handle, &pkt->dseg_count, seg_cnt);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ddi_put32(pha->hba_buf.acc_handle, &pkt->dseg_0_length,
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard /* Load total byte count. */
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ddi_put32(pha->hba_buf.acc_handle, &pkt->total_byte_count,
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ddi_put32(cmem->acc_handle, &cdma->cmd.dl, (uint32_t)fcp->fcp_data_len);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ql_chg_endian((uint8_t *)&cdma->cmd.dl, 4);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard /* Load command data segments. */
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ddi_put32(cmem->acc_handle, ptr32++, cp->dmac_address);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ddi_put32(cmem->acc_handle, ptr32++, cp->dmac_notused);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard ddi_put32(cmem->acc_handle, ptr32++, (uint32_t)cp->dmac_size);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard /* Sync DMA buffer. */
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard (void) ddi_dma_sync(cmem->dma_handle, 0, 0, DDI_DMA_SYNC_FORDEV);
f885d00f4e3c96a769ce0228a732da31ad9d0b78Daniel Beauregard QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Function issues marker IOCB.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * loop_id: device loop ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lun: device LUN
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * type: marker modifier
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql local function return status code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interrupt or Kernel context, no mailbox commands allowed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_marker(ql_adapter_state_t *ha, uint16_t loop_id, uint16_t lun,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set LUN number */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set N_port handle */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Issue command to ISP */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_ms_iocb
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Setup of name/management server IOCB.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha = adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sp = srb structure pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * arg = request queue packet.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interrupt or Kernel context, no mailbox commands allowed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_ms_iocb(ql_adapter_state_t *ha, ql_srb_t *sp, void *arg)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_DUMP_3(sp->pkt->pkt_cmd, 8, sp->pkt->pkt_cmdlen);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Build command packet.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set loop ID */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set ISP command timeout. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(ha->hba_buf.acc_handle, &pkt->timeout, sp->isp_timeout);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set cmd data segment count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set total data segment count */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte seg_cnt = (uint16_t)(sp->pkt->pkt_resp_cookie_cnt + 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(ha->hba_buf.acc_handle, &pkt->total_dseg_count, seg_cnt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load ct cmd byte count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, &pkt->cmd_byte_count,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load ct rsp byte count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, &pkt->resp_byte_count,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load MS command data segments. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, ptr32++, cp->dmac_address);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, ptr32++, cp->dmac_notused);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, ptr32++, (uint32_t)cp->dmac_size);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load MS response entry data segments. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, ptr32++, cp->dmac_address);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, ptr32++, cp->dmac_notused);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, ptr32, (uint32_t)cp->dmac_size);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Build continuation packets.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_ms_24xx_iocb
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Setup of name/management server IOCB.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sp: srb structure pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * arg: request queue packet.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interrupt or Kernel context, no mailbox commands allowed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_ms_24xx_iocb(ql_adapter_state_t *ha, ql_srb_t *sp, void *arg)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_DUMP_3(sp->pkt->pkt_cmd, 8, sp->pkt->pkt_cmdlen);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Build command packet.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set loop ID */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(pha->hba_buf.acc_handle, &pkt->n_port_hdl, tq->loop_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set ISP command timeout. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(pha->hba_buf.acc_handle, &pkt->timeout,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set cmd/response data segment counts. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(pha->hba_buf.acc_handle, &pkt->cmd_dseg_count, 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte seg_cnt = (uint16_t)sp->pkt->pkt_resp_cookie_cnt;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(pha->hba_buf.acc_handle, &pkt->resp_dseg_count, seg_cnt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load ct cmd byte count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(pha->hba_buf.acc_handle, &pkt->cmd_byte_count,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load ct rsp byte count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(pha->hba_buf.acc_handle, &pkt->resp_byte_count,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load MS command entry data segments. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(pha->hba_buf.acc_handle, ptr32++, cp->dmac_address);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(pha->hba_buf.acc_handle, ptr32++, cp->dmac_notused);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(pha->hba_buf.acc_handle, ptr32++, (uint32_t)cp->dmac_size);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load MS response entry data segments. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(pha->hba_buf.acc_handle, ptr32++, cp->dmac_address);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(pha->hba_buf.acc_handle, ptr32++, cp->dmac_notused);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(pha->hba_buf.acc_handle, ptr32, (uint32_t)cp->dmac_size);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Build continuation packets.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_ip_iocb
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Setup of IP IOCB.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sp: srb structure pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * arg: request queue packet.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interrupt or Kernel context, no mailbox commands allowed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_ip_iocb(ql_adapter_state_t *ha, ql_srb_t *sp, void *arg)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set loop ID */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set control flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (sp->pkt->pkt_tran_flags & FC_TRAN_HI_PRIORITY) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set ISP command timeout. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(ha->hba_buf.acc_handle, &pkt->timeout, sp->isp_timeout);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set data segment count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load total byte count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, &pkt->byte_count,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(ha->hba_buf.acc_handle, &pkt->dseg_count, seg_cnt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Build command packet.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load command entry data segments. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, ptr32++, cp->dmac_address);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Build continuation packets.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (boolean_t)(CFG_IST(ha, CFG_ENABLE_64BIT_ADDRESSING)));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_ip_24xx_iocb
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Setup of IP IOCB for ISP24xx.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha: adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sp: srb structure pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * arg: request queue packet.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interrupt or Kernel context, no mailbox commands allowed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteql_ip_24xx_iocb(ql_adapter_state_t *ha, ql_srb_t *sp, void *arg)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set N_port handle */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(ha->hba_buf.acc_handle, &pkt->hdl_status, tq->loop_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set ISP command timeout. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(ha->hba_buf.acc_handle, &pkt->timeout_hdl,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set data segment count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load total byte count. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, &pkt->byte_count,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(ha->hba_buf.acc_handle, &pkt->dseg_count, seg_cnt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set control flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(ha->hba_buf.acc_handle, &pkt->control_flags,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set frame header control flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(ha->hba_buf.acc_handle, &pkt->frame_hdr_cntrl_flgs,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load command data segment. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, ptr32++, cp->dmac_address);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, ptr32++, cp->dmac_notused);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, ptr32, (uint32_t)cp->dmac_size);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Build continuation packets.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_isp_rcvbuf
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Locates free buffers and places it on the receive buffer queue.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha = adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interrupt or Kernel context, no mailbox commands allowed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Acquire adapter state lock. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Calculate number of free receive buffer entries. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* This should never happen */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rcv_q_cnt = (uint16_t)(ha->rcvbuf_ring_index < index ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte index - ha->rcvbuf_ring_index : RCVBUF_CONTAINER_CNT -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Load all free buffers in ISP receive buffer ring. */
16dd44c265271a75647fb0bb41109bb7c585a526Daniel Beauregard while (rcv_q_cnt > (uint16_t)0 && index < QL_UB_LIMIT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Locate a buffer to give. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Build container.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(ha->hba_buf.acc_handle, &container->handle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Adjust ring index. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ha->rcvbuf_ring_index == RCVBUF_CONTAINER_CNT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Sync queue. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (off_t)RCVBUF_Q_BUFFER_OFFSET, (size_t)RCVBUF_QUEUE_SIZE,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set chip new ring index. */
eb82ff87b34e625264561b2d267577cf9821dab0Daniel Beauregard WRT16_IO_REG(ha, mailbox_in[8], ha->rcvbuf_ring_index);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Release adapter state lock. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ql_isp24xx_rcvbuf
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Locates free buffers and send it to adapter.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ha = adapter state pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Interrupt or Kernel context, no mailbox commands allowed.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): started\n", ha->instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Locate a buffer to give. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get IOCB packet for buffers. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Build container.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, &container->bufp[0],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(ha->hba_buf.acc_handle, &container->bufp[1],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(ha->hba_buf.acc_handle, &container->handle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte QL_PRINT_3(CE_CONT, "(%d): done\n", ha->instance);