162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * linux/drivers/message/fusion/mptscsih.h 362306a36Sopenharmony_ci * High performance SCSI / Fibre Channel SCSI Host device driver. 462306a36Sopenharmony_ci * For use with PCI chip/adapter(s): 562306a36Sopenharmony_ci * LSIFC9xx/LSI409xx Fibre Channel 662306a36Sopenharmony_ci * running LSI Fusion MPT (Message Passing Technology) firmware. 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * Copyright (c) 1999-2008 LSI Corporation 962306a36Sopenharmony_ci * (mailto:DL-MPTFusionLinux@lsi.com) 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci */ 1262306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1362306a36Sopenharmony_ci/* 1462306a36Sopenharmony_ci This program is free software; you can redistribute it and/or modify 1562306a36Sopenharmony_ci it under the terms of the GNU General Public License as published by 1662306a36Sopenharmony_ci the Free Software Foundation; version 2 of the License. 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci This program is distributed in the hope that it will be useful, 1962306a36Sopenharmony_ci but WITHOUT ANY WARRANTY; without even the implied warranty of 2062306a36Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 2162306a36Sopenharmony_ci GNU General Public License for more details. 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci NO WARRANTY 2462306a36Sopenharmony_ci THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR 2562306a36Sopenharmony_ci CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT 2662306a36Sopenharmony_ci LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, 2762306a36Sopenharmony_ci MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is 2862306a36Sopenharmony_ci solely responsible for determining the appropriateness of using and 2962306a36Sopenharmony_ci distributing the Program and assumes all risks associated with its 3062306a36Sopenharmony_ci exercise of rights under this Agreement, including but not limited to 3162306a36Sopenharmony_ci the risks and costs of program errors, damage to or loss of data, 3262306a36Sopenharmony_ci programs or equipment, and unavailability or interruption of operations. 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci DISCLAIMER OF LIABILITY 3562306a36Sopenharmony_ci NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY 3662306a36Sopenharmony_ci DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3762306a36Sopenharmony_ci DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND 3862306a36Sopenharmony_ci ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 3962306a36Sopenharmony_ci TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 4062306a36Sopenharmony_ci USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED 4162306a36Sopenharmony_ci HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci You should have received a copy of the GNU General Public License 4462306a36Sopenharmony_ci along with this program; if not, write to the Free Software 4562306a36Sopenharmony_ci Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 4662306a36Sopenharmony_ci*/ 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci#ifndef SCSIHOST_H_INCLUDED 4962306a36Sopenharmony_ci#define SCSIHOST_H_INCLUDED 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 5262306a36Sopenharmony_ci/* 5362306a36Sopenharmony_ci * SCSI Public stuff... 5462306a36Sopenharmony_ci */ 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci#define MPT_SCANDV_GOOD (0x00000000) /* must be 0 */ 5762306a36Sopenharmony_ci#define MPT_SCANDV_DID_RESET (0x00000001) 5862306a36Sopenharmony_ci#define MPT_SCANDV_SENSE (0x00000002) 5962306a36Sopenharmony_ci#define MPT_SCANDV_SOME_ERROR (0x00000004) 6062306a36Sopenharmony_ci#define MPT_SCANDV_SELECTION_TIMEOUT (0x00000008) 6162306a36Sopenharmony_ci#define MPT_SCANDV_ISSUE_SENSE (0x00000010) 6262306a36Sopenharmony_ci#define MPT_SCANDV_FALLBACK (0x00000020) 6362306a36Sopenharmony_ci#define MPT_SCANDV_BUSY (0x00000040) 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci#define MPT_SCANDV_MAX_RETRIES (10) 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci#define MPT_ICFLAG_BUF_CAP 0x01 /* ReadBuffer Read Capacity format */ 6862306a36Sopenharmony_ci#define MPT_ICFLAG_ECHO 0x02 /* ReadBuffer Echo buffer format */ 6962306a36Sopenharmony_ci#define MPT_ICFLAG_EBOS 0x04 /* ReadBuffer Echo buffer has EBOS */ 7062306a36Sopenharmony_ci#define MPT_ICFLAG_PHYS_DISK 0x08 /* Any SCSI IO but do Phys Disk Format */ 7162306a36Sopenharmony_ci#define MPT_ICFLAG_TAGGED_CMD 0x10 /* Do tagged IO */ 7262306a36Sopenharmony_ci#define MPT_ICFLAG_DID_RESET 0x20 /* Bus Reset occurred with this command */ 7362306a36Sopenharmony_ci#define MPT_ICFLAG_RESERVED 0x40 /* Reserved has been issued */ 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci#define MPT_SCSI_CMD_PER_DEV_HIGH 64 7662306a36Sopenharmony_ci#define MPT_SCSI_CMD_PER_DEV_LOW 32 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci#define MPT_SCSI_CMD_PER_LUN 7 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_ci#define MPT_SCSI_MAX_SECTORS 8192 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci/* SCSI driver setup structure. Settings can be overridden 8362306a36Sopenharmony_ci * by command line options. 8462306a36Sopenharmony_ci */ 8562306a36Sopenharmony_ci#define MPTSCSIH_DOMAIN_VALIDATION 1 8662306a36Sopenharmony_ci#define MPTSCSIH_MAX_WIDTH 1 8762306a36Sopenharmony_ci#define MPTSCSIH_MIN_SYNC 0x08 8862306a36Sopenharmony_ci#define MPTSCSIH_SAF_TE 0 8962306a36Sopenharmony_ci#define MPTSCSIH_PT_CLEAR 0 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci#endif 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_citypedef struct _internal_cmd { 9562306a36Sopenharmony_ci char *data; /* data pointer */ 9662306a36Sopenharmony_ci dma_addr_t data_dma; /* data dma address */ 9762306a36Sopenharmony_ci int size; /* transfer size */ 9862306a36Sopenharmony_ci u8 cmd; /* SCSI Op Code */ 9962306a36Sopenharmony_ci u8 channel; /* bus number */ 10062306a36Sopenharmony_ci u8 id; /* SCSI ID (virtual) */ 10162306a36Sopenharmony_ci u64 lun; 10262306a36Sopenharmony_ci u8 flags; /* Bit Field - See above */ 10362306a36Sopenharmony_ci u8 physDiskNum; /* Phys disk number, -1 else */ 10462306a36Sopenharmony_ci u8 rsvd2; 10562306a36Sopenharmony_ci u8 rsvd; 10662306a36Sopenharmony_ci} INTERNAL_CMD; 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ciextern void mptscsih_remove(struct pci_dev *); 10962306a36Sopenharmony_ciextern void mptscsih_shutdown(struct pci_dev *); 11062306a36Sopenharmony_ci#ifdef CONFIG_PM 11162306a36Sopenharmony_ciextern int mptscsih_suspend(struct pci_dev *pdev, pm_message_t state); 11262306a36Sopenharmony_ciextern int mptscsih_resume(struct pci_dev *pdev); 11362306a36Sopenharmony_ci#endif 11462306a36Sopenharmony_ciextern int mptscsih_show_info(struct seq_file *, struct Scsi_Host *); 11562306a36Sopenharmony_ciextern const char * mptscsih_info(struct Scsi_Host *SChost); 11662306a36Sopenharmony_ciextern int mptscsih_qcmd(struct scsi_cmnd *SCpnt); 11762306a36Sopenharmony_ciextern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, 11862306a36Sopenharmony_ci u8 id, u64 lun, int ctx2abort, ulong timeout); 11962306a36Sopenharmony_ciextern void mptscsih_slave_destroy(struct scsi_device *device); 12062306a36Sopenharmony_ciextern int mptscsih_slave_configure(struct scsi_device *device); 12162306a36Sopenharmony_ciextern int mptscsih_abort(struct scsi_cmnd * SCpnt); 12262306a36Sopenharmony_ciextern int mptscsih_dev_reset(struct scsi_cmnd * SCpnt); 12362306a36Sopenharmony_ciextern int mptscsih_bus_reset(struct scsi_cmnd * SCpnt); 12462306a36Sopenharmony_ciextern int mptscsih_host_reset(struct scsi_cmnd *SCpnt); 12562306a36Sopenharmony_ciextern int mptscsih_bios_param(struct scsi_device * sdev, struct block_device *bdev, sector_t capacity, int geom[]); 12662306a36Sopenharmony_ciextern int mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); 12762306a36Sopenharmony_ciextern int mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); 12862306a36Sopenharmony_ciextern int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); 12962306a36Sopenharmony_ciextern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply); 13062306a36Sopenharmony_ciextern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); 13162306a36Sopenharmony_ciextern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth); 13262306a36Sopenharmony_ciextern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id); 13362306a36Sopenharmony_ciextern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id); 13462306a36Sopenharmony_ciextern const struct attribute_group *mptscsih_host_attr_groups[]; 13562306a36Sopenharmony_ciextern struct scsi_cmnd *mptscsih_get_scsi_lookup(MPT_ADAPTER *ioc, int i); 13662306a36Sopenharmony_ciextern void mptscsih_taskmgmt_response_code(MPT_ADAPTER *ioc, u8 response_code); 13762306a36Sopenharmony_ciextern void mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd); 138