Add Read TOC (0x43) Command Support (and basic testcase).

This commit is contained in:
Jon Grimm
2012-09-24 10:15:00 -05:00
parent 4b250c0abb
commit e55ec72f36
11 changed files with 458 additions and 0 deletions

View File

@@ -727,6 +727,10 @@ iscsi_unmap_task(struct iscsi_context *iscsi, int lun, int anchor, int group,
struct unmap_list *list, int list_len,
iscsi_command_cb cb, void *private_data);
EXTERN struct scsi_task *
iscsi_readtoc_task(struct iscsi_context *iscsi, int lun, int msf, int format,
int track_session, int maxsize,
iscsi_command_cb cb, void *private_data);
/*
* Sync commands for SCSI
@@ -881,6 +885,10 @@ EXTERN struct scsi_task *
iscsi_unmap_sync(struct iscsi_context *iscsi, int lun, int anchor, int group,
struct unmap_list *list, int list_len);
EXTERN struct scsi_task *
iscsi_readtoc_sync(struct iscsi_context *iscsi, int lun, int msf,
int format, int track_session, int maxsize);
/*
* This function is used when the application wants to specify its own buffers to read the data
* from the DATA-IN PDUs into.

View File

@@ -39,6 +39,7 @@ enum scsi_opcode {
SCSI_OPCODE_SYNCHRONIZECACHE10 = 0x35,
SCSI_OPCODE_WRITE_SAME10 = 0x41,
SCSI_OPCODE_UNMAP = 0x42,
SCSI_OPCODE_READTOC = 0x43,
SCSI_OPCODE_READ16 = 0x88,
SCSI_OPCODE_COMPARE_AND_WRITE = 0x89,
SCSI_OPCODE_WRITE16 = 0x8A,
@@ -106,6 +107,56 @@ enum scsi_xfer_dir {
SCSI_XFER_WRITE = 2
};
/*
* READTOC
*/
EXTERN struct scsi_task *scsi_cdb_readtoc(int msf, int format, int track_session, uint32_t xferlen);
enum scsi_readtoc_fmt {
SCSI_READ_TOC = 0,
SCSI_READ_SESSION_INFO = 1,
SCSI_READ_FULL_TOC = 2,
SCSI_READ_PMA = 3,
SCSI_READ_ATIP = 4
};
struct scsi_readtoc_desc{
union {
struct scsi_toc_desc {
int adr;
int control;
int track;
uint32_t lba;
} toc;
struct scsi_session_desc {
int adr;
int control;
int first_in_last;
uint32_t lba;
} ses;
struct scsi_fulltoc_desc {
int session;
int adr;
int control;
int tno;
int point;
int min;
int sec;
int frame;
int zero;
int pmin;
int psec;
int pframe;
} full;
} desc;
};
struct scsi_readtoc_list {
int num;
int first;
int last;
struct scsi_readtoc_desc desc[0];
};
struct scsi_reportluns_params {
int report_type;
};
@@ -206,6 +257,11 @@ struct scsi_modesense6_params {
struct scsi_serviceactionin_params {
enum scsi_service_action_in sa;
};
struct scsi_readtoc_params {
int msf;
int format;
int track_session;
};
struct scsi_sense {
unsigned char error_type;
@@ -259,6 +315,7 @@ struct scsi_task {
struct scsi_inquiry_params inquiry;
struct scsi_modesense6_params modesense6;
struct scsi_serviceactionin_params serviceactionin;
struct scsi_readtoc_params readtoc;
} params;
enum scsi_residual residual_status;