From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by mx.groups.io with SMTP id smtpd.web10.820.1583365872347372549 for ; Wed, 04 Mar 2020 15:51:12 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=vRtSEqXJ; spf=pass (domain: oracle.com, ip: 141.146.126.78, mailfrom: liran.alon@oracle.com) Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 024Nm5ji158087; Wed, 4 Mar 2020 23:51:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=VgBJ1WC40duVq/0qMnofF1EaBUV3YpGkz/m15ZeyuT8=; b=vRtSEqXJJXDFr1/a5P0fAs37K45E9AQyycpZQCpt2styzbWACuhVRry/DGFKxT7trpAR 3bp3Z30vqfF4gND0i3/JJRpd/FgSDveAyh64gPSwMTSnJW3/1OrixfIQjt3HcX2wRjl1 9bONQgjUbYqDRgBCHOGXL7gDqqW+txsYV59KqfopQIZHtcfU0KJLGaw4klbQoJSDM5HP BDEJALoOu/tTAUYwpyjWF/oFmAR7rFuDdK12yGEti21AVBtPdwb+ejBwFLgnvSdCMwy4 J3sd23wTNjemwxkKB0x89zuCiXhSITTfXa0bn1rBLQfjpv/M+7esgE5cLpsZ8p4A+jgK Cw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 2yffwr1mdm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Mar 2020 23:51:11 +0000 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 024Nkr6G115752; Wed, 4 Mar 2020 23:51:11 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 2yg1rss9qy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Mar 2020 23:51:11 +0000 Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 024Np9FL002897; Wed, 4 Mar 2020 23:51:09 GMT Received: from [192.168.14.112] (/79.177.218.220) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 04 Mar 2020 15:51:09 -0800 Subject: Re: [PATCH v3 08/13] OvmfPkg/MptScsiDxe: Implement GetTargetLun To: Nikita Leshenko , devel@edk2.groups.io Cc: aaron.young@oracle.com, jordan.l.justen@intel.com, lersek@redhat.com, ard.biesheuvel@linaro.org References: <20200304192257.96736-1-nikita.leshchenko@oracle.com> <20200304192257.96736-9-nikita.leshchenko@oracle.com> From: Liran Alon Message-ID: <7fbb8a2b-98da-292d-2a38-49290a323eca@oracle.com> Date: Thu, 5 Mar 2020 01:51:05 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200304192257.96736-9-nikita.leshchenko@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9550 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 adultscore=0 spamscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2003040151 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9550 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 spamscore=0 impostorscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 phishscore=0 clxscore=1015 bulkscore=0 adultscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2003040151 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US On 04/03/2020 21:22, Nikita Leshenko wrote: > Currently we accept only Pun=0 and Lun=0, but we will relax this in a > later patch. > > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390 > Signed-off-by: Nikita Leshenko > --- > OvmfPkg/MptScsiDxe/MptScsi.c | 28 +++++++++++++++++++++++++++- > 1 file changed, 27 insertions(+), 1 deletion(-) > > diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c > index cba564b5f648..a77599dd4b27 100644 > --- a/OvmfPkg/MptScsiDxe/MptScsi.c > +++ b/OvmfPkg/MptScsiDxe/MptScsi.c > @@ -169,7 +169,33 @@ MptScsiGetTargetLun ( > OUT UINT64 *Lun > ) > { > - return EFI_UNSUPPORTED; > + SCSI_DEVICE_PATH *ScsiDevicePath; > + > + if (DevicePath == NULL || > + Target == NULL || *Target == NULL || Lun == NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + if (DevicePath->Type != MESSAGING_DEVICE_PATH || > + DevicePath->SubType != MSG_SCSI_DP) { > + return EFI_UNSUPPORTED; > + } > + > + ScsiDevicePath = (SCSI_DEVICE_PATH *)DevicePath; > + if (ScsiDevicePath->Pun > 0 || > + ScsiDevicePath->Lun > 0) { > + return EFI_NOT_FOUND; > + } > + > + ZeroMem (*Target, TARGET_MAX_BYTES); Why do you need to ZeroMem() if you only use the first byte of Target? Seems redundant. In addition, I suggest squashing this patch with the previous one as GetTargetLun() and BuildDevicePath() kinda complement each other. Reviewed-by: Liran Alon > + // > + // This device support 256 targets only, so it's enough to set the LSB > + // of Target. > + // > + **Target = (UINT8)ScsiDevicePath->Pun; > + *Lun = ScsiDevicePath->Lun; > + > + return EFI_SUCCESS; > } > > STATIC