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.web12.16743.1583349734532236842 for ; Wed, 04 Mar 2020 11:22:14 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=JFUkbbIw; 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 024Iw72F028174; Wed, 4 Mar 2020 19:22:14 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=g5tNrpcCF5HZcl4xnGQhSNm4dxpVy+Oj4AaJx3aCHDs=; b=JFUkbbIwp/V47K5VlRDiBZliS3WErQSDX7xY1e4FrWngyG3austkV0ypXSfOKIJNeZlr yJMbfZQAjJY9K0xlimWCd9UJfgoZoWug5fam9h2HoeLSi5tQ38RKx+QYmEd9a7incZe7 24C55B1iOfxiQ+FPgbud0E1GfWboiBdM4wg3T29xjdk8FPDL6JlU5GdLmnBgZuS5WCSL FElTemDGGvsnikZWOMMNxrE+YWE+buqMer4Oqgf63dBPuj4+oWb3NVMLY7eTKgJdW9SO t0+S0KX7o+jQthBR6+qwudHbTqjG9kQgeGrGPnzCv4/chM4l5nDb888NPBRuQkGfzRnF lA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 2yffwr0e39-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Mar 2020 19:22:13 +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 024JDB9e148935; Wed, 4 Mar 2020 19:22:13 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 2yg1h1h4sp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 04 Mar 2020 19:22:13 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 024JMCko014401; Wed, 4 Mar 2020 19:22:12 GMT Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 04 Mar 2020 11:22:11 -0800 From: "Nikita Leshenko" To: devel@edk2.groups.io Cc: Nikita Leshenko , liran.alon@oracle.com, aaron.young@oracle.com, jordan.l.justen@intel.com, lersek@redhat.com, ard.biesheuvel@linaro.org Subject: [PATCH v3 06/13] OvmfPkg/MptScsiDxe: Report one Target and one LUN Date: Wed, 4 Mar 2020 21:22:50 +0200 Message-Id: <20200304192257.96736-7-nikita.leshchenko@oracle.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200304192257.96736-1-nikita.leshchenko@oracle.com> References: <20200304192257.96736-1-nikita.leshchenko@oracle.com> MIME-Version: 1.0 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-2003040126 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-2003040126 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 Signed-off-by: Nikita Leshenko Reviewed-by: Laszlo Ersek --- OvmfPkg/MptScsiDxe/MptScsi.c | 38 +++++++++++++++++++++++++++++-- OvmfPkg/MptScsiDxe/MptScsiDxe.inf | 1 + 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c index 9598b82fda53..e898a6024f73 100644 --- a/OvmfPkg/MptScsiDxe/MptScsi.c +++ b/OvmfPkg/MptScsiDxe/MptScsi.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -62,6 +63,22 @@ MptScsiPassThru ( return EFI_UNSUPPORTED; } +STATIC +BOOLEAN +IsTargetInitialized ( + IN UINT8 *Target + ) +{ + UINTN Idx; + + for (Idx = 0; Idx < TARGET_MAX_BYTES; ++Idx) { + if (Target[Idx] != 0xFF) { + return TRUE; + } + } + return FALSE; +} + STATIC EFI_STATUS EFIAPI @@ -71,7 +88,16 @@ MptScsiGetNextTargetLun ( IN OUT UINT64 *Lun ) { - return EFI_UNSUPPORTED; + // + // Currently support only target 0 LUN 0, so hardcode it + // + if (!IsTargetInitialized (*Target)) { + ZeroMem (*Target, TARGET_MAX_BYTES); + *Lun = 0; + return EFI_SUCCESS; + } else { + return EFI_NOT_FOUND; + } } STATIC @@ -82,7 +108,15 @@ MptScsiGetNextTarget ( IN OUT UINT8 **Target ) { - return EFI_UNSUPPORTED; + // + // Currently support only target 0 LUN 0, so hardcode it + // + if (!IsTargetInitialized (*Target)) { + ZeroMem (*Target, TARGET_MAX_BYTES); + return EFI_SUCCESS; + } else { + return EFI_NOT_FOUND; + } } STATIC diff --git a/OvmfPkg/MptScsiDxe/MptScsiDxe.inf b/OvmfPkg/MptScsiDxe/MptScsiDxe.inf index a253c5d96916..8f366b92eb72 100644 --- a/OvmfPkg/MptScsiDxe/MptScsiDxe.inf +++ b/OvmfPkg/MptScsiDxe/MptScsiDxe.inf @@ -30,6 +30,7 @@ [Packages] OvmfPkg/OvmfPkg.dec [LibraryClasses] + BaseMemoryLib DebugLib MemoryAllocationLib UefiBootServicesTableLib -- 2.20.1