From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.28946.1684260062692197817 for ; Tue, 16 May 2023 11:01:03 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=LYvjZaGy; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: michael.d.kinney@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684260062; x=1715796062; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=/V4p0up1j2PruyumtHdmuKehzuHCY0HFXNH+JR3mAEM=; b=LYvjZaGyrqAakSpmgA0+5NfEzaO/X0zQNz4mgknM/W6Tsq2DHrSB2kX5 sgzWQwl0x0WoJCyhQ5RwjBksPhEjsaEiPBfXjcoeTTEiMLm0O7TJV0zRE KPIqNrsjt0+8KnMDdCudRjWZ6UYgBCbh+73qW42d3OCNyxa1cEjEsU5YN CSvFX3sQpoEnSVp4b3Vzen6E/w8q12PIEYQhwyN1ISTHyqTH+npmSzXTs V6g4gfbaEjRaMMWiNB+3VeCDu36hgjRh0gHY3l2om+kytmL3yy2ZPJXbg gq0yXetcq3xLHPeY8W2PshdZLmPJY7HFU4He3I+5cj4FHtS87dT0uQ14r Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10712"; a="331167355" X-IronPort-AV: E=Sophos;i="5.99,278,1677571200"; d="scan'208";a="331167355" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2023 11:00:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10712"; a="947938916" X-IronPort-AV: E=Sophos;i="5.99,278,1677571200"; d="scan'208";a="947938916" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga006.fm.intel.com with ESMTP; 16 May 2023 11:00:59 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 16 May 2023 11:00:58 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Tue, 16 May 2023 11:00:58 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.45) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Tue, 16 May 2023 11:00:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m47ijhodbJadDXAEe16+Z0kgD3Vs2Y0HqwEnUalEmQP9cIkZhctXtYL5Zbgi2gjFTYHD2eDcRtYLBHhZ9U/LCPmvgU0TIPovjgvJup1lC2ZAlRFdxS8hrSGKYzeOHiC+JL+NGFW/t16A6NVlNTIqSpXBG5A4XY8XldyFY1WYsXX7jGNcFvnrN642ruo9mu2/OzHVq6dfuDw3V2jPicjP8ErlaDf8hxswwsoq9kO32E86AX3pRfRdkVNUtaI1Ml3PHKlOt4zTXIaIJrVKtj++pbUFMMZSZYkoTGOn5cD6duMX30TbgpTM/cLR61IlwPwvueiOVrYS+1zegHBE3SkG4A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7zA8kANp5YXDNCct0rGTXnMmZgRW29PK0DbGsV+mzSQ=; b=exqaZ5yl0Bmh9DnR4yeznc1j3H99bC6TyUDrja/rU3LlVThb5H7wi+WHw2r2+dQw4aXNQP5gWaBT80xL65d/HMzSNf3RAUVI0FuouuYnE2AX3RkNJFIq7xv4qIUh7j9izX0o2jtv0cxEieF+bcKwT4Jc8YqnGVutbyXEJ2LzjFpUEGDpZgE9mqqtG/SQuZ8GrKYcsFkk4DAsExQ5bjPABxsDPMXwZTqxl7DfCrOMoovRu9O+CNYuv2Kd1JyQMOxiwWOsKjCIaptFKghxrI9WaYI2sCzirfeMTidr7p/ikaTJmGZUxiIxbd7DhhSOI/b5DH5Ozcv5TPSBOLKVPjg87A== 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 Received: from CO1PR11MB4929.namprd11.prod.outlook.com (2603:10b6:303:6d::19) by PH7PR11MB7571.namprd11.prod.outlook.com (2603:10b6:510:27e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.20; Tue, 16 May 2023 18:00:50 +0000 Received: from CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::6e8f:1c7:b499:a84d]) by CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::6e8f:1c7:b499:a84d%4]) with mapi id 15.20.6387.032; Tue, 16 May 2023 18:00:50 +0000 From: "Michael D Kinney" To: "devel@edk2.groups.io" , "Oram, Isaac W" CC: "Wang, Jian J" , "Gao, Liming" , "Zimmer, Vincent" , "Chiu, Chasel" , "Kinney, Michael D" Subject: Re: [edk2-devel][edk2-platforms][RFC PATCH V1 1/1] MdeModulePkg/StatusCodeHandlerSmm: Add debug strings to memory buffering Thread-Topic: [edk2-devel][edk2-platforms][RFC PATCH V1 1/1] MdeModulePkg/StatusCodeHandlerSmm: Add debug strings to memory buffering Thread-Index: AQHZiB1ag759tAmV10+lArq1OIsZ969dMCmQ Date: Tue, 16 May 2023 18:00:49 +0000 Message-ID: References: <175FB03665B4DC78.20583@groups.io> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CO1PR11MB4929:EE_|PH7PR11MB7571:EE_ x-ms-office365-filtering-correlation-id: f5b11b25-105a-45b8-410f-08db56377b8c x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RGjWcRUrDzplQNKRffGsbX5hDMyfoRT2NhnOEtUzFVz6h0Fy8JuVn2TQDe7fhnQQbvPAf3TgXI8JaiYVkg/2pM0Qj/JdJLQKOQ6yVoQyMyIPDJgcRZ1fOi+a+NF7TCS/THADP0V1eZXpyN8aGZglZuB+M6zxmMQuGk9T/bw5Tdge9hBgO0t6LyF1ztM2EUojIfGH0PUu9EAPeq/BEkGjdvKWMYtSDqhcLcxCmIiv2HTKuqgxaybT/v3hk1sJk8T0QH5H6Qh2eDZG6kL4DicLsR2ftdI15jvpLF0xsRIjXYsUPF6DAnZpt7+x2mE2Mdb34ACWeJwzt64CIwVxc6qi8RjG4ScY16tcMYNONA1ILfAU2WRcyYwN4GDkwkAkL3OrQwc9CrLGMqj/yn3kCghkfQjb0uq45zxp6mZ1Ah0cp1uuNOTC9tBEH3eYBQucRfboNGXJABZm/9V1XrQVBPQYlwpQyunrddASoT/eZJVGzXD3QDFsfSxpre1oPUMAu12wjbmsYNRdgKiopU0hUVJ13xPHqKs3UMSyOiACD+OtQKhabwldRc9N1JmAhdT22ouiJc1Qcbw4mTWA5hPuJJdUKYRc8D9C+IEJIZz2WZPguCcykVGLctsDKGI3q+zZJcHX2TwAqx1tqHAfIFJoKynN2w== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR11MB4929.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(376002)(39860400002)(366004)(396003)(136003)(451199021)(86362001)(55016003)(66899021)(83380400001)(76116006)(66476007)(66946007)(478600001)(66446008)(110136005)(33656002)(316002)(8676002)(8936002)(54906003)(2906002)(4326008)(5660300002)(41300700001)(6636002)(64756008)(53546011)(52536014)(66556008)(9686003)(6506007)(71200400001)(966005)(107886003)(7696005)(82960400001)(38100700002)(26005)(186003)(122000001)(38070700005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?thkE0EVAm21Esxmd8XQLneeivQBrjn/iuLDzs0Jyn/6I8YL4uGI697K6mH/Z?= =?us-ascii?Q?QXYWEP0b7ViwxoEiNv3moJEVkQh10N/97KWY+jcBnTYPTIwzndtX1t5JNTAb?= =?us-ascii?Q?WNskB4lr0e9ON9ZKYjAZKoz7YCGQH6WVTFTfrofs2RBIrww0lWUnvbbAGztC?= =?us-ascii?Q?QC6FAzNfDYDoDzouYoVp0YKxI1Mhstj5H8+ljnvJ2kZNM1gyoojcgusj8mcs?= =?us-ascii?Q?Tn8eVa1VFV2qO/T4vO5lNRL3biw8NloG62JpOgqqDsqV7z4+c82F/PFy2yH5?= =?us-ascii?Q?sIXor66wRt6Ae3FWKIw/PFxad5s07lBOaX+0BaDqgpe8LAptmILz/dGiyIbO?= =?us-ascii?Q?xf5/wSTjZU36uOrtacTc8lf09FwfnTzMyWi8UNxEIbdMzLBCRp9+zpeHet7a?= =?us-ascii?Q?j9scYPuJ+qD1EYvxSabgxDR0FW5N83iYuU9pHeuvawBNFaiudp/zmshlKc0N?= =?us-ascii?Q?wLuZuph9oOtQmLKlYb9IUsI1tCxDWSrdUFbOKw8YSrUA/hGxeVLxJqNycbQX?= =?us-ascii?Q?xBpdiaJSpBMprgSRi081R66rxW2PYnndPNIBSFvsCc29rI1DgCSOMRqBhRNE?= =?us-ascii?Q?st0KcYOT7MZI4lgTbVuro/1/+g+kHfm6yhPQ5drLilTWH+2HRPc4YYxD8M1j?= =?us-ascii?Q?uSqqUMoquu6tCT4DJgLEGuyd38rgCuvb9CWFTWKrXzX20wdLVZ4F9NEJ0eqA?= =?us-ascii?Q?6SmAgWsRd5ldebEMZzllM2q8qjMOxGN4u/cKB69VS42tQQBCmenO8OeKIvvI?= =?us-ascii?Q?UWSWqwU7vF3j58jpx6xMErDaw9uNilNvL0X3FG3gLgqHhBOf/NN6izpNOgJi?= =?us-ascii?Q?/kka725c/ZCu4i35GHw16Us76tlt93L2CFLzhoXjg8NOBFhSRUzM6ya3O8OV?= =?us-ascii?Q?shg5yI41DostYR2a515MVOXVw1jDPkYa96X9iNgCZwWklbobN9gKFlR2a5NV?= =?us-ascii?Q?0LU7hVmkxJspuElqcarueiVFEUwwQyg3/TCDavcV+N1FTCDXPJEMizjPDF9V?= =?us-ascii?Q?zzF+V9v/PAGQYJOwh0zZVm7ZJDGKawT3h48DFql21IU4bzSuUhNVHXtdRLd4?= =?us-ascii?Q?FsdWxW+IwhD25CNOXRC/Kqu7oPHkwTHzhD7gZ2pQ6WFLjDczor5CiHwx/ZUD?= =?us-ascii?Q?5HOZK4WP7yLFzwOjg7+iuuazSr32+5JOrzzKPCjdKR8+ujn8RlYW0z3FsUpm?= =?us-ascii?Q?1eC70atTh7wQPQJedQPy5SYTm+t6LKMot15yjy33kDqiPkx+mvT3lilGiZL9?= =?us-ascii?Q?5hZJ1fJ2qLar3xGEMBJdHiUVzyKkxQA5h1mAioMu3jBe/tqaNS1rShPLnrEM?= =?us-ascii?Q?nRbWwILPIBwZQmelfq9B3o+bXnDLrk3IEgQ6tlxEHacyerAi7XUeMvJZcLpv?= =?us-ascii?Q?99r8aJ3wC9gcVya9mjqFf8ABRb/Xsu2pwu9tShWu16LbhzsgXBK8SXlqaHtE?= =?us-ascii?Q?F+nzIk+bAE9lHOEeGU1RvTpZZd3ycctcae2Sox8SulrVkcOYbNpfJkytcR1r?= =?us-ascii?Q?f1gaSGLAhEkbJtULRnbtix2PFrwh4bQruZpBav+JY+LpSCu0tQZ52AnR2gCx?= =?us-ascii?Q?TQQPDzGh+I7AEcxWn9oNr+xA/Mon4RmU22TgMhiW?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4929.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f5b11b25-105a-45b8-410f-08db56377b8c X-MS-Exchange-CrossTenant-originalarrivaltime: 16 May 2023 18:00:49.8578 (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: lQeyyPoc856OqY0YuPFIVjftS/u/R2fbATcePw2zYQIGKn687olPc8QjhZ68aiv3p/vVXuE3sYVJcXdqcys9FeMn2UUQBibYo5MqRP9etfw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB7571 Return-Path: michael.d.kinney@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Isaac, Multiple status code handlers can be registered. One for memory and one fo= r serial. Why would we mix serial into memory one? Mike > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Isaac > Oram > Sent: Tuesday, May 16, 2023 10:39 AM > To: devel@edk2.groups.io; Oram, Isaac W > Cc: Wang, Jian J ; Gao, Liming > ; Zimmer, Vincent ; > Chiu, Chasel > Subject: Re: [edk2-devel][edk2-platforms][RFC PATCH V1 1/1] > MdeModulePkg/StatusCodeHandlerSmm: Add debug strings to memory > buffering >=20 > Apologies, this is edk2 scope, not edk2-platforms. >=20 > This is an RFC to see if this kind of feature is widely interesting and i= f > someone wants to explore this in depth. > This is not a complete or mature implementation. I didn't fully decipher= the > extended data format. >=20 > Regards, > Isaac >=20 > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Isaac > Oram > Sent: Tuesday, May 16, 2023 10:35 AM > To: devel@edk2.groups.io > Cc: Oram, Isaac W ; Wang, Jian J > ; Gao, Liming > Subject: [edk2-devel][edk2-platforms][RFC PATCH V1 1/1] > MdeModulePkg/StatusCodeHandlerSmm: Add debug strings to memory > buffering >=20 > Extend the MemoryStatusCodeWorker functionality to log the debug strings. > In the event of an assert, dump the strings to serial port. > The rationale is that SMI latency is very important. This provides a mea= ns to > log messages quickly (to memory) and dump them in the event of an assert. >=20 > Cc: Jian J Wang > Cc: Liming Gao > Signed-off-by: Isaac Oram > --- > .../Include/Guid/MemoryStatusCodeRecord.h | 7 + > .../Smm/MemoryStatusCodeWorker.c | 199 ++++++++++++++++++ > 2 files changed, 206 insertions(+) >=20 > diff --git a/MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h > b/MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h > index a924c592c9..d37b6304c6 100644 > --- a/MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h > +++ b/MdeModulePkg/Include/Guid/MemoryStatusCodeRecord.h > @@ -10,6 +10,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef > __MEMORY_STATUS_CODE_RECORD_H__ #define > __MEMORY_STATUS_CODE_RECORD_H__ >=20 > +#include > + > /// > /// Global ID used to identify GUIDed HOBs that start with a structure o= f type > /// MEMORY_STATUSCODE_PACKET_HEADER, followed by an array of > structures of type @@ -90,6 +92,11 @@ typedef struct { > /// the system. Valid instance numbers start with the number 1. > /// > UINT32 Instance; > + > + // > + // Extra data > + // > + UINT64 Data[(MAX_EXTENDED_DATA_SIZE / sizeof (UINT64= )) + 1]; > } MEMORY_STATUSCODE_RECORD; >=20 > extern EFI_GUID gMemoryStatusCodeRecordGuid; diff --git > a/MdeModulePkg/Universal/StatusCodeHandler/Smm/MemoryStatusCodeWo > rker.c > b/MdeModulePkg/Universal/StatusCodeHandler/Smm/MemoryStatusCodeW > orker.c > index 80c94e4682..c482c4bd9a 100644 > --- > a/MdeModulePkg/Universal/StatusCodeHandler/Smm/MemoryStatusCodeWo > rker.c > +++ > b/MdeModulePkg/Universal/StatusCodeHandler/Smm/MemoryStatusCodeW > orke > +++ r.c > @@ -11,6 +11,141 @@ >=20 > RUNTIME_MEMORY_STATUSCODE_HEADER *mMmMemoryStatusCodeTable; >=20 > +VOID > +DumpBufferToSerial ( > + VOID > + ); > + > +EFI_STATUS > +EFIAPI > +DumpRecordToSerial ( > + IN EFI_STATUS_CODE_TYPE CodeType, > + IN EFI_STATUS_CODE_VALUE Value, > + IN UINT32 Instance, > + IN EFI_GUID *CallerId, > + IN EFI_STATUS_CODE_DATA *Data OPTIONAL > + ) > +{ > + CHAR8 *Filename; > + CHAR8 *Description; > + CHAR8 *Format; > + CHAR8 Buffer[MAX_EXTENDED_DATA_SIZE + sizeof (UINT64)]; > + UINT32 ErrorLevel; > + UINT32 LineNumber; > + UINTN CharCount; > + BASE_LIST Marker; > + > + Buffer[0] =3D '\0'; > + > + if ((Data !=3D NULL) && > + ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, > + &Filename, &Description, &LineNumber)) { > + // > + // Print ASSERT() information into output buffer. > + // > + CharCount =3D AsciiSPrint ( > + Buffer, > + sizeof (Buffer), > + "\n\rDXE_ASSERT!: %a (%d): %a\n\r", > + Filename, > + LineNumber, > + Description > + ); > + } else if ((Data !=3D NULL) && > + ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, > + &Marker, &Format)) { > + // > + // Print DEBUG() information into output buffer. > + // > + CharCount =3D AsciiBSPrint ( > + Buffer, > + sizeof (Buffer), > + Format, > + Marker > + ); > + } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) =3D=3D EFI_ERROR_COD= E) > { > + // > + // Print ERROR information into output buffer. > + // > + CharCount =3D AsciiSPrint ( > + Buffer, > + sizeof (Buffer), > + "ERROR: C%08x:V%08x I%x", > + CodeType, > + Value, > + Instance > + ); > + ASSERT (CharCount > 0); > + > + if (CallerId !=3D NULL) { > + CharCount +=3D AsciiSPrint ( > + &Buffer[CharCount], > + (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)= ), > + " %g", > + CallerId > + ); > + } > + > + if (Data !=3D NULL) { > + CharCount +=3D AsciiSPrint ( > + &Buffer[CharCount], > + (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)= ), > + " %x", > + Data > + ); > + } > + > + CharCount +=3D AsciiSPrint ( > + &Buffer[CharCount], > + (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCount)), > + "\n\r" > + ); > + } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) =3D=3D > EFI_PROGRESS_CODE) { > + // > + // Print PROGRESS information into output buffer. > + // > + CharCount =3D AsciiSPrint ( > + Buffer, > + sizeof (Buffer), > + "PROGRESS CODE: V%08x I%x\n\r", > + Value, > + Instance > + ); > + } else if ((Data !=3D NULL) && > + CompareGuid (&Data->Type, &gEfiStatusCodeDataTypeStringGuid= ) > && > + (((EFI_STATUS_CODE_STRING_DATA *)Data)->StringType =3D=3D > + EfiStringAscii)) { > + // > + // EFI_STATUS_CODE_STRING_DATA > + // > + CharCount =3D AsciiSPrint ( > + Buffer, > + sizeof (Buffer), > + "%a", > + ((EFI_STATUS_CODE_STRING_DATA *)Data)->String.Ascii > + ); > + } else { > + // > + // Code type is not defined. > + // > + CharCount =3D AsciiSPrint ( > + Buffer, > + sizeof (Buffer), > + "Undefined: C%08x:V%08x I%x\n\r", > + CodeType, > + Value, > + Instance > + ); > + } > + > + // > + // Call SerialPort Lib function to do print. > + // > + SerialPortWrite ((UINT8 *)Buffer, CharCount); > + > + return EFI_SUCCESS; > +} > + > /** > Initialize MM memory status code table as initialization for memory st= atus > code worker >=20 > @@ -69,6 +204,9 @@ MemoryStatusCodeReportWorker ( > ) > { > MEMORY_STATUSCODE_RECORD *Record; > + CHAR8 *Filename; > + CHAR8 *Description; > + UINT32 LineNumber; >=20 > // > // Locate current record buffer. > @@ -82,6 +220,7 @@ MemoryStatusCodeReportWorker ( > Record->CodeType =3D CodeType; > Record->Value =3D Value; > Record->Instance =3D Instance; > + CopyMem (&Record->Data, Data, (Data->HeaderSize + Data->Size)); >=20 > // > // If record index equals to max record number, then wrap around recor= d > index to zero. > @@ -99,5 +238,65 @@ MemoryStatusCodeReportWorker ( > mMmMemoryStatusCodeTable->RecordIndex =3D 0; > } >=20 > + if ((Data !=3D NULL) && ReportStatusCodeExtractAssertInfo (CodeType, V= alue, > Data, &Filename, &Description, &LineNumber)) { > + // Found an assert, dump the buffer > + DumpBufferToSerial (); > + } > + > return EFI_SUCCESS; > } > + > +VOID > +DumpBufferToSerial ( > + VOID > + ) > +{ > + MEMORY_STATUSCODE_RECORD *CurrentRecord; > + UINT32 CurrentIndex; > + UINT32 RecordsToPrint; > + CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH]; > + UINTN CharCount; > + > + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), "Begin dump of SMM > + debug messages\n"); SerialPortWrite ((UINT8 *)Buffer, CharCount); > + > + // > + // Determine number of records to print // > + > + RecordsToPrint =3D mMmMemoryStatusCodeTable->NumberOfRecords; > + > + // > + // Determine first record in case we rolled over. > + // > + if (mMmMemoryStatusCodeTable->NumberOfRecords >=3D > mMmMemoryStatusCodeTable->MaxRecordsNumber) { > + RecordsToPrint =3D mMmMemoryStatusCodeTable->MaxRecordsNumber; > + CurrentIndex =3D mMmMemoryStatusCodeTable->RecordIndex; > + } else { > + RecordsToPrint =3D mMmMemoryStatusCodeTable->NumberOfRecords; > + CurrentIndex =3D 0; > + } > + > + > + // > + // Locate first record. > + // > + CurrentRecord =3D (MEMORY_STATUSCODE_RECORD > *)(mMmMemoryStatusCodeTable > + + 1); CurrentRecord =3D &CurrentRecord[CurrentIndex]; > + > + // > + // Print records > + // > + while (CurrentIndex < RecordsToPrint) { > + DumpRecordToSerial (CurrentRecord->CodeType, CurrentRecord->Value, > CurrentRecord->Instance, NULL, (EFI_STATUS_CODE_DATA *)CurrentRecord- > >Data); > + CurrentIndex++; > + if (CurrentIndex =3D=3D mMmMemoryStatusCodeTable->MaxRecordsNumber) = { > + CurrentIndex =3D 0; > + } > + CurrentRecord =3D (MEMORY_STATUSCODE_RECORD > *)(mMmMemoryStatusCodeTable + 1); > + CurrentRecord =3D &CurrentRecord[CurrentIndex]; } > + > + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), "End dump of SMM > +debug messages\n"); > + SerialPortWrite ((UINT8 *)Buffer, CharCount); } > -- > 2.40.0.windows.1 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20