diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/ide/core.c | 7 | ||||
-rw-r--r-- | hw/scsi-disk.c | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c index fe5bd172af..6fd6dc2477 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -148,8 +148,11 @@ static void ide_identify(IDEState *s) put_le16(p + 83, (1 << 14) | (1 << 13) | (1 <<12) | (1 << 10)); /* 14=set to 1, 1=SMART self test, 0=SMART error logging */ put_le16(p + 84, (1 << 14) | 0); - /* 14 = NOP supported, 0=SMART feature set enabled */ - put_le16(p + 85, (1 << 14) | 1); + /* 14 = NOP supported, 5=WCACHE enabled, 0=SMART feature set enabled */ + if (bdrv_enable_write_cache(s->bs)) + put_le16(p + 85, (1 << 14) | (1 << 5) | 1); + else + put_le16(p + 85, (1 << 14) | 1); /* 13=flush_cache_ext,12=flush_cache,10=lba48 */ put_le16(p + 86, (1 << 14) | (1 << 13) | (1 <<12) | (1 << 10)); /* 14=set to 1, 1=smart self test, 0=smart error logging */ diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index ffc2654bf9..de8e314b15 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -709,7 +709,9 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, memset(p,0,20); p[0] = 8; p[1] = 0x12; - p[2] = 4; /* WCE */ + if (bdrv_enable_write_cache(s->dinfo->bdrv)) { + p[2] = 4; /* WCE */ + } p += 20; } if ((page == 0x3f || page == 0x2a) |