From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web10.35031.1684273318460224330 for ; Tue, 16 May 2023 14:41:59 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=ZfYHofU3; spf=pass (domain: intel.com, ip: 192.55.52.43, 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=1684273318; x=1715809318; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=SsBMhxulztyIUV6LXprOVWm3tsRGmd16paa+EzMhAms=; b=ZfYHofU31BdZnl5DRRueJPpWHzot3AYFXBMYghReqQAzBXuVCOivxWiC hQOLUHXw2FnfhRkWfiOajDkVGOGQolaj0MvHCh6X5rcUFV1dM1MKlLold p7Q9K35CBhv7EF9s0QUq6Xd5dFYunc90/1L7VRdNhuhdLLaxljurEmsfH rxpnrze0lqaMxnubGw5/wI0SDgvWFtq9o/Rlvu/hP5z+K8p3o51h/PphR IxTPbQSc9yrOBHLOJUG1eoC6Fh6zbYL5K9h7SJbLT+zUtCI8DN3dJBdVI eva2OEsLOxxw6jJBmSIF/XOZ1Zz8tl54sZuIb8UgEMFEWSlv9YqUbDVDY g==; X-IronPort-AV: E=McAfee;i="6600,9927,10712"; a="437944146" X-IronPort-AV: E=Sophos;i="5.99,278,1677571200"; d="scan'208";a="437944146" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2023 14:41:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10712"; a="701508128" X-IronPort-AV: E=Sophos;i="5.99,278,1677571200"; d="scan'208";a="701508128" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga002.jf.intel.com with ESMTP; 16 May 2023 14:41:57 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) 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 14:41:57 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX610.amr.corp.intel.com (10.22.229.23) 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 14:41:56 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) 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 14:41:56 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.101) by edgegateway.intel.com (134.134.137.103) 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 14:41:56 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jqdGlcr3/taweo9e3qAhzquRP6rmrBZSo3P2WFYQgTY/j270pbZfK7x9YEy4xxN6hz1QLRtNws1YQ+yD1c87jo6VOwUYCJpW84RooHU+zRLAJh6JzL6c2Su7gBaN9NLBKqslr1cJfvbMGBqMA8Xbyg9OWAeMueNE3AyDTERdAqKkVJk5LYLAd6W+oDmGWZud5BOLwTo9mAmZHZ9kuEf1Xlpvkb1ZKpihJ1N82H+gS3Gb8jHuPOK+/v/QCGfInoiSW7eGRe0//CnsSpST47JYBoT3FCidhishMQc/dKcoVHRoBZtVNtXoEOU6tYYiVz9AqJt4ezjLrZRq9Ya1R3kcvw== 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=LG+Gw4YOblJ0fYvsCaMh3TuP6ef9fqvsHqVSWIeOQv8=; b=OjYTG1kP2KTgqi/Jqfn2Moa0ByflP1jLMjVRgljk5ONNvYJAiSi+htFU/necj3VpXO5R2axeucn76VTZaTymFQU56u7z7D++CMWDaBdvx71AIN2lSo54hsXejXXdJeC97mIiMyIB8WAmqzVP9HNzh7nR3CuHHbImrJePWDWsUHf2WEdOGSO8TX6Wav9i3Z3Kf3vwymDtPml8KJLaTt0+9rCXr2UHMxcRfdeKu6i0ozwirbU4GYptXQQuSBJIoD6KuWP0XJ0SOz70VVUrZ+o7D/UVXDm+CbTZStJVB2szUQFW3XKQjRfQKcKPw0rd9OzTEz/zIOoyz3SPSeYZeJIk3A== 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 SJ0PR11MB5581.namprd11.prod.outlook.com (2603:10b6:a03:305::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30; Tue, 16 May 2023 21:41:53 +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 21:41:53 +0000 From: "Michael D Kinney" To: "Oram, Isaac W" , "devel@edk2.groups.io" 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+lArq1OIsZ969dMCmQgAAUIACAACmYkA== Date: Tue, 16 May 2023 21:41:53 +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_|SJ0PR11MB5581:EE_ x-ms-office365-filtering-correlation-id: 1f96e7e5-7d55-4096-7788-08db56565d69 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: vuwcxQbLrL78mVh/PM3h7QSuhZ6pgQzXSuaOramx0D4tR4XeoZJewIsmu4gEUKl5LpFQyDz/yJOcz2WNFBXpyGLXHkpORPyqLfDi6jBfANl02PqQ5+Wp6ynoCo5bNgKSrnY6yJLNReG7BRQl1170BcfMCULEd1gE6m95TgcJJ5/W6AiCEglIJLpFNmIjRQ35+O9aJrJr8SJELlGLvwDgZUp37nu2aBI+hZZR4eySbozejG/c02hoC373+ClnMotLcZm32tnvz4leH+aNenaMIUBPb10h3R9GuA6iwAx9IkjrNTDswZj1tGIdPY1RPFDThCD8rsmju+b3LC6SY4vYY1xd8KbGCJ14sLPpvFOm6RSvq1E5UEOauG53gECfk+O/EatKwaG5TpRdOB6BRVhIrWD7i/9TIiIi2KkqikslVXERzvhplpTIT0noC9oFf5Y9B31MiL2IxVN2fSYGQq1nHl4e5ogHvUIARx9Obe4kw1vG8lI+WRZ77wZcMCzp4apOrq0fb1GQ5BpR4Ne2L3gcpI6OzPR7y8aXTlgbdZxFM1ULO80HdKjG+WXJ71rdmo9ZylM9Q8qHJ8F8w//5EjfsKr9WAtD9JhhA44kCuHHqagj7MVhDJ8pddzOcfHnh3wxQ+YJ/qxRPbUK3AngRo08pzQ== 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)(376002)(136003)(346002)(39860400002)(396003)(366004)(451199021)(83380400001)(53546011)(54906003)(966005)(7696005)(26005)(478600001)(110136005)(71200400001)(9686003)(107886003)(6506007)(33656002)(186003)(30864003)(2906002)(38100700002)(38070700005)(5660300002)(4326008)(64756008)(66556008)(52536014)(66446008)(122000001)(76116006)(66946007)(66476007)(41300700001)(82960400001)(8936002)(55016003)(8676002)(86362001)(316002)(66899021);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?4Fn0iWZDHaf+uUiJNYOTTiB25xCF6NMemr4nnGLrGSKnp4EXwDcozInn+lbm?= =?us-ascii?Q?ydfAIHjtShtgRQfqH58le3yx6zV4B/tnPhc0nXIXmEQ59nic7JulGVuQFycU?= =?us-ascii?Q?G2QfR3TQGaM/Fuqs7xMwN9HLq/f0l2vmjeoZIINfC0W15DGL9PjLeb+bbpqh?= =?us-ascii?Q?DONqcGuKQPz+lGyY54y3GvgonqKFmzQ+1Xru24+vq/5+esADWo+fnIhEZrKg?= =?us-ascii?Q?zuAjwmEE7FgbfYh9THI27ZrqeMO30PqSmGS/SJsPncjqxQhfwoz8VkTHUsc4?= =?us-ascii?Q?NQCENmm0cnp57OXO6ww7GtkkgHQhqqByMoW77HUBECI4Agrzok4RLnSOpRl7?= =?us-ascii?Q?Ip9Een6b0XrZLkGoY2o9rVdQWz4qxlwPiV+GARCZskvL8NE6hjbFrMADD6y6?= =?us-ascii?Q?odbiuBaQ6iuhqHLICkHVItJ2CroWIWieAp/Ezn53UGK/17wI5PzhwGJFmTlF?= =?us-ascii?Q?PCEZ72vd47uVSS1aMrsHe97sh3klcBEIPlkOHhLlZW2lFMHH6qyBAAdJMWVZ?= =?us-ascii?Q?VYGlZVWCrN+meStrib9rZJwAgRN2lyWfx+eTX05nw01zf7Iq8LDUtPdd80m4?= =?us-ascii?Q?oKl40AXBg6yV9z6RlbznsUfgWx0E4OyCLLYtXEbg8luAvqNabVbIbrbiv+he?= =?us-ascii?Q?yrMj6KL44TLGVWSbwwNrHaNXlxH3yPawRlePcT7IQfrlxGfn2Q3Z6IjmeNbA?= =?us-ascii?Q?Mf35yLFa9I7hiUHkVOLmIgoZk/DUpSi/3XwxTNExtJzw3zxq9Hra0+BTjnIf?= =?us-ascii?Q?f2ScRZPm/UgMhO7LA4F3K6JfqMJ95cBb5Dd5n7aLVAvzhHmvAeeIwynN6FH0?= =?us-ascii?Q?D3okhaznujTy1mpRXO2v1RhjMBF25M0OPPHxcmsq+oxui/6NsO/4DdMeykKp?= =?us-ascii?Q?fgDqyPOxdMqHhGjQY3ckbvkaawfujlqvU/F0XcJPIhWAS2sWRyJctt7ki+TU?= =?us-ascii?Q?cqPZ7aKiOQp+ptAiY5j0F3uALDyzjfospNorBVpHKfNJ8nIPj6aues6yhbmC?= =?us-ascii?Q?awxGNqqR3+QJ2Ctwdutuwb+yHluVPwhKMPyU83yRA/4R3cwPUEL+5qxm8rus?= =?us-ascii?Q?mxJ/42ydYBfqmWYiNNGwSJiv91sXZWRzyq8RbmiAVTF9Q701xuvs51f7EnD2?= =?us-ascii?Q?Yu519AJqoHSkEpHLISK+WJcF8XtDt3NxFaWrpCWmyZdvooHBw9YEoXNemCg1?= =?us-ascii?Q?3Xh62a6TbKDJSmZmg6Q0m+0t7WqwKJA0zkcF49NM8XRZuE84f6lLItspi8iK?= =?us-ascii?Q?2Di9w1aV4Zo5+eZJLuX+MGELgt/ztPypnEHr693Q0M27QIogP6LWGcXD2yQr?= =?us-ascii?Q?QM5wh/R0BdQMZWEKyjj9BohbjDDQoK9/rKKs6q7sx6JcFtZMkvaWciW+1rD4?= =?us-ascii?Q?nA+1V6CR6gH+q5cNkDNL3FSendANLtALMom/A8HE5DFXF61gqPbXE7Ow+BoL?= =?us-ascii?Q?eALmxtV2oHoi/qWK4ZM/orKvF33rfkIAxZxvGOORkcD6Nibi2xn7G1d4RsVX?= =?us-ascii?Q?icwGdw0xBjyvEKEA6CRKoujFNXnmXHBfkUaCxuBkltydvNTVD0TcOJ509b8c?= =?us-ascii?Q?HZeHGh0q1cbQEjHtvHvJRwV6+RrLI25sKfSaJ05CH2nI0u9g5UK9Jotkj1YW?= =?us-ascii?Q?Sw=3D=3D?= 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: 1f96e7e5-7d55-4096-7788-08db56565d69 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 May 2023 21:41:53.7088 (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: zmxM/KgDSZixwWXT7hNfDsVIfJ/zekYGAFpFxjOVT/cQyp6dd2uxz6PhQLUJQRehgZ44lJekCF/zHQDTsHDg0jIdUh1W1lOnGn++r4pAF/Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5581 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, We do have a standard handler for unexpected exception that dumps all CPU s= tate to serial. UefiCpuPkg\Library\CpuExceptionHandlerLib This seems similar/related use case. Mike > -----Original Message----- > From: Oram, Isaac W > Sent: Tuesday, May 16, 2023 12:12 PM > To: Kinney, Michael D ; devel@edk2.groups.io > 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 > It is sometimes desirable to have debug logging enabled even in productio= n > systems. > But printing to serial ports on an SMI handler is slow, so SMM debug mess= age > printing is typically disabled. > This provides the ability to get the data via serial/BMC/production avail= able > channels. > It should be high performance to add to the memory buffer, though I didn'= t > measure. > It is a one time event to dump on assert. > It could be extended to dump on error codes. Exceptions? > It could be provided as a protocol or such to allow anyone to trigger. >=20 >=20 > I just added the Data logging and connected the serial dump to ASSERT, bu= t > again, this is more an RFC on the general capability of logging strings (= SMRAM > is more plentiful than it once was, so only recording status code and val= ue > seems unnecessarily frugal) and dumping them to serial port. >=20 > I simply wanted to make it available and RFC seemed as good a way to do i= t > as any. If there is a preferred path for such topics, let me know. >=20 > Regards, > Isaac >=20 > -----Original Message----- > From: Kinney, Michael D > Sent: Tuesday, May 16, 2023 11:01 AM > 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 >=20 > Hi Isaac, >=20 > Multiple status code handlers can be registered. One for memory and one = for > serial. >=20 > Why would we mix serial into memory one? >=20 > Mike >=20 > > -----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 > > > > Apologies, this is edk2 scope, not edk2-platforms. > > > > This is an RFC to see if this kind of feature is widely interesting > > and if someone wants to explore this in depth. > > This is not a complete or mature implementation. I didn't fully > > decipher the extended data format. > > > > Regards, > > Isaac > > > > -----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 > > > > 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 > > means to log messages quickly (to memory) and dump them in the event of > an assert. > > > > 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(+) > > > > 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__ > > > > +#include > > + > > /// > > /// Global ID used to identify GUIDed HOBs that start with a > > structure of 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 (UINT= 64)) + > 1]; > > } MEMORY_STATUSCODE_RECORD; > > > > 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 @@ > > > > RUNTIME_MEMORY_STATUSCODE_HEADER > *mMmMemoryStatusCodeTable; > > > > +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_CODE) > > { > > + // > > + // 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]) * CharCoun= t)), > > + " %g", > > + CallerId > > + ); > > + } > > + > > + if (Data !=3D NULL) { > > + CharCount +=3D AsciiSPrint ( > > + &Buffer[CharCount], > > + (sizeof (Buffer) - (sizeof (Buffer[0]) * CharCoun= t)), > > + " %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 > > status code worker > > > > @@ -69,6 +204,9 @@ MemoryStatusCodeReportWorker ( > > ) > > { > > MEMORY_STATUSCODE_RECORD *Record; > > + CHAR8 *Filename; > > + CHAR8 *Description; > > + UINT32 LineNumber; > > > > // > > // 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)); > > > > // > > // If record index equals to max record number, then wrap around > > record index to zero. > > @@ -99,5 +238,65 @@ MemoryStatusCodeReportWorker ( > > mMmMemoryStatusCodeTable->RecordIndex =3D 0; > > } > > > > + if ((Data !=3D NULL) && ReportStatusCodeExtractAssertInfo (CodeType, > > + Value, > > 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 > >