]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2007-11-03 Marco Gerards <marco@gnu.org>
authormarco_g <marco_g@localhost>
Sat, 3 Nov 2007 12:25:19 +0000 (12:25 +0000)
committermarco_g <marco_g@localhost>
Sat, 3 Nov 2007 12:25:19 +0000 (12:25 +0000)
* disk/ata.c (grub_ata_readwrite): Call grub_ata_pio_read and
grub_ata_pio_write once for every single sector, instead of for
multiple sectors.

ChangeLog
disk/ata.c

index 5bc46d1fec4a0bc0886476e20e88e5784d65487b..bc7ac7c95f90d61483611b5954e194a56870f3a8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-11-03  Marco Gerards  <marco@gnu.org>
+
+       * disk/ata.c (grub_ata_readwrite): Call grub_ata_pio_read and
+       grub_ata_pio_write once for every single sector, instead of for
+       multiple sectors.
+
 2007-10-31  Robert Millan  <rmh@aybabtu.com>
 
        * configure.ac: Add `i386-linuxbios' to the list of supported targets.
index d3fac2bdc795d9a395e72a7e293f1c34b9b13559..d8dfa622b32b170e8654ec6e96bfb1a054e30498 100644 (file)
@@ -492,6 +492,7 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
   grub_ata_addressing_t addressing;
   int cmd;
   int cmd_write;
+  unsigned int sect;
 
   addressing = dev->addr;
 
@@ -523,21 +524,28 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
        {
          /* Read 256/65536 sectors.  */
          grub_ata_regset (dev, GRUB_ATA_REG_CMD, cmd);
-         if (grub_ata_pio_read (dev, buf,
-                                batch * GRUB_DISK_SECTOR_SIZE))
-           return grub_errno;
+         for (sect = 0; sect < batch; sect++)
+           {
+             if (grub_ata_pio_read (dev, buf,
+                                    GRUB_DISK_SECTOR_SIZE))
+               return grub_errno;
+             buf += GRUB_DISK_SECTOR_SIZE;
+             sector++;
+           }
        }
       else
        {
          /* Write 256/65536 sectors.  */
          grub_ata_regset (dev, GRUB_ATA_REG_CMD, cmd_write);
-         if (grub_ata_pio_write (dev, buf,
-                                 batch * GRUB_DISK_SECTOR_SIZE))
-           return grub_errno;
+         for (sect = 0; sect < batch; sect++)
+           {
+             if (grub_ata_pio_write (dev, buf,
+                                     GRUB_DISK_SECTOR_SIZE))
+               return grub_errno;
+             buf += GRUB_DISK_SECTOR_SIZE;
+           }
        }
-
-      buf += batch * GRUB_DISK_SECTOR_SIZE;
-      sector += batch * GRUB_DISK_SECTOR_SIZE;
+      sector += batch;
     }
 
   /* Read/write just a "few" sectors.  */
@@ -548,15 +556,22 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
     {
       /* Read sectors.  */
       grub_ata_regset (dev, GRUB_ATA_REG_CMD, cmd);
-      if (grub_ata_pio_read (dev, buf,
-                            (size % batch) * GRUB_DISK_SECTOR_SIZE))
-       return grub_errno;
+      for (sect = 0; sect < (size % batch); sect++)
+       {
+         if (grub_ata_pio_read (dev, buf, GRUB_DISK_SECTOR_SIZE))
+           return grub_errno;
+         buf += GRUB_DISK_SECTOR_SIZE;
+       }
     } else {
       /* Write sectors.  */
       grub_ata_regset (dev, GRUB_ATA_REG_CMD, cmd_write);
-      if (grub_ata_pio_write (dev, buf,
-                             (size % batch) * GRUB_DISK_SECTOR_SIZE))
-       return grub_errno;
+      for (sect = 0; sect < batch; sect++)
+       {
+         if (grub_ata_pio_write (dev, buf,
+                                 (size % batch) * GRUB_DISK_SECTOR_SIZE))
+           return grub_errno;
+         buf += GRUB_DISK_SECTOR_SIZE;
+       }
     }
 
   return GRUB_ERR_NONE;