26 * 3. Neither the name of the author nor the names of its contributors may be
27 * used to endorse or promote products derived from this software without
28 * specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
33 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
34 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
35 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
36 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
37 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
38 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
39 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
40 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
41 * DAMAGE.
42 */
43
44 /*
45 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
46 */
47
48 #ifndef _MR_SAS_H_
49 #define _MR_SAS_H_
50
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54
55 #include <sys/scsi/scsi.h>
56 #include "mr_sas_list.h"
57 #include "ld_pd_map.h"
58
59 /*
60 * MegaRAID SAS2.0 Driver meta data
61 */
62 #define MRSAS_VERSION "6.503.00.00ILLUMOS"
63 #define MRSAS_RELDATE "July 30, 2012"
64
65 #define MRSAS_TRUE 1
73 /*
74 * MegaRAID SAS2.0 device id conversion definitions.
75 */
76 #define INST2LSIRDCTL(x) ((x) << INST_MINOR_SHIFT)
77 #define MRSAS_GET_BOUNDARY_ALIGNED_LEN(len, new_len, boundary_len) { \
78 int rem; \
79 rem = (len / boundary_len); \
80 if ((rem * boundary_len) != len) { \
81 new_len = len + ((rem + 1) * boundary_len - len); \
82 } else { \
83 new_len = len; \
84 } \
85 }
86
87
88 /*
89 * MegaRAID SAS2.0 supported controllers
90 */
91 #define PCI_DEVICE_ID_LSI_2108VDE 0x0078
92 #define PCI_DEVICE_ID_LSI_2108V 0x0079
93 #define PCI_DEVICE_ID_LSI_TBOLT 0x005b
94 #define PCI_DEVICE_ID_LSI_INVADER 0x005d
95
96 /*
97 * Register Index for 2108 Controllers.
98 */
99 #define REGISTER_SET_IO_2108 (2)
100
101 #define MRSAS_MAX_SGE_CNT 0x50
102 #define MRSAS_APP_RESERVED_CMDS 32
103
104 #define MRSAS_IOCTL_DRIVER 0x12341234
105 #define MRSAS_IOCTL_FIRMWARE 0x12345678
106 #define MRSAS_IOCTL_AEN 0x87654321
107
108 #define MRSAS_1_SECOND 1000000
109
110 #ifdef PDSUPPORT
111
112 #define UNCONFIGURED_GOOD 0x0
113 #define PD_SYSTEM 0x40
114 #define MR_EVT_PD_STATE_CHANGE 0x0072
115 #define MR_EVT_PD_REMOVED_EXT 0x00f8
116 #define MR_EVT_PD_INSERTED_EXT 0x00f7
117 #define MR_DCMD_PD_GET_INFO 0x02020000
118 #define MRSAS_TBOLT_PD_LUN 1
119 #define MRSAS_TBOLT_PD_TGT_MAX 255
120 #define MRSAS_TBOLT_GET_PD_MAX(s) ((s)->mr_tbolt_pd_max)
121
122 #endif
577 ddi_intr_handle_t *intr_htable; /* Interrupt handle array */
578 size_t intr_htable_size; /* Int. handle array size */
579 int intr_type;
580 int intr_cnt;
581 uint_t intr_pri;
582 int intr_cap;
583
584 ddi_taskq_t *taskq;
585 struct mrsas_ld *mr_ld_list;
586 kmutex_t config_dev_mtx;
587 /* ThunderBolt (TB) specific */
588 ddi_softintr_t tbolt_soft_intr_id;
589
590 #ifdef PDSUPPORT
591 uint32_t mr_tbolt_pd_max;
592 struct mrsas_tbolt_pd *mr_tbolt_pd_list;
593 #endif
594
595 uint8_t fast_path_io;
596
597 uint16_t tbolt;
598 uint16_t reply_read_index;
599 uint16_t reply_size; /* Single Reply struct size */
600 uint16_t raid_io_msg_size; /* Single message size */
601 uint32_t io_request_frames_phy;
602 uint8_t *io_request_frames;
603 /* Virtual address of request desc frame pool */
604 MRSAS_REQUEST_DESCRIPTOR_UNION *request_message_pool;
605 /* Physical address of request desc frame pool */
606 uint32_t request_message_pool_phy;
607 /* Virtual address of reply Frame */
608 MPI2_REPLY_DESCRIPTORS_UNION *reply_frame_pool;
609 /* Physical address of reply Frame */
610 uint32_t reply_frame_pool_phy;
611 uint8_t *reply_pool_limit; /* Last reply frame address */
612 /* Physical address of Last reply frame */
613 uint32_t reply_pool_limit_phy;
614 uint32_t reply_q_depth; /* Reply Queue Depth */
615 uint8_t max_sge_in_main_msg;
616 uint8_t max_sge_in_chain;
617 uint8_t chain_offset_io_req;
2028 struct scsi_address *, struct scsi_pkt *, uchar_t *);
2029 int mrsas_tbolt_reset_ppc(struct mrsas_instance *instance);
2030 void mrsas_tbolt_kill_adapter(struct mrsas_instance *instance);
2031 int abort_syncmap_cmd(struct mrsas_instance *, struct mrsas_cmd *);
2032 void mrsas_tbolt_prepare_cdb(struct mrsas_instance *instance, U8 cdb[],
2033 struct IO_REQUEST_INFO *, Mpi2RaidSCSIIORequest_t *, U32);
2034
2035
2036 int mrsas_init_adapter_ppc(struct mrsas_instance *instance);
2037 int mrsas_init_adapter_tbolt(struct mrsas_instance *instance);
2038 int mrsas_init_adapter(struct mrsas_instance *instance);
2039
2040 int mrsas_alloc_cmd_pool(struct mrsas_instance *instance);
2041 void mrsas_free_cmd_pool(struct mrsas_instance *instance);
2042
2043 void mrsas_print_cmd_details(struct mrsas_instance *, struct mrsas_cmd *, int);
2044 struct mrsas_cmd *get_raid_msg_pkt(struct mrsas_instance *);
2045
2046 int mfi_state_transition_to_ready(struct mrsas_instance *);
2047
2048
2049 /* FMA functions. */
2050 int mrsas_common_check(struct mrsas_instance *, struct mrsas_cmd *);
2051 void mrsas_fm_ereport(struct mrsas_instance *, char *);
2052
2053
2054 #ifdef __cplusplus
2055 }
2056 #endif
2057
2058 #endif /* _MR_SAS_H_ */
|
26 * 3. Neither the name of the author nor the names of its contributors may be
27 * used to endorse or promote products derived from this software without
28 * specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
33 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
34 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
35 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
36 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
37 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
38 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
39 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
40 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
41 * DAMAGE.
42 */
43
44 /*
45 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
46 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
47 */
48
49 #ifndef _MR_SAS_H_
50 #define _MR_SAS_H_
51
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55
56 #include <sys/scsi/scsi.h>
57 #include "mr_sas_list.h"
58 #include "ld_pd_map.h"
59
60 /*
61 * MegaRAID SAS2.0 Driver meta data
62 */
63 #define MRSAS_VERSION "6.503.00.00ILLUMOS"
64 #define MRSAS_RELDATE "July 30, 2012"
65
66 #define MRSAS_TRUE 1
74 /*
75 * MegaRAID SAS2.0 device id conversion definitions.
76 */
77 #define INST2LSIRDCTL(x) ((x) << INST_MINOR_SHIFT)
78 #define MRSAS_GET_BOUNDARY_ALIGNED_LEN(len, new_len, boundary_len) { \
79 int rem; \
80 rem = (len / boundary_len); \
81 if ((rem * boundary_len) != len) { \
82 new_len = len + ((rem + 1) * boundary_len - len); \
83 } else { \
84 new_len = len; \
85 } \
86 }
87
88
89 /*
90 * MegaRAID SAS2.0 supported controllers
91 */
92 #define PCI_DEVICE_ID_LSI_2108VDE 0x0078
93 #define PCI_DEVICE_ID_LSI_2108V 0x0079
94 #define PCI_DEVICE_ID_LSI_SKINNY 0x0071
95 #define PCI_DEVICE_ID_LSI_SKINNY_NEW 0x0073
96 #define PCI_DEVICE_ID_LSI_TBOLT 0x005b
97 #define PCI_DEVICE_ID_LSI_INVADER 0x005d
98
99 /*
100 * Register Index for 2108 Controllers.
101 */
102 #define REGISTER_SET_IO_2108 (2)
103
104 #define MRSAS_MAX_SGE_CNT 0x50
105 #define MRSAS_APP_RESERVED_CMDS 32
106 #define MRSAS_APP_MIN_RESERVED_CMDS 4
107
108 #define MRSAS_IOCTL_DRIVER 0x12341234
109 #define MRSAS_IOCTL_FIRMWARE 0x12345678
110 #define MRSAS_IOCTL_AEN 0x87654321
111
112 #define MRSAS_1_SECOND 1000000
113
114 #ifdef PDSUPPORT
115
116 #define UNCONFIGURED_GOOD 0x0
117 #define PD_SYSTEM 0x40
118 #define MR_EVT_PD_STATE_CHANGE 0x0072
119 #define MR_EVT_PD_REMOVED_EXT 0x00f8
120 #define MR_EVT_PD_INSERTED_EXT 0x00f7
121 #define MR_DCMD_PD_GET_INFO 0x02020000
122 #define MRSAS_TBOLT_PD_LUN 1
123 #define MRSAS_TBOLT_PD_TGT_MAX 255
124 #define MRSAS_TBOLT_GET_PD_MAX(s) ((s)->mr_tbolt_pd_max)
125
126 #endif
581 ddi_intr_handle_t *intr_htable; /* Interrupt handle array */
582 size_t intr_htable_size; /* Int. handle array size */
583 int intr_type;
584 int intr_cnt;
585 uint_t intr_pri;
586 int intr_cap;
587
588 ddi_taskq_t *taskq;
589 struct mrsas_ld *mr_ld_list;
590 kmutex_t config_dev_mtx;
591 /* ThunderBolt (TB) specific */
592 ddi_softintr_t tbolt_soft_intr_id;
593
594 #ifdef PDSUPPORT
595 uint32_t mr_tbolt_pd_max;
596 struct mrsas_tbolt_pd *mr_tbolt_pd_list;
597 #endif
598
599 uint8_t fast_path_io;
600
601 uint8_t skinny;
602 uint8_t tbolt;
603 uint16_t reply_read_index;
604 uint16_t reply_size; /* Single Reply struct size */
605 uint16_t raid_io_msg_size; /* Single message size */
606 uint32_t io_request_frames_phy;
607 uint8_t *io_request_frames;
608 /* Virtual address of request desc frame pool */
609 MRSAS_REQUEST_DESCRIPTOR_UNION *request_message_pool;
610 /* Physical address of request desc frame pool */
611 uint32_t request_message_pool_phy;
612 /* Virtual address of reply Frame */
613 MPI2_REPLY_DESCRIPTORS_UNION *reply_frame_pool;
614 /* Physical address of reply Frame */
615 uint32_t reply_frame_pool_phy;
616 uint8_t *reply_pool_limit; /* Last reply frame address */
617 /* Physical address of Last reply frame */
618 uint32_t reply_pool_limit_phy;
619 uint32_t reply_q_depth; /* Reply Queue Depth */
620 uint8_t max_sge_in_main_msg;
621 uint8_t max_sge_in_chain;
622 uint8_t chain_offset_io_req;
2033 struct scsi_address *, struct scsi_pkt *, uchar_t *);
2034 int mrsas_tbolt_reset_ppc(struct mrsas_instance *instance);
2035 void mrsas_tbolt_kill_adapter(struct mrsas_instance *instance);
2036 int abort_syncmap_cmd(struct mrsas_instance *, struct mrsas_cmd *);
2037 void mrsas_tbolt_prepare_cdb(struct mrsas_instance *instance, U8 cdb[],
2038 struct IO_REQUEST_INFO *, Mpi2RaidSCSIIORequest_t *, U32);
2039
2040
2041 int mrsas_init_adapter_ppc(struct mrsas_instance *instance);
2042 int mrsas_init_adapter_tbolt(struct mrsas_instance *instance);
2043 int mrsas_init_adapter(struct mrsas_instance *instance);
2044
2045 int mrsas_alloc_cmd_pool(struct mrsas_instance *instance);
2046 void mrsas_free_cmd_pool(struct mrsas_instance *instance);
2047
2048 void mrsas_print_cmd_details(struct mrsas_instance *, struct mrsas_cmd *, int);
2049 struct mrsas_cmd *get_raid_msg_pkt(struct mrsas_instance *);
2050
2051 int mfi_state_transition_to_ready(struct mrsas_instance *);
2052
2053 struct mrsas_cmd *mrsas_get_mfi_pkt(struct mrsas_instance *);
2054 void mrsas_return_mfi_pkt(struct mrsas_instance *, struct mrsas_cmd *);
2055
2056
2057 /* FMA functions. */
2058 int mrsas_common_check(struct mrsas_instance *, struct mrsas_cmd *);
2059 void mrsas_fm_ereport(struct mrsas_instance *, char *);
2060
2061
2062 #ifdef __cplusplus
2063 }
2064 #endif
2065
2066 #endif /* _MR_SAS_H_ */
|