Unmarshall support for Control modepage

This commit is contained in:
Ronnie Sahlberg
2013-07-05 22:38:45 -07:00
parent 03ce9dc4b1
commit b6e5af558d
2 changed files with 65 additions and 0 deletions

View File

@@ -659,6 +659,33 @@ struct scsi_mode_page_caching {
int cache_segment_size;
};
struct scsi_mode_page_control {
int tst;
int tmf_only;
int dpicz;
int d_sense;
int gltsd;
int rlec;
int queue_algorithm_modifier;
int nuar;
int qerr;
int vs;
int rac;
int ua_intlck_ctrl;
int swp;
int ato;
int tas;
int atmpe;
int rwwp;
int autoload_mode;
int busy_timeout_period;
int extended_selftest_completion_time;
};
struct scsi_mode_page_disconnect_reconnect {
int buffer_full_ratio;
int buffer_empty_ratio;
@@ -692,6 +719,7 @@ enum scsi_modesense_page_code {
SCSI_MODESENSE_PAGECODE_VERIFY_ERROR_RECOVERY = 0x07,
SCSI_MODESENSE_PAGECODE_CACHING = 0x08,
SCSI_MODESENSE_PAGECODE_XOR_CONTROL = 0x10,
SCSI_MODESENSE_PAGECODE_CONTROL = 0x0a,
SCSI_MODESENSE_PAGECODE_INFORMATIONAL_EXCEPTIONS_CONTROL = 0x1c,
SCSI_MODESENSE_PAGECODE_RETURN_ALL_PAGES = 0x3f
};
@@ -705,6 +733,7 @@ struct scsi_mode_page {
int len;
union {
struct scsi_mode_page_caching caching;
struct scsi_mode_page_control control;
struct scsi_mode_page_disconnect_reconnect disconnect_reconnect;
struct scsi_mode_page_informational_exceptions_control iec;
};

View File

@@ -2223,6 +2223,39 @@ scsi_parse_mode_caching(struct scsi_task *task, int pos, struct scsi_mode_page *
mp->caching.cache_segment_size = task_get_uint16(task, pos + 12);
}
static void
scsi_parse_mode_control(struct scsi_task *task, int pos, struct scsi_mode_page *mp)
{
mp->control.tst = (task_get_uint8(task, pos) >> 5) & 0x07;
mp->control.tmf_only = task_get_uint8(task, pos) & 0x10;
mp->control.dpicz = task_get_uint8(task, pos) & 0x08;
mp->control.d_sense = task_get_uint8(task, pos) & 0x04;
mp->control.gltsd = task_get_uint8(task, pos) & 0x02;
mp->control.rlec = task_get_uint8(task, pos) & 0x01;
mp->control.queue_algorithm_modifier =
(task_get_uint8(task, pos + 1) >> 4) & 0x0f;
mp->control.nuar = task_get_uint8(task, pos + 1) & 0x08;
mp->control.qerr = (task_get_uint8(task, pos + 1) >> 1) & 0x03;
mp->control.vs = task_get_uint8(task, pos + 2) & 0x80;
mp->control.rac = task_get_uint8(task, pos + 2) & 0x40;
mp->control.ua_intlck_ctrl =
(task_get_uint8(task, pos + 2) >> 4) & 0x0f;
mp->control.swp = task_get_uint8(task, pos + 2) & 0x08;
mp->control.ato = task_get_uint8(task, pos + 3) & 0x80;
mp->control.tas = task_get_uint8(task, pos + 3) & 0x40;
mp->control.atmpe = task_get_uint8(task, pos + 3) & 0x20;
mp->control.swp = task_get_uint8(task, pos + 3) & 0x10;
mp->control.autoload_mode = task_get_uint8(task, pos + 2) & 0x07;
mp->control.busy_timeout_period =
task_get_uint16(task, pos + 6);
mp->control.extended_selftest_completion_time =
task_get_uint16(task, pos + 8);
}
static void
scsi_parse_mode_disconnect_reconnect(struct scsi_task *task, int pos, struct scsi_mode_page *mp)
{
@@ -2320,6 +2353,9 @@ scsi_modesense_datain_unmarshall(struct scsi_task *task)
case SCSI_MODESENSE_PAGECODE_CACHING:
scsi_parse_mode_caching(task, pos, mp);
break;
case SCSI_MODESENSE_PAGECODE_CONTROL:
scsi_parse_mode_control(task, pos, mp);
break;
case SCSI_MODESENSE_PAGECODE_DISCONNECT_RECONNECT:
scsi_parse_mode_disconnect_reconnect(task, pos, mp);
break;