From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1473482164 for ; Thu, 23 Feb 2017 22:42:57 -0800 (PST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Feb 2017 22:42:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,200,1484035200"; d="scan'208";a="69051494" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga005.fm.intel.com with ESMTP; 23 Feb 2017 22:42:56 -0800 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 23 Feb 2017 22:42:56 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 23 Feb 2017 22:42:56 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.177]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.204]) with mapi id 14.03.0248.002; Fri, 24 Feb 2017 14:42:54 +0800 From: "Tian, Feng" To: Jeremy Linton , "edk2-devel@lists.01.org" CC: "ard.biesheuvel@linaro.org" , "Steve.Capper@arm.com" , "ryan.harkin@linaro.org" , "leif.lindholm@linaro.org" , "linaro-uefi@lists.linaro.org" , "Tian, Feng" Thread-Topic: [edk2] [PATCH v3 2/7] MdePkg IndustryStandard/Scsi.h: Add sense code macro Thread-Index: AQHSjiT4hNuLhYhh6Uq6bRVgY3TYIKF3spKA Date: Fri, 24 Feb 2017 06:42:53 +0000 Message-ID: <7F1BAD85ADEA444D97065A60D2E97EE5699B5197@SHSMSX101.ccr.corp.intel.com> References: <20170223223355.11383-1-jeremy.linton@arm.com> <20170223223355.11383-3-jeremy.linton@arm.com> In-Reply-To: <20170223223355.11383-3-jeremy.linton@arm.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v3 2/7] MdePkg IndustryStandard/Scsi.h: Add sense code macro X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Feb 2017 06:42:57 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Linton, Could you let me know where the +#define EFI_SCSI_REQUEST_SENSE_ERROR (0x7= 0) comes from? According to SCSI SPC5r08 spec, the first byte of sense data is the RESPONS= E CODE field.=20 And 0x70 means a) the result of an error, exception condition, or protocol specific failur= e that is associated with CHECK CONDITION status; or b) additional information that is associated with a status other than CHECK= CONDITION. It's possible that 0x70 means success... so this naming may be not quite ap= propriate. And in your usage, you forcedly convert Packet->SenseData to UINT8 and acce= ss each sense data field by array index. I think it's unnecessary. Packet->= SenseData is EFI_SCSI_SENSE_DATA type, which has defined the meaning of eac= h field. With this structure, you don't need introduce EFI_SCSI_SK_VALUE ma= cro again. + sense =3D (UINT8 *)Packet->SenseData; + if ((Packet->SenseDataLength > 13) && + (sense[0] & EFI_SCSI_REQUEST_SENSE_ERROR)) { + DEBUG ((DEBUG_INFO, "SiI3132ScsiPassRead() Key %X ASC(Q) %02X%02= X\n", + EFI_SCSI_SK_VALUE (sense[2]), sense[12], sense[13])); + } Thanks Feng -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jere= my Linton Sent: Friday, February 24, 2017 6:34 AM To: edk2-devel@lists.01.org Cc: ard.biesheuvel@linaro.org; Steve.Capper@arm.com; ryan.harkin@linaro.org= ; leif.lindholm@linaro.org; linaro-uefi@lists.linaro.org Subject: [edk2] [PATCH v3 2/7] MdePkg IndustryStandard/Scsi.h: Add sense co= de macro Add some definitions to mask the sense key from sense data, and check the v= alidity of the returned sense data. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeremy Linton --- MdePkg/Include/IndustryStandard/Scsi.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MdePkg/Include/IndustryStandard/Scsi.h b/MdePkg/Include/Indust= ryStandard/Scsi.h index 0d81314..802479e 100644 --- a/MdePkg/Include/IndustryStandard/Scsi.h +++ b/MdePkg/Include/IndustryStandard/Scsi.h @@ -369,6 +369,8 @@ typedef struct { // // Sense Key // +#define EFI_SCSI_REQUEST_SENSE_ERROR (0x70) +#define EFI_SCSI_SK_VALUE(byte) (byte&0x0F) #define EFI_SCSI_SK_NO_SENSE (0x0) #define EFI_SCSI_SK_RECOVERY_ERROR (0x1) #define EFI_SCSI_SK_NOT_READY (0x2) -- 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel