public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael Kubacki" <michael.kubacki@outlook.com>
To: devel@edk2.groups.io
Cc: Liming Gao <gaoliming@byosoft.com.cn>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Guomin Jiang <guomin.jiang@intel.com>,
	Wei6 Xu <wei6.xu@intel.com>
Subject: [PATCH v5 2/6] FmpDevicePkg: Add Last Attempt Status header files
Date: Thu, 15 Oct 2020 14:11:17 -0700	[thread overview]
Message-ID: <MWHPR07MB344054BB25C26751BB5DD37AE9020@MWHPR07MB3440.namprd07.prod.outlook.com> (raw)
In-Reply-To: <20201015211121.1927-1-michael.kubacki@outlook.com>

From: Michael Kubacki <michael.kubacki@microsoft.com>

Introduces a public and a private header file to define more
granular usage of the UEFI Specification defined unsuccessful
vendor range for Last Attempt Status codes. The unsuccessful
vendor range is described in UEFI Specification 2.8A section 23.4.

The public header file Include/LastAttemptStatus.h defines ranges
within the unsuccessful vendor range. At a high-level, the two
main ranges are defined are the FMP Reserved range and the Device
Library Reserved range.

The FMP Reserved range is reserved for usage of components within
FmpDevicePkg. PrivateInclude/FmpLastAttemptStatus.h contains
usage details and specific Last Attempt Status code definitions.

The Device Library Reserved range is reserved for usage by
FmpDeviceLib instances. Each library may define custom Last
Attempt Status codes within the bounds defined in
Include/LastAttemptStatus.h:
[LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE,
 LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE]

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
---
 FmpDevicePkg/Include/LastAttemptStatus.h           | 81 ++++++++++++++++++++
 FmpDevicePkg/PrivateInclude/FmpLastAttemptStatus.h | 81 ++++++++++++++++++++
 2 files changed, 162 insertions(+)

diff --git a/FmpDevicePkg/Include/LastAttemptStatus.h b/FmpDevicePkg/Include/LastAttemptStatus.h
new file mode 100644
index 000000000000..0dcd1ef71621
--- /dev/null
+++ b/FmpDevicePkg/Include/LastAttemptStatus.h
@@ -0,0 +1,81 @@
+/** @file
+  Defines last attempt status code ranges within the UEFI Specification
+  defined unsuccessful vendor range.
+
+  Copyright (c) Microsoft Corporation.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __LAST_ATTEMPT_STATUS_H__
+#define __LAST_ATTEMPT_STATUS_H__
+
+///
+/// Last Attempt Status Unsuccessful Vendor Range Map
+///
+/// Update this map any time new ranges are added. Pre-existing range definitions cannot be modified
+/// to keep status code definitions consistent over time.
+///
+/// START     | END       | Usage
+/// ------------------------------------------------------------------|
+/// 0x1000    | 0x17FF    | FmpDevicePkg                              |
+///    0x1000 |    0x107F | FmpDxe driver                             |
+///    0x1080 |    0x109F | FmpDependencyLib                          |
+///    0x10A0 |    0x10BF | FmpDependencyCheckLib                     |
+///    0x10C0 |    0x17FF | Unused. Available for future expansion.   |
+/// 0x1800    | 0x1FFF    | FmpDeviceLib instances implementation     |
+/// 0x2000    | 0x3FFF    | Unused. Available for future expansion.   |
+///
+
+///
+/// The minimum value of the FMP reserved range.
+///
+#define LAST_ATTEMPT_STATUS_FMP_RESERVED_MIN_ERROR_CODE_VALUE               0x1000
+
+///
+/// The maximum value of the FMP reserved range.
+///
+#define LAST_ATTEMPT_STATUS_FMP_RESERVED_MAX_ERROR_CODE_VALUE               0x1FFF
+
+///
+/// The minimum value allowed for FmpDxe driver-specific errors.
+///
+#define LAST_ATTEMPT_STATUS_DRIVER_MIN_ERROR_CODE_VALUE                     0x1000
+
+///
+/// The maximum value allowed for FmpDxe driver-specific errors.
+///
+#define LAST_ATTEMPT_STATUS_DRIVER_MAX_ERROR_CODE_VALUE                     0x107F
+
+///
+/// The minimum value allowed for FmpDependencyLib related errors.
+///
+#define LAST_ATTEMPT_STATUS_FMP_DEPENDENCY_LIB_MIN_ERROR_CODE_VALUE         0x1080
+
+///
+/// The maximum value allowed for FmpDependencyLib related errors.
+///
+#define LAST_ATTEMPT_STATUS_FMP_DEPENDENCY_LIB_MAX_ERROR_CODE_VALUE         0x109F
+
+///
+/// The minimum value allowed for FmpDependencyCheckLib related errors.
+///
+#define LAST_ATTEMPT_STATUS_FMP_DEPENDENCY_CHECK_LIB_MIN_ERROR_CODE_VALUE   0x10A0
+
+///
+/// The maximum value allowed for FmpDependencyCheckLib related errors.
+///
+#define LAST_ATTEMPT_STATUS_FMP_DEPENDENCY_CHECK_LIB_MAX_ERROR_CODE_VALUE   0x10BF
+
+///
+/// The minimum value allowed for FMP device library errors.
+///
+#define LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE             0x1800
+
+///
+/// The maximum value allowed for FMP device library errors.
+///
+#define LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE             0x1FFF
+
+#endif
diff --git a/FmpDevicePkg/PrivateInclude/FmpLastAttemptStatus.h b/FmpDevicePkg/PrivateInclude/FmpLastAttemptStatus.h
new file mode 100644
index 000000000000..a0cc94f69955
--- /dev/null
+++ b/FmpDevicePkg/PrivateInclude/FmpLastAttemptStatus.h
@@ -0,0 +1,81 @@
+/** @file
+  Defines private last attempt status codes used in FmpDevicePkg.
+
+  Copyright (c) Microsoft Corporation.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __FMP_LAST_ATTEMPT_STATUS_H__
+#define __FMP_LAST_ATTEMPT_STATUS_H__
+
+///
+/// Last attempt status codes defined for additional granularity in FmpDevicePkg components.
+///
+/// These codes are defined within the last attempt status FMP reserved range which extends from
+/// LAST_ATTEMPT_STATUS_FMP_RESERVED_MIN_ERROR_CODE_VALUE to LAST_ATTEMPT_STATUS_FMP_RESERVED_MAX_ERROR_CODE_VALUE.
+///
+/// The following last attempt status code ranges are currently defined for the corresponding component:
+///   * LAST_ATTEMPT_STATUS_DRIVER - FMP driver
+///   * LAST_ATTEMPT_STATUS_DEPENDENCY - FMP dependency functionality
+///
+/// Future last attempt status code additions in FmpDevicePkg should be added as follows:
+///   * FmpDxe driver: Onto the end of the LAST_ATTEMPT_STATUS_DRIVER_ERROR range
+///   * FMP dependency functionality: Onto the end of the LAST_ATTEMPT_STATUS_DEPENDENCY_ERROR range
+///   * Other components: Add a new range onto the end of the last existing range in the enum within the limits of
+///     [LAST_ATTEMPT_STATUS_FMP_RESERVED_MIN_ERROR_CODE_VALUE,LAST_ATTEMPT_STATUS_FMP_RESERVED_MAX_ERROR_CODE_VALUE]
+///
+/// The value of pre-existing last attempt status codes should never be modified to ensure the values remain
+/// consistent over time.
+///
+enum LAST_ATTEMPT_STATUS_EXPANDED_ERROR_LIST
+{
+  ///
+  /// Last attempt status codes used in FmpDxe
+  ///
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_GET_FMP_HEADER                 = LAST_ATTEMPT_STATUS_DRIVER_MIN_ERROR_CODE_VALUE,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_PROGRESS_CALLBACK_ERROR        ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_CHECK_POWER_API                ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_CHECK_SYS_THERMAL_API          ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_THERMAL                        ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_CHECK_SYS_ENV_API              ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_SYSTEM_ENV                     ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_GET_FMP_HEADER_SIZE            ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_GET_ALL_HEADER_SIZE            ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_GET_FMP_HEADER_VERSION         ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_IMAGE_NOT_PROVIDED             ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_IMAGE_NOT_UPDATABLE            ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_INVALID_CERTIFICATE            ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_INVALID_IMAGE_INDEX            ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_INVALID_KEY_LENGTH             ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_INVALID_KEY_LENGTH_VALUE       ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_VERSION_TOO_LOW                ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_DEVICE_LOCKED                  ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_IMAGE_AUTH_FAILURE             ,
+  LAST_ATTEMPT_STATUS_DRIVER_ERROR_PROTOCOL_ARG_MISSING           ,
+
+  ///
+  /// Last attempt status codes used in FmpDependencyLib
+  ///
+  LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_GET_DEPEX_FAILURE          = LAST_ATTEMPT_STATUS_FMP_DEPENDENCY_LIB_MIN_ERROR_CODE_VALUE,
+  LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_NO_END_OPCODE              ,
+  LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_UNKNOWN_OPCODE             ,
+  LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_GUID_BEYOND_DEPEX          ,
+  LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_VERSION_BEYOND_DEPEX       ,
+  LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_VERSION_STR_BEYOND_DEPEX   ,
+  LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_FMP_NOT_FOUND              ,
+  LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_PUSH_FAILURE               ,
+  LAST_ATTEMPT_STATUS_DEPENDENCY_LIB_ERROR_POP_FAILURE                ,
+
+  //
+  // Last attempt status codes used in FmpDependencyCheckLib
+  //
+  LAST_ATTEMPT_STATUS_DEPENDENCY_CHECK_LIB_ERROR_FMP_PROTOCOL_NOT_FOUND             = LAST_ATTEMPT_STATUS_FMP_DEPENDENCY_CHECK_LIB_MIN_ERROR_CODE_VALUE,
+  LAST_ATTEMPT_STATUS_DEPENDENCY_CHECK_LIB_ERROR_MEM_ALLOC_FMP_INFO_BUFFER_FAILED   ,
+  LAST_ATTEMPT_STATUS_DEPENDENCY_CHECK_LIB_ERROR_MEM_ALLOC_DESC_VER_BUFFER_FAILED   ,
+  LAST_ATTEMPT_STATUS_DEPENDENCY_CHECK_LIB_ERROR_MEM_ALLOC_DESC_SIZE_BUFFER_FAILED  ,
+  LAST_ATTEMPT_STATUS_DEPENDENCY_CHECK_LIB_ERROR_MEM_ALLOC_FMP_VER_BUFFER_FAILED
+};
+
+#endif
-- 
2.28.0.windows.1


  parent reply	other threads:[~2020-10-15 21:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20201015211121.1927-1-michael.kubacki@outlook.com>
2020-10-15 21:11 ` [PATCH v5 1/6] MdePkg/SystemResourceTable.h: Add vendor range values Michael Kubacki
2020-10-15 21:11 ` Michael Kubacki [this message]
2020-10-15 21:11 ` [PATCH v5 3/6] FmpDevicePkg/FmpDxe: Add check image path Last Attempt Status capability Michael Kubacki
2020-10-15 21:11 ` [PATCH v5 4/6] FmpDevicePkg/FmpDxe: Improve set image path Last Attempt Status granularity Michael Kubacki
2020-10-15 21:11 ` [PATCH v5 5/6] FmpDevicePkg: Add Last Attempt Status support to dependency libs Michael Kubacki
2020-10-15 21:11 ` [PATCH v5 6/6] FmpDevicePkg/FmpDeviceLib: Add Last Attempt Status to Check/Set API Michael Kubacki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MWHPR07MB344054BB25C26751BB5DD37AE9020@MWHPR07MB3440.namprd07.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox