Skip to contentSkip to conversation

ata identify device errors

Qemu-devel Jens Axboe 1 participant 1 message Jan 24, 2004

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

Hi,

In an increasingly pedantic mode, I started looking at other ata standard violations by qemu. I went as far back as ata-2 to verify that these are indeed errors.

- word 4+5 have always been vendor unique, qemu should not set them to number of sectors.
- word 20, ditto.
- word 47, max multisector. Upper byte must be 0x80.
- qemu sets word 54-58, it must set word 53 bit 1 as well to indicate that these values are indeed valid.

Index: ide.c
===================================================================
RCS file: /cvsroot/qemu/qemu/ide.c,v
retrieving revision 1.6

ide.c +3 -5
diff -u -r1.6 ide.c
@@ -392,22 +393,20 @@
     stw_raw(p + 0, 0x0040);
     stw_raw(p + 1, s->cylinders); 
     stw_raw(p + 3, s->heads);
-    stw_raw(p + 4, 512 * s->sectors); /* sectors */
-    stw_raw(p + 5, 512); /* sector size */
     stw_raw(p + 6, s->sectors); 
     padstr((uint8_t *)(p + 10), "QM00001", 20); /* serial number */
-    stw_raw(p + 20, 3); /* buffer type */
     stw_raw(p + 21, 512); /* cache size in sectors */
     stw_raw(p + 22, 4); /* ecc bytes */
     padstr((uint8_t *)(p + 23), QEMU_VERSION, 8); /* firmware version */
     padstr((uint8_t *)(p + 27), "QEMU HARDDISK", 40); /* model */
-#if MAX_MULT_SECTORS > 1    
-    stw_raw(p + 47, MAX_MULT_SECTORS);
+#if MAX_MULT_SECTORS > 1
+    stw_raw(p + 47, 0x8000 | MAX_MULT_SECTORS);
 #endif
     stw_raw(p + 48, 1); /* dword I/O */
     stw_raw(p + 49, 1 << 9); /* LBA supported, no DMA */
     stw_raw(p + 51, 0x200); /* PIO transfer cycle */
     stw_raw(p + 52, 0x200); /* DMA transfer cycle */
+    stw_raw(p + 53, 1); /* words 54-58 are valid */
     stw_raw(p + 54, s->cylinders);
     stw_raw(p + 55, s->heads);
     stw_raw(p + 56, s->sectors);
Signature · 1 line
Jens Axboe