From nobody Mon Feb 9 20:35:30 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+56313+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+56313+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1585152473; cv=none; d=zohomail.com; s=zohoarc; b=YN4QgabLKZphLYuy8cNz3gr1qyqVRg6ifemB8kiOqhofDi3eEQ15qeG+7I5oA3REUDOXW54Y6yOkERU6Jeorur7bSFuuIQrCI6009+u/OVbxYXCx1WQMtahsdM/TTzQO+esXpdcvkb3KUZPOsEo+ZhF7k4aAJad+PQwBOJpHG2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585152473; 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=PD0bDrheEw9w3yTCMaDP552QBxHEL6kgUqzmxbr8REk=; b=i6RU2yjwRlp38vcIxwAgCUvJlngJMS/+wiIDVk4vUxuDrFLflhdM7lrSxuhrszqNDwcfVCzlRXS2kN7EGDH90YOKQfYsQwY+Z0+YkXu1xvYiJeGxQT9PhxS0Szmzvxvs3yK7+qmTyIVuzly0DYLFdBZVBDOZl7QtwZBexY5/Z1M= 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+56313+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 1585152473781279.38437525627376; Wed, 25 Mar 2020 09:07:53 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id IFu2YY1788612x7ZxfkEEnL0; Wed, 25 Mar 2020 09:07:53 -0700 X-Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by mx.groups.io with SMTP id smtpd.web11.15221.1585152472962758502 for ; Wed, 25 Mar 2020 09:07:53 -0700 X-Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02PG3LAc050325; Wed, 25 Mar 2020 16:07:52 GMT X-Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2ywabrank5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Mar 2020 16:07:52 +0000 X-Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02PG7hMQ182585; Wed, 25 Mar 2020 16:07:52 GMT X-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 3003gj0s36-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Mar 2020 16:07:52 +0000 X-Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 02PG7pws031693; Wed, 25 Mar 2020 16:07:51 GMT X-Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 25 Mar 2020 09:07:51 -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 v2 07/17] OvmfPkg/PvScsiDxe: Translate Target & LUN to/from DevicePath Date: Wed, 25 Mar 2020 18:09:55 +0200 Message-Id: <20200325161005.16743-8-liran.alon@oracle.com> In-Reply-To: <20200325161005.16743-1-liran.alon@oracle.com> References: <20200325161005.16743-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: qaWixY1l9FoM4EsfnvbTA5v1x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1585152473; bh=04YezynaaqH1nl1UOE/P1L28rxmOPUhYkLkBXUwljcE=; h=Cc:Date:From:Reply-To:Subject:To; b=Q6PzITeDnmXI6H+jQy1D3n7yFmbI5t4gsWpdndh8ssfCIUhO85Tg0gMaNA50+3+xgQ2 LTh5jMqYf3COhPJdiqd8Sii855K8/Hlzx0VEv9EbnjXgi9pB+in3ROTzCxmCmQPoJ8kIo lsL+UjdVBTaFVqYnUosVZ6ipjR918Zp4tdI= 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: Laszlo Ersek Signed-off-by: Liran Alon --- OvmfPkg/PvScsiDxe/PvScsi.c | 61 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/PvScsiDxe/PvScsi.c b/OvmfPkg/PvScsiDxe/PvScsi.c index 7f51ada19a1a..76fc1eb910f2 100644 --- a/OvmfPkg/PvScsiDxe/PvScsi.c +++ b/OvmfPkg/PvScsiDxe/PvScsi.c @@ -137,7 +137,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 @@ -150,7 +181,33 @@ 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; + ZeroMem (*Target + 1, TARGET_MAX_BYTES - 1); + *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 (#56313): https://edk2.groups.io/g/devel/message/56313 Mute This Topic: https://groups.io/mt/72544111/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-