Module Name:    src
Committed By:   tsutsui
Date:           Tue Jun 15 17:16:16 UTC 2021

Modified Files:
        src/sys/arch/luna68k/stand/boot: sc.c version

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/luna68k/stand/boot/sc.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/luna68k/stand/boot/version

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/luna68k/stand/boot/sc.c
diff -u src/sys/arch/luna68k/stand/boot/sc.c:1.17 src/sys/arch/luna68k/stand/boot/sc.c:1.18
--- src/sys/arch/luna68k/stand/boot/sc.c:1.17	Fri Feb  9 22:08:28 2018
+++ src/sys/arch/luna68k/stand/boot/sc.c	Tue Jun 15 17:16:16 2021
@@ -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);
 }
 
 

Index: src/sys/arch/luna68k/stand/boot/version
diff -u src/sys/arch/luna68k/stand/boot/version:1.12 src/sys/arch/luna68k/stand/boot/version:1.13
--- src/sys/arch/luna68k/stand/boot/version:1.12	Sun Jan 17 04:40:10 2016
+++ src/sys/arch/luna68k/stand/boot/version	Tue Jun 15 17:16:16 2021
@@ -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 @@ is taken as the current.
 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.

Reply via email to