+2007-11-03 Marco Gerards <marco@gnu.org>
+
+ * disk/ata.c (grub_ata_pio_read): Detect and return the error code.
+ (grub_ata_pio_write): Likewise.
+ (grub_ata_readwrite): Use `grub_error', instead of
+ returning `grub_errno'.
+
2007-11-03 Marco Gerards <marco@gnu.org>
* disk/ata.c (grub_ata_readwrite): Call grub_ata_pio_read and
for (i = 0; i < size / 2; i++)
buf16[i] = grub_le_to_cpu16 (grub_inw(dev->ioaddress + GRUB_ATA_REG_DATA));
- /* XXX: Do some error checks. */
+ if (grub_ata_regget (dev, GRUB_ATA_REG_STATUS) & 1)
+ return grub_ata_regget (dev, GRUB_ATA_REG_ERROR);
return 0;
}
for (i = 0; i < size / 2; i++)
grub_outw(grub_cpu_to_le16 (buf16[i]), dev->ioaddress + GRUB_ATA_REG_DATA);
- /* XXX: Do some error checks. */
+ if (grub_ata_regget (dev, GRUB_ATA_REG_STATUS) & 1)
+ return grub_ata_regget (dev, GRUB_ATA_REG_ERROR);
return 0;
}
{
if (grub_ata_pio_read (dev, buf,
GRUB_DISK_SECTOR_SIZE))
- return grub_errno;
+ return grub_error (GRUB_ERR_READ_ERROR, "ATA read error");
buf += GRUB_DISK_SECTOR_SIZE;
sector++;
}
{
if (grub_ata_pio_write (dev, buf,
GRUB_DISK_SECTOR_SIZE))
- return grub_errno;
+ return grub_error (GRUB_ERR_WRITE_ERROR, "ATA write error");
buf += GRUB_DISK_SECTOR_SIZE;
}
}
for (sect = 0; sect < (size % batch); sect++)
{
if (grub_ata_pio_read (dev, buf, GRUB_DISK_SECTOR_SIZE))
- return grub_errno;
+ return grub_error (GRUB_ERR_READ_ERROR, "ATA read error");
buf += GRUB_DISK_SECTOR_SIZE;
}
} else {
{
if (grub_ata_pio_write (dev, buf,
(size % batch) * GRUB_DISK_SECTOR_SIZE))
- return grub_errno;
+ return grub_error (GRUB_ERR_WRITE_ERROR, "ATA write error");
buf += GRUB_DISK_SECTOR_SIZE;
}
}