#define R_CMD_FIFO 0x04
#define R_DONE_FIFO 0x08
#define R_INT_MASK 0x0C
#define R_STATUS 0x10
#define R_INT_PENDING 0x14
#define INT_DISABLE 0x00
#define INT_ENABLE 0x01
#define R_42XX_STATUS 0x30
#define R_42XX_INT_MASK 0x34
#define R_42XX_REQUEST 0x40
#define R_42XX_REPLY 0x44
#define INT_ENABLE_42XX 0x00
#define INT_DISABLE_42XX 0x08
#define STATUS_42XX_INT_PENDING 0x08
#define SOFT_ERROR 0x02
#define HARD_ERROR 0x04
#define INVALID_ERROR 0x10
#define CMD_REJECTED 0x14
#define CMD_GET_LOG_DRV_INFO 0x10
#define CMD_GET_CTRL_INFO 0x11
#define CMD_SENSE_DRV_STATUS 0x12
#define CMD_START_RECOVERY 0x13
#define CMD_GET_PHYS_DRV_INFO 0x15
#define CMD_BLINK_DRV_LEDS 0x16
#define CMD_SENSE_DRV_LEDS 0x17
#define CMD_GET_LOG_DRV_EXT 0x18
#define CMD_READ 0x20
#define CMD_WRITE 0x30
#define CMD_WRITE_MEDIA 0x31
#define CMD_RESET_CTRL 0x40
#define CMD_DIAG_PASS_THRU 0x41
#define CMD_GET_CONFIG 0x50
#define CMD_SET_CONFIG 0x51
#define CMD_BYPASS_VOL_STATE 0x52
#define CMD_SS_CREATE_VOL 0x53
#define CMD_CHANGE_CONFIG 0x54
#define CMD_SENSE_ORIG_CONF 0x55
#define CMD_REORDER_LOG_DRV 0x56
#define CMD_LABEL_LOG_DRV 0x57
#define CMD_SS_TO_VOL 0x58
#define CMD_SET_SURFACE_DELAY 0x60
#define CMD_SET_OVERHEAT_DELAY 0x61
#define CMD_SENSE_BUS_PARAMS 0x65
#define CMD_SENSE_SUBSYS_INFO 0x66
#define CMD_SENSE_SURFACE_ATS 0x70
#define CMD_PASSTHROUGH 0x90
#define CMD_PASSTHROUGH_A 0x91
#define CMD_RESET_SCSI_DEV 0x94
#define CMD_PAUSE_BG_ACT 0x98
#define CMD_RESUME_BG_ACT 0x99
#define CMD_START_FIRMWARE 0x99
#define CMD_SENSE_DRV_ERR_LOG 0xa6
#define CMD_START_CPM 0xa7
#define CMD_SENSE_CP 0xa8
#define CMD_STOP_CPM 0xa9
#define CMD_FLUSH_CACHE 0xc2
#define CMD_COLLECT_BUFFER 0xd2
#define CMD_ACCEPT_MEDIA_EXCH 0xe0
#define CMD_FLASH_READ 0xf6
#define CMD_FLASH_WRITE 0xf7
struct ida_drive_param {
u_int16_t ncylinders;
u_int8_t nheads;
u_int8_t signature;
u_int8_t psectors;
u_int16_t wprecomp;
u_int8_t max_acc;
u_int8_t control;
u_int16_t pcylinders;
u_int8_t ptracks;
u_int16_t landing_zone;
u_int8_t nsectors;
u_int8_t checksum;
} __packed;
#define IDA_RAID0 0
#define IDA_RAID4 1
#define IDA_RAID1 2
#define IDA_RAID5 3
struct ida_drive_info {
u_int16_t secsize;
u_int32_t secperunit;
struct ida_drive_param dp;
u_int8_t mirror;
u_int8_t reserved;
u_int8_t bios_disable;
} __packed;
struct ida_drive_info_ext {
u_int16_t secsize;
u_int32_t secperunit;
struct ida_drive_param dp;
u_int8_t mirror;
u_int8_t reserved;
u_int8_t bios_disable;
u_int32_t ld_id;
u_int8_t ld_label[64];
} __packed;
struct ida_controller_info {
u_int8_t num_drvs;
u_int32_t signature;
u_int8_t firm_rev[4];
u_int8_t rom_rev[4];
u_int8_t hw_rev;
u_int32_t bb_rev;
u_int32_t dp_map;
u_int32_t ed_map;
u_int32_t board_id;
u_int8_t cfg_error;
u_int32_t nd_map;
u_int8_t bad_ram_addr;
u_int8_t cpu_rev;
u_int8_t pdpi_rev;
u_int8_t epic_rev;
u_int8_t wcxc_rev;
u_int8_t mkt_rev;
u_int8_t cflag;
#define IDA_CI_CFLAG_7DPB (1<<3)
#define IDA_CI_CFLAG_BIGMAP (1<<7)
u_int8_t hflag;
u_int8_t expand_dis;
u_int8_t scsi_cc;
u_int32_t max_req_blocks;
u_int32_t cclock;
u_int8_t dp_scsi;
u_int16_t big_dp_map[8];
u_int16_t big_ed_map[8];
u_int16_t big_nd_map[8];
u_int16_t task_flags;
u_int8_t icl_bus;
u_int8_t red_modes;
u_int8_t cur_red_mode;
u_int8_t red_ctlr_stat;
u_int8_t red_fail_reason;
u_int8_t reserved[403];
} __packed;
struct ida_drive_status {
u_int8_t status;
u_int32_t failure_map;
u_int16_t read_err[32];
u_int16_t write_error[32];
u_int8_t reserved0[288];
u_int32_t secrecover;
u_int8_t rebuilding;
u_int16_t remap_cnt[32];
u_int32_t repl_map;
u_int32_t spare_map;
u_int8_t spare_status;
u_int8_t spare_repl_map[32];
u_int32_t repl_ok_map;
u_int8_t media_exchange;
u_int8_t cache_failure;
u_int8_t expand_failure;
u_int8_t unit_flags;
u_int16_t big_failure_map[8];
u_int16_t big_remap_cnt[128];
u_int16_t big_repl_map[8];
u_int16_t big_act_spare_map[8];
u_int8_t big_spare_repl_map[128];
u_int16_t big_repl_ok_map[8];
u_int8_t big_rebuilding;
u_int8_t reserved1[36];
} __packed;
struct ida_phys_drv_info {
u_int8_t scsi_bus;
u_int8_t scsi_id;
u_int16_t blksize;
u_int32_t blkcount;
u_int32_t blkreserved;
u_int8_t drv_model[40];
u_int8_t drv_serial[40];
u_int8_t drv_fwrev[8];
u_int8_t scsi_inq;
u_int8_t cpq_drv_stmp;
u_int8_t last_fail;
u_int8_t pd_flags;
#define PDF_DISK_PRESENT 0x01
#define PDF_NONDISK_PRESENT 0x02
#define PDF_WIDE_ENABLED 0x04
#define PDF_SYNC 0x08
#define PDF_NARROW_TRAY 0x10
#define PDF_WIDEFAIL 0x20
#define PDF_ULTRA 0x40
#define PDF_ULTRA2 0x80
u_int8_t mpd_flags;
#define MPDF_SMART_SUPPORT 0x01
#define MPDF_SMART_ERRORS 0x02
#define MPDF_SMART_ENABLED 0x04
#define MPDF_SMART_ERR_RESET 0x08
#define MPDF_DRIVE_EXTERNAL 0x10
#define MPDF_DRIVE_CONF_LVOL 0x20
#define MPDF_DRIVE_CONF_SPARE 0x40
#define MPDF_DRIVE_WCE 0x80
u_int8_t scsi_lun;
u_int8_t ympd_flags;
#define YMPDF_DRIVE_WCE_SET 0x40
#define YMPDF_DRIVE_WCE_CHNG 0x80
u_int8_t reserved;
u_int32_t spi_speed_rules;
u_int8_t phys_con[2];
u_int8_t phys_box;
u_int8_t phys_bay;
} __packed;
struct ida_blink_drv_leds {
u_int32_t bd;
u_int32_t bte;
u_int8_t bse[256];
u_int8_t reserved1[248];
} __packed;
struct ida_label_logical {
u_int32_t ld_id;
u_int8_t ld_label[64];
} __packed;