From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web12.9499.1592189122689128744 for ; Sun, 14 Jun 2020 19:45:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=RRpVrfwE; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: eric.dong@intel.com) IronPort-SDR: DeboSnU2A2fO2F7wqMBB6rQGybqL0XrvjIVIp4dAc5RLbR8z0pX5x2g8NImRi7kcrkyNPKDEmZ C0xRJocVaiBw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2020 19:45:22 -0700 IronPort-SDR: mrtd6IL0JY4Ko+cAGMQRW8bckHezXGgPqtJGLD4Z7EsxO+MFX72VA+An1VyYUYxz3d2lLxBL3V PfO09tRjlDXw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,513,1583222400"; d="scan'208";a="475824264" Received: from orsmsx110.amr.corp.intel.com ([10.22.240.8]) by fmsmga005.fm.intel.com with ESMTP; 14 Jun 2020 19:45:22 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by ORSMSX110.amr.corp.intel.com (10.22.240.8) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 14 Jun 2020 19:45:21 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.175) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 14 Jun 2020 19:45:21 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UNolxSUZQMgGvMBY/0HWckXTCLO41qBHutA0v6kbCI+L0dwGW5o3jylcOSilRsuVokK8SQI60aE3G4zTDuvlb2Y7ugVZkBZd45vDN+D5ab46ORGspFv0N/tonT3KL6jhk0NcjcWsRQffj6Hq2I5kA6dQGc3zKjj2li3G9faXyM4SUCUPdLK/UcTFYQzG/eaSnIMZcyzAuT0oHKF2V+f1I42evJlWZya5JpJygTCiGOoXgSbkxt6aTnX56FkaDISBGtQCb75w/tT+11kiza+UcwLQWiva08v9bJ7R9mEXGWAUNQgqCGXFQClBXYfi+8QmUpQRWi4k76vkwmYQK1gXfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rRdFt5itWZ7iQJdFZ0DfhTAObX+WcwYojEMu8RveS2Q=; b=Kshc6YREylEP5aKoK1bOzCS+F9IZbzb+at/RlVH4lYLuaqE6DKhKSziIO2qYRj2x3X27yWRNgkvXH6M3VosSaa9HSzUkILthbDISa43Wxson2a9h3Rs0V2uXNOqbjY2IAyqiyeZfK8A/oYhTQIOQaylUVuJ0iUpdKLaNGkEWRVszq5nciWLtiAq9dIXuPvfOIkMiT6kSgvP24wHXmoYzV/XMjv4WNwYN7DiQZS8Pxf4j1ndmdaytdLYy8HMgT9qo5E7PULhr1UkLkvGNXIHEwnnED8YqFK1pAC5mj/NjIS6TFtjrMvRTLu/R97nC3zfIqX4UhB3w5Oxiw7qR2AQjrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rRdFt5itWZ7iQJdFZ0DfhTAObX+WcwYojEMu8RveS2Q=; b=RRpVrfwE89P3eV3sLjrD+zRRJRSjam9olAv2E6qrA2wp+J7TN5f5DwsggoHclTMS+0R6HkenwhPOVMYIAC9V5d2YdiQ/Zc7XaLpQ95TU1ly3/3ttP8HPqOiE84hLPZ8vsY4vePXsiW/bAfvsFYyyEd41Z0Rbu51yrbHBkgEbl3g= Received: from DM6PR11MB3274.namprd11.prod.outlook.com (2603:10b6:5:b::26) by DM6PR11MB3227.namprd11.prod.outlook.com (2603:10b6:5:5d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.25; Mon, 15 Jun 2020 02:45:19 +0000 Received: from DM6PR11MB3274.namprd11.prod.outlook.com ([fe80::cc01:6f05:1402:e7d7]) by DM6PR11MB3274.namprd11.prod.outlook.com ([fe80::cc01:6f05:1402:e7d7%6]) with mapi id 15.20.3088.028; Mon, 15 Jun 2020 02:45:19 +0000 From: "Dong, Eric" To: "Tan, Ming" , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [PATCH v3] Features/Intel/PostCodeDebugFeaturePkg: add it. Thread-Topic: [PATCH v3] Features/Intel/PostCodeDebugFeaturePkg: add it. Thread-Index: AQHWQGs/lNyfFPgNhU2hBVhOAx0DeKjY/MMA Date: Mon, 15 Jun 2020 02:45:18 +0000 Message-ID: References: <20200612034032.34163-1-ming.tan@intel.com> In-Reply-To: <20200612034032.34163-1-ming.tan@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.36] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7bb05fdf-ac48-4f5a-6c75-08d810d62449 x-ms-traffictypediagnostic: DM6PR11MB3227: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2512; x-forefront-prvs: 04359FAD81 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0aoqn4quTwxPzxOVmTXj3PCH61wxqKRFCiYK0wplaPDO+vFTeutqocsNS9YkHAm1bsciBfd0Xzk2Y2XSWr9xjzgJD0WHUikNfbXafsy5Czzy/J6xljfGPR/Atqii9OHm/bcNQslC04BnCbVW/aLkGsNbDtlAW6vq4HA/VAwvY73ETWqmoM9Dw5GOZp3KjPJQgapa3b9Goli4CSDGF8FQJb3SX7R5yPTnsiMZ7tjvUXSK7sjuRkaDh2IFNBm30XZB/3VRqqTfjlYBNv+KzeHrJu30wyh/CAKb+8k8tqEim0+KVZksR4ddgEB/dVl4EU50nEJuiwlQYsi9OkOQDAzjvDe5sTGAvaUBzSJEt2lPkDYsR3FgKsjpgWMexOcoYKnWrbB27vpivYMScUuovoPUGvKCc6BMVZiBqme16IY3YanSl3YQyxDd8dHIRgJ2W8DJTcXH5xbX8svicQVYCQCiQA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB3274.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(346002)(376002)(136003)(39860400002)(366004)(396003)(53546011)(8936002)(86362001)(8676002)(6506007)(26005)(55016002)(71200400001)(33656002)(30864003)(186003)(966005)(9686003)(66946007)(478600001)(107886003)(2906002)(5660300002)(83380400001)(66476007)(316002)(76116006)(64756008)(66446008)(7696005)(110136005)(4326008)(66556008)(52536014)(213903007)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: rCt9Mn72ODzApRyX2SkSr9beIyC36yHbcB+vPt520iOliL9LoG8E/2xQ4OHYnNHR+0NK/P6a9Y+Bdc/0vYPrAUCOwtxyPcYgYjOwCvC8+ftZUQAoGvqOt7YjXGtCLTb+d861mZD/T3T8PCBYLu11hbrQkh1OdX9/E5Csf4PTPghRuxGXY7eV3uv+ObzZc7djogulSRo2fUNKLDzUKMMrpGZSDGvvamlZWSwhnaBF2h8zrwztB6uprWdqawULzrYgNRYTcDHHntZAgR44w/lF6MfR88N8YVO44NZLIy0YbAHJdTCT6rFSNlcLA3WQRYO5OAufdhYuOkxQ0nwWT/mI3kuqK8eEvKHaIeXQxqgl7fMLCdhSInSyJ5aGr980+VNdDBYXIN8ufLxRndKYIjWaRJUEO6ytQa2HOBoEdK0gE+NGHIwdAxhZ7zFKT3fimlmFLbU1an7rLuSV2x+FWvJnADY2omEukFv17a0BcQ2zKeu/p6Vz+XDqSZNXSDMvj9Dn MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 7bb05fdf-ac48-4f5a-6c75-08d810d62449 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jun 2020 02:45:18.8693 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Gfveb9qly7kRLw02Jsibr4NZQVS7DReNFyOFloTZqZ5XoiSPZYTLI1+bV45eGvVoCZifBdko2h92hQ68nDmFAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3227 Return-Path: eric.dong@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Eric Dong > -----Original Message----- > From: Tan, Ming > Sent: Friday, June 12, 2020 11:41 AM > To: devel@edk2.groups.io > Cc: Dong, Eric ; Gao, Liming > Subject: [PATCH v3] Features/Intel/PostCodeDebugFeaturePkg: add it. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2478 >=20 > The PostCodeDebugFeaturePkg include some useful post code debug > libraries, such as get post code from status code and show it. >=20 > It provide a library PostCodeStatusCodeHandlerLib used by edk2 > StatusCodeHandler.efi, used to show the post code. > It also provide a library of PostCodeMap lib, it map the status code > to post code. >=20 > Cc: Eric Dong > Cc: Liming Gao > Signed-off-by: Ming Tan > --- > V3: Modify according Eric's comments. > Modify some bugs about dsc file when it is included. > Update Readme.md. > V2: Delete the last empty line in > PostCodeDebugFeaturePkg/Library/PostCodeMapLib/PostCodeMapLib.inf > .../Include/Library/PostCodeMapLib.h | 32 +++ > .../Include/PostCodeDebugFeature.dsc | 200 +++++++++++++ > .../PlatformStatusCodesInternal.h | 270 ++++++++++++++++++ > .../Library/PostCodeMapLib/PostCodeMapLib.c | 207 ++++++++++++++ > .../Library/PostCodeMapLib/PostCodeMapLib.inf | 27 ++ > .../PeiPostCodeStatusCodeHandlerLib.c | 102 +++++++ > .../PeiPostCodeStatusCodeHandlerLib.inf | 49 ++++ > .../RuntimeDxePostCodeStatusCodeHandlerLib.c | 188 ++++++++++++ > ...RuntimeDxePostCodeStatusCodeHandlerLib.inf | 51 ++++ > .../SmmPostCodeStatusCodeHandlerLib.c | 141 +++++++++ > .../SmmPostCodeStatusCodeHandlerLib.inf | 50 ++++ > .../PostCodeDebugFeaturePkg.dec | 32 +++ > .../PostCodeDebugFeaturePkg.dsc | 30 ++ > .../PostCodeDebugFeaturePkg/Readme.md | 117 ++++++++ > 14 files changed, 1496 insertions(+) > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/Library/Post > CodeMapLib.h > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/PostCodeDe > bugFeature.dsc > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMa > pLib/PlatformStatusCodesInternal.h > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMa > pLib/PostCodeMapLib.c > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeMa > pLib/PostCodeMapLib.inf > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStat > usCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.c > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStat > usCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.inf > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStat > usCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.c > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStat > usCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.inf > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStat > usCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.c > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeStat > usCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.inf > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFeat > urePkg.dec > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFeat > urePkg.dsc > create mode 100644 > Features/Intel/Debugging/PostCodeDebugFeaturePkg/Readme.md >=20 > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/Library/Po > stCodeMapLib.h > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/Library/Po > stCodeMapLib.h > new file mode 100644 > index 0000000000..834be623a1 > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/Library/Po > stCodeMapLib.h > @@ -0,0 +1,32 @@ > +/** @file >=20 > + This library class provides Platform PostCode Map. >=20 > + >=20 > + Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.
>=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#ifndef __POST_CODE_MAP_LIB__ >=20 > +#define __POST_CODE_MAP_LIB__ >=20 > + >=20 > +/** >=20 > + Get PostCode from status code type and value. >=20 > + >=20 > + @param CodeType Indicates the type of status code being repor= ted. >=20 > + @param Value Describes the current status of a hardware or >=20 > + software entity. This includes information ab= out the class and >=20 > + subclass that is used to classify the entity = as well as an > operation. >=20 > + For progress codes, the operation is the curr= ent activity. >=20 > + For error codes, it is the exception.For debu= g codes,it is not > defined at this time. >=20 > + >=20 > + @return PostCode >=20 > + >=20 > +**/ >=20 > +UINT32 >=20 > +EFIAPI >=20 > +GetPostCodeFromStatusCode ( >=20 > + IN EFI_STATUS_CODE_TYPE CodeType, >=20 > + IN EFI_STATUS_CODE_VALUE Value >=20 > + ); >=20 > + >=20 > +#endif >=20 > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/PostCode > DebugFeature.dsc > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/PostCode > DebugFeature.dsc > new file mode 100644 > index 0000000000..2852b9cf7c > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Include/PostCode > DebugFeature.dsc > @@ -0,0 +1,200 @@ > +## @file >=20 > +# This package provides PostCode Debug feature. >=20 > +# This file should be included into another package DSC file to build th= is > feature. >=20 > +# >=20 > +# The DEC files are used by the utilities that parse DSC and >=20 > +# INF files to generate AutoGen.c and AutoGen.h files >=20 > +# for the build infrastructure. >=20 > +# >=20 > +# Copyright (c) 2020, Intel Corporation. All rights reserved.
>=20 > +# >=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +## >=20 > + >=20 > +######################################################### > ####################### >=20 > +# >=20 > +# Defines Section - statements that will be processed to create a Makefi= le. >=20 > +# >=20 > +######################################################### > ####################### >=20 > +[Defines] >=20 > +!ifndef $(PEI_ARCH) >=20 > + !error "PEI_ARCH must be specified to build this feature!" >=20 > +!endif >=20 > +!ifndef $(DXE_ARCH) >=20 > + !error "DXE_ARCH must be specified to build this feature!" >=20 > +!endif >=20 > + >=20 > +######################################################### > ####################### >=20 > +# >=20 > +# PCD Section - list of PCD Entries modified by the feature. >=20 > +# >=20 > +######################################################### > ####################### >=20 > + >=20 > +# Unmark the following and StatusCodeHandler.efi to build the .dsc file > directly >=20 > +#[PcdsDynamicDefault] >=20 > +# > gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode| > TRUE >=20 > + >=20 > +######################################################### > ####################### >=20 > +# >=20 > +# Library Class section - list of all Library Classes needed by this fea= ture. >=20 > +# >=20 > +######################################################### > ####################### >=20 > +[LibraryClasses] >=20 > + ####################################### >=20 > + # Edk2 Packages >=20 > + ####################################### >=20 > + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf >=20 > + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf >=20 > + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf >=20 > + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf >=20 > + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf >=20 > + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf >=20 > + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf >=20 > + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf >=20 > + > TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTem > plate.inf >=20 > + > UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBo > otServicesTableLib.inf >=20 > + > UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry > Point.inf >=20 > + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf >=20 > + > UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib > /UefiRuntimeServicesTableLib.inf >=20 > + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf >=20 > + >=20 > +[LibraryClasses.common.PEIM] >=20 > + ####################################### >=20 > + # Edk2 Packages >=20 > + ####################################### >=20 > + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf >=20 > + > MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemory > AllocationLib.inf >=20 > + > PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/P > eiServicesTablePointerLibIdt.inf >=20 > + >=20 > +[LibraryClasses.IA32.PEIM,LibraryClasses.IA32.PEI_CORE,LibraryClasses.IA= 32 > .SEC] >=20 > + ####################################### >=20 > + # Edk2 Packages >=20 > + ####################################### >=20 > + > ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiR > eportStatusCodeLib.inf >=20 > + >=20 > +[LibraryClasses.common.DXE_DRIVER] >=20 > + ####################################### >=20 > + # Edk2 Packages >=20 > + ####################################### >=20 > + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf >=20 > + > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo > ryAllocationLib.inf >=20 > + >=20 > +[LibraryClasses.common.DXE_RUNTIME_DRIVER] >=20 > + ####################################### >=20 > + # Edk2 Packages >=20 > + ####################################### >=20 > + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf >=20 > + > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo > ryAllocationLib.inf >=20 > + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf >=20 > + > ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCod > eLib/RuntimeDxeReportStatusCodeLib.inf >=20 > + >=20 > +[LibraryClasses.common.UEFI_DRIVER] >=20 > + ####################################### >=20 > + # Edk2 Packages >=20 > + ####################################### >=20 > + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf >=20 > + > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo > ryAllocationLib.inf >=20 > + >=20 > +[LibraryClasses.X64.DXE_SMM_DRIVER] >=20 > + ####################################### >=20 > + # Edk2 Packages >=20 > + ####################################### >=20 > + > SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesT > ableLib.inf >=20 > + > MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMe > moryAllocationLib.inf >=20 > + SmmIoLib|MdePkg/Library/SmmIoLib/SmmIoLib.inf >=20 > + SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf >=20 > + > ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/S > mmReportStatusCodeLib.inf >=20 > + >=20 > +######################################################### > ####################### >=20 > +# >=20 > +# Component section - list of all components that need built for this fe= ature. >=20 > +# >=20 > +# Note: The EDK II DSC file is not used to specify how compiled binary > images get placed >=20 > +# into firmware volume images. This section is just a list of modu= les to > compile from >=20 > +# source into UEFI-compliant binaries. >=20 > +# It is the FDF file that contains information on combining binary= files into > firmware >=20 > +# volume images, whose concept is beyond UEFI and is described in = PI > specification. >=20 > +# There may also be modules listed in this section that are not re= quired > in the FDF file, >=20 > +# When a module listed here is excluded from FDF file, then UEFI- > compliant binary will be >=20 > +# generated for it, but the binary will not be put into any firmwa= re > volume. >=20 > +# >=20 > +######################################################### > ####################### >=20 > +# >=20 > +# Feature PEI Components >=20 > +# >=20 > + >=20 > +# @todo: Change below line to [Components.$(PEI_ARCH)] after > https://bugzilla.tianocore.org/show_bug.cgi?id=3D2308 >=20 > +# is completed. >=20 > +[Components.IA32] >=20 > + ##################################### >=20 > + # PostCode Debug Feature Package >=20 > + ##################################### >=20 > + >=20 > + # Add library instances here that are not included in package componen= ts > and should be tested >=20 > + # in the package build. >=20 > + > PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/PeiPost > CodeStatusCodeHandlerLib.inf >=20 > + >=20 > + # The following is an example for used with StatusCodeHandler: >=20 > +# > MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.in > f { >=20 > +# >=20 > +# > OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibN > ull/OemHookStatusCodeLibNull.inf >=20 > +# > SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.= in > f >=20 > +# > PostCodeLib|MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDeb > ug.inf >=20 > +# > PostCodeMapLib|PostCodeDebugFeaturePkg/Library/PostCodeMapLib/Post > CodeMapLib.inf >=20 > +# > NULL|PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/P > eiPostCodeStatusCodeHandlerLib.inf >=20 > +# } >=20 > + >=20 > + # Add components here that should be included in the package build. >=20 > + >=20 > +# >=20 > +# Feature DXE Components >=20 > +# >=20 > + >=20 > +# @todo: Change below line to [Components.$(DXE_ARCH)] after > https://bugzilla.tianocore.org/show_bug.cgi?id=3D2308 >=20 > +# is completed. >=20 > +[Components.X64] >=20 > + ##################################### >=20 > + # PostCode Debug Feature Package >=20 > + ##################################### >=20 > + >=20 > + # Add library instances here that are not included in package componen= ts > and should be tested >=20 > + # in the package build. >=20 > + > PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/Runtim > eDxePostCodeStatusCodeHandlerLib.inf >=20 > + > PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/SmmPo > stCodeStatusCodeHandlerLib.inf >=20 > + >=20 > + # The following is an example for used with StatusCodeHandler: >=20 > +# > MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHan > dlerRuntimeDxe.inf { >=20 > +# >=20 > +# > OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibN > ull/OemHookStatusCodeLibNull.inf >=20 > +# > SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.= in > f >=20 > +# > PostCodeLib|MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDeb > ug.inf >=20 > +# > PostCodeMapLib|PostCodeDebugFeaturePkg/Library/PostCodeMapLib/Post > CodeMapLib.inf >=20 > +# > NULL|PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/R > untimeDxePostCodeStatusCodeHandlerLib.inf >=20 > +# } >=20 > + >=20 > +# > MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSm > m.inf { >=20 > +# >=20 > +# > OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibN > ull/OemHookStatusCodeLibNull.inf >=20 > +# > SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.= in > f >=20 > +# > PostCodeLib|MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDeb > ug.inf >=20 > +# > PostCodeMapLib|PostCodeDebugFeaturePkg/Library/PostCodeMapLib/Post > CodeMapLib.inf >=20 > +# > NULL|PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/S > mmPostCodeStatusCodeHandlerLib.inf >=20 > +# } >=20 > + >=20 > + # Add components here that should be included in the package build. >=20 > + >=20 > +######################################################### > ########################################## >=20 > +# >=20 > +# BuildOptions Section - Define the module specific tool chain flags tha= t > should be used as >=20 > +# the default flags for a module. These flags are= appended to > any >=20 > +# standard flags that are defined by the build pr= ocess. They can > be >=20 > +# applied for any modules or only those modules w= ith the > specific >=20 > +# module style (EDK or EDKII) specified in [Compo= nents] section. >=20 > +# >=20 > +# For advanced features, it is recommended to ena= ble > [BuildOptions] in >=20 > +# the applicable INF file so it does not affect t= he whole board > package >=20 > +# build when this DSC file is active. >=20 > +# >=20 > +######################################################### > ########################################## >=20 > +[BuildOptions] >=20 > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PlatformStatusCodesInternal.h > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PlatformStatusCodesInternal.h > new file mode 100644 > index 0000000000..7c8daf052d > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PlatformStatusCodesInternal.h > @@ -0,0 +1,270 @@ > +/** @file >=20 > + PostCode status code definition. >=20 > + >=20 > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
>=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#ifndef __PLATFORM_STATUS_CODES_INTERNAL_H__ >=20 > +#define __PLATFORM_STATUS_CODES_INTERNAL_H__ >=20 > + >=20 > +#include >=20 > + >=20 > +typedef struct{ >=20 > + EFI_STATUS_CODE_VALUE Value; >=20 > + UINT32 Data; >=20 > +} STATUS_CODE_TO_DATA_MAP; >=20 > + >=20 > +// >=20 > +// Enable PEI/DXE status code >=20 > +// >=20 > +#define PEI_STATUS_CODE 1 >=20 > +#define DXE_STATUS_CODE 1 >=20 > + >=20 > +#define STATUS_CODE_TYPE(Type) > ((Type)&EFI_STATUS_CODE_TYPE_MASK) >=20 > +#define STATUS_CODE_CLASS(Value) > ((Value)&EFI_STATUS_CODE_CLASS_MASK) >=20 > + >=20 > +//Progress/Error codes >=20 > +#define PEI_CORE_STARTED (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_CORE_PC_ENTRY_POINT) >=20 > +#define PEI_RESET_NOT_AVAILABLE (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PS_EC_RESET_NOT_AVAILABLE) >=20 > +#define PEI_DXEIPL_NOT_FOUND (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_CORE_EC_DXEIPL_NOT_FOUND) >=20 > +#define PEI_DXE_CORE_NOT_FOUND (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_CORE_EC_DXE_CORRUPT) >=20 > +#define PEI_S3_RESUME_ERROR (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_EC_S3_RESUME_FAILED) >=20 > +#define PEI_RECOVERY_FAILED (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_EC_RECOVERY_FAILED) >=20 > +#define DXE_CORE_STARTED (EFI_SOFTWARE_DXE_CORE | > EFI_SW_DXE_CORE_PC_ENTRY_POINT) >=20 > + >=20 > +//#define DXE_EXIT_BOOT_SERVICES_BEGIN 0xF8 >=20 > +#define DXE_EXIT_BOOT_SERVICES_END > (EFI_SOFTWARE_EFI_BOOT_SERVICE | > EFI_SW_BS_PC_EXIT_BOOT_SERVICES) >=20 > + >=20 > +// Reported by CPU PEIM >=20 > +#define PEI_CAR_CPU_INIT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_PC_POWER_ON_INIT) >=20 > + >=20 > +// Reported by NB PEIM >=20 > +//#define PEI_CAR_NB_INIT (EFI_COMPUTING_UNIT_CHIP= SET | > EFI_CU_CHIPSET_NORTH_INIT) >=20 > + >=20 > +// Reported by SB PEIM >=20 > +//#define PEI_CAR_SB_INIT (EFI_COMPUTING_UNIT_CHIP= SET | > EFI_CU_CHIPSET_PC_SOUTH_INIT) >=20 > + >=20 > +//Reported by Memory Detection PEIM >=20 > +#define PEI_MEMORY_SPD_READ > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_SPD_READ) >=20 > +#define PEI_MEMORY_PRESENCE_DETECT > (EFI_COMPUTING_UNIT_MEMORY | > EFI_CU_MEMORY_PC_PRESENCE_DETECT) >=20 > +#define PEI_MEMORY_TIMING > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_TIMING) >=20 > +#define PEI_MEMORY_CONFIGURING > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_CONFIGURING) >=20 > +#define PEI_MEMORY_OPTIMIZING > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_PC_OPTIMIZING) >=20 > +#define PEI_MEMORY_INIT (EFI_COMPUTING_UNIT_MEMORY > | EFI_CU_MEMORY_PC_INIT) >=20 > +#define PEI_MEMORY_TEST (EFI_COMPUTING_UNIT_MEMORY > | EFI_CU_MEMORY_PC_TEST) >=20 > +#define PEI_MEMORY_INVALID_TYPE > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_TYPE) >=20 > +#define PEI_MEMORY_INVALID_SPEED > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_SPEED) >=20 > +#define PEI_MEMORY_SPD_FAIL > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_SPD_FAIL) >=20 > +#define PEI_MEMORY_INVALID_SIZE > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_INVALID_SIZE) >=20 > +#define PEI_MEMORY_MISMATCH > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_MISMATCH) >=20 > +#define PEI_MEMORY_S3_RESUME_FAILED > (EFI_COMPUTING_UNIT_MEMORY | > EFI_CU_MEMORY_EC_S3_RESUME_FAIL) >=20 > +#define PEI_MEMORY_NOT_DETECTED > (EFI_COMPUTING_UNIT_MEMORY | > EFI_CU_MEMORY_EC_NONE_DETECTED) >=20 > +#define PEI_MEMORY_NONE_USEFUL > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_NONE_USEFUL) >=20 > +#define PEI_MEMORY_ERROR > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_EC_NON_SPECIFIC) >=20 > +#define PEI_MEMORY_INSTALLED (EFI_SOFTWARE_PEI_SERVICE = | > EFI_SW_PS_PC_INSTALL_PEI_MEMORY) >=20 > +#define PEI_MEMORY_NOT_INSTALLED > (EFI_SOFTWARE_PEI_SERVICE | > EFI_SW_PEI_CORE_EC_MEMORY_NOT_INSTALLED) >=20 > +#define PEI_MEMORY_INSTALLED_TWICE > (EFI_SOFTWARE_PEI_SERVICE | > EFI_SW_PS_EC_MEMORY_INSTALLED_TWICE) >=20 > + >=20 > +//Reported by CPU PEIM >=20 > +#define PEI_CPU_INIT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_PC_INIT_BEGIN) >=20 > +#define PEI_CPU_CACHE_INIT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_CACHE_INIT) >=20 > +#define PEI_CPU_BSP_SELECT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_BSP_SELECT) >=20 > +#define PEI_CPU_AP_INIT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_AP_INIT) >=20 > +#define PEI_CPU_SMM_INIT > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_PC_SMM_INIT) >=20 > +#define PEI_CPU_INVALID_TYPE > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_INVALID_TYPE) >=20 > +#define PEI_CPU_INVALID_SPEED > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_INVALID_SPEED) >=20 > +#define PEI_CPU_MISMATCH > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_MISMATCH) >=20 > +#define PEI_CPU_SELF_TEST_FAILED > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST) >=20 > +#define PEI_CPU_CACHE_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_CACHE) >=20 > +#define PEI_CPU_MICROCODE_UPDATE_FAILED > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_MICROCODE_UPDATE) >=20 > +#define PEI_CPU_NO_MICROCODE > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_NO_MICROCODE_UPDATE) >=20 > +//If non of the errors above apply use this one >=20 > +#define PEI_CPU_INTERNAL_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_INTERNAL) >=20 > +//Generic CPU error. It should only be used if non of the errors above a= pply >=20 > +#define PEI_CPU_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_EC_NON_SPECIFIC) >=20 > + >=20 > +// Reported by NB PEIM >=20 > +#define PEI_MEM_NB_INIT (EFI_COMPUTING_UNIT_CHIPSE= T | > EFI_CHIPSET_PC_PEI_MEM_NB_INIT) >=20 > +// Reported by SB PEIM >=20 > +#define PEI_MEM_SB_INIT (EFI_COMPUTING_UNIT_CHIPSE= T | > EFI_CHIPSET_PC_PEI_MEM_SB_INIT) >=20 > + >=20 > +//Reported by PEIM which detected forced or auto recovery condition >=20 > +#define PEI_RECOVERY_AUTO (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_PC_RECOVERY_AUTO) >=20 > +#define PEI_RECOVERY_USER (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_PC_RECOVERY_USER) >=20 > + >=20 > +//Reported by DXE IPL >=20 > +#define PEI_RECOVERY_PPI_NOT_FOUND > (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_EC_RECOVERY_PPI_NOT_FOUND) >=20 > +#define PEI_S3_RESUME_PPI_NOT_FOUND > (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_EC_S3_RESUME_PPI_NOT_FOUND) >=20 > +#define PEI_S3_RESUME_FAILED (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_EC_S3_RESUME_FAILED) >=20 > + >=20 > +//Reported by Recovery PEIM >=20 > +#define PEI_RECOVERY_STARTED (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_PC_RECOVERY_BEGIN) >=20 > +#define PEI_RECOVERY_CAPSULE_FOUND > (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_LOAD) >=20 > +#define PEI_RECOVERY_NO_CAPSULE > (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_NO_RECOVERY_CAPSULE) >=20 > +#define PEI_RECOVERY_CAPSULE_LOADED > (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_CAPSULE_START) >=20 > +#define PEI_RECOVERY_INVALID_CAPSULE > (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_EC_INVALID_CAPSULE_DESCRIPTOR) >=20 > + >=20 > +//Reported by S3 Resume PEIM >=20 > +#define PEI_S3_BOOT_SCRIPT (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_PC_S3_BOOT_SCRIPT) >=20 > +#define PEI_S3_OS_WAKE (EFI_SOFTWARE_PEI_MODULE | > EFI_SW_PEI_PC_OS_WAKE) >=20 > +#define PEI_S3_BOOT_SCRIPT_ERROR > (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_S3_BOOT_SCRIPT_ERROR) >=20 > +#define PEI_S3_OS_WAKE_ERROR (EFI_SOFTWARE_PEI_MODULE > | EFI_SW_PEI_EC_S3_OS_WAKE_ERROR) >=20 > + >=20 > +#define PEI_PEIM_STARTED (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PC_INIT_BEGIN) >=20 > +#define PEI_PEIM_ENDED (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PC_INIT_END) >=20 > + >=20 > +//Reported by DXE IPL >=20 > +#define PEI_DXE_IPL_STARTED (EFI_SOFTWARE_PEI_CORE | > EFI_SW_PEI_CORE_PC_HANDOFF_TO_NEXT) >=20 > + >=20 > +//Reported by PEIM which installs Reset PPI >=20 > +#define PEI_RESET_SYSTEM (EFI_SOFTWARE_PEI_SERVICE = | > EFI_SW_PS_PC_RESET_SYSTEM) >=20 > + >=20 > +//Reported by the PEIM or DXE driver which detected the error >=20 > +#define GENERIC_MEMORY_CORRECTABLE_ERROR > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_CORRECTABLE) >=20 > +#define GENERIC_MEMORY_UNCORRECTABLE_ERROR > (EFI_COMPUTING_UNIT_MEMORY | > EFI_CU_MEMORY_EC_UNCORRECTABLE) >=20 > + >=20 > +//Reported by Flash Update DXE driver >=20 > +#define DXE_FLASH_UPDATE_FAILED > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UPDATE_FAIL) >=20 > + >=20 > +//Reported by the PEIM or DXE driver which detected the error >=20 > +#define GENERIC_CPU_THERMAL_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_THERMAL) >=20 > +#define GENERIC_CPU_LOW_VOLTAGE > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_LOW_VOLTAGE) >=20 > +#define GENERIC_CPU_HIGH_VOLTAGE > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_HIGH_VOLTAGE) >=20 > +#define GENERIC_CPU_CORRECTABLE_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_CORRECTABLE) >=20 > +#define GENERIC_CPU_UNCORRECTABLE_ERROR > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | > EFI_CU_HP_EC_UNCORRECTABLE) >=20 > +#define GENERIC_BAD_DATE_TIME_ERROR > (EFI_SOFTWARE_UNSPECIFIED | EFI_SW_EC_BAD_DATE_TIME) >=20 > +#define GENERIC_MEMORY_SIZE_DECREASE > (EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_MISMATCH) >=20 > + >=20 > +//Reported by DXE Core >=20 > +#define DXE_DRIVER_STARTED > (EFI_SOFTWARE_EFI_DXE_SERVICE | EFI_SW_PC_INIT_BEGIN) >=20 > +#define DXE_DRIVER_ENED (EFI_SOFTWARE_DXE_CORE | > EFI_SW_PC_INIT_END) >=20 > +#define DXE_ARCH_PROTOCOLS_AVAILABLE > (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ARCH_READY) >=20 > +#define DXE_DRIVER_CONNECTED (EFI_SOFTWARE_DXE_CORE | > EFI_SW_DXE_CORE_PC_START_DRIVER) >=20 > +#define DXE_ARCH_PROTOCOL_NOT_AVAILABLE > (EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_EC_NO_ARCH) >=20 > + >=20 > +//Reported by DXE CPU driver >=20 > +#define DXE_CPU_SELF_TEST_FAILED > (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST) >=20 > + >=20 > +//Reported by PCI Host Bridge driver >=20 > +#define DXE_NB_HB_INIT (EFI_COMPUTING_UNIT_CHIPSE= T | > EFI_CHIPSET_PC_DXE_HB_INIT ) >=20 > + >=20 > +// Reported by NB Driver >=20 > +#define DXE_NB_INIT (EFI_COMPUTING_UNIT_CHIPSE= T | > EFI_CHIPSET_PC_DXE_NB_INIT ) >=20 > +#define DXE_NB_SMM_INIT (EFI_COMPUTING_UNIT_CHIPSE= T | > EFI_CHIPSET_PC_DXE_NB_SMM_INIT ) >=20 > +#define DXE_NB_ERROR (EFI_COMPUTING_UNIT_CHIPSE= T | > EFI_CHIPSET_EC_DXE_NB_ERROR ) >=20 > + >=20 > +// Reported by SB Driver(s) >=20 > +#define DXE_SBRUN_INIT (EFI_COMPUTING_UNIT_CHIPSE= T | > EFI_CHIPSET_PC_DXE_SB_RT_INIT ) >=20 > +#define DXE_SB_INIT (EFI_COMPUTING_UNIT_CHIPSE= T | > EFI_CHIPSET_PC_DXE_SB_INIT ) >=20 > +#define DXE_SB_SMM_INIT (EFI_COMPUTING_UNIT_CHIPSE= T | > EFI_CHIPSET_PC_DXE_SB_SMM_INIT ) >=20 > +#define DXE_SB_DEVICES_INIT (EFI_COMPUTING_UNIT_CHIPSE= T > | EFI_CHIPSET_PC_DXE_SB_DEVICES_INIT ) >=20 > +#define DXE_SB_BAD_BATTERY (EFI_COMPUTING_UNIT_CHIPSE= T > | EFI_CHIPSET_EC_BAD_BATTERY) >=20 > +#define DXE_SB_ERROR (EFI_COMPUTING_UNIT_CHIPSE= T | > EFI_CHIPSET_EC_DXE_SB_ERROR ) >=20 > + >=20 > +//Reported by DXE Core >=20 > +#define DXE_BDS_STARTED (EFI_SOFTWARE_DXE_CORE | > EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT) >=20 > + >=20 > +//Reported by BDS >=20 > +//#define DXE_BDS_CONNECT_DRIVERS > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_BEGIN_CONNECTING_DRIVERS) >=20 > + >=20 > +//Reported by Boot Manager >=20 > +#define DXE_READY_TO_BOOT (EFI_SOFTWARE_DXE_BS_DRIVE= R > | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT) >=20 > + >=20 > +//Reported by DXE Core >=20 > +#define DXE_EXIT_BOOT_SERVICES > (EFI_SOFTWARE_EFI_BOOT_SERVICE | > EFI_SW_BS_PC_EXIT_BOOT_SERVICES) >=20 > +#define DXE_EXIT_BOOT_SERVICES_EVENT > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_EXIT_BOOT_SERVICES_EVENT) >=20 > + >=20 > +//Reported by driver that installs Runtime AP >=20 > +#define RT_SET_VIRTUAL_ADDRESS_MAP_BEGIN > (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | > EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP) >=20 > +#define RT_SET_VIRTUAL_ADDRESS_MAP_END > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_VIRTUAL_ADDRESS_CHANGE_EVENT) >=20 > + >=20 > +//Reported by CSM >=20 > +#define DXE_LEGACY_OPROM_INIT > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_LEGACY_OPROM_INIT) >=20 > +#define DXE_LEGACY_BOOT (EFI_SOFTWARE_DXE_BS_DRIVE= R | > EFI_SW_DXE_BS_PC_LEGACY_BOOT_EVENT) >=20 > +#define DXE_LEGACY_OPROM_NO_SPACE > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_EC_LEGACY_OPROM_NO_SPACE) >=20 > + >=20 > +//Reported by SETUP >=20 > +//#define DXE_SETUP_VERIFYING_PASSWORD > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_PC_VERIFYING_PASSWORD) >=20 > +#define DXE_SETUP_START (EFI_SOFTWARE_DXE_BS_DRIVE= R | > EFI_SW_PC_USER_SETUP) >=20 > +#define DXE_SETUP_INPUT_WAIT > (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT) >=20 > +#define DXE_INVALID_PASSWORD > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_EC_INVALID_PASSWORD) >=20 > +#define DXE_INVALID_IDE_PASSWORD > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_EC_INVALID_IDE_PASSWORD) >=20 > +#define DXE_BOOT_OPTION_LOAD_ERROR > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR) >=20 > +#define DXE_BOOT_OPTION_FAILED > (EFI_SOFTWARE_DXE_BS_DRIVER | > EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED) >=20 > + >=20 > +//Reported by a Driver that installs Reset AP >=20 > +#define DXE_RESET_SYSTEM > (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | EFI_SW_RS_PC_RESET_SYSTEM) >=20 > +#define DXE_RESET_NOT_AVAILABLE > (EFI_SOFTWARE_EFI_RUNTIME_SERVICE | > EFI_SW_PS_EC_RESET_NOT_AVAILABLE) >=20 > + >=20 > +// Reported by PCI bus driver >=20 > +#define DXE_PCI_BUS_BEGIN (EFI_IO_BUS_PCI | > EFI_IOB_PC_INIT) >=20 > +#define DXE_PCI_BUS_ENUM (EFI_IO_BUS_PCI | > EFI_IOB_PCI_BUS_ENUM) >=20 > +#define DXE_PCI_BUS_HPC_INIT (EFI_IO_BUS_PCI | > EFI_IOB_PCI_HPC_INIT) >=20 > +#define DXE_PCI_BUS_REQUEST_RESOURCES (EFI_IO_BUS_PCI | > EFI_IOB_PCI_RES_ALLOC) >=20 > +#define DXE_PCI_BUS_ASSIGN_RESOURCES (EFI_IO_BUS_PCI | > EFI_IOB_PC_ENABLE) >=20 > +#define DXE_PCI_BUS_HOTPLUG (EFI_IO_BUS_PCI | > EFI_IOB_PC_HOTPLUG) >=20 > +#define DXE_PCI_BUS_OUT_OF_RESOURCES (EFI_IO_BUS_PCI | > EFI_IOB_EC_RESOURCE_CONFLICT) >=20 > + >=20 > +// Reported by USB bus driver >=20 > +#define DXE_USB_BEGIN (EFI_IO_BUS_USB | EFI_IOB_= PC_INIT) >=20 > +#define DXE_USB_RESET (EFI_IO_BUS_USB | > EFI_IOB_PC_RESET) >=20 > +#define DXE_USB_DETECT (EFI_IO_BUS_USB | > EFI_IOB_PC_DETECT) >=20 > +#define DXE_USB_ENABLE (EFI_IO_BUS_USB | > EFI_IOB_PC_ENABLE) >=20 > +#define DXE_USB_HOTPLUG (EFI_IO_BUS_USB | > EFI_IOB_PC_HOTPLUG) >=20 > + >=20 > +//Reported by IDE bus driver >=20 > +#define DXE_IDE_BEGIN (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_PC_INIT) >=20 > +#define DXE_IDE_RESET (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_PC_RESET) >=20 > +#define DXE_IDE_DETECT (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_PC_DETECT) >=20 > +#define DXE_IDE_ENABLE (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_PC_ENABLE) >=20 > +#define DXE_IDE_SMART_ERROR (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_ATA_BUS_SMART_OVERTHRESHOLD) >=20 > +#define DXE_IDE_CONTROLLER_ERROR (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_EC_CONTROLLER_ERROR) >=20 > +#define DXE_IDE_DEVICE_FAILURE (EFI_IO_BUS_ATA_ATAPI | > EFI_IOB_EC_INTERFACE_ERROR) >=20 > + >=20 > +// Reported by SCSI bus driver >=20 > +#define DXE_SCSI_BEGIN (EFI_IO_BUS_SCSI | EFI_IOB= _PC_INIT) >=20 > +#define DXE_SCSI_RESET (EFI_IO_BUS_SCSI | > EFI_IOB_PC_RESET) >=20 > +#define DXE_SCSI_DETECT (EFI_IO_BUS_SCSI | > EFI_IOB_PC_DETECT) >=20 > +#define DXE_SCSI_ENABLE (EFI_IO_BUS_SCSI | > EFI_IOB_PC_ENABLE) >=20 > + >=20 > +// Reported by Super I/O driver >=20 > +#define DXE_SIO_INIT (EFI_IO_BUS_LPC | EFI_IOB_= PC_INIT) >=20 > + >=20 > +// Reported by Keyboard driver >=20 > +#define DXE_KEYBOARD_INIT (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_INIT) >=20 > +#define DXE_KEYBOARD_RESET (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_RESET) >=20 > +#define DXE_KEYBOARD_DISABLE (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_DISABLE) >=20 > +#define DXE_KEYBOARD_DETECT (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_PRESENCE_DETECT) >=20 > +#define DXE_KEYBOARD_ENABLE (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_ENABLE) >=20 > +#define DXE_KEYBOARD_CLEAR_BUFFER > (EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_CLEAR_BUFFER) >=20 > +#define DXE_KEYBOARD_SELF_TEST (EFI_PERIPHERAL_KEYBOARD | > EFI_P_KEYBOARD_PC_SELF_TEST) >=20 > + >=20 > +// Reported by Mouse driver >=20 > +#define DXE_MOUSE_INIT (EFI_PERIPHERAL_MOUSE | > EFI_P_PC_INIT) >=20 > +#define DXE_MOUSE_RESET (EFI_PERIPHERAL_MOUSE | > EFI_P_PC_RESET) >=20 > +#define DXE_MOUSE_DISABLE (EFI_PERIPHERAL_MOUSE | > EFI_P_PC_DISABLE) >=20 > +#define DXE_MOUSE_DETECT (EFI_PERIPHERAL_MOUSE | > EFI_P_PC_PRESENCE_DETECT) >=20 > +#define DXE_MOUSE_ENABLE (EFI_PERIPHERAL_MOUSE | > EFI_P_PC_ENABLE) >=20 > + >=20 > +// Reported by Mass Storage drivers >=20 > +#define DXE_FIXED_MEDIA_INIT (EFI_PERIPHERAL_FIXED_MEDI= A > | EFI_P_PC_INIT) >=20 > +#define DXE_FIXED_MEDIA_RESET (EFI_PERIPHERAL_FIXED_MEDI= A > | EFI_P_PC_RESET) >=20 > +#define DXE_FIXED_MEDIA_DISABLE > (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_DISABLE) >=20 > +#define DXE_FIXED_MEDIA_DETECT > (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_PRESENCE_DETECT) >=20 > +#define DXE_FIXED_MEDIA_ENABLE > (EFI_PERIPHERAL_FIXED_MEDIA | EFI_P_PC_ENABLE) >=20 > +#define DXE_REMOVABLE_MEDIA_INIT > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_INIT) >=20 > +#define DXE_REMOVABLE_MEDIA_RESET > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_RESET) >=20 > +#define DXE_REMOVABLE_MEDIA_DISABLE > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_DISABLE) >=20 > +#define DXE_REMOVABLE_MEDIA_DETECT > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_PRESENCE_DETECT) >=20 > +#define DXE_REMOVABLE_MEDIA_ENABLE > (EFI_PERIPHERAL_REMOVABLE_MEDIA | EFI_P_PC_ENABLE) >=20 > + >=20 > + >=20 > +// Reported by BDS >=20 > +#define DXE_CON_OUT_CONNECT > (EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_PC_INIT) >=20 > +#define DXE_CON_IN_CONNECT (EFI_PERIPHERAL_KEYBOARD | > EFI_P_PC_INIT) >=20 > +#define DXE_NO_CON_OUT > (EFI_PERIPHERAL_LOCAL_CONSOLE | EFI_P_EC_NOT_DETECTED) >=20 > +#define DXE_NO_CON_IN (EFI_PERIPHERAL_KEYBOARD | > EFI_P_EC_NOT_DETECTED) >=20 > + >=20 > +#endif >=20 > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PostCodeMapLib.c > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PostCodeMapLib.c > new file mode 100644 > index 0000000000..2246e59f8b > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PostCodeMapLib.c > @@ -0,0 +1,207 @@ > +/** @file >=20 > + PostCodeMap implementation. >=20 > + >=20 > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
>=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#include >=20 > +#include >=20 > + >=20 > +#include "PlatformStatusCodesInternal.h" >=20 > + >=20 > +STATUS_CODE_TO_DATA_MAP mPostCodeProgressMap[] =3D { >=20 > + // >=20 > + // PEI >=20 > + // >=20 > + //Regular boot >=20 > + { PEI_CORE_STARTED, 0x10 }, >=20 > + { PEI_CAR_CPU_INIT, 0x11 }, >=20 > + { PEI_MEMORY_SPD_READ, 0x1D }, >=20 > + { PEI_MEMORY_PRESENCE_DETECT, 0x1E }, >=20 > + { PEI_MEMORY_TIMING, 0x1F}, >=20 > + { PEI_MEMORY_CONFIGURING, 0x20 }, >=20 > + { PEI_MEMORY_INIT, 0x21 }, >=20 > + { PEI_MEMORY_INSTALLED, 0x31 }, >=20 > + { PEI_CPU_INIT, 0x32 }, >=20 > + { PEI_CPU_CACHE_INIT, 0x33 }, >=20 > + { PEI_CPU_BSP_SELECT, 0x34 }, >=20 > + { PEI_CPU_AP_INIT, 0x35 }, >=20 > + { PEI_CPU_SMM_INIT, 0x36 }, >=20 > + { PEI_MEM_NB_INIT, 0x37 }, >=20 > + { PEI_MEM_SB_INIT, 0x3B }, >=20 > + { PEI_DXE_IPL_STARTED, 0x4F }, >=20 > + //Recovery >=20 > + { PEI_RECOVERY_AUTO, 0xF0 }, >=20 > + { PEI_RECOVERY_USER, 0xF1 }, >=20 > + { PEI_RECOVERY_STARTED, 0xF2 }, >=20 > + { PEI_RECOVERY_CAPSULE_FOUND, 0xF3 }, >=20 > + { PEI_RECOVERY_CAPSULE_LOADED, 0xF4 }, >=20 > + //S3 >=20 > + //{ PEI_S3_STARTED, 0xE0 }, >=20 > + { PEI_S3_BOOT_SCRIPT, 0xE1 }, >=20 > + //{ PEI_S3_VIDEO_REPOST, 0xE2 }, >=20 > + { PEI_S3_OS_WAKE, 0xE3 }, >=20 > + >=20 > + // >=20 > + // DXE >=20 > + // >=20 > + { DXE_CORE_STARTED, 0x1060 }, >=20 > + { DXE_SBRUN_INIT, 0x1062 }, >=20 > + { DXE_NB_HB_INIT, 0x1068 }, >=20 > + { DXE_NB_INIT, 0x1069 }, >=20 > + { DXE_NB_SMM_INIT, 0x106A }, >=20 > + { DXE_SB_INIT, 0x1070 }, >=20 > + { DXE_SB_SMM_INIT, 0x1071 }, >=20 > + { DXE_SB_DEVICES_INIT, 0x1072 }, >=20 > + { DXE_BDS_STARTED, 0x1090 }, >=20 > + { DXE_PCI_BUS_BEGIN, 0x1092 }, >=20 > + { DXE_PCI_BUS_HPC_INIT, 0x1093 }, >=20 > + { DXE_PCI_BUS_ENUM, 0x1094 }, >=20 > + { DXE_PCI_BUS_REQUEST_RESOURCES, 0x1095 }, >=20 > + { DXE_PCI_BUS_ASSIGN_RESOURCES, 0x1096 }, >=20 > + { DXE_CON_OUT_CONNECT, 0x1097 }, >=20 > + { DXE_CON_IN_CONNECT, 0x1098 }, >=20 > + { DXE_SIO_INIT, 0x1099 }, >=20 > + { DXE_USB_BEGIN, 0x109A }, >=20 > + { DXE_USB_RESET, 0x109B }, >=20 > + { DXE_USB_DETECT, 0x109C }, >=20 > + { DXE_USB_ENABLE, 0x109D }, >=20 > + { DXE_IDE_BEGIN, 0x10A1 }, >=20 > + { DXE_IDE_RESET, 0x10A2 }, >=20 > + { DXE_IDE_DETECT, 0x10A3 }, >=20 > + { DXE_IDE_ENABLE, 0x10A4 }, >=20 > + { DXE_SCSI_BEGIN, 0x10A5 }, >=20 > + { DXE_SCSI_RESET, 0x10A6 }, >=20 > + { DXE_SCSI_DETECT, 0x10A7 }, >=20 > + { DXE_SCSI_ENABLE, 0x10A8 }, >=20 > + { DXE_SETUP_START, 0x10AB }, >=20 > + { DXE_SETUP_INPUT_WAIT, 0x10AC }, >=20 > + { DXE_READY_TO_BOOT, 0x10AD }, >=20 > + { DXE_LEGACY_BOOT, 0x10AE }, >=20 > + { DXE_EXIT_BOOT_SERVICES, 0x10AF }, >=20 > + { RT_SET_VIRTUAL_ADDRESS_MAP_BEGIN, 0x10B0 }, >=20 > + { RT_SET_VIRTUAL_ADDRESS_MAP_END, 0x10B1 }, >=20 > + { DXE_LEGACY_OPROM_INIT, 0x10B2 }, >=20 > + { DXE_RESET_SYSTEM, 0x10B3 }, >=20 > + { DXE_USB_HOTPLUG, 0x10B4 }, >=20 > + { DXE_PCI_BUS_HOTPLUG, 0x10B5 }, >=20 > + {0,0} >=20 > +}; >=20 > + >=20 > +STATUS_CODE_TO_DATA_MAP mPostCodeErrorMap[] =3D { >=20 > + // >=20 > + // PEI >=20 > + // >=20 > + //Regular boot >=20 > + { PEI_MEMORY_INVALID_TYPE, 0x50 }, >=20 > + { PEI_MEMORY_INVALID_SPEED, 0x50 }, >=20 > + { PEI_MEMORY_SPD_FAIL, 0x51 }, >=20 > + { PEI_MEMORY_INVALID_SIZE, 0x52 }, >=20 > + { PEI_MEMORY_MISMATCH, 0x52 }, >=20 > + { PEI_MEMORY_NOT_DETECTED, 0x53 }, >=20 > + { PEI_MEMORY_NONE_USEFUL, 0x53 }, >=20 > + { PEI_MEMORY_ERROR, 0x54 }, >=20 > + { PEI_MEMORY_NOT_INSTALLED, 0x55 }, >=20 > + { PEI_CPU_INVALID_TYPE, 0x56 }, >=20 > + { PEI_CPU_INVALID_SPEED, 0x56 }, >=20 > + { PEI_CPU_MISMATCH, 0x57 }, >=20 > + { PEI_CPU_SELF_TEST_FAILED, 0x58 }, >=20 > + { PEI_CPU_CACHE_ERROR, 0x58 }, >=20 > + { PEI_CPU_MICROCODE_UPDATE_FAILED, 0x59 }, >=20 > + { PEI_CPU_NO_MICROCODE, 0x59 }, >=20 > + { PEI_CPU_INTERNAL_ERROR, 0x5A }, >=20 > + { PEI_CPU_ERROR, 0x5A }, >=20 > + { PEI_RESET_NOT_AVAILABLE,0x5B }, >=20 > + //Recovery >=20 > + { PEI_RECOVERY_PPI_NOT_FOUND, 0xF8 }, >=20 > + { PEI_RECOVERY_NO_CAPSULE, 0xF9 }, >=20 > + { PEI_RECOVERY_INVALID_CAPSULE, 0xFA }, >=20 > + //S3 Resume >=20 > + { PEI_MEMORY_S3_RESUME_FAILED, 0xE8 }, >=20 > + { PEI_S3_RESUME_PPI_NOT_FOUND, 0xE9 }, >=20 > + { PEI_S3_BOOT_SCRIPT_ERROR, 0xEA }, >=20 > + { PEI_S3_OS_WAKE_ERROR, 0xEB }, >=20 > + >=20 > + // >=20 > + // DXE >=20 > + // >=20 > + { DXE_CPU_SELF_TEST_FAILED, 0x1058 }, >=20 > + { DXE_NB_ERROR, 0x10D1 }, >=20 > + { DXE_SB_ERROR, 0x10D2 }, >=20 > + { DXE_ARCH_PROTOCOL_NOT_AVAILABLE, 0x10D3 }, >=20 > + { DXE_PCI_BUS_OUT_OF_RESOURCES, 0x10D4 }, >=20 > + { DXE_LEGACY_OPROM_NO_SPACE, 0x10D5 }, >=20 > + { DXE_NO_CON_OUT, 0x10D6 }, >=20 > + { DXE_NO_CON_IN, 0x10D7 }, >=20 > + { DXE_INVALID_PASSWORD, 0x10D8 }, >=20 > + { DXE_BOOT_OPTION_LOAD_ERROR, 0x10D9 }, >=20 > + { DXE_BOOT_OPTION_FAILED, 0x10DA }, >=20 > + { DXE_FLASH_UPDATE_FAILED, 0x10DB }, >=20 > + { DXE_RESET_NOT_AVAILABLE, 0x10DC }, >=20 > + {0,0} >=20 > +}; >=20 > + >=20 > +STATUS_CODE_TO_DATA_MAP *mPostCodeStatusCodesMap[] =3D { >=20 > + //#define EFI_PROGRESS_CODE 0x00000001 >=20 > + mPostCodeProgressMap, >=20 > + //#define EFI_ERROR_CODE 0x00000002 >=20 > + mPostCodeErrorMap >=20 > + //#define EFI_DEBUG_CODE 0x00000003 >=20 > +}; >=20 > + >=20 > +/** >=20 > + Find the post code data from status code value. >=20 > + >=20 > + @param Map The map used to find in. >=20 > + @param Value The status code value. >=20 > + >=20 > + @return PostCode 0 for not found. >=20 > + >=20 > +**/ >=20 > +UINT32 >=20 > +FindPostCodeData ( >=20 > + IN STATUS_CODE_TO_DATA_MAP *Map, >=20 > + IN EFI_STATUS_CODE_VALUE Value >=20 > + ) >=20 > +{ >=20 > + while (Map->Value !=3D 0) { >=20 > + if (Map->Value =3D=3D Value) { >=20 > + return Map->Data; >=20 > + } >=20 > + Map++; >=20 > + } >=20 > + return 0; >=20 > +} >=20 > + >=20 > +/** >=20 > + Get PostCode from status code type and value. >=20 > + >=20 > + @param CodeType Indicates the type of status code being repor= ted. >=20 > + @param Value Describes the current status of a hardware or >=20 > + software entity. This includes information ab= out the class and >=20 > + subclass that is used to classify the entity = as well as an > operation. >=20 > + For progress codes, the operation is the curr= ent activity. >=20 > + For error codes, it is the exception.For debu= g codes,it is not > defined at this time. >=20 > + >=20 > + @return PostCode >=20 > + >=20 > +**/ >=20 > +UINT32 >=20 > +EFIAPI >=20 > +GetPostCodeFromStatusCode ( >=20 > + IN EFI_STATUS_CODE_TYPE CodeType, >=20 > + IN EFI_STATUS_CODE_VALUE Value >=20 > + ) >=20 > +{ >=20 > + UINT32 CodeTypeIndex; >=20 > + >=20 > + CodeTypeIndex =3D STATUS_CODE_TYPE (CodeType) - 1; >=20 > + >=20 > + if (CodeTypeIndex >=3D sizeof (mPostCodeStatusCodesMap) / > sizeof(mPostCodeStatusCodesMap[0])) { >=20 > + return 0; >=20 > + } >=20 > + >=20 > + return FindPostCodeData (mPostCodeStatusCodesMap[CodeTypeIndex], > Value); >=20 > +} >=20 > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PostCodeMapLib.inf > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PostCodeMapLib.inf > new file mode 100644 > index 0000000000..18a8ac6116 > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCode > MapLib/PostCodeMapLib.inf > @@ -0,0 +1,27 @@ > +## @file >=20 > +# Instance of Platform Post Code Map Library. >=20 > +# >=20 > +# Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved.
>=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +## >=20 > + >=20 > +[Defines] >=20 > + INF_VERSION =3D 0x00010017 >=20 > + BASE_NAME =3D PostCodeMapLib >=20 > + FILE_GUID =3D 1C579857-5328-4304-8607-77B0BC97855= 4 >=20 > + VERSION_STRING =3D 1.0 >=20 > + MODULE_TYPE =3D BASE >=20 > + LIBRARY_CLASS =3D PostCodeMapLib >=20 > +# >=20 > +# The following information is for reference only and not required by th= e > build tools. >=20 > +# >=20 > +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC >=20 > +# >=20 > + >=20 > +[Packages] >=20 > + MdePkg/MdePkg.dec >=20 > + >=20 > +[Sources] >=20 > + PostCodeMapLib.c >=20 > + PlatformStatusCodesInternal.h >=20 > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.c > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.c > new file mode 100644 > index 0000000000..85d7a3d9a8 > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.c > @@ -0,0 +1,102 @@ > +/** @file >=20 > + PostCode status code implementation. >=20 > + >=20 > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
>=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > + >=20 > +#include >=20 > +#include >=20 > + >=20 > +/** >=20 > + Convert status code value and write data to post code. >=20 > + >=20 > + @param PeiServices An indirect pointer to the EFI_PEI_SERVICES t= able > published by the PEI Foundation. >=20 > + @param CodeType Indicates the type of status code being repor= ted. >=20 > + @param Value Describes the current status of a hardware or >=20 > + software entity. This includes information ab= out the class and >=20 > + subclass that is used to classify the entity = as well as an > operation. >=20 > + For progress codes, the operation is the curr= ent activity. >=20 > + For error codes, it is the exception.For debu= g codes,it is not > defined at this time. >=20 > + @param Instance The enumeration of a hardware or software ent= ity > within >=20 > + the system. A system may contain multiple ent= ities that match > a class/subclass >=20 > + pairing. The instance differentiates between = them. An > instance of 0 indicates >=20 > + that instance information is unavailable, not= meaningful, or > not relevant. >=20 > + Valid instance numbers start with 1. >=20 > + @param CallerId This optional parameter may be used to identi= fy the > caller. >=20 > + This parameter allows the status code driver = to apply different > rules to >=20 > + different callers. >=20 > + @param Data This optional parameter may be used to pass > additional data. >=20 > + >=20 > + @retval EFI_SUCCESS Status code reported to post code successfull= y. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +PostCodeStatusCodeReportWorker ( >=20 > + IN CONST EFI_PEI_SERVICES **PeiServices, >=20 > + IN EFI_STATUS_CODE_TYPE CodeType, >=20 > + IN EFI_STATUS_CODE_VALUE Value, >=20 > + IN UINT32 Instance, >=20 > + IN CONST EFI_GUID *CallerId, >=20 > + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL >=20 > + ) >=20 > +{ >=20 > + UINT32 PostCodeValue; >=20 > + >=20 > + PostCodeValue =3D GetPostCodeFromStatusCode (CodeType, Value); >=20 > + if (PostCodeValue !=3D 0) { >=20 > + DEBUG ((EFI_D_INFO, "POSTCODE=3D<%02x>\n", PostCodeValue)); >=20 > + PostCode (PostCodeValue); >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Constructor function of PeiPostCodeStatusCodeHandlerLib. >=20 > + >=20 > + This function is the constructor function of this PostCode Status Code > Handler Library for PEI Phase. >=20 > + It check whether need post code, and register it to > gEfiPeiRscHandlerPpiGuid. >=20 > + >=20 > + @param FileHandle Handle of the file being invoked. >=20 > + @param PeiServices Describes the list of possible PEI Services. >=20 > + >=20 > + @retval EFI_SUCESS The entry point of DXE IPL PEIM executes successfu= lly. >=20 > + >=20 > +**/ >=20 > +RETURN_STATUS >=20 > +EFIAPI >=20 > +PeiPostCodeStatusCodeHandlerLibConstructor ( >=20 > + IN EFI_PEI_FILE_HANDLE FileHandle, >=20 > + IN CONST EFI_PEI_SERVICES **PeiServices >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + EFI_PEI_RSC_HANDLER_PPI *RscHandlerPpi; >=20 > + >=20 > + if (!PcdGetBool (PcdStatusCodeUsePostCode)) { >=20 > + return RETURN_SUCCESS; >=20 > + } >=20 > + >=20 > + Status =3D PeiServicesLocatePpi ( >=20 > + &gEfiPeiRscHandlerPpiGuid, >=20 > + 0, >=20 > + NULL, >=20 > + (VOID **) &RscHandlerPpi >=20 > + ); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > + >=20 > + Status =3D RscHandlerPpi->Register (PostCodeStatusCodeReportWorker); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > + >=20 > + return RETURN_SUCCESS; >=20 > +} >=20 > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.inf > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.inf > new file mode 100644 > index 0000000000..c27578fe90 > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/PeiPostCodeStatusCodeHandlerLib.inf > @@ -0,0 +1,49 @@ > +## @file >=20 > +# PostCode status code implementation. >=20 > +# >=20 > +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
>=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +# vendor. This file may not be modified, except as allowed by >=20 > +# additional terms of your license agreement. >=20 > +# >=20 > +## >=20 > + >=20 > +[Defines] >=20 > + INF_VERSION =3D 0x00010005 >=20 > + BASE_NAME =3D PeiPostCodeStatusCodeHandlerLib >=20 > + FILE_GUID =3D FA32350A-63DB-4AC6-88D1-BC5327EE7EC= E >=20 > + MODULE_TYPE =3D PEIM >=20 > + CONSTRUCTOR =3D PeiPostCodeStatusCodeHandlerLibCons= tructor >=20 > + LIBRARY_CLASS =3D StatusCodeHandlerLib|SEC PEIM PEI_C= OR >=20 > + >=20 > +# >=20 > +# The following information is for reference only and not required by th= e > build tools. >=20 > +# >=20 > +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC (EBC is only for b= uild) >=20 > +# >=20 > + >=20 > +[Sources] >=20 > + PeiPostCodeStatusCodeHandlerLib.c >=20 > + >=20 > +[Packages] >=20 > + MdePkg/MdePkg.dec >=20 > + MdeModulePkg/MdeModulePkg.dec >=20 > + PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dec >=20 > + >=20 > +[LibraryClasses] >=20 > + PeiServicesLib >=20 > + DebugLib >=20 > + PcdLib >=20 > + ReportStatusCodeLib >=20 > + PostCodeMapLib >=20 > + PostCodeLib >=20 > + >=20 > +[Pcd] >=20 > + > gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode > ## CONSUMES >=20 > + >=20 > +[Ppis] >=20 > + gEfiPeiRscHandlerPpiGuid ## CONSUMES >=20 > + >=20 > +[Depex] >=20 > + TRUE >=20 > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.c > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.c > new file mode 100644 > index 0000000000..59b531fe7c > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.c > @@ -0,0 +1,188 @@ > +/** @file >=20 > + PostCode status code implementation. >=20 > + >=20 > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
>=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > + >=20 > +#include >=20 > +#include >=20 > + >=20 > +EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol =3D NULL; >=20 > +EFI_EVENT mExitBootServicesEvent =3D NULL; >=20 > +BOOLEAN mRegisted =3D FALSE; >=20 > + >=20 > +/** >=20 > + Convert status code value and write data to post code. >=20 > + >=20 > + @param CodeType Indicates the type of status code being repor= ted. >=20 > + @param Value Describes the current status of a hardware or >=20 > + software entity. This includes information ab= out the class and >=20 > + subclass that is used to classify the entity = as well as an > operation. >=20 > + For progress codes, the operation is the curr= ent activity. >=20 > + For error codes, it is the exception.For debu= g codes,it is not > defined at this time. >=20 > + @param Instance The enumeration of a hardware or software ent= ity > within >=20 > + the system. A system may contain multiple ent= ities that match > a class/subclass >=20 > + pairing. The instance differentiates between = them. An > instance of 0 indicates >=20 > + that instance information is unavailable, not= meaningful, or > not relevant. >=20 > + Valid instance numbers start with 1. >=20 > + @param CallerId This optional parameter may be used to identi= fy the > caller. >=20 > + This parameter allows the status code driver = to apply different > rules to >=20 > + different callers. >=20 > + @param Data This optional parameter may be used to pass > additional data. >=20 > + >=20 > + @retval EFI_SUCCESS Status code reported to post code successfull= y. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +PostCodeStatusCodeReportWorker ( >=20 > + IN EFI_STATUS_CODE_TYPE CodeType, >=20 > + IN EFI_STATUS_CODE_VALUE Value, >=20 > + IN UINT32 Instance, >=20 > + IN EFI_GUID *CallerId, >=20 > + IN EFI_STATUS_CODE_DATA *Data OPTIONAL >=20 > + ) >=20 > +{ >=20 > + UINT32 PostCodeValue; >=20 > + >=20 > + PostCodeValue =3D GetPostCodeFromStatusCode (CodeType, Value); >=20 > + if (PostCodeValue !=3D 0) { >=20 > + DEBUG ((EFI_D_INFO, "POSTCODE=3D<%02x>\n", PostCodeValue)); >=20 > + PostCode (PostCodeValue); >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Unregister status code callback functions only available at boot time = from >=20 > + report status code router when exiting boot services. >=20 > + >=20 > + @param Event Event whose notification function is being invok= ed. >=20 > + @param Context Pointer to the notification function's context, = which is >=20 > + always zero in current implementation. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +UnregisterPostCodeBootTimeHandlers ( >=20 > + IN EFI_EVENT Event, >=20 > + IN VOID *Context >=20 > + ) >=20 > +{ >=20 > + if (mRegisted) { >=20 > + mRscHandlerProtocol->Unregister (PostCodeStatusCodeReportWorker); >=20 > + } >=20 > +} >=20 > + >=20 > + >=20 > + >=20 > +/** >=20 > + Register status code callback function only when Report Status Code > protocol >=20 > + is installed. >=20 > + >=20 > + @param Event Event whose notification function is being invok= ed. >=20 > + @param Context Pointer to the notification function's context, = which is >=20 > + always zero in current implementation. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +RegisterPostCodeBootTimeHandlers ( >=20 > + IN EFI_EVENT Event, >=20 > + IN VOID *Context >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + >=20 > + Status =3D gBS->LocateProtocol ( >=20 > + &gEfiRscHandlerProtocolGuid, >=20 > + NULL, >=20 > + (VOID **) &mRscHandlerProtocol >=20 > + ); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > + >=20 > + mRscHandlerProtocol->Register (PostCodeStatusCodeReportWorker, > TPL_HIGH_LEVEL); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > + mRegisted =3D TRUE; >=20 > + >=20 > + Status =3D gBS->CreateEventEx ( >=20 > + EVT_NOTIFY_SIGNAL, >=20 > + TPL_NOTIFY, >=20 > + UnregisterPostCodeBootTimeHandlers, >=20 > + NULL, >=20 > + &gEfiEventExitBootServicesGuid, >=20 > + &mExitBootServicesEvent >=20 > + ); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > +} >=20 > + >=20 > +/** >=20 > + Constructor function of RuntimeDxePostCodeStatusCodeHandlerLib. >=20 > + >=20 > + This function allocates memory for extended status code data, caches >=20 > + the report status code service, and registers events. >=20 > + >=20 > + @param ImageHandle The firmware allocated handle for the EFI image. >=20 > + @param SystemTable A pointer to the EFI System Table. >=20 > + >=20 > + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +RuntimeDxePostCodeStatusCodeHandlerLibConstructor ( >=20 > + IN EFI_HANDLE ImageHandle, >=20 > + IN EFI_SYSTEM_TABLE *SystemTable >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + EFI_EVENT RegisterStatusCodeHandlerEvent; >=20 > + VOID *Registration; >=20 > + >=20 > + if (!PcdGetBool (PcdStatusCodeUsePostCode)) { >=20 > + return EFI_SUCCESS; >=20 > + } >=20 > + >=20 > + Status =3D gBS->LocateProtocol ( >=20 > + &gEfiRscHandlerProtocolGuid, >=20 > + NULL, >=20 > + (VOID **) &mRscHandlerProtocol >=20 > + ); >=20 > + >=20 > + if (!EFI_ERROR (Status)) { >=20 > + RegisterPostCodeBootTimeHandlers (NULL, NULL); >=20 > + } else { >=20 > + Status =3D gBS->CreateEvent ( >=20 > + EVT_NOTIFY_SIGNAL, >=20 > + TPL_NOTIFY, >=20 > + RegisterPostCodeBootTimeHandlers, >=20 > + NULL, >=20 > + &RegisterStatusCodeHandlerEvent >=20 > + ); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > + >=20 > + // >=20 > + // Register for protocol notifications on this event >=20 > + // >=20 > + Status =3D gBS->RegisterProtocolNotify ( >=20 > + &gEfiRscHandlerProtocolGuid, >=20 > + RegisterStatusCodeHandlerEvent, >=20 > + &Registration >=20 > + ); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.inf > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.inf > new file mode 100644 > index 0000000000..21012980fe > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/RuntimeDxePostCodeStatusCodeHandlerLib.inf > @@ -0,0 +1,51 @@ > +## @file >=20 > +# PostCode status code implementation. >=20 > +# >=20 > +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
>=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +# vendor. This file may not be modified, except as allowed by >=20 > +# additional terms of your license agreement. >=20 > +# >=20 > +## >=20 > + >=20 > +[Defines] >=20 > + INF_VERSION =3D 0x00010005 >=20 > + BASE_NAME =3D RuntimeDxePostCodeStatusCodeHandler= Lib >=20 > + FILE_GUID =3D FC4F3901-3E9B-4CA3-AB6C-1B65E9AA696= 0 >=20 > + MODULE_TYPE =3D DXE_RUNTIME_DRIVER >=20 > + VERSION_STRING =3D 1.0 >=20 > + CONSTRUCTOR =3D > RuntimeDxePostCodeStatusCodeHandlerLibConstructor >=20 > + LIBRARY_CLASS =3D StatusCodeHandlerLib|DXE_RUNTIME_DR= IVER >=20 > + >=20 > +# >=20 > +# The following information is for reference only and not required by th= e > build tools. >=20 > +# >=20 > +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC (EBC is only for b= uild) >=20 > +# >=20 > + >=20 > +[Sources] >=20 > + RuntimeDxePostCodeStatusCodeHandlerLib.c >=20 > + >=20 > +[Packages] >=20 > + MdePkg/MdePkg.dec >=20 > + MdeModulePkg/MdeModulePkg.dec >=20 > + PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dec >=20 > + >=20 > +[LibraryClasses] >=20 > + UefiBootServicesTableLib >=20 > + UefiRuntimeLib >=20 > + DebugLib >=20 > + PcdLib >=20 > + ReportStatusCodeLib >=20 > + PostCodeMapLib >=20 > + PostCodeLib >=20 > + >=20 > +[Pcd] >=20 > + > gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode > ## CONSUMES >=20 > + >=20 > +[Protocols] >=20 > + gEfiRscHandlerProtocolGuid ## CONSUMES >=20 > + >=20 > +[Depex] >=20 > + TRUE >=20 > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.c > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.c > new file mode 100644 > index 0000000000..efd3a7ee6f > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.c > @@ -0,0 +1,141 @@ > +/** @file >=20 > + PostCode status code implementation. >=20 > + >=20 > + Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
>=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > + >=20 > +#include >=20 > +#include >=20 > + >=20 > + >=20 > +/** >=20 > + Convert status code value and write data to post code. >=20 > + >=20 > + @param CodeType Indicates the type of status code being repor= ted. >=20 > + @param Value Describes the current status of a hardware or >=20 > + software entity. This includes information ab= out the class and >=20 > + subclass that is used to classify the entity = as well as an > operation. >=20 > + For progress codes, the operation is the curr= ent activity. >=20 > + For error codes, it is the exception.For debu= g codes,it is not > defined at this time. >=20 > + @param Instance The enumeration of a hardware or software ent= ity > within >=20 > + the system. A system may contain multiple ent= ities that match > a class/subclass >=20 > + pairing. The instance differentiates between = them. An > instance of 0 indicates >=20 > + that instance information is unavailable, not= meaningful, or > not relevant. >=20 > + Valid instance numbers start with 1. >=20 > + @param CallerId This optional parameter may be used to identi= fy the > caller. >=20 > + This parameter allows the status code driver = to apply different > rules to >=20 > + different callers. >=20 > + @param Data This optional parameter may be used to pass > additional data. >=20 > + >=20 > + @retval EFI_SUCCESS Status code reported to post code successfull= y. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +PostCodeStatusCodeReportWorker ( >=20 > + IN EFI_STATUS_CODE_TYPE CodeType, >=20 > + IN EFI_STATUS_CODE_VALUE Value, >=20 > + IN UINT32 Instance, >=20 > + IN EFI_GUID *CallerId, >=20 > + IN EFI_STATUS_CODE_DATA *Data OPTIONAL >=20 > + ) >=20 > +{ >=20 > + UINT32 PostCodeValue; >=20 > + >=20 > + PostCodeValue =3D GetPostCodeFromStatusCode (CodeType, Value); >=20 > + if (PostCodeValue !=3D 0) { >=20 > + DEBUG ((EFI_D_INFO, "POSTCODE=3D<%02x>\n", PostCodeValue)); >=20 > + PostCode (PostCodeValue); >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Register status code callback function only when Report Status Code > protocol >=20 > + is installed. >=20 > + >=20 > + @param Protocol Points to the protocol's unique identifier. >=20 > + @param Interface Points to the interface instance. >=20 > + @param Handle The handle on which the interface was installed. >=20 > + >=20 > + @retval EFI_SUCCESS Notification runs successfully. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +RegisterPostCodeBootTimeHandlers ( >=20 > + IN CONST EFI_GUID *Protocol, >=20 > + IN VOID *Interface, >=20 > + IN EFI_HANDLE Handle >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + EFI_SMM_RSC_HANDLER_PROTOCOL *RscHandlerProtocol; >=20 > + >=20 > + Status =3D gSmst->SmmLocateProtocol ( >=20 > + &gEfiSmmRscHandlerProtocolGuid, >=20 > + NULL, >=20 > + (VOID **) &RscHandlerProtocol >=20 > + ); >=20 > + ASSERT_EFI_ERROR (Status); >=20 > + >=20 > + RscHandlerProtocol->Register (PostCodeStatusCodeReportWorker); >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > +/** >=20 > + Constructor function of SmmPostCodeStatusCodeHandlerLib. >=20 > + >=20 > + This function allocates memory for extended status code data, caches >=20 > + the report status code service, and registers events. >=20 > + >=20 > + @param ImageHandle The firmware allocated handle for the EFI image. >=20 > + @param SystemTable A pointer to the EFI System Table. >=20 > + >=20 > + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +SmmPostCodeStatusCodeHandlerLibConstructor ( >=20 > + IN EFI_HANDLE ImageHandle, >=20 > + IN EFI_SYSTEM_TABLE *SystemTable >=20 > + ) >=20 > +{ >=20 > + EFI_STATUS Status; >=20 > + VOID *Registration; >=20 > + EFI_SMM_RSC_HANDLER_PROTOCOL *RscHandlerProtocol; >=20 > + >=20 > + if (!PcdGetBool (PcdStatusCodeUsePostCode)) { >=20 > + return EFI_SUCCESS; >=20 > + } >=20 > + >=20 > + Status =3D gSmst->SmmLocateProtocol ( >=20 > + &gEfiSmmRscHandlerProtocolGuid, >=20 > + NULL, >=20 > + (VOID **) &RscHandlerProtocol >=20 > + ); >=20 > + if (!EFI_ERROR (Status)) { >=20 > + RegisterPostCodeBootTimeHandlers (NULL, NULL, NULL); >=20 > + } else { >=20 > + gSmst->SmmRegisterProtocolNotify ( >=20 > + &gEfiSmmRscHandlerProtocolGuid, >=20 > + RegisterPostCodeBootTimeHandlers, >=20 > + &Registration >=20 > + ); >=20 > + } >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.inf > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.inf > new file mode 100644 > index 0000000000..7cc357fd49 > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Library/PostCodeS > tatusCodeHandlerLib/SmmPostCodeStatusCodeHandlerLib.inf > @@ -0,0 +1,50 @@ > +## @file >=20 > +# PostCode status code implementation. >=20 > +# >=20 > +# Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
>=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +# vendor. This file may not be modified, except as allowed by >=20 > +# additional terms of your license agreement. >=20 > +# >=20 > +## >=20 > + >=20 > +[Defines] >=20 > + INF_VERSION =3D 0x00010005 >=20 > + BASE_NAME =3D SmmPostCodeStatusCodeHandlerLib >=20 > + FILE_GUID =3D AE5C0A80-309A-42F7-BFDD-80CDA1BA2D7= E >=20 > + MODULE_TYPE =3D DXE_SMM_DRIVER >=20 > + VERSION_STRING =3D 1.0 >=20 > + CONSTRUCTOR =3D > SmmPostCodeStatusCodeHandlerLibConstructor >=20 > + LIBRARY_CLASS =3D StatusCodeHandlerLib|DXE_SMM_DRIVER >=20 > + >=20 > +# >=20 > +# The following information is for reference only and not required by th= e > build tools. >=20 > +# >=20 > +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC (EBC is only for b= uild) >=20 > +# >=20 > + >=20 > +[Sources] >=20 > + SmmPostCodeStatusCodeHandlerLib.c >=20 > + >=20 > +[Packages] >=20 > + MdePkg/MdePkg.dec >=20 > + MdeModulePkg/MdeModulePkg.dec >=20 > + PostCodeDebugFeaturePkg/PostCodeDebugFeaturePkg.dec >=20 > + >=20 > +[LibraryClasses] >=20 > + SmmServicesTableLib >=20 > + DebugLib >=20 > + PcdLib >=20 > + ReportStatusCodeLib >=20 > + PostCodeMapLib >=20 > + PostCodeLib >=20 > + >=20 > +[Pcd] >=20 > + > gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode > ## CONSUMES >=20 > + >=20 > +[Protocols] >=20 > + gEfiSmmRscHandlerProtocolGuid ## CONSUMES >=20 > + >=20 > +[Depex] >=20 > + TRUE >=20 > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFe > aturePkg.dec > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFe > aturePkg.dec > new file mode 100644 > index 0000000000..7d0e474965 > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFe > aturePkg.dec > @@ -0,0 +1,32 @@ > +## @file >=20 > +# This package provides PostCode Debug feature. >=20 > +# This package should only depend on EDK II Core packages, IntelSiliconP= kg, > and MinPlatformPkg. >=20 > +# >=20 > +# The DEC files are used by the utilities that parse DSC and >=20 > +# INF files to generate AutoGen.c and AutoGen.h files >=20 > +# for the build infrastructure. >=20 > +# >=20 > +# Copyright (c) 2020, Intel Corporation. All rights reserved.
>=20 > +# >=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +## >=20 > + >=20 > +[Defines] >=20 > + DEC_SPECIFICATION =3D 0x00010017 >=20 > + PACKAGE_NAME =3D PostCodeDebugFeaturePkg >=20 > + PACKAGE_GUID =3D A579E0A8-0D27-4CA6-900E-D613003729DE >=20 > + PACKAGE_VERSION =3D 0.1 >=20 > + >=20 > +[Includes] >=20 > + Include >=20 > + >=20 > +[LibraryClasses] >=20 > + ## @libraryclass Provide the function to map the status code to p= ost > code. >=20 > + PostCodeMapLib|Include/Library/PostCodeMapLib.h >=20 > + >=20 > +[Guids] >=20 > + gPostCodeDebugFeaturePkgTokenSpaceGuid =3D {0x68886ac8, 0x7a29, > 0x4845, {0xa7, 0x02, 0xe9, 0x83, 0xc8, 0x7f, 0xfb, 0xab}} >=20 > + >=20 > +[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] >=20 > + > gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode| > TRUE|BOOLEAN|0x00000001 >=20 > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFe > aturePkg.dsc > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFe > aturePkg.dsc > new file mode 100644 > index 0000000000..4f0bec4a6f > --- /dev/null > +++ > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/PostCodeDebugFe > aturePkg.dsc > @@ -0,0 +1,30 @@ > +## @file >=20 > +# This package provides PostCode Debug feature. >=20 > +# This package should only depend on EDK II Core packages, IntelSiliconP= kg, > and MinPlatformPkg. >=20 > +# >=20 > +# The DEC files are used by the utilities that parse DSC and >=20 > +# INF files to generate AutoGen.c and AutoGen.h files >=20 > +# for the build infrastructure. >=20 > +# >=20 > +# Copyright (c) 2020, Intel Corporation. All rights reserved.
>=20 > +# >=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +## >=20 > + >=20 > +[Defines] >=20 > + PLATFORM_NAME =3D PostCodeFeaturePkg >=20 > + PLATFORM_GUID =3D 4ADE0B1A-7929-495D-A221-6576C7884CA= C >=20 > + PLATFORM_VERSION =3D 0.1 >=20 > + DSC_SPECIFICATION =3D 0x00010005 >=20 > + OUTPUT_DIRECTORY =3D Build/$(PLATFORM_NAME) >=20 > + SUPPORTED_ARCHITECTURES =3D IA32|X64 >=20 > + BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT >=20 > + SKUID_IDENTIFIER =3D DEFAULT >=20 > + PEI_ARCH =3D IA32 >=20 > + DXE_ARCH =3D X64 >=20 > + >=20 > +# >=20 > +# This package always builds the feature. >=20 > +# >=20 > +!include Include/PostCodeDebugFeature.dsc >=20 > diff --git > a/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Readme.md > b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Readme.md > new file mode 100644 > index 0000000000..c49db35999 > --- /dev/null > +++ b/Features/Intel/Debugging/PostCodeDebugFeaturePkg/Readme.md > @@ -0,0 +1,117 @@ > +# Overview >=20 > +* **Feature Name:** Post Code Debug >=20 > +* **PI Phase(s) Supported:** PEI, DXE, SMM >=20 > +* **SMM Required?** Yes >=20 > + >=20 > +More Information: >=20 > + >=20 > +## Purpose >=20 > +The PostCodeDebugFeaturePkg include some useful post code debug > libraries, such as get post code from status code and show it. >=20 > +This is an important capability in firmware development to get and analy= ze > the post code. >=20 > + >=20 > + >=20 > +# High-Level Theory of Operation >=20 > +It provide a library PostCodeStatusCodeHandlerLib used by edk2 > StatusCodeHandler.efi, used to show the post code. >=20 > +It also provide a library of PostCodeMap lib, it map the status code to = post > code. >=20 > +A library of PostCode lib is needed by platform. >=20 > + >=20 > +In the library contstructor function, PostCodeStatusCodeHandlerLib regis= ter > the call back function for ReportStatusCode. >=20 > +When called, it call GetPostCodeFromStatusCode() in PostCodeMapLib to > get post code from status code, and call PostCode() in PostCodeLib to sho= w > the post code. >=20 > + >=20 > +PostCodeStatusCodeHandlerLib include 3 libraries for PEI, RuntimeDxe, > SMM: >=20 > +* PeiPostCodeStatusCodeHandlerLib >=20 > +* RuntimeDxePostCodeStatusCodeHandlerLib >=20 > +* SmmPostCodeStatusCodeHandlerLib >=20 > + >=20 > +## Firmware Volumes >=20 > +Linked with StatusCodeHandler.efi, and make sure put the > StatusCodeHandler.efi after the ReportStatusCodeRouter.efi. >=20 > + >=20 > +## Modules >=20 > +* PostCodeStatusCodeHandlerLib >=20 > +* PostCodeMapLib >=20 > + >=20 > +## PostCodeStatusCodeHandlerLib >=20 > +This library register the call back function for ReportStatusCode, and g= et > post code from status code, and show post code. >=20 > + >=20 > +## PostCodeMapLib >=20 > +This library provide a function to get post code from status code. >=20 > + >=20 > +## Key Functions >=20 > +* In PeiPostCodeStatusCodeHandlerLib: >=20 > + EFI_STATUS >=20 > + EFIAPI >=20 > + PostCodeStatusCodeReportWorker ( >=20 > + IN CONST EFI_PEI_SERVICES **PeiServices, >=20 > + IN EFI_STATUS_CODE_TYPE CodeType, >=20 > + IN EFI_STATUS_CODE_VALUE Value, >=20 > + IN UINT32 Instance, >=20 > + IN CONST EFI_GUID *CallerId, >=20 > + IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL >=20 > + ) >=20 > + >=20 > +* In RuntimeDxePostCodeStatusCodeHandlerLib: >=20 > + EFI_STATUS >=20 > + EFIAPI >=20 > + PostCodeStatusCodeReportWorker ( >=20 > + IN EFI_STATUS_CODE_TYPE CodeType, >=20 > + IN EFI_STATUS_CODE_VALUE Value, >=20 > + IN UINT32 Instance, >=20 > + IN EFI_GUID *CallerId, >=20 > + IN EFI_STATUS_CODE_DATA *Data OPTIONAL >=20 > + ) >=20 > + >=20 > +* In SmmPostCodeStatusCodeHandlerLib: >=20 > + EFI_STATUS >=20 > + EFIAPI >=20 > + PostCodeStatusCodeReportWorker ( >=20 > + IN EFI_STATUS_CODE_TYPE CodeType, >=20 > + IN EFI_STATUS_CODE_VALUE Value, >=20 > + IN UINT32 Instance, >=20 > + IN EFI_GUID *CallerId, >=20 > + IN EFI_STATUS_CODE_DATA *Data OPTIONAL >=20 > + ) >=20 > + >=20 > +* In PostCodeMapLib: >=20 > + UINT32 >=20 > + EFIAPI >=20 > + GetPostCodeFromStatusCode ( >=20 > + IN EFI_STATUS_CODE_TYPE CodeType, >=20 > + IN EFI_STATUS_CODE_VALUE Value >=20 > + ) >=20 > + >=20 > +## Configuration >=20 > +* Link the library to StatusCodeHandler.efi. >=20 > + Example: >=20 > + > MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHan > dlerRuntimeDxe.inf { >=20 > + >=20 > + > NULL|PostCodeDebugFeaturePkg/Library/PostCodeStatusCodeHandlerLib/R > untimeDxePostCodeStatusCodeHandlerLib.inf >=20 > + } >=20 > + Refer to PostCodeDebugFeature.dsc for other example. >=20 > +* Config PCD > gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode. >=20 > + In platform .dsc file, need to config the type of > gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode. >=20 > + Use PcdsFixedAtBuild to save binary size, and use PcdsDynamic if want = to > enable/disable in runtime. >=20 > +* Implemented platform's special PostCodeMapLib if needed. >=20 > +* Provide the platform's special PostCodeLib. >=20 > +* Make sure put the StatusCodeHandler.efi after the > ReportStatusCodeRouter.efi. >=20 > + >=20 > +## Data Flows >=20 > +Status Code (ReportStatusCode) -> Post Code > (GetPostCodeFromStatusCode). >=20 > + >=20 > +## Control Flows >=20 > +ReportStatusCode() -> PostCodeStatusCodeReportWorker() -> > GetPostCodeFromStatusCode() -> PostCode() >=20 > + >=20 > +## Build Flows >=20 > +There is not special build flows. >=20 > + >=20 > +## Test Point Results >=20 > +Verify the post code shown is correct. >=20 > + >=20 > +## Functional Exit Criteria >=20 > +N/A >=20 > + >=20 > +## Feature Enabling Checklist >=20 > +* Set the PCD > gPostCodeDebugFeaturePkgTokenSpaceGuid.PcdStatusCodeUsePostCode > to TRUE. >=20 > +* The post code can be shown. >=20 > + >=20 > +## Common Optimizations >=20 > +* Implemented platform's special PostCodeMapLib if needed. >=20 > -- > 2.24.0.windows.2