2 * This is the Fusion MPT base driver providing common API layer interface
3 * for access to MPT (Message Passing Technology) firmware.
5 * This code is based on drivers/scsi/mpt2sas/mpt2_base.h
6 * Copyright (C) 2007-2014 LSI Corporation
7 * Copyright (C) 20013-2014 Avago Technologies
8 * (mailto: MPT-FusionLinux.pdl@avagotech.com)
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
22 * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
23 * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
24 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
25 * solely responsible for determining the appropriateness of using and
26 * distributing the Program and assumes all risks associated with its
27 * exercise of rights under this Agreement, including but not limited to
28 * the risks and costs of program errors, damage to or loss of data,
29 * programs or equipment, and unavailability or interruption of operations.
31 * DISCLAIMER OF LIABILITY
32 * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
33 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
35 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
36 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
37 * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
38 * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
40 * You should have received a copy of the GNU General Public License
41 * along with this program; if not, write to the Free Software
42 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
46 #ifndef MPT2SAS_BASE_H_INCLUDED
47 #define MPT2SAS_BASE_H_INCLUDED
49 #include "mpi/mpi2_type.h"
51 #include "mpi/mpi2_ioc.h"
52 #include "mpi/mpi2_cnfg.h"
53 #include "mpi/mpi2_init.h"
54 #include "mpi/mpi2_raid.h"
55 #include "mpi/mpi2_tool.h"
56 #include "mpi/mpi2_sas.h"
58 #include <scsi/scsi.h>
59 #include <scsi/scsi_cmnd.h>
60 #include <scsi/scsi_device.h>
61 #include <scsi/scsi_host.h>
62 #include <scsi/scsi_tcq.h>
63 #include <scsi/scsi_transport_sas.h>
64 #include <scsi/scsi_dbg.h>
65 #include <scsi/scsi_eh.h>
67 #include "mpt2sas_debug.h"
69 /* driver versioning info */
70 #define MPT2SAS_DRIVER_NAME "mpt2sas"
71 #define MPT2SAS_AUTHOR "Avago Technologies <MPT-FusionLinux.pdl@avagotech.com>"
72 #define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver"
73 #define MPT2SAS_DRIVER_VERSION "20.100.00.00"
74 #define MPT2SAS_MAJOR_VERSION 20
75 #define MPT2SAS_MINOR_VERSION 100
76 #define MPT2SAS_BUILD_VERSION 00
77 #define MPT2SAS_RELEASE_VERSION 00
80 * Set MPT2SAS_SG_DEPTH value based on user input.
82 #ifdef CONFIG_SCSI_MPT2SAS_MAX_SGE
83 #if CONFIG_SCSI_MPT2SAS_MAX_SGE < 16
84 #define MPT2SAS_SG_DEPTH 16
85 #elif CONFIG_SCSI_MPT2SAS_MAX_SGE > 128
86 #define MPT2SAS_SG_DEPTH 128
88 #define MPT2SAS_SG_DEPTH CONFIG_SCSI_MPT2SAS_MAX_SGE
91 #define MPT2SAS_SG_DEPTH 128 /* MAX_HW_SEGMENTS */
98 #define MPT2SAS_SATA_QUEUE_DEPTH 32
99 #define MPT2SAS_SAS_QUEUE_DEPTH 254
100 #define MPT2SAS_RAID_QUEUE_DEPTH 128
102 #define MPT_NAME_LENGTH 32 /* generic length of strings */
103 #define MPT_STRING_LENGTH 64
105 #define MPT_MAX_CALLBACKS 16
111 #define INTERNAL_CMDS_COUNT 10 /* reserved cmds */
113 #define MPI2_HIM_MASK 0xFFFFFFFF /* mask every bit*/
115 #define MPT2SAS_INVALID_DEVICE_HANDLE 0xFFFF
121 #define MPT2_IOC_PRE_RESET 1 /* prior to host reset */
122 #define MPT2_IOC_AFTER_RESET 2 /* just after host reset */
123 #define MPT2_IOC_DONE_RESET 3 /* links re-initialized */
128 #define MPT2SAS_FMT "%s: "
129 #define MPT2SAS_INFO_FMT KERN_INFO MPT2SAS_FMT
130 #define MPT2SAS_NOTE_FMT KERN_NOTICE MPT2SAS_FMT
131 #define MPT2SAS_WARN_FMT KERN_WARNING MPT2SAS_FMT
132 #define MPT2SAS_ERR_FMT KERN_ERR MPT2SAS_FMT
137 #define MPT2SAS_DELL_BRANDING_SIZE 32
139 #define MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING "Dell 6Gbps SAS HBA"
140 #define MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING "Dell PERC H200 Adapter"
141 #define MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING "Dell PERC H200 Integrated"
142 #define MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING "Dell PERC H200 Modular"
143 #define MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING "Dell PERC H200 Embedded"
144 #define MPT2SAS_DELL_PERC_H200_BRANDING "Dell PERC H200"
145 #define MPT2SAS_DELL_6GBPS_SAS_BRANDING "Dell 6Gbps SAS"
150 #define MPT2SAS_DELL_6GBPS_SAS_HBA_SSDID 0x1F1C
151 #define MPT2SAS_DELL_PERC_H200_ADAPTER_SSDID 0x1F1D
152 #define MPT2SAS_DELL_PERC_H200_INTEGRATED_SSDID 0x1F1E
153 #define MPT2SAS_DELL_PERC_H200_MODULAR_SSDID 0x1F1F
154 #define MPT2SAS_DELL_PERC_H200_EMBEDDED_SSDID 0x1F20
155 #define MPT2SAS_DELL_PERC_H200_SSDID 0x1F21
156 #define MPT2SAS_DELL_6GBPS_SAS_SSDID 0x1F22
161 #define MPT2SAS_INTEL_RMS25JB080_BRANDING \
162 "Intel(R) Integrated RAID Module RMS25JB080"
163 #define MPT2SAS_INTEL_RMS25JB040_BRANDING \
164 "Intel(R) Integrated RAID Module RMS25JB040"
165 #define MPT2SAS_INTEL_RMS25KB080_BRANDING \
166 "Intel(R) Integrated RAID Module RMS25KB080"
167 #define MPT2SAS_INTEL_RMS25KB040_BRANDING \
168 "Intel(R) Integrated RAID Module RMS25KB040"
169 #define MPT2SAS_INTEL_RMS25LB040_BRANDING \
170 "Intel(R) Integrated RAID Module RMS25LB040"
171 #define MPT2SAS_INTEL_RMS25LB080_BRANDING \
172 "Intel(R) Integrated RAID Module RMS25LB080"
173 #define MPT2SAS_INTEL_RMS2LL080_BRANDING \
174 "Intel Integrated RAID Module RMS2LL080"
175 #define MPT2SAS_INTEL_RMS2LL040_BRANDING \
176 "Intel Integrated RAID Module RMS2LL040"
177 #define MPT2SAS_INTEL_RS25GB008_BRANDING \
178 "Intel(R) RAID Controller RS25GB008"
179 #define MPT2SAS_INTEL_SSD910_BRANDING \
180 "Intel(R) SSD 910 Series"
184 #define MPT2SAS_INTEL_RMS25JB080_SSDID 0x3516
185 #define MPT2SAS_INTEL_RMS25JB040_SSDID 0x3517
186 #define MPT2SAS_INTEL_RMS25KB080_SSDID 0x3518
187 #define MPT2SAS_INTEL_RMS25KB040_SSDID 0x3519
188 #define MPT2SAS_INTEL_RMS25LB040_SSDID 0x351A
189 #define MPT2SAS_INTEL_RMS25LB080_SSDID 0x351B
190 #define MPT2SAS_INTEL_RMS2LL080_SSDID 0x350E
191 #define MPT2SAS_INTEL_RMS2LL040_SSDID 0x350F
192 #define MPT2SAS_INTEL_RS25GB008_SSDID 0x3000
193 #define MPT2SAS_INTEL_SSD910_SSDID 0x3700
198 #define MPT2SAS_HP_3PAR_SSVID 0x1590
199 #define MPT2SAS_HP_2_4_INTERNAL_BRANDING "HP H220 Host Bus Adapter"
200 #define MPT2SAS_HP_2_4_EXTERNAL_BRANDING "HP H221 Host Bus Adapter"
201 #define MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_BRANDING "HP H222 Host Bus Adapter"
202 #define MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_BRANDING "HP H220i Host Bus Adapter"
203 #define MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_BRANDING "HP H210i Host Bus Adapter"
208 #define MPT2SAS_HP_2_4_INTERNAL_SSDID 0x0041
209 #define MPT2SAS_HP_2_4_EXTERNAL_SSDID 0x0042
210 #define MPT2SAS_HP_1_4_INTERNAL_1_4_EXTERNAL_SSDID 0x0043
211 #define MPT2SAS_HP_EMBEDDED_2_4_INTERNAL_SSDID 0x0044
212 #define MPT2SAS_HP_DAUGHTER_2_4_INTERNAL_SSDID 0x0046
215 * WarpDrive Specific Log codes
218 #define MPT2_WARPDRIVE_LOGENTRY (0x8002)
219 #define MPT2_WARPDRIVE_LC_SSDT (0x41)
220 #define MPT2_WARPDRIVE_LC_SSDLW (0x43)
221 #define MPT2_WARPDRIVE_LC_SSDLF (0x44)
222 #define MPT2_WARPDRIVE_LC_BRMF (0x4D)
225 * per target private data
227 #define MPT_TARGET_FLAGS_RAID_COMPONENT 0x01
228 #define MPT_TARGET_FLAGS_VOLUME 0x02
229 #define MPT_TARGET_FLAGS_DELETED 0x04
232 * struct MPT2SAS_TARGET - starget private hostdata
233 * @starget: starget object
234 * @sas_address: target sas address
235 * @raid_device: raid_device pointer to access volume data
236 * @handle: device handle
237 * @num_luns: number luns
238 * @flags: MPT_TARGET_FLAGS_XXX flags
239 * @deleted: target flaged for deletion
240 * @tm_busy: target is busy with TM request.
241 * @sdev: The sas_device associated with this target
243 struct MPT2SAS_TARGET
{
244 struct scsi_target
*starget
;
246 struct _raid_device
*raid_device
;
252 struct _sas_device
*sdev
;
257 * per device private data
259 #define MPT_DEVICE_FLAGS_INIT 0x01
260 #define MPT_DEVICE_TLR_ON 0x02
263 * struct MPT2SAS_DEVICE - sdev private hostdata
264 * @sas_target: starget private hostdata
266 * @flags: MPT_DEVICE_XXX flags
267 * @configured_lun: lun is configured
268 * @block: device is in SDEV_BLOCK state
269 * @tlr_snoop_check: flag used in determining whether to disable TLR
272 /* OEM Identifiers */
273 #define MFG10_OEM_ID_INVALID (0x00000000)
274 #define MFG10_OEM_ID_DELL (0x00000001)
275 #define MFG10_OEM_ID_FSC (0x00000002)
276 #define MFG10_OEM_ID_SUN (0x00000003)
277 #define MFG10_OEM_ID_IBM (0x00000004)
280 #define MFG10_GF0_OCE_DISABLED (0x00000001)
281 #define MFG10_GF0_R1E_DRIVE_COUNT (0x00000002)
282 #define MFG10_GF0_R10_DISPLAY (0x00000004)
283 #define MFG10_GF0_SSD_DATA_SCRUB_DISABLE (0x00000008)
284 #define MFG10_GF0_SINGLE_DRIVE_R0 (0x00000010)
286 /* OEM Specific Flags will come from OEM specific header files */
287 typedef struct _MPI2_CONFIG_PAGE_MAN_10
{
288 MPI2_CONFIG_PAGE_HEADER Header
; /* 00h */
289 U8 OEMIdentifier
; /* 04h */
290 U8 Reserved1
; /* 05h */
291 U16 Reserved2
; /* 08h */
292 U32 Reserved3
; /* 0Ch */
293 U32 GenericFlags0
; /* 10h */
294 U32 GenericFlags1
; /* 14h */
295 U32 Reserved4
; /* 18h */
296 U32 OEMSpecificFlags0
; /* 1Ch */
297 U32 OEMSpecificFlags1
; /* 20h */
298 U32 Reserved5
[18]; /* 24h-60h*/
299 } MPI2_CONFIG_PAGE_MAN_10
,
300 MPI2_POINTER PTR_MPI2_CONFIG_PAGE_MAN_10
,
301 Mpi2ManufacturingPage10_t
, MPI2_POINTER pMpi2ManufacturingPage10_t
;
303 #define MFG_PAGE10_HIDE_SSDS_MASK (0x00000003)
304 #define MFG_PAGE10_HIDE_ALL_DISKS (0x00)
305 #define MFG_PAGE10_EXPOSE_ALL_DISKS (0x01)
306 #define MFG_PAGE10_HIDE_IF_VOL_PRESENT (0x02)
309 struct MPT2SAS_DEVICE
{
310 struct MPT2SAS_TARGET
*sas_target
;
318 #define MPT2_CMD_NOT_USED 0x8000 /* free */
319 #define MPT2_CMD_COMPLETE 0x0001 /* completed */
320 #define MPT2_CMD_PENDING 0x0002 /* pending */
321 #define MPT2_CMD_REPLY_VALID 0x0004 /* reply is valid */
322 #define MPT2_CMD_RESET 0x0008 /* host reset dropped the command */
325 * struct _internal_cmd - internal commands struct
328 * @reply: reply message pointer
330 * @status: MPT2_CMD_XXX status
331 * @smid: system message id
333 struct _internal_cmd
{
335 struct completion done
;
344 * struct _sas_device - attached device information
345 * @list: sas device list
346 * @starget: starget object
347 * @sas_address: device sas address
348 * @device_name: retrieved from the SAS IDENTIFY frame.
349 * @handle: device handle
350 * @sas_address_parent: sas address of parent expander or sas host
351 * @enclosure_handle: enclosure handle
352 * @enclosure_logical_id: enclosure logical identifier
353 * @volume_handle: volume handle (valid when hidden raid member)
354 * @volume_wwid: volume unique identifier
355 * @device_info: bitfield provides detailed info about the device
357 * @channel: target channel
358 * @slot: number number
359 * @phy: phy identifier provided in sas device page 0
360 * @responding: used in _scsih_sas_device_mark_responding
361 * @pfa_led_on: flag for PFA LED status
364 struct list_head list
;
365 struct scsi_target
*starget
;
369 u64 sas_address_parent
;
370 u16 enclosure_handle
;
371 u64 enclosure_logical_id
;
381 struct kref refcount
;
384 static inline void sas_device_get(struct _sas_device
*s
)
386 kref_get(&s
->refcount
);
389 static inline void sas_device_free(struct kref
*r
)
391 kfree(container_of(r
, struct _sas_device
, refcount
));
394 static inline void sas_device_put(struct _sas_device
*s
)
396 kref_put(&s
->refcount
, sas_device_free
);
400 * struct _raid_device - raid volume link list
401 * @list: sas device list
402 * @starget: starget object
403 * @sdev: scsi device struct (volumes are single lun)
404 * @wwid: unique identifier for the volume
405 * @handle: device handle
406 * @block_size: Block size of the volume
408 * @channel: target channel
409 * @volume_type: the raid level
410 * @device_info: bitfield provides detailed info about the hidden components
411 * @num_pds: number of hidden raid components
412 * @responding: used in _scsih_raid_device_mark_responding
413 * @percent_complete: resync percent complete
414 * @direct_io_enabled: Whether direct io to PDs are allowed or not
415 * @stripe_exponent: X where 2powX is the stripe sz in blocks
416 * @block_exponent: X where 2powX is the block sz in bytes
417 * @max_lba: Maximum number of LBA in the volume
418 * @stripe_sz: Stripe Size of the volume
419 * @device_info: Device info of the volume member disk
420 * @pd_handle: Array of handles of the physical drives for direct I/O in le16
422 #define MPT_MAX_WARPDRIVE_PDS 8
423 struct _raid_device
{
424 struct list_head list
;
425 struct scsi_target
*starget
;
426 struct scsi_device
*sdev
;
436 u8 direct_io_enabled
;
442 u16 pd_handle
[MPT_MAX_WARPDRIVE_PDS
];
446 * struct _boot_device - boot device info
447 * @is_raid: flag to indicate whether this is volume
448 * @device: holds pointer for either struct _sas_device or
449 * struct _raid_device
451 struct _boot_device
{
457 * struct _sas_port - wide/narrow sas port information
458 * @port_list: list of ports belonging to expander
459 * @num_phys: number of phys belonging to this port
460 * @remote_identify: attached device identification
461 * @rphy: sas transport rphy object
462 * @port: sas transport wide/narrow port object
463 * @phy_list: _sas_phy list objects belonging to this port
466 struct list_head port_list
;
468 struct sas_identify remote_identify
;
469 struct sas_rphy
*rphy
;
470 struct sas_port
*port
;
471 struct list_head phy_list
;
475 * struct _sas_phy - phy information
476 * @port_siblings: list of phys belonging to a port
477 * @identify: phy identification
478 * @remote_identify: attached device identification
479 * @phy: sas transport phy object
480 * @phy_id: unique phy id
481 * @handle: device handle for this phy
482 * @attached_handle: device handle for attached device
483 * @phy_belongs_to_port: port has been created for this phy
486 struct list_head port_siblings
;
487 struct sas_identify identify
;
488 struct sas_identify remote_identify
;
493 u8 phy_belongs_to_port
;
497 * struct _sas_node - sas_host/expander information
498 * @list: list of expanders
499 * @parent_dev: parent device class
500 * @num_phys: number phys belonging to this sas_host/expander
501 * @sas_address: sas address of this sas_host/expander
502 * @handle: handle for this sas_host/expander
503 * @sas_address_parent: sas address of parent expander or sas host
504 * @enclosure_handle: handle for this a member of an enclosure
505 * @device_info: bitwise defining capabilities of this sas_host/expander
506 * @responding: used in _scsih_expander_device_mark_responding
507 * @phy: a list of phys that make up this sas_host/expander
508 * @sas_port_list: list of ports attached to this sas_host/expander
511 struct list_head list
;
512 struct device
*parent_dev
;
516 u64 sas_address_parent
;
517 u16 enclosure_handle
;
518 u64 enclosure_logical_id
;
520 struct _sas_phy
*phy
;
521 struct list_head sas_port_list
;
525 * enum reset_type - reset state
526 * @FORCE_BIG_HAMMER: issue diagnostic reset
527 * @SOFT_RESET: issue message_unit_reset, if fails to to big hammer
535 * struct chain_tracker - firmware chain tracker
536 * @chain_buffer: chain buffer
537 * @chain_buffer_dma: physical address
538 * @tracker_list: list of free request (ioc->free_chain_list)
540 struct chain_tracker
{
542 dma_addr_t chain_buffer_dma
;
543 struct list_head tracker_list
;
547 * struct scsiio_tracker - scsi mf request tracker
548 * @smid: system message id
549 * @scmd: scsi request pointer
550 * @cb_idx: callback index
551 * @direct_io: To indicate whether I/O is direct (WARPDRIVE)
552 * @chain_list: list of chains associated to this IO
553 * @tracker_list: list of free request (ioc->free_list)
555 struct scsiio_tracker
{
557 struct scsi_cmnd
*scmd
;
560 struct list_head chain_list
;
561 struct list_head tracker_list
;
565 * struct request_tracker - firmware request tracker
566 * @smid: system message id
567 * @cb_idx: callback index
568 * @tracker_list: list of free request (ioc->free_list)
570 struct request_tracker
{
573 struct list_head tracker_list
;
577 * struct _tr_list - target reset list
578 * @handle: device handle
579 * @state: state machine
582 struct list_head list
;
587 typedef void (*MPT_ADD_SGE
)(void *paddr
, u32 flags_length
, dma_addr_t dma_addr
);
590 * struct adapter_reply_queue - the reply queue struct
591 * @ioc: per adapter object
592 * @msix_index: msix index into vector table
593 * @vector: irq vector
594 * @reply_post_host_index: head index in the pool where FW completes IO
595 * @reply_post_free: reply post base virt address
596 * @name: the name registered to request_irq()
597 * @busy: isr is actively processing replies on another cpu
600 struct adapter_reply_queue
{
601 struct MPT2SAS_ADAPTER
*ioc
;
604 u32 reply_post_host_index
;
605 Mpi2ReplyDescriptorsUnion_t
*reply_post_free
;
606 char name
[MPT_NAME_LENGTH
];
608 cpumask_var_t affinity_hint
;
609 struct list_head list
;
612 /* IOC Facts and Port Facts converted from little endian to cpu */
613 union mpi2_version_union
{
614 MPI2_VERSION_STRUCT Struct
;
618 struct mpt2sas_facts
{
634 union mpi2_version_union FWVersion
;
635 u16 IOCRequestFrameSize
;
642 u16 HighPriorityCredit
;
643 u16 MaxReplyDescriptorPostQueueDepth
;
647 u16 MaxPersistentEntries
;
651 struct mpt2sas_port_facts
{
656 u16 MaxPostedCmdBuffers
;
659 struct reply_post_struct
{
660 Mpi2ReplyDescriptorsUnion_t
*reply_post_free
;
661 dma_addr_t reply_post_free_dma
;
665 * enum mutex_type - task management mutex type
666 * @TM_MUTEX_OFF: mutex is not required becuase calling function is acquiring it
667 * @TM_MUTEX_ON: mutex is required
674 typedef void (*MPT2SAS_FLUSH_RUNNING_CMDS
)(struct MPT2SAS_ADAPTER
*ioc
);
676 * struct MPT2SAS_ADAPTER - per adapter struct
678 * @shost: shost object
679 * @id: unique adapter id
680 * @cpu_count: number online cpus
681 * @name: generic ioc string
682 * @tmp_string: tmp string used for logging
683 * @pdev: pci pdev object
684 * @chip: memory mapped register space
685 * @chip_phys: physical addrss prior to mapping
686 * @logging_level: see mpt2sas_debug.h
687 * @fwfault_debug: debuging FW timeouts
688 * @ir_firmware: IR firmware present
689 * @bars: bitmask of BAR's that must be configured
690 * @mask_interrupts: ignore interrupt
691 * @dma_mask: used to set the consistent dma mask
692 * @fault_reset_work_q_name: fw fault work queue
693 * @fault_reset_work_q: ""
694 * @fault_reset_work: ""
695 * @firmware_event_name: fw event work queue
696 * @firmware_event_thread: ""
697 * @fw_events_off: flag to turn off fw event handling
699 * @fw_event_list: list of fw events
700 * @aen_event_read_flag: event log was read
701 * @broadcast_aen_busy: broadcast aen waiting to be serviced
702 * @shost_recovery: host reset in progress
703 * @ioc_reset_in_progress_lock:
704 * @ioc_link_reset_in_progress: phy/hard reset in progress
705 * @ignore_loginfos: ignore loginfos during task management
706 * @remove_host: flag for when driver unloads, to avoid sending dev resets
707 * @pci_error_recovery: flag to prevent ioc access until slot reset completes
708 * @wait_for_discovery_to_complete: flag set at driver load time when
709 * waiting on reporting devices
710 * @is_driver_loading: flag set at driver load time
711 * @port_enable_failed: flag set when port enable has failed
712 * @start_scan: flag set from scan_start callback, cleared from _mpt2sas_fw_work
713 * @start_scan_failed: means port enable failed, return's the ioc_status
714 * @msix_enable: flag indicating msix is enabled
715 * @msix_vector_count: number msix vectors
716 * @cpu_msix_table: table for mapping cpus to msix index
717 * @cpu_msix_table_sz: table size
718 * @schedule_dead_ioc_flush_running_cmds: callback to flush pending commands
719 * @scsi_io_cb_idx: shost generated commands
720 * @tm_cb_idx: task management commands
721 * @scsih_cb_idx: scsih internal commands
722 * @transport_cb_idx: transport internal commands
723 * @ctl_cb_idx: clt internal commands
724 * @base_cb_idx: base internal commands
725 * @config_cb_idx: base internal commands
726 * @tm_tr_cb_idx : device removal target reset handshake
727 * @tm_tr_volume_cb_idx : volume removal target reset
734 * @base_add_sg_single: handler for either 32/64 bit sgl's
735 * @event_type: bits indicating which events to log
736 * @event_context: unique id for each logged event
737 * @event_log: event log pointer
738 * @event_masks: events that are masked
739 * @facts: static facts data
740 * @pfacts: static port facts data
741 * @manu_pg0: static manufacturing page 0
742 * @manu_pg10: static manufacturing page 10
743 * @bios_pg2: static bios page 2
744 * @bios_pg3: static bios page 3
745 * @ioc_pg8: static ioc page 8
746 * @iounit_pg0: static iounit page 0
747 * @iounit_pg1: static iounit page 1
748 * @iounit_pg8: static iounit page 8
749 * @sas_hba: sas host object
750 * @sas_expander_list: expander object list
752 * @sas_device_list: sas device object list
753 * @sas_device_init_list: sas device object list (used only at init time)
755 * @io_missing_delay: time for IO completed by fw when PDR enabled
756 * @device_missing_delay: time for device missing by fw when PDR enabled
757 * @sas_id : used for setting volume target IDs
758 * @blocking_handles: bitmask used to identify which devices need blocking
759 * @pd_handles : bitmask for PD handles
760 * @pd_handles_sz : size of pd_handle bitmask
761 * @config_page_sz: config page size
762 * @config_page: reserve memory for config page payload
764 * @hba_queue_depth: hba request queue depth
765 * @sge_size: sg element size for either 32/64 bit
766 * @scsiio_depth: SCSI_IO queue depth
767 * @request_sz: per request frame size
768 * @request: pool of request frames
771 * @scsi_lookup: firmware request tracker list
773 * @free_list: free list of request
774 * @chain: pool of chains
778 * @max_sges_in_main_message: number sg elements in main message
779 * @max_sges_in_chain_message: number sg elements per chain
780 * @chains_needed_per_io: max chains per io
781 * @chain_offset_value_for_main_message: location 1st sg in main
782 * @chain_depth: total chains allocated
786 * @hi_priority_depth:
794 * @internal_free_list:
795 * @sense: pool of sense
798 * @reply_depth: hba reply queue depth:
799 * @reply_sz: per reply frame size:
800 * @reply: pool of replys:
803 * @reply_free_queue_depth: reply free depth
804 * @reply_free: pool for reply free queue (32 bit addr)
806 * @reply_free_dma_pool:
807 * @reply_free_host_index: tail index in pool to insert free replys
808 * @reply_post_queue_depth: reply post queue depth
809 * @reply_post_struct: struct for reply_post_free physical & virt address
810 * @rdpq_array_capable: FW supports multiple reply queue addresses in ioc_init
811 * @rdpq_array_enable: rdpq_array support is enabled in the driver
812 * @rdpq_array_enable_assigned: this ensures that rdpq_array_enable flag
813 * is assigned only ones
814 * @reply_queue_count: number of reply queue's
815 * @reply_queue_list: link list contaning the reply queue info
816 * @reply_post_host_index: head index in the pool where FW completes IO
817 * @delayed_tr_list: target reset link list
818 * @delayed_tr_volume_list: volume target reset link list
819 * @@temp_sensors_count: flag to carry the number of temperature sensors
820 * @pci_access_mutex: Mutex to synchronize ioctl,sysfs show path and
821 * pci resource handling. PCI resource freeing will lead to free
822 * vital hardware/memory resource, which might be in use by cli/sysfs
823 * path functions resulting in Null pointer reference followed by kernel
824 * crash. To avoid the above race condition we use mutex syncrhonization
825 * which ensures the syncrhonization between cli/sysfs_show path
827 struct MPT2SAS_ADAPTER
{
828 struct list_head list
;
829 struct Scsi_Host
*shost
;
832 char name
[MPT_NAME_LENGTH
];
833 char tmp_string
[MPT_STRING_LENGTH
];
834 struct pci_dev
*pdev
;
835 Mpi2SystemInterfaceRegs_t __iomem
*chip
;
836 resource_size_t chip_phys
;
844 /* fw fault handler */
845 char fault_reset_work_q_name
[20];
846 struct workqueue_struct
*fault_reset_work_q
;
847 struct delayed_work fault_reset_work
;
849 /* fw event handler */
850 char firmware_event_name
[20];
851 struct workqueue_struct
*firmware_event_thread
;
852 spinlock_t fw_event_lock
;
853 struct list_head fw_event_list
;
856 int aen_event_read_flag
;
857 u8 broadcast_aen_busy
;
858 u16 broadcast_aen_pending
;
861 struct mutex reset_in_progress_mutex
;
862 spinlock_t ioc_reset_in_progress_lock
;
863 u8 ioc_link_reset_in_progress
;
864 u8 ioc_reset_in_progress_status
;
868 u8 pci_error_recovery
;
869 u8 wait_for_discovery_to_complete
;
870 struct completion port_enable_done
;
871 u8 is_driver_loading
;
872 u8 port_enable_failed
;
875 u16 start_scan_failed
;
878 u16 msix_vector_count
;
880 resource_size_t __iomem
**reply_post_host_index
;
881 u16 cpu_msix_table_sz
;
883 MPT2SAS_FLUSH_RUNNING_CMDS schedule_dead_ioc_flush_running_cmds
;
884 u32 non_operational_loop
;
886 /* internal commands, callback index */
893 u8 port_enable_cb_idx
;
896 u8 tm_tr_volume_cb_idx
;
897 u8 tm_sas_control_cb_idx
;
898 struct _internal_cmd base_cmds
;
899 struct _internal_cmd port_enable_cmds
;
900 struct _internal_cmd transport_cmds
;
901 struct _internal_cmd scsih_cmds
;
902 struct _internal_cmd tm_cmds
;
903 struct _internal_cmd ctl_cmds
;
904 struct _internal_cmd config_cmds
;
906 MPT_ADD_SGE base_add_sg_single
;
909 u32 event_type
[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS
];
912 u32 event_masks
[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS
];
914 /* static config pages */
915 struct mpt2sas_facts facts
;
916 struct mpt2sas_port_facts
*pfacts
;
917 Mpi2ManufacturingPage0_t manu_pg0
;
918 Mpi2BiosPage2_t bios_pg2
;
919 Mpi2BiosPage3_t bios_pg3
;
920 Mpi2IOCPage8_t ioc_pg8
;
921 Mpi2IOUnitPage0_t iounit_pg0
;
922 Mpi2IOUnitPage1_t iounit_pg1
;
923 Mpi2IOUnitPage8_t iounit_pg8
;
925 struct _boot_device req_boot_device
;
926 struct _boot_device req_alt_boot_device
;
927 struct _boot_device current_boot_device
;
929 /* sas hba, expander, and device list */
930 struct _sas_node sas_hba
;
931 struct list_head sas_expander_list
;
932 spinlock_t sas_node_lock
;
933 struct list_head sas_device_list
;
934 struct list_head sas_device_init_list
;
935 spinlock_t sas_device_lock
;
936 struct list_head raid_device_list
;
937 spinlock_t raid_device_lock
;
939 u16 device_missing_delay
;
941 void *blocking_handles
;
948 dma_addr_t config_page_dma
;
956 dma_addr_t request_dma
;
958 struct scsiio_tracker
*scsi_lookup
;
959 ulong scsi_lookup_pages
;
960 spinlock_t scsi_lookup_lock
;
961 struct list_head free_list
;
962 int pending_io_count
;
963 wait_queue_head_t reset_wq
;
966 struct chain_tracker
*chain_lookup
;
967 struct list_head free_chain_list
;
968 struct dma_pool
*chain_dma_pool
;
970 u16 max_sges_in_main_message
;
971 u16 max_sges_in_chain_message
;
972 u16 chains_needed_per_io
;
973 u16 chain_offset_value_for_main_message
;
976 /* hi-priority queue */
977 u16 hi_priority_smid
;
979 dma_addr_t hi_priority_dma
;
980 u16 hi_priority_depth
;
981 struct request_tracker
*hpr_lookup
;
982 struct list_head hpr_free_list
;
987 dma_addr_t internal_dma
;
989 struct request_tracker
*internal_lookup
;
990 struct list_head internal_free_list
;
994 dma_addr_t sense_dma
;
995 struct dma_pool
*sense_dma_pool
;
1000 dma_addr_t reply_dma
;
1001 u32 reply_dma_max_address
;
1002 u32 reply_dma_min_address
;
1003 struct dma_pool
*reply_dma_pool
;
1005 /* reply free queue */
1006 u16 reply_free_queue_depth
;
1008 dma_addr_t reply_free_dma
;
1009 struct dma_pool
*reply_free_dma_pool
;
1010 u32 reply_free_host_index
;
1012 /* reply post queue */
1013 u16 reply_post_queue_depth
;
1014 struct reply_post_struct
*reply_post
;
1015 u8 rdpq_array_capable
;
1016 u8 rdpq_array_enable
;
1017 u8 rdpq_array_enable_assigned
;
1018 struct dma_pool
*reply_post_free_dma_pool
;
1019 u8 reply_queue_count
;
1020 struct list_head reply_queue_list
;
1022 struct list_head delayed_tr_list
;
1023 struct list_head delayed_tr_volume_list
;
1024 u8 temp_sensors_count
;
1026 /* diag buffer support */
1027 u8
*diag_buffer
[MPI2_DIAG_BUF_TYPE_COUNT
];
1028 u32 diag_buffer_sz
[MPI2_DIAG_BUF_TYPE_COUNT
];
1029 dma_addr_t diag_buffer_dma
[MPI2_DIAG_BUF_TYPE_COUNT
];
1030 u8 diag_buffer_status
[MPI2_DIAG_BUF_TYPE_COUNT
];
1031 u32 unique_id
[MPI2_DIAG_BUF_TYPE_COUNT
];
1032 Mpi2ManufacturingPage10_t manu_pg10
;
1033 u32 product_specific
[MPI2_DIAG_BUF_TYPE_COUNT
][23];
1034 u32 diagnostic_flags
[MPI2_DIAG_BUF_TYPE_COUNT
];
1035 u32 ring_buffer_offset
;
1039 u8 mfg_pg10_hide_flag
;
1042 struct mutex pci_access_mutex
;
1045 typedef u8 (*MPT_CALLBACK
)(struct MPT2SAS_ADAPTER
*ioc
, u16 smid
, u8 msix_index
,
1049 /* base shared API */
1050 extern struct list_head mpt2sas_ioc_list
;
1051 /* spinlock on list operations over IOCs
1052 * Case: when multiple warpdrive cards(IOCs) are in use
1053 * Each IOC will added to the ioc list stucture on initialization.
1054 * Watchdog threads run at regular intervals to check IOC for any
1055 * fault conditions which will trigger the dead_ioc thread to
1056 * deallocate pci resource, resulting deleting the IOC netry from list,
1057 * this deletion need to protected by spinlock to enusre that
1058 * ioc removal is syncrhonized, if not synchronized it might lead to
1059 * list_del corruption as the ioc list is traversed in cli path
1061 extern spinlock_t gioc_lock
;
1062 void mpt2sas_base_start_watchdog(struct MPT2SAS_ADAPTER
*ioc
);
1063 void mpt2sas_base_stop_watchdog(struct MPT2SAS_ADAPTER
*ioc
);
1065 int mpt2sas_base_attach(struct MPT2SAS_ADAPTER
*ioc
);
1066 void mpt2sas_base_detach(struct MPT2SAS_ADAPTER
*ioc
);
1067 int mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER
*ioc
);
1068 void mpt2sas_base_free_resources(struct MPT2SAS_ADAPTER
*ioc
);
1069 int mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER
*ioc
, int sleep_flag
,
1070 enum reset_type type
);
1072 void *mpt2sas_base_get_msg_frame(struct MPT2SAS_ADAPTER
*ioc
, u16 smid
);
1073 void *mpt2sas_base_get_sense_buffer(struct MPT2SAS_ADAPTER
*ioc
, u16 smid
);
1074 void mpt2sas_base_build_zero_len_sge(struct MPT2SAS_ADAPTER
*ioc
, void *paddr
);
1075 __le32
mpt2sas_base_get_sense_buffer_dma(struct MPT2SAS_ADAPTER
*ioc
,
1077 void mpt2sas_base_flush_reply_queues(struct MPT2SAS_ADAPTER
*ioc
);
1079 /* hi-priority queue */
1080 u16
mpt2sas_base_get_smid_hpr(struct MPT2SAS_ADAPTER
*ioc
, u8 cb_idx
);
1081 u16
mpt2sas_base_get_smid_scsiio(struct MPT2SAS_ADAPTER
*ioc
, u8 cb_idx
,
1082 struct scsi_cmnd
*scmd
);
1084 u16
mpt2sas_base_get_smid(struct MPT2SAS_ADAPTER
*ioc
, u8 cb_idx
);
1085 void mpt2sas_base_free_smid(struct MPT2SAS_ADAPTER
*ioc
, u16 smid
);
1086 void mpt2sas_base_put_smid_scsi_io(struct MPT2SAS_ADAPTER
*ioc
, u16 smid
,
1088 void mpt2sas_base_put_smid_hi_priority(struct MPT2SAS_ADAPTER
*ioc
, u16 smid
);
1089 void mpt2sas_base_put_smid_target_assist(struct MPT2SAS_ADAPTER
*ioc
, u16 smid
,
1091 void mpt2sas_base_put_smid_default(struct MPT2SAS_ADAPTER
*ioc
, u16 smid
);
1092 void mpt2sas_base_initialize_callback_handler(void);
1093 u8
mpt2sas_base_register_callback_handler(MPT_CALLBACK cb_func
);
1094 void mpt2sas_base_release_callback_handler(u8 cb_idx
);
1096 u8
mpt2sas_base_done(struct MPT2SAS_ADAPTER
*ioc
, u16 smid
, u8 msix_index
,
1098 u8
mpt2sas_port_enable_done(struct MPT2SAS_ADAPTER
*ioc
, u16 smid
,
1099 u8 msix_index
, u32 reply
);
1100 void *mpt2sas_base_get_reply_virt_addr(struct MPT2SAS_ADAPTER
*ioc
, u32 phys_addr
);
1102 u32
mpt2sas_base_get_iocstate(struct MPT2SAS_ADAPTER
*ioc
, int cooked
);
1104 void mpt2sas_base_fault_info(struct MPT2SAS_ADAPTER
*ioc
, u16 fault_code
);
1105 int mpt2sas_base_sas_iounit_control(struct MPT2SAS_ADAPTER
*ioc
,
1106 Mpi2SasIoUnitControlReply_t
*mpi_reply
, Mpi2SasIoUnitControlRequest_t
1108 int mpt2sas_base_scsi_enclosure_processor(struct MPT2SAS_ADAPTER
*ioc
,
1109 Mpi2SepReply_t
*mpi_reply
, Mpi2SepRequest_t
*mpi_request
);
1110 void mpt2sas_base_validate_event_type(struct MPT2SAS_ADAPTER
*ioc
, u32
*event_type
);
1112 void mpt2sas_halt_firmware(struct MPT2SAS_ADAPTER
*ioc
);
1114 void mpt2sas_base_update_missing_delay(struct MPT2SAS_ADAPTER
*ioc
,
1115 u16 device_missing_delay
, u8 io_missing_delay
);
1117 int mpt2sas_port_enable(struct MPT2SAS_ADAPTER
*ioc
);
1119 /* scsih shared API */
1120 void mpt2sas_scsih_event_callback(struct MPT2SAS_ADAPTER
*ioc
, u8 msix_index
,
1122 int mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER
*ioc
, u16 handle
,
1123 uint channel
, uint id
, uint lun
, u8 type
, u16 smid_task
,
1124 ulong timeout
, enum mutex_type m_type
);
1125 void mpt2sas_scsih_set_tm_flag(struct MPT2SAS_ADAPTER
*ioc
, u16 handle
);
1126 void mpt2sas_scsih_clear_tm_flag(struct MPT2SAS_ADAPTER
*ioc
, u16 handle
);
1127 void mpt2sas_expander_remove(struct MPT2SAS_ADAPTER
*ioc
, u64 sas_address
);
1128 void mpt2sas_device_remove_by_sas_address(struct MPT2SAS_ADAPTER
*ioc
,
1130 struct _sas_node
*mpt2sas_scsih_expander_find_by_handle(struct MPT2SAS_ADAPTER
*ioc
,
1132 struct _sas_node
*mpt2sas_scsih_expander_find_by_sas_address(struct MPT2SAS_ADAPTER
1133 *ioc
, u64 sas_address
);
1134 struct _sas_device
*mpt2sas_get_sdev_by_addr(
1135 struct MPT2SAS_ADAPTER
*ioc
, u64 sas_address
);
1136 struct _sas_device
*__mpt2sas_get_sdev_by_addr(
1137 struct MPT2SAS_ADAPTER
*ioc
, u64 sas_address
);
1139 void mpt2sas_port_enable_complete(struct MPT2SAS_ADAPTER
*ioc
);
1140 void mpt2sas_scsih_reset_handler(struct MPT2SAS_ADAPTER
*ioc
, int reset_phase
);
1142 /* config shared API */
1143 u8
mpt2sas_config_done(struct MPT2SAS_ADAPTER
*ioc
, u16 smid
, u8 msix_index
,
1145 int mpt2sas_config_get_number_hba_phys(struct MPT2SAS_ADAPTER
*ioc
, u8
*num_phys
);
1146 int mpt2sas_config_get_manufacturing_pg0(struct MPT2SAS_ADAPTER
*ioc
,
1147 Mpi2ConfigReply_t
*mpi_reply
, Mpi2ManufacturingPage0_t
*config_page
);
1148 int mpt2sas_config_get_manufacturing_pg10(struct MPT2SAS_ADAPTER
*ioc
,
1149 Mpi2ConfigReply_t
*mpi_reply
, Mpi2ManufacturingPage10_t
*config_page
);
1150 int mpt2sas_config_get_bios_pg2(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1151 *mpi_reply
, Mpi2BiosPage2_t
*config_page
);
1152 int mpt2sas_config_get_bios_pg3(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1153 *mpi_reply
, Mpi2BiosPage3_t
*config_page
);
1154 int mpt2sas_config_get_iounit_pg0(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1155 *mpi_reply
, Mpi2IOUnitPage0_t
*config_page
);
1156 int mpt2sas_config_get_sas_device_pg0(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1157 *mpi_reply
, Mpi2SasDevicePage0_t
*config_page
, u32 form
, u32 handle
);
1158 int mpt2sas_config_get_sas_device_pg1(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1159 *mpi_reply
, Mpi2SasDevicePage1_t
*config_page
, u32 form
, u32 handle
);
1160 int mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1161 *mpi_reply
, Mpi2SasIOUnitPage0_t
*config_page
, u16 sz
);
1162 int mpt2sas_config_get_iounit_pg1(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1163 *mpi_reply
, Mpi2IOUnitPage1_t
*config_page
);
1164 int mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1165 *mpi_reply
, Mpi2IOUnitPage1_t
*config_page
);
1166 int mpt2sas_config_get_iounit_pg8(struct MPT2SAS_ADAPTER
*ioc
,
1167 Mpi2ConfigReply_t
*mpi_reply
, Mpi2IOUnitPage8_t
*config_page
);
1168 int mpt2sas_config_get_iounit_pg3(struct MPT2SAS_ADAPTER
*ioc
,
1169 Mpi2ConfigReply_t
*mpi_reply
, Mpi2IOUnitPage3_t
*config_page
, u16 sz
);
1170 int mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1171 *mpi_reply
, Mpi2SasIOUnitPage1_t
*config_page
, u16 sz
);
1172 int mpt2sas_config_set_sas_iounit_pg1(struct MPT2SAS_ADAPTER
*ioc
,
1173 Mpi2ConfigReply_t
*mpi_reply
, Mpi2SasIOUnitPage1_t
*config_page
, u16 sz
);
1174 int mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1175 *mpi_reply
, Mpi2IOCPage8_t
*config_page
);
1176 int mpt2sas_config_get_expander_pg0(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1177 *mpi_reply
, Mpi2ExpanderPage0_t
*config_page
, u32 form
, u32 handle
);
1178 int mpt2sas_config_get_expander_pg1(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1179 *mpi_reply
, Mpi2ExpanderPage1_t
*config_page
, u32 phy_number
, u16 handle
);
1180 int mpt2sas_config_get_enclosure_pg0(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1181 *mpi_reply
, Mpi2SasEnclosurePage0_t
*config_page
, u32 form
, u32 handle
);
1182 int mpt2sas_config_get_phy_pg0(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1183 *mpi_reply
, Mpi2SasPhyPage0_t
*config_page
, u32 phy_number
);
1184 int mpt2sas_config_get_phy_pg1(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1185 *mpi_reply
, Mpi2SasPhyPage1_t
*config_page
, u32 phy_number
);
1186 int mpt2sas_config_get_raid_volume_pg1(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1187 *mpi_reply
, Mpi2RaidVolPage1_t
*config_page
, u32 form
, u32 handle
);
1188 int mpt2sas_config_get_number_pds(struct MPT2SAS_ADAPTER
*ioc
, u16 handle
, u8
*num_pds
);
1189 int mpt2sas_config_get_raid_volume_pg0(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1190 *mpi_reply
, Mpi2RaidVolPage0_t
*config_page
, u32 form
, u32 handle
, u16 sz
);
1191 int mpt2sas_config_get_phys_disk_pg0(struct MPT2SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1192 *mpi_reply
, Mpi2RaidPhysDiskPage0_t
*config_page
, u32 form
,
1194 int mpt2sas_config_get_volume_handle(struct MPT2SAS_ADAPTER
*ioc
, u16 pd_handle
,
1195 u16
*volume_handle
);
1196 int mpt2sas_config_get_volume_wwid(struct MPT2SAS_ADAPTER
*ioc
, u16 volume_handle
,
1198 /* ctl shared API */
1199 extern struct device_attribute
*mpt2sas_host_attrs
[];
1200 extern struct device_attribute
*mpt2sas_dev_attrs
[];
1201 void mpt2sas_ctl_init(void);
1202 void mpt2sas_ctl_exit(void);
1203 u8
mpt2sas_ctl_done(struct MPT2SAS_ADAPTER
*ioc
, u16 smid
, u8 msix_index
,
1205 void mpt2sas_ctl_reset_handler(struct MPT2SAS_ADAPTER
*ioc
, int reset_phase
);
1206 void mpt2sas_ctl_event_callback(struct MPT2SAS_ADAPTER
*ioc
, u8 msix_index
,
1208 void mpt2sas_ctl_add_to_event_log(struct MPT2SAS_ADAPTER
*ioc
,
1209 Mpi2EventNotificationReply_t
*mpi_reply
);
1211 void mpt2sas_enable_diag_buffer(struct MPT2SAS_ADAPTER
*ioc
,
1212 u8 bits_to_regsiter
);
1214 /* transport shared API */
1215 u8
mpt2sas_transport_done(struct MPT2SAS_ADAPTER
*ioc
, u16 smid
, u8 msix_index
,
1217 struct _sas_port
*mpt2sas_transport_port_add(struct MPT2SAS_ADAPTER
*ioc
,
1218 u16 handle
, u64 sas_address
);
1219 void mpt2sas_transport_port_remove(struct MPT2SAS_ADAPTER
*ioc
, u64 sas_address
,
1220 u64 sas_address_parent
);
1221 int mpt2sas_transport_add_host_phy(struct MPT2SAS_ADAPTER
*ioc
, struct _sas_phy
1222 *mpt2sas_phy
, Mpi2SasPhyPage0_t phy_pg0
, struct device
*parent_dev
);
1223 int mpt2sas_transport_add_expander_phy(struct MPT2SAS_ADAPTER
*ioc
, struct _sas_phy
1224 *mpt2sas_phy
, Mpi2ExpanderPage1_t expander_pg1
, struct device
*parent_dev
);
1225 void mpt2sas_transport_update_links(struct MPT2SAS_ADAPTER
*ioc
,
1226 u64 sas_address
, u16 handle
, u8 phy_number
, u8 link_rate
);
1227 extern struct sas_function_template mpt2sas_transport_functions
;
1228 extern struct scsi_transport_template
*mpt2sas_transport_template
;
1229 extern int scsi_internal_device_block(struct scsi_device
*sdev
);
1230 extern u8
mpt2sas_stm_zero_smid_handler(struct MPT2SAS_ADAPTER
*ioc
,
1231 u8 msix_index
, u32 reply
);
1232 extern int scsi_internal_device_unblock(struct scsi_device
*sdev
,
1233 enum scsi_device_state new_state
);
1235 #endif /* MPT2SAS_BASE_H_INCLUDED */