1fcf3ce44SJohn Forte /* 2fcf3ce44SJohn Forte * CDDL HEADER START 3fcf3ce44SJohn Forte * 4fcf3ce44SJohn Forte * The contents of this file are subject to the terms of the 5fcf3ce44SJohn Forte * Common Development and Distribution License (the "License"). 6fcf3ce44SJohn Forte * You may not use this file except in compliance with the License. 7fcf3ce44SJohn Forte * 8fcf3ce44SJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9fcf3ce44SJohn Forte * or http://www.opensolaris.org/os/licensing. 10fcf3ce44SJohn Forte * See the License for the specific language governing permissions 11fcf3ce44SJohn Forte * and limitations under the License. 12fcf3ce44SJohn Forte * 13fcf3ce44SJohn Forte * When distributing Covered Code, include this CDDL HEADER in each 14fcf3ce44SJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15fcf3ce44SJohn Forte * If applicable, add the following below this CDDL HEADER, with the 16fcf3ce44SJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying 17fcf3ce44SJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner] 18fcf3ce44SJohn Forte * 19fcf3ce44SJohn Forte * CDDL HEADER END 20fcf3ce44SJohn Forte */ 21fcf3ce44SJohn Forte 22*4c3888b8SHans Rosenfeld /* Copyright 2015 QLogic Corporation */ 23fcf3ce44SJohn Forte 24fcf3ce44SJohn Forte /* 25*4c3888b8SHans Rosenfeld * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. 26fcf3ce44SJohn Forte */ 27fcf3ce44SJohn Forte 28fcf3ce44SJohn Forte #ifndef _QL_API_H 29fcf3ce44SJohn Forte #define _QL_API_H 30fcf3ce44SJohn Forte 31fcf3ce44SJohn Forte /* 32fcf3ce44SJohn Forte * ISP2xxx Solaris Fibre Channel Adapter (FCA) driver header file. 33fcf3ce44SJohn Forte * 34fcf3ce44SJohn Forte * *********************************************************************** 35fcf3ce44SJohn Forte * * ** 36fcf3ce44SJohn Forte * * NOTICE ** 37*4c3888b8SHans Rosenfeld * * COPYRIGHT (C) 1996-2015 QLOGIC CORPORATION ** 38fcf3ce44SJohn Forte * * ALL RIGHTS RESERVED ** 39fcf3ce44SJohn Forte * * ** 40fcf3ce44SJohn Forte * *********************************************************************** 41fcf3ce44SJohn Forte * 42fcf3ce44SJohn Forte */ 43fcf3ce44SJohn Forte 44fcf3ce44SJohn Forte #ifdef __cplusplus 45fcf3ce44SJohn Forte extern "C" { 46fcf3ce44SJohn Forte #endif 47fcf3ce44SJohn Forte 48fcf3ce44SJohn Forte /* OS include files. */ 49fcf3ce44SJohn Forte #include <sys/scsi/scsi_types.h> 50fcf3ce44SJohn Forte #include <sys/byteorder.h> 51fcf3ce44SJohn Forte #include <sys/pci.h> 52fcf3ce44SJohn Forte #include <sys/utsname.h> 53fcf3ce44SJohn Forte #include <sys/file.h> 54fcf3ce44SJohn Forte #include <sys/param.h> 55*4c3888b8SHans Rosenfeld #include <sys/time.h> 56*4c3888b8SHans Rosenfeld #include <sys/ddifm.h> 57*4c3888b8SHans Rosenfeld #include <sys/sunddi.h> 58*4c3888b8SHans Rosenfeld #include <sys/fm/protocol.h> 59*4c3888b8SHans Rosenfeld #include <sys/fm/io/ddi.h> 60fcf3ce44SJohn Forte #include <ql_open.h> 61fcf3ce44SJohn Forte 62fcf3ce44SJohn Forte #include <sys/fibre-channel/fc.h> 63fcf3ce44SJohn Forte #include <sys/fibre-channel/impl/fc_fcaif.h> 64fcf3ce44SJohn Forte 65fcf3ce44SJohn Forte #ifndef DDI_INTR_TYPE_FIXED 66fcf3ce44SJohn Forte #define DDI_INTR_TYPE_FIXED 0x1 67fcf3ce44SJohn Forte #endif 68fcf3ce44SJohn Forte #ifndef DDI_INTR_TYPE_MSI 69fcf3ce44SJohn Forte #define DDI_INTR_TYPE_MSI 0x2 70fcf3ce44SJohn Forte #endif 71fcf3ce44SJohn Forte #ifndef DDI_INTR_TYPE_MSIX 72fcf3ce44SJohn Forte #define DDI_INTR_TYPE_MSIX 0x4 73fcf3ce44SJohn Forte #endif 74fcf3ce44SJohn Forte #ifndef DDI_INTR_FLAG_BLOCK 75fcf3ce44SJohn Forte #define DDI_INTR_FLAG_BLOCK 0x100 76fcf3ce44SJohn Forte #endif 77fcf3ce44SJohn Forte #ifndef DDI_INTR_ALLOC_NORMAL 78fcf3ce44SJohn Forte #define DDI_INTR_ALLOC_NORMAL 0 79fcf3ce44SJohn Forte #endif 80fcf3ce44SJohn Forte #ifndef DDI_INTR_ALLOC_STRICT 81fcf3ce44SJohn Forte #define DDI_INTR_ALLOC_STRICT 1 82fcf3ce44SJohn Forte #endif 83fcf3ce44SJohn Forte 84*4c3888b8SHans Rosenfeld #define PCI_PCIE_DEVICE_CONTROL 0x8 /* Device control reg offset */ 85*4c3888b8SHans Rosenfeld #define PCI_MSI_CONTROL 0x2 /* MSI Control reg offset */ 86*4c3888b8SHans Rosenfeld #define PCI_MSI_MSG_ADDR 0x4 /* MSI Msg Addr reg offset */ 87*4c3888b8SHans Rosenfeld #define PCI_MSI_MSG_UPPER_ADDR 0x8 /* MSI MSI Msg Upper Addr reg */ 88*4c3888b8SHans Rosenfeld /* offset */ 89*4c3888b8SHans Rosenfeld #define PCI_MSI_MSG_DATA 0xc /* MSI Msg Data reg offset */ 90*4c3888b8SHans Rosenfeld #define PCI_MSI_X_CONTROL 0x2 /* MSI-X Control reg offset */ 91*4c3888b8SHans Rosenfeld #define MSI_X_TABLE_SIZE_MASK 0x7ff /* MSI-X Table Size mask */ 92*4c3888b8SHans Rosenfeld 93*4c3888b8SHans Rosenfeld #define PCIE_EXT_CAP_PTR 0x100 94*4c3888b8SHans Rosenfeld #define PCIE_EXT_CAP_NEXT_SHIFT 20 95*4c3888b8SHans Rosenfeld #define PCIE_EXT_CAP_ID_SRIOV 0x0010 /* SRIOV capabilities offset */ 96*4c3888b8SHans Rosenfeld #define PCIE_EXT_CAP_SRIOV_TOTAL_VFS 0xe 97*4c3888b8SHans Rosenfeld #define PCIE_SRIOV_PAGE_SIZE_MULTIPLIER 4096 98*4c3888b8SHans Rosenfeld 99fcf3ce44SJohn Forte /* 100fcf3ce44SJohn Forte * NPIV defines 101fcf3ce44SJohn Forte */ 102fcf3ce44SJohn Forte #ifndef FC_NPIV_FDISC_FAILED 103fcf3ce44SJohn Forte #define FC_NPIV_FDISC_FAILED 0x45 104fcf3ce44SJohn Forte #endif 105fcf3ce44SJohn Forte #ifndef FC_NPIV_FDISC_WWN_INUSE 106fcf3ce44SJohn Forte #define FC_NPIV_FDISC_WWN_INUSE 0x46 107fcf3ce44SJohn Forte #endif 108fcf3ce44SJohn Forte #ifndef FC_NPIV_NOT_SUPPORTED 109fcf3ce44SJohn Forte #define FC_NPIV_NOT_SUPPORTED 0x47 110fcf3ce44SJohn Forte #endif 111fcf3ce44SJohn Forte #ifndef FC_NPIV_WRONG_TOPOLOGY 112fcf3ce44SJohn Forte #define FC_NPIV_WRONG_TOPOLOGY 0x48 113fcf3ce44SJohn Forte #endif 114fcf3ce44SJohn Forte #ifndef FC_NPIV_NPIV_BOUND 115fcf3ce44SJohn Forte #define FC_NPIV_NPIV_BOUND 0x49 116fcf3ce44SJohn Forte #endif 117*4c3888b8SHans Rosenfeld #ifndef FC_HBA_PORTSPEED_32GBIT 118*4c3888b8SHans Rosenfeld #define FC_HBA_PORTSPEED_32GBIT 64 119*4c3888b8SHans Rosenfeld #endif 120fcf3ce44SJohn Forte 121fcf3ce44SJohn Forte #pragma weak ddi_intr_get_supported_types 122fcf3ce44SJohn Forte #pragma weak ddi_intr_get_nintrs 123fcf3ce44SJohn Forte #pragma weak ddi_intr_alloc 124fcf3ce44SJohn Forte #pragma weak ddi_intr_free 125fcf3ce44SJohn Forte #pragma weak ddi_intr_get_pri 126fcf3ce44SJohn Forte #pragma weak ddi_intr_add_handler 127fcf3ce44SJohn Forte #pragma weak ddi_intr_dup_handler 128fcf3ce44SJohn Forte #pragma weak ddi_intr_get_navail 129fcf3ce44SJohn Forte #pragma weak ddi_intr_block_disable 130fcf3ce44SJohn Forte #pragma weak ddi_intr_block_enable 131fcf3ce44SJohn Forte #pragma weak ddi_intr_disable 132fcf3ce44SJohn Forte #pragma weak ddi_intr_enable 133fcf3ce44SJohn Forte #pragma weak ddi_intr_get_cap 134fcf3ce44SJohn Forte #pragma weak ddi_intr_remove_handler 135fcf3ce44SJohn Forte extern int ddi_intr_get_supported_types(); 136fcf3ce44SJohn Forte extern int ddi_intr_get_nintrs(); 137fcf3ce44SJohn Forte extern int ddi_intr_alloc(); 138fcf3ce44SJohn Forte extern int ddi_intr_free(); 139fcf3ce44SJohn Forte extern int ddi_intr_get_pri(); 140fcf3ce44SJohn Forte extern int ddi_intr_add_handler(); 141fcf3ce44SJohn Forte extern int ddi_intr_dup_handler(); 142fcf3ce44SJohn Forte extern int ddi_intr_get_navail(); 143fcf3ce44SJohn Forte extern int ddi_intr_block_disable(); 144fcf3ce44SJohn Forte extern int ddi_intr_block_enable(); 145fcf3ce44SJohn Forte extern int ddi_intr_disable(); 146fcf3ce44SJohn Forte extern int ddi_intr_enable(); 147fcf3ce44SJohn Forte extern int ddi_intr_get_cap(); 148fcf3ce44SJohn Forte extern int ddi_intr_remove_handler(); 149fcf3ce44SJohn Forte 150fcf3ce44SJohn Forte #define QL_CLEAR_DMA_HANDLE(x) ((ddi_dma_impl_t *)x)->dmai_fault_notify = 0; \ 151*4c3888b8SHans Rosenfeld ((ddi_dma_impl_t *)x)->dmai_fault_check = 0; \ 152*4c3888b8SHans Rosenfeld ((ddi_dma_impl_t *)x)->dmai_fault = 0 153fcf3ce44SJohn Forte 154fcf3ce44SJohn Forte #ifndef FC_STATE_1GBIT_SPEED 1555dfd244aSDaniel Beauregard #define FC_STATE_1GBIT_SPEED 0x0100 /* 1 Gbit/sec */ 156fcf3ce44SJohn Forte #endif 157fcf3ce44SJohn Forte #ifndef FC_STATE_2GBIT_SPEED 1585dfd244aSDaniel Beauregard #define FC_STATE_2GBIT_SPEED 0x0400 /* 2 Gbit/sec */ 159fcf3ce44SJohn Forte #endif 160fcf3ce44SJohn Forte #ifndef FC_STATE_4GBIT_SPEED 1615dfd244aSDaniel Beauregard #define FC_STATE_4GBIT_SPEED 0x0500 /* 4 Gbit/sec */ 1625dfd244aSDaniel Beauregard #endif 1635dfd244aSDaniel Beauregard #ifndef FC_STATE_8GBIT_SPEED 1645dfd244aSDaniel Beauregard #define FC_STATE_8GBIT_SPEED 0x0700 /* 8 Gbit/sec */ 1655dfd244aSDaniel Beauregard #endif 1665dfd244aSDaniel Beauregard #ifndef FC_STATE_10GBIT_SPEED 1675dfd244aSDaniel Beauregard #define FC_STATE_10GBIT_SPEED 0x0600 /* 10 Gbit/sec */ 168fcf3ce44SJohn Forte #endif 169*4c3888b8SHans Rosenfeld #ifndef FC_STATE_16GBIT_SPEED 170*4c3888b8SHans Rosenfeld #define FC_STATE_16GBIT_SPEED 0x0800 /* 16 Gbit/sec */ 171*4c3888b8SHans Rosenfeld #endif 172*4c3888b8SHans Rosenfeld #ifndef FC_STATE_32GBIT_SPEED 173*4c3888b8SHans Rosenfeld #define FC_STATE_32GBIT_SPEED 0x1000 /* 32 Gbit/sec */ 174*4c3888b8SHans Rosenfeld #endif 175fcf3ce44SJohn Forte 176fcf3ce44SJohn Forte /* 177fcf3ce44SJohn Forte * Data bit definitions. 178fcf3ce44SJohn Forte */ 179*4c3888b8SHans Rosenfeld #define BIT_0 0x1 180*4c3888b8SHans Rosenfeld #define BIT_1 0x2 181*4c3888b8SHans Rosenfeld #define BIT_2 0x4 182*4c3888b8SHans Rosenfeld #define BIT_3 0x8 183*4c3888b8SHans Rosenfeld #define BIT_4 0x10 184*4c3888b8SHans Rosenfeld #define BIT_5 0x20 185*4c3888b8SHans Rosenfeld #define BIT_6 0x40 186*4c3888b8SHans Rosenfeld #define BIT_7 0x80 187*4c3888b8SHans Rosenfeld #define BIT_8 0x100 188*4c3888b8SHans Rosenfeld #define BIT_9 0x200 189*4c3888b8SHans Rosenfeld #define BIT_10 0x400 190*4c3888b8SHans Rosenfeld #define BIT_11 0x800 191*4c3888b8SHans Rosenfeld #define BIT_12 0x1000 192*4c3888b8SHans Rosenfeld #define BIT_13 0x2000 193*4c3888b8SHans Rosenfeld #define BIT_14 0x4000 194*4c3888b8SHans Rosenfeld #define BIT_15 0x8000 195*4c3888b8SHans Rosenfeld #define BIT_16 0x10000 196*4c3888b8SHans Rosenfeld #define BIT_17 0x20000 197*4c3888b8SHans Rosenfeld #define BIT_18 0x40000 198*4c3888b8SHans Rosenfeld #define BIT_19 0x80000 199*4c3888b8SHans Rosenfeld #define BIT_20 0x100000 200*4c3888b8SHans Rosenfeld #define BIT_21 0x200000 201*4c3888b8SHans Rosenfeld #define BIT_22 0x400000 202*4c3888b8SHans Rosenfeld #define BIT_23 0x800000 203*4c3888b8SHans Rosenfeld #define BIT_24 0x1000000 204*4c3888b8SHans Rosenfeld #define BIT_25 0x2000000 205*4c3888b8SHans Rosenfeld #define BIT_26 0x4000000 206*4c3888b8SHans Rosenfeld #define BIT_27 0x8000000 207*4c3888b8SHans Rosenfeld #define BIT_28 0x10000000 208*4c3888b8SHans Rosenfeld #define BIT_29 0x20000000 209*4c3888b8SHans Rosenfeld #define BIT_30 0x40000000 210*4c3888b8SHans Rosenfeld #define BIT_31 0x80000000 211*4c3888b8SHans Rosenfeld #define BIT_32 0x100000000 212*4c3888b8SHans Rosenfeld #define BIT_33 0x200000000 213*4c3888b8SHans Rosenfeld #define BIT_34 0x400000000 214*4c3888b8SHans Rosenfeld #define BIT_35 0x800000000 215*4c3888b8SHans Rosenfeld #define BIT_36 0x1000000000 216*4c3888b8SHans Rosenfeld #define BIT_37 0x2000000000 217*4c3888b8SHans Rosenfeld #define BIT_38 0x4000000000 218*4c3888b8SHans Rosenfeld #define BIT_39 0x8000000000 219*4c3888b8SHans Rosenfeld #define BIT_40 0x10000000000 220*4c3888b8SHans Rosenfeld #define BIT_41 0x20000000000 221*4c3888b8SHans Rosenfeld #define BIT_42 0x40000000000 222*4c3888b8SHans Rosenfeld #define BIT_43 0x80000000000 223*4c3888b8SHans Rosenfeld #define BIT_44 0x100000000000 224*4c3888b8SHans Rosenfeld #define BIT_45 0x200000000000 225*4c3888b8SHans Rosenfeld #define BIT_46 0x400000000000 226*4c3888b8SHans Rosenfeld #define BIT_47 0x800000000000 227*4c3888b8SHans Rosenfeld #define BIT_48 0x1000000000000 228*4c3888b8SHans Rosenfeld #define BIT_49 0x2000000000000 229*4c3888b8SHans Rosenfeld #define BIT_50 0x4000000000000 230*4c3888b8SHans Rosenfeld #define BIT_51 0x8000000000000 231*4c3888b8SHans Rosenfeld #define BIT_52 0x10000000000000 232*4c3888b8SHans Rosenfeld #define BIT_53 0x20000000000000 233*4c3888b8SHans Rosenfeld #define BIT_54 0x40000000000000 234*4c3888b8SHans Rosenfeld #define BIT_55 0x80000000000000 235*4c3888b8SHans Rosenfeld #define BIT_56 0x100000000000000 236*4c3888b8SHans Rosenfeld #define BIT_57 0x200000000000000 237*4c3888b8SHans Rosenfeld #define BIT_58 0x400000000000000 238*4c3888b8SHans Rosenfeld #define BIT_59 0x800000000000000 239*4c3888b8SHans Rosenfeld #define BIT_60 0x1000000000000000 240*4c3888b8SHans Rosenfeld #define BIT_61 0x2000000000000000 241*4c3888b8SHans Rosenfeld #define BIT_62 0x4000000000000000 242*4c3888b8SHans Rosenfeld #define BIT_63 0x8000000000000000 243fcf3ce44SJohn Forte 244fcf3ce44SJohn Forte /* 245fcf3ce44SJohn Forte * Local Macro Definitions. 246fcf3ce44SJohn Forte */ 247fcf3ce44SJohn Forte #ifndef TRUE 248fcf3ce44SJohn Forte #define TRUE B_TRUE 249fcf3ce44SJohn Forte #endif 250fcf3ce44SJohn Forte 251fcf3ce44SJohn Forte #ifndef FALSE 252fcf3ce44SJohn Forte #define FALSE B_FALSE 253fcf3ce44SJohn Forte #endif 254fcf3ce44SJohn Forte 255fcf3ce44SJohn Forte /* 256fcf3ce44SJohn Forte * I/O register 257fcf3ce44SJohn Forte */ 258fcf3ce44SJohn Forte #define RD_REG_BYTE(ha, addr) \ 259eb82ff87SDaniel Beauregard (uint8_t)ddi_get8(ha->dev_handle, (uint8_t *)(addr)) 260fcf3ce44SJohn Forte #define RD_REG_WORD(ha, addr) \ 261eb82ff87SDaniel Beauregard (uint16_t)ddi_get16(ha->dev_handle, (uint16_t *)(addr)) 262fcf3ce44SJohn Forte #define RD_REG_DWORD(ha, addr) \ 263eb82ff87SDaniel Beauregard (uint32_t)ddi_get32(ha->dev_handle, (uint32_t *)(addr)) 264eb82ff87SDaniel Beauregard #define RD_REG_DDWORD(ha, addr) \ 265eb82ff87SDaniel Beauregard (uint64_t)ddi_get64(ha->dev_handle, (uint64_t *)(addr)) 266fcf3ce44SJohn Forte 267fcf3ce44SJohn Forte #define WRT_REG_BYTE(ha, addr, data) \ 268eb82ff87SDaniel Beauregard ddi_put8(ha->dev_handle, (uint8_t *)(addr), (uint8_t)(data)) 269fcf3ce44SJohn Forte #define WRT_REG_WORD(ha, addr, data) \ 270eb82ff87SDaniel Beauregard ddi_put16(ha->dev_handle, (uint16_t *)(addr), (uint16_t)(data)) 271fcf3ce44SJohn Forte #define WRT_REG_DWORD(ha, addr, data) \ 272eb82ff87SDaniel Beauregard ddi_put32(ha->dev_handle, (uint32_t *)(addr), (uint32_t)(data)) 273eb82ff87SDaniel Beauregard #define WRT_REG_DDWORD(ha, addr, data) \ 274eb82ff87SDaniel Beauregard ddi_put64(ha->dev_handle, (uint64_t *)(addr), (uint64_t)(data)) 275fcf3ce44SJohn Forte 276fcf3ce44SJohn Forte #define RD8_IO_REG(ha, regname) \ 277fcf3ce44SJohn Forte RD_REG_BYTE(ha, (ha->iobase + ha->reg_off->regname)) 278fcf3ce44SJohn Forte #define RD16_IO_REG(ha, regname) \ 279fcf3ce44SJohn Forte RD_REG_WORD(ha, (ha->iobase + ha->reg_off->regname)) 280fcf3ce44SJohn Forte #define RD32_IO_REG(ha, regname) \ 281fcf3ce44SJohn Forte RD_REG_DWORD(ha, (ha->iobase + ha->reg_off->regname)) 282fcf3ce44SJohn Forte 283fcf3ce44SJohn Forte #define WRT8_IO_REG(ha, regname, data) \ 284eb82ff87SDaniel Beauregard WRT_REG_BYTE(ha, (ha->iobase + ha->reg_off->regname), (data)) 285fcf3ce44SJohn Forte #define WRT16_IO_REG(ha, regname, data) \ 286eb82ff87SDaniel Beauregard WRT_REG_WORD(ha, (ha->iobase + ha->reg_off->regname), (data)) 287fcf3ce44SJohn Forte #define WRT32_IO_REG(ha, regname, data) \ 288eb82ff87SDaniel Beauregard WRT_REG_DWORD(ha, (ha->iobase + ha->reg_off->regname), (data)) 289fcf3ce44SJohn Forte 290fcf3ce44SJohn Forte #define RD_IOREG_BYTE(ha, addr) \ 291eb82ff87SDaniel Beauregard (uint8_t)ddi_get8(ha->iomap_dev_handle, (uint8_t *)(addr)) 292fcf3ce44SJohn Forte #define RD_IOREG_WORD(ha, addr) \ 293eb82ff87SDaniel Beauregard (uint16_t)ddi_get16(ha->iomap_dev_handle, (uint16_t *)(addr)) 294fcf3ce44SJohn Forte #define RD_IOREG_DWORD(ha, addr) \ 295eb82ff87SDaniel Beauregard (uint32_t)ddi_get32(ha->iomap_dev_handle, (uint32_t *)(addr)) 296fcf3ce44SJohn Forte 297fcf3ce44SJohn Forte #define WRT_IOREG_BYTE(ha, addr, data) \ 298eb82ff87SDaniel Beauregard ddi_put8(ha->iomap_dev_handle, (uint8_t *)addr, (uint8_t)(data)) 299fcf3ce44SJohn Forte #define WRT_IOREG_WORD(ha, addr, data) \ 300eb82ff87SDaniel Beauregard ddi_put16(ha->iomap_dev_handle, (uint16_t *)addr, (uint16_t)(data)) 301fcf3ce44SJohn Forte #define WRT_IOREG_DWORD(ha, addr, data) \ 302eb82ff87SDaniel Beauregard ddi_put32(ha->iomap_dev_handle, (uint32_t *)addr, (uint32_t)(data)) 303fcf3ce44SJohn Forte 304fcf3ce44SJohn Forte #define RD8_IOMAP_REG(ha, regname) \ 305fcf3ce44SJohn Forte RD_IOREG_BYTE(ha, (ha->iomap_iobase + ha->reg_off->regname)) 306fcf3ce44SJohn Forte #define RD16_IOMAP_REG(ha, regname) \ 307fcf3ce44SJohn Forte RD_IOREG_WORD(ha, (ha->iomap_iobase + ha->reg_off->regname)) 308fcf3ce44SJohn Forte #define RD32_IOMAP_REG(ha, regname) \ 309fcf3ce44SJohn Forte RD_IOREG_DWORD(ha, (ha->iomap_iobase + ha->reg_off->regname)) 310fcf3ce44SJohn Forte 311fcf3ce44SJohn Forte #define WRT8_IOMAP_REG(ha, regname, data) \ 312eb82ff87SDaniel Beauregard WRT_IOREG_BYTE(ha, (ha->iomap_iobase + ha->reg_off->regname), (data)) 313fcf3ce44SJohn Forte #define WRT16_IOMAP_REG(ha, regname, data) \ 314eb82ff87SDaniel Beauregard WRT_IOREG_WORD(ha, (ha->iomap_iobase + ha->reg_off->regname), (data)) 315fcf3ce44SJohn Forte #define WRT32_IOMAP_REG(ha, regname, data) \ 316eb82ff87SDaniel Beauregard WRT_IOREG_DWORD(ha, (ha->iomap_iobase + ha->reg_off->regname), (data)) 317fcf3ce44SJohn Forte 318*4c3888b8SHans Rosenfeld #define RD8_MBAR_REG(ha, ofst) \ 319*4c3888b8SHans Rosenfeld (uint8_t)ddi_get8(ha->mbar_dev_handle, \ 320*4c3888b8SHans Rosenfeld (uint8_t *)(ha->mbar + (ofst))) 321*4c3888b8SHans Rosenfeld #define RD16_MBAR_REG(ha, ofst) \ 322*4c3888b8SHans Rosenfeld (uint16_t)ddi_get16(ha->mbar_dev_handle, \ 323*4c3888b8SHans Rosenfeld (uint16_t *)(ha->mbar + (ofst))) 324*4c3888b8SHans Rosenfeld #define RD32_MBAR_REG(ha, ofst) \ 325*4c3888b8SHans Rosenfeld (uint32_t)ddi_get32(ha->mbar_dev_handle, \ 326*4c3888b8SHans Rosenfeld (uint32_t *)(ha->mbar + (ofst))) 327*4c3888b8SHans Rosenfeld #define RD64_MBAR_REG(ha, ofst) \ 328*4c3888b8SHans Rosenfeld (uint64_t)ddi_get64(ha->mbar_dev_handle, \ 329*4c3888b8SHans Rosenfeld (uint64_t *)(ha->mbar + (ofst))) 330*4c3888b8SHans Rosenfeld 331*4c3888b8SHans Rosenfeld #define WR8_MBAR_REG(ha, ofst, data) \ 332*4c3888b8SHans Rosenfeld ddi_put8(ha->mbar_dev_handle, \ 333*4c3888b8SHans Rosenfeld (uint8_t *)(ha->mbar + (ofst)), \ 334*4c3888b8SHans Rosenfeld (uint8_t)(data)) 335*4c3888b8SHans Rosenfeld #define WR16_MBAR_REG(ha, ofst, data) \ 336*4c3888b8SHans Rosenfeld ddi_put16(ha->mbar_dev_handle, \ 337*4c3888b8SHans Rosenfeld (uint16_t *)(ha->mbar + (ofst)), \ 338*4c3888b8SHans Rosenfeld (uint16_t)(data)) 339*4c3888b8SHans Rosenfeld #define WR32_MBAR_REG(ha, ofst, data) \ 340*4c3888b8SHans Rosenfeld ddi_put32(ha->mbar_dev_handle, \ 341*4c3888b8SHans Rosenfeld (uint32_t *)(ha->mbar + (ofst)), \ 342*4c3888b8SHans Rosenfeld (uint32_t)(data)) 343*4c3888b8SHans Rosenfeld #define WR64_MBAR_REG(ha, ofst, data) \ 344*4c3888b8SHans Rosenfeld ddi_put64(ha->mbar_dev_handle, \ 345*4c3888b8SHans Rosenfeld (uint64_t *)(ha->mbar + (ofst)), \ 346*4c3888b8SHans Rosenfeld (uint64_t)(data)) 347*4c3888b8SHans Rosenfeld 348fcf3ce44SJohn Forte /* 349fcf3ce44SJohn Forte * FCA definitions 350fcf3ce44SJohn Forte */ 351fcf3ce44SJohn Forte #define MAX_LUNS 16384 352fcf3ce44SJohn Forte #define QL_FCA_BRAND 0x0fca2200 353fcf3ce44SJohn Forte 354fcf3ce44SJohn Forte /* Following to be removed when defined by OS. */ 355fcf3ce44SJohn Forte /* ************************************************************************ */ 356fcf3ce44SJohn Forte #define LA_ELS_FARP_REQ 0x54 357fcf3ce44SJohn Forte #define LA_ELS_FARP_REPLY 0x55 358fcf3ce44SJohn Forte #define LA_ELS_LPC 0x71 359fcf3ce44SJohn Forte #define LA_ELS_LSTS 0x72 360fcf3ce44SJohn Forte 361fcf3ce44SJohn Forte typedef struct { 362fcf3ce44SJohn Forte ls_code_t ls_code; 363fcf3ce44SJohn Forte uint8_t rsvd[3]; 364fcf3ce44SJohn Forte uint8_t port_control; 365fcf3ce44SJohn Forte uint8_t lpb[16]; 366fcf3ce44SJohn Forte uint8_t lpe[16]; 367fcf3ce44SJohn Forte } ql_lpc_t; 368fcf3ce44SJohn Forte 369fcf3ce44SJohn Forte typedef struct { 370fcf3ce44SJohn Forte ls_code_t ls_code; 371fcf3ce44SJohn Forte } ql_acc_rjt_t; 372fcf3ce44SJohn Forte 373fcf3ce44SJohn Forte typedef fc_linit_resp_t ql_lpc_resp_t; 374fcf3ce44SJohn Forte typedef fc_scr_resp_t ql_rscn_resp_t; 375fcf3ce44SJohn Forte 376fcf3ce44SJohn Forte typedef struct { 377fcf3ce44SJohn Forte uint16_t class_valid_svc_opt; 378fcf3ce44SJohn Forte uint16_t initiator_ctl; 379fcf3ce44SJohn Forte uint16_t recipient_ctl; 380fcf3ce44SJohn Forte uint16_t rcv_data_size; 381fcf3ce44SJohn Forte uint16_t conc_sequences; 382fcf3ce44SJohn Forte uint16_t n_port_end_to_end_credit; 383fcf3ce44SJohn Forte uint16_t open_sequences_per_exch; 384fcf3ce44SJohn Forte uint16_t unused; 385fcf3ce44SJohn Forte } class_svc_param_t; 386fcf3ce44SJohn Forte 387fcf3ce44SJohn Forte typedef struct { 388fcf3ce44SJohn Forte uint8_t type; 389fcf3ce44SJohn Forte uint8_t rsvd; 390fcf3ce44SJohn Forte uint16_t process_assoc_flags; 391fcf3ce44SJohn Forte uint32_t originator_process; 392fcf3ce44SJohn Forte uint32_t responder_process; 393fcf3ce44SJohn Forte uint32_t process_flags; 394fcf3ce44SJohn Forte } prli_svc_param_t; 395fcf3ce44SJohn Forte /* *********************************************************************** */ 396fcf3ce44SJohn Forte 397fcf3ce44SJohn Forte /* 398fcf3ce44SJohn Forte * Fibre Channel device definitions. 399fcf3ce44SJohn Forte */ 400fcf3ce44SJohn Forte #define MAX_22_FIBRE_DEVICES 256 401fcf3ce44SJohn Forte #define MAX_24_FIBRE_DEVICES 2048 40216dd44c2SDaniel Beauregard #define MAX_24_VIRTUAL_PORTS 127 40316dd44c2SDaniel Beauregard #define MAX_25_VIRTUAL_PORTS 254 404*4c3888b8SHans Rosenfeld #define MAX_27_VIRTUAL_PORTS 252 405*4c3888b8SHans Rosenfeld #define MAX_8021_VIRTUAL_PORTS 63 406*4c3888b8SHans Rosenfeld #define MAX_81XX_VIRTUAL_PORTS 254 407*4c3888b8SHans Rosenfeld #define MAX_83_VIRTUAL_PORTS 254 408fcf3ce44SJohn Forte 409fcf3ce44SJohn Forte #define LAST_LOCAL_LOOP_ID 0x7d 410fcf3ce44SJohn Forte #define FL_PORT_LOOP_ID 0x7e /* FFFFFE Fabric F_Port */ 411fcf3ce44SJohn Forte #define SWITCH_FABRIC_CONTROLLER_LOOP_ID 0x7f /* FFFFFD Fabric Controller */ 412fcf3ce44SJohn Forte #define SIMPLE_NAME_SERVER_LOOP_ID 0x80 /* FFFFFC Directory Server */ 413fcf3ce44SJohn Forte #define SNS_FIRST_LOOP_ID 0x81 414fcf3ce44SJohn Forte #define SNS_LAST_LOOP_ID 0xfe 415fcf3ce44SJohn Forte #define IP_BROADCAST_LOOP_ID 0xff /* FFFFFF Broadcast */ 416fcf3ce44SJohn Forte #define BROADCAST_ADDR 0xffffff /* FFFFFF Broadcast */ 417fcf3ce44SJohn Forte 418fcf3ce44SJohn Forte /* 419fcf3ce44SJohn Forte * Fibre Channel 24xx device definitions. 420fcf3ce44SJohn Forte */ 421fcf3ce44SJohn Forte #define LAST_N_PORT_HDL 0x7ef 422fcf3ce44SJohn Forte #define SNS_24XX_HDL 0x7FC /* SNS FFFFFCh */ 423fcf3ce44SJohn Forte #define SFC_24XX_HDL 0x7FD /* fabric controller FFFFFDh */ 424fcf3ce44SJohn Forte #define FL_PORT_24XX_HDL 0x7FE /* F_Port FFFFFEh */ 425fcf3ce44SJohn Forte #define BROADCAST_24XX_HDL 0x7FF /* IP broadcast FFFFFFh */ 426fcf3ce44SJohn Forte 427fcf3ce44SJohn Forte /* Loop ID's used as flags, must be higher than any valid Loop ID */ 428fcf3ce44SJohn Forte #define PORT_NO_LOOP_ID 0x8000 /* Device does not have loop ID. */ 429fcf3ce44SJohn Forte #define PORT_LOST_ID 0x4000 /* Device has been lost. */ 430fcf3ce44SJohn Forte 431fcf3ce44SJohn Forte /* Fibre Channel Topoploy. */ 432fcf3ce44SJohn Forte #define QL_N_PORT BIT_0 433fcf3ce44SJohn Forte #define QL_NL_PORT BIT_1 434fcf3ce44SJohn Forte #define QL_F_PORT BIT_2 435fcf3ce44SJohn Forte #define QL_FL_PORT BIT_3 436fcf3ce44SJohn Forte #define QL_LOOP_CONNECTION (QL_NL_PORT | QL_FL_PORT) 437fcf3ce44SJohn Forte #define QL_P2P_CONNECTION (QL_F_PORT | QL_N_PORT) 438*4c3888b8SHans Rosenfeld #define QL_FABRIC_CONNECTION (QL_F_PORT | QL_FL_PORT) 439fcf3ce44SJohn Forte 440fcf3ce44SJohn Forte /* Timeout timer counts in seconds (must greater than 1 second). */ 441fcf3ce44SJohn Forte #define WATCHDOG_TIME 5 /* 0 - 255 */ 442fcf3ce44SJohn Forte #define PORT_RETRY_TIME 2 /* 0 - 255 */ 443fcf3ce44SJohn Forte #define LOOP_DOWN_TIMER_OFF 0 444fcf3ce44SJohn Forte #define LOOP_DOWN_TIMER_START 240 /* 0 - 255 */ 445fcf3ce44SJohn Forte #define LOOP_DOWN_TIMER_END 1 446fcf3ce44SJohn Forte #define LOOP_DOWN_RESET (LOOP_DOWN_TIMER_START - 45) /* 0 - 255 */ 447fcf3ce44SJohn Forte #define R_A_TOV_DEFAULT 20 /* 0 - 65535 */ 448fcf3ce44SJohn Forte #define IDLE_CHECK_TIMER 300 /* 0 - 65535 */ 449fcf3ce44SJohn Forte #define MAX_DEVICE_LOST_RETRY 16 /* 0 - 255 */ 450f885d00fSDaniel Beauregard #define TIMEOUT_THRESHOLD 16 /* 0 - 255 */ 451fcf3ce44SJohn Forte 452fcf3ce44SJohn Forte /* Maximum outstanding commands in ISP queues (1-4095) */ 453*4c3888b8SHans Rosenfeld #define OSC_INDEX_MASK 0xfff 454*4c3888b8SHans Rosenfeld #define OSC_INDEX_SHIFT 12 455fcf3ce44SJohn Forte 456fcf3ce44SJohn Forte /* Maximum unsolicited buffers (1-65535) */ 457fcf3ce44SJohn Forte #define QL_UB_LIMIT 256 458fcf3ce44SJohn Forte 459fcf3ce44SJohn Forte /* ISP request, response and receive buffer entry counts */ 460fcf3ce44SJohn Forte #define REQUEST_ENTRY_CNT 512 /* Request entries (205-65535) */ 461fcf3ce44SJohn Forte #define RESPONSE_ENTRY_CNT 256 /* Response entries (1-65535) */ 462fcf3ce44SJohn Forte #define RCVBUF_CONTAINER_CNT 64 /* Rcv buffer containers (8-1024) */ 463fcf3ce44SJohn Forte 464fcf3ce44SJohn Forte /* 465fcf3ce44SJohn Forte * ISP request, response, mailbox and receive buffer queue sizes 466fcf3ce44SJohn Forte */ 467*4c3888b8SHans Rosenfeld #define SHADOW_ENTRY_SIZE 4 468fcf3ce44SJohn Forte #define REQUEST_ENTRY_SIZE 64 469fcf3ce44SJohn Forte #define REQUEST_QUEUE_SIZE (REQUEST_ENTRY_SIZE * REQUEST_ENTRY_CNT) 470fcf3ce44SJohn Forte 471fcf3ce44SJohn Forte #define RESPONSE_ENTRY_SIZE 64 472fcf3ce44SJohn Forte #define RESPONSE_QUEUE_SIZE (RESPONSE_ENTRY_SIZE * RESPONSE_ENTRY_CNT) 473fcf3ce44SJohn Forte 474fcf3ce44SJohn Forte #define RCVBUF_CONTAINER_SIZE 12 475fcf3ce44SJohn Forte #define RCVBUF_QUEUE_SIZE (RCVBUF_CONTAINER_SIZE * RCVBUF_CONTAINER_CNT) 476fcf3ce44SJohn Forte 477fcf3ce44SJohn Forte /* 478fcf3ce44SJohn Forte * DMA attributes definitions. 479fcf3ce44SJohn Forte */ 480fcf3ce44SJohn Forte #define QL_DMA_LOW_ADDRESS (uint64_t)0 481fcf3ce44SJohn Forte #define QL_DMA_HIGH_64BIT_ADDRESS (uint64_t)0xffffffffffffffff 482fcf3ce44SJohn Forte #define QL_DMA_HIGH_32BIT_ADDRESS (uint64_t)0xffffffff 483fcf3ce44SJohn Forte #define QL_DMA_XFER_COUNTER (uint64_t)0xffffffff 484fcf3ce44SJohn Forte #define QL_DMA_ADDRESS_ALIGNMENT (uint64_t)8 485fcf3ce44SJohn Forte #define QL_DMA_ALIGN_8_BYTE_BOUNDARY (uint64_t)BIT_3 486fcf3ce44SJohn Forte #define QL_DMA_RING_ADDRESS_ALIGNMENT (uint64_t)64 487fcf3ce44SJohn Forte #define QL_DMA_ALIGN_64_BYTE_BOUNDARY (uint64_t)BIT_6 488fcf3ce44SJohn Forte #define QL_DMA_BURSTSIZES 0xff 489fcf3ce44SJohn Forte #define QL_DMA_MIN_XFER_SIZE 1 490fcf3ce44SJohn Forte #define QL_DMA_MAX_XFER_SIZE (uint64_t)0xffffffff 491fcf3ce44SJohn Forte #define QL_DMA_SEGMENT_BOUNDARY (uint64_t)0xffffffff 492fcf3ce44SJohn Forte 493fcf3ce44SJohn Forte #ifdef __sparc 494fcf3ce44SJohn Forte #define QL_DMA_SG_LIST_LENGTH 1 495fcf3ce44SJohn Forte #define QL_FCSM_CMD_SGLLEN 1 496fcf3ce44SJohn Forte #define QL_FCSM_RSP_SGLLEN 1 497fcf3ce44SJohn Forte #define QL_FCIP_CMD_SGLLEN 1 498fcf3ce44SJohn Forte #define QL_FCIP_RSP_SGLLEN 1 499fcf3ce44SJohn Forte #define QL_FCP_CMD_SGLLEN 1 500fcf3ce44SJohn Forte #define QL_FCP_RSP_SGLLEN 1 501fcf3ce44SJohn Forte #else 502fcf3ce44SJohn Forte #define QL_DMA_SG_LIST_LENGTH 1024 503fcf3ce44SJohn Forte #define QL_FCSM_CMD_SGLLEN 1 504fcf3ce44SJohn Forte #define QL_FCSM_RSP_SGLLEN 6 505fcf3ce44SJohn Forte /* 506fcf3ce44SJohn Forte * QL_FCIP_CMD_SGLLEN needs to be increased as we changed the max fcip packet 507fcf3ce44SJohn Forte * size to about 64K. With this, we need to increase the maximum number of 508fcf3ce44SJohn Forte * scatter-gather elements allowable from the existing 7. We want it to be more 509fcf3ce44SJohn Forte * like 17 (max fragments for an fcip packet that is unaligned). (64K / 4K) + 1 510fcf3ce44SJohn Forte * or whatever. Otherwise the DMA breakup routines will give bad results. 511fcf3ce44SJohn Forte */ 512fcf3ce44SJohn Forte #define QL_FCIP_CMD_SGLLEN 17 513fcf3ce44SJohn Forte #define QL_FCIP_RSP_SGLLEN 1 514fcf3ce44SJohn Forte #define QL_FCP_CMD_SGLLEN 1 515fcf3ce44SJohn Forte #define QL_FCP_RSP_SGLLEN 1 516fcf3ce44SJohn Forte #endif 517fcf3ce44SJohn Forte 518fcf3ce44SJohn Forte #ifndef DDI_DMA_RELAXED_ORDERING 519fcf3ce44SJohn Forte #define DDI_DMA_RELAXED_ORDERING 0x400 520fcf3ce44SJohn Forte #endif 521fcf3ce44SJohn Forte 522fcf3ce44SJohn Forte #define QL_DMA_GRANULARITY 1 523fcf3ce44SJohn Forte #define QL_DMA_XFER_FLAGS 0 524fcf3ce44SJohn Forte 525*4c3888b8SHans Rosenfeld typedef union { 526fcf3ce44SJohn Forte uint64_t size64; /* 1 X 64 bit number */ 527fcf3ce44SJohn Forte uint32_t size32[2]; /* 2 x 32 bit number */ 528fcf3ce44SJohn Forte uint16_t size16[4]; /* 4 x 16 bit number */ 529fcf3ce44SJohn Forte uint8_t size8[8]; /* 8 x 8 bit number */ 530fcf3ce44SJohn Forte } conv_num_t; 531fcf3ce44SJohn Forte 532fcf3ce44SJohn Forte /* 533fcf3ce44SJohn Forte * Device register offsets. 534fcf3ce44SJohn Forte */ 535fcf3ce44SJohn Forte #define MAX_MBOX_COUNT 32 536fcf3ce44SJohn Forte typedef struct { 537eb82ff87SDaniel Beauregard uint16_t flash_address; /* Flash BIOS address */ 538eb82ff87SDaniel Beauregard uint16_t flash_data; /* Flash BIOS data */ 539eb82ff87SDaniel Beauregard uint16_t ctrl_status; /* Control/Status */ 540eb82ff87SDaniel Beauregard uint16_t ictrl; /* Interrupt control */ 541eb82ff87SDaniel Beauregard uint16_t istatus; /* Interrupt status */ 542eb82ff87SDaniel Beauregard uint16_t semaphore; /* Semaphore */ 543eb82ff87SDaniel Beauregard uint16_t nvram; /* NVRAM register. */ 544eb82ff87SDaniel Beauregard uint16_t req_in; /* for 2200 MBX 4 Write */ 545eb82ff87SDaniel Beauregard uint16_t req_out; /* for 2200 MBX 4 read */ 546eb82ff87SDaniel Beauregard uint16_t resp_in; /* for 2200 MBX 5 Read */ 547eb82ff87SDaniel Beauregard uint16_t resp_out; /* for 2200 MBX 5 Write */ 548eb82ff87SDaniel Beauregard uint16_t risc2host; 549eb82ff87SDaniel Beauregard uint16_t mbox_cnt; /* Number of mailboxes */ 550eb82ff87SDaniel Beauregard uint16_t mailbox_in[MAX_MBOX_COUNT]; /* Mailbox registers */ 551eb82ff87SDaniel Beauregard uint16_t mailbox_out[MAX_MBOX_COUNT]; /* Mailbox registers */ 552eb82ff87SDaniel Beauregard uint16_t fpm_diag_config; 553eb82ff87SDaniel Beauregard uint16_t pcr; /* Processor Control Register. */ 554eb82ff87SDaniel Beauregard uint16_t mctr; /* Memory Configuration and Timing. */ 555eb82ff87SDaniel Beauregard uint16_t fb_cmd; 556eb82ff87SDaniel Beauregard uint16_t hccr; /* Host command & control register. */ 557eb82ff87SDaniel Beauregard uint16_t gpiod; /* GPIO Data register. */ 558eb82ff87SDaniel Beauregard uint16_t gpioe; /* GPIO Enable register. */ 559eb82ff87SDaniel Beauregard uint16_t host_to_host_sema; /* 2312 resource lock register */ 560eb82ff87SDaniel Beauregard uint16_t pri_req_in; /* 2400 */ 561eb82ff87SDaniel Beauregard uint16_t pri_req_out; /* 2400 */ 562eb82ff87SDaniel Beauregard uint16_t atio_req_in; /* 2400 */ 563eb82ff87SDaniel Beauregard uint16_t atio_req_out; /* 2400 */ 564eb82ff87SDaniel Beauregard uint16_t io_base_addr; /* 2400 */ 565eb82ff87SDaniel Beauregard uint16_t nx_host_int; /* NetXen */ 566eb82ff87SDaniel Beauregard uint16_t nx_risc_int; /* NetXen */ 567fcf3ce44SJohn Forte } reg_off_t; 568fcf3ce44SJohn Forte 569*4c3888b8SHans Rosenfeld /* 570*4c3888b8SHans Rosenfeld * Multi-Queue, Mem BAR 2 definition. 571*4c3888b8SHans Rosenfeld */ 572*4c3888b8SHans Rosenfeld #define MBAR2_REQ_IN 0x0 573*4c3888b8SHans Rosenfeld #define MBAR2_REQ_OUT 0x4 574*4c3888b8SHans Rosenfeld #define MBAR2_RESP_IN 0x8 575*4c3888b8SHans Rosenfeld #define MBAR2_RESP_OUT 0xc 576*4c3888b8SHans Rosenfeld #define MBAR2_MULTI_Q_MAX 256 577*4c3888b8SHans Rosenfeld #define MBAR2_REG_OFFSET 4096 578*4c3888b8SHans Rosenfeld 579fcf3ce44SJohn Forte /* 580fcf3ce44SJohn Forte * Mbox-8 read maximum debounce count. 581fcf3ce44SJohn Forte * Reading Mbox-8 could be debouncing, before getting stable value. 582fcf3ce44SJohn Forte * This is the recommended driver fix from Qlogic along with firmware fix. 583fcf3ce44SJohn Forte * During testing, maximum count did not cross 3. 584fcf3ce44SJohn Forte */ 585fcf3ce44SJohn Forte #define QL_MAX_DEBOUNCE 10 586fcf3ce44SJohn Forte 587fcf3ce44SJohn Forte /* 588fcf3ce44SJohn Forte * Control Status register definitions 589fcf3ce44SJohn Forte */ 590fcf3ce44SJohn Forte #define ISP_FUNC_NUM_MASK (BIT_15 | BIT_14) 591fcf3ce44SJohn Forte #define ISP_FLASH_64K_BANK BIT_3 /* Flash BIOS 64K Bank Select */ 592fcf3ce44SJohn Forte #define ISP_FLASH_ENABLE BIT_1 /* Flash BIOS Read/Write enable */ 593fcf3ce44SJohn Forte #define ISP_RESET BIT_0 /* ISP soft reset */ 594fcf3ce44SJohn Forte 595fcf3ce44SJohn Forte /* 596fcf3ce44SJohn Forte * Control Status 24xx register definitions 597fcf3ce44SJohn Forte */ 598fcf3ce44SJohn Forte #define FLASH_NVRAM_ACCESS_ERROR BIT_18 599fcf3ce44SJohn Forte #define DMA_ACTIVE BIT_17 600fcf3ce44SJohn Forte #define DMA_SHUTDOWN BIT_16 601fcf3ce44SJohn Forte #define FUNCTION_NUMBER BIT_15 602fcf3ce44SJohn Forte 603fcf3ce44SJohn Forte #define MWB_4096_BYTES (BIT_5 | BIT_4) 604fcf3ce44SJohn Forte #define MWB_2048_BYTES BIT_5 605fcf3ce44SJohn Forte #define MWB_1024_BYTES BIT_4 606fcf3ce44SJohn Forte #define MWB_512_BYTES 0 607fcf3ce44SJohn Forte 608fcf3ce44SJohn Forte /* 609fcf3ce44SJohn Forte * Interrupt Control register definitions 610fcf3ce44SJohn Forte */ 611fcf3ce44SJohn Forte #define ISP_EN_INT BIT_15 /* ISP enable interrupts. */ 612fcf3ce44SJohn Forte #define ISP_EN_RISC BIT_3 /* ISP enable RISC interrupts. */ 613fcf3ce44SJohn Forte 614fcf3ce44SJohn Forte /* 615fcf3ce44SJohn Forte * Interrupt Status register definitions 616fcf3ce44SJohn Forte */ 617fcf3ce44SJohn Forte #define RISC_INT BIT_3 /* RISC interrupt */ 618fcf3ce44SJohn Forte 619eb82ff87SDaniel Beauregard /* 620eb82ff87SDaniel Beauregard * NetXen Host/Risc Interrupt register definitions 621eb82ff87SDaniel Beauregard */ 622eb82ff87SDaniel Beauregard #define NX_MBX_CMD BIT_0 /* Mailbox command present */ 623eb82ff87SDaniel Beauregard #define NX_RISC_INT BIT_0 /* RISC interrupt present */ 624eb82ff87SDaniel Beauregard 625fcf3ce44SJohn Forte /* 626fcf3ce44SJohn Forte * NVRAM register definitions. 627fcf3ce44SJohn Forte */ 628fcf3ce44SJohn Forte #define NV_DESELECT 0 629fcf3ce44SJohn Forte #define NV_CLOCK BIT_0 630fcf3ce44SJohn Forte #define NV_SELECT BIT_1 631fcf3ce44SJohn Forte #define NV_DATA_OUT BIT_2 632fcf3ce44SJohn Forte #define NV_DATA_IN BIT_3 633fcf3ce44SJohn Forte #define NV_PR_ENABLE BIT_13 /* protection register enable */ 634fcf3ce44SJohn Forte #define NV_WR_ENABLE BIT_14 /* write enable */ 635fcf3ce44SJohn Forte #define NV_BUSY BIT_15 636fcf3ce44SJohn Forte 637fcf3ce44SJohn Forte /* 638fcf3ce44SJohn Forte * Flash/NVRAM 24xx definitions 639fcf3ce44SJohn Forte */ 640fcf3ce44SJohn Forte #define FLASH_DATA_FLAG BIT_31 641fcf3ce44SJohn Forte #define FLASH_CONF_ADDR 0x7FFD0000 6425dfd244aSDaniel Beauregard #define FLASH_24_25_DATA_ADDR 0x7FF00000 6435dfd244aSDaniel Beauregard #define FLASH_8100_DATA_ADDR 0x7F800000 644*4c3888b8SHans Rosenfeld #define FLASH_8300_DATA_ADDR 0x7F800000 645*4c3888b8SHans Rosenfeld #define FLASH_2700_DATA_ADDR 0x7F800000 646fcf3ce44SJohn Forte #define FLASH_ADDR_MASK 0x7FFF0000 647fcf3ce44SJohn Forte 648fcf3ce44SJohn Forte #define NVRAM_CONF_ADDR 0x7FFF0000 649fcf3ce44SJohn Forte #define NVRAM_DATA_ADDR 0x7FFE0000 650fcf3ce44SJohn Forte 6515dfd244aSDaniel Beauregard #define NVRAM_2200_FUNC0_ADDR 0x0 6525dfd244aSDaniel Beauregard #define NVRAM_2300_FUNC0_ADDR 0x0 6535dfd244aSDaniel Beauregard #define NVRAM_2300_FUNC1_ADDR 0x80 6545dfd244aSDaniel Beauregard #define NVRAM_2400_FUNC0_ADDR 0x80 6555dfd244aSDaniel Beauregard #define NVRAM_2400_FUNC1_ADDR 0x180 6565dfd244aSDaniel Beauregard #define NVRAM_2500_FUNC0_ADDR 0x48080 6575dfd244aSDaniel Beauregard #define NVRAM_2500_FUNC1_ADDR 0x48180 6585dfd244aSDaniel Beauregard #define NVRAM_8100_FUNC0_ADDR 0xD0080 6595dfd244aSDaniel Beauregard #define NVRAM_8100_FUNC1_ADDR 0xD0180 660eb82ff87SDaniel Beauregard #define NVRAM_8021_FUNC0_ADDR 0xF0080 661eb82ff87SDaniel Beauregard #define NVRAM_8021_FUNC1_ADDR 0xF0180 662*4c3888b8SHans Rosenfeld #define NVRAM_8300_FC_FUNC0_ADDR 0x270080 663*4c3888b8SHans Rosenfeld #define NVRAM_8300_FC_FUNC1_ADDR 0x270180 664*4c3888b8SHans Rosenfeld #define NVRAM_8300_FCOE_FUNC0_ADDR 0x274080 665*4c3888b8SHans Rosenfeld #define NVRAM_8300_FCOE_FUNC1_ADDR 0x274180 666*4c3888b8SHans Rosenfeld #define NVRAM_2700_FUNC0_ADDR 0x270080 667*4c3888b8SHans Rosenfeld #define NVRAM_2700_FUNC1_ADDR 0x270180 668*4c3888b8SHans Rosenfeld #define NVRAM_2700_FUNC2_ADDR 0x270280 669*4c3888b8SHans Rosenfeld #define NVRAM_2700_FUNC3_ADDR 0x270380 6705dfd244aSDaniel Beauregard 6715dfd244aSDaniel Beauregard #define VPD_2400_FUNC0_ADDR 0 6725dfd244aSDaniel Beauregard #define VPD_2400_FUNC1_ADDR 0x100 6735dfd244aSDaniel Beauregard #define VPD_2500_FUNC0_ADDR 0x48000 6745dfd244aSDaniel Beauregard #define VPD_2500_FUNC1_ADDR 0x48100 6755dfd244aSDaniel Beauregard #define VPD_8100_FUNC0_ADDR 0xD0000 6765dfd244aSDaniel Beauregard #define VPD_8100_FUNC1_ADDR 0xD0400 677eb82ff87SDaniel Beauregard #define VPD_8021_FUNC0_ADDR 0xFA300 678eb82ff87SDaniel Beauregard #define VPD_8021_FUNC1_ADDR 0xFA300 679*4c3888b8SHans Rosenfeld #define VPD_8300_FC_FUNC0_ADDR 0x270000 680*4c3888b8SHans Rosenfeld #define VPD_8300_FC_FUNC1_ADDR 0x270100 681*4c3888b8SHans Rosenfeld #define VPD_8300_FCOE_FUNC0_ADDR 0xFA300 682*4c3888b8SHans Rosenfeld #define VPD_8300_FCOE_FUNC1_ADDR 0xFA300 683*4c3888b8SHans Rosenfeld #define VPD_2700_FUNC0_ADDR 0x270000 684*4c3888b8SHans Rosenfeld #define VPD_2700_FUNC1_ADDR 0x270100 685*4c3888b8SHans Rosenfeld #define VPD_2700_FUNC2_ADDR 0x270200 686*4c3888b8SHans Rosenfeld #define VPD_2700_FUNC3_ADDR 0x270300 6875dfd244aSDaniel Beauregard #define VPD_SIZE 0x80 6885dfd244aSDaniel Beauregard 6895dfd244aSDaniel Beauregard #define FLASH_2200_FIRMWARE_ADDR 0x20000 6905dfd244aSDaniel Beauregard #define FLASH_2300_FIRMWARE_ADDR 0x20000 6915dfd244aSDaniel Beauregard #define FLASH_2400_FIRMWARE_ADDR 0x20000 6925dfd244aSDaniel Beauregard #define FLASH_2500_FIRMWARE_ADDR 0x20000 6935dfd244aSDaniel Beauregard #define FLASH_8100_FIRMWARE_ADDR 0xA0000 694eb82ff87SDaniel Beauregard #define FLASH_8021_FIRMWARE_ADDR 0x40000 695eb82ff87SDaniel Beauregard #define FLASH_8021_FIRMWARE_SIZE 0x80000 696*4c3888b8SHans Rosenfeld #define FLASH_8300_FC_FIRMWARE_ADDR 0x240000 697*4c3888b8SHans Rosenfeld #define FLASH_8300_FCOE_FIRMWARE_ADDR 0x220000 698*4c3888b8SHans Rosenfeld #define FLASH_8300_FIRMWARE_SIZE 0x20000 699*4c3888b8SHans Rosenfeld #define FLASH_2700_FIRMWARE_ADDR 0x240000 700*4c3888b8SHans Rosenfeld #define FLASH_2700_FIRMWARE_SIZE 0x20000 701*4c3888b8SHans Rosenfeld 702eb82ff87SDaniel Beauregard #define FLASH_8021_BOOTLOADER_ADDR 0x4000 703eb82ff87SDaniel Beauregard #define FLASH_8021_BOOTLOADER_SIZE 0x8000 704*4c3888b8SHans Rosenfeld #define FLASH_8300_BOOTLOADER_ADDR 0x4000 705*4c3888b8SHans Rosenfeld #define FLASH_8300_BOOTLOADER_SIZE 0x8000 706*4c3888b8SHans Rosenfeld 707*4c3888b8SHans Rosenfeld #define FLASH_2200_BOOT_CODE_ADDR 0 708*4c3888b8SHans Rosenfeld #define FLASH_2300_BOOT_CODE_ADDR 0 709*4c3888b8SHans Rosenfeld #define FLASH_2400_BOOT_CODE_ADDR 0 710*4c3888b8SHans Rosenfeld #define FLASH_2500_BOOT_CODE_ADDR 0 711*4c3888b8SHans Rosenfeld #define FLASH_2700_BOOT_CODE_ADDR 0x200000 712*4c3888b8SHans Rosenfeld #define FLASH_8100_BOOT_CODE_ADDR 0x80000 713*4c3888b8SHans Rosenfeld #define FLASH_8021_BOOT_CODE_ADDR 0x20000 714*4c3888b8SHans Rosenfeld #define FLASH_8300_BOOT_CODE_ADDR 0x200000 715*4c3888b8SHans Rosenfeld 716*4c3888b8SHans Rosenfeld #define BEACON_8300_FC_FUNC0_ADDR 0x00201320 717*4c3888b8SHans Rosenfeld #define BEACON_8300_FC_FUNC1_ADDR 0x00201328 718*4c3888b8SHans Rosenfeld #define BEACON_8300_FCOE_FUNC0_ADDR 0x00201324 719*4c3888b8SHans Rosenfeld #define BEACON_8300_FCOE_FUNC1_ADDR 0x0020132c 720*4c3888b8SHans Rosenfeld #define BEACON_2700_FUNC0_ADDR 0x00201320 721*4c3888b8SHans Rosenfeld #define BEACON_2700_FUNC1_ADDR 0x00201328 722*4c3888b8SHans Rosenfeld #define BEACON_2700_FUNC2_ADDR 0x00201330 723*4c3888b8SHans Rosenfeld #define BEACON_2700_FUNC3_ADDR 0x00201338 7245dfd244aSDaniel Beauregard 7255dfd244aSDaniel Beauregard #define FLASH_2400_ERRLOG_START_ADDR_0 0 7265dfd244aSDaniel Beauregard #define FLASH_2400_ERRLOG_START_ADDR_1 0 727fcf3ce44SJohn Forte #define FLASH_2500_ERRLOG_START_ADDR_0 0x54000 728fcf3ce44SJohn Forte #define FLASH_2500_ERRLOG_START_ADDR_1 0x54400 7295dfd244aSDaniel Beauregard #define FLASH_8100_ERRLOG_START_ADDR_0 0xDC000 7305dfd244aSDaniel Beauregard #define FLASH_8100_ERRLOG_START_ADDR_1 0xDC400 731*4c3888b8SHans Rosenfeld #define FLASH_8300_ERRLOG_START_ADDR_0 0x280000 732*4c3888b8SHans Rosenfeld #define FLASH_8300_ERRLOG_START_ADDR_1 0x280400 733fcf3ce44SJohn Forte #define FLASH_ERRLOG_SIZE 0x200 734fcf3ce44SJohn Forte #define FLASH_ERRLOG_ENTRY_SIZE 4 7355dfd244aSDaniel Beauregard 7365dfd244aSDaniel Beauregard #define FLASH_2400_DESCRIPTOR_TABLE 0 737fcf3ce44SJohn Forte #define FLASH_2500_DESCRIPTOR_TABLE 0x50000 7385dfd244aSDaniel Beauregard #define FLASH_8100_DESCRIPTOR_TABLE 0xD8000 739eb82ff87SDaniel Beauregard #define FLASH_8021_DESCRIPTOR_TABLE 0 740*4c3888b8SHans Rosenfeld #define FLASH_8300_DESCRIPTOR_TABLE 0xFC000 741*4c3888b8SHans Rosenfeld #define FLASH_2700_DESCRIPTOR_TABLE 0xFC000 7425dfd244aSDaniel Beauregard 7435dfd244aSDaniel Beauregard #define FLASH_2400_LAYOUT_TABLE 0x11400 7445dfd244aSDaniel Beauregard #define FLASH_2500_LAYOUT_TABLE 0x50400 7455dfd244aSDaniel Beauregard #define FLASH_8100_LAYOUT_TABLE 0xD8400 746eb82ff87SDaniel Beauregard #define FLASH_8021_LAYOUT_TABLE 0xFC400 747*4c3888b8SHans Rosenfeld #define FLASH_8300_LAYOUT_TABLE 0xFC400 748*4c3888b8SHans Rosenfeld #define FLASH_2700_LAYOUT_TABLE 0xFC400 749fcf3ce44SJohn Forte 750fcf3ce44SJohn Forte /* 751fcf3ce44SJohn Forte * Flash Error Log Event Codes. 752fcf3ce44SJohn Forte */ 753fcf3ce44SJohn Forte #define FLASH_ERRLOG_AEN_8002 0x8002 754fcf3ce44SJohn Forte #define FLASH_ERRLOG_AEN_8003 0x8003 755fcf3ce44SJohn Forte #define FLASH_ERRLOG_AEN_8004 0x8004 756fcf3ce44SJohn Forte #define FLASH_ERRLOG_RESET_ERR 0xF00B 757fcf3ce44SJohn Forte #define FLASH_ERRLOG_ISP_ERR 0xF020 758fcf3ce44SJohn Forte #define FLASH_ERRLOG_PARITY_ERR 0xF022 759fcf3ce44SJohn Forte #define FLASH_ERRLOG_NVRAM_CHKSUM_ERR 0xF023 760fcf3ce44SJohn Forte #define FLASH_ERRLOG_FLASH_FW_ERR 0xF024 761fcf3ce44SJohn Forte 762fcf3ce44SJohn Forte #define VPD_TAG_END 0x78 763fcf3ce44SJohn Forte #define VPD_TAG_CHKSUM "RV" 764fcf3ce44SJohn Forte #define VPD_TAG_SN "SN" 765fcf3ce44SJohn Forte #define VPD_TAG_PN "PN" 766fcf3ce44SJohn Forte #define VPD_TAG_PRODID "\x82" 767fcf3ce44SJohn Forte #define VPD_TAG_LRT 0x90 768fcf3ce44SJohn Forte #define VPD_TAG_LRTC 0x91 769fcf3ce44SJohn Forte 770fcf3ce44SJohn Forte /* 771fcf3ce44SJohn Forte * RISC to Host Status register definitions. 772fcf3ce44SJohn Forte */ 773fcf3ce44SJohn Forte #define RH_RISC_INT BIT_15 /* RISC to Host Intrpt Req */ 774fcf3ce44SJohn Forte #define RH_RISC_PAUSED BIT_8 /* RISC Paused bit. */ 775fcf3ce44SJohn Forte 776fcf3ce44SJohn Forte /* 777fcf3ce44SJohn Forte * RISC to Host Status register status field definitions. 778fcf3ce44SJohn Forte */ 779fcf3ce44SJohn Forte #define ROM_MBX_SUCCESS 0x01 780fcf3ce44SJohn Forte #define ROM_MBX_ERR 0x02 781fcf3ce44SJohn Forte #define MBX_SUCCESS 0x10 782fcf3ce44SJohn Forte #define MBX_ERR 0x11 783fcf3ce44SJohn Forte #define ASYNC_EVENT 0x12 784fcf3ce44SJohn Forte #define RESP_UPDATE 0x13 785*4c3888b8SHans Rosenfeld #define MULTI_Q_RSP_UPDATE 0x14 786fcf3ce44SJohn Forte #define SCSI_FAST_POST_16 0x15 787fcf3ce44SJohn Forte #define SCSI_FAST_POST_32 0x16 788fcf3ce44SJohn Forte #define CTIO_FAST_POST 0x17 789fcf3ce44SJohn Forte #define IP_FAST_POST_XMT 0x18 790fcf3ce44SJohn Forte #define IP_FAST_POST_RCV 0x19 791fcf3ce44SJohn Forte #define IP_FAST_POST_BRD 0x1a 792fcf3ce44SJohn Forte #define IP_FAST_POST_RCV_ALN 0x1b 793fcf3ce44SJohn Forte #define ATIO_UPDATE 0x1c 794fcf3ce44SJohn Forte #define ATIO_RESP_UPDATE 0x1d 795fcf3ce44SJohn Forte 796fcf3ce44SJohn Forte /* 797fcf3ce44SJohn Forte * HCCR commands. 798fcf3ce44SJohn Forte */ 799fcf3ce44SJohn Forte #define HC_RESET_RISC 0x1000 /* Reset RISC */ 800fcf3ce44SJohn Forte #define HC_PAUSE_RISC 0x2000 /* Pause RISC */ 801fcf3ce44SJohn Forte #define HC_RELEASE_RISC 0x3000 /* Release RISC from reset. */ 802fcf3ce44SJohn Forte #define HC_DISABLE_PARITY_PAUSE 0x4001 /* qla2200/2300 - disable parity err */ 803fcf3ce44SJohn Forte /* RISC pause. */ 804fcf3ce44SJohn Forte #define HC_SET_HOST_INT 0x5000 /* Set host interrupt */ 805fcf3ce44SJohn Forte #define HC_CLR_HOST_INT 0x6000 /* Clear HOST interrupt */ 806fcf3ce44SJohn Forte #define HC_CLR_RISC_INT 0x7000 /* Clear RISC interrupt */ 807fcf3ce44SJohn Forte #define HC_HOST_INT BIT_7 /* Host interrupt bit */ 808fcf3ce44SJohn Forte #define HC_RISC_PAUSE BIT_5 /* Pause mode bit */ 809fcf3ce44SJohn Forte 810fcf3ce44SJohn Forte /* 811fcf3ce44SJohn Forte * HCCR commands for 24xx and 25xx. 812fcf3ce44SJohn Forte */ 813fcf3ce44SJohn Forte #define HC24_RESET_RISC 0x10000000 /* Reset RISC */ 814fcf3ce44SJohn Forte #define HC24_CLEAR_RISC_RESET 0x20000000 /* Release RISC from reset. */ 815fcf3ce44SJohn Forte #define HC24_PAUSE_RISC 0x30000000 /* Pause RISC */ 816fcf3ce44SJohn Forte #define HC24_RELEASE_PAUSE 0x40000000 /* Release RISC from pause */ 817fcf3ce44SJohn Forte #define HC24_SET_HOST_INT 0x50000000 /* Set host interrupt */ 818fcf3ce44SJohn Forte #define HC24_CLR_HOST_INT 0x60000000 /* Clear HOST interrupt */ 819fcf3ce44SJohn Forte #define HC24_CLR_RISC_INT 0xA0000000 /* Clear RISC interrupt */ 820fcf3ce44SJohn Forte #define HC24_HOST_INT BIT_6 /* Host to RISC intrpt bit */ 821fcf3ce44SJohn Forte #define HC24_RISC_RESET BIT_5 /* RISC Reset mode bit. */ 822fcf3ce44SJohn Forte 823fcf3ce44SJohn Forte /* 824fcf3ce44SJohn Forte * ISP Initialization Control Blocks. 825fcf3ce44SJohn Forte * Little endian except where noted. 826fcf3ce44SJohn Forte */ 827fcf3ce44SJohn Forte #define ICB_VERSION 1 828fcf3ce44SJohn Forte typedef struct ql_init_cb { 829*4c3888b8SHans Rosenfeld uint8_t version; 830*4c3888b8SHans Rosenfeld uint8_t reserved; 831fcf3ce44SJohn Forte 832fcf3ce44SJohn Forte /* 833fcf3ce44SJohn Forte * LSB BIT 0 = enable_hard_loop_id 834fcf3ce44SJohn Forte * LSB BIT 1 = enable_fairness 835fcf3ce44SJohn Forte * LSB BIT 2 = enable_full_duplex 836fcf3ce44SJohn Forte * LSB BIT 3 = enable_fast_posting 837fcf3ce44SJohn Forte * LSB BIT 4 = enable_target_mode 838fcf3ce44SJohn Forte * LSB BIT 5 = disable_initiator_mode 839fcf3ce44SJohn Forte * LSB BIT 6 = enable_adisc 840fcf3ce44SJohn Forte * LSB BIT 7 = enable_target_inquiry_data 841fcf3ce44SJohn Forte * 842fcf3ce44SJohn Forte * MSB BIT 0 = enable_port_update_ae 843fcf3ce44SJohn Forte * MSB BIT 1 = disable_initial_lip 844fcf3ce44SJohn Forte * MSB BIT 2 = enable_decending_soft_assign 845fcf3ce44SJohn Forte * MSB BIT 3 = previous_assigned_addressing 846fcf3ce44SJohn Forte * MSB BIT 4 = enable_stop_q_on_full 847fcf3ce44SJohn Forte * MSB BIT 5 = enable_full_login_on_lip 848fcf3ce44SJohn Forte * MSB BIT 6 = enable_node_name 849fcf3ce44SJohn Forte * MSB BIT 7 = extended_control_block 850fcf3ce44SJohn Forte */ 851fcf3ce44SJohn Forte uint8_t firmware_options[2]; 852fcf3ce44SJohn Forte 853fcf3ce44SJohn Forte uint8_t max_frame_length[2]; 854fcf3ce44SJohn Forte uint8_t max_iocb_allocation[2]; 855fcf3ce44SJohn Forte uint8_t execution_throttle[2]; 856fcf3ce44SJohn Forte uint8_t login_retry_count; 857fcf3ce44SJohn Forte uint8_t retry_delay; /* unused */ 858fcf3ce44SJohn Forte uint8_t port_name[8]; /* Big endian. */ 859fcf3ce44SJohn Forte uint8_t hard_address[2]; /* option bit 0 */ 860fcf3ce44SJohn Forte uint8_t inquiry; /* option bit 7 */ 861fcf3ce44SJohn Forte uint8_t login_timeout; 862fcf3ce44SJohn Forte uint8_t node_name[8]; /* Big endian */ 863fcf3ce44SJohn Forte uint8_t request_q_outpointer[2]; 864fcf3ce44SJohn Forte uint8_t response_q_inpointer[2]; 865fcf3ce44SJohn Forte uint8_t request_q_length[2]; 866fcf3ce44SJohn Forte uint8_t response_q_length[2]; 867fcf3ce44SJohn Forte uint8_t request_q_address[8]; 868fcf3ce44SJohn Forte uint8_t response_q_address[8]; 869fcf3ce44SJohn Forte uint8_t lun_enables[2]; 870fcf3ce44SJohn Forte uint8_t command_resouce_count; 871fcf3ce44SJohn Forte uint8_t immediate_notify_resouce_count; 872fcf3ce44SJohn Forte uint8_t timeout[2]; 873fcf3ce44SJohn Forte uint8_t reserved_2[2]; 874fcf3ce44SJohn Forte 875fcf3ce44SJohn Forte /* 876fcf3ce44SJohn Forte * LSB BIT 0 = Timer operation mode bit 0 877fcf3ce44SJohn Forte * LSB BIT 1 = Timer operation mode bit 1 878fcf3ce44SJohn Forte * LSB BIT 2 = Timer operation mode bit 2 879fcf3ce44SJohn Forte * LSB BIT 3 = Timer operation mode bit 3 880fcf3ce44SJohn Forte * LSB BIT 4 = P2P Connection option bit 0 881fcf3ce44SJohn Forte * LSB BIT 5 = P2P Connection option bit 1 882fcf3ce44SJohn Forte * LSB BIT 6 = P2P Connection option bit 2 883fcf3ce44SJohn Forte * LSB BIT 7 = Enable Non part on LIHA failure 884fcf3ce44SJohn Forte * 885fcf3ce44SJohn Forte * MSB BIT 0 = Enable class 2 886fcf3ce44SJohn Forte * MSB BIT 1 = Enable ACK0 887fcf3ce44SJohn Forte * MSB BIT 2 = 888fcf3ce44SJohn Forte * MSB BIT 3 = 889fcf3ce44SJohn Forte * MSB BIT 4 = FC Tape Enable 890fcf3ce44SJohn Forte * MSB BIT 5 = Enable FC Confirm 891fcf3ce44SJohn Forte * MSB BIT 6 = Enable CRN 892fcf3ce44SJohn Forte * MSB BIT 7 = 893fcf3ce44SJohn Forte */ 894*4c3888b8SHans Rosenfeld uint8_t add_fw_opt[2]; 895fcf3ce44SJohn Forte 896*4c3888b8SHans Rosenfeld uint8_t response_accumulation_timer; 897*4c3888b8SHans Rosenfeld uint8_t interrupt_delay_timer; 898fcf3ce44SJohn Forte 899fcf3ce44SJohn Forte /* 900fcf3ce44SJohn Forte * LSB BIT 0 = Enable Read xfr_rdy 901fcf3ce44SJohn Forte * LSB BIT 1 = Soft ID only 902fcf3ce44SJohn Forte * LSB BIT 2 = 903fcf3ce44SJohn Forte * LSB BIT 3 = 904fcf3ce44SJohn Forte * LSB BIT 4 = FCP RSP Payload [0] 905fcf3ce44SJohn Forte * LSB BIT 5 = FCP RSP Payload [1] / Sbus enable - 2200 906fcf3ce44SJohn Forte * LSB BIT 6 = 907fcf3ce44SJohn Forte * LSB BIT 7 = 908fcf3ce44SJohn Forte * 909fcf3ce44SJohn Forte * MSB BIT 0 = Sbus enable - 2300 910fcf3ce44SJohn Forte * MSB BIT 1 = 911fcf3ce44SJohn Forte * MSB BIT 2 = 912fcf3ce44SJohn Forte * MSB BIT 3 = 913fcf3ce44SJohn Forte * MSB BIT 4 = 914fcf3ce44SJohn Forte * MSB BIT 5 = enable 50 ohm termination 915fcf3ce44SJohn Forte * MSB BIT 6 = Data Rate (2300 only) 916fcf3ce44SJohn Forte * MSB BIT 7 = Data Rate (2300 only) 917fcf3ce44SJohn Forte */ 918*4c3888b8SHans Rosenfeld uint8_t special_options[2]; 919fcf3ce44SJohn Forte 920*4c3888b8SHans Rosenfeld uint8_t reserved_3[26]; 921fcf3ce44SJohn Forte } ql_init_cb_t; 9225dfd244aSDaniel Beauregard 923fcf3ce44SJohn Forte /* 924fcf3ce44SJohn Forte * Virtual port definition. 925fcf3ce44SJohn Forte */ 926fcf3ce44SJohn Forte typedef struct ql_vp_cfg { 927*4c3888b8SHans Rosenfeld uint8_t reserved[2]; 928*4c3888b8SHans Rosenfeld uint8_t options; 929*4c3888b8SHans Rosenfeld uint8_t hard_prev_addr; 930*4c3888b8SHans Rosenfeld uint8_t port_name[8]; 931*4c3888b8SHans Rosenfeld uint8_t node_name[8]; 932fcf3ce44SJohn Forte } ql_vp_cfg_t; 933fcf3ce44SJohn Forte 934fcf3ce44SJohn Forte /* 935fcf3ce44SJohn Forte * VP options. 936fcf3ce44SJohn Forte */ 9374f8b8adcSDaniel Beauregard #define VPO_ENABLE_SNS_LOGIN_SCR BIT_6 938fcf3ce44SJohn Forte #define VPO_TARGET_MODE_DISABLED BIT_5 939fcf3ce44SJohn Forte #define VPO_INITIATOR_MODE_ENABLED BIT_4 940fcf3ce44SJohn Forte #define VPO_ENABLED BIT_3 941fcf3ce44SJohn Forte #define VPO_ID_NOT_ACQUIRED BIT_2 942fcf3ce44SJohn Forte #define VPO_PREVIOUSLY_ASSIGNED_ID BIT_1 943fcf3ce44SJohn Forte #define VPO_HARD_ASSIGNED_ID BIT_0 944fcf3ce44SJohn Forte 945fcf3ce44SJohn Forte #define ICB_24XX_VERSION 1 946fcf3ce44SJohn Forte typedef struct ql_init_24xx_cb { 947fcf3ce44SJohn Forte uint8_t version[2]; 948fcf3ce44SJohn Forte uint8_t reserved_1[2]; 949fcf3ce44SJohn Forte uint8_t max_frame_length[2]; 950fcf3ce44SJohn Forte uint8_t execution_throttle[2]; 951fcf3ce44SJohn Forte uint8_t exchange_count[2]; 952fcf3ce44SJohn Forte uint8_t hard_address[2]; 953fcf3ce44SJohn Forte uint8_t port_name[8]; /* Big endian. */ 954fcf3ce44SJohn Forte uint8_t node_name[8]; /* Big endian. */ 955fcf3ce44SJohn Forte 956fcf3ce44SJohn Forte uint8_t response_q_inpointer[2]; 957fcf3ce44SJohn Forte uint8_t request_q_outpointer[2]; 958fcf3ce44SJohn Forte 959fcf3ce44SJohn Forte uint8_t login_retry_count[2]; 960fcf3ce44SJohn Forte 961fcf3ce44SJohn Forte uint8_t prio_request_q_outpointer[2]; 962fcf3ce44SJohn Forte 963fcf3ce44SJohn Forte uint8_t response_q_length[2]; 964fcf3ce44SJohn Forte uint8_t request_q_length[2]; 965fcf3ce44SJohn Forte 966fcf3ce44SJohn Forte uint8_t link_down_on_nos[2]; 967fcf3ce44SJohn Forte 968fcf3ce44SJohn Forte uint8_t prio_request_q_length[2]; 969fcf3ce44SJohn Forte uint8_t request_q_address[8]; 970fcf3ce44SJohn Forte uint8_t response_q_address[8]; 971fcf3ce44SJohn Forte uint8_t prio_request_q_address[8]; 9725dfd244aSDaniel Beauregard uint8_t msi_x_vector[2]; 9735dfd244aSDaniel Beauregard uint8_t reserved_2[6]; 974fcf3ce44SJohn Forte uint8_t atio_q_inpointer[2]; 975fcf3ce44SJohn Forte uint8_t atio_q_length[2]; 976fcf3ce44SJohn Forte uint8_t atio_q_address[8]; 977fcf3ce44SJohn Forte 978fcf3ce44SJohn Forte uint8_t interrupt_delay_timer[2]; /* 100us per */ 979fcf3ce44SJohn Forte uint8_t login_timeout[2]; 980fcf3ce44SJohn Forte /* 981fcf3ce44SJohn Forte * BIT 0 = Hard Assigned Loop ID 982fcf3ce44SJohn Forte * BIT 1 = Enable Fairness 983fcf3ce44SJohn Forte * BIT 2 = Enable Full-Duplex 984fcf3ce44SJohn Forte * BIT 3 = Reserved 985fcf3ce44SJohn Forte * BIT 4 = Target Mode Enable 986fcf3ce44SJohn Forte * BIT 5 = Initiator Mode Disable 987fcf3ce44SJohn Forte * BIT 6 = Reserved 988fcf3ce44SJohn Forte * BIT 7 = Reserved 989fcf3ce44SJohn Forte * 990fcf3ce44SJohn Forte * BIT 8 = Reserved 991fcf3ce44SJohn Forte * BIT 9 = Disable Initial LIP 992fcf3ce44SJohn Forte * BIT 10 = Descending Loop ID Search 993fcf3ce44SJohn Forte * BIT 11 = Previous Assigned Loop ID 994fcf3ce44SJohn Forte * BIT 12 = Reserved 995fcf3ce44SJohn Forte * BIT 13 = Full Login after LIP 996fcf3ce44SJohn Forte * BIT 14 = Node Name Option 997fcf3ce44SJohn Forte * BIT 15-31 = Reserved 998fcf3ce44SJohn Forte */ 999*4c3888b8SHans Rosenfeld uint8_t firmware_options_1[4]; 1000fcf3ce44SJohn Forte 1001fcf3ce44SJohn Forte /* 1002fcf3ce44SJohn Forte * BIT 0 = Operation Mode bit 0 1003fcf3ce44SJohn Forte * BIT 1 = Operation Mode bit 1 1004fcf3ce44SJohn Forte * BIT 2 = Operation Mode bit 2 1005fcf3ce44SJohn Forte * BIT 3 = Operation Mode bit 3 1006fcf3ce44SJohn Forte * BIT 4 = Connection Options bit 0 1007fcf3ce44SJohn Forte * BIT 5 = Connection Options bit 1 1008fcf3ce44SJohn Forte * BIT 6 = Connection Options bit 2 1009fcf3ce44SJohn Forte * BIT 7 = Enable Non part on LIHA failure 1010fcf3ce44SJohn Forte * 1011fcf3ce44SJohn Forte * BIT 8 = Enable Class 2 1012fcf3ce44SJohn Forte * BIT 9 = Enable ACK0 1013fcf3ce44SJohn Forte * BIT 10 = Reserved 1014fcf3ce44SJohn Forte * BIT 11 = Enable FC-SP Security 1015fcf3ce44SJohn Forte * BIT 12 = FC Tape Enable 10165dfd244aSDaniel Beauregard * BIT 13 = Reserved 10175dfd244aSDaniel Beauregard * BIT 14 = Target PRLI Control 10185dfd244aSDaniel Beauregard * BIT 15 = Reserved 10195dfd244aSDaniel Beauregard * 10205dfd244aSDaniel Beauregard * BIT 16 = Enable Emulated MSIX 10215dfd244aSDaniel Beauregard * BIT 17 = Reserved 10225dfd244aSDaniel Beauregard * BIT 18 = Enable Alternate Device Number 10235dfd244aSDaniel Beauregard * BIT 19 = Enable Alternate Bus Number 10245dfd244aSDaniel Beauregard * BIT 20 = Enable Translated Address 10255dfd244aSDaniel Beauregard * BIT 21 = Enable VM Security 10265dfd244aSDaniel Beauregard * BIT 22 = Enable Interrupt Handshake 10275dfd244aSDaniel Beauregard * BIT 23 = Enable Multiple Queue 10285dfd244aSDaniel Beauregard * 10295dfd244aSDaniel Beauregard * BIT 24 = IOCB Security 10305dfd244aSDaniel Beauregard * BIT 25 = qos 10315dfd244aSDaniel Beauregard * BIT 26-31 = Reserved 1032fcf3ce44SJohn Forte */ 1033fcf3ce44SJohn Forte uint8_t firmware_options_2[4]; 1034fcf3ce44SJohn Forte 1035fcf3ce44SJohn Forte /* 1036fcf3ce44SJohn Forte * BIT 0 = Reserved 1037fcf3ce44SJohn Forte * BIT 1 = Soft ID only 1038fcf3ce44SJohn Forte * BIT 2 = Reserved 1039fcf3ce44SJohn Forte * BIT 3 = Reserved 1040fcf3ce44SJohn Forte * BIT 4 = FCP RSP Payload bit 0 1041fcf3ce44SJohn Forte * BIT 5 = FCP RSP Payload bit 1 1042fcf3ce44SJohn Forte * BIT 6 = Enable Rec Out-of-Order data frame handling 1043fcf3ce44SJohn Forte * BIT 7 = Disable Automatic PLOGI on Local Loop 1044fcf3ce44SJohn Forte * 1045fcf3ce44SJohn Forte * BIT 8 = Reserved 1046fcf3ce44SJohn Forte * BIT 9 = Enable Out-of-Order FCP_XFER_RDY relative 1047fcf3ce44SJohn Forte * offset handling 1048fcf3ce44SJohn Forte * BIT 10 = Reserved 1049fcf3ce44SJohn Forte * BIT 11 = Reserved 1050fcf3ce44SJohn Forte * BIT 12 = Reserved 1051fcf3ce44SJohn Forte * BIT 13 = Data Rate bit 0 1052fcf3ce44SJohn Forte * BIT 14 = Data Rate bit 1 1053fcf3ce44SJohn Forte * BIT 15 = Data Rate bit 2 10545dfd244aSDaniel Beauregard * 1055fcf3ce44SJohn Forte * BIT 16 = 75-ohm Termination Select 10565dfd244aSDaniel Beauregard * BIT 17 = Enable Multiple FCFs 10575dfd244aSDaniel Beauregard * BIT 18 = MAC Addressing Mode 10585dfd244aSDaniel Beauregard * BIT 19 = MAC Addressing Mode 10595dfd244aSDaniel Beauregard * BIT 20 = MAC Addressing Mode 10605dfd244aSDaniel Beauregard * BIT 21 = Ethernet Data Rate 10615dfd244aSDaniel Beauregard * BIT 22 = Ethernet Data Rate 10625dfd244aSDaniel Beauregard * BIT 23 = Ethernet Data Rate 10635dfd244aSDaniel Beauregard * 10645dfd244aSDaniel Beauregard * BIT 24 = Ethernet Data Rate 10655dfd244aSDaniel Beauregard * BIT 25 = Ethernet Data Rate 10665dfd244aSDaniel Beauregard * BIT 26 = Enable Ethernet Header ATIO Queue 10675dfd244aSDaniel Beauregard * BIT 27 = Enable Ethernet Header Response Queue 10685dfd244aSDaniel Beauregard * BIT 28 = SPMA Selection 10695dfd244aSDaniel Beauregard * BIT 29 = SPMA Selection 10705dfd244aSDaniel Beauregard * BIT 30 = Reserved 10715dfd244aSDaniel Beauregard * BIT 31 = Reserved 1072fcf3ce44SJohn Forte */ 1073fcf3ce44SJohn Forte uint8_t firmware_options_3[4]; 1074fcf3ce44SJohn Forte 1075*4c3888b8SHans Rosenfeld uint8_t qos[2]; 1076*4c3888b8SHans Rosenfeld uint8_t rid[2]; 10775dfd244aSDaniel Beauregard 1078*4c3888b8SHans Rosenfeld uint8_t reserved_3[4]; 10795dfd244aSDaniel Beauregard 1080*4c3888b8SHans Rosenfeld uint8_t enode_mac_addr[6]; 10815dfd244aSDaniel Beauregard 1082*4c3888b8SHans Rosenfeld uint8_t reserved_4[10]; 1083fcf3ce44SJohn Forte 1084fcf3ce44SJohn Forte /* 1085fcf3ce44SJohn Forte * Multi-ID firmware. 1086fcf3ce44SJohn Forte */ 1087*4c3888b8SHans Rosenfeld uint8_t vp_count[2]; 1088fcf3ce44SJohn Forte 1089fcf3ce44SJohn Forte /* 1090fcf3ce44SJohn Forte * BIT 1 = Allows mode 2 connection option 1091fcf3ce44SJohn Forte */ 1092fcf3ce44SJohn Forte uint8_t global_vp_option[2]; 1093fcf3ce44SJohn Forte 10945dfd244aSDaniel Beauregard ql_vp_cfg_t vpc[MAX_25_VIRTUAL_PORTS + 1]; 10955dfd244aSDaniel Beauregard 10965dfd244aSDaniel Beauregard /* 10975dfd244aSDaniel Beauregard * Extended Initialization Control Block 10985dfd244aSDaniel Beauregard */ 10995dfd244aSDaniel Beauregard ql_ext_icb_8100_t ext_blk; 1100fcf3ce44SJohn Forte } ql_init_24xx_cb_t; 1101fcf3ce44SJohn Forte 1102fcf3ce44SJohn Forte typedef union ql_comb_init_cb { 1103fcf3ce44SJohn Forte ql_init_cb_t cb; 1104fcf3ce44SJohn Forte ql_init_24xx_cb_t cb24; 1105fcf3ce44SJohn Forte } ql_comb_init_cb_t; 1106fcf3ce44SJohn Forte 1107fcf3ce44SJohn Forte /* 1108fcf3ce44SJohn Forte * ISP IP Initialization Control Block. 1109fcf3ce44SJohn Forte * Little endian except where noted. 1110fcf3ce44SJohn Forte */ 1111fcf3ce44SJohn Forte #define IP_ICB_VERSION 1 1112fcf3ce44SJohn Forte typedef struct ql_ip_init_cb { 1113*4c3888b8SHans Rosenfeld uint8_t version; 1114*4c3888b8SHans Rosenfeld uint8_t reserved; 1115fcf3ce44SJohn Forte 1116fcf3ce44SJohn Forte /* 1117fcf3ce44SJohn Forte * LSB BIT 0 = receive_buffer_address_length 1118fcf3ce44SJohn Forte * LSB BIT 1 = fast post broadcast received 1119fcf3ce44SJohn Forte * LSB BIT 2 = allow out of receive buffers AE 1120fcf3ce44SJohn Forte */ 1121fcf3ce44SJohn Forte uint8_t ip_firmware_options[2]; 1122fcf3ce44SJohn Forte uint8_t ip_header_size[2]; 1123fcf3ce44SJohn Forte uint8_t mtu_size[2]; /* max value is 65280 */ 1124fcf3ce44SJohn Forte uint8_t buf_size[2]; 1125fcf3ce44SJohn Forte uint8_t reserved_1[8]; 1126fcf3ce44SJohn Forte uint8_t queue_size[2]; /* 8-1024 */ 1127fcf3ce44SJohn Forte uint8_t low_water_mark[2]; 1128fcf3ce44SJohn Forte uint8_t queue_address[8]; 1129fcf3ce44SJohn Forte uint8_t queue_inpointer[2]; 1130fcf3ce44SJohn Forte uint8_t fast_post_reg_count[2]; /* 0-14 */ 1131fcf3ce44SJohn Forte uint8_t cc[2]; 1132fcf3ce44SJohn Forte uint8_t reserved_2[28]; 1133fcf3ce44SJohn Forte } ql_ip_init_cb_t; 1134fcf3ce44SJohn Forte 1135fcf3ce44SJohn Forte #define IP_ICB_24XX_VERSION 1 1136fcf3ce44SJohn Forte typedef struct ql_ip_init_24xx_cb { 1137*4c3888b8SHans Rosenfeld uint8_t version; 1138*4c3888b8SHans Rosenfeld uint8_t reserved; 1139fcf3ce44SJohn Forte /* 1140fcf3ce44SJohn Forte * LSB BIT 2 = allow out of receive buffers AE 1141fcf3ce44SJohn Forte */ 1142fcf3ce44SJohn Forte uint8_t ip_firmware_options[2]; 1143fcf3ce44SJohn Forte uint8_t ip_header_size[2]; 1144fcf3ce44SJohn Forte uint8_t mtu_size[2]; 1145fcf3ce44SJohn Forte uint8_t buf_size[2]; 1146fcf3ce44SJohn Forte uint8_t reserved_1[10]; 1147fcf3ce44SJohn Forte uint8_t low_water_mark[2]; 1148fcf3ce44SJohn Forte uint8_t reserved_3[12]; 1149fcf3ce44SJohn Forte uint8_t cc[2]; 1150fcf3ce44SJohn Forte uint8_t reserved_2[28]; 1151fcf3ce44SJohn Forte } ql_ip_init_24xx_cb_t; 1152fcf3ce44SJohn Forte 1153fcf3ce44SJohn Forte typedef union ql_comb_ip_init_cb { 1154fcf3ce44SJohn Forte ql_ip_init_cb_t cb; 1155fcf3ce44SJohn Forte ql_ip_init_24xx_cb_t cb24; 1156fcf3ce44SJohn Forte } ql_comb_ip_init_cb_t; 1157fcf3ce44SJohn Forte 1158fcf3ce44SJohn Forte /* 1159fcf3ce44SJohn Forte * f/w module table 1160fcf3ce44SJohn Forte */ 1161fcf3ce44SJohn Forte struct fw_table { 1162*4c3888b8SHans Rosenfeld uint32_t fw_class; 1163fcf3ce44SJohn Forte int8_t *fw_version; 1164fcf3ce44SJohn Forte }; 1165fcf3ce44SJohn Forte 1166fcf3ce44SJohn Forte /* 1167fcf3ce44SJohn Forte * DMA memory type. 1168fcf3ce44SJohn Forte */ 1169fcf3ce44SJohn Forte typedef enum mem_alloc_type { 1170fcf3ce44SJohn Forte UNKNOWN_MEMORY, 1171fcf3ce44SJohn Forte TASK_MEMORY, 1172fcf3ce44SJohn Forte LITTLE_ENDIAN_DMA, 1173fcf3ce44SJohn Forte BIG_ENDIAN_DMA, 1174fcf3ce44SJohn Forte KERNEL_MEM, 1175*4c3888b8SHans Rosenfeld NO_SWAP_DMA 1176fcf3ce44SJohn Forte } mem_alloc_type_t; 1177fcf3ce44SJohn Forte 1178fcf3ce44SJohn Forte /* 1179fcf3ce44SJohn Forte * DMA memory alignment type. 1180fcf3ce44SJohn Forte */ 1181fcf3ce44SJohn Forte typedef enum men_align_type { 118216dd44c2SDaniel Beauregard QL_DMA_DATA_ALIGN, 118316dd44c2SDaniel Beauregard QL_DMA_RING_ALIGN, 1184fcf3ce44SJohn Forte } mem_alignment_t; 1185fcf3ce44SJohn Forte 1186fcf3ce44SJohn Forte /* 1187fcf3ce44SJohn Forte * DMA memory object. 1188fcf3ce44SJohn Forte */ 1189fcf3ce44SJohn Forte typedef struct dma_mem { 1190fcf3ce44SJohn Forte uint64_t alignment; 1191fcf3ce44SJohn Forte void *bp; 1192fcf3ce44SJohn Forte ddi_dma_cookie_t *cookies; 1193fcf3ce44SJohn Forte ddi_acc_handle_t acc_handle; 1194fcf3ce44SJohn Forte ddi_dma_handle_t dma_handle; 1195fcf3ce44SJohn Forte ddi_dma_cookie_t cookie; 1196*4c3888b8SHans Rosenfeld uint32_t max_cookie_count; 1197fcf3ce44SJohn Forte uint32_t cookie_count; 1198fcf3ce44SJohn Forte uint32_t size; 1199fcf3ce44SJohn Forte uint32_t memflags; 1200fcf3ce44SJohn Forte mem_alloc_type_t type; 1201fcf3ce44SJohn Forte uint32_t flags; /* Solaris DMA flags. */ 1202fcf3ce44SJohn Forte } dma_mem_t; 1203fcf3ce44SJohn Forte 1204fcf3ce44SJohn Forte /* 1205fcf3ce44SJohn Forte * 24 bit port ID type definition. 1206fcf3ce44SJohn Forte */ 1207fcf3ce44SJohn Forte typedef union { 1208fcf3ce44SJohn Forte struct { 1209fcf3ce44SJohn Forte uint8_t d_id[3]; 1210fcf3ce44SJohn Forte uint8_t rsvd_1; 1211fcf3ce44SJohn Forte }r; 1212fcf3ce44SJohn Forte 1213fcf3ce44SJohn Forte uint32_t b24 : 24; 1214fcf3ce44SJohn Forte 1215fcf3ce44SJohn Forte #if defined(_BIT_FIELDS_LTOH) 1216fcf3ce44SJohn Forte struct { 1217fcf3ce44SJohn Forte uint8_t al_pa; 1218fcf3ce44SJohn Forte uint8_t area; 1219fcf3ce44SJohn Forte uint8_t domain; 1220fcf3ce44SJohn Forte uint8_t rsvd_1; 1221fcf3ce44SJohn Forte }b; 1222fcf3ce44SJohn Forte #elif defined(_BIT_FIELDS_HTOL) 1223fcf3ce44SJohn Forte struct { 1224fcf3ce44SJohn Forte uint8_t domain; 1225fcf3ce44SJohn Forte uint8_t area; 1226fcf3ce44SJohn Forte uint8_t al_pa; 1227fcf3ce44SJohn Forte uint8_t rsvd_1; 1228fcf3ce44SJohn Forte }b; 1229fcf3ce44SJohn Forte #else 1230*4c3888b8SHans Rosenfeld #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 1231fcf3ce44SJohn Forte #endif 1232fcf3ce44SJohn Forte } port_id_t; 1233fcf3ce44SJohn Forte 1234fcf3ce44SJohn Forte /* 1235fcf3ce44SJohn Forte * Link list definitions. 1236fcf3ce44SJohn Forte */ 1237fcf3ce44SJohn Forte typedef struct ql_link { 1238*4c3888b8SHans Rosenfeld struct ql_link *prev; 1239*4c3888b8SHans Rosenfeld struct ql_link *next; 1240*4c3888b8SHans Rosenfeld void *base_address; 1241*4c3888b8SHans Rosenfeld struct ql_head *head; /* the queue this link is on */ 1242fcf3ce44SJohn Forte } ql_link_t; 1243fcf3ce44SJohn Forte 1244fcf3ce44SJohn Forte typedef struct ql_head { 1245*4c3888b8SHans Rosenfeld ql_link_t *first; 1246*4c3888b8SHans Rosenfeld ql_link_t *last; 1247fcf3ce44SJohn Forte } ql_head_t; 1248fcf3ce44SJohn Forte 1249*4c3888b8SHans Rosenfeld /* 1250*4c3888b8SHans Rosenfeld * ISP request queue context 1251*4c3888b8SHans Rosenfeld */ 1252*4c3888b8SHans Rosenfeld typedef struct ql_request_q { 1253*4c3888b8SHans Rosenfeld struct cmd_entry *req_ring_ptr; 1254*4c3888b8SHans Rosenfeld dma_mem_t req_ring; 1255*4c3888b8SHans Rosenfeld uint32_t *req_out_shadow_ptr; 1256*4c3888b8SHans Rosenfeld uint32_t req_out_shadow_ofst; 1257*4c3888b8SHans Rosenfeld uint32_t mbar_req_in; 1258*4c3888b8SHans Rosenfeld uint32_t mbar_req_out; 1259*4c3888b8SHans Rosenfeld uint16_t req_ring_index; 1260*4c3888b8SHans Rosenfeld uint16_t req_entry_cnt; 1261*4c3888b8SHans Rosenfeld uint16_t req_q_cnt; /* # of available entries. */ 1262*4c3888b8SHans Rosenfeld uint16_t req_q_number; 1263*4c3888b8SHans Rosenfeld } ql_request_q_t; 1264*4c3888b8SHans Rosenfeld 1265*4c3888b8SHans Rosenfeld /* 1266*4c3888b8SHans Rosenfeld * ISP response queue context 1267*4c3888b8SHans Rosenfeld */ 1268*4c3888b8SHans Rosenfeld typedef struct ql_response_q { 1269*4c3888b8SHans Rosenfeld struct ql_srb *status_srb; 1270*4c3888b8SHans Rosenfeld struct sts_entry *rsp_ring_ptr; 1271*4c3888b8SHans Rosenfeld dma_mem_t rsp_ring; 1272*4c3888b8SHans Rosenfeld kmutex_t intr_mutex; 1273*4c3888b8SHans Rosenfeld uint32_t *rsp_in_shadow_ptr; 1274*4c3888b8SHans Rosenfeld uint32_t rsp_in_shadow_ofst; 1275*4c3888b8SHans Rosenfeld uint32_t mbar_rsp_in; 1276*4c3888b8SHans Rosenfeld uint32_t mbar_rsp_out; 1277*4c3888b8SHans Rosenfeld uint16_t rsp_ring_index; 1278*4c3888b8SHans Rosenfeld uint16_t rsp_entry_cnt; 1279*4c3888b8SHans Rosenfeld uint16_t isp_rsp_index; 1280*4c3888b8SHans Rosenfeld uint16_t rsp_q_number; 1281*4c3888b8SHans Rosenfeld uint16_t msi_x_vector; 1282*4c3888b8SHans Rosenfeld } ql_response_q_t; 1283*4c3888b8SHans Rosenfeld 1284fcf3ce44SJohn Forte /* 1285fcf3ce44SJohn Forte * This is the per-command structure 1286fcf3ce44SJohn Forte */ 1287fcf3ce44SJohn Forte typedef struct ql_srb { 1288fcf3ce44SJohn Forte /* Command link. */ 1289fcf3ce44SJohn Forte ql_link_t cmd; 1290fcf3ce44SJohn Forte 1291fcf3ce44SJohn Forte /* Watchdog link and timer. */ 1292fcf3ce44SJohn Forte ql_link_t wdg; 1293fcf3ce44SJohn Forte time_t wdg_q_time; 1294fcf3ce44SJohn Forte time_t init_wdg_q_time; 1295fcf3ce44SJohn Forte uint16_t isp_timeout; 1296fcf3ce44SJohn Forte 1297fcf3ce44SJohn Forte /* FCA and FC Transport data. */ 1298fcf3ce44SJohn Forte fc_packet_t *pkt; 1299fcf3ce44SJohn Forte struct ql_adapter_state *ha; 1300fcf3ce44SJohn Forte uint32_t magic_number; 1301fcf3ce44SJohn Forte 1302fcf3ce44SJohn Forte /* unsolicited buffer context. */ 1303fcf3ce44SJohn Forte dma_mem_t ub_buffer; 1304fcf3ce44SJohn Forte uint32_t ub_type; 1305fcf3ce44SJohn Forte uint32_t ub_size; 1306fcf3ce44SJohn Forte 1307fcf3ce44SJohn Forte /* FCP command. */ 1308fcf3ce44SJohn Forte fcp_cmd_t *fcp; 1309fcf3ce44SJohn Forte 1310fcf3ce44SJohn Forte /* Request sense. */ 1311fcf3ce44SJohn Forte uint32_t request_sense_length; 1312fcf3ce44SJohn Forte caddr_t request_sense_ptr; 1313fcf3ce44SJohn Forte 1314fcf3ce44SJohn Forte /* Device queue pointer. */ 1315fcf3ce44SJohn Forte struct ql_lun *lun_queue; 1316fcf3ce44SJohn Forte 1317fcf3ce44SJohn Forte /* Command state/status flags. */ 1318fcf3ce44SJohn Forte volatile uint32_t flags; 1319fcf3ce44SJohn Forte 1320fcf3ce44SJohn Forte /* Command IOCB context. */ 1321fcf3ce44SJohn Forte void (*iocb)(struct ql_adapter_state *, 1322*4c3888b8SHans Rosenfeld ql_request_q_t *, struct ql_srb *, void *); 1323f885d00fSDaniel Beauregard struct cmd_entry *request_ring_ptr; 1324fcf3ce44SJohn Forte uint32_t handle; 1325*4c3888b8SHans Rosenfeld uint16_t req_q_number; 1326fcf3ce44SJohn Forte uint16_t req_cnt; 1327fcf3ce44SJohn Forte uint8_t retry_count; 1328*4c3888b8SHans Rosenfeld uint8_t rsp_q_number; 1329f885d00fSDaniel Beauregard dma_mem_t sg_dma; 1330fcf3ce44SJohn Forte } ql_srb_t; 1331fcf3ce44SJohn Forte 1332*4c3888b8SHans Rosenfeld #define SRB_ISP_STARTED BIT_0 /* Command sent to ISP. */ 1333*4c3888b8SHans Rosenfeld #define SRB_ISP_COMPLETED BIT_1 /* ISP finished with command. */ 1334*4c3888b8SHans Rosenfeld #define SRB_RETRY BIT_2 /* Driver retrying command. */ 1335*4c3888b8SHans Rosenfeld #define SRB_POLL BIT_3 /* Poll for completion. */ 1336*4c3888b8SHans Rosenfeld 1337*4c3888b8SHans Rosenfeld #define SRB_WATCHDOG_ENABLED BIT_4 /* Command on watchdog list. */ 1338*4c3888b8SHans Rosenfeld #define SRB_ELS_PKT BIT_5 /* Extended Link Services pkt */ 1339*4c3888b8SHans Rosenfeld #define SRB_UB_IN_FCA BIT_6 /* FCA holds unsolicited buffer */ 1340*4c3888b8SHans Rosenfeld #define SRB_UB_IN_ISP BIT_7 /* ISP holds unsolicited buffer */ 1341*4c3888b8SHans Rosenfeld 1342*4c3888b8SHans Rosenfeld #define SRB_UB_CALLBACK BIT_8 /* Unsolicited callback needed. */ 1343*4c3888b8SHans Rosenfeld #define SRB_UB_RSCN BIT_9 /* Unsolicited RSCN callback. */ 1344*4c3888b8SHans Rosenfeld #define SRB_UB_FCP BIT_10 /* Unsolicited RSCN callback. */ 1345*4c3888b8SHans Rosenfeld #define SRB_FCP_CMD_PKT BIT_11 /* FCP command type packet. */ 1346*4c3888b8SHans Rosenfeld 1347*4c3888b8SHans Rosenfeld #define SRB_FCP_DATA_PKT BIT_12 /* FCP data type packet. */ 1348*4c3888b8SHans Rosenfeld #define SRB_FCP_RSP_PKT BIT_13 /* FCP response type packet. */ 1349*4c3888b8SHans Rosenfeld #define SRB_IP_PKT BIT_14 /* IP type packet. */ 1350*4c3888b8SHans Rosenfeld #define SRB_GENERIC_SERVICES_PKT BIT_15 /* Generic services type packet */ 1351*4c3888b8SHans Rosenfeld 1352*4c3888b8SHans Rosenfeld #define SRB_COMMAND_TIMEOUT BIT_16 /* Command timed out. */ 1353*4c3888b8SHans Rosenfeld #define SRB_ABORTING BIT_17 /* SRB aborting. */ 1354*4c3888b8SHans Rosenfeld #define SRB_IN_DEVICE_QUEUE BIT_18 /* In Device Queue */ 1355*4c3888b8SHans Rosenfeld #define SRB_IN_TOKEN_ARRAY BIT_19 /* In Token Array */ 1356*4c3888b8SHans Rosenfeld 1357*4c3888b8SHans Rosenfeld #define SRB_UB_FREE_REQUESTED BIT_20 /* UB Free requested */ 1358*4c3888b8SHans Rosenfeld #define SRB_UB_ACQUIRED BIT_21 /* UB selected for upcall */ 1359*4c3888b8SHans Rosenfeld #define SRB_MS_PKT BIT_22 /* Management Service pkt */ 1360fcf3ce44SJohn Forte 1361fcf3ce44SJohn Forte /* 1362fcf3ce44SJohn Forte * This byte will be used to define flags for the LUN on the target. 1363fcf3ce44SJohn Forte * Presently, we have untagged-command as one flag. Others can be 1364fcf3ce44SJohn Forte * added later, if needed. 1365fcf3ce44SJohn Forte */ 1366fcf3ce44SJohn Forte typedef struct tgt_lun_flags { 1367fcf3ce44SJohn Forte uint8_t 1368fcf3ce44SJohn Forte untagged_pending:1, 1369fcf3ce44SJohn Forte unused_bits:7; 1370fcf3ce44SJohn Forte } tgt_lun_flags_t; 1371fcf3ce44SJohn Forte 1372fcf3ce44SJohn Forte #define QL_IS_UNTAGGED_PENDING(q, lun_num) \ 1373fcf3ce44SJohn Forte ((q->lun_flags[lun_num].untagged_pending == TRUE) ? 1 : 0) 1374fcf3ce44SJohn Forte #define QL_SET_UNTAGGED_PENDING(q, lun_num) \ 1375fcf3ce44SJohn Forte (q->lun_flags[lun_num].untagged_pending = TRUE) 1376fcf3ce44SJohn Forte #define QL_CLEAR_UNTAGGED_PENDING(q, lun_num) \ 1377fcf3ce44SJohn Forte (q->lun_flags[lun_num].untagged_pending = FALSE) 1378fcf3ce44SJohn Forte 1379fcf3ce44SJohn Forte /* 1380fcf3ce44SJohn Forte * Fibre Channel LUN Queue structure 1381fcf3ce44SJohn Forte */ 1382fcf3ce44SJohn Forte typedef struct ql_lun { 1383fcf3ce44SJohn Forte /* Head command link. */ 1384fcf3ce44SJohn Forte ql_head_t cmd; 1385fcf3ce44SJohn Forte 1386fcf3ce44SJohn Forte struct ql_target *target_queue; 1387fcf3ce44SJohn Forte 1388fcf3ce44SJohn Forte uint32_t flags; 1389fcf3ce44SJohn Forte 1390fcf3ce44SJohn Forte /* LUN execution throttle. */ 1391fcf3ce44SJohn Forte uint16_t lun_outcnt; 1392fcf3ce44SJohn Forte 1393*4c3888b8SHans Rosenfeld /* LUN number as reported by REPORT LUNS */ 1394fcf3ce44SJohn Forte uint16_t lun_no; 1395fcf3ce44SJohn Forte 1396*4c3888b8SHans Rosenfeld /* 1397*4c3888b8SHans Rosenfeld * Logical unit number in SCSI3 format, also 1398*4c3888b8SHans Rosenfeld * referred to as FCP lun or FCP entity address. 1399*4c3888b8SHans Rosenfeld */ 1400*4c3888b8SHans Rosenfeld uint64_t lun_addr; 1401*4c3888b8SHans Rosenfeld 1402fcf3ce44SJohn Forte ql_link_t link; 1403fcf3ce44SJohn Forte } ql_lun_t; 1404fcf3ce44SJohn Forte 1405fcf3ce44SJohn Forte /* 1406fcf3ce44SJohn Forte * LUN Queue flags 1407fcf3ce44SJohn Forte */ 1408fcf3ce44SJohn Forte #define LQF_UNTAGGED_PENDING BIT_0 1409fcf3ce44SJohn Forte 1410*4c3888b8SHans Rosenfeld /* 1411*4c3888b8SHans Rosenfeld * SCSI standard defined lun addressing methods. 1412*4c3888b8SHans Rosenfeld */ 1413*4c3888b8SHans Rosenfeld #define QL_LUN_AM_MASK 0xC0 /* Address Method Mask */ 1414*4c3888b8SHans Rosenfeld #define QL_LUN_AM_PDEV 0x00 /* Peripheral device AM */ 1415*4c3888b8SHans Rosenfeld #define QL_LUN_AM_FLAT 0x40 /* Flat space AM */ 1416*4c3888b8SHans Rosenfeld #define QL_LUN_AM_LUN 0x80 /* Logical unit AM */ 1417*4c3888b8SHans Rosenfeld #define QL_LUN_AM_EFLAT 0xC0 /* Extended flat space AM */ 1418*4c3888b8SHans Rosenfeld #define QL_LUN_AM_ELUN 0xC0 /* Extended logical unit AM */ 1419*4c3888b8SHans Rosenfeld 1420fcf3ce44SJohn Forte /* 1421fcf3ce44SJohn Forte * Fibre Channel Device Queue structure 1422fcf3ce44SJohn Forte */ 1423fcf3ce44SJohn Forte typedef struct ql_target { 1424fcf3ce44SJohn Forte /* Device queue lock. */ 1425fcf3ce44SJohn Forte kmutex_t mutex; 1426fcf3ce44SJohn Forte 1427fcf3ce44SJohn Forte volatile uint32_t flags; 1428fcf3ce44SJohn Forte port_id_t d_id; 1429fcf3ce44SJohn Forte uint16_t loop_id; 1430fcf3ce44SJohn Forte volatile uint16_t outcnt; /* # of cmds running in ISP */ 1431fcf3ce44SJohn Forte uint32_t iidma_rate; 1432fcf3ce44SJohn Forte 1433fcf3ce44SJohn Forte /* Device link. */ 1434fcf3ce44SJohn Forte ql_link_t device; 1435fcf3ce44SJohn Forte 1436fcf3ce44SJohn Forte /* Head watchdog link. */ 1437fcf3ce44SJohn Forte ql_head_t wdg; 1438fcf3ce44SJohn Forte 1439fcf3ce44SJohn Forte /* Unsolicited buffer IP data. */ 1440fcf3ce44SJohn Forte uint32_t ub_frame_ro; 1441fcf3ce44SJohn Forte uint16_t ub_sequence_length; 1442fcf3ce44SJohn Forte uint16_t ub_loop_id; 1443fcf3ce44SJohn Forte uint8_t ub_total_seg_cnt; 1444fcf3ce44SJohn Forte uint8_t ub_seq_cnt; 1445fcf3ce44SJohn Forte uint8_t ub_seq_id; 1446fcf3ce44SJohn Forte 1447fcf3ce44SJohn Forte /* Port down retry counter. */ 1448fcf3ce44SJohn Forte uint16_t port_down_retry_count; 1449fcf3ce44SJohn Forte uint16_t qfull_retry_count; 1450fcf3ce44SJohn Forte 1451fcf3ce44SJohn Forte /* logout sent state */ 1452fcf3ce44SJohn Forte uint8_t logout_sent; 1453fcf3ce44SJohn Forte 1454fcf3ce44SJohn Forte /* Data from Port database matches machine type. */ 1455fcf3ce44SJohn Forte uint8_t master_state; 1456fcf3ce44SJohn Forte uint8_t slave_state; 1457fcf3ce44SJohn Forte port_id_t hard_addr; 1458fcf3ce44SJohn Forte uint8_t port_name[8]; 1459fcf3ce44SJohn Forte uint8_t node_name[8]; 1460fcf3ce44SJohn Forte uint16_t cmn_features; 1461fcf3ce44SJohn Forte uint16_t conc_sequences; 1462fcf3ce44SJohn Forte uint16_t relative_offset; 1463fcf3ce44SJohn Forte uint16_t class3_recipient_ctl; 1464fcf3ce44SJohn Forte uint16_t class3_rcv_data_size; 1465fcf3ce44SJohn Forte uint16_t class3_conc_sequences; 1466fcf3ce44SJohn Forte uint16_t class3_open_sequences_per_exch; 1467fcf3ce44SJohn Forte uint16_t prli_payload_length; 1468fcf3ce44SJohn Forte uint16_t prli_svc_param_word_0; 1469fcf3ce44SJohn Forte uint16_t prli_svc_param_word_3; 1470fcf3ce44SJohn Forte 1471fcf3ce44SJohn Forte /* LUN context. */ 1472fcf3ce44SJohn Forte ql_head_t lun_queues; 1473fcf3ce44SJohn Forte ql_lun_t *last_lun_queue; 1474fcf3ce44SJohn Forte } ql_tgt_t; 1475fcf3ce44SJohn Forte 1476fcf3ce44SJohn Forte /* 1477fcf3ce44SJohn Forte * Target Queue flags 1478fcf3ce44SJohn Forte */ 1479fcf3ce44SJohn Forte #define TQF_TAPE_DEVICE BIT_0 1480fcf3ce44SJohn Forte #define TQF_QUEUE_SUSPENDED BIT_1 /* Queue suspended. */ 1481fcf3ce44SJohn Forte #define TQF_FABRIC_DEVICE BIT_2 1482fcf3ce44SJohn Forte #define TQF_INITIATOR_DEVICE BIT_3 1483fcf3ce44SJohn Forte #define TQF_RSCN_RCVD BIT_4 1484fcf3ce44SJohn Forte #define TQF_NEED_AUTHENTICATION BIT_5 1485fcf3ce44SJohn Forte #define TQF_PLOGI_PROGRS BIT_6 1486fcf3ce44SJohn Forte #define TQF_IIDMA_NEEDED BIT_7 1487*4c3888b8SHans Rosenfeld #define TQF_LOGIN_NEEDED BIT_8 1488*4c3888b8SHans Rosenfeld 14895dfd244aSDaniel Beauregard /* 14905dfd244aSDaniel Beauregard * Tempoary N_Port information 14915dfd244aSDaniel Beauregard */ 14925dfd244aSDaniel Beauregard typedef struct ql_n_port_info { 14935dfd244aSDaniel Beauregard uint16_t n_port_handle; 14945dfd244aSDaniel Beauregard uint8_t port_name[8]; /* Big endian. */ 14955dfd244aSDaniel Beauregard uint8_t node_name[8]; /* Big endian. */ 1496*4c3888b8SHans Rosenfeld port_id_t d_id; 14975dfd244aSDaniel Beauregard } ql_n_port_info_t; 1498fcf3ce44SJohn Forte 1499fcf3ce44SJohn Forte /* 1500fcf3ce44SJohn Forte * iiDMA 1501fcf3ce44SJohn Forte */ 1502fcf3ce44SJohn Forte #define IIDMA_RATE_INIT 0xffffffff /* init state */ 1503fcf3ce44SJohn Forte #define IIDMA_RATE_NDEF 0xfffffffe /* not defined in conf file */ 1504fcf3ce44SJohn Forte #define IIDMA_RATE_1GB 0x0 1505fcf3ce44SJohn Forte #define IIDMA_RATE_2GB 0x1 1506*4c3888b8SHans Rosenfeld #define IIDMA_RATE_AUTO 0x2 1507fcf3ce44SJohn Forte #define IIDMA_RATE_4GB 0x3 1508fcf3ce44SJohn Forte #define IIDMA_RATE_8GB 0x4 1509*4c3888b8SHans Rosenfeld #define IIDMA_RATE_16GB 0x5 1510*4c3888b8SHans Rosenfeld #define IIDMA_RATE_32GB 0x6 15115dfd244aSDaniel Beauregard #define IIDMA_RATE_10GB 0x13 15125dfd244aSDaniel Beauregard #define IIDMA_RATE_MAX IIDMA_RATE_10GB 1513fcf3ce44SJohn Forte 1514fcf3ce44SJohn Forte /* 1515fcf3ce44SJohn Forte * Kernel statistic structure definitions. 1516fcf3ce44SJohn Forte */ 1517fcf3ce44SJohn Forte typedef struct ql_device_stat { 1518fcf3ce44SJohn Forte int logouts_recvd; 1519fcf3ce44SJohn Forte int task_mgmt_failures; 1520fcf3ce44SJohn Forte int data_ro_mismatches; 1521fcf3ce44SJohn Forte int dl_len_mismatches; 1522fcf3ce44SJohn Forte } ql_device_stat_t; 1523fcf3ce44SJohn Forte 1524fcf3ce44SJohn Forte typedef struct ql_adapter_24xx_stat { 1525fcf3ce44SJohn Forte int version; /* version of this struct */ 1526fcf3ce44SJohn Forte int lip_count; /* lips forced */ 1527fcf3ce44SJohn Forte int ncmds; /* outstanding commands */ 1528fcf3ce44SJohn Forte ql_adapter_revlvl_t revlvl; /* adapter revision levels */ 1529fcf3ce44SJohn Forte ql_device_stat_t d_stats[MAX_24_FIBRE_DEVICES]; /* per device stats */ 1530fcf3ce44SJohn Forte } ql_adapter_stat_t; 1531fcf3ce44SJohn Forte 1532fcf3ce44SJohn Forte /* 1533fcf3ce44SJohn Forte * Firmware code segment. 1534fcf3ce44SJohn Forte */ 1535fcf3ce44SJohn Forte #define MAX_RISC_CODE_SEGMENTS 3 1536fcf3ce44SJohn Forte typedef struct fw_code { 1537fcf3ce44SJohn Forte caddr_t code; 1538fcf3ce44SJohn Forte uint32_t addr; 1539fcf3ce44SJohn Forte uint32_t length; 1540fcf3ce44SJohn Forte } ql_fw_code_t; 1541fcf3ce44SJohn Forte 1542fcf3ce44SJohn Forte /* diagnostic els ECHO defines */ 1543fcf3ce44SJohn Forte #define QL_ECHO_CMD 0x10000000 /* echo opcode */ 1544fcf3ce44SJohn Forte #define QL_ECHO_CMD_LENGTH 220 /* command length */ 1545fcf3ce44SJohn Forte 1546fcf3ce44SJohn Forte /* DUMP state flags. */ 1547fcf3ce44SJohn Forte #define QL_DUMPING BIT_0 1548fcf3ce44SJohn Forte #define QL_DUMP_VALID BIT_1 1549fcf3ce44SJohn Forte #define QL_DUMP_UPLOADED BIT_2 1550fcf3ce44SJohn Forte 1551*4c3888b8SHans Rosenfeld #define QL_LOG_ENTRIES 256 /* max # of EL entries */ 1552*4c3888b8SHans Rosenfeld #define QL_LOG_LENGTH 128 /* max # of bytes in each EL entry */ 1553*4c3888b8SHans Rosenfeld 1554*4c3888b8SHans Rosenfeld typedef struct ql_trace_entry { 1555*4c3888b8SHans Rosenfeld timespec_t hs_time; /* high resolution timestamp */ 1556*4c3888b8SHans Rosenfeld char buf[QL_LOG_LENGTH]; 1557*4c3888b8SHans Rosenfeld } ql_trace_entry_t; 1558*4c3888b8SHans Rosenfeld 1559*4c3888b8SHans Rosenfeld /* per instance based extended logging trace descriptor */ 156016dd44c2SDaniel Beauregard typedef struct el_trace_desc { 156116dd44c2SDaniel Beauregard kmutex_t mutex; 1562*4c3888b8SHans Rosenfeld uint32_t nentries; /* max number of entries */ 1563*4c3888b8SHans Rosenfeld uint16_t nindex; /* next index to fill */ 1564*4c3888b8SHans Rosenfeld uint32_t start; /* starting point */ 1565*4c3888b8SHans Rosenfeld uint32_t end; /* ending point */ 1566*4c3888b8SHans Rosenfeld uint32_t csize; /* current filled queue size */ 1567*4c3888b8SHans Rosenfeld uint32_t count; /* sequence number */ 1568*4c3888b8SHans Rosenfeld size_t trace_buffer_size; 1569*4c3888b8SHans Rosenfeld ql_trace_entry_t *trace_buffer; 1570*4c3888b8SHans Rosenfeld } ql_trace_desc_t; 157116dd44c2SDaniel Beauregard 1572c1fad183SDaniel Beauregard /* 1573c1fad183SDaniel Beauregard * NVRAM cache descriptor. 1574c1fad183SDaniel Beauregard */ 1575c1fad183SDaniel Beauregard typedef struct nvram_cache_desc { 1576c1fad183SDaniel Beauregard uint32_t valid; 1577c1fad183SDaniel Beauregard uint32_t size; 1578c1fad183SDaniel Beauregard void *cache; 1579c1fad183SDaniel Beauregard } nvram_cache_desc_t; 1580c1fad183SDaniel Beauregard 1581*4c3888b8SHans Rosenfeld /* 1582*4c3888b8SHans Rosenfeld * Plogi retry parameters 1583*4c3888b8SHans Rosenfeld */ 1584*4c3888b8SHans Rosenfeld typedef struct plogi_params_desc { 1585*4c3888b8SHans Rosenfeld uint32_t retry_cnt; 1586*4c3888b8SHans Rosenfeld uint32_t retry_dly_usec; 1587*4c3888b8SHans Rosenfeld } plogi_params_desc_t; 1588*4c3888b8SHans Rosenfeld 1589fcf3ce44SJohn Forte /* 1590fcf3ce44SJohn Forte * ql attach progress indication 1591fcf3ce44SJohn Forte */ 1592fcf3ce44SJohn Forte #define QL_SOFT_STATE_ALLOCED BIT_0 1593fcf3ce44SJohn Forte #define QL_REGS_MAPPED BIT_1 1594fcf3ce44SJohn Forte #define QL_HBA_BUFFER_SETUP BIT_2 1595fcf3ce44SJohn Forte #define QL_MUTEX_CV_INITED BIT_3 1596fcf3ce44SJohn Forte #define QL_INTR_ADDED BIT_4 1597fcf3ce44SJohn Forte #define QL_CONFIG_SPACE_SETUP BIT_5 1598fcf3ce44SJohn Forte #define QL_TASK_DAEMON_STARTED BIT_6 1599fcf3ce44SJohn Forte #define QL_KSTAT_CREATED BIT_7 1600fcf3ce44SJohn Forte #define QL_MINOR_NODE_CREATED BIT_8 1601fcf3ce44SJohn Forte #define QL_FCA_TRAN_ALLOCED BIT_9 1602fcf3ce44SJohn Forte #define QL_FCA_ATTACH_DONE BIT_10 1603fcf3ce44SJohn Forte #define QL_IOMAP_IOBASE_MAPPED BIT_11 16045dfd244aSDaniel Beauregard #define QL_N_PORT_INFO_CREATED BIT_12 1605eb82ff87SDaniel Beauregard #define QL_DB_IOBASE_MAPPED BIT_13 1606*4c3888b8SHans Rosenfeld #define QL_FCA_INIT_FM BIT_14 1607*4c3888b8SHans Rosenfeld #define QL_NVRAM_CACHE_CREATED BIT_15 1608*4c3888b8SHans Rosenfeld #define QL_PLOGI_PARAMS_CREATED BIT_16 1609*4c3888b8SHans Rosenfeld 1610fcf3ce44SJohn Forte /* Device queue head list size (based on AL_PA address). */ 1611fcf3ce44SJohn Forte #define DEVICE_HEAD_LIST_SIZE 0x81 1612fcf3ce44SJohn Forte 1613eb82ff87SDaniel Beauregard struct legacy_intr_set { 1614eb82ff87SDaniel Beauregard uint32_t int_vec_bit; 1615eb82ff87SDaniel Beauregard uint32_t tgt_status_reg; 1616eb82ff87SDaniel Beauregard uint32_t tgt_mask_reg; 1617eb82ff87SDaniel Beauregard uint32_t pci_int_reg; 1618eb82ff87SDaniel Beauregard }; 1619eb82ff87SDaniel Beauregard 1620*4c3888b8SHans Rosenfeld /* Returned Mailbox registers. */ 1621*4c3888b8SHans Rosenfeld typedef struct ql_mbx_data { 1622*4c3888b8SHans Rosenfeld uint16_t mb[MAX_MBOX_COUNT]; 1623*4c3888b8SHans Rosenfeld } ql_mbx_data_t; 1624*4c3888b8SHans Rosenfeld 1625*4c3888b8SHans Rosenfeld typedef struct ql_ledstate { 1626*4c3888b8SHans Rosenfeld uint32_t BeaconState; 1627*4c3888b8SHans Rosenfeld uint32_t LEDflags; 1628*4c3888b8SHans Rosenfeld uint32_t flags; 1629*4c3888b8SHans Rosenfeld uint32_t led_blink_on; 1630*4c3888b8SHans Rosenfeld uint32_t select; 1631*4c3888b8SHans Rosenfeld ql_mbx_data_t cfg; 1632*4c3888b8SHans Rosenfeld } ql_ledstate_t; 1633*4c3888b8SHans Rosenfeld 1634fcf3ce44SJohn Forte /* 1635fcf3ce44SJohn Forte * Adapter state structure. 1636fcf3ce44SJohn Forte */ 1637fcf3ce44SJohn Forte typedef struct ql_adapter_state { 1638fcf3ce44SJohn Forte ql_link_t hba; 1639fcf3ce44SJohn Forte 1640fcf3ce44SJohn Forte kmutex_t mutex; 1641*4c3888b8SHans Rosenfeld volatile uint64_t flags; /* State flags. */ 1642fcf3ce44SJohn Forte uint32_t state; 1643fcf3ce44SJohn Forte port_id_t d_id; 1644fcf3ce44SJohn Forte uint16_t loop_id; 1645fcf3ce44SJohn Forte uint16_t sfp_stat; 1646fcf3ce44SJohn Forte uint16_t idle_timer; 1647*4c3888b8SHans Rosenfeld uint16_t r_a_tov; /* 2 * R_A_TOV + 5 */ 1648*4c3888b8SHans Rosenfeld uint8_t topology; 1649*4c3888b8SHans Rosenfeld uint8_t bbcr_runtime; 1650*4c3888b8SHans Rosenfeld uint8_t bbcr_initial; 1651fcf3ce44SJohn Forte uint8_t loop_down_abort_time; 1652fcf3ce44SJohn Forte uint8_t port_retry_timer; 1653fcf3ce44SJohn Forte uint8_t loop_down_timer; 1654fcf3ce44SJohn Forte uint8_t watchdog_timer; 1655fcf3ce44SJohn Forte 1656fcf3ce44SJohn Forte /* Task Daemon context. */ 1657*4c3888b8SHans Rosenfeld ql_head_t unsol_callback_queue; 1658*4c3888b8SHans Rosenfeld ddi_taskq_t *driver_thread_taskq; 1659fcf3ce44SJohn Forte kmutex_t task_daemon_mutex; 1660fcf3ce44SJohn Forte kcondvar_t cv_task_daemon; 1661*4c3888b8SHans Rosenfeld kcondvar_t cv_dr_suspended; 1662*4c3888b8SHans Rosenfeld volatile uint64_t task_daemon_flags; 1663*4c3888b8SHans Rosenfeld uint32_t driver_thread_awake; 1664*4c3888b8SHans Rosenfeld uint64_t df; 1665*4c3888b8SHans Rosenfeld uint64_t sf; 1666*4c3888b8SHans Rosenfeld uint64_t cf; 1667*4c3888b8SHans Rosenfeld 1668*4c3888b8SHans Rosenfeld /* Completion thread context */ 1669*4c3888b8SHans Rosenfeld ddi_taskq_t *completion_taskq; 1670*4c3888b8SHans Rosenfeld ql_head_t comp_q; 1671*4c3888b8SHans Rosenfeld kmutex_t comp_q_mutex; 1672*4c3888b8SHans Rosenfeld kcondvar_t cv_comp_thread; 1673*4c3888b8SHans Rosenfeld uint8_t comp_thds_active; 1674*4c3888b8SHans Rosenfeld uint8_t comp_thds_awake; 1675*4c3888b8SHans Rosenfeld uint8_t completion_thds; 1676fcf3ce44SJohn Forte 1677fcf3ce44SJohn Forte /* Interrupt context. */ 1678*4c3888b8SHans Rosenfeld ddi_iblock_cookie_t iblock_cookie; 1679*4c3888b8SHans Rosenfeld ddi_intr_handle_t *htable; 1680*4c3888b8SHans Rosenfeld uint32_t hsize; 1681*4c3888b8SHans Rosenfeld int32_t intr_cnt; 1682*4c3888b8SHans Rosenfeld void *intr_pri; 1683*4c3888b8SHans Rosenfeld int32_t intr_cap; 1684*4c3888b8SHans Rosenfeld uint32_t iflags; 1685fcf3ce44SJohn Forte volatile uint8_t intr_claimed; 1686*4c3888b8SHans Rosenfeld uint8_t mq_msix_vectors; 1687*4c3888b8SHans Rosenfeld uint8_t interrupt_count; 1688fcf3ce44SJohn Forte 1689*4c3888b8SHans Rosenfeld /* Outstanding ISP commands. */ 1690fcf3ce44SJohn Forte ql_head_t pending_cmds; 1691fcf3ce44SJohn Forte ql_srb_t **outstanding_cmds; 1692fcf3ce44SJohn Forte uint16_t osc_index; 1693*4c3888b8SHans Rosenfeld uint16_t osc_max_cnt; 1694*4c3888b8SHans Rosenfeld 1695*4c3888b8SHans Rosenfeld /* ISP request queue context. */ 1696*4c3888b8SHans Rosenfeld kmutex_t req_ring_mutex; 1697*4c3888b8SHans Rosenfeld ql_request_q_t *req_q[2]; 1698fcf3ce44SJohn Forte 1699fcf3ce44SJohn Forte /* ISP response queue context. */ 1700*4c3888b8SHans Rosenfeld ql_response_q_t **rsp_queues; 1701*4c3888b8SHans Rosenfeld uint32_t rsp_queues_size; 1702*4c3888b8SHans Rosenfeld uint8_t rsp_queues_cnt; 1703*4c3888b8SHans Rosenfeld uint8_t rsp_q_number; 1704*4c3888b8SHans Rosenfeld uint8_t io_min_rsp_q_number; 1705*4c3888b8SHans Rosenfeld 1706*4c3888b8SHans Rosenfeld /* IP receive buffer queue context. */ 1707*4c3888b8SHans Rosenfeld ql_tgt_t *rcv_dev_q; 1708*4c3888b8SHans Rosenfeld dma_mem_t rcv_ring; 1709*4c3888b8SHans Rosenfeld struct rcvbuf *rcvbuf_ring_ptr; 1710*4c3888b8SHans Rosenfeld uint16_t rcvbuf_ring_index; 1711fcf3ce44SJohn Forte 1712fcf3ce44SJohn Forte /* Mailbox context. */ 1713fcf3ce44SJohn Forte kmutex_t mbx_mutex; 1714fcf3ce44SJohn Forte struct mbx_cmd *mcp; 1715fcf3ce44SJohn Forte kcondvar_t cv_mbx_wait; 1716fcf3ce44SJohn Forte kcondvar_t cv_mbx_intr; 1717fcf3ce44SJohn Forte volatile uint8_t mailbox_flags; 1718fcf3ce44SJohn Forte 1719fcf3ce44SJohn Forte /* Unsolicited buffer data. */ 1720fcf3ce44SJohn Forte uint16_t ub_outcnt; 1721fcf3ce44SJohn Forte uint8_t ub_seq_id; 1722fcf3ce44SJohn Forte uint8_t ub_command_count; 1723fcf3ce44SJohn Forte uint8_t ub_notify_count; 1724fcf3ce44SJohn Forte uint32_t ub_allocated; 1725fcf3ce44SJohn Forte kmutex_t ub_mutex; 1726fcf3ce44SJohn Forte kcondvar_t cv_ub; 1727fcf3ce44SJohn Forte fc_unsol_buf_t **ub_array; 1728fcf3ce44SJohn Forte 1729fcf3ce44SJohn Forte /* Head of device queue list. */ 1730fcf3ce44SJohn Forte ql_head_t *dev; 1731fcf3ce44SJohn Forte 1732fcf3ce44SJohn Forte /* Kernel statistics. */ 1733fcf3ce44SJohn Forte kstat_t *k_stats; 1734fcf3ce44SJohn Forte ql_adapter_stat_t *adapter_stats; 1735fcf3ce44SJohn Forte 1736*4c3888b8SHans Rosenfeld /* PCI context */ 1737fcf3ce44SJohn Forte ddi_acc_handle_t pci_handle; /* config space */ 1738*4c3888b8SHans Rosenfeld ddi_acc_handle_t dev_handle; 1739*4c3888b8SHans Rosenfeld caddr_t iobase; 1740fcf3ce44SJohn Forte ddi_acc_handle_t iomap_dev_handle; 1741fcf3ce44SJohn Forte caddr_t iomap_iobase; 1742*4c3888b8SHans Rosenfeld ddi_acc_handle_t mbar_dev_handle; 1743*4c3888b8SHans Rosenfeld caddr_t mbar; 1744*4c3888b8SHans Rosenfeld uint32_t mbar_size; 1745*4c3888b8SHans Rosenfeld uint32_t mbar_queue_offset; 1746*4c3888b8SHans Rosenfeld uint16_t device_id; 1747*4c3888b8SHans Rosenfeld uint16_t subsys_id; 1748*4c3888b8SHans Rosenfeld uint16_t subven_id; 1749*4c3888b8SHans Rosenfeld uint16_t ven_id; 1750*4c3888b8SHans Rosenfeld uint16_t pci_max_read_req; 1751*4c3888b8SHans Rosenfeld uint8_t rev_id; 1752*4c3888b8SHans Rosenfeld uint8_t pci_function_number; 1753*4c3888b8SHans Rosenfeld 1754*4c3888b8SHans Rosenfeld /* Solaris adapter configuration data */ 1755fcf3ce44SJohn Forte dev_info_t *dip; 1756fcf3ce44SJohn Forte fc_fca_tran_t *tran; 175716dd44c2SDaniel Beauregard uint32_t instance; 1758fcf3ce44SJohn Forte int8_t *devpath; 1759c92b35bbSToomas Soome uint32_t fru_hba_index; 1760c92b35bbSToomas Soome uint32_t fru_port_index; 1761fcf3ce44SJohn Forte uint8_t adapInfo[18]; 1762fcf3ce44SJohn Forte 1763fcf3ce44SJohn Forte /* Adapter context */ 1764fcf3ce44SJohn Forte la_els_logi_t loginparams; 1765fcf3ce44SJohn Forte fc_fca_bind_info_t bind_info; 1766fcf3ce44SJohn Forte ddi_modhandle_t fw_module; 1767eb82ff87SDaniel Beauregard uint32_t fw_major_version; 1768eb82ff87SDaniel Beauregard uint32_t fw_minor_version; 1769eb82ff87SDaniel Beauregard uint32_t fw_subminor_version; 1770*4c3888b8SHans Rosenfeld uint32_t fw_attributes; 1771*4c3888b8SHans Rosenfeld uint32_t fw_ext_attributes; 1772*4c3888b8SHans Rosenfeld uint32_t fw_ext_memory_end; 1773fcf3ce44SJohn Forte uint32_t fw_ext_memory_size; 1774*4c3888b8SHans Rosenfeld uint32_t fw_shared_ram_start; 1775*4c3888b8SHans Rosenfeld uint32_t fw_shared_ram_end; 1776*4c3888b8SHans Rosenfeld uint32_t fw_ddr_ram_start; 1777*4c3888b8SHans Rosenfeld uint32_t fw_ddr_ram_end; 1778fcf3ce44SJohn Forte uint32_t parity_pause_errors; 1779eb82ff87SDaniel Beauregard boolean_t log_parity_pause; 1780*4c3888b8SHans Rosenfeld uint32_t fw_class; 1781*4c3888b8SHans Rosenfeld uint16_t fw_state[7]; 1782*4c3888b8SHans Rosenfeld uint16_t rom_status; 1783*4c3888b8SHans Rosenfeld ql_ledstate_t ledstate; 1784fcf3ce44SJohn Forte uint16_t parity_hccr_err; 1785fcf3ce44SJohn Forte uint32_t parity_stat_err; 1786fcf3ce44SJohn Forte reg_off_t *reg_off; 1787fcf3ce44SJohn Forte caddr_t risc_code; 1788fcf3ce44SJohn Forte uint32_t risc_code_size; 1789fcf3ce44SJohn Forte ql_fw_code_t risc_fw[MAX_RISC_CODE_SEGMENTS]; 1790fcf3ce44SJohn Forte uint32_t risc_dump_size; 1791fcf3ce44SJohn Forte void (*fcp_cmd)(struct ql_adapter_state *, 1792*4c3888b8SHans Rosenfeld ql_request_q_t *, ql_srb_t *, void *); 1793fcf3ce44SJohn Forte void (*ip_cmd)(struct ql_adapter_state *, 1794*4c3888b8SHans Rosenfeld ql_request_q_t *, ql_srb_t *, void *); 1795fcf3ce44SJohn Forte void (*ms_cmd)(struct ql_adapter_state *, 1796*4c3888b8SHans Rosenfeld ql_request_q_t *, ql_srb_t *, void *); 1797*4c3888b8SHans Rosenfeld void (*els_cmd)(struct ql_adapter_state *, 1798*4c3888b8SHans Rosenfeld ql_request_q_t *, ql_srb_t *, void *); 1799fcf3ce44SJohn Forte uint8_t cmd_segs; 1800fcf3ce44SJohn Forte uint8_t cmd_cont_segs; 1801fcf3ce44SJohn Forte 1802fcf3ce44SJohn Forte /* NVRAM configuration data */ 1803*4c3888b8SHans Rosenfeld uint64_t cfg_flags; 1804fcf3ce44SJohn Forte ql_comb_init_cb_t init_ctrl_blk; 1805fcf3ce44SJohn Forte ql_comb_ip_init_cb_t ip_init_ctrl_blk; 1806fcf3ce44SJohn Forte uint32_t fw_transfer_size; 1807*4c3888b8SHans Rosenfeld uint16_t adapter_features; 1808fcf3ce44SJohn Forte uint16_t execution_throttle; 1809fcf3ce44SJohn Forte uint16_t port_down_retry_count; 1810*4c3888b8SHans Rosenfeld uint16_t serdes_param[4]; 1811*4c3888b8SHans Rosenfeld uint16_t maximum_luns_per_target; 1812fcf3ce44SJohn Forte uint8_t port_down_retry_delay; 1813fcf3ce44SJohn Forte uint8_t qfull_retry_count; 1814fcf3ce44SJohn Forte uint8_t qfull_retry_delay; 1815fcf3ce44SJohn Forte uint8_t loop_reset_delay; 1816fcf3ce44SJohn Forte 1817fcf3ce44SJohn Forte /* Power management context. */ 1818fcf3ce44SJohn Forte kmutex_t pm_mutex; 1819*4c3888b8SHans Rosenfeld uint32_t pm_busy; 1820fcf3ce44SJohn Forte uint8_t power_level; 1821fcf3ce44SJohn Forte uint8_t pm_capable; 1822fcf3ce44SJohn Forte uint8_t config_saved; 1823fcf3ce44SJohn Forte uint8_t lip_on_panic; 1824fcf3ce44SJohn Forte 1825fcf3ce44SJohn Forte /* sbus card data */ 1826fcf3ce44SJohn Forte caddr_t sbus_fpga_iobase; 1827fcf3ce44SJohn Forte ddi_acc_handle_t sbus_fpga_dev_handle; 1828fcf3ce44SJohn Forte ddi_acc_handle_t sbus_config_handle; 1829fcf3ce44SJohn Forte caddr_t sbus_config_base; 1830fcf3ce44SJohn Forte 1831fcf3ce44SJohn Forte /* XIOCTL context pointer. */ 1832fcf3ce44SJohn Forte struct ql_xioctl *xioctl; 1833fcf3ce44SJohn Forte 1834fcf3ce44SJohn Forte struct ql_fcache *fcache; 1835fcf3ce44SJohn Forte int8_t *vcache; 1836*4c3888b8SHans Rosenfeld nvram_cache_desc_t *nvram_cache; 1837fcf3ce44SJohn Forte 183816dd44c2SDaniel Beauregard /* f/w dump mutex */ 183916dd44c2SDaniel Beauregard uint32_t ql_dump_size; 184016dd44c2SDaniel Beauregard uint32_t ql_dump_state; 184116dd44c2SDaniel Beauregard void *ql_dump_ptr; 184216dd44c2SDaniel Beauregard kmutex_t dump_mutex; 184316dd44c2SDaniel Beauregard 1844fcf3ce44SJohn Forte uint8_t fwwait; 184516dd44c2SDaniel Beauregard 184616dd44c2SDaniel Beauregard dma_mem_t fwexttracebuf; /* extended trace */ 184716dd44c2SDaniel Beauregard dma_mem_t fwfcetracebuf; /* event trace */ 1848*4c3888b8SHans Rosenfeld ql_mbx_data_t fw_fce_trace_enable; 1849fcf3ce44SJohn Forte uint32_t fwfcetraceopt; 1850fcf3ce44SJohn Forte uint32_t flash_errlog_start; /* 32bit word addr */ 1851fcf3ce44SJohn Forte uint32_t flash_errlog_ptr; /* 32bit word addr */ 18525dfd244aSDaniel Beauregard uint8_t send_plogi_timer; 1853fcf3ce44SJohn Forte 1854*4c3888b8SHans Rosenfeld /* Plogi retry parameters */ 1855*4c3888b8SHans Rosenfeld plogi_params_desc_t *plogi_params; 1856*4c3888b8SHans Rosenfeld 1857fcf3ce44SJohn Forte /* Virtual port context. */ 1858fcf3ce44SJohn Forte fca_port_attrs_t *pi_attrs; 1859fcf3ce44SJohn Forte struct ql_adapter_state *pha; 1860fcf3ce44SJohn Forte struct ql_adapter_state *vp_next; 1861fcf3ce44SJohn Forte uint8_t vp_index; 1862*4c3888b8SHans Rosenfeld uint8_t max_vports; 1863fcf3ce44SJohn Forte 1864fcf3ce44SJohn Forte uint16_t free_loop_id; 1865fcf3ce44SJohn Forte 18665dfd244aSDaniel Beauregard /* Tempoary N_Port information */ 18675dfd244aSDaniel Beauregard struct ql_n_port_info *n_port; 18685dfd244aSDaniel Beauregard 1869*4c3888b8SHans Rosenfeld ql_trace_desc_t *ql_trace_desc; 18705dfd244aSDaniel Beauregard 18715dfd244aSDaniel Beauregard uint32_t flash_data_addr; 18725dfd244aSDaniel Beauregard uint32_t flash_fw_addr; 18735dfd244aSDaniel Beauregard uint32_t flash_golden_fw_addr; 1874*4c3888b8SHans Rosenfeld uint32_t boot_code_addr; 18755dfd244aSDaniel Beauregard uint32_t flash_vpd_addr; 18765dfd244aSDaniel Beauregard uint32_t flash_nvram_addr; 18775dfd244aSDaniel Beauregard uint32_t flash_desc_addr; 18785dfd244aSDaniel Beauregard uint32_t mpi_capability_list; 18795dfd244aSDaniel Beauregard uint8_t phy_fw_major_version; 18805dfd244aSDaniel Beauregard uint8_t phy_fw_minor_version; 18815dfd244aSDaniel Beauregard uint8_t phy_fw_subminor_version; 18825dfd244aSDaniel Beauregard uint8_t mpi_fw_major_version; 18835dfd244aSDaniel Beauregard uint8_t mpi_fw_minor_version; 18845dfd244aSDaniel Beauregard uint8_t mpi_fw_subminor_version; 18855dfd244aSDaniel Beauregard 18865dfd244aSDaniel Beauregard uint16_t idc_mb[8]; 1887f885d00fSDaniel Beauregard uint8_t idc_restart_timer; 18887a2b99c0SDaniel Beauregard 18897a2b99c0SDaniel Beauregard /* VLAN ID and MAC address */ 18907a2b99c0SDaniel Beauregard uint8_t fcoe_vnport_mac[6]; 18917a2b99c0SDaniel Beauregard uint16_t fabric_params; 18927a2b99c0SDaniel Beauregard uint16_t fcoe_vlan_id; 18937a2b99c0SDaniel Beauregard uint16_t fcoe_fcf_idx; 1894eb82ff87SDaniel Beauregard 1895eb82ff87SDaniel Beauregard /* NetXen context */ 1896eb82ff87SDaniel Beauregard ddi_acc_handle_t db_dev_handle; 1897eb82ff87SDaniel Beauregard caddr_t db_iobase; 1898eb82ff87SDaniel Beauregard caddr_t nx_pcibase; /* BAR0 base I/O address */ 1899eb82ff87SDaniel Beauregard uint32_t qdr_sn_window; 1900eb82ff87SDaniel Beauregard uint32_t *nx_req_in; 1901eb82ff87SDaniel Beauregard caddr_t db_read; 1902eb82ff87SDaniel Beauregard uint32_t pci_bus_addr; 1903eb82ff87SDaniel Beauregard struct legacy_intr_set nx_legacy_intr; 1904eb82ff87SDaniel Beauregard uint32_t bootloader_size; 1905eb82ff87SDaniel Beauregard uint32_t bootloader_addr; 1906eb82ff87SDaniel Beauregard uint32_t flash_fw_size; 1907*4c3888b8SHans Rosenfeld uint32_t dev_state; 1908*4c3888b8SHans Rosenfeld uint32_t fw_heartbeat_counter; 1909*4c3888b8SHans Rosenfeld dma_mem_t dmp_template; 1910*4c3888b8SHans Rosenfeld uint32_t md_capture_mask; 1911*4c3888b8SHans Rosenfeld uint32_t md_capture_size; 1912f885d00fSDaniel Beauregard uint16_t iidma_rate; 1913eb82ff87SDaniel Beauregard uint8_t function_number; 1914f885d00fSDaniel Beauregard uint8_t timeout_cnt; 1915*4c3888b8SHans Rosenfeld uint8_t seconds_since_last_heartbeat; 1916*4c3888b8SHans Rosenfeld 1917*4c3888b8SHans Rosenfeld /* default dma attributes */ 1918*4c3888b8SHans Rosenfeld ddi_dma_attr_t bit32_io_dma_attr; 1919*4c3888b8SHans Rosenfeld ddi_dma_attr_t bit64_io_dma_attr; 1920*4c3888b8SHans Rosenfeld 1921*4c3888b8SHans Rosenfeld ddi_dma_attr_t io_dma_attr; 1922*4c3888b8SHans Rosenfeld ddi_dma_attr_t fcsm_cmd_dma_attr; 1923*4c3888b8SHans Rosenfeld ddi_dma_attr_t fcsm_rsp_dma_attr; 1924*4c3888b8SHans Rosenfeld ddi_dma_attr_t fcip_cmd_dma_attr; 1925*4c3888b8SHans Rosenfeld ddi_dma_attr_t fcip_rsp_dma_attr; 1926*4c3888b8SHans Rosenfeld ddi_dma_attr_t fcp_cmd_dma_attr; 1927*4c3888b8SHans Rosenfeld ddi_dma_attr_t fcp_rsp_dma_attr; 1928*4c3888b8SHans Rosenfeld ddi_dma_attr_t fcp_data_dma_attr; 1929*4c3888b8SHans Rosenfeld 1930*4c3888b8SHans Rosenfeld int fm_capabilities; 1931*4c3888b8SHans Rosenfeld uint16_t errlog[4]; 1932fcf3ce44SJohn Forte } ql_adapter_state_t; 1933fcf3ce44SJohn Forte 1934fcf3ce44SJohn Forte /* 1935fcf3ce44SJohn Forte * adapter state flags 1936fcf3ce44SJohn Forte */ 1937*4c3888b8SHans Rosenfeld #define FCA_BOUND (uint64_t)BIT_0 1938*4c3888b8SHans Rosenfeld #define QL_OPENED (uint64_t)BIT_1 1939*4c3888b8SHans Rosenfeld #define ONLINE (uint64_t)BIT_2 1940*4c3888b8SHans Rosenfeld #define INTERRUPTS_ENABLED (uint64_t)BIT_3 1941*4c3888b8SHans Rosenfeld 1942*4c3888b8SHans Rosenfeld #define ABORT_CMDS_LOOP_DOWN_TMO (uint64_t)BIT_4 1943*4c3888b8SHans Rosenfeld #define POINT_TO_POINT (uint64_t)BIT_5 1944*4c3888b8SHans Rosenfeld #define IP_ENABLED (uint64_t)BIT_6 1945*4c3888b8SHans Rosenfeld #define IP_INITIALIZED (uint64_t)BIT_7 1946*4c3888b8SHans Rosenfeld 1947*4c3888b8SHans Rosenfeld #define MENLO_LOGIN_OPERATIONAL (uint64_t)BIT_8 1948*4c3888b8SHans Rosenfeld #define ADAPTER_SUSPENDED (uint64_t)BIT_9 1949*4c3888b8SHans Rosenfeld #define FW_DUMP_NEEDED (uint64_t)BIT_10 1950*4c3888b8SHans Rosenfeld #define PARITY_ERROR (uint64_t)BIT_11 1951*4c3888b8SHans Rosenfeld 1952*4c3888b8SHans Rosenfeld #define FLASH_ERRLOG_MARKER (uint64_t)BIT_12 1953*4c3888b8SHans Rosenfeld #define VP_ENABLED (uint64_t)BIT_13 1954*4c3888b8SHans Rosenfeld #define FDISC_ENABLED (uint64_t)BIT_14 1955*4c3888b8SHans Rosenfeld #define MULTI_QUEUE (uint64_t)BIT_15 1956*4c3888b8SHans Rosenfeld 1957*4c3888b8SHans Rosenfeld #define MPI_RESET_NEEDED (uint64_t)BIT_16 1958*4c3888b8SHans Rosenfeld #define VP_ID_NOT_ACQUIRED (uint64_t)BIT_17 1959*4c3888b8SHans Rosenfeld #define IDC_STALL_NEEDED (uint64_t)BIT_18 1960*4c3888b8SHans Rosenfeld #define POLL_INTR (uint64_t)BIT_19 1961*4c3888b8SHans Rosenfeld 1962*4c3888b8SHans Rosenfeld #define IDC_RESTART_NEEDED (uint64_t)BIT_20 1963*4c3888b8SHans Rosenfeld #define IDC_ACK_NEEDED (uint64_t)BIT_21 1964*4c3888b8SHans Rosenfeld #define LOOPBACK_ACTIVE (uint64_t)BIT_22 1965*4c3888b8SHans Rosenfeld #define QUEUE_SHADOW_PTRS (uint64_t)BIT_23 1966*4c3888b8SHans Rosenfeld 1967*4c3888b8SHans Rosenfeld #define NO_INTR_HANDSHAKE (uint64_t)BIT_24 1968*4c3888b8SHans Rosenfeld #define COMP_THD_TERMINATE (uint64_t)BIT_25 1969*4c3888b8SHans Rosenfeld #define DISABLE_NIC_FW_DMP (uint64_t)BIT_26 1970*4c3888b8SHans Rosenfeld #define MULTI_CHIP_ADAPTER (uint64_t)BIT_27 1971fcf3ce44SJohn Forte 1972fcf3ce44SJohn Forte /* 1973fcf3ce44SJohn Forte * task daemon flags 1974fcf3ce44SJohn Forte */ 1975*4c3888b8SHans Rosenfeld #define TASK_DAEMON_STOP_FLG (uint64_t)BIT_0 1976*4c3888b8SHans Rosenfeld #define TASK_DAEMON_SLEEPING_FLG (uint64_t)BIT_1 1977*4c3888b8SHans Rosenfeld #define TASK_DAEMON_ALIVE_FLG (uint64_t)BIT_2 1978*4c3888b8SHans Rosenfeld #define TASK_DAEMON_IDLE_CHK_FLG (uint64_t)BIT_3 1979fcf3ce44SJohn Forte 1980*4c3888b8SHans Rosenfeld #define SUSPENDED_WAKEUP_FLG (uint64_t)BIT_4 1981*4c3888b8SHans Rosenfeld #define FC_STATE_CHANGE (uint64_t)BIT_5 1982*4c3888b8SHans Rosenfeld #define NEED_UNSOLICITED_BUFFERS (uint64_t)BIT_6 1983*4c3888b8SHans Rosenfeld #define MARKER_NEEDED (uint64_t)BIT_7 1984*4c3888b8SHans Rosenfeld 1985*4c3888b8SHans Rosenfeld #define MARKER_ACTIVE (uint64_t)BIT_8 1986*4c3888b8SHans Rosenfeld #define ISP_ABORT_NEEDED (uint64_t)BIT_9 1987*4c3888b8SHans Rosenfeld #define ABORT_ISP_ACTIVE (uint64_t)BIT_10 1988*4c3888b8SHans Rosenfeld #define LOOP_RESYNC_NEEDED (uint64_t)BIT_11 1989*4c3888b8SHans Rosenfeld 1990*4c3888b8SHans Rosenfeld #define LOOP_RESYNC_ACTIVE (uint64_t)BIT_12 1991*4c3888b8SHans Rosenfeld #define LOOP_DOWN (uint64_t)BIT_13 1992*4c3888b8SHans Rosenfeld #define DRIVER_STALL (uint64_t)BIT_14 1993*4c3888b8SHans Rosenfeld #define COMMAND_WAIT_NEEDED (uint64_t)BIT_15 1994*4c3888b8SHans Rosenfeld 1995*4c3888b8SHans Rosenfeld #define COMMAND_WAIT_ACTIVE (uint64_t)BIT_16 1996*4c3888b8SHans Rosenfeld #define STATE_ONLINE (uint64_t)BIT_17 1997*4c3888b8SHans Rosenfeld #define ABORT_QUEUES_NEEDED (uint64_t)BIT_18 1998*4c3888b8SHans Rosenfeld #define TASK_DAEMON_STALLED_FLG (uint64_t)BIT_19 1999*4c3888b8SHans Rosenfeld 2000*4c3888b8SHans Rosenfeld #define SEND_PLOGI (uint64_t)BIT_20 2001*4c3888b8SHans Rosenfeld #define FIRMWARE_UP (uint64_t)BIT_21 2002*4c3888b8SHans Rosenfeld #define IDC_POLL_NEEDED (uint64_t)BIT_22 2003*4c3888b8SHans Rosenfeld #define FIRMWARE_LOADED (uint64_t)BIT_23 2004*4c3888b8SHans Rosenfeld 2005*4c3888b8SHans Rosenfeld #define RSCN_UPDATE_NEEDED (uint64_t)BIT_24 2006*4c3888b8SHans Rosenfeld #define HANDLE_PORT_BYPASS_CHANGE (uint64_t)BIT_25 2007*4c3888b8SHans Rosenfeld #define PORT_RETRY_NEEDED (uint64_t)BIT_26 2008*4c3888b8SHans Rosenfeld #define TASK_DAEMON_POWERING_DOWN (uint64_t)BIT_27 2009*4c3888b8SHans Rosenfeld 2010*4c3888b8SHans Rosenfeld #define TD_IIDMA_NEEDED (uint64_t)BIT_28 2011*4c3888b8SHans Rosenfeld #define WATCHDOG_NEEDED (uint64_t)BIT_29 2012*4c3888b8SHans Rosenfeld #define LED_BLINK (uint64_t)BIT_30 2013*4c3888b8SHans Rosenfeld 2014*4c3888b8SHans Rosenfeld #define DTF_EL_MSG_SKIP_FLGS (IDC_POLL_NEEDED | WATCHDOG_NEEDED | \ 2015*4c3888b8SHans Rosenfeld TASK_DAEMON_IDLE_CHK_FLG | LED_BLINK) 2016fcf3ce44SJohn Forte /* 2017fcf3ce44SJohn Forte * Mailbox flags 2018fcf3ce44SJohn Forte */ 201916dd44c2SDaniel Beauregard #define MBX_WANT_FLG BIT_0 202016dd44c2SDaniel Beauregard #define MBX_BUSY_FLG BIT_1 202116dd44c2SDaniel Beauregard #define MBX_INTERRUPT BIT_2 202216dd44c2SDaniel Beauregard #define MBX_ABORT BIT_3 2023fcf3ce44SJohn Forte 2024fcf3ce44SJohn Forte /* 2025fcf3ce44SJohn Forte * Configuration flags 2026fcf3ce44SJohn Forte */ 2027*4c3888b8SHans Rosenfeld #define CFG_CTRL_27XX (uint64_t)BIT_0 2028*4c3888b8SHans Rosenfeld #define CFG_ENABLE_64BIT_ADDRESSING (uint64_t)BIT_1 2029*4c3888b8SHans Rosenfeld #define CFG_ENABLE_LIP_RESET (uint64_t)BIT_2 2030*4c3888b8SHans Rosenfeld #define CFG_ENABLE_FULL_LIP_LOGIN (uint64_t)BIT_3 2031*4c3888b8SHans Rosenfeld 2032*4c3888b8SHans Rosenfeld #define CFG_ENABLE_TARGET_RESET (uint64_t)BIT_4 2033*4c3888b8SHans Rosenfeld #define CFG_ENABLE_LINK_DOWN_REPORTING (uint64_t)BIT_5 2034*4c3888b8SHans Rosenfeld #define CFG_LR_SUPPORT (uint64_t)BIT_6 2035*4c3888b8SHans Rosenfeld #define CFG_ENABLE_FCP_2_SUPPORT (uint64_t)BIT_7 2036*4c3888b8SHans Rosenfeld 2037*4c3888b8SHans Rosenfeld #define CFG_CTRL_83XX (uint64_t)BIT_8 2038*4c3888b8SHans Rosenfeld #define CFG_SBUS_CARD (uint64_t)BIT_9 2039*4c3888b8SHans Rosenfeld #define CFG_CTRL_23XX (uint64_t)BIT_10 2040*4c3888b8SHans Rosenfeld #define CFG_CTRL_63XX (uint64_t)BIT_11 2041*4c3888b8SHans Rosenfeld 2042*4c3888b8SHans Rosenfeld #define CFG_CTRL_22XX (uint64_t)BIT_12 2043*4c3888b8SHans Rosenfeld #define CFG_CTRL_24XX (uint64_t)BIT_13 2044*4c3888b8SHans Rosenfeld #define CFG_CTRL_25XX (uint64_t)BIT_14 2045*4c3888b8SHans Rosenfeld #define CFG_ENABLE_EXTENDED_LOGGING (uint64_t)BIT_15 2046*4c3888b8SHans Rosenfeld 2047*4c3888b8SHans Rosenfeld #define CFG_DISABLE_RISC_CODE_LOAD (uint64_t)BIT_16 2048*4c3888b8SHans Rosenfeld #define CFG_SET_CACHE_LINE_SIZE_1 (uint64_t)BIT_17 2049*4c3888b8SHans Rosenfeld #define CFG_CTRL_MENLO (uint64_t)BIT_18 2050*4c3888b8SHans Rosenfeld #define CFG_EXT_FW_INTERFACE (uint64_t)BIT_19 2051*4c3888b8SHans Rosenfeld 2052*4c3888b8SHans Rosenfeld #define CFG_LOAD_FLASH_FW (uint64_t)BIT_20 2053*4c3888b8SHans Rosenfeld #define CFG_DUMP_MAILBOX_TIMEOUT (uint64_t)BIT_21 2054*4c3888b8SHans Rosenfeld #define CFG_DUMP_ISP_SYSTEM_ERROR (uint64_t)BIT_22 2055*4c3888b8SHans Rosenfeld #define CFG_DUMP_DRIVER_COMMAND_TIMEOUT (uint64_t)BIT_23 2056*4c3888b8SHans Rosenfeld 2057*4c3888b8SHans Rosenfeld #define CFG_DUMP_LOOP_OFFLINE_TIMEOUT (uint64_t)BIT_24 2058*4c3888b8SHans Rosenfeld #define CFG_ENABLE_FWEXTTRACE (uint64_t)BIT_25 2059*4c3888b8SHans Rosenfeld #define CFG_ENABLE_FWFCETRACE (uint64_t)BIT_26 2060*4c3888b8SHans Rosenfeld #define CFG_CTRL_80XX (uint64_t)BIT_27 2061*4c3888b8SHans Rosenfeld 2062*4c3888b8SHans Rosenfeld #define CFG_CTRL_81XX (uint64_t)BIT_28 2063*4c3888b8SHans Rosenfeld #define CFG_CTRL_82XX (uint64_t)BIT_29 2064*4c3888b8SHans Rosenfeld #define CFG_FAST_TIMEOUT (uint64_t)BIT_30 2065*4c3888b8SHans Rosenfeld 2066*4c3888b8SHans Rosenfeld #define CFG_CTRL_2363 (CFG_CTRL_23XX | CFG_CTRL_63XX) 2067*4c3888b8SHans Rosenfeld #define CFG_CTRL_2425 (CFG_CTRL_24XX | CFG_CTRL_25XX) 2068*4c3888b8SHans Rosenfeld #define CFG_CTRL_2783 (CFG_CTRL_27XX | CFG_CTRL_83XX) 2069*4c3888b8SHans Rosenfeld #define CFG_CTRL_8081 (CFG_CTRL_80XX | CFG_CTRL_81XX) 2070*4c3888b8SHans Rosenfeld #define CFG_CTRL_278083 (CFG_CTRL_80XX | CFG_CTRL_2783) 2071*4c3888b8SHans Rosenfeld #define CFG_CTRL_27808183 (CFG_CTRL_8081 | CFG_CTRL_2783) 2072*4c3888b8SHans Rosenfeld #define CFG_CTRL_2527808183 (CFG_CTRL_25XX | CFG_CTRL_27808183) 2073*4c3888b8SHans Rosenfeld #define CFG_CTRL_252780818283 (CFG_CTRL_82XX | CFG_CTRL_2527808183) 2074*4c3888b8SHans Rosenfeld 2075*4c3888b8SHans Rosenfeld #define CFG_ISP_FW_TYPE_1 (CFG_CTRL_22XX | CFG_CTRL_2363) 2076*4c3888b8SHans Rosenfeld #define CFG_ISP_FW_TYPE_2 (CFG_CTRL_24XX | CFG_CTRL_252780818283) 2077*4c3888b8SHans Rosenfeld #define CFG_FCIP_TYPE_1 (CFG_CTRL_22XX | CFG_CTRL_23XX) 2078*4c3888b8SHans Rosenfeld #define CFG_FCIP_SUPPORT (CFG_FCIP_TYPE_1 | CFG_CTRL_24XX) 2079*4c3888b8SHans Rosenfeld #define CFG_FCOE_SUPPORT (CFG_CTRL_82XX | CFG_CTRL_8081) 2080*4c3888b8SHans Rosenfeld #define CFG_N2N_SUPPORT (CFG_CTRL_2425 | CFG_CTRL_2783) 2081*4c3888b8SHans Rosenfeld #define CFG_FC_TYPE_1 (CFG_CTRL_22XX | CFG_CTRL_2363) 2082*4c3888b8SHans Rosenfeld #define CFG_FC_TYPE_2 (CFG_CTRL_2425 | CFG_CTRL_2783) 2083*4c3888b8SHans Rosenfeld #define CFG_FC_TYPE (CFG_FC_TYPE_1 | CFG_FC_TYPE_2) 2084*4c3888b8SHans Rosenfeld #define CFG_NO_INTR_HSHAKE_SUP (CFG_CTRL_27808183) 2085*4c3888b8SHans Rosenfeld #define CFG_MWB_4096_SUPPORT (CFG_CTRL_2425 | CFG_CTRL_81XX) 2086*4c3888b8SHans Rosenfeld #define CFG_IIDMA_SUPPORT (CFG_CTRL_8081 | CFG_FC_TYPE_2) 2087*4c3888b8SHans Rosenfeld #define CFG_FLASH_ACC_SUPPORT (CFG_CTRL_27808183) 2088*4c3888b8SHans Rosenfeld #define CFG_FLASH_DMA_SUPPORT (CFG_CTRL_2527808183) 2089*4c3888b8SHans Rosenfeld #define CFG_LOOP_POINT_SUPPORT (CFG_CTRL_8081) 2090*4c3888b8SHans Rosenfeld #define CFG_LB_ECHO_SUPPORT (CFG_CTRL_2363 | CFG_ISP_FW_TYPE_2) 2091*4c3888b8SHans Rosenfeld #define CFG_SET_LEDS_SUPPORT (CFG_CTRL_2363 | CFG_ISP_FW_TYPE_2) 2092*4c3888b8SHans Rosenfeld #define CFG_SERDES_SUPPORT (CFG_CTRL_2783) 2093*4c3888b8SHans Rosenfeld #define CFG_BBCR_SUPPORT (CFG_CTRL_2783) 2094*4c3888b8SHans Rosenfeld #define CFG_MSI_SUPPORT (CFG_CTRL_2425 | CFG_CTRL_81XX | CFG_CTRL_82XX) 2095*4c3888b8SHans Rosenfeld 2096*4c3888b8SHans Rosenfeld 2097*4c3888b8SHans Rosenfeld #define CFG_IST(ha, cfgflags) (ha->cfg_flags & (cfgflags)) 2098fcf3ce44SJohn Forte 2099fcf3ce44SJohn Forte /* 2100fcf3ce44SJohn Forte * Interrupt configuration flags 2101fcf3ce44SJohn Forte */ 210216dd44c2SDaniel Beauregard #define IFLG_INTR_LEGACY BIT_0 210316dd44c2SDaniel Beauregard #define IFLG_INTR_FIXED BIT_1 210416dd44c2SDaniel Beauregard #define IFLG_INTR_MSI BIT_2 210516dd44c2SDaniel Beauregard #define IFLG_INTR_MSIX BIT_3 2106fcf3ce44SJohn Forte 2107fcf3ce44SJohn Forte #define IFLG_INTR_AIF (IFLG_INTR_MSI | IFLG_INTR_FIXED | IFLG_INTR_MSIX) 2108fcf3ce44SJohn Forte 2109fcf3ce44SJohn Forte /* 2110fcf3ce44SJohn Forte * Macros to help code, maintain, etc. 2111fcf3ce44SJohn Forte */ 2112fcf3ce44SJohn Forte #define LSB(x) (uint8_t)(x) 2113fcf3ce44SJohn Forte #define MSB(x) (uint8_t)((uint16_t)(x) >> 8) 2114fcf3ce44SJohn Forte #define MSW(x) (uint16_t)((uint32_t)(x) >> 16) 2115fcf3ce44SJohn Forte #define LSW(x) (uint16_t)(x) 2116fcf3ce44SJohn Forte #define LSD(x) (uint32_t)(x) 2117fcf3ce44SJohn Forte #define MSD(x) (uint32_t)((uint64_t)(x) >> 32) 2118fcf3ce44SJohn Forte 2119*4c3888b8SHans Rosenfeld #define LONG_TO_LLONG(lsl, msl) (uint64_t)((uint64_t)(msl) << 32 | \ 2120*4c3888b8SHans Rosenfeld (uint32_t)(lsl)) 2121*4c3888b8SHans Rosenfeld #define SHORT_TO_LONG(lsw, msw) (uint32_t)((uint32_t)msw << 16 | (uint16_t)lsw) 2122*4c3888b8SHans Rosenfeld #define CHAR_TO_SHORT(lsb, msb) (uint16_t)((uint16_t)msb << 8 | (uint8_t)lsb) 2123fcf3ce44SJohn Forte #define CHAR_TO_LONG(lsb, b1, b2, msb) \ 2124fcf3ce44SJohn Forte (uint32_t)(SHORT_TO_LONG(CHAR_TO_SHORT(lsb, b1), \ 2125fcf3ce44SJohn Forte CHAR_TO_SHORT(b2, msb))) 2126fcf3ce44SJohn Forte 2127fcf3ce44SJohn Forte /* Little endian machine correction defines. */ 2128fcf3ce44SJohn Forte #ifdef _LITTLE_ENDIAN 2129fcf3ce44SJohn Forte #define LITTLE_ENDIAN_16(x) 2130fcf3ce44SJohn Forte #define LITTLE_ENDIAN_24(x) 2131fcf3ce44SJohn Forte #define LITTLE_ENDIAN_32(x) 2132fcf3ce44SJohn Forte #define LITTLE_ENDIAN_64(x) 2133fcf3ce44SJohn Forte #define LITTLE_ENDIAN(bp, bytes) 2134fcf3ce44SJohn Forte #define BIG_ENDIAN_16(x) ql_chg_endian((uint8_t *)x, 2) 2135fcf3ce44SJohn Forte #define BIG_ENDIAN_24(x) ql_chg_endian((uint8_t *)x, 3) 2136fcf3ce44SJohn Forte #define BIG_ENDIAN_32(x) ql_chg_endian((uint8_t *)x, 4) 2137fcf3ce44SJohn Forte #define BIG_ENDIAN_64(x) ql_chg_endian((uint8_t *)x, 8) 2138fcf3ce44SJohn Forte #define BIG_ENDIAN(bp, bytes) ql_chg_endian((uint8_t *)bp, bytes) 2139fcf3ce44SJohn Forte #endif /* _LITTLE_ENDIAN */ 2140fcf3ce44SJohn Forte 2141fcf3ce44SJohn Forte /* Big endian machine correction defines. */ 2142fcf3ce44SJohn Forte #ifdef _BIG_ENDIAN 2143fcf3ce44SJohn Forte #define LITTLE_ENDIAN_16(x) ql_chg_endian((uint8_t *)x, 2) 2144fcf3ce44SJohn Forte #define LITTLE_ENDIAN_24(x) ql_chg_endian((uint8_t *)x, 3) 2145fcf3ce44SJohn Forte #define LITTLE_ENDIAN_32(x) ql_chg_endian((uint8_t *)x, 4) 2146fcf3ce44SJohn Forte #define LITTLE_ENDIAN_64(x) ql_chg_endian((uint8_t *)x, 8) 2147fcf3ce44SJohn Forte #define LITTLE_ENDIAN(bp, bytes) ql_chg_endian((uint8_t *)bp, bytes) 2148fcf3ce44SJohn Forte #define BIG_ENDIAN_16(x) 2149fcf3ce44SJohn Forte #define BIG_ENDIAN_24(x) 2150fcf3ce44SJohn Forte #define BIG_ENDIAN_32(x) 2151fcf3ce44SJohn Forte #define BIG_ENDIAN_64(x) 2152fcf3ce44SJohn Forte #define BIG_ENDIAN(bp, bytes) 2153fcf3ce44SJohn Forte #endif /* _BIG_ENDIAN */ 2154fcf3ce44SJohn Forte 2155fcf3ce44SJohn Forte #define LOCAL_LOOP_ID(x) (x <= LAST_LOCAL_LOOP_ID) 2156fcf3ce44SJohn Forte 2157fcf3ce44SJohn Forte #define FABRIC_LOOP_ID(x) (x == FL_PORT_LOOP_ID || \ 2158fcf3ce44SJohn Forte x == SIMPLE_NAME_SERVER_LOOP_ID) 2159fcf3ce44SJohn Forte 2160fcf3ce44SJohn Forte #define SNS_LOOP_ID(x) (x >= SNS_FIRST_LOOP_ID && \ 2161fcf3ce44SJohn Forte x <= SNS_LAST_LOOP_ID) 2162fcf3ce44SJohn Forte 2163fcf3ce44SJohn Forte #define BROADCAST_LOOP_ID(x) (x == IP_BROADCAST_LOOP_ID) 2164fcf3ce44SJohn Forte 2165fcf3ce44SJohn Forte #define VALID_LOOP_ID(x) (LOCAL_LOOP_ID(x) || SNS_LOOP_ID(x) || \ 2166fcf3ce44SJohn Forte FABRIC_LOOP_ID(x) || BROADCAST_LOOP_ID(x)) 2167fcf3ce44SJohn Forte 2168fcf3ce44SJohn Forte #define VALID_N_PORT_HDL(x) (x <= LAST_N_PORT_HDL || \ 2169fcf3ce44SJohn Forte (x >= SNS_24XX_HDL && x <= BROADCAST_24XX_HDL)) 2170fcf3ce44SJohn Forte 2171*4c3888b8SHans Rosenfeld #define VALID_DEVICE_ID(ha, x) (CFG_IST(ha, CFG_ISP_FW_TYPE_2) ? \ 2172fcf3ce44SJohn Forte VALID_N_PORT_HDL(x) : VALID_LOOP_ID(x)) 2173fcf3ce44SJohn Forte 2174*4c3888b8SHans Rosenfeld #define VALID_TARGET_ID(ha, x) (CFG_IST(ha, CFG_ISP_FW_TYPE_2) ? \ 2175fcf3ce44SJohn Forte (x <= LAST_N_PORT_HDL) : (LOCAL_LOOP_ID(x) || SNS_LOOP_ID(x))) 2176fcf3ce44SJohn Forte 2177*4c3888b8SHans Rosenfeld #define RESERVED_LOOP_ID(ha, x) (CFG_IST(ha, CFG_ISP_FW_TYPE_2) ? \ 2178fcf3ce44SJohn Forte (x > LAST_N_PORT_HDL && x <= FL_PORT_24XX_HDL) : \ 2179fcf3ce44SJohn Forte (x >= FL_PORT_LOOP_ID && x <= SIMPLE_NAME_SERVER_LOOP_ID)) 2180fcf3ce44SJohn Forte 2181*4c3888b8SHans Rosenfeld #define QL_LOOP_TRANSITION (MARKER_NEEDED | MARKER_ACTIVE | \ 2182fcf3ce44SJohn Forte ISP_ABORT_NEEDED | ABORT_ISP_ACTIVE | \ 2183fcf3ce44SJohn Forte LOOP_RESYNC_NEEDED | LOOP_RESYNC_ACTIVE | \ 2184fcf3ce44SJohn Forte COMMAND_WAIT_NEEDED | COMMAND_WAIT_ACTIVE) 2185fcf3ce44SJohn Forte 2186fcf3ce44SJohn Forte #define LOOP_RECONFIGURE(ha) (ha->task_daemon_flags & (QL_LOOP_TRANSITION | \ 2187fcf3ce44SJohn Forte DRIVER_STALL)) 2188fcf3ce44SJohn Forte 2189*4c3888b8SHans Rosenfeld #define DRIVER_SUSPENDED(ha) (ha->task_daemon_flags & (LOOP_DOWN | \ 2190*4c3888b8SHans Rosenfeld QL_LOOP_TRANSITION | DRIVER_STALL)) 2191fcf3ce44SJohn Forte 2192fcf3ce44SJohn Forte #define LOOP_NOT_READY(ha) (ha->task_daemon_flags & (QL_LOOP_TRANSITION | \ 2193fcf3ce44SJohn Forte LOOP_DOWN)) 2194fcf3ce44SJohn Forte 2195fcf3ce44SJohn Forte #define LOOP_READY(ha) (LOOP_NOT_READY(ha) == 0) 2196fcf3ce44SJohn Forte 2197fcf3ce44SJohn Forte #define QL_TASK_PENDING(ha) ( \ 2198fcf3ce44SJohn Forte ha->task_daemon_flags & (QL_LOOP_TRANSITION | ABORT_QUEUES_NEEDED | \ 2199*4c3888b8SHans Rosenfeld PORT_RETRY_NEEDED) || ha->unsol_callback_queue.first != NULL) 2200fcf3ce44SJohn Forte 2201fcf3ce44SJohn Forte #define QL_DAEMON_NOT_ACTIVE(ha) ( \ 2202fcf3ce44SJohn Forte !(ha->task_daemon_flags & TASK_DAEMON_ALIVE_FLG) || \ 2203fcf3ce44SJohn Forte ha->task_daemon_flags & (TASK_DAEMON_SLEEPING_FLG | \ 2204fcf3ce44SJohn Forte TASK_DAEMON_STOP_FLG)) 2205fcf3ce44SJohn Forte 2206*4c3888b8SHans Rosenfeld #define QL_ABORTED_SRB(ha) ((ql_srb_t *)ha) 2207fcf3ce44SJohn Forte 2208*4c3888b8SHans Rosenfeld #define INTERRUPT_PENDING(ha) (CFG_IST(ha, CFG_CTRL_82XX) ? \ 2209eb82ff87SDaniel Beauregard RD32_IO_REG(ha, nx_risc_int) & NX_RISC_INT : \ 2210eb82ff87SDaniel Beauregard RD16_IO_REG(ha, istatus) & RISC_INT) 2211fcf3ce44SJohn Forte /* 2212fcf3ce44SJohn Forte * Locking Macro Definitions 2213fcf3ce44SJohn Forte */ 2214fcf3ce44SJohn Forte #define GLOBAL_STATE_LOCK() mutex_enter(&ql_global_mutex) 2215fcf3ce44SJohn Forte #define GLOBAL_STATE_UNLOCK() mutex_exit(&ql_global_mutex) 2216fcf3ce44SJohn Forte 2217*4c3888b8SHans Rosenfeld #define GLOBAL_TIMER_LOCK() mutex_enter(&ql_global_timer_mutex) 2218*4c3888b8SHans Rosenfeld #define GLOBAL_TIMER_UNLOCK() mutex_exit(&ql_global_timer_mutex) 2219*4c3888b8SHans Rosenfeld 2220fcf3ce44SJohn Forte #define TRY_DEVICE_QUEUE_LOCK(q) mutex_tryenter(&q->mutex) 2221fcf3ce44SJohn Forte #define DEVICE_QUEUE_LOCK(q) mutex_enter(&q->mutex) 2222fcf3ce44SJohn Forte #define DEVICE_QUEUE_UNLOCK(q) mutex_exit(&q->mutex) 2223fcf3ce44SJohn Forte 2224a2b3ff35SDaniel Beauregard #define TRY_MBX_REGISTER_LOCK(ha) mutex_tryenter(&ha->pha->mbx_mutex) 2225a2b3ff35SDaniel Beauregard #define MBX_REGISTER_LOCK_OWNER(ha) mutex_owner(&ha->pha->mbx_mutex) 2226fcf3ce44SJohn Forte #define MBX_REGISTER_LOCK(ha) mutex_enter(&ha->pha->mbx_mutex) 2227fcf3ce44SJohn Forte #define MBX_REGISTER_UNLOCK(ha) mutex_exit(&ha->pha->mbx_mutex) 2228fcf3ce44SJohn Forte 2229*4c3888b8SHans Rosenfeld #define INTR_LOCK(ha) ql_intr_lock(ha->pha) 2230*4c3888b8SHans Rosenfeld #define INTR_UNLOCK(ha) ql_intr_unlock(ha->pha) 2231*4c3888b8SHans Rosenfeld 2232*4c3888b8SHans Rosenfeld #define INDX_INTR_LOCK(ha, i) mutex_enter(&ha->pha->rsp_queues[i]->intr_mutex) 2233*4c3888b8SHans Rosenfeld #define INDX_INTR_UNLOCK(ha, i) mutex_exit(&ha->pha->rsp_queues[i]->intr_mutex) 2234fcf3ce44SJohn Forte 2235fcf3ce44SJohn Forte #define TASK_DAEMON_LOCK(ha) mutex_enter(&ha->pha->task_daemon_mutex) 2236fcf3ce44SJohn Forte #define TASK_DAEMON_UNLOCK(ha) mutex_exit(&ha->pha->task_daemon_mutex) 2237fcf3ce44SJohn Forte 2238fcf3ce44SJohn Forte #define REQUEST_RING_LOCK(ha) mutex_enter(&ha->pha->req_ring_mutex) 2239fcf3ce44SJohn Forte #define REQUEST_RING_UNLOCK(ha) mutex_exit(&ha->pha->req_ring_mutex) 2240fcf3ce44SJohn Forte 2241*4c3888b8SHans Rosenfeld #define COMP_Q_LOCK(ha) mutex_enter(&ha->pha->comp_q_mutex) 2242*4c3888b8SHans Rosenfeld #define COMP_Q_UNLOCK(ha) mutex_exit(&ha->pha->comp_q_mutex) 2243fcf3ce44SJohn Forte 2244fcf3ce44SJohn Forte #define ADAPTER_STATE_LOCK(ha) mutex_enter(&ha->pha->mutex) 2245fcf3ce44SJohn Forte #define ADAPTER_STATE_UNLOCK(ha) mutex_exit(&ha->pha->mutex) 2246fcf3ce44SJohn Forte 224716dd44c2SDaniel Beauregard #define QL_DUMP_LOCK(ha) mutex_enter(&ha->pha->dump_mutex) 224816dd44c2SDaniel Beauregard #define QL_DUMP_UNLOCK(ha) mutex_exit(&ha->pha->dump_mutex) 224916dd44c2SDaniel Beauregard 2250fcf3ce44SJohn Forte #define QL_PM_LOCK(ha) mutex_enter(&ha->pha->pm_mutex) 2251fcf3ce44SJohn Forte #define QL_PM_UNLOCK(ha) mutex_exit(&ha->pha->pm_mutex) 2252fcf3ce44SJohn Forte 2253fcf3ce44SJohn Forte #define QL_UB_LOCK(ha) mutex_enter(&ha->pha->ub_mutex) 2254fcf3ce44SJohn Forte #define QL_UB_UNLOCK(ha) mutex_exit(&ha->pha->ub_mutex) 2255fcf3ce44SJohn Forte 2256fcf3ce44SJohn Forte #define GLOBAL_HW_LOCK() mutex_enter(&ql_global_hw_mutex) 2257fcf3ce44SJohn Forte #define GLOBAL_HW_UNLOCK() mutex_exit(&ql_global_hw_mutex) 2258fcf3ce44SJohn Forte 2259fcf3ce44SJohn Forte /* 2260fcf3ce44SJohn Forte * PCI power management control/status register location 2261fcf3ce44SJohn Forte */ 2262fcf3ce44SJohn Forte #define QL_PM_CS_REG 0x48 2263fcf3ce44SJohn Forte 2264fcf3ce44SJohn Forte /* 2265fcf3ce44SJohn Forte * ql component 2266fcf3ce44SJohn Forte */ 2267fcf3ce44SJohn Forte #define QL_POWER_COMPONENT 0 2268fcf3ce44SJohn Forte 2269fcf3ce44SJohn Forte typedef struct ql_config_space { 2270fcf3ce44SJohn Forte uint16_t chs_command; 2271fcf3ce44SJohn Forte uint8_t chs_cache_line_size; 2272fcf3ce44SJohn Forte uint8_t chs_latency_timer; 2273fcf3ce44SJohn Forte uint8_t chs_header_type; 2274fcf3ce44SJohn Forte uint8_t chs_sec_latency_timer; 2275fcf3ce44SJohn Forte uint8_t chs_bridge_control; 2276fcf3ce44SJohn Forte uint32_t chs_base0; 2277fcf3ce44SJohn Forte uint32_t chs_base1; 2278fcf3ce44SJohn Forte uint32_t chs_base2; 2279fcf3ce44SJohn Forte uint32_t chs_base3; 2280fcf3ce44SJohn Forte uint32_t chs_base4; 2281fcf3ce44SJohn Forte uint32_t chs_base5; 2282fcf3ce44SJohn Forte } ql_config_space_t; 2283fcf3ce44SJohn Forte 2284fcf3ce44SJohn Forte #ifdef USE_DDI_INTERFACES 2285fcf3ce44SJohn Forte 2286fcf3ce44SJohn Forte #define QL_SAVE_CONFIG_REGS(dip) pci_save_config_regs(dip) 2287fcf3ce44SJohn Forte #define QL_RESTORE_CONFIG_REGS(dip) pci_restore_config_regs(dip) 2288fcf3ce44SJohn Forte 2289fcf3ce44SJohn Forte #else /* USE_DDI_INTERFACES */ 2290fcf3ce44SJohn Forte 2291fcf3ce44SJohn Forte #define QL_SAVE_CONFIG_REGS(dip) ql_save_config_regs(dip) 2292fcf3ce44SJohn Forte #define QL_RESTORE_CONFIG_REGS(dip) ql_restore_config_regs(dip) 2293fcf3ce44SJohn Forte 2294fcf3ce44SJohn Forte #endif /* USE_DDI_INTERFACES */ 2295fcf3ce44SJohn Forte 2296fcf3ce44SJohn Forte /* 2297fcf3ce44SJohn Forte * QL local function return status codes 2298fcf3ce44SJohn Forte */ 2299fcf3ce44SJohn Forte #define QL_SUCCESS 0x4000 2300fcf3ce44SJohn Forte #define QL_INVALID_COMMAND 0x4001 2301fcf3ce44SJohn Forte #define QL_INTERFACE_ERROR 0x4002 2302fcf3ce44SJohn Forte #define QL_TEST_FAILED 0x4003 2303fcf3ce44SJohn Forte #define QL_COMMAND_ERROR 0x4005 2304fcf3ce44SJohn Forte #define QL_PARAMETER_ERROR 0x4006 2305fcf3ce44SJohn Forte #define QL_PORT_ID_USED 0x4007 2306fcf3ce44SJohn Forte #define QL_LOOP_ID_USED 0x4008 2307fcf3ce44SJohn Forte #define QL_ALL_IDS_IN_USE 0x4009 2308fcf3ce44SJohn Forte #define QL_NOT_LOGGED_IN 0x400A 2309fcf3ce44SJohn Forte #define QL_LOOP_DOWN 0x400B 2310fcf3ce44SJohn Forte #define QL_LOOP_BACK_ERROR 0x400C 2311fcf3ce44SJohn Forte #define QL_CHECKSUM_ERROR 0x4010 23125dfd244aSDaniel Beauregard #define QL_CONSUMED 0x4011 2313fcf3ce44SJohn Forte 2314fcf3ce44SJohn Forte #define QL_FUNCTION_TIMEOUT 0x100 2315fcf3ce44SJohn Forte #define QL_FUNCTION_PARAMETER_ERROR 0x101 2316fcf3ce44SJohn Forte #define QL_FUNCTION_FAILED 0x102 2317fcf3ce44SJohn Forte #define QL_MEMORY_ALLOC_FAILED 0x103 2318fcf3ce44SJohn Forte #define QL_FABRIC_NOT_INITIALIZED 0x104 2319fcf3ce44SJohn Forte #define QL_LOCK_TIMEOUT 0x105 2320fcf3ce44SJohn Forte #define QL_ABORTED 0x106 2321fcf3ce44SJohn Forte #define QL_FUNCTION_SUSPENDED 0x107 2322fcf3ce44SJohn Forte #define QL_END_OF_DATA 0x108 2323fcf3ce44SJohn Forte #define QL_IP_UNSUPPORTED 0x109 2324fcf3ce44SJohn Forte #define QL_PM_ERROR 0x10a 2325fcf3ce44SJohn Forte #define QL_DATA_EXISTS 0x10b 2326fcf3ce44SJohn Forte #define QL_NOT_SUPPORTED 0x10c 2327fcf3ce44SJohn Forte #define QL_MEMORY_FULL 0x10d 2328fcf3ce44SJohn Forte #define QL_FW_NOT_SUPPORTED 0x10e 2329fcf3ce44SJohn Forte #define QL_FWMODLOAD_FAILED 0x10f 233016dd44c2SDaniel Beauregard #define QL_FWSYM_NOT_FOUND 0x110 233116dd44c2SDaniel Beauregard #define QL_LOGIN_NOT_SUPPORTED 0x111 2332fcf3ce44SJohn Forte 2333fcf3ce44SJohn Forte /* 2334fcf3ce44SJohn Forte * SBus card FPGA register offsets. 2335fcf3ce44SJohn Forte */ 2336fcf3ce44SJohn Forte #define FPGA_CONF 0x100 2337fcf3ce44SJohn Forte #define FPGA_EEPROM_LOADDR 0x102 2338fcf3ce44SJohn Forte #define FPGA_EEPROM_HIADDR 0x104 2339fcf3ce44SJohn Forte #define FPGA_EEPROM_DATA 0x106 2340fcf3ce44SJohn Forte #define FPGA_REVISION 0x108 2341fcf3ce44SJohn Forte 2342fcf3ce44SJohn Forte #define SBUS_FLASH_WRITE_ENABLE 0x0080 2343fcf3ce44SJohn Forte #define QL_SBUS_FCODE_SIZE 0x30000 2344fcf3ce44SJohn Forte #define QL_FCODE_OFFSET 0 2345fcf3ce44SJohn Forte #define QL_FPGA_SIZE 0x40000 2346fcf3ce44SJohn Forte #define QL_FPGA_OFFSET 0x40000 2347fcf3ce44SJohn Forte 2348fcf3ce44SJohn Forte #define READ_PORT_ID(addr) ((uint32_t)((((uint32_t)((addr)[0])) << 16) | \ 2349fcf3ce44SJohn Forte (((uint32_t)((addr)[1])) << 8) | \ 2350fcf3ce44SJohn Forte (((uint32_t)((addr)[2]))))) 2351fcf3ce44SJohn Forte #define READ_PORT_NAME(addr) ((u_longlong_t)((((uint64_t)((addr)[0])) << 56) | \ 2352fcf3ce44SJohn Forte (((uint64_t)((addr)[1])) << 48) | \ 2353fcf3ce44SJohn Forte (((uint64_t)((addr)[2])) << 40) | \ 2354fcf3ce44SJohn Forte (((uint64_t)((addr)[3])) << 32) | \ 2355fcf3ce44SJohn Forte (((uint64_t)((addr)[4])) << 24) | \ 2356fcf3ce44SJohn Forte (((uint64_t)((addr)[5])) << 16) | \ 2357fcf3ce44SJohn Forte (((uint64_t)((addr)[6])) << 8) | \ 2358fcf3ce44SJohn Forte (((uint64_t)((addr)[7]))))) 235916dd44c2SDaniel Beauregard /* 236016dd44c2SDaniel Beauregard * Structure used to associate cmds with strings which describe them. 236116dd44c2SDaniel Beauregard */ 236216dd44c2SDaniel Beauregard typedef struct cmd_table_entry { 236316dd44c2SDaniel Beauregard uint16_t cmd; 236416dd44c2SDaniel Beauregard char *string; 236516dd44c2SDaniel Beauregard } cmd_table_t; 236616dd44c2SDaniel Beauregard 236716dd44c2SDaniel Beauregard /* 236816dd44c2SDaniel Beauregard * ELS command table initializer 236916dd44c2SDaniel Beauregard */ 237016dd44c2SDaniel Beauregard #define ELS_CMD_TABLE() \ 237116dd44c2SDaniel Beauregard { \ 237216dd44c2SDaniel Beauregard {LA_ELS_RJT, "LA_ELS_RJT"}, \ 237316dd44c2SDaniel Beauregard {LA_ELS_ACC, "LA_ELS_ACC"}, \ 237416dd44c2SDaniel Beauregard {LA_ELS_PLOGI, "LA_ELS_PLOGI"}, \ 237516dd44c2SDaniel Beauregard {LA_ELS_PDISC, "LA_ELS_PDISC"}, \ 237616dd44c2SDaniel Beauregard {LA_ELS_FLOGI, "LA_ELS_FLOGI"}, \ 237716dd44c2SDaniel Beauregard {LA_ELS_FDISC, "LA_ELS_FDISC"}, \ 237816dd44c2SDaniel Beauregard {LA_ELS_LOGO, "LA_ELS_LOGO"}, \ 237916dd44c2SDaniel Beauregard {LA_ELS_PRLI, "LA_ELS_PRLI"}, \ 238016dd44c2SDaniel Beauregard {LA_ELS_PRLO, "LA_ELS_PRLO"}, \ 238116dd44c2SDaniel Beauregard {LA_ELS_ADISC, "LA_ELS_ADISC"}, \ 238216dd44c2SDaniel Beauregard {LA_ELS_LINIT, "LA_ELS_LINIT"}, \ 238316dd44c2SDaniel Beauregard {LA_ELS_LPC, "LA_ELS_LPC"}, \ 238416dd44c2SDaniel Beauregard {LA_ELS_LSTS, "LA_ELS_LSTS"}, \ 238516dd44c2SDaniel Beauregard {LA_ELS_SCR, "LA_ELS_SCR"}, \ 238616dd44c2SDaniel Beauregard {LA_ELS_RSCN, "LA_ELS_RSCN"}, \ 238716dd44c2SDaniel Beauregard {LA_ELS_FARP_REQ, "LA_ELS_FARP_REQ"}, \ 238816dd44c2SDaniel Beauregard {LA_ELS_FARP_REPLY, "LA_ELS_FARP_REPLY"}, \ 238916dd44c2SDaniel Beauregard {LA_ELS_RLS, "LA_ELS_RLS"}, \ 239016dd44c2SDaniel Beauregard {LA_ELS_RNID, "LA_ELS_RNID"}, \ 2391c92b35bbSToomas Soome {0, NULL} \ 239216dd44c2SDaniel Beauregard } 239316dd44c2SDaniel Beauregard 239416dd44c2SDaniel Beauregard /* 239516dd44c2SDaniel Beauregard * ELS Passthru IOCB data segment descriptor. 239616dd44c2SDaniel Beauregard */ 239716dd44c2SDaniel Beauregard typedef struct data_seg_desc { 239816dd44c2SDaniel Beauregard uint32_t addr[2]; 239916dd44c2SDaniel Beauregard uint32_t length; 240016dd44c2SDaniel Beauregard } data_seg_desc_t; 240116dd44c2SDaniel Beauregard 240216dd44c2SDaniel Beauregard /* 240316dd44c2SDaniel Beauregard * ELS descriptor used to abstract the hosts fibre channel packet 240416dd44c2SDaniel Beauregard * from the ISP ELS code. 240516dd44c2SDaniel Beauregard */ 240616dd44c2SDaniel Beauregard typedef struct els_desc { 240716dd44c2SDaniel Beauregard uint8_t els; /* the ELS command code */ 240816dd44c2SDaniel Beauregard ddi_acc_handle_t els_handle; 240916dd44c2SDaniel Beauregard uint16_t n_port_handle; 241016dd44c2SDaniel Beauregard port_id_t d_id; 241116dd44c2SDaniel Beauregard port_id_t s_id; 241216dd44c2SDaniel Beauregard uint16_t control_flags; 241316dd44c2SDaniel Beauregard uint32_t cmd_byte_count; 241416dd44c2SDaniel Beauregard uint32_t rsp_byte_count; 241516dd44c2SDaniel Beauregard data_seg_desc_t tx_dsd; /* FC frame payload */ 241616dd44c2SDaniel Beauregard data_seg_desc_t rx_dsd; /* ELS resp payload buffer */ 241716dd44c2SDaniel Beauregard } els_descriptor_t; 241816dd44c2SDaniel Beauregard 241916dd44c2SDaniel Beauregard typedef struct prli_svc_pram_resp_page { 242016dd44c2SDaniel Beauregard uint8_t type_code; 242116dd44c2SDaniel Beauregard uint8_t type_code_ext; 242216dd44c2SDaniel Beauregard uint16_t prli_resp_flags; 242316dd44c2SDaniel Beauregard uint32_t orig_process_associator; 242416dd44c2SDaniel Beauregard uint32_t resp_process_associator; 242516dd44c2SDaniel Beauregard uint32_t common_parameters; 242616dd44c2SDaniel Beauregard } prli_svc_pram_resp_page_t; 242716dd44c2SDaniel Beauregard 242816dd44c2SDaniel Beauregard /* 242916dd44c2SDaniel Beauregard * PRLI accept Service Parameter Page Word 3 243016dd44c2SDaniel Beauregard */ 243116dd44c2SDaniel Beauregard #define PRLI_W3_WRITE_FCP_XFR_RDY_DISABLED BIT_0 243216dd44c2SDaniel Beauregard #define PRLI_W3_READ_FCP_XFR_RDY_DISABLED BIT_1 243316dd44c2SDaniel Beauregard #define PRLI_W3_OBSOLETE_BIT_2 BIT_2 243416dd44c2SDaniel Beauregard #define PRLI_W3_OBSOLETE_BIT_3 BIT_3 243516dd44c2SDaniel Beauregard #define PRLI_W3_TARGET_FUNCTION BIT_4 243616dd44c2SDaniel Beauregard #define PRLI_W3_INITIATOR_FUNCTION BIT_5 243716dd44c2SDaniel Beauregard #define PRLI_W3_DATA_OVERLAY_ALLOWED BIT_6 243816dd44c2SDaniel Beauregard #define PRLI_W3_CONFIRMED_COMP_ALLOWED BIT_7 243916dd44c2SDaniel Beauregard #define PRLI_W3_RETRY BIT_8 244016dd44c2SDaniel Beauregard #define PRLI_W3_TASK_RETRY_ID_REQUESTED BIT_9 244116dd44c2SDaniel Beauregard 244216dd44c2SDaniel Beauregard typedef struct prli_acc_resp { 244316dd44c2SDaniel Beauregard uint8_t ls_code; 244416dd44c2SDaniel Beauregard uint8_t page_length; 244516dd44c2SDaniel Beauregard uint16_t payload_length; 244616dd44c2SDaniel Beauregard struct prli_svc_pram_resp_page svc_params; 244716dd44c2SDaniel Beauregard } prli_acc_resp_t; 244816dd44c2SDaniel Beauregard 2449*4c3888b8SHans Rosenfeld #define EL_TRACE_BUF_SIZE 8192 2450*4c3888b8SHans Rosenfeld 2451*4c3888b8SHans Rosenfeld #define QL_PORT_ID_MASK 0xffffff 2452*4c3888b8SHans Rosenfeld 2453*4c3888b8SHans Rosenfeld #define QL_PLOGI_RETRY_CNT (5) 2454*4c3888b8SHans Rosenfeld #define QL_PLOGI_RETRY_DLY_USEC (10 * MILLISEC) 2455fcf3ce44SJohn Forte 2456fcf3ce44SJohn Forte /* 2457fcf3ce44SJohn Forte * Global Data in ql_api.c source file. 2458fcf3ce44SJohn Forte */ 2459fcf3ce44SJohn Forte extern void *ql_state; /* for soft state routine */ 2460fcf3ce44SJohn Forte extern uint32_t ql_os_release_level; 2461fcf3ce44SJohn Forte extern ql_head_t ql_hba; 2462fcf3ce44SJohn Forte extern kmutex_t ql_global_mutex; 2463fcf3ce44SJohn Forte extern kmutex_t ql_global_hw_mutex; 2464fcf3ce44SJohn Forte extern kmutex_t ql_global_el_mutex; 2465fcf3ce44SJohn Forte extern uint8_t ql_ip_fast_post_count; 2466fcf3ce44SJohn Forte extern uint32_t ql_ip_buffer_count; 2467fcf3ce44SJohn Forte extern uint32_t ql_ip_low_water; 2468fcf3ce44SJohn Forte extern uint8_t ql_alpa_to_index[]; 2469fcf3ce44SJohn Forte extern uint32_t ql_gfru_hba_index; 2470f885d00fSDaniel Beauregard extern uint32_t ql_enable_ets; 2471f885d00fSDaniel Beauregard extern uint16_t ql_osc_wait_count; 2472fcf3ce44SJohn Forte 2473fcf3ce44SJohn Forte /* 2474fcf3ce44SJohn Forte * Global Function Prototypes in ql_api.c source file. 2475fcf3ce44SJohn Forte */ 2476fcf3ce44SJohn Forte void ql_chg_endian(uint8_t *, size_t); 2477fcf3ce44SJohn Forte void ql_populate_hba_fru_details(ql_adapter_state_t *, fc_fca_port_info_t *); 2478fcf3ce44SJohn Forte void ql_setup_fruinfo(ql_adapter_state_t *); 2479fcf3ce44SJohn Forte uint16_t ql_pci_config_get16(ql_adapter_state_t *, off_t); 2480fcf3ce44SJohn Forte uint32_t ql_pci_config_get32(ql_adapter_state_t *, off_t); 2481fcf3ce44SJohn Forte void ql_pci_config_put8(ql_adapter_state_t *, off_t, uint8_t); 2482fcf3ce44SJohn Forte void ql_pci_config_put16(ql_adapter_state_t *, off_t, uint16_t); 2483fcf3ce44SJohn Forte void ql_delay(ql_adapter_state_t *, clock_t); 2484*4c3888b8SHans Rosenfeld void ql_awaken_task_daemon(ql_adapter_state_t *, ql_srb_t *, uint64_t, 2485*4c3888b8SHans Rosenfeld uint64_t); 2486fcf3ce44SJohn Forte int ql_abort_device(ql_adapter_state_t *, ql_tgt_t *, int); 2487fcf3ce44SJohn Forte int ql_binary_fw_dump(ql_adapter_state_t *, int); 2488*4c3888b8SHans Rosenfeld void ql_done(ql_link_t *, boolean_t); 2489fcf3ce44SJohn Forte int ql_24xx_flash_id(ql_adapter_state_t *); 2490fcf3ce44SJohn Forte int ql_24xx_load_flash(ql_adapter_state_t *, uint8_t *, uint32_t, uint32_t); 2491fcf3ce44SJohn Forte int ql_poll_flash(ql_adapter_state_t *, uint32_t, uint8_t); 2492fcf3ce44SJohn Forte void ql_flash_disable(ql_adapter_state_t *); 2493fcf3ce44SJohn Forte void ql_flash_enable(ql_adapter_state_t *); 2494fcf3ce44SJohn Forte int ql_erase_flash(ql_adapter_state_t *, int); 2495fcf3ce44SJohn Forte void ql_write_flash_byte(ql_adapter_state_t *, uint32_t, uint8_t); 2496fcf3ce44SJohn Forte uint8_t ql_read_flash_byte(ql_adapter_state_t *, uint32_t); 2497fcf3ce44SJohn Forte int ql_24xx_read_flash(ql_adapter_state_t *, uint32_t, uint32_t *); 2498fcf3ce44SJohn Forte int ql_24xx_write_flash(ql_adapter_state_t *, uint32_t, uint32_t); 2499fcf3ce44SJohn Forte fc_unsol_buf_t *ql_get_unsolicited_buffer(ql_adapter_state_t *, uint32_t); 2500*4c3888b8SHans Rosenfeld int ql_dump_firmware(ql_adapter_state_t *); 2501fcf3ce44SJohn Forte size_t ql_ascii_fw_dump(ql_adapter_state_t *, caddr_t); 2502fcf3ce44SJohn Forte void ql_add_link_b(ql_head_t *, ql_link_t *); 2503fcf3ce44SJohn Forte void ql_add_link_t(ql_head_t *, ql_link_t *); 2504fcf3ce44SJohn Forte void ql_remove_link(ql_head_t *, ql_link_t *); 2505fcf3ce44SJohn Forte void ql_next(ql_adapter_state_t *, ql_lun_t *); 2506fcf3ce44SJohn Forte void ql_send_logo(ql_adapter_state_t *, ql_tgt_t *, ql_head_t *); 2507fcf3ce44SJohn Forte void ql_cthdr_endian(ddi_acc_handle_t, caddr_t, boolean_t); 2508fcf3ce44SJohn Forte ql_tgt_t *ql_d_id_to_queue(ql_adapter_state_t *, port_id_t); 2509fcf3ce44SJohn Forte ql_tgt_t *ql_loop_id_to_queue(ql_adapter_state_t *, uint16_t); 2510fcf3ce44SJohn Forte void ql_cmd_wait(ql_adapter_state_t *); 2511fcf3ce44SJohn Forte void ql_loop_online(ql_adapter_state_t *); 2512fcf3ce44SJohn Forte ql_tgt_t *ql_dev_init(ql_adapter_state_t *, port_id_t, uint16_t); 2513fcf3ce44SJohn Forte int ql_ub_frame_hdr(ql_adapter_state_t *, ql_tgt_t *, uint16_t, ql_head_t *); 2514fcf3ce44SJohn Forte void ql_rcv_rscn_els(ql_adapter_state_t *, uint16_t *, ql_head_t *); 2515fcf3ce44SJohn Forte int ql_stall_driver(ql_adapter_state_t *, uint32_t); 2516fcf3ce44SJohn Forte void ql_restart_driver(ql_adapter_state_t *); 2517fcf3ce44SJohn Forte int ql_load_flash(ql_adapter_state_t *, uint8_t *, uint32_t); 2518fcf3ce44SJohn Forte int ql_get_dma_mem(ql_adapter_state_t *, dma_mem_t *, uint32_t, 2519fcf3ce44SJohn Forte mem_alloc_type_t, mem_alignment_t); 2520*4c3888b8SHans Rosenfeld void ql_free_dma_resource(ql_adapter_state_t *, dma_mem_t *); 2521fcf3ce44SJohn Forte int ql_alloc_phys(ql_adapter_state_t *, dma_mem_t *, int); 2522fcf3ce44SJohn Forte void ql_free_phys(ql_adapter_state_t *, dma_mem_t *); 2523fcf3ce44SJohn Forte void ql_24xx_protect_flash(ql_adapter_state_t *); 2524fcf3ce44SJohn Forte uint8_t ql_pci_config_get8(ql_adapter_state_t *, off_t); 2525fcf3ce44SJohn Forte void ql_pci_config_put32(ql_adapter_state_t *, off_t, uint32_t); 25265dfd244aSDaniel Beauregard int ql_24xx_unprotect_flash(ql_adapter_state_t *); 252716dd44c2SDaniel Beauregard char *els_cmd_text(int); 252816dd44c2SDaniel Beauregard char *mbx_cmd_text(int); 252916dd44c2SDaniel Beauregard char *cmd_text(cmd_table_t *, int); 2530fcf3ce44SJohn Forte uint32_t ql_fwmodule_resolve(ql_adapter_state_t *); 2531fcf3ce44SJohn Forte void ql_port_state(ql_adapter_state_t *, uint32_t, uint32_t); 25325dfd244aSDaniel Beauregard void ql_isp_els_handle_cmd_endian(ql_adapter_state_t *ha, ql_srb_t *srb); 25335dfd244aSDaniel Beauregard void ql_isp_els_handle_rsp_endian(ql_adapter_state_t *ha, ql_srb_t *srb); 25345dfd244aSDaniel Beauregard void ql_isp_els_handle_endian(ql_adapter_state_t *ha, uint8_t *ptr, 25355dfd244aSDaniel Beauregard uint8_t ls_code); 2536*4c3888b8SHans Rosenfeld void ql_el_trace_alloc(ql_adapter_state_t *); 2537*4c3888b8SHans Rosenfeld void ql_el_trace_dealloc(ql_adapter_state_t *); 2538eb82ff87SDaniel Beauregard int ql_nvram_cache_desc_ctor(ql_adapter_state_t *); 2539eb82ff87SDaniel Beauregard int ql_nvram_cache_desc_dtor(ql_adapter_state_t *); 2540*4c3888b8SHans Rosenfeld int ql_plogi_params_desc_ctor(ql_adapter_state_t *); 2541*4c3888b8SHans Rosenfeld int ql_plogi_params_desc_dtor(ql_adapter_state_t *); 25425dfd244aSDaniel Beauregard int ql_wwn_cmp(ql_adapter_state_t *, la_wwn_t *, la_wwn_t *); 25435dfd244aSDaniel Beauregard void ql_dev_free(ql_adapter_state_t *, ql_tgt_t *); 2544*4c3888b8SHans Rosenfeld void ql_restart_queues(ql_adapter_state_t *); 2545*4c3888b8SHans Rosenfeld void ql_abort_queues(ql_adapter_state_t *); 2546*4c3888b8SHans Rosenfeld void ql_requeue_pending_cmds(ql_adapter_state_t *, ql_tgt_t *); 2547*4c3888b8SHans Rosenfeld void ql_toggle_loop_state(ql_adapter_state_t *); 2548*4c3888b8SHans Rosenfeld void ql_els_24xx_iocb(ql_adapter_state_t *, ql_request_q_t *, ql_srb_t *, 2549*4c3888b8SHans Rosenfeld void *); 2550*4c3888b8SHans Rosenfeld int ql_get_cap_ofst(ql_adapter_state_t *, uint8_t); 2551*4c3888b8SHans Rosenfeld void ql_intr_lock(ql_adapter_state_t *); 2552*4c3888b8SHans Rosenfeld void ql_intr_unlock(ql_adapter_state_t *); 2553*4c3888b8SHans Rosenfeld void ql_io_comp(ql_srb_t *sp); 2554*4c3888b8SHans Rosenfeld uint64_t ql_get_lun_addr(ql_tgt_t *, uint16_t); 2555*4c3888b8SHans Rosenfeld int ql_2700_get_flash_dmp_template(ql_adapter_state_t *); 2556*4c3888b8SHans Rosenfeld int ql_2700_get_module_dmp_template(ql_adapter_state_t *); 2557fcf3ce44SJohn Forte 2558fcf3ce44SJohn Forte #ifdef __cplusplus 2559fcf3ce44SJohn Forte } 2560fcf3ce44SJohn Forte #endif 2561fcf3ce44SJohn Forte 2562fcf3ce44SJohn Forte #endif /* _QL_API_H */ 2563