From a9e42d60c8974f1e47ea88e832ec2af9b5907690 Mon Sep 17 00:00:00 2001 From: Oliver Smith-Denny Date: Wed, 8 May 2024 14:40:42 -0700 Subject: [PATCH 1/2] [MERGE ON REBASE] Fix Wrong mMaxAddress Calculation in AdvLogger (#483) ## Description In two places in the Adv Logger v5 update, the incorrect macro was used to calculate mMaxAddress, which led to the log not being fully printed on some architectures. Fixing these leads to the log to be printed. For each item, place an "x" in between `[` and `]` if true. Example: `[x]`. _(you can also check items in the GitHub UI)_ - [x] Impacts functionality? - **Functionality** - Does the change ultimately impact how firmware functions? - Examples: Add a new library, publish a new PPI, update an algorithm, ... - [ ] Impacts security? - **Security** - Does the change have a direct security impact on an application, flow, or firmware? - Examples: Crypto algorithm change, buffer overflow fix, parameter validation improvement, ... - [ ] Breaking change? - **Breaking change** - Will anyone consuming this change experience a break in build or boot behavior? - Examples: Add a new library class, move a module to a different repo, call a function in a new library class in a pre-existing module, ... - [ ] Includes tests? - **Tests** - Does the change include any explicit test code? - Examples: Unit tests, integration tests, robot tests, ... - [ ] Includes documentation? - **Documentation** - Does the change contain explicit documentation additions outside direct code modifications (and comments)? - Examples: Update readme file, add feature readme file, link to documentation on an a separate Web page, ... ## How This Was Tested Tested on a physical platform where this was broken. ## Integration Instructions N/A. On Mu rebase, this commit can be merged with the AdvLogger v5 commit. --- .../Library/AdvancedLoggerLib/DxeCore/AdvancedLoggerLib.c | 2 +- .../AdvancedLoggerWrapper/AdvancedLoggerWrapperTestApp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AdvLoggerPkg/Library/AdvancedLoggerLib/DxeCore/AdvancedLoggerLib.c b/AdvLoggerPkg/Library/AdvancedLoggerLib/DxeCore/AdvancedLoggerLib.c index 12ab33b19c..bce40dc971 100644 --- a/AdvLoggerPkg/Library/AdvancedLoggerLib/DxeCore/AdvancedLoggerLib.c +++ b/AdvLoggerPkg/Library/AdvancedLoggerLib/DxeCore/AdvancedLoggerLib.c @@ -392,7 +392,7 @@ DxeCoreAdvancedLoggerLibConstructor ( LoggerInfo->HdwPortInitialized = TRUE; } - mMaxAddress = TOTAL_LOG_SIZE_WITH_ALI (LoggerInfo); + mMaxAddress = LOG_MAX_ADDRESS (LoggerInfo); mBufferSize = LoggerInfo->LogBufferSize; } else { DEBUG ((DEBUG_ERROR, "%a: Error allocating Advanced Logger Buffer\n", __FUNCTION__)); diff --git a/AdvLoggerPkg/UnitTests/AdvancedLoggerWrapper/AdvancedLoggerWrapperTestApp.c b/AdvLoggerPkg/UnitTests/AdvancedLoggerWrapper/AdvancedLoggerWrapperTestApp.c index 84a45ae230..e1df8bb947 100644 --- a/AdvLoggerPkg/UnitTests/AdvancedLoggerWrapper/AdvancedLoggerWrapperTestApp.c +++ b/AdvLoggerPkg/UnitTests/AdvancedLoggerWrapper/AdvancedLoggerWrapperTestApp.c @@ -179,7 +179,7 @@ InitializeInMemoryLog ( if (!EFI_ERROR (Status)) { mLoggerInfo = LOGGER_INFO_FROM_PROTOCOL (LoggerProtocol); if (mLoggerInfo != NULL) { - mMaxAddress = TOTAL_LOG_SIZE_WITH_ALI (mLoggerInfo); + mMaxAddress = LOG_MAX_ADDRESS (mLoggerInfo); mBufferSize = mLoggerInfo->LogBufferSize; } From 927dbf842988bacb81ff29f662bcbc806df88ce1 Mon Sep 17 00:00:00 2001 From: Oliver Smith-Denny Date: Mon, 13 May 2024 15:13:31 -0700 Subject: [PATCH 2/2] [REBASE ON MERGE] Fix Incorrect mHighAddress Calculation (#484) ## Description Fix an error made in the AdvLogger v5 PR (#471). This is the same fix (but for a different variable name which is why it was mixed on the last fix up) as #483. Usage of mHighAddress (and mMaxAddress) will be evaluated as part of issue #474. - [x] Impacts functionality? - **Functionality** - Does the change ultimately impact how firmware functions? - Examples: Add a new library, publish a new PPI, update an algorithm, ... - [ ] Impacts security? - **Security** - Does the change have a direct security impact on an application, flow, or firmware? - Examples: Crypto algorithm change, buffer overflow fix, parameter validation improvement, ... - [ ] Breaking change? - **Breaking change** - Will anyone consuming this change experience a break in build or boot behavior? - Examples: Add a new library class, move a module to a different repo, call a function in a new library class in a pre-existing module, ... - [ ] Includes tests? - **Tests** - Does the change include any explicit test code? - Examples: Unit tests, integration tests, robot tests, ... - [ ] Includes documentation? - **Documentation** - Does the change contain explicit documentation additions outside direct code modifications (and comments)? - Examples: Update readme file, add feature readme file, link to documentation on an a separate Web page, ... ## How This Was Tested Tested on Q35, LineParserTestApp was failing because of this. ## Integration Instructions N/A for a platform. For the next Mu integration, this should be combined with the Advanced Logger v5 commit be9a3d273ffabebca606266c6cb3a47bbf49c4d5. --- .../Library/AdvancedLoggerAccessLib/AdvancedLoggerAccessLib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AdvLoggerPkg/Library/AdvancedLoggerAccessLib/AdvancedLoggerAccessLib.c b/AdvLoggerPkg/Library/AdvancedLoggerAccessLib/AdvancedLoggerAccessLib.c index 6543466462..893e32256b 100644 --- a/AdvLoggerPkg/Library/AdvancedLoggerAccessLib/AdvancedLoggerAccessLib.c +++ b/AdvLoggerPkg/Library/AdvancedLoggerAccessLib/AdvancedLoggerAccessLib.c @@ -439,7 +439,7 @@ AdvancedLoggerAccessLibUnitTestInitialize ( if (!EFI_ERROR (Status)) { mLoggerInfo = LOGGER_INFO_FROM_PROTOCOL (LoggerProtocol); mLowAddress = PA_FROM_PTR (LOG_BUFFER_FROM_ALI (mLoggerInfo)); - mHighAddress = PA_FROM_PTR (TOTAL_LOG_SIZE_WITH_ALI (mLoggerInfo)); + mHighAddress = PA_FROM_PTR (LOG_MAX_ADDRESS (mLoggerInfo)); } return Status; @@ -466,7 +466,7 @@ AdvancedLoggerAccessLibConstructor ( if (!EFI_ERROR (Status)) { mLoggerInfo = LOGGER_INFO_FROM_PROTOCOL (LoggerProtocol); mLowAddress = PA_FROM_PTR (LOG_BUFFER_FROM_ALI (mLoggerInfo)); - mHighAddress = PA_FROM_PTR (TOTAL_LOG_SIZE_WITH_ALI (mLoggerInfo)); + mHighAddress = PA_FROM_PTR (LOG_MAX_ADDRESS (mLoggerInfo)); // Leave this debug message as ERROR.