Commit adf1152b34 for qemu.org

commit adf1152b3454673a19f84e830dce80203851864c
Author: Denis V. Lunev <den@openvz.org>
Date:   Thu Aug 20 09:37:11 2026 +0200

    hw/ide: name the retired IDENTIFY DEVICE words the device fills in

    Words 4, 5 and 20 have carried an "XXX: retired, remove ?" since the
    device was written, and word 21 is labelled a cache size when it is a
    buffer size. ATA-4 8.12.13 retired words 4 and 5, 8.12.17 retired words
    20 and 21, and ATA-5 keeps all four that way.

    Retired is not a reason to drop them. ATA-5 3.2.3.6 says a retired word
    that is still used shall have "the meaning or functionality as described
    in previous standards", and that is what these carry: ATA-1 9.9.3, 9.9.4
    and 9.9.7 define the unformatted bytes per track and per sector and the
    buffer type, and the ATA-1 IDENTIFY table gives word 21 as the buffer
    size in 512 byte increments. Software old enough to read them gets what
    it expects, so answer the question rather than leave it open.

    Word 22 is obsolete rather than retired (ATA-4 8.12.18) and already
    carries its ATA-1 9.9.8 name, so leave it alone.

    Cc: John Snow <jsnow@redhat.com>
    Cc: Peter Maydell <peter.maydell@linaro.org>
    Cc: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
    Signed-off-by: Denis V. Lunev <den@openvz.org>

diff --git a/hw/ide/core.c b/hw/ide/core.c
index befbab9486..292908fb1c 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -141,12 +141,12 @@ static void ide_identify(IDEState *s)
     /* Words 1, 3 and 6 describe the default translation (ATA-5 8.16.8) */
     put_le16(p + 1, s->cylinders);
     put_le16(p + 3, s->drive_heads);
-    put_le16(p + 4, 512 * s->drive_sectors); /* XXX: retired, remove ? */
-    put_le16(p + 5, 512); /* XXX: retired, remove ? */
+    put_le16(p + 4, 512 * s->drive_sectors); /* ATA-1 unformatted bytes/trk */
+    put_le16(p + 5, 512); /* ATA-1 unformatted bytes per sector */
     put_le16(p + 6, s->drive_sectors);
     padstr((char *)(p + 10), s->drive_serial_str, 20); /* serial number */
-    put_le16(p + 20, 3); /* XXX: retired, remove ? */
-    put_le16(p + 21, 512); /* cache size in sectors */
+    put_le16(p + 20, 3); /* ATA-1 buffer type: dual ported, read caching */
+    put_le16(p + 21, 512); /* ATA-1 buffer size in 512 byte increments */
     put_le16(p + 22, 4); /* ecc bytes */
     padstr((char *)(p + 23), s->version, 8); /* firmware version */
     padstr((char *)(p + 27), s->drive_model_str, 40); /* model */