^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * This file is provided under a dual BSD/GPLv2 license. When using or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * redistributing this file, you may do so under either license.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * GPL LICENSE SUMMARY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * This program is free software; you can redistribute it and/or modify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * it under the terms of version 2 of the GNU General Public License as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * published by the Free Software Foundation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * This program is distributed in the hope that it will be useful, but
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * WITHOUT ANY WARRANTY; without even the implied warranty of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * General Public License for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * You should have received a copy of the GNU General Public License
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * along with this program; if not, write to the Free Software
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * The full GNU General Public License is included in this distribution
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * in the file called LICENSE.GPL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * BSD LICENSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * Redistribution and use in source and binary forms, with or without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) * modification, are permitted provided that the following conditions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * are met:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * * Redistributions of source code must retain the above copyright
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * notice, this list of conditions and the following disclaimer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * * Redistributions in binary form must reproduce the above copyright
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * notice, this list of conditions and the following disclaimer in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * the documentation and/or other materials provided with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * distribution.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * * Neither the name of Intel Corporation nor the names of its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * contributors may be used to endorse or promote products derived
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * from this software without specific prior written permission.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #ifndef __ISCI_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #define __ISCI_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #define DRV_NAME "isci"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #define SCI_PCI_BAR_COUNT 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define SCI_NUM_MSI_X_INT 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #define SCI_SMU_BAR 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #define SCI_SMU_BAR_SIZE (16*1024)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #define SCI_SCU_BAR 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #define SCI_SCU_BAR_SIZE (4*1024*1024)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #define SCI_IO_SPACE_BAR0 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #define SCI_IO_SPACE_BAR1 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) #define ISCI_CAN_QUEUE_VAL 250 /* < SCI_MAX_IO_REQUESTS ? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #define SCIC_CONTROLLER_STOP_TIMEOUT 5000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #define SCI_CONTROLLER_INVALID_IO_TAG 0xFFFF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #define SCI_MAX_PHYS (4UL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #define SCI_MAX_PORTS SCI_MAX_PHYS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #define SCI_MAX_SMP_PHYS (384) /* not silicon constrained */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #define SCI_MAX_REMOTE_DEVICES (256UL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #define SCI_MAX_IO_REQUESTS (256UL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #define SCI_MAX_SEQ (16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) #define SCI_MAX_MSIX_MESSAGES (2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #define SCI_MAX_SCATTER_GATHER_ELEMENTS 130 /* not silicon constrained */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define SCI_MAX_CONTROLLERS 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #define SCI_MAX_DOMAINS SCI_MAX_PORTS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #define SCU_MAX_CRITICAL_NOTIFICATIONS (384)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) #define SCU_MAX_EVENTS_SHIFT (7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #define SCU_MAX_EVENTS (1 << SCU_MAX_EVENTS_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #define SCU_MAX_UNSOLICITED_FRAMES (128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #define SCU_MAX_COMPLETION_QUEUE_SCRATCH (128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #define SCU_MAX_COMPLETION_QUEUE_ENTRIES (SCU_MAX_CRITICAL_NOTIFICATIONS \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) + SCU_MAX_EVENTS \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) + SCU_MAX_UNSOLICITED_FRAMES \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) + SCI_MAX_IO_REQUESTS \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) + SCU_MAX_COMPLETION_QUEUE_SCRATCH)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) #define SCU_MAX_COMPLETION_QUEUE_SHIFT (ilog2(SCU_MAX_COMPLETION_QUEUE_ENTRIES))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #define SCU_ABSOLUTE_MAX_UNSOLICITED_FRAMES (4096)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define SCU_UNSOLICITED_FRAME_BUFFER_SIZE (1024U)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #define SCU_INVALID_FRAME_INDEX (0xFFFF)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define SCU_IO_REQUEST_MAX_SGE_SIZE (0x00FFFFFF)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) #define SCU_IO_REQUEST_MAX_TRANSFER_LENGTH (0x00FFFFFF)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) static inline void check_sizes(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) BUILD_BUG_ON_NOT_POWER_OF_2(SCU_MAX_EVENTS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) BUILD_BUG_ON(SCU_MAX_UNSOLICITED_FRAMES <= 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) BUILD_BUG_ON_NOT_POWER_OF_2(SCU_MAX_UNSOLICITED_FRAMES);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) BUILD_BUG_ON_NOT_POWER_OF_2(SCU_MAX_COMPLETION_QUEUE_ENTRIES);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) BUILD_BUG_ON(SCU_MAX_UNSOLICITED_FRAMES > SCU_ABSOLUTE_MAX_UNSOLICITED_FRAMES);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) BUILD_BUG_ON_NOT_POWER_OF_2(SCI_MAX_IO_REQUESTS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) BUILD_BUG_ON_NOT_POWER_OF_2(SCI_MAX_SEQ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) * enum sci_status - This is the general return status enumeration for non-IO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) * non-task management related SCI interface methods.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) enum sci_status {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * This member indicates successful completion.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) SCI_SUCCESS = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) * This value indicates that the calling method completed successfully,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * but that the IO may have completed before having it's start method
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * invoked. This occurs during SAT translation for requests that do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * not require an IO to the target or for any other requests that may
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) * be completed without having to submit IO.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) SCI_SUCCESS_IO_COMPLETE_BEFORE_START,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * This Value indicates that the SCU hardware returned an early response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * because the io request specified more data than is returned by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) * target device (mode pages, inquiry data, etc.). The completion routine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) * will handle this case to get the actual number of bytes transferred.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) SCI_SUCCESS_IO_DONE_EARLY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) * This member indicates that the object for which a state change is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) * being requested is already in said state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) SCI_WARNING_ALREADY_IN_STATE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) * This member indicates interrupt coalescence timer may cause SAS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) * specification compliance issues (i.e. SMP target mode response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) * frames must be returned within 1.9 milliseconds).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) SCI_WARNING_TIMER_CONFLICT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) * This field indicates a sequence of action is not completed yet. Mostly,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) * this status is used when multiple ATA commands are needed in a SATI translation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) SCI_WARNING_SEQUENCE_INCOMPLETE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) * This member indicates that there was a general failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) SCI_FAILURE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) * This member indicates that the SCI implementation is unable to complete
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) * an operation due to a critical flaw the prevents any further operation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) * (i.e. an invalid pointer).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) SCI_FATAL_ERROR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) * This member indicates the calling function failed, because the state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) * of the controller is in a state that prevents successful completion.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) SCI_FAILURE_INVALID_STATE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * This member indicates the calling function failed, because there is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) * insufficient resources/memory to complete the request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) SCI_FAILURE_INSUFFICIENT_RESOURCES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) * This member indicates the calling function failed, because the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) * controller object required for the operation can't be located.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) SCI_FAILURE_CONTROLLER_NOT_FOUND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) * This member indicates the calling function failed, because the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) * discovered controller type is not supported by the library.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) SCI_FAILURE_UNSUPPORTED_CONTROLLER_TYPE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) * This member indicates the calling function failed, because the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) * requested initialization data version isn't supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) SCI_FAILURE_UNSUPPORTED_INIT_DATA_VERSION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) * This member indicates the calling function failed, because the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) * requested configuration of SAS Phys into SAS Ports is not supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) * This member indicates the calling function failed, because the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) * requested protocol is not supported by the remote device, port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) * or controller.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) SCI_FAILURE_UNSUPPORTED_PROTOCOL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) * This member indicates the calling function failed, because the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) * requested information type is not supported by the SCI implementation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) SCI_FAILURE_UNSUPPORTED_INFORMATION_TYPE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) * This member indicates the calling function failed, because the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) * device already exists.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) SCI_FAILURE_DEVICE_EXISTS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) * This member indicates the calling function failed, because adding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) * a phy to the object is not possible.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) SCI_FAILURE_ADDING_PHY_UNSUPPORTED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) * This member indicates the calling function failed, because the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) * requested information type is not supported by the SCI implementation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) SCI_FAILURE_UNSUPPORTED_INFORMATION_FIELD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) * This member indicates the calling function failed, because the SCI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) * implementation does not support the supplied time limit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) SCI_FAILURE_UNSUPPORTED_TIME_LIMIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) * This member indicates the calling method failed, because the SCI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) * implementation does not contain the specified Phy.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) SCI_FAILURE_INVALID_PHY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) * This member indicates the calling method failed, because the SCI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) * implementation does not contain the specified Port.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) SCI_FAILURE_INVALID_PORT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) * This member indicates the calling method was partly successful
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) * The port was reset but not all phys in port are operational
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) SCI_FAILURE_RESET_PORT_PARTIAL_SUCCESS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) * This member indicates that calling method failed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) * The port reset did not complete because none of the phys are operational
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) SCI_FAILURE_RESET_PORT_FAILURE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) * This member indicates the calling method failed, because the SCI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) * implementation does not contain the specified remote device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) SCI_FAILURE_INVALID_REMOTE_DEVICE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) * This member indicates the calling method failed, because the remote
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) * device is in a bad state and requires a reset.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) * This member indicates the calling method failed, because the SCI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) * implementation does not contain or support the specified IO tag.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) SCI_FAILURE_INVALID_IO_TAG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) * This member indicates that the operation failed and the user should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) * check the response data associated with the IO.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) SCI_FAILURE_IO_RESPONSE_VALID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) * This member indicates that the operation failed, the failure is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) * controller implementation specific, and the response data associated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) * with the request is not valid. You can query for the controller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) * specific error information via sci_controller_get_request_status()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) * This member indicated that the operation failed because the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) * user requested this IO to be terminated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) SCI_FAILURE_IO_TERMINATED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) * This member indicates that the operation failed and the associated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) * request requires a SCSI abort task to be sent to the target.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) SCI_FAILURE_IO_REQUIRES_SCSI_ABORT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) * This member indicates that the operation failed because the supplied
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) * device could not be located.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) SCI_FAILURE_DEVICE_NOT_FOUND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) * This member indicates that the operation failed because the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) * objects association is required and is not correctly set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) SCI_FAILURE_INVALID_ASSOCIATION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) * This member indicates that the operation failed, because a timeout
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) * occurred.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) SCI_FAILURE_TIMEOUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) * This member indicates that the operation failed, because the user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) * specified a value that is either invalid or not supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) SCI_FAILURE_INVALID_PARAMETER_VALUE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) * This value indicates that the operation failed, because the number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) * of messages (MSI-X) is not supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) SCI_FAILURE_UNSUPPORTED_MESSAGE_COUNT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) * This value indicates that the method failed due to a lack of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) * available NCQ tags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) SCI_FAILURE_NO_NCQ_TAG_AVAILABLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) * This value indicates that a protocol violation has occurred on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) * link.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) SCI_FAILURE_PROTOCOL_VIOLATION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) * This value indicates a failure condition that retry may help to clear.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) SCI_FAILURE_RETRY_REQUIRED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) * This field indicates the retry limit was reached when a retry is attempted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) SCI_FAILURE_RETRY_LIMIT_REACHED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) * This member indicates the calling method was partly successful.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) * Mostly, this status is used when a LUN_RESET issued to an expander attached
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) * STP device in READY NCQ substate needs to have RNC suspended/resumed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) * before posting TC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) * This field indicates an illegal phy connection based on the routing attribute
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) * of both expander phy attached to each other.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) SCI_FAILURE_ILLEGAL_ROUTING_ATTRIBUTE_CONFIGURATION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) * This field indicates a CONFIG ROUTE INFO command has a response with function result
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) * INDEX DOES NOT EXIST, usually means exceeding max route index.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) SCI_FAILURE_EXCEED_MAX_ROUTE_INDEX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) * This value indicates that an unsupported PCI device ID has been
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) * specified. This indicates that attempts to invoke
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) * sci_library_allocate_controller() will fail.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) SCI_FAILURE_UNSUPPORTED_PCI_DEVICE_ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) * enum sci_io_status - This enumeration depicts all of the possible IO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) * completion status values. Each value in this enumeration maps directly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) * to a value in the enum sci_status enumeration. Please refer to that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) * enumeration for detailed comments concerning what the status represents.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) * Add the API to retrieve the SCU status from the core. Check to see that the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) * following status are properly handled: - SCI_IO_FAILURE_UNSUPPORTED_PROTOCOL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) * - SCI_IO_FAILURE_INVALID_IO_TAG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) enum sci_io_status {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) SCI_IO_SUCCESS = SCI_SUCCESS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) SCI_IO_FAILURE = SCI_FAILURE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) SCI_IO_SUCCESS_COMPLETE_BEFORE_START = SCI_SUCCESS_IO_COMPLETE_BEFORE_START,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) SCI_IO_SUCCESS_IO_DONE_EARLY = SCI_SUCCESS_IO_DONE_EARLY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) SCI_IO_FAILURE_INVALID_STATE = SCI_FAILURE_INVALID_STATE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) SCI_IO_FAILURE_INSUFFICIENT_RESOURCES = SCI_FAILURE_INSUFFICIENT_RESOURCES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) SCI_IO_FAILURE_UNSUPPORTED_PROTOCOL = SCI_FAILURE_UNSUPPORTED_PROTOCOL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) SCI_IO_FAILURE_RESPONSE_VALID = SCI_FAILURE_IO_RESPONSE_VALID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) SCI_IO_FAILURE_CONTROLLER_SPECIFIC_ERR = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) SCI_IO_FAILURE_TERMINATED = SCI_FAILURE_IO_TERMINATED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) SCI_IO_FAILURE_REQUIRES_SCSI_ABORT = SCI_FAILURE_IO_REQUIRES_SCSI_ABORT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) SCI_IO_FAILURE_INVALID_PARAMETER_VALUE = SCI_FAILURE_INVALID_PARAMETER_VALUE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) SCI_IO_FAILURE_NO_NCQ_TAG_AVAILABLE = SCI_FAILURE_NO_NCQ_TAG_AVAILABLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) SCI_IO_FAILURE_PROTOCOL_VIOLATION = SCI_FAILURE_PROTOCOL_VIOLATION,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) SCI_IO_FAILURE_REMOTE_DEVICE_RESET_REQUIRED = SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) SCI_IO_FAILURE_RETRY_REQUIRED = SCI_FAILURE_RETRY_REQUIRED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) SCI_IO_FAILURE_RETRY_LIMIT_REACHED = SCI_FAILURE_RETRY_LIMIT_REACHED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) SCI_IO_FAILURE_INVALID_REMOTE_DEVICE = SCI_FAILURE_INVALID_REMOTE_DEVICE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) * enum sci_task_status - This enumeration depicts all of the possible task
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) * completion status values. Each value in this enumeration maps directly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) * to a value in the enum sci_status enumeration. Please refer to that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) * enumeration for detailed comments concerning what the status represents.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) * Check to see that the following status are properly handled:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) enum sci_task_status {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) SCI_TASK_SUCCESS = SCI_SUCCESS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) SCI_TASK_FAILURE = SCI_FAILURE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) SCI_TASK_FAILURE_INVALID_STATE = SCI_FAILURE_INVALID_STATE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) SCI_TASK_FAILURE_INSUFFICIENT_RESOURCES = SCI_FAILURE_INSUFFICIENT_RESOURCES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) SCI_TASK_FAILURE_UNSUPPORTED_PROTOCOL = SCI_FAILURE_UNSUPPORTED_PROTOCOL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) SCI_TASK_FAILURE_INVALID_TAG = SCI_FAILURE_INVALID_IO_TAG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) SCI_TASK_FAILURE_RESPONSE_VALID = SCI_FAILURE_IO_RESPONSE_VALID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) SCI_TASK_FAILURE_CONTROLLER_SPECIFIC_ERR = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) SCI_TASK_FAILURE_TERMINATED = SCI_FAILURE_IO_TERMINATED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) SCI_TASK_FAILURE_INVALID_PARAMETER_VALUE = SCI_FAILURE_INVALID_PARAMETER_VALUE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) SCI_TASK_FAILURE_REMOTE_DEVICE_RESET_REQUIRED = SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) SCI_TASK_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS = SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) * sci_swab32_cpy - convert between scsi and scu-hardware byte format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) * @dest: receive the 4-byte endian swapped version of src
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) * @src: word aligned source buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) * scu hardware handles SSP/SMP control, response, and unidentified
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) * frames in "big endian dword" order. Regardless of host endian this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) * is always a swab32()-per-dword conversion of the standard definition,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) * i.e. single byte fields swapped and multi-byte fields in little-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) * endian
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) static inline void sci_swab32_cpy(void *_dest, void *_src, ssize_t word_cnt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) u32 *dest = _dest, *src = _src;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) while (--word_cnt >= 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) dest[word_cnt] = swab32(src[word_cnt]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) extern unsigned char no_outbound_task_to;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) extern u16 ssp_max_occ_to;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) extern u16 stp_max_occ_to;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) extern u16 ssp_inactive_to;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) extern u16 stp_inactive_to;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) extern unsigned char phy_gen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) extern unsigned char max_concurr_spinup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) extern uint cable_selection_override;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) irqreturn_t isci_msix_isr(int vec, void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) irqreturn_t isci_intx_isr(int vec, void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) irqreturn_t isci_error_isr(int vec, void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) * Each timer is associated with a cancellation flag that is set when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) * del_timer() is called and checked in the timer callback function. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) * is needed since del_timer_sync() cannot be called with sci_lock held.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) * For deinit however, del_timer_sync() is used without holding the lock.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) struct sci_timer {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) struct timer_list timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) bool cancel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) void sci_init_timer(struct sci_timer *tmr, void (*fn)(struct timer_list *t))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) tmr->cancel = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) timer_setup(&tmr->timer, fn, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) static inline void sci_mod_timer(struct sci_timer *tmr, unsigned long msec)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) tmr->cancel = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) mod_timer(&tmr->timer, jiffies + msecs_to_jiffies(msec));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) static inline void sci_del_timer(struct sci_timer *tmr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) tmr->cancel = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) del_timer(&tmr->timer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) struct sci_base_state_machine {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) const struct sci_base_state *state_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) u32 initial_state_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) u32 current_state_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) u32 previous_state_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) typedef void (*sci_state_transition_t)(struct sci_base_state_machine *sm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) struct sci_base_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) sci_state_transition_t enter_state; /* Called on state entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) sci_state_transition_t exit_state; /* Called on state exit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) extern void sci_init_sm(struct sci_base_state_machine *sm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) const struct sci_base_state *state_table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) u32 initial_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) extern void sci_change_state(struct sci_base_state_machine *sm, u32 next_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) #endif /* __ISCI_H__ */