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.web10.724.1586885746427539481 for ; Tue, 14 Apr 2020 10:35:46 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=Lvs/Zo5J; spf=pass (domain: oracle.com, ip: 156.151.31.85, mailfrom: nikita.leshchenko@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 03EH9alw154803; Tue, 14 Apr 2020 17:35:43 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=D8RxDCiLQ3pwQ+nhxjIqMww/25u92Tiq6pVmzFIFJu4=; b=Lvs/Zo5J5mIpn/ij8aQRWN8DFxPASrOXRjICJnmD4rSKU4RZbuedDEtQCunUJR19qQIS lXnLNP2Zv45Nu9A+iSr7a8Ra5sZ0I7u4/ziRo1z6jDbFybmQCwruFI26yc/S5KSMPuev 8sSMn/e2RMOGQpNyNRLV+co1vpNLJ0CB+sHPHOaWHp1EdMx5KxUQeLA3Jqu3/MKbzSyf EAXRShY5DQ/yMb+bAwSMr47HvrZjZEUn9YSIpdDv8uuI6iWxynyDejnLcy+mKBzOYXrp aK83ZmBn+sSYcB4NMRpvWHI2SSaadBtSNfX6AshmuHj/le1csKNTAdgrKzhnNXfTEoZZ rA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 30b6hpp870-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Apr 2020 17:35:43 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03EH7skg012159; Tue, 14 Apr 2020 17:35:43 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 30bqcjamus-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Apr 2020 17:35:42 +0000 Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 03EHZfEZ026757; Tue, 14 Apr 2020 17:35:41 GMT Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 14 Apr 2020 10:35:41 -0700 From: "Nikita Leshenko" To: devel@edk2.groups.io Cc: Nikita Leshenko , liran.alon@oracle.com, aaron.young@oracle.com, Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [PATCH v4 06/13] OvmfPkg/MptScsiDxe: Report one Target and one LUN Date: Tue, 14 Apr 2020 20:38:06 +0300 Message-Id: <20200414173813.7715-7-nikita.leshchenko@oracle.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200414173813.7715-1-nikita.leshchenko@oracle.com> References: <20200414173813.7715-1-nikita.leshchenko@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9591 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 phishscore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004140131 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9591 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxlogscore=999 clxscore=1015 mlxscore=0 phishscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004140131 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 | 40 +++++++++++++++++++++++++++++-- OvmfPkg/MptScsiDxe/MptScsiDxe.inf | 1 + 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c index 40d392c2346f..30fb084379db 100644 --- a/OvmfPkg/MptScsiDxe/MptScsi.c +++ b/OvmfPkg/MptScsiDxe/MptScsi.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -57,6 +58,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 @@ -66,7 +83,17 @@ 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; + } else { + return EFI_NOT_FOUND; + } + + return EFI_SUCCESS; } STATIC @@ -77,7 +104,16 @@ 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); + } else { + return EFI_NOT_FOUND; + } + + return EFI_SUCCESS; } STATIC diff --git a/OvmfPkg/MptScsiDxe/MptScsiDxe.inf b/OvmfPkg/MptScsiDxe/MptScsiDxe.inf index 5bdbc63f3ac6..809f12173bb8 100644 --- a/OvmfPkg/MptScsiDxe/MptScsiDxe.inf +++ b/OvmfPkg/MptScsiDxe/MptScsiDxe.inf @@ -24,6 +24,7 @@ [Packages] OvmfPkg/OvmfPkg.dec [LibraryClasses] + BaseMemoryLib DebugLib MemoryAllocationLib UefiBootServicesTableLib -- 2.20.1