From patchwork Wed Oct 12 03:42:23 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: 680993 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sv0733Lb8z9t0J for ; Wed, 12 Oct 2016 14:42:39 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3sv0732WvczDsrm for ; Wed, 12 Oct 2016 14:42:39 +1100 (AEDT) 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 3sv0711fC6zDsrc for ; Wed, 12 Oct 2016 14:42:37 +1100 (AEDT) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9C3dZgR092764 for ; Tue, 11 Oct 2016 23:42:35 -0400 Received: from e28smtp04.in.ibm.com (e28smtp04.in.ibm.com [125.16.236.4]) by mx0a-001b2d01.pphosted.com with ESMTP id 2615bu1sd1-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 11 Oct 2016 23:42:34 -0400 Received: from localhost by e28smtp04.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Oct 2016 09:12:31 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp04.in.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 12 Oct 2016 09:12:30 +0530 Received: from d28relay08.in.ibm.com (d28relay08.in.ibm.com [9.184.220.159]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id 0FC15E005A for ; Wed, 12 Oct 2016 09:12:10 +0530 (IST) Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay08.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u9C3gEkD30933034 for ; Wed, 12 Oct 2016 09:12:14 +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 u9C3gSl2032746 for ; Wed, 12 Oct 2016 09:12:29 +0530 Received: from abhimanyu.in.ibm.com ([9.79.236.205]) by d28av05.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u9C3gR8f032693; Wed, 12 Oct 2016 09:12:27 +0530 From: Nikunj A Dadhania To: slof@lists.ozlabs.org Date: Wed, 12 Oct 2016 09:12:23 +0530 X-Mailer: git-send-email 2.7.4 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16101203-0012-0000-0000-00000331E466 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16101203-0013-0000-0000-0000194847D9 Message-Id: <1476243743-13039-1-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-10-12_01:, , 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-1609300000 definitions=main-1610120060 Subject: [SLOF] [PATCH v2] scsi: implement READ (16) command 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-10 would fail as it is limited by the block address(4bytes). Add and use SCSI command READ(16) when max blocks is more than 0xFFFFFFFF. Signed-off-by: Nikunj A Dadhania Reviewed-by: Thomas Huth --- slof/fs/scsi-disk.fs | 7 ++++++- slof/fs/scsi-support.fs | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/slof/fs/scsi-disk.fs b/slof/fs/scsi-disk.fs index 2f7d740..bcaa19e 100644 --- a/slof/fs/scsi-disk.fs +++ b/slof/fs/scsi-disk.fs @@ -82,7 +82,12 @@ CREATE cdb 10 allot >r rot r> ( block# #blocks addr len ) 2swap ( addr len block# #blocks ) dup >r - cdb scsi-build-read-10 ( addr len ) + cdb ( addr len block# #blocks cdb ) + max-block-num FFFFFFFF > IF + scsi-build-read-16 ( addr len ) + ELSE + scsi-build-read-10 ( addr len ) + THEN r> -rot ( #blocks addr len ) scsi-dir-read cdb scsi-param-size 10 retry-scsi-command diff --git a/slof/fs/scsi-support.fs b/slof/fs/scsi-support.fs index 3e65c87..202d43f 100644 --- a/slof/fs/scsi-support.fs +++ b/slof/fs/scsi-support.fs @@ -525,6 +525,35 @@ CONSTANT scsi-length-read-12 ; \ *************************************************************************** +\ SCSI-Command: READ (16) +\ Type: Block Command +\ *************************************************************************** +\ Forth Word: scsi-build-read-16 ( block# #blocks cdb -- ) +\ *************************************************************************** +\ command code +88 CONSTANT scsi-cmd-read-16 + +\ CDB structure +STRUCT + /c FIELD read-16>operation-code \ code: 88 + /c FIELD read-16>protect \ RDPROTECT, DPO, FUA, FUA_NV + /n FIELD read-16>block-address \ lba + /l FIELD read-16>length \ transfer length (32bits) + /c FIELD read-16>group \ group number + /c FIELD read-16>control +CONSTANT scsi-length-read-16 + +: scsi-build-read-16 ( block# #blocks cdb -- ) + >r ( block# #blocks ) ( R: -- cdb ) + r@ scsi-length-read-16 erase \ 16 bytes CDB + scsi-cmd-read-16 r@ read-16>operation-code c! ( block# #blocks ) + r@ read-16>length l! ( block# ) + r@ read-16>block-address ! ( ) + scsi-param-control r> read-16>control c! ( R: cdb -- ) + scsi-length-read-16 to scsi-param-size \ update CDB length +; + +\ *************************************************************************** \ SCSI-Command: READ with autodetection of required command \ read(10) or read(12) depending on parameter size \ (read(6) removed because obsolete in some cases (USB))