Patchwork ATA: Allow WIN_SECURITY_FREEZE_LOCK as nop

login
register
mail settings
Submitter Alexander Graf
Date April 26, 2012, 10:45 a.m.
Message ID <1335437107-17105-1-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/155242/
State New
Headers show

Comments

Alexander Graf - April 26, 2012, 10:45 a.m.
When using Windows 8 with an AHCI disk drive, it issues a blue screen.
The reason is that WIN_SECURITY_FREEZE_LOCK / CFA_WEAR_LEVEL is not
supported by our ATA implementation, but Windows expects it to be there.

Since without security stuff implemented, the lock would be a nop anyway
and CFA_WEAR_LEVEL already is treated as a nop, let's just allow the cmd
for HD drives as well. That way Windows is happy.

Signed-off-by: Alexander Graf <agraf@suse.de>

---

v1 -> v2:

  - add comment explaining that WIN_SECURITY_FREEZE_LOCK == CFA_WEAR_LEVEL
    per id, and it's required for win8+ahci.
---
 hw/ide/core.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
Kevin Wolf - May 2, 2012, 4:47 p.m.
Am 26.04.2012 12:45, schrieb Alexander Graf:
> When using Windows 8 with an AHCI disk drive, it issues a blue screen.
> The reason is that WIN_SECURITY_FREEZE_LOCK / CFA_WEAR_LEVEL is not
> supported by our ATA implementation, but Windows expects it to be there.
> 
> Since without security stuff implemented, the lock would be a nop anyway
> and CFA_WEAR_LEVEL already is treated as a nop, let's just allow the cmd
> for HD drives as well. That way Windows is happy.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>

Thanks, applied to the block branch.

Kevin

Patch

diff --git a/hw/ide/core.c b/hw/ide/core.c
index a5216a6..9785d5f 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1035,7 +1035,7 @@  static const uint8_t ide_cmd_table[0x100] = {
     [WIN_IDENTIFY]                      = ALL_OK,
     [WIN_SETFEATURES]                   = ALL_OK,
     [IBM_SENSE_CONDITION]               = CFA_OK,
-    [CFA_WEAR_LEVEL]                    = CFA_OK,
+    [CFA_WEAR_LEVEL]                    = HD_CFA_OK,
     [WIN_READ_NATIVE_MAX]               = ALL_OK,
 };
 
@@ -1350,6 +1350,11 @@  void ide_exec_cmd(IDEBus *bus, uint32_t val)
         break;
     case CFA_ERASE_SECTORS:
     case CFA_WEAR_LEVEL:
+#if 0
+    /* This one has the same ID as CFA_WEAR_LEVEL and is required for
+       Windows 8 to work with AHCI */
+    case WIN_SECURITY_FREEZE_LOCK:
+#endif
         if (val == CFA_WEAR_LEVEL)
             s->nsector = 0;
         if (val == CFA_ERASE_SECTORS)