* grub-core/disk/scsi.c (grub_scsi_read): Limit SCSI reads to 32K
because of underlying system restrictions.
This commit is contained in:
parent
efff4b1cc3
commit
1e3d9b8612
2 changed files with 31 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2011-06-27 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/disk/scsi.c (grub_scsi_read): Limit SCSI reads to 32K
|
||||||
|
because of underlying system restrictions.
|
||||||
|
|
||||||
2011-06-27 Vladimir Serbinenko <phcoder@gmail.com>
|
2011-06-27 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* util/grub-mkrescue.in: Rename "ata" to "pata" and add ahci when
|
* util/grub-mkrescue.in: Rename "ata" to "pata" and add ahci when
|
||||||
|
|
|
@ -524,17 +524,36 @@ grub_scsi_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
|
|
||||||
scsi = disk->data;
|
scsi = disk->data;
|
||||||
|
|
||||||
|
while (size)
|
||||||
|
{
|
||||||
|
/* PATA doesn't support more than 32K reads.
|
||||||
|
Not sure about AHCI and USB. If it's confirmed that either of
|
||||||
|
them can do bigger reads reliably this value can be moved to 'scsi'
|
||||||
|
structure. */
|
||||||
|
grub_size_t len = 32768 >> disk->log_sector_size;
|
||||||
|
grub_err_t err;
|
||||||
|
if (len > size)
|
||||||
|
len = size;
|
||||||
/* Depending on the type, select a read function. */
|
/* Depending on the type, select a read function. */
|
||||||
switch (scsi->devtype)
|
switch (scsi->devtype)
|
||||||
{
|
{
|
||||||
case grub_scsi_devtype_direct:
|
case grub_scsi_devtype_direct:
|
||||||
return grub_scsi_read10 (disk, sector, size, buf);
|
err = grub_scsi_read10 (disk, sector, len, buf);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
break;
|
||||||
|
|
||||||
case grub_scsi_devtype_cdrom:
|
case grub_scsi_devtype_cdrom:
|
||||||
return grub_scsi_read12 (disk, sector, size, buf);
|
err = grub_scsi_read12 (disk, sector, len, buf);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
size -= len;
|
||||||
|
sector += len;
|
||||||
|
buf += len << disk->log_sector_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: Never reached. */
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
|
||||||
#if 0 /* Workaround - it works - but very slowly, from some reason
|
#if 0 /* Workaround - it works - but very slowly, from some reason
|
||||||
|
|
Loading…
Reference in a new issue