Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/luna68k/stand/boot Fix off-by-one of a number of bl...



details:   https://anonhg.NetBSD.org/src/rev/196abd288019
branches:  trunk
changeset: 379705:196abd288019
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Tue Jun 15 17:16:16 2021 +0000

description:
Fix off-by-one of a number of blocks of probed disks.

The SCSI READ_CAPACITY command returns the last logical data block
address, so we have to increment it to get a number of blocks
as src/sys/dev/scsipi/sd.c does.

Bump revision to denote the change.

diffstat:

 sys/arch/luna68k/stand/boot/sc.c    |  10 +++++++---
 sys/arch/luna68k/stand/boot/version |   3 ++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diffs (51 lines):

diff -r 82e68d469fa1 -r 196abd288019 sys/arch/luna68k/stand/boot/sc.c
--- a/sys/arch/luna68k/stand/boot/sc.c  Tue Jun 15 17:13:08 2021 +0000
+++ b/sys/arch/luna68k/stand/boot/sc.c  Tue Jun 15 17:16:16 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sc.c,v 1.17 2018/02/09 22:08:28 jakllsch Exp $ */
+/*     $NetBSD: sc.c,v 1.18 2021/06/15 17:16:16 tsutsui Exp $  */
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -240,13 +240,17 @@ static void
 scprobe(struct scsi_softc *hs, uint target, uint lun)
 {
        struct scsi_inquiry inqbuf;
-       uint32_t capbuf[2];
+       uint32_t capbuf[2], blocks, blksize;
        char idstr[32];
        int i;
 
        if (!scident(hs->sc_ctlr, target, lun, &inqbuf, capbuf))
                return;
 
+       /* CMD_READ_CAPACITY returns the last logical data block address. */
+       blocks  = capbuf[0] + 1;
+       blksize = capbuf[1];
+
        memcpy(idstr, &inqbuf.vendor_id, 28);
        for (i = 27; i > 23; --i)
                if (idstr[i] != ' ')
@@ -262,7 +266,7 @@ scprobe(struct scsi_softc *hs, uint targ
        idstr[i + 1] = '\0';
 
        printf(" ID %d: %s %s rev %s", target, idstr, &idstr[8], &idstr[24]);
-       printf(", %d bytes/sect x %d sectors\n", capbuf[1], capbuf[0]);
+       printf(", %d bytes/sect x %d sectors\n", blksize, blocks);
 }
 
 
diff -r 82e68d469fa1 -r 196abd288019 sys/arch/luna68k/stand/boot/version
--- a/sys/arch/luna68k/stand/boot/version       Tue Jun 15 17:13:08 2021 +0000
+++ b/sys/arch/luna68k/stand/boot/version       Tue Jun 15 17:16:16 2021 +0000
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.12 2016/01/17 04:40:10 tsutsui Exp $
+$NetBSD: version,v 1.13 2021/06/15 17:16:16 tsutsui Exp $
 
 NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE.  The format of this
 file is important - make sure the entries are appended on end, last item
@@ -17,3 +17,4 @@ 1.8:  Probe SCSI devices at any IDs and c
 1.9:   Parse boot flags and pass boothowto and bootdev info to kernel.
 1.10:  Use booted device unit by default if no unit number is specified.
 1.11:  Disable slow gunzip CRC32 calculation.
+1.12:  Fix off-by-one of a number of blocks of probed disks.



Home | Main Index | Thread Index | Old Index