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.11153.1582735236826393670 for ; Wed, 26 Feb 2020 08:40:36 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=CMIIgeVD; spf=pass (domain: oracle.com, ip: 141.146.126.78, mailfrom: nikita.leshchenko@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 01QGNlwO060265; Wed, 26 Feb 2020 16:40:36 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-2020-01-29; bh=Oli1lbIbY9VsSoktp/zd6PQrQKcQcO21p7ROM79urFU=; b=CMIIgeVDhK3Hf2kC4U366w1uFLkZ4d5QhF8wPGBs4155r5BcXWQhCv1hMI3wGMU2L7GX /SqCQRlQMK4/ugfzCI7mQPkCa7gyBz/odvX+BwR/nCGEPKwYjXbanvQBSGY6Xr54mKSJ Z5n1uddVuYcdXAHyRtm0e0t0U8JPhp2amPP2ovw2yqGqqk81L317fv+tfkGsjV+r4ogy yuTeEFhsJ03sSroMNLMkxPkqL5z3wxQsZ5BQcBnPfc1ltBslB76v1Og7QNd6TGBX+N+Z NGsfLavL5kBLDMBbT5veM0LRBi45IRpRmpcoMmcxvOlGU5NxKovNP3yohXEZbg+fPfQR fQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 2ydcsrmw8u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Feb 2020 16:40:36 +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 01QGMepX076184; Wed, 26 Feb 2020 16:40:36 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3030.oracle.com with ESMTP id 2ydcsa6puj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Feb 2020 16:40:35 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 01QGeXCm013067; Wed, 26 Feb 2020 16:40:33 GMT Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Feb 2020 08:40:33 -0800 From: "Nikita Leshenko" To: devel@edk2.groups.io Cc: liran.alon@oracle.com, aaron.young@oracle.com, jordan.l.justen@intel.com, lersek@redhat.com, ard.biesheuvel@linaro.org, Nikita Leshenko Subject: [PATCH v2 06/13] OvmfPkg/MptScsiDxe: Report one Target and one LUN Date: Wed, 26 Feb 2020 18:41:44 +0200 Message-Id: <20200226164151.125182-7-nikita.leshchenko@oracle.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200226164151.125182-1-nikita.leshchenko@oracle.com> References: <20200226164151.125182-1-nikita.leshchenko@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9543 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002260112 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9543 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 impostorscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002260112 Content-Transfer-Encoding: 8bit Support for multiple targets will be implemented in a later commit in this series. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390 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 | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c index b8eabfb23c..76f0515b52 100644 --- a/OvmfPkg/MptScsiDxe/MptScsi.c +++ b/OvmfPkg/MptScsiDxe/MptScsi.c @@ -63,6 +63,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 @@ -72,7 +87,16 @@ MptScsiGetNextTargetLun ( IN OUT UINT64 *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 @@ -83,7 +107,15 @@ MptScsiGetNextTarget ( IN OUT UINT8 **Target ) { - 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