Skip to contentSkip to conversation

allow disabling IDE block mode

PATCH New Carlo Marcelo Arenas Belon 1 participant 1 message Feb 11, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 allow disabling IDE block mode

Greetings,

the following patch changes the logic for the processing of WIN_SETMULT so that setting it to 0 (off) is a valid operation as shown by (running Linux on qemu)

  # hdparm -m0 /dev/hda

/dev/hda:
setting multcount to 0
multcount = 0 (off)

this is specially visible while running Ubuntu Linux 6.06 (dapper) on qemu as it by default disables multmode at boot resulting in the following error :

hda: set_multmode: status=0x41 { DriveReady Error }
hda: set_multmode: error=0x04 { DriveStatusError }
ide: failed opcode was: 0xef

Carlo

Index: hw/ide.c
===================================================================
RCS file: /sources/qemu/qemu/hw/ide.c,v
retrieving revision 1.53

ide.c +2 -3
diff -u -r1.53 ide.c
@@ -1631,9 +1631,8 @@
             ide_set_irq(s);
             break;
         case WIN_SETMULT:
-            if (s->nsector > MAX_MULT_SECTORS || 
-                s->nsector == 0 ||
-                (s->nsector & (s->nsector - 1)) != 0) {
+            if (s->nsector != 0 && (s->nsector > MAX_MULT_SECTORS || 
+                (s->nsector & (s->nsector - 1)) != 0)) {
                 ide_abort_command(s);
             } else {
                 s->mult_sectors = s->nsector;