Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * PMC-Sierra 8001/8081/8088/8089 SAS/SATA based host adapters driver
0003  *
0004  * Copyright (c) 2008-2009 USI Co., Ltd.
0005  * All rights reserved.
0006  *
0007  * Redistribution and use in source and binary forms, with or without
0008  * modification, are permitted provided that the following conditions
0009  * are met:
0010  * 1. Redistributions of source code must retain the above copyright
0011  *    notice, this list of conditions, and the following disclaimer,
0012  *    without modification.
0013  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
0014  *    substantially similar to the "NO WARRANTY" disclaimer below
0015  *    ("Disclaimer") and any redistribution must be conditioned upon
0016  *    including a substantially similar Disclaimer requirement for further
0017  *    binary redistribution.
0018  * 3. Neither the names of the above-listed copyright holders nor the names
0019  *    of any contributors may be used to endorse or promote products derived
0020  *    from this software without specific prior written permission.
0021  *
0022  * Alternatively, this software may be distributed under the terms of the
0023  * GNU General Public License ("GPL") version 2 as published by the Free
0024  * Software Foundation.
0025  *
0026  * NO WARRANTY
0027  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0028  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0029  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
0030  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0031  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0032  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0033  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0034  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
0035  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
0036  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0037  * POSSIBILITY OF SUCH DAMAGES.
0038  *
0039  */
0040 
0041 #ifndef _PM8001_DEFS_H_
0042 #define _PM8001_DEFS_H_
0043 
0044 enum chip_flavors {
0045     chip_8001,
0046     chip_8008,
0047     chip_8009,
0048     chip_8018,
0049     chip_8019,
0050     chip_8074,
0051     chip_8076,
0052     chip_8077,
0053     chip_8006,
0054     chip_8070,
0055     chip_8072
0056 };
0057 
0058 enum phy_speed {
0059     PHY_SPEED_15 = 0x01,
0060     PHY_SPEED_30 = 0x02,
0061     PHY_SPEED_60 = 0x04,
0062     PHY_SPEED_120 = 0x08,
0063 };
0064 
0065 enum data_direction {
0066     DATA_DIR_NONE = 0x0,    /* NO TRANSFER */
0067     DATA_DIR_IN = 0x01, /* INBOUND */
0068     DATA_DIR_OUT = 0x02,    /* OUTBOUND */
0069     DATA_DIR_BYRECIPIENT = 0x04, /* UNSPECIFIED */
0070 };
0071 
0072 enum port_type {
0073     PORT_TYPE_SAS = (1L << 1),
0074     PORT_TYPE_SATA = (1L << 0),
0075 };
0076 
0077 /* driver compile-time configuration */
0078 #define PM8001_MAX_CCB       1024   /* max ccbs supported */
0079 #define PM8001_MPI_QUEUE         1024   /* maximum mpi queue entries */
0080 #define PM8001_MAX_INB_NUM   64
0081 #define PM8001_MAX_OUTB_NUM  64
0082 #define PM8001_CAN_QUEUE     508    /* SCSI Queue depth */
0083 
0084 /* Inbound/Outbound queue size */
0085 #define IOMB_SIZE_SPC       64
0086 #define IOMB_SIZE_SPCV      128
0087 
0088 /* unchangeable hardware details */
0089 #define PM8001_MAX_PHYS      16 /* max. possible phys */
0090 #define PM8001_MAX_PORTS     16 /* max. possible ports */
0091 #define PM8001_MAX_DEVICES   2048   /* max supported device */
0092 #define PM8001_MAX_MSIX_VEC  64 /* max msi-x int for spcv/ve */
0093 #define PM8001_RESERVE_SLOT  8
0094 
0095 #define CONFIG_SCSI_PM8001_MAX_DMA_SG   528
0096 #define PM8001_MAX_DMA_SG   CONFIG_SCSI_PM8001_MAX_DMA_SG
0097 
0098 enum memory_region_num {
0099     AAP1 = 0x0, /* application acceleration processor */
0100     IOP,        /* IO processor */
0101     NVMD,       /* NVM device */
0102     FW_FLASH,    /* memory for fw flash update */
0103     FORENSIC_MEM,  /* memory for fw forensic data */
0104     USI_MAX_MEMCNT_BASE
0105 };
0106 #define PM8001_EVENT_LOG_SIZE    (128 * 1024)
0107 
0108 /**
0109  * maximum DMA memory regions(number of IBQ + number of IBQ CI
0110  * + number of  OBQ + number of OBQ PI)
0111  */
0112 #define USI_MAX_MEMCNT  (USI_MAX_MEMCNT_BASE + ((2 * PM8001_MAX_INB_NUM) \
0113             + (2 * PM8001_MAX_OUTB_NUM)))
0114 /*error code*/
0115 enum mpi_err {
0116     MPI_IO_STATUS_SUCCESS = 0x0,
0117     MPI_IO_STATUS_BUSY = 0x01,
0118     MPI_IO_STATUS_FAIL = 0x02,
0119 };
0120 
0121 /**
0122  * Phy Control constants
0123  */
0124 enum phy_control_type {
0125     PHY_LINK_RESET = 0x01,
0126     PHY_HARD_RESET = 0x02,
0127     PHY_NOTIFY_ENABLE_SPINUP = 0x10,
0128 };
0129 
0130 enum pm8001_hba_info_flags {
0131     PM8001F_INIT_TIME   = (1U << 0),
0132     PM8001F_RUN_TIME    = (1U << 1),
0133 };
0134 
0135 /**
0136  * Phy Status
0137  */
0138 #define PHY_LINK_DISABLE    0x00
0139 #define PHY_LINK_DOWN       0x01
0140 #define PHY_STATE_LINK_UP_SPCV  0x2
0141 #define PHY_STATE_LINK_UP_SPC   0x1
0142 
0143 #endif