ipr.h
来自「linux 内核源代码」· C头文件 代码 · 共 1,569 行 · 第 1/3 页
H
1,569 行
/* * ipr.h -- driver for IBM Power Linux RAID adapters * * Written By: Brian King <brking@us.ibm.com>, IBM Corporation * * Copyright (C) 2003, 2004 IBM Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Alan Cox <alan@redhat.com> - Removed several careless u32/dma_addr_t errors * that broke 64bit platforms. */#ifndef _IPR_H#define _IPR_H#include <linux/types.h>#include <linux/completion.h>#include <linux/libata.h>#include <linux/list.h>#include <linux/kref.h>#include <scsi/scsi.h>#include <scsi/scsi_cmnd.h>/* * Literals */#define IPR_DRIVER_VERSION "2.4.1"#define IPR_DRIVER_DATE "(April 24, 2007)"/* * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding * ops per device for devices not running tagged command queuing. * This can be adjusted at runtime through sysfs device attributes. */#define IPR_MAX_CMD_PER_LUN 6#define IPR_MAX_CMD_PER_ATA_LUN 1/* * IPR_NUM_BASE_CMD_BLKS: This defines the maximum number of * ops the mid-layer can send to the adapter. */#define IPR_NUM_BASE_CMD_BLKS 100#define PCI_DEVICE_ID_IBM_OBSIDIAN_E 0x0339#define PCI_DEVICE_ID_IBM_SCAMP_E 0x034A#define IPR_SUBS_DEV_ID_2780 0x0264#define IPR_SUBS_DEV_ID_5702 0x0266#define IPR_SUBS_DEV_ID_5703 0x0278#define IPR_SUBS_DEV_ID_572E 0x028D#define IPR_SUBS_DEV_ID_573E 0x02D3#define IPR_SUBS_DEV_ID_573D 0x02D4#define IPR_SUBS_DEV_ID_571A 0x02C0#define IPR_SUBS_DEV_ID_571B 0x02BE#define IPR_SUBS_DEV_ID_571E 0x02BF#define IPR_SUBS_DEV_ID_571F 0x02D5#define IPR_SUBS_DEV_ID_572A 0x02C1#define IPR_SUBS_DEV_ID_572B 0x02C2#define IPR_SUBS_DEV_ID_572F 0x02C3#define IPR_SUBS_DEV_ID_574D 0x030B#define IPR_SUBS_DEV_ID_574E 0x030A#define IPR_SUBS_DEV_ID_575B 0x030D#define IPR_SUBS_DEV_ID_575C 0x0338#define IPR_SUBS_DEV_ID_575D 0x033E#define IPR_SUBS_DEV_ID_57B3 0x033A#define IPR_SUBS_DEV_ID_57B7 0x0360#define IPR_SUBS_DEV_ID_57B8 0x02C2#define IPR_NAME "ipr"/* * Return codes */#define IPR_RC_JOB_CONTINUE 1#define IPR_RC_JOB_RETURN 2/* * IOASCs */#define IPR_IOASC_NR_INIT_CMD_REQUIRED 0x02040200#define IPR_IOASC_NR_IOA_RESET_REQUIRED 0x02048000#define IPR_IOASC_SYNC_REQUIRED 0x023f0000#define IPR_IOASC_MED_DO_NOT_REALLOC 0x03110C00#define IPR_IOASC_HW_SEL_TIMEOUT 0x04050000#define IPR_IOASC_HW_DEV_BUS_STATUS 0x04448500#define IPR_IOASC_IOASC_MASK 0xFFFFFF00#define IPR_IOASC_SCSI_STATUS_MASK 0x000000FF#define IPR_IOASC_IR_INVALID_REQ_TYPE_OR_PKT 0x05240000#define IPR_IOASC_IR_RESOURCE_HANDLE 0x05250000#define IPR_IOASC_IR_NO_CMDS_TO_2ND_IOA 0x05258100#define IPR_IOASA_IR_DUAL_IOA_DISABLED 0x052C8000#define IPR_IOASC_BUS_WAS_RESET 0x06290000#define IPR_IOASC_BUS_WAS_RESET_BY_OTHER 0x06298000#define IPR_IOASC_ABORTED_CMD_TERM_BY_HOST 0x0B5A0000#define IPR_FIRST_DRIVER_IOASC 0x10000000#define IPR_IOASC_IOA_WAS_RESET 0x10000001#define IPR_IOASC_PCI_ACCESS_ERROR 0x10000002/* Driver data flags */#define IPR_USE_LONG_TRANSOP_TIMEOUT 0x00000001#define IPR_USE_PCI_WARM_RESET 0x00000002#define IPR_DEFAULT_MAX_ERROR_DUMP 984#define IPR_NUM_LOG_HCAMS 2#define IPR_NUM_CFG_CHG_HCAMS 2#define IPR_NUM_HCAMS (IPR_NUM_LOG_HCAMS + IPR_NUM_CFG_CHG_HCAMS)#define IPR_MAX_NUM_TARGETS_PER_BUS 256#define IPR_MAX_NUM_LUNS_PER_TARGET 256#define IPR_MAX_NUM_VSET_LUNS_PER_TARGET 8#define IPR_VSET_BUS 0xff#define IPR_IOA_BUS 0xff#define IPR_IOA_TARGET 0xff#define IPR_IOA_LUN 0xff#define IPR_MAX_NUM_BUSES 16#define IPR_MAX_BUS_TO_SCAN IPR_MAX_NUM_BUSES#define IPR_NUM_RESET_RELOAD_RETRIES 3/* We need resources for HCAMS, IOA reset, IOA bringdown, and ERP */#define IPR_NUM_INTERNAL_CMD_BLKS (IPR_NUM_HCAMS + \ ((IPR_NUM_RESET_RELOAD_RETRIES + 1) * 2) + 3)#define IPR_MAX_COMMANDS IPR_NUM_BASE_CMD_BLKS#define IPR_NUM_CMD_BLKS (IPR_NUM_BASE_CMD_BLKS + \ IPR_NUM_INTERNAL_CMD_BLKS)#define IPR_MAX_PHYSICAL_DEVS 192#define IPR_MAX_SGLIST 64#define IPR_IOA_MAX_SECTORS 32767#define IPR_VSET_MAX_SECTORS 512#define IPR_MAX_CDB_LEN 16#define IPR_DEFAULT_BUS_WIDTH 16#define IPR_80MBs_SCSI_RATE ((80 * 10) / (IPR_DEFAULT_BUS_WIDTH / 8))#define IPR_U160_SCSI_RATE ((160 * 10) / (IPR_DEFAULT_BUS_WIDTH / 8))#define IPR_U320_SCSI_RATE ((320 * 10) / (IPR_DEFAULT_BUS_WIDTH / 8))#define IPR_MAX_SCSI_RATE(width) ((320 * 10) / ((width) / 8))#define IPR_IOA_RES_HANDLE 0xffffffff#define IPR_INVALID_RES_HANDLE 0#define IPR_IOA_RES_ADDR 0x00ffffff/* * Adapter Commands */#define IPR_QUERY_RSRC_STATE 0xC2#define IPR_RESET_DEVICE 0xC3#define IPR_RESET_TYPE_SELECT 0x80#define IPR_LUN_RESET 0x40#define IPR_TARGET_RESET 0x20#define IPR_BUS_RESET 0x10#define IPR_ATA_PHY_RESET 0x80#define IPR_ID_HOST_RR_Q 0xC4#define IPR_QUERY_IOA_CONFIG 0xC5#define IPR_CANCEL_ALL_REQUESTS 0xCE#define IPR_HOST_CONTROLLED_ASYNC 0xCF#define IPR_HCAM_CDB_OP_CODE_CONFIG_CHANGE 0x01#define IPR_HCAM_CDB_OP_CODE_LOG_DATA 0x02#define IPR_SET_SUPPORTED_DEVICES 0xFB#define IPR_IOA_SHUTDOWN 0xF7#define IPR_WR_BUF_DOWNLOAD_AND_SAVE 0x05/* * Timeouts */#define IPR_SHUTDOWN_TIMEOUT (ipr_fastfail ? 60 * HZ : 10 * 60 * HZ)#define IPR_VSET_RW_TIMEOUT (ipr_fastfail ? 30 * HZ : 2 * 60 * HZ)#define IPR_ABBREV_SHUTDOWN_TIMEOUT (10 * HZ)#define IPR_DUAL_IOA_ABBR_SHUTDOWN_TO (2 * 60 * HZ)#define IPR_DEVICE_RESET_TIMEOUT (ipr_fastfail ? 10 * HZ : 30 * HZ)#define IPR_CANCEL_ALL_TIMEOUT (ipr_fastfail ? 10 * HZ : 30 * HZ)#define IPR_ABORT_TASK_TIMEOUT (ipr_fastfail ? 10 * HZ : 30 * HZ)#define IPR_INTERNAL_TIMEOUT (ipr_fastfail ? 10 * HZ : 30 * HZ)#define IPR_WRITE_BUFFER_TIMEOUT (10 * 60 * HZ)#define IPR_SET_SUP_DEVICE_TIMEOUT (2 * 60 * HZ)#define IPR_REQUEST_SENSE_TIMEOUT (10 * HZ)#define IPR_OPERATIONAL_TIMEOUT (5 * 60)#define IPR_LONG_OPERATIONAL_TIMEOUT (12 * 60)#define IPR_WAIT_FOR_RESET_TIMEOUT (2 * HZ)#define IPR_CHECK_FOR_RESET_TIMEOUT (HZ / 10)#define IPR_WAIT_FOR_BIST_TIMEOUT (2 * HZ)#define IPR_PCI_RESET_TIMEOUT (HZ / 2)#define IPR_DUMP_TIMEOUT (15 * HZ)/* * SCSI Literals */#define IPR_VENDOR_ID_LEN 8#define IPR_PROD_ID_LEN 16#define IPR_SERIAL_NUM_LEN 8/* * Hardware literals */#define IPR_FMT2_MBX_ADDR_MASK 0x0fffffff#define IPR_FMT2_MBX_BAR_SEL_MASK 0xf0000000#define IPR_FMT2_MKR_BAR_SEL_SHIFT 28#define IPR_GET_FMT2_BAR_SEL(mbx) \(((mbx) & IPR_FMT2_MBX_BAR_SEL_MASK) >> IPR_FMT2_MKR_BAR_SEL_SHIFT)#define IPR_SDT_FMT2_BAR0_SEL 0x0#define IPR_SDT_FMT2_BAR1_SEL 0x1#define IPR_SDT_FMT2_BAR2_SEL 0x2#define IPR_SDT_FMT2_BAR3_SEL 0x3#define IPR_SDT_FMT2_BAR4_SEL 0x4#define IPR_SDT_FMT2_BAR5_SEL 0x5#define IPR_SDT_FMT2_EXP_ROM_SEL 0x8#define IPR_FMT2_SDT_READY_TO_USE 0xC4D4E3F2#define IPR_DOORBELL 0x82800000#define IPR_RUNTIME_RESET 0x40000000#define IPR_PCII_IOA_TRANS_TO_OPER (0x80000000 >> 0)#define IPR_PCII_IOARCB_XFER_FAILED (0x80000000 >> 3)#define IPR_PCII_IOA_UNIT_CHECKED (0x80000000 >> 4)#define IPR_PCII_NO_HOST_RRQ (0x80000000 >> 5)#define IPR_PCII_CRITICAL_OPERATION (0x80000000 >> 6)#define IPR_PCII_IO_DEBUG_ACKNOWLEDGE (0x80000000 >> 7)#define IPR_PCII_IOARRIN_LOST (0x80000000 >> 27)#define IPR_PCII_MMIO_ERROR (0x80000000 >> 28)#define IPR_PCII_PROC_ERR_STATE (0x80000000 >> 29)#define IPR_PCII_HRRQ_UPDATED (0x80000000 >> 30)#define IPR_PCII_CORE_ISSUED_RST_REQ (0x80000000 >> 31)#define IPR_PCII_ERROR_INTERRUPTS \(IPR_PCII_IOARCB_XFER_FAILED | IPR_PCII_IOA_UNIT_CHECKED | \IPR_PCII_NO_HOST_RRQ | IPR_PCII_IOARRIN_LOST | IPR_PCII_MMIO_ERROR)#define IPR_PCII_OPER_INTERRUPTS \(IPR_PCII_ERROR_INTERRUPTS | IPR_PCII_HRRQ_UPDATED | IPR_PCII_IOA_TRANS_TO_OPER)#define IPR_UPROCI_RESET_ALERT (0x80000000 >> 7)#define IPR_UPROCI_IO_DEBUG_ALERT (0x80000000 >> 9)#define IPR_LDUMP_MAX_LONG_ACK_DELAY_IN_USEC 200000 /* 200 ms */#define IPR_LDUMP_MAX_SHORT_ACK_DELAY_IN_USEC 200000 /* 200 ms *//* * Dump literals */#define IPR_MAX_IOA_DUMP_SIZE (4 * 1024 * 1024)#define IPR_NUM_SDT_ENTRIES 511#define IPR_MAX_NUM_DUMP_PAGES ((IPR_MAX_IOA_DUMP_SIZE / PAGE_SIZE) + 1)/* * Misc literals */#define IPR_NUM_IOADL_ENTRIES IPR_MAX_SGLIST/* * Adapter interface types */struct ipr_res_addr { u8 reserved; u8 bus; u8 target; u8 lun;#define IPR_GET_PHYS_LOC(res_addr) \ (((res_addr).bus << 16) | ((res_addr).target << 8) | (res_addr).lun)}__attribute__((packed, aligned (4)));struct ipr_std_inq_vpids { u8 vendor_id[IPR_VENDOR_ID_LEN]; u8 product_id[IPR_PROD_ID_LEN];}__attribute__((packed));struct ipr_vpd { struct ipr_std_inq_vpids vpids; u8 sn[IPR_SERIAL_NUM_LEN];}__attribute__((packed));struct ipr_ext_vpd { struct ipr_vpd vpd; __be32 wwid[2];}__attribute__((packed));struct ipr_std_inq_data { u8 peri_qual_dev_type;#define IPR_STD_INQ_PERI_QUAL(peri) ((peri) >> 5)#define IPR_STD_INQ_PERI_DEV_TYPE(peri) ((peri) & 0x1F) u8 removeable_medium_rsvd;#define IPR_STD_INQ_REMOVEABLE_MEDIUM 0x80#define IPR_IS_DASD_DEVICE(std_inq) \((IPR_STD_INQ_PERI_DEV_TYPE((std_inq).peri_qual_dev_type) == TYPE_DISK) && \!(((std_inq).removeable_medium_rsvd) & IPR_STD_INQ_REMOVEABLE_MEDIUM))#define IPR_IS_SES_DEVICE(std_inq) \(IPR_STD_INQ_PERI_DEV_TYPE((std_inq).peri_qual_dev_type) == TYPE_ENCLOSURE) u8 version; u8 aen_naca_fmt; u8 additional_len; u8 sccs_rsvd; u8 bq_enc_multi; u8 sync_cmdq_flags; struct ipr_std_inq_vpids vpids; u8 ros_rsvd_ram_rsvd[4]; u8 serial_num[IPR_SERIAL_NUM_LEN];}__attribute__ ((packed));struct ipr_config_table_entry { u8 proto;#define IPR_PROTO_SATA 0x02#define IPR_PROTO_SATA_ATAPI 0x03#define IPR_PROTO_SAS_STP 0x06#define IPR_PROTO_SAS_STP_ATAPI 0x07 u8 array_id; u8 flags;#define IPR_IS_IOA_RESOURCE 0x80#define IPR_IS_ARRAY_MEMBER 0x20#define IPR_IS_HOT_SPARE 0x10 u8 rsvd_subtype;#define IPR_RES_SUBTYPE(res) (((res)->cfgte.rsvd_subtype) & 0x0f)#define IPR_SUBTYPE_AF_DASD 0#define IPR_SUBTYPE_GENERIC_SCSI 1#define IPR_SUBTYPE_VOLUME_SET 2#define IPR_SUBTYPE_GENERIC_ATA 4#define IPR_QUEUEING_MODEL(res) ((((res)->cfgte.flags) & 0x70) >> 4)#define IPR_QUEUE_FROZEN_MODEL 0#define IPR_QUEUE_NACA_MODEL 1 struct ipr_res_addr res_addr; __be32 res_handle; __be32 reserved4[2]; struct ipr_std_inq_data std_inq_data;}__attribute__ ((packed, aligned (4)));struct ipr_config_table_hdr { u8 num_entries; u8 flags;#define IPR_UCODE_DOWNLOAD_REQ 0x10 __be16 reserved;}__attribute__((packed, aligned (4)));struct ipr_config_table { struct ipr_config_table_hdr hdr; struct ipr_config_table_entry dev[IPR_MAX_PHYSICAL_DEVS];}__attribute__((packed, aligned (4)));struct ipr_hostrcb_cfg_ch_not { struct ipr_config_table_entry cfgte; u8 reserved[936];}__attribute__((packed, aligned (4)));struct ipr_supported_device { __be16 data_length; u8 reserved; u8 num_records; struct ipr_std_inq_vpids vpids; u8 reserved2[16];}__attribute__((packed, aligned (4)));/* Command packet structure */struct ipr_cmd_pkt { __be16 reserved; /* Reserved by IOA */ u8 request_type;#define IPR_RQTYPE_SCSICDB 0x00#define IPR_RQTYPE_IOACMD 0x01#define IPR_RQTYPE_HCAM 0x02#define IPR_RQTYPE_ATA_PASSTHRU 0x04 u8 luntar_luntrn; u8 flags_hi;#define IPR_FLAGS_HI_WRITE_NOT_READ 0x80#define IPR_FLAGS_HI_NO_ULEN_CHK 0x20#define IPR_FLAGS_HI_SYNC_OVERRIDE 0x10#define IPR_FLAGS_HI_SYNC_COMPLETE 0x08#define IPR_FLAGS_HI_NO_LINK_DESC 0x04 u8 flags_lo;#define IPR_FLAGS_LO_ALIGNED_BFR 0x20#define IPR_FLAGS_LO_DELAY_AFTER_RST 0x10#define IPR_FLAGS_LO_UNTAGGED_TASK 0x00#define IPR_FLAGS_LO_SIMPLE_TASK 0x02#define IPR_FLAGS_LO_ORDERED_TASK 0x04#define IPR_FLAGS_LO_HEAD_OF_Q_TASK 0x06#define IPR_FLAGS_LO_ACA_TASK 0x08 u8 cdb[16]; __be16 timeout;}__attribute__ ((packed, aligned(4)));struct ipr_ioarcb_ata_regs { u8 flags;#define IPR_ATA_FLAG_PACKET_CMD 0x80#define IPR_ATA_FLAG_XFER_TYPE_DMA 0x40#define IPR_ATA_FLAG_STATUS_ON_GOOD_COMPLETION 0x20 u8 reserved[3]; __be16 data; u8 feature; u8 nsect; u8 lbal; u8 lbam; u8 lbah; u8 device; u8 command; u8 reserved2[3]; u8 hob_feature; u8 hob_nsect; u8 hob_lbal; u8 hob_lbam; u8 hob_lbah; u8 ctl;}__attribute__ ((packed, aligned(4)));struct ipr_ioadl_desc { __be32 flags_and_data_len;#define IPR_IOADL_FLAGS_MASK 0xff000000#define IPR_IOADL_GET_FLAGS(x) (be32_to_cpu(x) & IPR_IOADL_FLAGS_MASK)#define IPR_IOADL_DATA_LEN_MASK 0x00ffffff#define IPR_IOADL_GET_DATA_LEN(x) (be32_to_cpu(x) & IPR_IOADL_DATA_LEN_MASK)#define IPR_IOADL_FLAGS_READ 0x48000000#define IPR_IOADL_FLAGS_READ_LAST 0x49000000#define IPR_IOADL_FLAGS_WRITE 0x68000000#define IPR_IOADL_FLAGS_WRITE_LAST 0x69000000#define IPR_IOADL_FLAGS_LAST 0x01000000 __be32 address;}__attribute__((packed, aligned (8)));struct ipr_ioarcb_add_data { union { struct ipr_ioarcb_ata_regs regs; struct ipr_ioadl_desc ioadl[5]; __be32 add_cmd_parms[10]; }u;}__attribute__ ((packed, aligned(4)));/* IOA Request Control Block 128 bytes */struct ipr_ioarcb { __be32 ioarcb_host_pci_addr; __be32 reserved; __be32 res_handle; __be32 host_response_handle; __be32 reserved1; __be32 reserved2; __be32 reserved3; __be32 write_data_transfer_length; __be32 read_data_transfer_length; __be32 write_ioadl_addr; __be32 write_ioadl_len; __be32 read_ioadl_addr; __be32 read_ioadl_len; __be32 ioasa_host_pci_addr; __be16 ioasa_len; __be16 reserved4; struct ipr_cmd_pkt cmd_pkt; __be32 add_cmd_parms_len; struct ipr_ioarcb_add_data add_data;}__attribute__((packed, aligned (4)));struct ipr_ioasa_vset { __be32 failing_lba_hi; __be32 failing_lba_lo; __be32 reserved;}__attribute__((packed, aligned (4)));struct ipr_ioasa_af_dasd { __be32 failing_lba; __be32 reserved[2];}__attribute__((packed, aligned (4)));struct ipr_ioasa_gpdd { u8 end_state; u8 bus_phase; __be16 reserved; __be32 ioa_data[2];}__attribute__((packed, aligned (4)));struct ipr_ioasa_gata { u8 error; u8 nsect; /* Interrupt reason */ u8 lbal; u8 lbam; u8 lbah; u8 device; u8 status; u8 alt_status; /* ATA CTL */ u8 hob_nsect; u8 hob_lbal; u8 hob_lbam; u8 hob_lbah;}__attribute__((packed, aligned (4)));struct ipr_auto_sense { __be16 auto_sense_len; __be16 ioa_data_len; __be32 data[SCSI_SENSE_BUFFERSIZE/sizeof(__be32)];};struct ipr_ioasa { __be32 ioasc;#define IPR_IOASC_SENSE_KEY(ioasc) ((ioasc) >> 24)#define IPR_IOASC_SENSE_CODE(ioasc) (((ioasc) & 0x00ff0000) >> 16)#define IPR_IOASC_SENSE_QUAL(ioasc) (((ioasc) & 0x0000ff00) >> 8)#define IPR_IOASC_SENSE_STATUS(ioasc) ((ioasc) & 0x000000ff)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?