#ifndef _DEV_IC_ICP_IOCTL_H_
#define _DEV_IC_ICP_IOCTL_H_
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/ioccom.h>
#include <dev/ic/icpreg.h>
#define GDT_SCRATCH_SZ 3072
typedef struct gdt_ucmd {
u_int16_t io_node;
u_int16_t service;
u_int32_t timeout;
u_int16_t status;
u_int32_t info;
struct {
u_int32_t cmd_boardnode;
u_int32_t cmd_cmdindex;
u_int16_t cmd_opcode;
union {
struct icp_rawcmd rc;
struct icp_ioctlcmd ic;
struct icp_cachecmd cc;
} cmd_packet;
} __packed command;
u_int8_t data[GDT_SCRATCH_SZ];
} __packed gdt_ucmd_t;
#define GDT_IOCTL_GENERAL _IOWR('J', 0, gdt_ucmd_t)
#define GDT_IOCTL_DRVERS _IOR('J', 1, int)
typedef struct gdt_ctrt {
u_int16_t io_node;
u_int16_t oem_id;
u_int16_t type;
u_int32_t info;
u_int8_t access;
u_int8_t remote;
u_int16_t ext_type;
u_int16_t device_id;
u_int16_t sub_device_id;
} __packed gdt_ctrt_t;
#define GDT_IOCTL_CTRTYPE _IOWR('J', 2, gdt_ctrt_t)
typedef struct gdt_osv {
u_int8_t oscode;
u_int8_t version;
u_int8_t subversion;
u_int16_t revision;
char name[64];
} __packed gdt_osv_t;
#define GDT_IOCTL_OSVERS _IOR('J', 3, gdt_osv_t)
#define GDT_IOCTL_CTRCNT _IOR('J', 5, int)
#define GDT_ES_ASYNC 1
#define GDT_ES_DRIVER 2
#define GDT_ES_TEST 3
#define GDT_ES_SYNC 4
typedef struct {
u_int16_t size;
union {
char stream[16];
struct {
u_int16_t ionode;
u_int16_t service;
u_int32_t index;
} __packed driver;
struct {
u_int16_t ionode;
u_int16_t service;
u_int16_t status;
u_int32_t info;
u_int8_t scsi_coord[3];
} __packed async;
struct {
u_int16_t ionode;
u_int16_t service;
u_int16_t status;
u_int32_t info;
u_int16_t hostdrive;
u_int8_t scsi_coord[3];
u_int8_t sense_key;
} __packed sync;
struct {
u_int32_t l1;
u_int32_t l2;
u_int32_t l3;
u_int32_t l4;
} __packed test;
} eu;
u_int32_t severity;
u_int8_t event_string[256];
} __packed gdt_evt_data;
typedef struct {
u_int32_t first_stamp;
u_int32_t last_stamp;
u_int16_t same_count;
u_int16_t event_source;
u_int16_t event_idx;
u_int8_t application;
u_int8_t reserved;
gdt_evt_data event_data;
} __packed gdt_evt_str;
typedef struct gdt_event {
int erase;
int handle;
gdt_evt_str dvr;
} __packed gdt_event_t;
#define GDT_IOCTL_EVENT _IOWR('J', 7, gdt_event_t)
typedef struct gdt_statist {
u_int16_t io_count_act;
u_int16_t io_count_max;
u_int16_t req_queue_act;
u_int16_t req_queue_max;
u_int16_t cmd_index_act;
u_int16_t cmd_index_max;
u_int16_t sg_count_act;
u_int16_t sg_count_max;
} __packed gdt_statist_t;
#define GDT_IOCTL_STATIST _IOR('J', 9, gdt_statist_t)
typedef struct gdt_rescan {
u_int16_t io_node;
u_int8_t flag;
u_int16_t hdr_no;
struct {
u_int8_t bus;
u_int8_t target;
u_int8_t lun;
u_int8_t cluster_type;
} __packed hdr_list[ICP_MAX_HDRIVES];
} __packed gdt_rescan_t;
#define GDT_IOCTL_RESCAN _IOWR('J', 11, gdt_rescan_t)
#endif