Print this page
hg changesets 607a5b46a793..b706c96317c3
Fix ncpus for early boot config
Purge the ack to the interrupt before exiting mptsas_intr()
Changes from code review
Initial modifications using the code changes present between
the LSI source code for FreeBSD drivers. Specifically the changes
between from mpslsi-source-17.00.00.00 -> mpslsi-source-03.00.00.00.
This mainly involves using a different scatter/gather element in
frame setup.
Changes to enable driver to compile.
Header paths, object lists, etc.


   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 /*
  27  * Copyright (c) 2013, Joyent, Inc. All rights reserved.

  28  */
  29 
  30 /*
  31  * Copyright (c) 2000 to 2010, LSI Corporation.
  32  * All rights reserved.
  33  *
  34  * Redistribution and use in source and binary forms of all code within
  35  * this file that is exclusively owned by LSI, with or without
  36  * modification, is permitted provided that, in addition to the CDDL 1.0
  37  * License requirements, the following conditions are met:
  38  *
  39  *    Neither the name of the author nor the names of its contributors may be
  40  *    used to endorse or promote products derived from this software without
  41  *    specific prior written permission.
  42  *
  43  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  44  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  45  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  46  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  47  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  48  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  49  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  50  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  51  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  52  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  53  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  54  * DAMAGE.
  55  */
  56 
  57 #ifndef _MPTSAS_IOCTL_H
  58 #define _MPTSAS_IOCTL_H
  59 
  60 #ifdef  __cplusplus
  61 extern "C" {
  62 #endif
  63 
  64 #include <sys/types.h>
  65 
  66 #define MPTIOCTL                        ('I' << 8)
  67 #define MPTIOCTL_GET_ADAPTER_DATA       (MPTIOCTL | 1)
  68 #define MPTIOCTL_UPDATE_FLASH           (MPTIOCTL | 2)
  69 #define MPTIOCTL_RESET_ADAPTER          (MPTIOCTL | 3)
  70 #define MPTIOCTL_PASS_THRU              (MPTIOCTL | 4)
  71 #define MPTIOCTL_EVENT_QUERY            (MPTIOCTL | 5)
  72 #define MPTIOCTL_EVENT_ENABLE           (MPTIOCTL | 6)
  73 #define MPTIOCTL_EVENT_REPORT           (MPTIOCTL | 7)
  74 #define MPTIOCTL_GET_PCI_INFO           (MPTIOCTL | 8)
  75 #define MPTIOCTL_DIAG_ACTION            (MPTIOCTL | 9)
  76 #define MPTIOCTL_REG_ACCESS             (MPTIOCTL | 10)
  77 #define MPTIOCTL_GET_DISK_INFO          (MPTIOCTL | 11)
  78 #define MPTIOCTL_LED_CONTROL            (MPTIOCTL | 12)


  85 #define MPTIOCTL_STATUS_GOOD            0
  86 #define MPTIOCTL_STATUS_LEN_TOO_SHORT   1
  87 
  88 typedef struct mptsas_pci_bits
  89 {
  90         union {
  91                 struct {
  92                         uint32_t        DeviceNumber    :5;
  93                         uint32_t        FunctionNumber  :3;
  94                         uint32_t        BusNumber       :24;
  95                 } bits;
  96                 uint32_t        AsDWORD;
  97         } u;
  98         uint32_t        PciSegmentId;
  99 } mptsas_pci_bits_t;
 100 /*
 101  *  The following is the MPTIOCTL_GET_ADAPTER_DATA data structure.  This data
 102  *  structure is setup so that we hopefully are properly aligned for both
 103  *  32-bit and 64-bit mode applications.
 104  *
 105  *  Adapter Type - Value = 4 = SCSI Protocol through SAS-2 adapter
 106  *
 107  *  MPI Port Number - The PCI Function number for this device
 108  *
 109  *  PCI Device HW Id - The PCI device number for this device
 110  *
 111  */
 112 #define MPTIOCTL_ADAPTER_TYPE_SAS2      4
 113 typedef struct mptsas_adapter_data
 114 {
 115         uint32_t                StructureLength;
 116         uint32_t                AdapterType;
 117         uint32_t                MpiPortNumber;
 118         uint32_t                PCIDeviceHwId;
 119         uint32_t                PCIDeviceHwRev;
 120         uint32_t                SubSystemId;
 121         uint32_t                SubsystemVendorId;
 122         uint32_t                Reserved1;
 123         uint32_t                MpiFirmwareVersion;
 124         uint32_t                BiosVersion;
 125         uint8_t                 DriverVersion[32];
 126         uint8_t                 Reserved2;
 127         uint8_t                 ScsiId;
 128         uint16_t                Reserved3;
 129         mptsas_pci_bits_t       PciInformation;
 130 } mptsas_adapter_data_t;
 131 
 132 


 340         uint16_t        Enclosure;
 341         uint16_t        Slot;
 342         uint8_t         Led;
 343         uint8_t         LedStatus;
 344 } mptsas_led_control_t;
 345 
 346 #define MPTSAS_LEDCTL_FLAG_SET          1
 347 #define MPTSAS_LEDCTL_FLAG_GET          2
 348 
 349 #define MPTSAS_LEDCTL_LED_IDENT         1
 350 #define MPTSAS_LEDCTL_LED_FAIL          2
 351 #define MPTSAS_LEDCTL_LED_OK2RM         3
 352 
 353 #define MPTSAS_LEDCTL_LED_MIN           MPTSAS_LEDCTL_LED_IDENT
 354 #define MPTSAS_LEDCTL_LED_MAX           MPTSAS_LEDCTL_LED_OK2RM
 355 
 356 #ifdef  __cplusplus
 357 }
 358 #endif
 359 
 360 #endif  /* _MPTSAS_IOCTL_H */


   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 /*
  27  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  28  * Copyright (c) 2014, Tegile Systems Inc. All rights reserved.
  29  */
  30 
  31 /*
  32  * Copyright (c) 2000 to 2010, LSI Corporation.
  33  * All rights reserved.
  34  *
  35  * Redistribution and use in source and binary forms of all code within
  36  * this file that is exclusively owned by LSI, with or without
  37  * modification, is permitted provided that, in addition to the CDDL 1.0
  38  * License requirements, the following conditions are met:
  39  *
  40  *    Neither the name of the author nor the names of its contributors may be
  41  *    used to endorse or promote products derived from this software without
  42  *    specific prior written permission.
  43  *
  44  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  45  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  46  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  47  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  48  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  49  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  50  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  51  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  52  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  53  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  54  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  55  * DAMAGE.
  56  */
  57 
  58 #ifndef _MPTSAS3_IOCTL_H
  59 #define _MPTSAS3_IOCTL_H
  60 
  61 #ifdef  __cplusplus
  62 extern "C" {
  63 #endif
  64 
  65 #include <sys/types.h>
  66 
  67 #define MPTIOCTL                        ('I' << 8)
  68 #define MPTIOCTL_GET_ADAPTER_DATA       (MPTIOCTL | 1)
  69 #define MPTIOCTL_UPDATE_FLASH           (MPTIOCTL | 2)
  70 #define MPTIOCTL_RESET_ADAPTER          (MPTIOCTL | 3)
  71 #define MPTIOCTL_PASS_THRU              (MPTIOCTL | 4)
  72 #define MPTIOCTL_EVENT_QUERY            (MPTIOCTL | 5)
  73 #define MPTIOCTL_EVENT_ENABLE           (MPTIOCTL | 6)
  74 #define MPTIOCTL_EVENT_REPORT           (MPTIOCTL | 7)
  75 #define MPTIOCTL_GET_PCI_INFO           (MPTIOCTL | 8)
  76 #define MPTIOCTL_DIAG_ACTION            (MPTIOCTL | 9)
  77 #define MPTIOCTL_REG_ACCESS             (MPTIOCTL | 10)
  78 #define MPTIOCTL_GET_DISK_INFO          (MPTIOCTL | 11)
  79 #define MPTIOCTL_LED_CONTROL            (MPTIOCTL | 12)


  86 #define MPTIOCTL_STATUS_GOOD            0
  87 #define MPTIOCTL_STATUS_LEN_TOO_SHORT   1
  88 
  89 typedef struct mptsas_pci_bits
  90 {
  91         union {
  92                 struct {
  93                         uint32_t        DeviceNumber    :5;
  94                         uint32_t        FunctionNumber  :3;
  95                         uint32_t        BusNumber       :24;
  96                 } bits;
  97                 uint32_t        AsDWORD;
  98         } u;
  99         uint32_t        PciSegmentId;
 100 } mptsas_pci_bits_t;
 101 /*
 102  *  The following is the MPTIOCTL_GET_ADAPTER_DATA data structure.  This data
 103  *  structure is setup so that we hopefully are properly aligned for both
 104  *  32-bit and 64-bit mode applications.
 105  *
 106  *  Adapter Type - Value = 6 = SCSI Protocol through SAS-3 adapter
 107  *
 108  *  MPI Port Number - The PCI Function number for this device
 109  *
 110  *  PCI Device HW Id - The PCI device number for this device
 111  *
 112  */
 113 #define MPTIOCTL_ADAPTER_TYPE_SAS3      6
 114 typedef struct mptsas_adapter_data
 115 {
 116         uint32_t                StructureLength;
 117         uint32_t                AdapterType;
 118         uint32_t                MpiPortNumber;
 119         uint32_t                PCIDeviceHwId;
 120         uint32_t                PCIDeviceHwRev;
 121         uint32_t                SubSystemId;
 122         uint32_t                SubsystemVendorId;
 123         uint32_t                Reserved1;
 124         uint32_t                MpiFirmwareVersion;
 125         uint32_t                BiosVersion;
 126         uint8_t                 DriverVersion[32];
 127         uint8_t                 Reserved2;
 128         uint8_t                 ScsiId;
 129         uint16_t                Reserved3;
 130         mptsas_pci_bits_t       PciInformation;
 131 } mptsas_adapter_data_t;
 132 
 133 


 341         uint16_t        Enclosure;
 342         uint16_t        Slot;
 343         uint8_t         Led;
 344         uint8_t         LedStatus;
 345 } mptsas_led_control_t;
 346 
 347 #define MPTSAS_LEDCTL_FLAG_SET          1
 348 #define MPTSAS_LEDCTL_FLAG_GET          2
 349 
 350 #define MPTSAS_LEDCTL_LED_IDENT         1
 351 #define MPTSAS_LEDCTL_LED_FAIL          2
 352 #define MPTSAS_LEDCTL_LED_OK2RM         3
 353 
 354 #define MPTSAS_LEDCTL_LED_MIN           MPTSAS_LEDCTL_LED_IDENT
 355 #define MPTSAS_LEDCTL_LED_MAX           MPTSAS_LEDCTL_LED_OK2RM
 356 
 357 #ifdef  __cplusplus
 358 }
 359 #endif
 360 
 361 #endif  /* _MPTSAS3_IOCTL_H */