Add more doxygen comments as to sense request information means and add a typedef for mmc_sense_request.
Use this in win32_ioctl.c.
This commit is contained in:
@@ -43,7 +43,7 @@ extern "C" {
|
|||||||
See SCSI Primary Commands-2 (SPC-2) table 102 or
|
See SCSI Primary Commands-2 (SPC-2) table 102 or
|
||||||
SPC 4.5.3, Table 26.
|
SPC 4.5.3, Table 26.
|
||||||
*/
|
*/
|
||||||
struct mmc_request_sense {
|
typedef struct mmc_request_sense {
|
||||||
#if defined(WORDS_BIGENDIAN)
|
#if defined(WORDS_BIGENDIAN)
|
||||||
uint8_t valid : 1; /**< valid bit is 1 if info is valid */
|
uint8_t valid : 1; /**< valid bit is 1 if info is valid */
|
||||||
uint8_t error_code : 7;
|
uint8_t error_code : 7;
|
||||||
@@ -79,7 +79,7 @@ extern "C" {
|
|||||||
uint8_t fruc; /**< Field replaceable unit code */
|
uint8_t fruc; /**< Field replaceable unit code */
|
||||||
uint8_t sks[3]; /**< Sense-key specific */
|
uint8_t sks[3]; /**< Sense-key specific */
|
||||||
uint8_t asb[46]; /**< Additional sense bytes */
|
uint8_t asb[46]; /**< Additional sense bytes */
|
||||||
};
|
} mmc_request_sense_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set this to the maximum value in milliseconds that we will
|
Set this to the maximum value in milliseconds that we will
|
||||||
|
|||||||
@@ -103,15 +103,15 @@ typedef struct _CDROM_TOC_FULL {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
SCSI_PASS_THROUGH_DIRECT sptd;
|
SCSI_PASS_THROUGH_DIRECT sptd;
|
||||||
ULONG Filler; /* Realign buffer to double-word boundary */
|
ULONG Filler; /* Realign buffer to double-word boundary */
|
||||||
UCHAR ucSenseBuf[32];
|
mmc_request_sense_t SenseBuf;
|
||||||
UCHAR DataBuf[512];
|
UCHAR DataBuf[512];
|
||||||
} SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER;
|
} SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER;
|
||||||
|
|
||||||
typedef struct _SCSI_PASS_THROUGH_WITH_BUFFER {
|
typedef struct _SCSI_PASS_THROUGH_WITH_BUFFER {
|
||||||
SCSI_PASS_THROUGH Spt;
|
SCSI_PASS_THROUGH Spt;
|
||||||
ULONG Filler; /* realign buffer to double-word boundary */
|
ULONG Filler; /* realign buffer to double-word boundary */
|
||||||
UCHAR SenseBuf[32];
|
mmc_request_sense_t SenseBuf;
|
||||||
UCHAR DataBuf[512];
|
UCHAR DataBuf[512];
|
||||||
} SCSI_PASS_THROUGH_WITH_BUFFER;
|
} SCSI_PASS_THROUGH_WITH_BUFFER;
|
||||||
|
|
||||||
|
|
||||||
@@ -462,7 +462,7 @@ run_mmc_cmd_win32ioctl( void *p_user_data,
|
|||||||
swb.sptd.TargetId= 0; /* SCSI target ID will also be filled in */
|
swb.sptd.TargetId= 0; /* SCSI target ID will also be filled in */
|
||||||
swb.sptd.Lun = 0; /* SCSI lun ID will also be filled in */
|
swb.sptd.Lun = 0; /* SCSI lun ID will also be filled in */
|
||||||
swb.sptd.CdbLength = i_cdb;
|
swb.sptd.CdbLength = i_cdb;
|
||||||
swb.sptd.SenseInfoLength = sizeof(swb.ucSenseBuf);
|
swb.sptd.SenseInfoLength = sizeof(swb.SenseBuf);
|
||||||
swb.sptd.DataIn =
|
swb.sptd.DataIn =
|
||||||
(SCSI_MMC_DATA_READ == e_direction) ? SCSI_IOCTL_DATA_IN :
|
(SCSI_MMC_DATA_READ == e_direction) ? SCSI_IOCTL_DATA_IN :
|
||||||
(SCSI_MMC_DATA_WRITE == e_direction) ? SCSI_IOCTL_DATA_OUT :
|
(SCSI_MMC_DATA_WRITE == e_direction) ? SCSI_IOCTL_DATA_OUT :
|
||||||
@@ -470,7 +470,8 @@ run_mmc_cmd_win32ioctl( void *p_user_data,
|
|||||||
swb.sptd.DataBuffer = p_buf;
|
swb.sptd.DataBuffer = p_buf;
|
||||||
swb.sptd.DataTransferLength= i_buf;
|
swb.sptd.DataTransferLength= i_buf;
|
||||||
swb.sptd.TimeOutValue = msecs2secs(i_timeout_ms);
|
swb.sptd.TimeOutValue = msecs2secs(i_timeout_ms);
|
||||||
swb.sptd.SenseInfoOffset = offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, ucSenseBuf);
|
swb.sptd.SenseInfoOffset = offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER,
|
||||||
|
SenseBuf);
|
||||||
|
|
||||||
memcpy(swb.sptd.Cdb, p_cdb, i_cdb);
|
memcpy(swb.sptd.Cdb, p_cdb, i_cdb);
|
||||||
|
|
||||||
@@ -491,13 +492,13 @@ run_mmc_cmd_win32ioctl( void *p_user_data,
|
|||||||
|
|
||||||
/* Record SCSI sense reply for API call mmc_last_cmd_sense().
|
/* Record SCSI sense reply for API call mmc_last_cmd_sense().
|
||||||
*/
|
*/
|
||||||
if (swb.ucSenseBuf[7]) {
|
if (swb.SenseBuf.additional_sense_len) {
|
||||||
int sense_size = swb.ucSenseBuf[7] + 8; /* SPC 4.5.3, Table 26:
|
/* SCSI Primary Command standard
|
||||||
252 bytes legal, 263 bytes
|
SPC 4.5.3, Table 26: 252 bytes legal, 263 bytes possible */
|
||||||
possible */
|
int sense_size = swb.SenseBuf.additional_sense_len + 8;
|
||||||
if (sense_size > sizeof(swb.ucSenseBuf))
|
if (sense_size > sizeof(swb.SenseBuf))
|
||||||
sense_size = sizeof(swb.ucSenseBuf);
|
sense_size = sizeof(swb.SenseBuf);
|
||||||
memcpy((void *) p_env->gen.scsi_mmc_sense, &swb.ucSenseBuf, sense_size);
|
memcpy((void *) p_env->gen.scsi_mmc_sense, &swb.SenseBuf, sense_size);
|
||||||
p_env->gen.scsi_mmc_sense_valid = sense_size;
|
p_env->gen.scsi_mmc_sense_valid = sense_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1250,7 +1250,7 @@ run_mmc_cmd_linux(void *p_user_data,
|
|||||||
{
|
{
|
||||||
_img_private_t *p_env = p_user_data;
|
_img_private_t *p_env = p_user_data;
|
||||||
struct cdrom_generic_command cgc;
|
struct cdrom_generic_command cgc;
|
||||||
struct mmc_request_sense sense;
|
mmc_request_sense_t sense;
|
||||||
unsigned char *u_sense = (unsigned char *) &sense;
|
unsigned char *u_sense = (unsigned char *) &sense;
|
||||||
|
|
||||||
p_env->gen.scsi_mmc_sense_valid = 0;
|
p_env->gen.scsi_mmc_sense_valid = 0;
|
||||||
@@ -1258,7 +1258,7 @@ run_mmc_cmd_linux(void *p_user_data,
|
|||||||
memcpy(&cgc.cmd, p_cdb, i_cdb);
|
memcpy(&cgc.cmd, p_cdb, i_cdb);
|
||||||
cgc.buflen = i_buf;
|
cgc.buflen = i_buf;
|
||||||
cgc.buffer = p_buf;
|
cgc.buffer = p_buf;
|
||||||
cgc.sense = (struct request_sense *) &sense;
|
cgc.sense = (mmc_sense_request_t *) &sense;
|
||||||
|
|
||||||
cgc.data_direction = (SCSI_MMC_DATA_READ == e_direction) ? CGC_DATA_READ :
|
cgc.data_direction = (SCSI_MMC_DATA_READ == e_direction) ? CGC_DATA_READ :
|
||||||
(SCSI_MMC_DATA_WRITE == e_direction) ? CGC_DATA_WRITE :
|
(SCSI_MMC_DATA_WRITE == e_direction) ? CGC_DATA_WRITE :
|
||||||
|
|||||||
Reference in New Issue
Block a user