From nobody Fri Dec 27 01:46:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1504125928194485.5193977430149; Wed, 30 Aug 2017 13:45:28 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 88CAC21E70D44; Wed, 30 Aug 2017 13:45:19 -0700 (PDT) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0079.outbound.protection.outlook.com [104.47.36.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D3B202095BB85 for ; Wed, 30 Aug 2017 13:45:16 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by DM2PR12MB0154.namprd12.prod.outlook.com (2a01:111:e400:50ce::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Wed, 30 Aug 2017 20:45:18 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=D3lSF6GNRRFKQWqVdWxmX7YhoTnwRoS2/OoFPj01VC8=; b=L81g/IFfHIYbcTL86S+I9HVbIJNTp2jhPEf+H671mke1og2TkJBMTqXexfkxMlStkWMmu1gqAT3gZVTCRZIHJen8ftnEvEcrobBXpPv7mklPRXb80PfU9qvKAoBhdVBklzT0c3BWf8MjozZ0a660q+su2bIDTsUv2mljYYQGZ1g= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Wed, 30 Aug 2017 16:45:01 -0400 Message-Id: <1504125903-29816-3-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504125903-29816-1-git-send-email-brijesh.singh@amd.com> References: <1504125903-29816-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR2201CA0040.namprd22.prod.outlook.com (2603:10b6:301:16::14) To DM2PR12MB0154.namprd12.prod.outlook.com (2a01:111:e400:50ce::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 56a3733a-43d9-4feb-1621-08d4efe806ca X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM2PR12MB0154; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0154; 3:K3klfkeYeLHMj9B2s+pNpWantNe1h6VxIWeugbhpf5N3LHUx50bI2nZwE7eOyCxBkjnnsCIOrJ3eYxgjOnL7wi+fpccrJTCUq9G+LMiH7j+mkYqfmYgfQ6usmCxIHYqOAqmKCvuoDDn6kg6aJQGtohWRrCtchc9L5l2MYs3fSV9s5Q+dRcpZwOjY3XB1Z5HUVSlVnhmFpnMH+uf7V+MfqijoyfzWZzugBcbGD8KLQ6V6bnQeguWeP1+ca0Gjhf4q; 25:O7l3C6Exb3+qBjGzPmFbnrEO/V+j12J90xgBl8TK1oa8gqqJ9ntd77AwghoFojjflnWHTLdOxtJX6UBpub+I1fhjGOirUcSIoUQvwh5K+euzBxR+TikqFKRKwPxQJdKuW0nWf7/Nc4YTsc2S4Sebi1meAky66Gl2UKSrTvwc8AbJhQJJapurBfh8WYRx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jLjhfWs+69KrctupDymbZ0ft2/2X8YVwQnAl4AqqzoT2yZ6ETvG1SsdMhRMab1yBVOxxLCRpyjH3IJOPsTgoWSh/LmhVQaCMZiDhozVyb5YgdumfbIKn2lYyaeQ5aX82ryjN0XFzQtGjMVsFh+PPpjkz19WZ19c36HiCZdxZE7qDhmSqRnQV7GqkRyJwp66uE/E7I32U7epOV+VA1tHJI6tCH0wTNe9CGtyCt+2Pl+wJVcMZS4yInO0rZk0jJlReQ== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(100000703101)(100105400095)(6055026)(6041248)(20161123564025)(20161123560025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM2PR12MB0154; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM2PR12MB0154; X-Forefront-PRVS: 041517DFAB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(6009001)(199003)(189002)(50466002)(86362001)(53936002)(3846002)(6916009)(54906002)(2950100002)(6116002)(478600001)(7736002)(33646002)(68736007)(189998001)(2906002)(48376002)(66066001)(47776003)(4326008)(8676002)(81166006)(97736004)(2351001)(50986999)(25786009)(2361001)(8936002)(101416001)(106356001)(5003940100001)(50226002)(105586002)(6666003)(110136004)(81156014)(36756003)(305945005)(53416004)(6486002)(42186005)(5660300001)(76176999)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0154; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR12MB0154; 23:ExqwFax7RcudmfkPNKbjgkmAuKpZB+bYonS/WxSLK?= =?us-ascii?Q?LgyTZ8UOqXlf4EnT7jOKLJNR2vKcewsNJTF+SIlRRNWuSU+sA7SE2HXa0yYP?= =?us-ascii?Q?NJsF+dHVKBomKqUPi+6PQaQNyVGoiILBHSGjsA6zrO0+njsdGiY+8DNuNSAu?= =?us-ascii?Q?h9fY+iXQhlmOz5kuVo+3OwVvc07l60suY2J348Nk9EhGj/fM8bV0cb9mGYDC?= =?us-ascii?Q?3LRkT3C/k5W9MfExpSt2xK0EXPMcutX2e35xy8Xgoe4I1f+i5RKMeS5fft62?= =?us-ascii?Q?zsFrJHZS3iKpAEY08YMbRptWjcU2tLAcOxoaOb9O5Q0E8x+NBUpmwrg8oDVT?= =?us-ascii?Q?5cMa+9Z+i9uF7XemQ7wN0i3NnzvP6qGNIhIPozhqtedBWskcuPNd1oTpHHSZ?= =?us-ascii?Q?WcTkbf6UQjr2b8fGix5Qi59H7b/iux9UVezIuHCMc0oHtiTFD2lCc9KzLyJ6?= =?us-ascii?Q?XnJOm6KeY/f/g6PEqB6dlu5cdGDUm8QPk6DcAET4yFNdXZmK0V1JYNEeJodD?= =?us-ascii?Q?deqTUuJZnurzSkGQGQS96tEIdDx/HnXN4raneOWFBsbqIs5Gs03DHniwkW4G?= =?us-ascii?Q?mcLHXYmnvIOnrwT/ms9qHOt5vS+oxuHCqfrLXSrhydew4R0Sv836b2Q4ZOJ6?= =?us-ascii?Q?FXhgyC+pb6VsGwzlb/WnwkCPVjQf3FLReVsFSIPbdHf+dZYv36kMOA/mULY2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iI2bFIAMP62SlLqBZkhM1LPrQ5zxK0gnFLnkpXbwxYKbbzYtALf2clw/N1xz5xVSmRw==; 24:avv8DZ2z7iMnoURtEkWI7RxJRLk8P3JxO+cEyOmw/C24ashN9usbdrP3jzrX3LgfDa5Y+XNBsH5QlpYHBl63AwRL9I9FlYMUYa9k+QgB3v8=; 7:Tpbe3ycC4J2qh8UyoFZAZkWW5d8L3D5P8II2L4FYkT7YY3pM0t8kQHI149NLayDWmUru8IpEuexs7h/UOCZWqlwTCV9hiauYnZXh73URWcKNwQIvvM3J8c0wLEkj2op8NCb6HGzx/6+/pyYi2Sw2Ov9fcNFddF58y0YX38jgQEnelk9aYMqDKL44Ww2ZYt/tQ+pDiknYZMdhMPvR4doKaJRF6khtfhL26P/ouGxbajM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0154; 20:5ft2dpIq2vKkJULGt5xgDEV+/5X34eZ0lhk6BJOVXrFxGvckSe6S92RFUMyY1y9OlGEu6eAd63vXXGyKV9PQx4M85PCZ6QxiO4fzqiJrtqu+DoUH78Bwyahaoo7M0ZPK8LN3YHKdgOJMLwpt5zNriQ0xniauc+n3iJOIvuZAW1+wkis1BWs+L2ZOMAcRAI+r5mnV5Y8O2grPz81MkBYQ9RnqMmWQJJeKxgDapccoYKIq+gMrLDz1Db2dusRf1ylr X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2017 20:45:18.4253 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0154 Subject: [edk2] [PATCH v2 2/4] OvmfPkg/VirtioScsiDxe: add helper to create a fake host adapter error X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When virtio request fails we return EFI_DEVICE_ERROR, as per the spec EFI_EXT_SCSI_PASS_THRU_PROTOCOL.PassThru() member function is required to implement elaborated error reporting. The patch refactors out entire block of the code that creates the host adapter error into a separate helper function (ReportHostAdapterError). Suggested-by: Laszlo Ersek Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Brijesh Singh Reviewed-by: Laszlo Ersek --- OvmfPkg/VirtioScsiDxe/VirtioScsi.c | 27 +++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/Vir= tioScsi.c index 5e72b1a24b59..cac213129409 100644 --- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c +++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c @@ -387,6 +387,26 @@ ParseResponse ( return EFI_DEVICE_ERROR; } =20 +/** + * The function can be used to create a fake host adapter error. + * When VirtioScsiPassThru is failed due to some reasons then this function + * can be called to contstruct a host adapter error. + * + */ +STATIC +EFI_STATUS +ReportHostAdapterError ( + OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet + ) +{ + Packet->InTransferLength =3D 0; + Packet->OutTransferLength =3D 0; + Packet->HostAdapterStatus =3D EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER; + Packet->TargetStatus =3D EFI_EXT_SCSI_STATUS_TARGET_GOOD; + Packet->SenseDataLength =3D 0; + return EFI_DEVICE_ERROR; +} + =20 // // The next seven functions implement EFI_EXT_SCSI_PASS_THRU_PROTOCOL @@ -472,12 +492,7 @@ VirtioScsiPassThru ( // if (VirtioFlush (Dev->VirtIo, VIRTIO_SCSI_REQUEST_QUEUE, &Dev->Ring, &Indices, NULL) !=3D EFI_SUCCESS) { - Packet->InTransferLength =3D 0; - Packet->OutTransferLength =3D 0; - Packet->HostAdapterStatus =3D EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER; - Packet->TargetStatus =3D EFI_EXT_SCSI_STATUS_TARGET_GOOD; - Packet->SenseDataLength =3D 0; - return EFI_DEVICE_ERROR; + return ReportHostAdapterError (Packet); } =20 return ParseResponse (Packet, &Response); --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel