From b1f42ea2867dd1081c13eced2919082e56d6757e Mon Sep 17 00:00:00 2001 From: "Project Mu UEFI Bot [bot]" <45776386+uefibot@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:53:43 -0500 Subject: [PATCH 1/4] Repo File Sync: Support CodeQL Plugin in BaseTools (#416) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit synced local file(s) with [microsoft/mu_devops](https://github.com/microsoft/mu_devops). 🤖: View the [Repo File Sync Configuration File](https://github.com/microsoft/mu_devops/blob/main/.sync/Files.yml) to see how files are synced. --- This PR was created automatically by the [repo-file-sync-action](https://github.com/BetaHuhn/repo-file-sync-action) workflow run [#7629520553](https://github.com/microsoft/mu_devops/actions/runs/7629520553) Signed-off-by: Project Mu UEFI Bot --- .github/workflows/codeql.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f526f30a71..fd6c928fe9 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -271,7 +271,9 @@ jobs: from pathlib import Path # Find the plugin directory that contains the CodeQL plugin - plugin_dir = list(Path(os.environ['GITHUB_WORKSPACE']).rglob('.pytool/Plugin/CodeQL')) + plugin_dir = list(Path(os.environ['GITHUB_WORKSPACE']).rglob('BaseTools/Plugin/CodeQL')) + if not plugin_dir: + plugin_dir = list(Path(os.environ['GITHUB_WORKSPACE']).rglob('.pytool/Plugin/CodeQL')) # This should only be found once if len(plugin_dir) == 1: From 966192bed83a6d3cd491e76e862183a6dea1e7d6 Mon Sep 17 00:00:00 2001 From: Joey Vagedes Date: Wed, 24 Jan 2024 09:38:09 -0800 Subject: [PATCH 2/4] Update pip-requirements.txt (#421) ## Description Updates edk2-pytool-extensions and edk2-pytool-library to work with the latest commit of MU_BASECORE For each item, place an "x" in between `[` and `]` if true. Example: `[x]`. _(you can also check items in the GitHub UI)_ - [ ] 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 N/A ## Integration Instructions N/A --- pip-requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pip-requirements.txt b/pip-requirements.txt index 1d06b01ca1..c4fb4ddf3c 100644 --- a/pip-requirements.txt +++ b/pip-requirements.txt @@ -12,8 +12,8 @@ # https://www.python.org/dev/peps/pep-0440/#version-specifiers ## -edk2-pytool-library==0.19.9 -edk2-pytool-extensions==0.26.4 +edk2-pytool-library==0.20.0 +edk2-pytool-extensions==0.27.0 edk2-basetools==0.1.29 antlr4-python3-runtime==4.13.1 regex==2023.12.25 From 08fb6f19afcb4fcb90fc49737304c871d2219073 Mon Sep 17 00:00:00 2001 From: "Project Mu UEFI Bot [bot]" <45776386+uefibot@users.noreply.github.com> Date: Thu, 25 Jan 2024 14:39:31 -0500 Subject: [PATCH 3/4] Repo File Sync: synced file(s) with microsoft/mu_devops (#418) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit synced local file(s) with [microsoft/mu_devops](https://github.com/microsoft/mu_devops). 🤖: View the [Repo File Sync Configuration File](https://github.com/microsoft/mu_devops/blob/main/.sync/Files.yml) to see how files are synced. --- This PR was created automatically by the [repo-file-sync-action](https://github.com/BetaHuhn/repo-file-sync-action) workflow run [#7652167966](https://github.com/microsoft/mu_devops/actions/runs/7652167966) Signed-off-by: Project Mu UEFI Bot --- .github/workflows/codeql.yml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index fd6c928fe9..70e2660a31 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -321,10 +321,32 @@ jobs: if: steps.codeqlcli_cache.outputs.cache-hit != 'true' run: stuart_update -c .pytool/CISettings.py -t DEBUG -a ${{ matrix.archs }} TOOL_CHAIN_TAG=${{ matrix.tool_chain_tag }} --codeql + - name: Find pytool Plugin Directory + id: find_pytool_dir + shell: python + run: | + import os + import sys + from pathlib import Path + + # Find the plugin directory that contains the Compiler plugin + plugin_dir = list(Path(os.environ['GITHUB_WORKSPACE']).rglob('.pytool/Plugin/CompilerPlugin')) + + # This should only be found once + if len(plugin_dir) == 1: + # If the directory is found get the parent Plugin directory + plugin_dir = str(plugin_dir[0].parent) + + with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: + print(f'pytool_plugin_dir={plugin_dir}', file=fh) + else: + print("::error title=Workspace Error!::Failed to find Mu Basecore .pytool/Plugin directory!") + sys.exit(1) + - name: Remove CI Plugins Irrelevant to CodeQL shell: python env: - CODEQL_PLUGIN_DIR: ${{ steps.find_dir.outputs.codeql_plugin_dir }} + PYTOOL_PLUGIN_DIR: ${{ steps.find_pytool_dir.outputs.pytool_plugin_dir }} run: | import os import shutil @@ -333,7 +355,7 @@ jobs: # Only these two plugins are needed for CodeQL plugins_to_keep = ['CodeQL', 'CompilerPlugin'] - plugin_dir = Path(os.environ['CODEQL_PLUGIN_DIR']).parent.absolute() + plugin_dir = Path(os.environ['PYTOOL_PLUGIN_DIR']).absolute() if plugin_dir.is_dir(): for dir in plugin_dir.iterdir(): if str(dir.stem) not in plugins_to_keep: From 833db39436523606d49e985f5dd4e436015e8f53 Mon Sep 17 00:00:00 2001 From: John Schock Date: Thu, 25 Jan 2024 11:47:23 -0800 Subject: [PATCH 4/4] Add call to HdwPortInitialize() when instantiating logger in DXE (#411) ## Description This change adds a call to AdvancedLoggerHdwPortInitialize() when the advanced logger is created in the DxeCoreAdvancedLoggerLibConstructor(). Previously, hardware port was only initalized in AdvancedLoggerGetInfo() if the logging info structure was present at a fixed location or in a HOB; this would cause writes to the hardware port to potentially fail in the path where the logger is not initialized until the Constructor is called. - [x] Impacts functionality? - AdvancedLoggerHdwPortInitialize() is now called in the DxeCoreAdvancedLoggerLibConstructor if the logger is instantiated there. - [ ] Impacts security? - [ ] Breaking change? - [ ] Includes tests? - [ ] Includes documentation? ## How This Was Tested Verified on a platform where this was not working due to missing HdwPort initialization; verified after this patch that it works as expected. ## Integration Instructions N/A --------- Co-authored-by: kuqin12 <42554914+kuqin12@users.noreply.github.com> (cherry picked from commit 6d5e0c5ff29037bbd02f20ccc37e4a25c4b5e806) --- .../AdvancedLoggerLib/DxeCore/AdvancedLoggerLib.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/AdvLoggerPkg/Library/AdvancedLoggerLib/DxeCore/AdvancedLoggerLib.c b/AdvLoggerPkg/Library/AdvancedLoggerLib/DxeCore/AdvancedLoggerLib.c index 1f76d905b0..f85f5edb96 100644 --- a/AdvLoggerPkg/Library/AdvancedLoggerLib/DxeCore/AdvancedLoggerLib.c +++ b/AdvLoggerPkg/Library/AdvancedLoggerLib/DxeCore/AdvancedLoggerLib.c @@ -384,8 +384,13 @@ DxeCoreAdvancedLoggerLibConstructor ( LoggerInfo->LogBufferSize = EFI_PAGES_TO_SIZE (FixedPcdGet32 (PcdAdvancedLoggerPages)) - sizeof (ADVANCED_LOGGER_INFO); LoggerInfo->LogCurrent = LoggerInfo->LogBuffer; LoggerInfo->HwPrintLevel = FixedPcdGet32 (PcdAdvancedLoggerHdwPortDebugPrintErrorLevel); - mMaxAddress = LoggerInfo->LogBuffer + LoggerInfo->LogBufferSize; - mBufferSize = LoggerInfo->LogBufferSize; + if (LoggerInfo->HdwPortInitialized == FALSE) { + AdvancedLoggerHdwPortInitialize (); + LoggerInfo->HdwPortInitialized = TRUE; + } + + mMaxAddress = LoggerInfo->LogBuffer + LoggerInfo->LogBufferSize; + mBufferSize = LoggerInfo->LogBufferSize; } else { DEBUG ((DEBUG_ERROR, "%a: Error allocating Advanced Logger Buffer\n", __FUNCTION__)); }