core, diskio: put the error code in dprintf and printable messages
authorH. Peter Anvin <hpa@zytor.com>
Wed, 30 Jun 2010 16:53:46 +0000 (09:53 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Thu, 1 Jul 2010 14:13:09 +0000 (07:13 -0700)
When we print an error message to the screen, include the error
number.  Furthermore, dprintf it on retries.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core/fs/diskio.c

index 176c5bc..b186af6 100644 (file)
@@ -79,6 +79,8 @@ static int chs_rdwr_sectors(struct disk *disk, void *buf,
            if (retry--)
                continue;
 
+           dprintf("CHS: error AX = %04x\n", oreg.eax.w[0]);
+
            /* For any starting value, this will always end with ..., 1, 0 */
            chunk >>= 1;
             if (chunk) {
@@ -87,7 +89,8 @@ static int chs_rdwr_sectors(struct disk *disk, void *buf,
                 ireg.eax.b[0] = chunk;
                 continue;
            } else {
-               printf("CHS: Error %s sector %llu (%u/%u/%u)\n",
+               printf("CHS: Error %04x %s sector %llu (%u/%u/%u)\n",
+                      oreg.eax.w[0],
                       is_write ? "writing" : "reading",
                       lba, c, h, s+1);
            }
@@ -179,6 +182,8 @@ static int edd_rdwr_sectors(struct disk *disk, void *buf,
            if (retry--)
                continue;
 
+           dprintf("EDD: error AX = %04x\n", oreg.eax.w[0]);
+
            /* For any starting value, this will always end with ..., 1, 0 */
            chunk >>= 1;
            if (chunk) {
@@ -188,7 +193,8 @@ static int edd_rdwr_sectors(struct disk *disk, void *buf,
            }
 
            /*** XXX: Consider falling back to CHS here?! ***/
-            printf("EDD: Error %s sector %llu\n",
+            printf("EDD: Error %04x %s sector %llu\n",
+                  oreg.eax.w[0],
                   is_write ? "writing" : "reading",
                   lba);
            return done;        /* Failure */