qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] ata identify device errors
@ 2004-01-24 20:20 Jens Axboe
  0 siblings, 0 replies; only message in thread
From: Jens Axboe @ 2004-01-24 20:20 UTC (permalink / raw)
  To: qemu-devel

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
diff -u -r1.6 ide.c
--- ide.c	22 Jan 2004 23:52:27 -0000	1.6
+++ ide.c	24 Jan 2004 20:19:13 -0000
@@ -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);

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-01-24 20:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-24 20:20 [Qemu-devel] ata identify device errors Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).