From patchwork Wed Oct 12 08:08:22 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: 681059 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 3sv6226y51z9s36 for ; Wed, 12 Oct 2016 19:08:42 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3sv6225ssszDsvb for ; Wed, 12 Oct 2016 19:08:42 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 3sv61y5K5YzDsrV for ; Wed, 12 Oct 2016 19:08:38 +1100 (AEDT) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9C83WXa126482 for ; Wed, 12 Oct 2016 04:08:35 -0400 Received: from e23smtp02.au.ibm.com (e23smtp02.au.ibm.com [202.81.31.144]) by mx0b-001b2d01.pphosted.com with ESMTP id 261e549h54-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 12 Oct 2016 04:08:35 -0400 Received: from localhost by e23smtp02.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Oct 2016 18:08:32 +1000 Received: from d23dlp03.au.ibm.com (202.81.31.214) by e23smtp02.au.ibm.com (202.81.31.208) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 12 Oct 2016 18:08:29 +1000 Received: from d23relay10.au.ibm.com (d23relay10.au.ibm.com [9.190.26.77]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 69C153578053 for ; Wed, 12 Oct 2016 19:08:29 +1100 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay10.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u9C88TF83211624 for ; Wed, 12 Oct 2016 19:08:29 +1100 Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u9C88T3j012662 for ; Wed, 12 Oct 2016 19:08:29 +1100 Received: from abhimanyu.in.ibm.com ([9.79.236.205]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u9C88Qxb012514; Wed, 12 Oct 2016 19:08:27 +1100 From: Nikunj A Dadhania To: slof@lists.ozlabs.org, thuth@redhat.com Date: Wed, 12 Oct 2016 13:38:22 +0530 X-Mailer: git-send-email 2.7.4 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16101208-0004-0000-0000-000001A538D5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16101208-0005-0000-0000-000008DE13CC Message-Id: <1476259702-20626-1-git-send-email-nikunj@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-10-12_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1610120132 Subject: [SLOF] [PATCH v3] 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..adb12e3 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 + /x 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 x! ( ) + 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))