From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 129A5208D6141 for ; Sun, 10 Feb 2019 23:57:46 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Feb 2019 23:57:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,358,1544515200"; d="scan'208";a="143214192" Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.8]) by fmsmga004.fm.intel.com with ESMTP; 10 Feb 2019 23:57:44 -0800 From: Hao Wu To: edk2-devel@lists.01.org Cc: Sean Brogan , Bret Barkelew , Jian J Wang , Ray Ni , Hao Wu Date: Mon, 11 Feb 2019 15:57:26 +0800 Message-Id: <20190211075738.16676-3-hao.a.wu@intel.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20190211075738.16676-1-hao.a.wu@intel.com> References: <20190211075738.16676-1-hao.a.wu@intel.com> Subject: [PATCH v1 1/1] MdeModulePkg/NvmExpressDxe: Report StatusCode for device init failure X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Feb 2019 07:57:46 -0000 From: Sean Brogan REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1408 According to the information of the above BZ-1408 and other platform owners, NVM Express devices are becoming more likely to be a critical part during the boot process. This commit will add the calls to 'REPORT_STATUS_CODE' when there is a failure happens during the NVM Express controller/device initialization process. Cc: Sean Brogan Cc: Bret Barkelew Cc: Jian J Wang Cc: Ray Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu --- MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf | 3 ++- MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.h | 3 ++- MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c | 10 +++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf index 38d793645b..4f888c49fb 100644 --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf @@ -4,7 +4,7 @@ # NvmExpressDxe driver is used to manage non-volatile memory subsystem which follows # NVM Express specification. # -# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -59,6 +59,7 @@ UefiBootServicesTableLib UefiLib PrintLib + ReportStatusCodeLib [Protocols] gEfiPciIoProtocolGuid ## TO_START diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.h b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.h index fe7d37c118..dcc848e930 100644 --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.h +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.h @@ -3,7 +3,7 @@ NVM Express specification. (C) Copyright 2016 Hewlett Packard Enterprise Development LP
- Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -45,6 +45,7 @@ #include #include #include +#include typedef struct _NVME_CONTROLLER_PRIVATE_DATA NVME_CONTROLLER_PRIVATE_DATA; typedef struct _NVME_DEVICE_PRIVATE_DATA NVME_DEVICE_PRIVATE_DATA; diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c index 4a070f3f13..90ad22b539 100644 --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressHci.c @@ -2,7 +2,7 @@ NvmExpressDxe driver is used to manage non-volatile memory subsystem which follows NVM Express specification. - Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -379,6 +379,10 @@ NvmeDisableController ( if (Index == 0) { Status = EFI_DEVICE_ERROR; + REPORT_STATUS_CODE ( + (EFI_ERROR_CODE | EFI_ERROR_MAJOR), + (EFI_IO_BUS_SCSI | EFI_IOB_EC_INTERFACE_ERROR) + ); } DEBUG ((EFI_D_INFO, "NVMe controller is disabled with status [%r].\n", Status)); @@ -449,6 +453,10 @@ NvmeEnableController ( if (Index == 0) { Status = EFI_TIMEOUT; + REPORT_STATUS_CODE ( + (EFI_ERROR_CODE | EFI_ERROR_MAJOR), + (EFI_IO_BUS_SCSI | EFI_IOB_EC_INTERFACE_ERROR) + ); } DEBUG ((EFI_D_INFO, "NVMe controller is enabled with status [%r].\n", Status)); -- 2.12.0.windows.1