diff options
author | Roman Kagan <rkagan@virtuozzo.com> | 2017-06-08 12:58:07 +0300 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-06-12 15:01:31 -0400 |
commit | 6345621ded7fe999084501ba9382913b079acc9c (patch) | |
tree | 5f1ffe7562c4e3958861578c5f4ab3a960f074c9 /src | |
parent | dee3c1535d5550fab914cd181cbb02741d749e2a (diff) | |
download | seabios-6345621ded7fe999084501ba9382913b079acc9c.tar.gz |
blockcmd: start REPORT_LUNS with the smallest buffer
A number of emulated SCSI devices in QEMU incorrectly return an error
to REPORT_LUNS command when the size of the data returned is smaller
than the allocation length passed in.
To work it around, start with the smallest allocation length possible:
for 1 entry. This is a slight pessimization because it would require
another REPORT_LUNS iteration if the target has more than a single LUN,
but this appears to have negligible impact on boot times, and makes
REPORT_LUNS enumeration work for more QEMU devices (lsi53c895a,
mptsas1068).
Reported-by: Maciej Józefczyk <maciej.jozefczyk@corp.ovh.com>
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/hw/blockcmd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c index 324188d7..98c06ced 100644 --- a/src/hw/blockcmd.c +++ b/src/hw/blockcmd.c @@ -215,7 +215,9 @@ static u64 scsilun2u64(struct scsi_lun *scsi_lun) int scsi_rep_luns_scan(struct drive_s *tmp_drive, scsi_add_lun add_lun) { int ret = -1; - u32 maxluns = 511; + /* start with the smallest possible buffer, otherwise some devices in QEMU + * may (incorrectly) error out on returning less data than fits in it */ + u32 maxluns = 1; u32 nluns, i; struct cdb_report_luns cdb = { .command = CDB_CMD_REPORT_LUNS, |