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.
This commit is contained in:
marco_g 2007-11-03 12:25:19 +00:00
parent ca25d8f0c1
commit ed649e5402
2 changed files with 36 additions and 15 deletions

View file

@ -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.

View 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;