TESTS: simple support for READDEFECTDATA10/12

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Ronnie Sahlberg
2016-09-22 22:43:16 -07:00
parent 01a8e22207
commit 39001203b7
14 changed files with 409 additions and 1 deletions

View File

@@ -536,6 +536,75 @@ scsi_cdb_readcapacity10(int lba, int pmi)
return task;
}
/*
* READDEFECTDATA10
*/
struct scsi_task *
scsi_cdb_readdefectdata10(int req_plist, int req_glist, int defect_list_format,
uint16_t alloc_len)
{
struct scsi_task *task;
task = malloc(sizeof(struct scsi_task));
if (task == NULL) {
return NULL;
}
memset(task, 0, sizeof(struct scsi_task));
task->cdb[0] = SCSI_OPCODE_READ_DEFECT_DATA10;
if (req_plist) {
task->cdb[2] |= 0x10;
}
if (req_glist) {
task->cdb[2] |= 0x08;
}
task->cdb[2] |= (defect_list_format & 0x07);
scsi_set_uint16(&task->cdb[7], alloc_len);
task->cdb_size = 10;
task->xfer_dir = SCSI_XFER_READ;
task->expxferlen = alloc_len;
return task;
}
/*
* READDEFECTDATA12
*/
struct scsi_task *
scsi_cdb_readdefectdata12(int req_plist, int req_glist, int defect_list_format,
uint32_t address_descriptor_index, uint32_t alloc_len)
{
struct scsi_task *task;
task = malloc(sizeof(struct scsi_task));
if (task == NULL) {
return NULL;
}
memset(task, 0, sizeof(struct scsi_task));
task->cdb[0] = SCSI_OPCODE_READ_DEFECT_DATA12;
if (req_plist) {
task->cdb[2] |= 0x10;
}
if (req_glist) {
task->cdb[2] |= 0x08;
}
task->cdb[2] |= (defect_list_format & 0x07);
scsi_set_uint32(&task->cdb[2], address_descriptor_index);
scsi_set_uint32(&task->cdb[6], alloc_len);
task->cdb_size = 12;
task->xfer_dir = SCSI_XFER_READ;
task->expxferlen = alloc_len;
return task;
}
/*
* READTOC
*/