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'.
This commit is contained in:
parent
ed649e5402
commit
cf8f780b84
2 changed files with 15 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
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>
|
2007-11-03 Marco Gerards <marco@gnu.org>
|
||||||
|
|
||||||
* disk/ata.c (grub_ata_readwrite): Call grub_ata_pio_read and
|
* disk/ata.c (grub_ata_readwrite): Call grub_ata_pio_read and
|
||||||
|
|
14
disk/ata.c
14
disk/ata.c
|
@ -181,7 +181,8 @@ grub_ata_pio_read (struct grub_ata_device *dev, char *buf,
|
||||||
for (i = 0; i < size / 2; i++)
|
for (i = 0; i < size / 2; i++)
|
||||||
buf16[i] = grub_le_to_cpu16 (grub_inw(dev->ioaddress + GRUB_ATA_REG_DATA));
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +204,8 @@ grub_ata_pio_write (struct grub_ata_device *dev, char *buf,
|
||||||
for (i = 0; i < size / 2; i++)
|
for (i = 0; i < size / 2; i++)
|
||||||
grub_outw(grub_cpu_to_le16 (buf16[i]), dev->ioaddress + GRUB_ATA_REG_DATA);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -528,7 +530,7 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
{
|
{
|
||||||
if (grub_ata_pio_read (dev, buf,
|
if (grub_ata_pio_read (dev, buf,
|
||||||
GRUB_DISK_SECTOR_SIZE))
|
GRUB_DISK_SECTOR_SIZE))
|
||||||
return grub_errno;
|
return grub_error (GRUB_ERR_READ_ERROR, "ATA read error");
|
||||||
buf += GRUB_DISK_SECTOR_SIZE;
|
buf += GRUB_DISK_SECTOR_SIZE;
|
||||||
sector++;
|
sector++;
|
||||||
}
|
}
|
||||||
|
@ -541,7 +543,7 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
{
|
{
|
||||||
if (grub_ata_pio_write (dev, buf,
|
if (grub_ata_pio_write (dev, buf,
|
||||||
GRUB_DISK_SECTOR_SIZE))
|
GRUB_DISK_SECTOR_SIZE))
|
||||||
return grub_errno;
|
return grub_error (GRUB_ERR_WRITE_ERROR, "ATA write error");
|
||||||
buf += GRUB_DISK_SECTOR_SIZE;
|
buf += GRUB_DISK_SECTOR_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -559,7 +561,7 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
for (sect = 0; sect < (size % batch); sect++)
|
for (sect = 0; sect < (size % batch); sect++)
|
||||||
{
|
{
|
||||||
if (grub_ata_pio_read (dev, buf, GRUB_DISK_SECTOR_SIZE))
|
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;
|
buf += GRUB_DISK_SECTOR_SIZE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -569,7 +571,7 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
{
|
{
|
||||||
if (grub_ata_pio_write (dev, buf,
|
if (grub_ata_pio_write (dev, buf,
|
||||||
(size % batch) * GRUB_DISK_SECTOR_SIZE))
|
(size % batch) * GRUB_DISK_SECTOR_SIZE))
|
||||||
return grub_errno;
|
return grub_error (GRUB_ERR_WRITE_ERROR, "ATA write error");
|
||||||
buf += GRUB_DISK_SECTOR_SIZE;
|
buf += GRUB_DISK_SECTOR_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue