From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web09.11538.1582879286615618129 for ; Fri, 28 Feb 2020 00:41:26 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Jh58QzfM; spf=pass (domain: redhat.com, ip: 205.139.110.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582879285; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6aJCj3v0A2Z7Qpk0kQSKDDL89isnou2i+lZH09x+gFk=; b=Jh58QzfMI7IyqeNlBaMT8Yr5lT6Y1QIVq0BWx6loecHCLK68pdzTGf2F6J5l6LvOkryBIV 6rJbYKOVw0rwGgfgu2AQrScoULiyStQLybeZVK8wpppWfLvL2agxjQyRvsJycp7AnoxeYE OwlaS7dRlxdaTjcbtOFYMj9ZoyxiT/E= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-386-VLMaZQLDPYSjiqkJVlqMfw-1; Fri, 28 Feb 2020 03:41:22 -0500 X-MC-Unique: VLMaZQLDPYSjiqkJVlqMfw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AAB7C800D53; Fri, 28 Feb 2020 08:41:20 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-243.ams2.redhat.com [10.36.116.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C2039299B; Fri, 28 Feb 2020 08:41:18 +0000 (UTC) Subject: Re: [PATCH v2 06/13] OvmfPkg/MptScsiDxe: Report one Target and one LUN To: Nikita Leshenko , devel@edk2.groups.io Cc: liran.alon@oracle.com, aaron.young@oracle.com, jordan.l.justen@intel.com, ard.biesheuvel@linaro.org References: <20200226164151.125182-1-nikita.leshchenko@oracle.com> <20200226164151.125182-7-nikita.leshchenko@oracle.com> From: "Laszlo Ersek" Message-ID: <7998a2aa-d3cf-7409-a439-e898aa695c90@redhat.com> Date: Fri, 28 Feb 2020 09:41:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200226164151.125182-7-nikita.leshchenko@oracle.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 02/26/20 17:41, Nikita Leshenko wrote: > 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; (1) Please replace this variable with: UINTN Idx; and add an empty line after it. With this fixed: Reviewed-by: Laszlo Ersek Thanks, Laszlo > + 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 >