From patchwork Thu Sep 22 18:13:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikunj A Dadhania X-Patchwork-Id: 673607 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sg4PF1DRPz9t15 for ; Fri, 23 Sep 2016 04:13:37 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3sg4PD6pkDzDsjQ for ; Fri, 23 Sep 2016 04:13:36 +1000 (AEST) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3sg4P904S0zDsjK for ; Fri, 23 Sep 2016 04:13:32 +1000 (AEST) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u8MID4oO143060 for ; Thu, 22 Sep 2016 14:13:31 -0400 Received: from e28smtp09.in.ibm.com (e28smtp09.in.ibm.com [125.16.236.9]) by mx0a-001b2d01.pphosted.com with ESMTP id 25mcrs465j-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 22 Sep 2016 14:13:30 -0400 Received: from localhost by e28smtp09.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 22 Sep 2016 23:43:27 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp09.in.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 22 Sep 2016 23:43:14 +0530 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id B0A55E0040 for ; Thu, 22 Sep 2016 23:42:36 +0530 (IST) Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay05.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u8MIDDw634144352 for ; Thu, 22 Sep 2016 23:43:13 +0530 Received: from d28av05.in.ibm.com (localhost [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u8MIDClA032640 for ; Thu, 22 Sep 2016 23:43:13 +0530 Received: from abhimanyu.in.ibm.com ([9.79.243.19]) by d28av05.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u8MID9nS032539; Thu, 22 Sep 2016 23:43:11 +0530 From: Nikunj A Dadhania To: slof@lists.ozlabs.org Date: Thu, 22 Sep 2016 23:43:07 +0530 X-Mailer: git-send-email 2.7.4 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16092218-0060-0000-0000-00000146DCC0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16092218-0061-0000-0000-00000FD20F40 Message-Id: <1474567987-31607-1-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-09-22_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609220318 Subject: [SLOF] [PATCH] scsi: implement read-capacity-16 X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" For disks bigger than 2TB(512B sector size), read-capacity-10 would fail and return FFFFFFFF, as it only has 4byte block address field. Detect this and use read-capacity-16 which returns 8byte block address. Signed-off-by: Nikunj A Dadhania Reviewed-by: Thomas Huth --- slof/fs/scsi-disk.fs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/slof/fs/scsi-disk.fs b/slof/fs/scsi-disk.fs index 1978471..d4a774b 100644 --- a/slof/fs/scsi-disk.fs +++ b/slof/fs/scsi-disk.fs @@ -121,6 +121,20 @@ CREATE cdb 10 allot drop scratch scsi-get-capacity-10 1 + ; +: read-capacity-16 ( -- blocksize #blocks ) + \ Now issue the read-capacity-16 command + scsi-disk-debug? IF + ." SCSI-DISK: read-capacity-16 " .s cr + THEN + \ Make sure that there are zeros in the buffer in case something goes wrong: + scratch 20 erase + cdb scsi-build-read-cap-16 scratch scsi-length-read-cap-16-data scsi-dir-read + cdb scsi-param-size 1 retry-scsi-command + \ Success ? + dup 0<> IF " read-capacity-16" dump-scsi-error 0 0 EXIT THEN + drop scratch scsi-get-capacity-16 1 + +; + 100 CONSTANT test-unit-retries \ SCSI test-unit-read @@ -293,6 +307,11 @@ CREATE cdb 10 allot " max-transfer" $call-parent to max-transfer read-capacity to max-block-num to block-size + \ Check if read-capacity-10 hit the maximum value 0xFFFF.FFFF + max-block-num 100000000 = IF + read-capacity-16 to max-block-num to block-size + THEN + max-block-num 0= block-size 0= OR IF ." SCSI-DISK: Failed to get disk capacity!" cr FALSE EXIT