From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=156.151.31.86; helo=userp2130.oracle.com; envelope-from=nikita.leshchenko@oracle.com; receiver=edk2-devel@lists.01.org Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 245CE21C8EFB5 for ; Thu, 31 Jan 2019 02:08:11 -0800 (PST) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0VA5TdX013904 for ; Thu, 31 Jan 2019 10:08:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2018-07-02; bh=hBY5aal9G2ZZkZdD8c/mXUk0bKqiVWcA9ia4W/6X75Y=; b=I9gu2V4I9A4SGMle7BmZLxKe1SHufoPkgYryrEjoVVSADnxPiYF3JTXI7woQaLGRSPW0 2BwP3+XmOXheG9Q2jNJqjFdvAlGQLWRucbWlmfHVxykeqUNSpfzvAWi6j2QoEHZR9WaL xirnDjJtlgjIqX1IIUmGZy2BIcuPp/C7yhaH4S8OdXzzwCEhETUxcdH9bmcJjP8s5OGn SkEs8ltCH0C+frmdh+QqQX+CvE81VRUHPofnBxXvjTeTmv16LGrEUjpj5NnTfew7/7Wz 8iz/6G+t3bNrmqAHEdqOGJ4fVWNWsY0zeGetF1I1eLRiy78YTl7GiIJr0BuIav5D3CAn ZA== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2q8eyuqn65-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 31 Jan 2019 10:08:10 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x0VA89Yw029506 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 31 Jan 2019 10:08:09 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x0VA89Hh012900 for ; Thu, 31 Jan 2019 10:08:09 GMT Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 31 Jan 2019 02:08:09 -0800 From: Nikita Leshenko To: edk2-devel@lists.01.org Cc: liran.alon@oracle.com, Nikita Leshenko Date: Thu, 31 Jan 2019 12:07:16 +0200 Message-Id: <20190131100724.20907-7-nikita.leshchenko@oracle.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190131100724.20907-1-nikita.leshchenko@oracle.com> References: <20190131100724.20907-1-nikita.leshchenko@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9152 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=902 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901310080 Subject: [PATCH 06/14] OvmfPkg/MptScsiDxe: Report one Target and one LUN X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2019 10:08:11 -0000 Content-Transfer-Encoding: 8bit Support for multiple targets will be implemented in a later commit in this series. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Nikita Leshenko Reviewed-by: Konrad Rzeszutek Wilk Reviewed-by: Aaron Young Reviewed-by: Liran Alon --- OvmfPkg/MptScsiDxe/MptScsi.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c index 6b655d9fe8..8ce7986b1d 100644 --- a/OvmfPkg/MptScsiDxe/MptScsi.c +++ b/OvmfPkg/MptScsiDxe/MptScsi.c @@ -68,6 +68,21 @@ MptScsiPassThru ( return EFI_UNSUPPORTED; } +STATIC +BOOLEAN +IsTargetInitialized ( + IN UINT8 *Target + ) +{ + int i; + for (i = 0; i < TARGET_MAX_BYTES; ++i) { + if (Target[i] != 0xFF) { + return TRUE; + } + } + return FALSE; +} + STATIC EFI_STATUS EFIAPI @@ -78,7 +93,15 @@ MptScsiGetNextTargetLun ( ) { DEBUG ((EFI_D_INFO, "MptScsiGetNextTargetLun %d %d\n", **Target, *Lun)); - return EFI_UNSUPPORTED; + + // Currently support only target 0 LUN 0, so hardcode it + if (!IsTargetInitialized (*Target)) { + **Target = 0; + *Lun = 0; + return EFI_SUCCESS; + } else { + return EFI_NOT_FOUND; + } } STATIC @@ -90,7 +113,14 @@ MptScsiGetNextTarget ( ) { DEBUG ((EFI_D_INFO, "MptScsiGetNextTarget\n")); - return EFI_UNSUPPORTED; + + // Currently support only target 0 LUN 0, so hardcode it + if (!IsTargetInitialized (*Target)) { + **Target = 0; + return EFI_SUCCESS; + } else { + return EFI_NOT_FOUND; + } } STATIC -- 2.20.1