From nobody Mon Feb 9 18:46:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+55874+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+55874+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1584373399; cv=none; d=zohomail.com; s=zohoarc; b=MkRI0LCB7K3AylgQ8FGbsyIFX3H2FWnJYMaiWb6kNH1DRwYspSax2s/DbnKBU2hJzVdsBJnSjXXxjwB1Z+BXKdmC3HfKW/uxMmR0KaiPdTPCNVoGR+J45cbTPJ7+psfxEa6v7XR8pDOyNRV75ZYnr4HMcAS1/yqmBJDTMtZZgm8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584373399; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=5kf4U4+PJUL7OYZQMNMFgcOjIzrQoQyxc9/5OAiY7Xw=; b=BtltWblboia8QjJYBpUcqqPMCInncLT6/lGH01nzy3Jifx0CyUlV3cPjSRqZyLupupAKtqzOnZRUZGpgW0sAVCi2BKmwIFMPKc9bw7Zu4DkjvbWZA/ZoQktTkvtUQlRillRcmr4paQM/fuzTIl8lwtpg9bXEPC3MtvXhpUCuHCM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+55874+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1584373399290253.41327240467774; Mon, 16 Mar 2020 08:43:19 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 5F62YY1788612xQFstl95inI; Mon, 16 Mar 2020 08:43:19 -0700 X-Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by mx.groups.io with SMTP id smtpd.web10.69874.1584370945323435090 for ; Mon, 16 Mar 2020 08:02:25 -0700 X-Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02GErgwg156914; Mon, 16 Mar 2020 15:02:25 GMT X-Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 2yrqwmyavv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Mar 2020 15:02:22 +0000 X-Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02GEpY1H075045; Mon, 16 Mar 2020 15:00:22 GMT X-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 2ys929uu03-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 16 Mar 2020 15:00:22 +0000 X-Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 02GF0KTe011470; Mon, 16 Mar 2020 15:00:20 GMT X-Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 16 Mar 2020 08:00:20 -0700 From: "Liran Alon" To: devel@edk2.groups.io, lersek@redhat.com Cc: nikita.leshchenko@oracle.com, aaron.young@oracle.com, jordan.l.justen@intel.com, ard.biesheuvel@linaro.org, Liran Alon Subject: [edk2-devel] [PATCH 07/17] OvmfPkg/PvScsiDxe: Translate Target & LUN to/from DevicePath Date: Mon, 16 Mar 2020 17:01:03 +0200 Message-Id: <20200316150113.104630-8-liran.alon@oracle.com> In-Reply-To: <20200316150113.104630-1-liran.alon@oracle.com> References: <20200316150113.104630-1-liran.alon@oracle.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,liran.alon@oracle.com X-Gm-Message-State: lF0CQnjjQ3BQEA7ekVwSv68cx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1584373399; bh=rjPfssaD5P9r1FJwGA9klmpbO02osI3aQoPXyd0qs4c=; h=Cc:Date:From:Reply-To:Subject:To; b=f2X6psV7jted8XXSolxV1WxbCvBHnWjywxYo4xIYYCAdJJERU3lfCiAULFYxzkyZDef R3Gd3Vsmmust5Tw5MlGjHsuGhYLB9cumILyZ+4ChV4lRPdIlemgJOKp+nrTZPhLhVqWj3 jX6tOq3HUTytWFL+DnV6LtBYiXU/gLz3rss= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Implement EXT_SCSI_PASS_THRU.BuildDevicePath() and EXT_SCSI_PASS_THRU.GetTargetLun(). Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2567 Reviewed-by: Nikita Leshenko Signed-off-by: Liran Alon Reviewed-by: Laszlo Ersek --- OvmfPkg/PvScsiDxe/PvScsi.c | 60 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/PvScsiDxe/PvScsi.c b/OvmfPkg/PvScsiDxe/PvScsi.c index 76bb361c7c94..f613870e80f2 100644 --- a/OvmfPkg/PvScsiDxe/PvScsi.c +++ b/OvmfPkg/PvScsiDxe/PvScsi.c @@ -136,7 +136,38 @@ PvScsiBuildDevicePath ( IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath ) { - return EFI_UNSUPPORTED; + UINT8 TargetValue; + PVSCSI_DEV *Dev; + SCSI_DEVICE_PATH *ScsiDevicePath; + + if (DevicePath =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + // + // We only use first byte of target identifer + // + TargetValue =3D *Target; + + Dev =3D PVSCSI_FROM_PASS_THRU (This); + if (TargetValue > Dev->MaxTarget || Lun > Dev->MaxLun) { + return EFI_NOT_FOUND; + } + + ScsiDevicePath =3D AllocatePool (sizeof (*ScsiDevicePath)); + if (ScsiDevicePath =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + ScsiDevicePath->Header.Type =3D MESSAGING_DEVICE_PATH; + ScsiDevicePath->Header.SubType =3D MSG_SCSI_DP; + ScsiDevicePath->Header.Length[0] =3D (UINT8)sizeof (*ScsiDevicePath); + ScsiDevicePath->Header.Length[1] =3D (UINT8)(sizeof (*ScsiDevicePath) >>= 8); + ScsiDevicePath->Pun =3D TargetValue; + ScsiDevicePath->Lun =3D (UINT16)Lun; + + *DevicePath =3D &ScsiDevicePath->Header; + return EFI_SUCCESS; } =20 STATIC @@ -149,7 +180,32 @@ PvScsiGetTargetLun ( OUT UINT64 *Lun ) { - return EFI_UNSUPPORTED; + SCSI_DEVICE_PATH *ScsiDevicePath; + PVSCSI_DEV *Dev; + + if (DevicePath =3D=3D NULL || Target =3D=3D NULL || *Target =3D=3D NULL = || Lun =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + if (DevicePath->Type !=3D MESSAGING_DEVICE_PATH || + DevicePath->SubType !=3D MSG_SCSI_DP) { + return EFI_UNSUPPORTED; + } + + ScsiDevicePath =3D (SCSI_DEVICE_PATH *)DevicePath; + Dev =3D PVSCSI_FROM_PASS_THRU (This); + if (ScsiDevicePath->Pun > Dev->MaxTarget || + ScsiDevicePath->Lun > Dev->MaxLun) { + return EFI_NOT_FOUND; + } + + // + // We only use first byte of target identifer + // + **Target =3D (UINT8)ScsiDevicePath->Pun; + *Lun =3D ScsiDevicePath->Lun; + + return EFI_SUCCESS; } =20 STATIC --=20 2.20.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#55874): https://edk2.groups.io/g/devel/message/55874 Mute This Topic: https://groups.io/mt/72001276/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-