diff options
author | Julius Lehmann <lehmanju@devpi.de> | 2024-10-26 20:06:44 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-11-01 13:34:32 -0600 |
commit | 5f7c06bdc3c6b20362992cd1b6d137f5bb599a0a (patch) | |
tree | 1c7c515fe21266fab4254759bd508e9ca5ee2283 /drivers/scsi/scsi.c | |
parent | 99ce74a41baede05b20639f3839588b3a9678df8 (diff) | |
download | u-boot-5f7c06bdc3c6b20362992cd1b6d137f5bb599a0a.tar.gz |
scsi: fix disk capacity too small by one sector
SCSI READ CAPACITY reports the address of the last block and the block
size. The total number of blocks is thus last block address plus one.
This also fixes the corresponding test case.
Diffstat (limited to 'drivers/scsi/scsi.c')
-rw-r--r-- | drivers/scsi/scsi.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 51cacf34792..bcdeda95ed1 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -309,6 +309,7 @@ static int scsi_read_capacity(struct udevice *dev, struct scsi_cmd *pccb, ((unsigned long)pccb->pdata[5] << 16) | ((unsigned long)pccb->pdata[6] << 8) | ((unsigned long)pccb->pdata[7]); + *capacity += 1; return 0; } @@ -332,6 +333,7 @@ static int scsi_read_capacity(struct udevice *dev, struct scsi_cmd *pccb, ((uint64_t)pccb->pdata[5] << 16) | ((uint64_t)pccb->pdata[6] << 8) | ((uint64_t)pccb->pdata[7]); + *capacity += 1; *blksz = ((uint64_t)pccb->pdata[8] << 56) | ((uint64_t)pccb->pdata[9] << 48) | |