jack wang | dbf9bfe | 2009-10-14 16:19:21 +0800 | [diff] [blame] | 1 | /* |
| 2 | * PMC-Sierra SPC 8001 SAS/SATA based host adapters driver |
| 3 | * |
| 4 | * Copyright (c) 2008-2009 USI Co., Ltd. |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions |
| 9 | * are met: |
| 10 | * 1. Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions, and the following disclaimer, |
| 12 | * without modification. |
| 13 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer |
| 14 | * substantially similar to the "NO WARRANTY" disclaimer below |
| 15 | * ("Disclaimer") and any redistribution must be conditioned upon |
| 16 | * including a substantially similar Disclaimer requirement for further |
| 17 | * binary redistribution. |
| 18 | * 3. Neither the names of the above-listed copyright holders nor the names |
| 19 | * of any contributors may be used to endorse or promote products derived |
| 20 | * from this software without specific prior written permission. |
| 21 | * |
| 22 | * Alternatively, this software may be distributed under the terms of the |
| 23 | * GNU General Public License ("GPL") version 2 as published by the Free |
| 24 | * Software Foundation. |
| 25 | * |
| 26 | * NO WARRANTY |
| 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR |
| 30 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 31 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 32 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 33 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 34 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 35 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 36 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 37 | * POSSIBILITY OF SUCH DAMAGES. |
| 38 | * |
| 39 | */ |
| 40 | |
| 41 | #ifndef _PM8001_DEFS_H_ |
| 42 | #define _PM8001_DEFS_H_ |
| 43 | |
| 44 | enum chip_flavors { |
| 45 | chip_8001, |
| 46 | }; |
| 47 | #define USI_MAX_MEMCNT 9 |
| 48 | #define PM8001_MAX_DMA_SG SG_ALL |
| 49 | enum phy_speed { |
| 50 | PHY_SPEED_15 = 0x01, |
| 51 | PHY_SPEED_30 = 0x02, |
| 52 | PHY_SPEED_60 = 0x04, |
| 53 | }; |
| 54 | |
| 55 | enum data_direction { |
| 56 | DATA_DIR_NONE = 0x0, /* NO TRANSFER */ |
| 57 | DATA_DIR_IN = 0x01, /* INBOUND */ |
| 58 | DATA_DIR_OUT = 0x02, /* OUTBOUND */ |
| 59 | DATA_DIR_BYRECIPIENT = 0x04, /* UNSPECIFIED */ |
| 60 | }; |
| 61 | |
| 62 | enum port_type { |
| 63 | PORT_TYPE_SAS = (1L << 1), |
| 64 | PORT_TYPE_SATA = (1L << 0), |
| 65 | }; |
| 66 | |
| 67 | /* driver compile-time configuration */ |
| 68 | #define PM8001_MAX_CCB 512 /* max ccbs supported */ |
| 69 | #define PM8001_MAX_INB_NUM 1 |
| 70 | #define PM8001_MAX_OUTB_NUM 1 |
| 71 | #define PM8001_CAN_QUEUE 128 /* SCSI Queue depth */ |
| 72 | |
| 73 | /* unchangeable hardware details */ |
| 74 | #define PM8001_MAX_PHYS 8 /* max. possible phys */ |
| 75 | #define PM8001_MAX_PORTS 8 /* max. possible ports */ |
| 76 | #define PM8001_MAX_DEVICES 1024 /* max supported device */ |
| 77 | |
| 78 | enum memory_region_num { |
| 79 | AAP1 = 0x0, /* application acceleration processor */ |
| 80 | IOP, /* IO processor */ |
| 81 | CI, /* consumer index */ |
| 82 | PI, /* producer index */ |
| 83 | IB, /* inbound queue */ |
| 84 | OB, /* outbound queue */ |
| 85 | NVMD, /* NVM device */ |
| 86 | DEV_MEM, /* memory for devices */ |
| 87 | CCB_MEM, /* memory for command control block */ |
| 88 | }; |
| 89 | #define PM8001_EVENT_LOG_SIZE (128 * 1024) |
| 90 | |
| 91 | /*error code*/ |
| 92 | enum mpi_err { |
| 93 | MPI_IO_STATUS_SUCCESS = 0x0, |
| 94 | MPI_IO_STATUS_BUSY = 0x01, |
| 95 | MPI_IO_STATUS_FAIL = 0x02, |
| 96 | }; |
| 97 | |
| 98 | /** |
| 99 | * Phy Control constants |
| 100 | */ |
| 101 | enum phy_control_type { |
| 102 | PHY_LINK_RESET = 0x01, |
| 103 | PHY_HARD_RESET = 0x02, |
| 104 | PHY_NOTIFY_ENABLE_SPINUP = 0x10, |
| 105 | }; |
| 106 | |
| 107 | enum pm8001_hba_info_flags { |
| 108 | PM8001F_INIT_TIME = (1U << 0), |
| 109 | PM8001F_RUN_TIME = (1U << 1), |
| 110 | }; |
| 111 | |
| 112 | #endif |