18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * linux/drivers/message/fusion/mptscsih.h 38c2ecf20Sopenharmony_ci * High performance SCSI / Fibre Channel SCSI Host device driver. 48c2ecf20Sopenharmony_ci * For use with PCI chip/adapter(s): 58c2ecf20Sopenharmony_ci * LSIFC9xx/LSI409xx Fibre Channel 68c2ecf20Sopenharmony_ci * running LSI Fusion MPT (Message Passing Technology) firmware. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Copyright (c) 1999-2008 LSI Corporation 98c2ecf20Sopenharmony_ci * (mailto:DL-MPTFusionLinux@lsi.com) 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 138c2ecf20Sopenharmony_ci/* 148c2ecf20Sopenharmony_ci This program is free software; you can redistribute it and/or modify 158c2ecf20Sopenharmony_ci it under the terms of the GNU General Public License as published by 168c2ecf20Sopenharmony_ci the Free Software Foundation; version 2 of the License. 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci This program is distributed in the hope that it will be useful, 198c2ecf20Sopenharmony_ci but WITHOUT ANY WARRANTY; without even the implied warranty of 208c2ecf20Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 218c2ecf20Sopenharmony_ci GNU General Public License for more details. 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci NO WARRANTY 248c2ecf20Sopenharmony_ci THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR 258c2ecf20Sopenharmony_ci CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT 268c2ecf20Sopenharmony_ci LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, 278c2ecf20Sopenharmony_ci MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is 288c2ecf20Sopenharmony_ci solely responsible for determining the appropriateness of using and 298c2ecf20Sopenharmony_ci distributing the Program and assumes all risks associated with its 308c2ecf20Sopenharmony_ci exercise of rights under this Agreement, including but not limited to 318c2ecf20Sopenharmony_ci the risks and costs of program errors, damage to or loss of data, 328c2ecf20Sopenharmony_ci programs or equipment, and unavailability or interruption of operations. 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci DISCLAIMER OF LIABILITY 358c2ecf20Sopenharmony_ci NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY 368c2ecf20Sopenharmony_ci DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 378c2ecf20Sopenharmony_ci DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND 388c2ecf20Sopenharmony_ci ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 398c2ecf20Sopenharmony_ci TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 408c2ecf20Sopenharmony_ci USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED 418c2ecf20Sopenharmony_ci HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci You should have received a copy of the GNU General Public License 448c2ecf20Sopenharmony_ci along with this program; if not, write to the Free Software 458c2ecf20Sopenharmony_ci Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 468c2ecf20Sopenharmony_ci*/ 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#ifndef SCSIHOST_H_INCLUDED 498c2ecf20Sopenharmony_ci#define SCSIHOST_H_INCLUDED 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 528c2ecf20Sopenharmony_ci/* 538c2ecf20Sopenharmony_ci * SCSI Public stuff... 548c2ecf20Sopenharmony_ci */ 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci#define MPT_SCANDV_GOOD (0x00000000) /* must be 0 */ 578c2ecf20Sopenharmony_ci#define MPT_SCANDV_DID_RESET (0x00000001) 588c2ecf20Sopenharmony_ci#define MPT_SCANDV_SENSE (0x00000002) 598c2ecf20Sopenharmony_ci#define MPT_SCANDV_SOME_ERROR (0x00000004) 608c2ecf20Sopenharmony_ci#define MPT_SCANDV_SELECTION_TIMEOUT (0x00000008) 618c2ecf20Sopenharmony_ci#define MPT_SCANDV_ISSUE_SENSE (0x00000010) 628c2ecf20Sopenharmony_ci#define MPT_SCANDV_FALLBACK (0x00000020) 638c2ecf20Sopenharmony_ci#define MPT_SCANDV_BUSY (0x00000040) 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci#define MPT_SCANDV_MAX_RETRIES (10) 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci#define MPT_ICFLAG_BUF_CAP 0x01 /* ReadBuffer Read Capacity format */ 688c2ecf20Sopenharmony_ci#define MPT_ICFLAG_ECHO 0x02 /* ReadBuffer Echo buffer format */ 698c2ecf20Sopenharmony_ci#define MPT_ICFLAG_EBOS 0x04 /* ReadBuffer Echo buffer has EBOS */ 708c2ecf20Sopenharmony_ci#define MPT_ICFLAG_PHYS_DISK 0x08 /* Any SCSI IO but do Phys Disk Format */ 718c2ecf20Sopenharmony_ci#define MPT_ICFLAG_TAGGED_CMD 0x10 /* Do tagged IO */ 728c2ecf20Sopenharmony_ci#define MPT_ICFLAG_DID_RESET 0x20 /* Bus Reset occurred with this command */ 738c2ecf20Sopenharmony_ci#define MPT_ICFLAG_RESERVED 0x40 /* Reserved has been issued */ 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#define MPT_SCSI_CMD_PER_DEV_HIGH 64 768c2ecf20Sopenharmony_ci#define MPT_SCSI_CMD_PER_DEV_LOW 32 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci#define MPT_SCSI_CMD_PER_LUN 7 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci#define MPT_SCSI_MAX_SECTORS 8192 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci/* SCSI driver setup structure. Settings can be overridden 838c2ecf20Sopenharmony_ci * by command line options. 848c2ecf20Sopenharmony_ci */ 858c2ecf20Sopenharmony_ci#define MPTSCSIH_DOMAIN_VALIDATION 1 868c2ecf20Sopenharmony_ci#define MPTSCSIH_MAX_WIDTH 1 878c2ecf20Sopenharmony_ci#define MPTSCSIH_MIN_SYNC 0x08 888c2ecf20Sopenharmony_ci#define MPTSCSIH_SAF_TE 0 898c2ecf20Sopenharmony_ci#define MPTSCSIH_PT_CLEAR 0 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci#endif 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_citypedef struct _internal_cmd { 958c2ecf20Sopenharmony_ci char *data; /* data pointer */ 968c2ecf20Sopenharmony_ci dma_addr_t data_dma; /* data dma address */ 978c2ecf20Sopenharmony_ci int size; /* transfer size */ 988c2ecf20Sopenharmony_ci u8 cmd; /* SCSI Op Code */ 998c2ecf20Sopenharmony_ci u8 channel; /* bus number */ 1008c2ecf20Sopenharmony_ci u8 id; /* SCSI ID (virtual) */ 1018c2ecf20Sopenharmony_ci u64 lun; 1028c2ecf20Sopenharmony_ci u8 flags; /* Bit Field - See above */ 1038c2ecf20Sopenharmony_ci u8 physDiskNum; /* Phys disk number, -1 else */ 1048c2ecf20Sopenharmony_ci u8 rsvd2; 1058c2ecf20Sopenharmony_ci u8 rsvd; 1068c2ecf20Sopenharmony_ci} INTERNAL_CMD; 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ciextern void mptscsih_remove(struct pci_dev *); 1098c2ecf20Sopenharmony_ciextern void mptscsih_shutdown(struct pci_dev *); 1108c2ecf20Sopenharmony_ci#ifdef CONFIG_PM 1118c2ecf20Sopenharmony_ciextern int mptscsih_suspend(struct pci_dev *pdev, pm_message_t state); 1128c2ecf20Sopenharmony_ciextern int mptscsih_resume(struct pci_dev *pdev); 1138c2ecf20Sopenharmony_ci#endif 1148c2ecf20Sopenharmony_ciextern int mptscsih_show_info(struct seq_file *, struct Scsi_Host *); 1158c2ecf20Sopenharmony_ciextern const char * mptscsih_info(struct Scsi_Host *SChost); 1168c2ecf20Sopenharmony_ciextern int mptscsih_qcmd(struct scsi_cmnd *SCpnt); 1178c2ecf20Sopenharmony_ciextern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, 1188c2ecf20Sopenharmony_ci u8 id, u64 lun, int ctx2abort, ulong timeout); 1198c2ecf20Sopenharmony_ciextern void mptscsih_slave_destroy(struct scsi_device *device); 1208c2ecf20Sopenharmony_ciextern int mptscsih_slave_configure(struct scsi_device *device); 1218c2ecf20Sopenharmony_ciextern int mptscsih_abort(struct scsi_cmnd * SCpnt); 1228c2ecf20Sopenharmony_ciextern int mptscsih_dev_reset(struct scsi_cmnd * SCpnt); 1238c2ecf20Sopenharmony_ciextern int mptscsih_bus_reset(struct scsi_cmnd * SCpnt); 1248c2ecf20Sopenharmony_ciextern int mptscsih_host_reset(struct scsi_cmnd *SCpnt); 1258c2ecf20Sopenharmony_ciextern int mptscsih_bios_param(struct scsi_device * sdev, struct block_device *bdev, sector_t capacity, int geom[]); 1268c2ecf20Sopenharmony_ciextern int mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); 1278c2ecf20Sopenharmony_ciextern int mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); 1288c2ecf20Sopenharmony_ciextern int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); 1298c2ecf20Sopenharmony_ciextern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply); 1308c2ecf20Sopenharmony_ciextern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); 1318c2ecf20Sopenharmony_ciextern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth); 1328c2ecf20Sopenharmony_ciextern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id); 1338c2ecf20Sopenharmony_ciextern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id); 1348c2ecf20Sopenharmony_ciextern struct device_attribute *mptscsih_host_attrs[]; 1358c2ecf20Sopenharmony_ciextern struct scsi_cmnd *mptscsih_get_scsi_lookup(MPT_ADAPTER *ioc, int i); 1368c2ecf20Sopenharmony_ciextern void mptscsih_taskmgmt_response_code(MPT_ADAPTER *ioc, u8 response_code); 1378c2ecf20Sopenharmony_ciextern void mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd); 138