From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by mx.groups.io with SMTP id smtpd.web11.749.1583365673926787301 for ; Wed, 04 Mar 2020 15:47:54 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=Ya4iF1Jh; spf=pass (domain: oracle.com, ip: 156.151.31.85, mailfrom: liran.alon@oracle.com) 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 024NdF2o095338; Wed, 4 Mar 2020 23:47:53 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=lMOe6vdNEcPgkaGiWWW34mqZkZ6BwKb29VQSYwO0veE=; b=Ya4iF1JhfMIfXJZwMUkV88CGT0ab4DESmNFOXDab98LHU/vHKqjneTXgztKBUp5ziPQw LrLqd9H9hN+iX1CxQ4Qe25jXOPQdBHDZsDVwoXUQ99hmsZ76DDV/3OLksySrDUZ+zmED P6Y4fFVYi9bf7CA80EOoxquTUIPqlvXLdlS/Iy8PuUhxhtgfpy1SgVJhdEYYgmaxg1NA LUlXYW1YPimxvOSxgkbTCS+r1a8k4Dh36IHp4CnHmnuZ0jThWKQBHxjjmkSrHDnqNaG+ nWGcGtSNC7vJOV3eUQy9tAUT0lCCIxxq+jrPOini9dNncB5hTxt7LEDU65PGeTgLSpDj EA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2yghn3de12-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Mar 2020 23:47:53 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 024Nlq7P120711; Wed, 4 Mar 2020 23:47:52 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2yg1h1ypk0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Mar 2020 23:47:52 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 024Nlp76021637; Wed, 4 Mar 2020 23:47:51 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:47:51 -0800 Subject: Re: [PATCH v3 07/13] OvmfPkg/MptScsiDxe: Build DevicePath for discovered devices 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-8-nikita.leshchenko@oracle.com> From: Liran Alon Message-ID: <218f4c38-aed7-48c3-69fb-2f66220dd9f4@oracle.com> Date: Thu, 5 Mar 2020 01:47:47 +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-8-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 adultscore=0 phishscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 spamscore=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 malwarescore=0 phishscore=0 spamscore=0 impostorscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 lowpriorityscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2003040150 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: > Used to identify the individual disks in the hardware tree > > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390 > Signed-off-by: Nikita Leshenko > --- > OvmfPkg/MptScsiDxe/MptScsi.c | 29 ++++++++++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > > diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c > index e898a6024f73..cba564b5f648 100644 > --- a/OvmfPkg/MptScsiDxe/MptScsi.c > +++ b/OvmfPkg/MptScsiDxe/MptScsi.c > @@ -129,7 +129,34 @@ MptScsiBuildDevicePath ( > IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath > ) > { > - return EFI_UNSUPPORTED; > + SCSI_DEVICE_PATH *ScsiDevicePath; > + > + if (DevicePath == NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + // > + // This device support 256 targets only, so it's enough to dereference > + // the LSB of Target. > + // > + if (*Target > 0 || Lun > 0) { > + return EFI_NOT_FOUND; > + } > + > + ScsiDevicePath = AllocateZeroPool (sizeof (*ScsiDevicePath)); Nit: It should also be sufficient to use AllocatePool() as below overrides all fields of SCSI_DEVICE_PATH. Reviewed-by: Liran Alon > + if (ScsiDevicePath == NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + > + ScsiDevicePath->Header.Type = MESSAGING_DEVICE_PATH; > + ScsiDevicePath->Header.SubType = MSG_SCSI_DP; > + ScsiDevicePath->Header.Length[0] = (UINT8)sizeof (*ScsiDevicePath); > + ScsiDevicePath->Header.Length[1] = (UINT8)(sizeof (*ScsiDevicePath) >> 8); > + ScsiDevicePath->Pun = *Target; > + ScsiDevicePath->Lun = (UINT16)Lun; > + > + *DevicePath = &ScsiDevicePath->Header; > + return EFI_SUCCESS; > } > > STATIC