* grub-core/disk/pata.c (grub_pata_readwrite): Fix ATAPI protocol error.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-02-29 12:45:32 +01:00
parent 2702b4e4f7
commit ebd17d6f51
2 changed files with 10 additions and 5 deletions

View file

@ -1,3 +1,7 @@
2012-02-29 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/pata.c (grub_pata_readwrite): Fix ATAPI protocol error.
2012-02-28 Vladimir Serbinenko <phcoder@gmail.com>
Fix make dist.

View file

@ -203,11 +203,8 @@ grub_pata_readwrite (struct grub_ata *disk,
/* Transfer data. */
while (nread < parms->size
&& ((sts & (GRUB_ATA_STATUS_DRQ | GRUB_ATA_STATUS_ERR))
== GRUB_ATA_STATUS_DRQ)
&& (!parms->cmdsize
|| ((grub_pata_regget (dev, GRUB_ATAPI_REG_IREASON)
& GRUB_ATAPI_IREASON_MASK) == GRUB_ATAPI_IREASON_DATA_IN)))
&& (sts & (GRUB_ATA_STATUS_DRQ | GRUB_ATA_STATUS_ERR))
== GRUB_ATA_STATUS_DRQ)
{
unsigned cnt;
@ -217,6 +214,10 @@ grub_pata_readwrite (struct grub_ata *disk,
if (parms->cmdsize)
{
if ((grub_pata_regget (dev, GRUB_ATAPI_REG_IREASON)
& GRUB_ATAPI_IREASON_MASK) != GRUB_ATAPI_IREASON_DATA_IN)
return grub_error (GRUB_ERR_READ_ERROR, "ATAPI protocol error");
cnt = grub_pata_regget (dev, GRUB_ATAPI_REG_CNTHIGH) << 8
| grub_pata_regget (dev, GRUB_ATAPI_REG_CNTLOW);
grub_dprintf("pata", "DRQ count=%u\n", cnt);