[SCSI] mpt2sas: make global symbols unique
[linux-2.6/mini2440.git] / drivers / scsi / mpt2sas / mpt2sas_base.h
blob6945ff4d382e669ade4c126273f72d74c59253d2
1 /*
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-2008 LSI Corporation
7 * (mailto:DL-MPTFusionLinux@lsi.com)
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * NO WARRANTY
20 * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
21 * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
22 * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
23 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
24 * solely responsible for determining the appropriateness of using and
25 * distributing the Program and assumes all risks associated with its
26 * exercise of rights under this Agreement, including but not limited to
27 * the risks and costs of program errors, damage to or loss of data,
28 * programs or equipment, and unavailability or interruption of operations.
30 * DISCLAIMER OF LIABILITY
31 * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
32 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
34 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
35 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
36 * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
37 * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
39 * You should have received a copy of the GNU General Public License
40 * along with this program; if not, write to the Free Software
41 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
42 * USA.
45 #ifndef MPT2SAS_BASE_H_INCLUDED
46 #define MPT2SAS_BASE_H_INCLUDED
48 #include "mpi/mpi2_type.h"
49 #include "mpi/mpi2.h"
50 #include "mpi/mpi2_ioc.h"
51 #include "mpi/mpi2_cnfg.h"
52 #include "mpi/mpi2_init.h"
53 #include "mpi/mpi2_raid.h"
54 #include "mpi/mpi2_tool.h"
55 #include "mpi/mpi2_sas.h"
57 #include <scsi/scsi.h>
58 #include <scsi/scsi_cmnd.h>
59 #include <scsi/scsi_device.h>
60 #include <scsi/scsi_host.h>
61 #include <scsi/scsi_tcq.h>
62 #include <scsi/scsi_transport_sas.h>
63 #include <scsi/scsi_dbg.h>
65 #include "mpt2sas_debug.h"
67 /* driver versioning info */
68 #define MPT2SAS_DRIVER_NAME "mpt2sas"
69 #define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>"
70 #define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver"
71 #define MPT2SAS_DRIVER_VERSION "00.100.11.16"
72 #define MPT2SAS_MAJOR_VERSION 00
73 #define MPT2SAS_MINOR_VERSION 100
74 #define MPT2SAS_BUILD_VERSION 11
75 #define MPT2SAS_RELEASE_VERSION 16
78 * Set MPT2SAS_SG_DEPTH value based on user input.
80 #ifdef CONFIG_SCSI_MPT2SAS_MAX_SGE
81 #if CONFIG_SCSI_MPT2SAS_MAX_SGE < 16
82 #define MPT2SAS_SG_DEPTH 16
83 #elif CONFIG_SCSI_MPT2SAS_MAX_SGE > 128
84 #define MPT2SAS_SG_DEPTH 128
85 #else
86 #define MPT2SAS_SG_DEPTH CONFIG_SCSI_MPT2SAS_MAX_SGE
87 #endif
88 #else
89 #define MPT2SAS_SG_DEPTH 128 /* MAX_HW_SEGMENTS */
90 #endif
94 * Generic Defines
96 #define MPT2SAS_SATA_QUEUE_DEPTH 32
97 #define MPT2SAS_SAS_QUEUE_DEPTH 254
98 #define MPT2SAS_RAID_QUEUE_DEPTH 128
100 #define MPT_NAME_LENGTH 32 /* generic length of strings */
101 #define MPT_STRING_LENGTH 64
103 #define MPT_MAX_CALLBACKS 16
105 #define CAN_SLEEP 1
106 #define NO_SLEEP 0
108 #define INTERNAL_CMDS_COUNT 10 /* reserved cmds */
110 #define MPI2_HIM_MASK 0xFFFFFFFF /* mask every bit*/
112 #define MPT2SAS_INVALID_DEVICE_HANDLE 0xFFFF
116 * reset phases
118 #define MPT2_IOC_PRE_RESET 1 /* prior to host reset */
119 #define MPT2_IOC_AFTER_RESET 2 /* just after host reset */
120 #define MPT2_IOC_DONE_RESET 3 /* links re-initialized */
123 * logging format
125 #define MPT2SAS_FMT "%s: "
126 #define MPT2SAS_DEBUG_FMT KERN_DEBUG MPT2SAS_FMT
127 #define MPT2SAS_INFO_FMT KERN_INFO MPT2SAS_FMT
128 #define MPT2SAS_NOTE_FMT KERN_NOTICE MPT2SAS_FMT
129 #define MPT2SAS_WARN_FMT KERN_WARNING MPT2SAS_FMT
130 #define MPT2SAS_ERR_FMT KERN_ERR MPT2SAS_FMT
133 * per target private data
135 #define MPT_TARGET_FLAGS_RAID_COMPONENT 0x01
136 #define MPT_TARGET_FLAGS_VOLUME 0x02
137 #define MPT_TARGET_FLAGS_DELETED 0x04
140 * struct MPT2SAS_TARGET - starget private hostdata
141 * @starget: starget object
142 * @sas_address: target sas address
143 * @handle: device handle
144 * @num_luns: number luns
145 * @flags: MPT_TARGET_FLAGS_XXX flags
146 * @deleted: target flaged for deletion
147 * @tm_busy: target is busy with TM request.
149 struct MPT2SAS_TARGET {
150 struct scsi_target *starget;
151 u64 sas_address;
152 u16 handle;
153 int num_luns;
154 u32 flags;
155 u8 deleted;
156 u8 tm_busy;
160 * per device private data
162 #define MPT_DEVICE_FLAGS_INIT 0x01
163 #define MPT_DEVICE_TLR_ON 0x02
166 * struct MPT2SAS_DEVICE - sdev private hostdata
167 * @sas_target: starget private hostdata
168 * @lun: lun number
169 * @flags: MPT_DEVICE_XXX flags
170 * @configured_lun: lun is configured
171 * @block: device is in SDEV_BLOCK state
172 * @tlr_snoop_check: flag used in determining whether to disable TLR
174 struct MPT2SAS_DEVICE {
175 struct MPT2SAS_TARGET *sas_target;
176 unsigned int lun;
177 u32 flags;
178 u8 configured_lun;
179 u8 block;
180 u8 tlr_snoop_check;
183 #define MPT2_CMD_NOT_USED 0x8000 /* free */
184 #define MPT2_CMD_COMPLETE 0x0001 /* completed */
185 #define MPT2_CMD_PENDING 0x0002 /* pending */
186 #define MPT2_CMD_REPLY_VALID 0x0004 /* reply is valid */
187 #define MPT2_CMD_RESET 0x0008 /* host reset dropped the command */
190 * struct _internal_cmd - internal commands struct
191 * @mutex: mutex
192 * @done: completion
193 * @reply: reply message pointer
194 * @status: MPT2_CMD_XXX status
195 * @smid: system message id
197 struct _internal_cmd {
198 struct mutex mutex;
199 struct completion done;
200 void *reply;
201 u16 status;
202 u16 smid;
206 * SAS Topology Structures
210 * struct _sas_device - attached device information
211 * @list: sas device list
212 * @starget: starget object
213 * @sas_address: device sas address
214 * @device_name: retrieved from the SAS IDENTIFY frame.
215 * @handle: device handle
216 * @parent_handle: handle to parent device
217 * @enclosure_handle: enclosure handle
218 * @enclosure_logical_id: enclosure logical identifier
219 * @volume_handle: volume handle (valid when hidden raid member)
220 * @volume_wwid: volume unique identifier
221 * @device_info: bitfield provides detailed info about the device
222 * @id: target id
223 * @channel: target channel
224 * @slot: number number
225 * @hidden_raid_component: set to 1 when this is a raid member
226 * @responding: used in _scsih_sas_device_mark_responding
228 struct _sas_device {
229 struct list_head list;
230 struct scsi_target *starget;
231 u64 sas_address;
232 u64 device_name;
233 u16 handle;
234 u16 parent_handle;
235 u16 enclosure_handle;
236 u64 enclosure_logical_id;
237 u16 volume_handle;
238 u64 volume_wwid;
239 u32 device_info;
240 int id;
241 int channel;
242 u16 slot;
243 u8 hidden_raid_component;
244 u8 responding;
248 * struct _raid_device - raid volume link list
249 * @list: sas device list
250 * @starget: starget object
251 * @sdev: scsi device struct (volumes are single lun)
252 * @wwid: unique identifier for the volume
253 * @handle: device handle
254 * @id: target id
255 * @channel: target channel
256 * @volume_type: the raid level
257 * @device_info: bitfield provides detailed info about the hidden components
258 * @num_pds: number of hidden raid components
259 * @responding: used in _scsih_raid_device_mark_responding
261 struct _raid_device {
262 struct list_head list;
263 struct scsi_target *starget;
264 struct scsi_device *sdev;
265 u64 wwid;
266 u16 handle;
267 int id;
268 int channel;
269 u8 volume_type;
270 u32 device_info;
271 u8 num_pds;
272 u8 responding;
276 * struct _boot_device - boot device info
277 * @is_raid: flag to indicate whether this is volume
278 * @device: holds pointer for either struct _sas_device or
279 * struct _raid_device
281 struct _boot_device {
282 u8 is_raid;
283 void *device;
287 * struct _sas_port - wide/narrow sas port information
288 * @port_list: list of ports belonging to expander
289 * @handle: device handle for this port
290 * @sas_address: sas address of this port
291 * @num_phys: number of phys belonging to this port
292 * @remote_identify: attached device identification
293 * @rphy: sas transport rphy object
294 * @port: sas transport wide/narrow port object
295 * @phy_list: _sas_phy list objects belonging to this port
297 struct _sas_port {
298 struct list_head port_list;
299 u16 handle;
300 u64 sas_address;
301 u8 num_phys;
302 struct sas_identify remote_identify;
303 struct sas_rphy *rphy;
304 struct sas_port *port;
305 struct list_head phy_list;
309 * struct _sas_phy - phy information
310 * @port_siblings: list of phys belonging to a port
311 * @identify: phy identification
312 * @remote_identify: attached device identification
313 * @phy: sas transport phy object
314 * @phy_id: unique phy id
315 * @handle: device handle for this phy
316 * @attached_handle: device handle for attached device
318 struct _sas_phy {
319 struct list_head port_siblings;
320 struct sas_identify identify;
321 struct sas_identify remote_identify;
322 struct sas_phy *phy;
323 u8 phy_id;
324 u16 handle;
325 u16 attached_handle;
329 * struct _sas_node - sas_host/expander information
330 * @list: list of expanders
331 * @parent_dev: parent device class
332 * @num_phys: number phys belonging to this sas_host/expander
333 * @sas_address: sas address of this sas_host/expander
334 * @handle: handle for this sas_host/expander
335 * @parent_handle: parent handle
336 * @enclosure_handle: handle for this a member of an enclosure
337 * @device_info: bitwise defining capabilities of this sas_host/expander
338 * @responding: used in _scsih_expander_device_mark_responding
339 * @phy: a list of phys that make up this sas_host/expander
340 * @sas_port_list: list of ports attached to this sas_host/expander
342 struct _sas_node {
343 struct list_head list;
344 struct device *parent_dev;
345 u8 num_phys;
346 u64 sas_address;
347 u16 handle;
348 u16 parent_handle;
349 u16 enclosure_handle;
350 u64 enclosure_logical_id;
351 u8 responding;
352 struct _sas_phy *phy;
353 struct list_head sas_port_list;
357 * enum reset_type - reset state
358 * @FORCE_BIG_HAMMER: issue diagnostic reset
359 * @SOFT_RESET: issue message_unit_reset, if fails to to big hammer
361 enum reset_type {
362 FORCE_BIG_HAMMER,
363 SOFT_RESET,
367 * struct request_tracker - firmware request tracker
368 * @smid: system message id
369 * @scmd: scsi request pointer
370 * @cb_idx: callback index
371 * @chain_list: list of chains associated to this IO
372 * @tracker_list: list of free request (ioc->free_list)
374 struct request_tracker {
375 u16 smid;
376 struct scsi_cmnd *scmd;
377 u8 cb_idx;
378 struct list_head tracker_list;
381 typedef void (*MPT_ADD_SGE)(void *paddr, u32 flags_length, dma_addr_t dma_addr);
384 * struct MPT2SAS_ADAPTER - per adapter struct
385 * @list: ioc_list
386 * @shost: shost object
387 * @id: unique adapter id
388 * @pci_irq: irq number
389 * @name: generic ioc string
390 * @tmp_string: tmp string used for logging
391 * @pdev: pci pdev object
392 * @chip: memory mapped register space
393 * @chip_phys: physical addrss prior to mapping
394 * @pio_chip: I/O mapped register space
395 * @logging_level: see mpt2sas_debug.h
396 * @ir_firmware: IR firmware present
397 * @bars: bitmask of BAR's that must be configured
398 * @mask_interrupts: ignore interrupt
399 * @fault_reset_work_q_name: fw fault work queue
400 * @fault_reset_work_q: ""
401 * @fault_reset_work: ""
402 * @firmware_event_name: fw event work queue
403 * @firmware_event_thread: ""
404 * @fw_events_off: flag to turn off fw event handling
405 * @fw_event_lock:
406 * @fw_event_list: list of fw events
407 * @aen_event_read_flag: event log was read
408 * @broadcast_aen_busy: broadcast aen waiting to be serviced
409 * @ioc_reset_in_progress: host reset in progress
410 * @ioc_reset_in_progress_lock:
411 * @ioc_link_reset_in_progress: phy/hard reset in progress
412 * @ignore_loginfos: ignore loginfos during task managment
413 * @remove_host: flag for when driver unloads, to avoid sending dev resets
414 * @wait_for_port_enable_to_complete:
415 * @msix_enable: flag indicating msix is enabled
416 * @msix_vector_count: number msix vectors
417 * @msix_table: virt address to the msix table
418 * @msix_table_backup: backup msix table
419 * @scsi_io_cb_idx: shost generated commands
420 * @tm_cb_idx: task management commands
421 * @transport_cb_idx: transport internal commands
422 * @ctl_cb_idx: clt internal commands
423 * @base_cb_idx: base internal commands
424 * @config_cb_idx: base internal commands
425 * @base_cmds:
426 * @transport_cmds:
427 * @tm_cmds:
428 * @ctl_cmds:
429 * @config_cmds:
430 * @base_add_sg_single: handler for either 32/64 bit sgl's
431 * @event_type: bits indicating which events to log
432 * @event_context: unique id for each logged event
433 * @event_log: event log pointer
434 * @event_masks: events that are masked
435 * @facts: static facts data
436 * @pfacts: static port facts data
437 * @manu_pg0: static manufacturing page 0
438 * @bios_pg2: static bios page 2
439 * @bios_pg3: static bios page 3
440 * @ioc_pg8: static ioc page 8
441 * @iounit_pg0: static iounit page 0
442 * @iounit_pg1: static iounit page 1
443 * @sas_hba: sas host object
444 * @sas_expander_list: expander object list
445 * @sas_node_lock:
446 * @sas_device_list: sas device object list
447 * @sas_device_init_list: sas device object list (used only at init time)
448 * @sas_device_lock:
449 * @io_missing_delay: time for IO completed by fw when PDR enabled
450 * @device_missing_delay: time for device missing by fw when PDR enabled
451 * @config_page_sz: config page size
452 * @config_page: reserve memory for config page payload
453 * @config_page_dma:
454 * @sge_size: sg element size for either 32/64 bit
455 * @request_depth: hba request queue depth
456 * @request_sz: per request frame size
457 * @request: pool of request frames
458 * @request_dma:
459 * @request_dma_sz:
460 * @scsi_lookup: firmware request tracker list
461 * @scsi_lookup_lock:
462 * @free_list: free list of request
463 * @chain: pool of chains
464 * @pending_io_count:
465 * @reset_wq:
466 * @chain_dma:
467 * @max_sges_in_main_message: number sg elements in main message
468 * @max_sges_in_chain_message: number sg elements per chain
469 * @chains_needed_per_io: max chains per io
470 * @chain_offset_value_for_main_message: location 1st sg in main
471 * @chain_depth: total chains allocated
472 * @sense: pool of sense
473 * @sense_dma:
474 * @sense_dma_pool:
475 * @reply_depth: hba reply queue depth:
476 * @reply_sz: per reply frame size:
477 * @reply: pool of replys:
478 * @reply_dma:
479 * @reply_dma_pool:
480 * @reply_free_queue_depth: reply free depth
481 * @reply_free: pool for reply free queue (32 bit addr)
482 * @reply_free_dma:
483 * @reply_free_dma_pool:
484 * @reply_free_host_index: tail index in pool to insert free replys
485 * @reply_post_queue_depth: reply post queue depth
486 * @reply_post_free: pool for reply post (64bit descriptor)
487 * @reply_post_free_dma:
488 * @reply_post_free_dma_pool:
489 * @reply_post_host_index: head index in the pool where FW completes IO
491 struct MPT2SAS_ADAPTER {
492 struct list_head list;
493 struct Scsi_Host *shost;
494 u8 id;
495 u32 pci_irq;
496 char name[MPT_NAME_LENGTH];
497 char tmp_string[MPT_STRING_LENGTH];
498 struct pci_dev *pdev;
499 Mpi2SystemInterfaceRegs_t __iomem *chip;
500 unsigned long chip_phys;
501 unsigned long pio_chip;
502 int logging_level;
503 u8 ir_firmware;
504 int bars;
505 u8 mask_interrupts;
507 /* fw fault handler */
508 char fault_reset_work_q_name[20];
509 struct workqueue_struct *fault_reset_work_q;
510 struct delayed_work fault_reset_work;
512 /* fw event handler */
513 char firmware_event_name[20];
514 struct workqueue_struct *firmware_event_thread;
515 u8 fw_events_off;
516 spinlock_t fw_event_lock;
517 struct list_head fw_event_list;
519 /* misc flags */
520 int aen_event_read_flag;
521 u8 broadcast_aen_busy;
522 u8 ioc_reset_in_progress;
523 u8 shost_recovery;
524 spinlock_t ioc_reset_in_progress_lock;
525 u8 ioc_link_reset_in_progress;
526 u8 ignore_loginfos;
527 u8 remove_host;
528 u8 wait_for_port_enable_to_complete;
530 u8 msix_enable;
531 u16 msix_vector_count;
532 u32 *msix_table;
533 u32 *msix_table_backup;
535 /* internal commands, callback index */
536 u8 scsi_io_cb_idx;
537 u8 tm_cb_idx;
538 u8 transport_cb_idx;
539 u8 ctl_cb_idx;
540 u8 base_cb_idx;
541 u8 config_cb_idx;
542 struct _internal_cmd base_cmds;
543 struct _internal_cmd transport_cmds;
544 struct _internal_cmd tm_cmds;
545 struct _internal_cmd ctl_cmds;
546 struct _internal_cmd config_cmds;
548 MPT_ADD_SGE base_add_sg_single;
550 /* event log */
551 u32 event_type[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS];
552 u32 event_context;
553 void *event_log;
554 u32 event_masks[MPI2_EVENT_NOTIFY_EVENTMASK_WORDS];
556 /* static config pages */
557 Mpi2IOCFactsReply_t facts;
558 Mpi2PortFactsReply_t *pfacts;
559 Mpi2ManufacturingPage0_t manu_pg0;
560 Mpi2BiosPage2_t bios_pg2;
561 Mpi2BiosPage3_t bios_pg3;
562 Mpi2IOCPage8_t ioc_pg8;
563 Mpi2IOUnitPage0_t iounit_pg0;
564 Mpi2IOUnitPage1_t iounit_pg1;
566 struct _boot_device req_boot_device;
567 struct _boot_device req_alt_boot_device;
568 struct _boot_device current_boot_device;
570 /* sas hba, expander, and device list */
571 struct _sas_node sas_hba;
572 struct list_head sas_expander_list;
573 spinlock_t sas_node_lock;
574 struct list_head sas_device_list;
575 struct list_head sas_device_init_list;
576 spinlock_t sas_device_lock;
577 struct list_head raid_device_list;
578 spinlock_t raid_device_lock;
579 u8 io_missing_delay;
580 u16 device_missing_delay;
581 int sas_id;
583 /* config page */
584 u16 config_page_sz;
585 void *config_page;
586 dma_addr_t config_page_dma;
588 /* request */
589 u16 sge_size;
590 u16 request_depth;
591 u16 request_sz;
592 u8 *request;
593 dma_addr_t request_dma;
594 u32 request_dma_sz;
595 struct request_tracker *scsi_lookup;
596 spinlock_t scsi_lookup_lock;
597 struct list_head free_list;
598 int pending_io_count;
599 wait_queue_head_t reset_wq;
601 /* chain */
602 u8 *chain;
603 dma_addr_t chain_dma;
604 u16 max_sges_in_main_message;
605 u16 max_sges_in_chain_message;
606 u16 chains_needed_per_io;
607 u16 chain_offset_value_for_main_message;
608 u16 chain_depth;
610 /* sense */
611 u8 *sense;
612 dma_addr_t sense_dma;
613 struct dma_pool *sense_dma_pool;
615 /* reply */
616 u16 reply_sz;
617 u8 *reply;
618 dma_addr_t reply_dma;
619 struct dma_pool *reply_dma_pool;
621 /* reply free queue */
622 u16 reply_free_queue_depth;
623 u32 *reply_free;
624 dma_addr_t reply_free_dma;
625 struct dma_pool *reply_free_dma_pool;
626 u32 reply_free_host_index;
628 /* reply post queue */
629 u16 reply_post_queue_depth;
630 Mpi2ReplyDescriptorsUnion_t *reply_post_free;
631 dma_addr_t reply_post_free_dma;
632 struct dma_pool *reply_post_free_dma_pool;
633 u32 reply_post_host_index;
635 /* diag buffer support */
636 u8 *diag_buffer[MPI2_DIAG_BUF_TYPE_COUNT];
637 u32 diag_buffer_sz[MPI2_DIAG_BUF_TYPE_COUNT];
638 dma_addr_t diag_buffer_dma[MPI2_DIAG_BUF_TYPE_COUNT];
639 u8 diag_buffer_status[MPI2_DIAG_BUF_TYPE_COUNT];
640 u32 unique_id[MPI2_DIAG_BUF_TYPE_COUNT];
641 u32 product_specific[MPI2_DIAG_BUF_TYPE_COUNT][23];
642 u32 diagnostic_flags[MPI2_DIAG_BUF_TYPE_COUNT];
645 typedef void (*MPT_CALLBACK)(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID,
646 u32 reply);
649 /* base shared API */
650 extern struct list_head mpt2sas_ioc_list;
652 int mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc);
653 void mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc);
654 int mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc);
655 void mpt2sas_base_free_resources(struct MPT2SAS_ADAPTER *ioc);
656 int mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag,
657 enum reset_type type);
659 void *mpt2sas_base_get_msg_frame(struct MPT2SAS_ADAPTER *ioc, u16 smid);
660 void *mpt2sas_base_get_sense_buffer(struct MPT2SAS_ADAPTER *ioc, u16 smid);
661 void mpt2sas_base_build_zero_len_sge(struct MPT2SAS_ADAPTER *ioc, void *paddr);
662 dma_addr_t mpt2sas_base_get_msg_frame_dma(struct MPT2SAS_ADAPTER *ioc, u16 smid);
663 dma_addr_t mpt2sas_base_get_sense_buffer_dma(struct MPT2SAS_ADAPTER *ioc, u16 smid);
665 u16 mpt2sas_base_get_smid(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx);
666 void mpt2sas_base_free_smid(struct MPT2SAS_ADAPTER *ioc, u16 smid);
667 void mpt2sas_base_put_smid_scsi_io(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 vf_id,
668 u16 handle);
669 void mpt2sas_base_put_smid_hi_priority(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 vf_id);
670 void mpt2sas_base_put_smid_target_assist(struct MPT2SAS_ADAPTER *ioc, u16 smid,
671 u8 vf_id, u16 io_index);
672 void mpt2sas_base_put_smid_default(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 vf_id);
673 void mpt2sas_base_initialize_callback_handler(void);
674 u8 mpt2sas_base_register_callback_handler(MPT_CALLBACK cb_func);
675 void mpt2sas_base_release_callback_handler(u8 cb_idx);
677 void mpt2sas_base_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID, u32 reply);
678 void *mpt2sas_base_get_reply_virt_addr(struct MPT2SAS_ADAPTER *ioc, u32 phys_addr);
680 u32 mpt2sas_base_get_iocstate(struct MPT2SAS_ADAPTER *ioc, int cooked);
682 void mpt2sas_base_fault_info(struct MPT2SAS_ADAPTER *ioc , u16 fault_code);
683 int mpt2sas_base_sas_iounit_control(struct MPT2SAS_ADAPTER *ioc,
684 Mpi2SasIoUnitControlReply_t *mpi_reply, Mpi2SasIoUnitControlRequest_t
685 *mpi_request);
686 int mpt2sas_base_scsi_enclosure_processor(struct MPT2SAS_ADAPTER *ioc,
687 Mpi2SepReply_t *mpi_reply, Mpi2SepRequest_t *mpi_request);
688 void mpt2sas_base_validate_event_type(struct MPT2SAS_ADAPTER *ioc, u32 *event_type);
690 /* scsih shared API */
691 void mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle, uint lun,
692 u8 type, u16 smid_task, ulong timeout);
693 void mpt2sas_scsih_set_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle);
694 void mpt2sas_scsih_clear_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle);
695 struct _sas_node *mpt2sas_scsih_expander_find_by_handle(struct MPT2SAS_ADAPTER *ioc,
696 u16 handle);
697 struct _sas_node *mpt2sas_scsih_expander_find_by_sas_address(struct MPT2SAS_ADAPTER
698 *ioc, u64 sas_address);
699 struct _sas_device *mpt2sas_scsih_sas_device_find_by_sas_address(
700 struct MPT2SAS_ADAPTER *ioc, u64 sas_address);
702 void mpt2sas_scsih_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, u32 reply);
703 void mpt2sas_scsih_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase);
705 /* config shared API */
706 void mpt2sas_config_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID, u32 reply);
707 int mpt2sas_config_get_number_hba_phys(struct MPT2SAS_ADAPTER *ioc, u8 *num_phys);
708 int mpt2sas_config_get_manufacturing_pg0(struct MPT2SAS_ADAPTER *ioc,
709 Mpi2ConfigReply_t *mpi_reply, Mpi2ManufacturingPage0_t *config_page);
710 int mpt2sas_config_get_bios_pg2(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
711 *mpi_reply, Mpi2BiosPage2_t *config_page);
712 int mpt2sas_config_get_bios_pg3(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
713 *mpi_reply, Mpi2BiosPage3_t *config_page);
714 int mpt2sas_config_get_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
715 *mpi_reply, Mpi2IOUnitPage0_t *config_page);
716 int mpt2sas_config_get_sas_device_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
717 *mpi_reply, Mpi2SasDevicePage0_t *config_page, u32 form, u32 handle);
718 int mpt2sas_config_get_sas_device_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
719 *mpi_reply, Mpi2SasDevicePage1_t *config_page, u32 form, u32 handle);
720 int mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
721 *mpi_reply, Mpi2SasIOUnitPage0_t *config_page, u16 sz);
722 int mpt2sas_config_get_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
723 *mpi_reply, Mpi2IOUnitPage1_t *config_page);
724 int mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
725 *mpi_reply, Mpi2IOUnitPage1_t config_page);
726 int mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
727 *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz);
728 int mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
729 *mpi_reply, Mpi2IOCPage8_t *config_page);
730 int mpt2sas_config_get_expander_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
731 *mpi_reply, Mpi2ExpanderPage0_t *config_page, u32 form, u32 handle);
732 int mpt2sas_config_get_expander_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
733 *mpi_reply, Mpi2ExpanderPage1_t *config_page, u32 phy_number, u16 handle);
734 int mpt2sas_config_get_enclosure_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
735 *mpi_reply, Mpi2SasEnclosurePage0_t *config_page, u32 form, u32 handle);
736 int mpt2sas_config_get_phy_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
737 *mpi_reply, Mpi2SasPhyPage0_t *config_page, u32 phy_number);
738 int mpt2sas_config_get_phy_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
739 *mpi_reply, Mpi2SasPhyPage1_t *config_page, u32 phy_number);
740 int mpt2sas_config_get_raid_volume_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
741 *mpi_reply, Mpi2RaidVolPage1_t *config_page, u32 form, u32 handle);
742 int mpt2sas_config_get_number_pds(struct MPT2SAS_ADAPTER *ioc, u16 handle, u8 *num_pds);
743 int mpt2sas_config_get_raid_volume_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
744 *mpi_reply, Mpi2RaidVolPage0_t *config_page, u32 form, u32 handle, u16 sz);
745 int mpt2sas_config_get_phys_disk_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
746 *mpi_reply, Mpi2RaidPhysDiskPage0_t *config_page, u32 form,
747 u32 form_specific);
748 int mpt2sas_config_get_volume_handle(struct MPT2SAS_ADAPTER *ioc, u16 pd_handle,
749 u16 *volume_handle);
750 int mpt2sas_config_get_volume_wwid(struct MPT2SAS_ADAPTER *ioc, u16 volume_handle,
751 u64 *wwid);
753 /* ctl shared API */
754 extern struct device_attribute *mpt2sas_host_attrs[];
755 extern struct device_attribute *mpt2sas_dev_attrs[];
756 void mpt2sas_ctl_init(void);
757 void mpt2sas_ctl_exit(void);
758 void mpt2sas_ctl_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID, u32 reply);
759 void mpt2sas_ctl_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase);
760 void mpt2sas_ctl_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, u32 reply);
761 void mpt2sas_ctl_add_to_event_log(struct MPT2SAS_ADAPTER *ioc,
762 Mpi2EventNotificationReply_t *mpi_reply);
764 /* transport shared API */
765 void mpt2sas_transport_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID, u32 reply);
766 struct _sas_port *mpt2sas_transport_port_add(struct MPT2SAS_ADAPTER *ioc,
767 u16 handle, u16 parent_handle);
768 void mpt2sas_transport_port_remove(struct MPT2SAS_ADAPTER *ioc, u64 sas_address,
769 u16 parent_handle);
770 int mpt2sas_transport_add_host_phy(struct MPT2SAS_ADAPTER *ioc, struct _sas_phy
771 *mpt2sas_phy, Mpi2SasPhyPage0_t phy_pg0, struct device *parent_dev);
772 int mpt2sas_transport_add_expander_phy(struct MPT2SAS_ADAPTER *ioc, struct _sas_phy
773 *mpt2sas_phy, Mpi2ExpanderPage1_t expander_pg1, struct device *parent_dev);
774 void mpt2sas_transport_update_phy_link_change(struct MPT2SAS_ADAPTER *ioc, u16 handle,
775 u16 attached_handle, u8 phy_number, u8 link_rate);
776 extern struct sas_function_template mpt2sas_transport_functions;
777 extern struct scsi_transport_template *mpt2sas_transport_template;
779 #endif /* MPT2SAS_BASE_H_INCLUDED */