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
c4ddbbe1ca066fd6662bdb8c477ad412b97c5590Daniel Beauregard * Copyright 2009 QLogic Corporation. All rights reserved.
c4ddbbe1ca066fd6662bdb8c477ad412b97c5590Daniel Beauregard * Use is subject to license terms.
3fb517f786391b507780c78aabb8d98bfea9efe9James Moore * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Qlogic logging
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Caution: 1) LOG will be available in debug/non-debug mode
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 2) Anything which can potentially flood the log should be under
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * extended logging, and use QLT_EXT_LOG.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 3) Don't use QLT_EXT_LOG in performance-critical code path, such
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * as normal SCSI I/O code path. It could hurt system performance.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 4) Use kmdb to change enable_extened_logging in the fly to adjust
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Error codes. FSC stands for Failure sub code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define QLT_MAILBOX_STUCK (QLT_FAILURE | QLT_FSC(2))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define QLT_UNEXPECTED_RESPONSE (QLT_FAILURE | QLT_FSC(4))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define QLT_MBOX_FAILED (QLT_FAILURE | QLT_FSC(5))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define QLT_MBOX_NOT_INITIALIZED (QLT_FAILURE | QLT_FSC(6))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define QLT_MBOX_ABORTED (QLT_FAILURE | QLT_FSC(8))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define QLT_MBOX_TIMEOUT (QLT_FAILURE | QLT_FSC(9))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define QLT_RESP_TIMEOUT (QLT_FAILURE | QLT_FSC(10))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define QLT_FLASH_TIMEOUT (QLT_FAILURE | QLT_FSC(11))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define QLT_FLASH_ACCESS_ERROR (QLT_FAILURE | QLT_FSC(12))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define QLT_BAD_NVRAM_DATA (QLT_FAILURE | QLT_FSC(13))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define QLT_FIRMWARE_ERROR_CODE (QLT_FAILURE | QLT_FSC(14))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define QLT_FIRMWARE_ERROR(s, c1, c2) (QLT_FIRMWARE_ERROR_CODE | \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (((uint64_t)s) << 32) | (((uint64_t)c1) << 24) | ((uint64_t)c2))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum {
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard * ISP mailbox commands
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_EXECUTE_FIRMWARE 0x02 /* Execute firmware. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_WRITE_RAM_WORD 0x04 /* Write RAM word. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_READ_RAM_WORD 0x05 /* Read RAM word. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_MAILBOX_REGISTER_TEST 0x06 /* Wrap incoming mailboxes */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_VERIFY_CHECKSUM 0x07 /* Verify checksum. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_ABOUT_FIRMWARE 0x08 /* About Firmware. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_DUMP_RISC_RAM 0x0a /* Dump RISC RAM command. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_LOAD_RAM_EXTENDED 0x0b /* Load RAM extended. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_DUMP_RAM_EXTENDED 0x0c /* Dump RAM extended. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_WRITE_RAM_EXTENDED 0x0d /* Write RAM word. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_READ_RAM_EXTENDED 0x0f /* Read RAM extended. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_SERDES_TRANSMIT_PARAMETERS 0x10 /* Serdes Xmit Parameters */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_2300_EXECUTE_IOCB 0x12 /* ISP2300 Execute IOCB cmd */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_GET_IO_STATUS 0x12 /* ISP2422 Get I/O Status */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_STOP_FIRMWARE 0x14 /* Stop firmware */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_ABORT_COMMAND_IOCB 0x15 /* Abort IOCB command. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_ABORT_DEVICE 0x16 /* Abort device (ID/LUN). */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_ABORT_TARGET 0x17 /* Abort target (ID). */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_XMIT_PARM 0x19 /* Change default xmit parms */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_PORT_PARAM 0x1a /* Get/set port speed parms */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_GET_ID 0x20 /* Get loop id of ISP2200. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_GET_TIMEOUT_PARAMETERS 0x22 /* Get Timeout Parameters. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_TRACE_CONTROL 0x27 /* Trace control. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_GET_FIRMWARE_OPTIONS 0x28 /* Get firmware options */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_SET_ADDITIONAL_FIRMWARE_OPT 0x38 /* set firmware options */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_RESET_MENLO 0x3a /* Reset Menlo. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_RESTART_MPI 0x3d /* Restart MPI. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_FLASH_ACCESS 0x3e /* Flash Access Control */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_LOOP_PORT_BYPASS 0x40 /* Loop Port Bypass. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_LOOP_PORT_ENABLE 0x41 /* Loop Port Enable. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_GET_RESOURCE_COUNTS 0x42 /* Get Resource Counts. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_NON_PARTICIPATE 0x43 /* Non-Participating Mode. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_DIAGNOSTIC_LOOP_BACK 0x45 /* Diagnostic loop back. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_ONLINE_SELF_TEST 0x46 /* Online self-test. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_ENHANCED_GET_PORT_DATABASE 0x47 /* Get Port Database + login */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_INITIALIZE_MULTI_ID_FW 0x48 /* Initialize multi-id fw */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_GET_DCBX_PARAMS 0x51 /* Get DCBX parameters */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_RESET_LINK_STATUS 0x52 /* Reset Link Error Status */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_EXECUTE_IOCB 0x54 /* 64 Bit Execute IOCB cmd. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_SEND_RNID_ELS 0x57 /* Send RNID ELS request */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_SET_PARAMETERS 0x59 /* Set parameters */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define PARAM_TYPE(type) ((type & PARAM_TYPE_FIELD_MASK) << \
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_GET_PARAMETERS 0x5a /* Get RNID parameters */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_INITIALIZE_FIRMWARE 0x60 /* Initialize firmware */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_INITIATE_LIP 0x62 /* Initiate LIP */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_GET_FC_AL_POSITION_MAP 0x63 /* Get FC_AL Position Map. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_GET_PORT_DATABASE 0x64 /* Get Port Database. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_CLEAR_ACA 0x65 /* Clear ACA. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_TARGET_RESET 0x66 /* Target Reset. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_CLEAR_TASK_SET 0x67 /* Clear Task Set. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_ABORT_TASK_SET 0x68 /* Abort Task Set. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_GET_FIRMWARE_STATE 0x69 /* Get firmware state. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_GET_PORT_NAME 0x6a /* Get port name. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_GET_LINK_STATUS 0x6b /* Get Link Status. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_LIP_RESET 0x6c /* LIP reset. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_GET_STATUS_COUNTS 0x6d /* Get Link Statistics and */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard /* Private Data Counts */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_SEND_SNS_COMMAND 0x6e /* Send Simple Name Server */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_LOGIN_FABRIC_PORT 0x6f /* Login fabric port. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_SEND_CHANGE_REQUEST 0x70 /* Send Change Request. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_LOGOUT_FABRIC_PORT 0x71 /* Logout fabric port. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_LIP_FULL_LOGIN 0x72 /* Full login LIP. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_LOGIN_LOOP_PORT 0x74 /* Login Loop Port. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_PORT_NODE_NAME_LIST 0x75 /* Get port/node name list */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_INITIALIZE_IP 0x77 /* Initialize IP */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_SEND_FARP_REQ_COMMAND 0x78 /* FARP request. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_GET_XGMAC_STATS 0x7a /* Get XGMAC Statistics. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_GET_ID_LIST 0x7c /* Get port ID list. */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_SEND_LFA_COMMAND 0x7d /* Send Loop Fabric Address */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_LUN_RESET 0x7e /* Send Task mgmt LUN reset */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_IDC_REQUEST 0x100 /* IDC request */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_IDC_ACK 0x101 /* IDC acknowledge */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_IDC_TIME_EXTEND 0x102 /* IDC extend time */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_PORT_RESET 0x120 /* Port Reset */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_SET_PORT_CONFIG 0x122 /* Set port configuration */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MBC_GET_PORT_CONFIG 0x123 /* Get port configuration */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * These should not be constents but should be obtained from fw.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Registers */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Interrupt stuff */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t intr_lock; /* Only used by intr routine */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Queues */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t rp_id_in_dereg; /* remote port in deregistering */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* MailBox data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t link_speed; /* Cached from intr routine */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte caddr_t qlt_fwdump_buf; /* FWDUMP will use ioctl flags/lock */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t qlt_change_state_flags; /* Cached for ACK handling */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard /* temp ref & stat counters */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard uint32_t qlt_bucketcnt[5]; /* element 0 = 2k */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard uint64_t qlt_bufref[5]; /* element 0 = 2k */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard uint64_t qlt_bumpbucket; /* bigger buffer supplied */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FWDUMP flags (part of IOCTL flags)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define QLT_FWDUMP_INPROGRESS 0x0100 /* if it's dumping now */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define QLT_FWDUMP_TRIGGERED_BY_USER 0x0200 /* if users triggered it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define QLT_FWDUMP_FETCHED_BY_USER 0x0400 /* if users have viewed it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * IOCTL supporting stuff
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte stmf_data_buf_t *dbuf; /* dbuf with handle 0 for SCSI cmds */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte stmf_data_buf_t *dbuf_rsp_iu; /* dbuf for possible FCP_RSP IU */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RESPONSE_QUEUE_OFFSET (REQUEST_QUEUE_OFFSET + \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ATIO_QUEUE_OFFSET (RESPONSE_QUEUE_OFFSET + \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define PRIORITY_QUEUE_OFFSET (ATIO_QUEUE_OFFSET + \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MBOX_DMA_MEM_OFFSET (PRIORITY_QUEUE_OFFSET + \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define TOTAL_DMA_MEM_SIZE (MBOX_DMA_MEM_OFFSET + MBOX_DMA_MEM_SIZE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_get16(qlt->regs_acc_handle, (uint16_t *)(qlt->regs + addr))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_get32(qlt->regs_acc_handle, (uint32_t *)(qlt->regs + addr))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(qlt->regs_acc_handle, (uint16_t *)(qlt->regs + addr), \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(qlt->regs_acc_handle, (uint32_t *)(qlt->regs + addr), \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pci_config_get16(qlt->pcicfg_acc_handle, (off_t)(addr))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pci_config_get32(qlt->pcicfg_acc_handle, (off_t)(addr))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pci_config_put16(qlt->pcicfg_acc_handle, (off_t)(addr), \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_get16(qlt->queue_mem_acc_handle, (uint16_t *)(addr))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DMEM_RD16(qlt, addr) LE_16((uint16_t)(*((uint16_t *)(addr))))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_get32(qlt->queue_mem_acc_handle, (uint32_t *)(addr))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DMEM_RD32(qlt, addr) LE_32((uint32_t)(*((uint32_t *)(addr))))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * #define QMEM_RD64(qlt, addr) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ddi_get64(qlt->queue_mem_acc_handle, (uint64_t *)(addr))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put16(qlt->queue_mem_acc_handle, (uint16_t *)(addr), \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DMEM_WR16(qlt, addr, data) (*((uint16_t *)(addr)) = \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_put32(qlt->queue_mem_acc_handle, (uint32_t *)(addr), \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DMEM_WR32(qlt, addr, data) (*((uint32_t *)(addr)) = \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * [QD]MEM is always little endian so the [QD]MEM_WR64 macro works for
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * both sparc and x86.
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard * Structure used to associate values with strings which describe them.
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregardchar *value2string(string_table_t *entry, int value, int delimiter);
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard#define PROP_STATUS_DELIMITER ((uint32_t)0xFFFF)
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard {DDI_PROP_NOT_FOUND, "DDI_PROP_NOT_FOUND"}, \
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard {DDI_PROP_UNDEFINED, "DDI_PROP_UNDEFINED"}, \
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard {DDI_PROP_NO_MEMORY, "DDI_PROP_NO_MEMORY"}, \
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard {DDI_PROP_INVAL_ARG, "DDI_PROP_INVAL_ARG"}, \
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard {DDI_PROP_BUF_TOO_SMALL, "DDI_PROP_BUF_TOO_SMALL"}, \
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard {DDI_PROP_CANNOT_DECODE, "DDI_PROP_CANNOT_DECODE"}, \
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard {DDI_PROP_CANNOT_ENCODE, "DDI_PROP_CANNOT_ENCODE"}, \
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard {DDI_PROP_END_OF_DATA, "DDI_PROP_END_OF_DATA"}, \
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard {PROP_STATUS_DELIMITER, "DDI_PROP_UNKNOWN"} \
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard/* Little endian machine correction defines. */
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard#define BIG_ENDIAN_16(x) qlt_chg_endian((uint8_t *)x, 2)
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard#define BIG_ENDIAN_24(x) qlt_chg_endian((uint8_t *)x, 3)
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard#define BIG_ENDIAN_32(x) qlt_chg_endian((uint8_t *)x, 4)
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard#define BIG_ENDIAN_64(x) qlt_chg_endian((uint8_t *)x, 8)
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard#define BIG_ENDIAN(bp, bytes) qlt_chg_endian((uint8_t *)bp, bytes)
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard#endif /* _LITTLE_ENDIAN */
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard/* Big endian machine correction defines. */
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard#define LITTLE_ENDIAN_16(x) qlt_chg_endian((uint8_t *)x, 2)
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard#define LITTLE_ENDIAN_24(x) qlt_chg_endian((uint8_t *)x, 3)
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard#define LITTLE_ENDIAN_32(x) qlt_chg_endian((uint8_t *)x, 4)
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard#define LITTLE_ENDIAN_64(x) qlt_chg_endian((uint8_t *)x, 8)
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard#define LITTLE_ENDIAN(bp, bytes) qlt_chg_endian((uint8_t *)bp, bytes)
0ff6bfafbd510fac2721570482eceb0d24afe291Daniel Beauregard#endif /* _BIG_ENDIAN */
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MSB(x) (uint8_t)((uint16_t)(x) >> 8)
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MSW(x) (uint16_t)((uint32_t)(x) >> 16)
a2255df3e7bbadf7b06c76c8226a1f6f5bbc9e07Daniel Beauregard#define MSD(x) (uint32_t)((uint64_t)(x) >> 32)
c4ddbbe1ca066fd6662bdb8c477ad412b97c5590Daniel Beauregardvoid qlt_el_msg(qlt_state_t *qlt, const char *fn, int ce, ...);
c4ddbbe1ca066fd6662bdb8c477ad412b97c5590Daniel Beauregardvoid qlt_dump_el_trace_buffer(qlt_state_t *qlt);
c4ddbbe1ca066fd6662bdb8c477ad412b97c5590Daniel Beauregard#define EL(qlt, ...) qlt_el_msg(qlt, __func__, CE_CONT, __VA_ARGS__);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _QLT_H */