#ifndef _CTLR_SCSI_H
#define _CTLR_SCSI_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/buf.h>
#include <sys/scsi/scsi.h>
#define ROUNDED_PARAMETER 0x37
#ifndef SHRT_MAX
#define SHRT_MAX 32767
#endif
struct scsi_ms_header {
struct mode_header mode_header;
struct block_descriptor block_descriptor;
};
#define MODE_SENSE_PC_CURRENT (0 << 6)
#define MODE_SENSE_PC_CHANGEABLE (1 << 6)
#define MODE_SENSE_PC_DEFAULT (2 << 6)
#define MODE_SENSE_PC_SAVED (3 << 6)
#define MODE_SELECT_SP 0x01
#define MODE_SELECT_PF 0x10
#define MIN_REQUEST_SENSE_LEN 18
#define IMPOSSIBLE_SCSI_STATUS 0xff
#define TRIPLET(u, m, l) ((int)((((u))&0xff<<16) + \
(((m)&0xff)<<8) + (l&0xff)))
#define PAGE1_SLOP 5
#define PAGE2_SLOP 6
#define PAGE3_SLOP 3
#define PAGE4_SLOP 8
#define PAGE8_SLOP 8
#define PAGE38_SLOP 8
#define MIN_PAGE1_LEN (sizeof (struct mode_err_recov)-PAGE1_SLOP)
#define MIN_PAGE2_LEN (sizeof (struct mode_disco_reco)-PAGE2_SLOP)
#define MIN_PAGE3_LEN (sizeof (struct mode_format)-PAGE3_SLOP)
#define MIN_PAGE4_LEN (sizeof (struct mode_geometry)-PAGE4_SLOP)
#define MIN_PAGE8_LEN (sizeof (struct mode_cache)-PAGE8_SLOP)
#define MIN_PAGE38_LEN (sizeof (struct mode_cache_ccs)-PAGE38_SLOP)
#define MODESENSE_PAGE_LEN(p) (((int)((struct mode_page *)p)->length) + \
sizeof (struct mode_page))
#define MAX_MODE_SENSE_SIZE 255
#ifdef __STDC__
int scsi_rdwr(int, int, diskaddr_t, int, caddr_t, int, int *);
int scsi_ex_man(struct defect_list *);
int scsi_ex_cur(struct defect_list *);
int scsi_ex_grown(struct defect_list *);
int uscsi_cmd(int, struct uscsi_cmd *, int);
int uscsi_mode_sense(int, int, int, caddr_t, int,
struct scsi_ms_header *);
int uscsi_mode_select(int, int, int, caddr_t, int,
struct scsi_ms_header *);
int uscsi_inquiry(int, caddr_t, int);
int uscsi_inquiry_page_86h(int, caddr_t, int);
int uscsi_read_capacity(int, struct scsi_capacity_16 *);
int uscsi_read_capacity_16(int, struct scsi_capacity_16 *);
int scsi_translate(int, struct scsi_bfi_defect *);
int scsi_dump_mode_sense_pages(int);
int scsi_supported_page(int);
int apply_chg_list(int, int, uchar_t *, uchar_t *, struct chg_list *);
int scsi_format_time(void);
uint8_t get_cur_protection_type(struct scsi_capacity_16 *);
#else
#ifdef sparc
int scsi_ms_page1();
int scsi_ms_page2();
int scsi_ms_page3();
int scsi_ms_page4();
int scsi_read_defect_data();
int scsi_repair();
#endif
int scsi_rdwr();
int scsi_ck_format();
int scsi_ex_man();
int scsi_ex_cur();
int scsi_ex_grown();
int uscsi_cmd();
int uscsi_mode_sense();
int uscsi_mode_select();
int uscsi_inquiry();
int uscsi_read_capacity();
int scsi_translate();
int scsi_dump_mode_sense_pages();
int scsi_supported_page();
int apply_chg_list();
int scsi_format_time();
#endif
#ifdef __cplusplus
}
#endif
#endif