diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-07-10 15:03:17 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-07-26 17:44:10 +0200 |
commit | 96c91bbf6090b3098db22ed19ab5ae2f9c6e4f16 (patch) | |
tree | 21c7de4c1c20ffc0a0d5fef6b385f80008fabdb1 /hw/scsi-disk.c | |
parent | 380feaffb0fcc8e5f615ed8e86d2e93717a6f2c6 (diff) | |
download | qemu-96c91bbf6090b3098db22ed19ab5ae2f9c6e4f16.zip qemu-96c91bbf6090b3098db22ed19ab5ae2f9c6e4f16.tar.gz qemu-96c91bbf6090b3098db22ed19ab5ae2f9c6e4f16.tar.bz2 |
scsi-disk: support toggling the write cache
Finally, this uses the "plumbing" in the previous patch to
add support for toggling the WCE bit of the caching mode page.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi-disk.c')
-rw-r--r-- | hw/scsi-disk.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index ad6c00d..fd5cd70 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -1050,10 +1050,8 @@ static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf, case MODE_PAGE_CACHING: length = 0x12; - if (page_control == 1) { /* Changeable Values */ - break; - } - if (bdrv_enable_write_cache(s->qdev.conf.bs)) { + if (page_control == 1 || /* Changeable Values */ + bdrv_enable_write_cache(s->qdev.conf.bs)) { p[0] = 4; /* WCE */ } break; @@ -1325,6 +1323,14 @@ static int scsi_disk_check_mode_select(SCSIDiskState *s, int page, static void scsi_disk_apply_mode_select(SCSIDiskState *s, int page, uint8_t *p) { + switch (page) { + case MODE_PAGE_CACHING: + bdrv_set_enable_write_cache(s->qdev.conf.bs, (p[0] & 4) != 0); + break; + + default: + break; + } } static int mode_select_pages(SCSIDiskReq *r, uint8_t *p, int len, bool change) |