1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * This file is provided under a dual BSD/GPLv2 license. When using or 3*4882a593Smuzhiyun * redistributing this file, you may do so under either license. 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * GPL LICENSE SUMMARY 6*4882a593Smuzhiyun * 7*4882a593Smuzhiyun * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8*4882a593Smuzhiyun * 9*4882a593Smuzhiyun * This program is free software; you can redistribute it and/or modify 10*4882a593Smuzhiyun * it under the terms of version 2 of the GNU General Public License as 11*4882a593Smuzhiyun * published by the Free Software Foundation. 12*4882a593Smuzhiyun * 13*4882a593Smuzhiyun * This program is distributed in the hope that it will be useful, but 14*4882a593Smuzhiyun * WITHOUT ANY WARRANTY; without even the implied warranty of 15*4882a593Smuzhiyun * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16*4882a593Smuzhiyun * General Public License for more details. 17*4882a593Smuzhiyun * 18*4882a593Smuzhiyun * You should have received a copy of the GNU General Public License 19*4882a593Smuzhiyun * along with this program; if not, write to the Free Software 20*4882a593Smuzhiyun * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 21*4882a593Smuzhiyun * The full GNU General Public License is included in this distribution 22*4882a593Smuzhiyun * in the file called LICENSE.GPL. 23*4882a593Smuzhiyun * 24*4882a593Smuzhiyun * BSD LICENSE 25*4882a593Smuzhiyun * 26*4882a593Smuzhiyun * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 27*4882a593Smuzhiyun * All rights reserved. 28*4882a593Smuzhiyun * 29*4882a593Smuzhiyun * Redistribution and use in source and binary forms, with or without 30*4882a593Smuzhiyun * modification, are permitted provided that the following conditions 31*4882a593Smuzhiyun * are met: 32*4882a593Smuzhiyun * 33*4882a593Smuzhiyun * * Redistributions of source code must retain the above copyright 34*4882a593Smuzhiyun * notice, this list of conditions and the following disclaimer. 35*4882a593Smuzhiyun * * Redistributions in binary form must reproduce the above copyright 36*4882a593Smuzhiyun * notice, this list of conditions and the following disclaimer in 37*4882a593Smuzhiyun * the documentation and/or other materials provided with the 38*4882a593Smuzhiyun * distribution. 39*4882a593Smuzhiyun * * Neither the name of Intel Corporation nor the names of its 40*4882a593Smuzhiyun * contributors may be used to endorse or promote products derived 41*4882a593Smuzhiyun * from this software without specific prior written permission. 42*4882a593Smuzhiyun * 43*4882a593Smuzhiyun * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 44*4882a593Smuzhiyun * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 45*4882a593Smuzhiyun * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 46*4882a593Smuzhiyun * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 47*4882a593Smuzhiyun * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 48*4882a593Smuzhiyun * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 49*4882a593Smuzhiyun * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 50*4882a593Smuzhiyun * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 51*4882a593Smuzhiyun * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 52*4882a593Smuzhiyun * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 53*4882a593Smuzhiyun * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 54*4882a593Smuzhiyun */ 55*4882a593Smuzhiyun #ifndef _ISCI_PROBE_ROMS_H_ 56*4882a593Smuzhiyun #define _ISCI_PROBE_ROMS_H_ 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun #ifdef __KERNEL__ 59*4882a593Smuzhiyun #include <linux/firmware.h> 60*4882a593Smuzhiyun #include <linux/pci.h> 61*4882a593Smuzhiyun #include <linux/efi.h> 62*4882a593Smuzhiyun #include "isci.h" 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun #define SCIC_SDS_PARM_NO_SPEED 0 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun /* generation 1 (i.e. 1.5 Gb/s) */ 67*4882a593Smuzhiyun #define SCIC_SDS_PARM_GEN1_SPEED 1 68*4882a593Smuzhiyun 69*4882a593Smuzhiyun /* generation 2 (i.e. 3.0 Gb/s) */ 70*4882a593Smuzhiyun #define SCIC_SDS_PARM_GEN2_SPEED 2 71*4882a593Smuzhiyun 72*4882a593Smuzhiyun /* generation 3 (i.e. 6.0 Gb/s) */ 73*4882a593Smuzhiyun #define SCIC_SDS_PARM_GEN3_SPEED 3 74*4882a593Smuzhiyun #define SCIC_SDS_PARM_MAX_SPEED SCIC_SDS_PARM_GEN3_SPEED 75*4882a593Smuzhiyun 76*4882a593Smuzhiyun /* parameters that can be set by module parameters */ 77*4882a593Smuzhiyun struct sci_user_parameters { 78*4882a593Smuzhiyun struct sci_phy_user_params { 79*4882a593Smuzhiyun /** 80*4882a593Smuzhiyun * This field specifies the NOTIFY (ENABLE SPIN UP) primitive 81*4882a593Smuzhiyun * insertion frequency for this phy index. 82*4882a593Smuzhiyun */ 83*4882a593Smuzhiyun u32 notify_enable_spin_up_insertion_frequency; 84*4882a593Smuzhiyun 85*4882a593Smuzhiyun /** 86*4882a593Smuzhiyun * This method specifies the number of transmitted DWORDs within which 87*4882a593Smuzhiyun * to transmit a single ALIGN primitive. This value applies regardless 88*4882a593Smuzhiyun * of what type of device is attached or connection state. A value of 89*4882a593Smuzhiyun * 0 indicates that no ALIGN primitives will be inserted. 90*4882a593Smuzhiyun */ 91*4882a593Smuzhiyun u16 align_insertion_frequency; 92*4882a593Smuzhiyun 93*4882a593Smuzhiyun /** 94*4882a593Smuzhiyun * This method specifies the number of transmitted DWORDs within which 95*4882a593Smuzhiyun * to transmit 2 ALIGN primitives. This applies for SAS connections 96*4882a593Smuzhiyun * only. A minimum value of 3 is required for this field. 97*4882a593Smuzhiyun */ 98*4882a593Smuzhiyun u16 in_connection_align_insertion_frequency; 99*4882a593Smuzhiyun 100*4882a593Smuzhiyun /** 101*4882a593Smuzhiyun * This field indicates the maximum speed generation to be utilized 102*4882a593Smuzhiyun * by phys in the supplied port. 103*4882a593Smuzhiyun * - A value of 1 indicates generation 1 (i.e. 1.5 Gb/s). 104*4882a593Smuzhiyun * - A value of 2 indicates generation 2 (i.e. 3.0 Gb/s). 105*4882a593Smuzhiyun * - A value of 3 indicates generation 3 (i.e. 6.0 Gb/s). 106*4882a593Smuzhiyun */ 107*4882a593Smuzhiyun u8 max_speed_generation; 108*4882a593Smuzhiyun 109*4882a593Smuzhiyun } phys[SCI_MAX_PHYS]; 110*4882a593Smuzhiyun 111*4882a593Smuzhiyun /** 112*4882a593Smuzhiyun * This field specifies the maximum number of direct attached devices 113*4882a593Smuzhiyun * that can have power supplied to them simultaneously. 114*4882a593Smuzhiyun */ 115*4882a593Smuzhiyun u8 max_concurr_spinup; 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun /** 118*4882a593Smuzhiyun * This field specifies the number of seconds to allow a phy to consume 119*4882a593Smuzhiyun * power before yielding to another phy. 120*4882a593Smuzhiyun * 121*4882a593Smuzhiyun */ 122*4882a593Smuzhiyun u8 phy_spin_up_delay_interval; 123*4882a593Smuzhiyun 124*4882a593Smuzhiyun /** 125*4882a593Smuzhiyun * These timer values specifies how long a link will remain open with no 126*4882a593Smuzhiyun * activity in increments of a microsecond, it can be in increments of 127*4882a593Smuzhiyun * 100 microseconds if the upper most bit is set. 128*4882a593Smuzhiyun * 129*4882a593Smuzhiyun */ 130*4882a593Smuzhiyun u16 stp_inactivity_timeout; 131*4882a593Smuzhiyun u16 ssp_inactivity_timeout; 132*4882a593Smuzhiyun 133*4882a593Smuzhiyun /** 134*4882a593Smuzhiyun * These timer values specifies how long a link will remain open in increments 135*4882a593Smuzhiyun * of 100 microseconds. 136*4882a593Smuzhiyun * 137*4882a593Smuzhiyun */ 138*4882a593Smuzhiyun u16 stp_max_occupancy_timeout; 139*4882a593Smuzhiyun u16 ssp_max_occupancy_timeout; 140*4882a593Smuzhiyun 141*4882a593Smuzhiyun /** 142*4882a593Smuzhiyun * This timer value specifies how long a link will remain open with no 143*4882a593Smuzhiyun * outbound traffic in increments of a microsecond. 144*4882a593Smuzhiyun * 145*4882a593Smuzhiyun */ 146*4882a593Smuzhiyun u8 no_outbound_task_timeout; 147*4882a593Smuzhiyun 148*4882a593Smuzhiyun }; 149*4882a593Smuzhiyun 150*4882a593Smuzhiyun #define SCIC_SDS_PARM_PHY_MASK_MIN 0x0 151*4882a593Smuzhiyun #define SCIC_SDS_PARM_PHY_MASK_MAX 0xF 152*4882a593Smuzhiyun #define MAX_CONCURRENT_DEVICE_SPIN_UP_COUNT 4 153*4882a593Smuzhiyun 154*4882a593Smuzhiyun struct sci_oem_params; 155*4882a593Smuzhiyun int sci_oem_parameters_validate(struct sci_oem_params *oem, u8 version); 156*4882a593Smuzhiyun 157*4882a593Smuzhiyun struct isci_orom; 158*4882a593Smuzhiyun struct isci_orom *isci_request_oprom(struct pci_dev *pdev); 159*4882a593Smuzhiyun struct isci_orom *isci_request_firmware(struct pci_dev *pdev, const struct firmware *fw); 160*4882a593Smuzhiyun struct isci_orom *isci_get_efi_var(struct pci_dev *pdev); 161*4882a593Smuzhiyun 162*4882a593Smuzhiyun struct isci_oem_hdr { 163*4882a593Smuzhiyun u8 sig[4]; 164*4882a593Smuzhiyun u8 rev_major; 165*4882a593Smuzhiyun u8 rev_minor; 166*4882a593Smuzhiyun u16 len; 167*4882a593Smuzhiyun u8 checksum; 168*4882a593Smuzhiyun u8 reserved1; 169*4882a593Smuzhiyun u16 reserved2; 170*4882a593Smuzhiyun } __attribute__ ((packed)); 171*4882a593Smuzhiyun 172*4882a593Smuzhiyun #else 173*4882a593Smuzhiyun #define SCI_MAX_PORTS 4 174*4882a593Smuzhiyun #define SCI_MAX_PHYS 4 175*4882a593Smuzhiyun #define SCI_MAX_CONTROLLERS 2 176*4882a593Smuzhiyun #endif 177*4882a593Smuzhiyun 178*4882a593Smuzhiyun #define ISCI_FW_NAME "isci/isci_firmware.bin" 179*4882a593Smuzhiyun 180*4882a593Smuzhiyun #define ROMSIGNATURE 0xaa55 181*4882a593Smuzhiyun 182*4882a593Smuzhiyun #define ISCI_OEM_SIG "$OEM" 183*4882a593Smuzhiyun #define ISCI_OEM_SIG_SIZE 4 184*4882a593Smuzhiyun #define ISCI_ROM_SIG "ISCUOEMB" 185*4882a593Smuzhiyun #define ISCI_ROM_SIG_SIZE 8 186*4882a593Smuzhiyun 187*4882a593Smuzhiyun #define ISCI_EFI_VENDOR_GUID \ 188*4882a593Smuzhiyun EFI_GUID(0x193dfefa, 0xa445, 0x4302, 0x99, 0xd8, 0xef, 0x3a, 0xad, \ 189*4882a593Smuzhiyun 0x1a, 0x04, 0xc6) 190*4882a593Smuzhiyun #define ISCI_EFI_VAR_NAME "RstScuO" 191*4882a593Smuzhiyun 192*4882a593Smuzhiyun #define ISCI_ROM_VER_1_0 0x10 193*4882a593Smuzhiyun #define ISCI_ROM_VER_1_1 0x11 194*4882a593Smuzhiyun #define ISCI_ROM_VER_1_3 0x13 195*4882a593Smuzhiyun #define ISCI_ROM_VER_LATEST ISCI_ROM_VER_1_3 196*4882a593Smuzhiyun 197*4882a593Smuzhiyun /* Allowed PORT configuration modes APC Automatic PORT configuration mode is 198*4882a593Smuzhiyun * defined by the OEM configuration parameters providing no PHY_MASK parameters 199*4882a593Smuzhiyun * for any PORT. i.e. There are no phys assigned to any of the ports at start. 200*4882a593Smuzhiyun * MPC Manual PORT configuration mode is defined by the OEM configuration 201*4882a593Smuzhiyun * parameters providing a PHY_MASK value for any PORT. It is assumed that any 202*4882a593Smuzhiyun * PORT with no PHY_MASK is an invalid port and not all PHYs must be assigned. 203*4882a593Smuzhiyun * A PORT_PHY mask that assigns just a single PHY to a port and no other PHYs 204*4882a593Smuzhiyun * being assigned is sufficient to declare manual PORT configuration. 205*4882a593Smuzhiyun */ 206*4882a593Smuzhiyun enum sci_port_configuration_mode { 207*4882a593Smuzhiyun SCIC_PORT_MANUAL_CONFIGURATION_MODE = 0, 208*4882a593Smuzhiyun SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE = 1 209*4882a593Smuzhiyun }; 210*4882a593Smuzhiyun 211*4882a593Smuzhiyun struct sci_bios_oem_param_block_hdr { 212*4882a593Smuzhiyun uint8_t signature[ISCI_ROM_SIG_SIZE]; 213*4882a593Smuzhiyun uint16_t total_block_length; 214*4882a593Smuzhiyun uint8_t hdr_length; 215*4882a593Smuzhiyun uint8_t version; 216*4882a593Smuzhiyun uint8_t preboot_source; 217*4882a593Smuzhiyun uint8_t num_elements; 218*4882a593Smuzhiyun uint16_t element_length; 219*4882a593Smuzhiyun uint8_t reserved[8]; 220*4882a593Smuzhiyun } __attribute__ ((packed)); 221*4882a593Smuzhiyun 222*4882a593Smuzhiyun struct sci_oem_params { 223*4882a593Smuzhiyun struct { 224*4882a593Smuzhiyun uint8_t mode_type; 225*4882a593Smuzhiyun uint8_t max_concurr_spin_up; 226*4882a593Smuzhiyun /* 227*4882a593Smuzhiyun * This bitfield indicates the OEM's desired default Tx 228*4882a593Smuzhiyun * Spread Spectrum Clocking (SSC) settings for SATA and SAS. 229*4882a593Smuzhiyun * NOTE: Default SSC Modulation Frequency is 31.5KHz. 230*4882a593Smuzhiyun */ 231*4882a593Smuzhiyun union { 232*4882a593Smuzhiyun struct { 233*4882a593Smuzhiyun /* 234*4882a593Smuzhiyun * NOTE: Max spread for SATA is +0 / -5000 PPM. 235*4882a593Smuzhiyun * Down-spreading SSC (only method allowed for SATA): 236*4882a593Smuzhiyun * SATA SSC Tx Disabled = 0x0 237*4882a593Smuzhiyun * SATA SSC Tx at +0 / -1419 PPM Spread = 0x2 238*4882a593Smuzhiyun * SATA SSC Tx at +0 / -2129 PPM Spread = 0x3 239*4882a593Smuzhiyun * SATA SSC Tx at +0 / -4257 PPM Spread = 0x6 240*4882a593Smuzhiyun * SATA SSC Tx at +0 / -4967 PPM Spread = 0x7 241*4882a593Smuzhiyun */ 242*4882a593Smuzhiyun uint8_t ssc_sata_tx_spread_level:4; 243*4882a593Smuzhiyun /* 244*4882a593Smuzhiyun * SAS SSC Tx Disabled = 0x0 245*4882a593Smuzhiyun * 246*4882a593Smuzhiyun * NOTE: Max spread for SAS down-spreading +0 / 247*4882a593Smuzhiyun * -2300 PPM 248*4882a593Smuzhiyun * Down-spreading SSC: 249*4882a593Smuzhiyun * SAS SSC Tx at +0 / -1419 PPM Spread = 0x2 250*4882a593Smuzhiyun * SAS SSC Tx at +0 / -2129 PPM Spread = 0x3 251*4882a593Smuzhiyun * 252*4882a593Smuzhiyun * NOTE: Max spread for SAS center-spreading +2300 / 253*4882a593Smuzhiyun * -2300 PPM 254*4882a593Smuzhiyun * Center-spreading SSC: 255*4882a593Smuzhiyun * SAS SSC Tx at +1064 / -1064 PPM Spread = 0x3 256*4882a593Smuzhiyun * SAS SSC Tx at +2129 / -2129 PPM Spread = 0x6 257*4882a593Smuzhiyun */ 258*4882a593Smuzhiyun uint8_t ssc_sas_tx_spread_level:3; 259*4882a593Smuzhiyun /* 260*4882a593Smuzhiyun * NOTE: Refer to the SSC section of the SAS 2.x 261*4882a593Smuzhiyun * Specification for proper setting of this field. 262*4882a593Smuzhiyun * For standard SAS Initiator SAS PHY operation it 263*4882a593Smuzhiyun * should be 0 for Down-spreading. 264*4882a593Smuzhiyun * SAS SSC Tx spread type: 265*4882a593Smuzhiyun * Down-spreading SSC = 0 266*4882a593Smuzhiyun * Center-spreading SSC = 1 267*4882a593Smuzhiyun */ 268*4882a593Smuzhiyun uint8_t ssc_sas_tx_type:1; 269*4882a593Smuzhiyun }; 270*4882a593Smuzhiyun uint8_t do_enable_ssc; 271*4882a593Smuzhiyun }; 272*4882a593Smuzhiyun /* 273*4882a593Smuzhiyun * This field indicates length of the SAS/SATA cable between 274*4882a593Smuzhiyun * host and device. 275*4882a593Smuzhiyun * This field is used make relationship between analog 276*4882a593Smuzhiyun * parameters of the phy in the silicon and length of the cable. 277*4882a593Smuzhiyun * Supported cable attenuation levels: 278*4882a593Smuzhiyun * "short"- up to 3m, "medium"-3m to 6m, and "long"- more than 279*4882a593Smuzhiyun * 6m. 280*4882a593Smuzhiyun * 281*4882a593Smuzhiyun * This is bit mask field: 282*4882a593Smuzhiyun * 283*4882a593Smuzhiyun * BIT: (MSB) 7 6 5 4 284*4882a593Smuzhiyun * ASSIGNMENT: <phy3><phy2><phy1><phy0> - Medium cable 285*4882a593Smuzhiyun * length assignment 286*4882a593Smuzhiyun * BIT: 3 2 1 0 (LSB) 287*4882a593Smuzhiyun * ASSIGNMENT: <phy3><phy2><phy1><phy0> - Long cable length 288*4882a593Smuzhiyun * assignment 289*4882a593Smuzhiyun * 290*4882a593Smuzhiyun * BITS 7-4 are set when the cable length is assigned to medium 291*4882a593Smuzhiyun * BITS 3-0 are set when the cable length is assigned to long 292*4882a593Smuzhiyun * 293*4882a593Smuzhiyun * The BIT positions are clear when the cable length is 294*4882a593Smuzhiyun * assigned to short. 295*4882a593Smuzhiyun * 296*4882a593Smuzhiyun * Setting the bits for both long and medium cable length is 297*4882a593Smuzhiyun * undefined. 298*4882a593Smuzhiyun * 299*4882a593Smuzhiyun * A value of 0x84 would assign 300*4882a593Smuzhiyun * phy3 - medium 301*4882a593Smuzhiyun * phy2 - long 302*4882a593Smuzhiyun * phy1 - short 303*4882a593Smuzhiyun * phy0 - short 304*4882a593Smuzhiyun */ 305*4882a593Smuzhiyun uint8_t cable_selection_mask; 306*4882a593Smuzhiyun } controller; 307*4882a593Smuzhiyun 308*4882a593Smuzhiyun struct { 309*4882a593Smuzhiyun uint8_t phy_mask; 310*4882a593Smuzhiyun } ports[SCI_MAX_PORTS]; 311*4882a593Smuzhiyun 312*4882a593Smuzhiyun struct sci_phy_oem_params { 313*4882a593Smuzhiyun struct { 314*4882a593Smuzhiyun uint32_t high; 315*4882a593Smuzhiyun uint32_t low; 316*4882a593Smuzhiyun } sas_address; 317*4882a593Smuzhiyun 318*4882a593Smuzhiyun uint32_t afe_tx_amp_control0; 319*4882a593Smuzhiyun uint32_t afe_tx_amp_control1; 320*4882a593Smuzhiyun uint32_t afe_tx_amp_control2; 321*4882a593Smuzhiyun uint32_t afe_tx_amp_control3; 322*4882a593Smuzhiyun } phys[SCI_MAX_PHYS]; 323*4882a593Smuzhiyun } __attribute__ ((packed)); 324*4882a593Smuzhiyun 325*4882a593Smuzhiyun struct isci_orom { 326*4882a593Smuzhiyun struct sci_bios_oem_param_block_hdr hdr; 327*4882a593Smuzhiyun struct sci_oem_params ctrl[SCI_MAX_CONTROLLERS]; 328*4882a593Smuzhiyun } __attribute__ ((packed)); 329*4882a593Smuzhiyun 330*4882a593Smuzhiyun #endif 331